From 8d6a2dbe255d76d6573809a26c9bc842fd54fee9 Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Thu, 9 Jan 2025 14:16:12 -0500 Subject: [PATCH 01/12] Partial (non-compiling) commit --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 6 +- .../Autosizing/All_Simple_Sizing.cc | 6 +- src/EnergyPlus/Autosizing/Base.cc | 14 +- src/EnergyPlus/Autosizing/Base.hh | 2 +- .../Autosizing/BaseSizerWithScalableInputs.cc | 2 +- .../Autosizing/BaseSizerWithScalableInputs.hh | 4 +- .../Autosizing/CoolingAirFlowSizing.cc | 4 +- .../Autosizing/CoolingCapacitySizing.cc | 22 +- src/EnergyPlus/Autosizing/CoolingSHRSizing.cc | 10 +- .../CoolingWaterDesAirInletHumRatSizing.cc | 2 +- .../CoolingWaterDesAirInletTempSizing.cc | 2 +- .../CoolingWaterDesAirOutletHumRatSizing.cc | 2 +- .../CoolingWaterDesAirOutletTempSizing.cc | 2 +- .../CoolingWaterDesWaterInletTempSizing.cc | 2 +- .../Autosizing/CoolingWaterflowSizing.cc | 14 +- .../Autosizing/HeatingAirFlowSizing.cc | 2 +- .../Autosizing/HeatingCapacitySizing.cc | 12 +- .../HeatingWaterDesAirInletHumRatSizing.cc | 2 +- .../HeatingWaterDesAirInletTempSizing.cc | 2 +- .../HeatingWaterDesCoilLoadUsedForUASizing.cc | 6 +- ...WaterDesCoilWaterVolFlowUsedForUASizing.cc | 4 +- .../Autosizing/HeatingWaterflowSizing.cc | 8 +- .../Autosizing/WaterHeatingCapacitySizing.cc | 2 +- .../Autosizing/WaterHeatingCoilUASizing.cc | 2 +- src/EnergyPlus/Coils/CoilCoolingDX.cc | 43 +- src/EnergyPlus/Coils/CoilCoolingDX.hh | 2 +- src/EnergyPlus/CostEstimateManager.cc | 14 +- src/EnergyPlus/DXCoils.cc | 1024 +++++++++-------- src/EnergyPlus/DXCoils.hh | 22 +- src/EnergyPlus/Data/EnergyPlusData.cc | 6 +- src/EnergyPlus/Data/EnergyPlusData.hh | 2 +- src/EnergyPlus/DataHVACGlobals.cc | 388 +++++-- src/EnergyPlus/DataHVACGlobals.hh | 51 +- src/EnergyPlus/DataHeatBalance.hh | 3 +- src/EnergyPlus/DataSizing.cc | 2 +- src/EnergyPlus/DataSizing.hh | 2 +- src/EnergyPlus/DesiccantDehumidifiers.cc | 115 +- src/EnergyPlus/DesiccantDehumidifiers.hh | 8 +- src/EnergyPlus/FanCoilUnits.cc | 73 +- src/EnergyPlus/FanCoilUnits.hh | 7 +- src/EnergyPlus/GeneralRoutines.cc | 42 + src/EnergyPlus/GeneralRoutines.hh | 13 + src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 28 +- src/EnergyPlus/HVACHXAssistedCoolingCoil.hh | 6 +- src/EnergyPlus/HeatRecovery.hh | 2 +- src/EnergyPlus/ReportCoilSelection.hh | 42 +- src/EnergyPlus/StandardRatings.hh | 6 +- 47 files changed, 1137 insertions(+), 898 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 12cf5a25e10..f9aefdf21f6 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -10521,10 +10521,10 @@ namespace AirflowNetwork { } else { // Replace the convenience function with in-place code std::string mycoil = DisSysCompCoilData(i).name; - auto it = std::find_if(m_state.dataCoilCooingDX->coilCoolingDXs.begin(), - m_state.dataCoilCooingDX->coilCoolingDXs.end(), + auto it = std::find_if(m_state.dataCoilCoolingDX->coilCoolingDXs.begin(), + m_state.dataCoilCoolingDX->coilCoolingDXs.end(), [&mycoil](const CoilCoolingDX &coil) { return coil.name == mycoil; }); - if (it != m_state.dataCoilCooingDX->coilCoolingDXs.end()) { + if (it != m_state.dataCoilCoolingDX->coilCoolingDXs.end()) { // Set the airloop number on the CoilCoolingDX object, which is used to collect the runtime fraction it->airLoopNum = DisSysCompCoilData(i).AirLoopNum; } else { diff --git a/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc b/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc index dc788ade567..0bf2b01a6f3 100644 --- a/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc +++ b/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc @@ -314,7 +314,7 @@ Real64 HeatingCoilDesAirInletTempSizer::size(EnergyPlusData &state, Real64 _orig this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp( - state, this->compName, this->compType, this->autoSizedValue, this->curSysNum, this->curZoneEqNum); + state, this->compName, this->coilType, this->autoSizedValue, this->curSysNum, this->curZoneEqNum); return this->autoSizedValue; } @@ -346,7 +346,7 @@ Real64 HeatingCoilDesAirOutletTempSizer::size(EnergyPlusData &state, Real64 _ori } this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->compType, this->autoSizedValue); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->coilType, this->autoSizedValue); return this->autoSizedValue; } @@ -382,7 +382,7 @@ Real64 HeatingCoilDesAirInletHumRatSizer::size(EnergyPlusData &state, Real64 _or } this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, this->autoSizedValue); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->coilType, this->autoSizedValue); return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/Base.cc b/src/EnergyPlus/Autosizing/Base.cc index 6fa956ffe0c..1617b77cbfd 100644 --- a/src/EnergyPlus/Autosizing/Base.cc +++ b/src/EnergyPlus/Autosizing/Base.cc @@ -571,16 +571,8 @@ void BaseSizer::select2StgDXHumCtrlSizerOutput(EnergyPlusData &state, bool &erro bool BaseSizer::isValidCoilType(std::string const &_compType) { - int coilNum = 0; - for (auto const &coilType : HVAC::cAllCoilTypes) { - coilNum += 1; - if (Util::SameString(_compType, coilType)) { - this->coilType_Num = coilNum; - return true; - } - } - this->coilType_Num = 0; - return false; + this->coilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, _compType)); + return this->coilType != HVAC::CoilType::Invalid; } bool BaseSizer::isValidFanType(std::string const &_compType) @@ -731,7 +723,7 @@ void BaseSizer::clearState() sizingDesValueFromParent = false; airLoopSysFlag = false; oaSysFlag = false; - coilType_Num = 0; + coilType = HVAC::CoilType::Invalid; compType = ""; compName = ""; isEpJSON = false; diff --git a/src/EnergyPlus/Autosizing/Base.hh b/src/EnergyPlus/Autosizing/Base.hh index 969d4945ee0..e84e28204cd 100644 --- a/src/EnergyPlus/Autosizing/Base.hh +++ b/src/EnergyPlus/Autosizing/Base.hh @@ -139,7 +139,7 @@ struct BaseSizer bool sizingDesValueFromParent = false; bool airLoopSysFlag = false; bool oaSysFlag = false; - int coilType_Num = 0; + HVAC::CoilType coilType = HVAC::CoilType::Invalid; std::string compType; std::string compName; bool isEpJSON = false; diff --git a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc index aafda6804f5..f4d0c686b3e 100644 --- a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc +++ b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc @@ -104,7 +104,7 @@ void BaseSizerWithScalableInputs::initializeWithinEP(EnergyPlusData &state, state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( state, this->compName, - this->compType, + this->coilType, state.dataFans->fans(this->primaryAirSystem(this->curSysNum).supFanNum)->Name, state.dataFans->fans(this->primaryAirSystem(this->curSysNum).supFanNum)->type, this->primaryAirSystem(this->curSysNum).supFanNum); diff --git a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh index 94fb0b45ca8..c85358a780e 100644 --- a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh +++ b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh @@ -86,7 +86,7 @@ struct BaseSizerWithScalableInputs : BaseSizerWithFanHeatInputs Real64 suppHeatCap = 0.0; Real64 unitaryHeatCap = 0.0; int dataTotCapCurveIndex = 0; - int dataCoolCoilType = -1; + HVAC::CoilType dataCoolCoilType = HVAC::CoilType::Invalid; // Why the 'data' prefix? int dataCoolCoilIndex = -1; int zoneHVACSizingIndex = 0; @@ -125,7 +125,7 @@ struct BaseSizerWithScalableInputs : BaseSizerWithFanHeatInputs suppHeatCap = 0.0; unitaryHeatCap = 0.0; zoneHVACSizingIndex = 0; - dataCoolCoilType = -1; + dataCoolCoilType = HVAC::CoilType::Invalid; dataCoolCoilIndex = -1; zoneHVACSizing.clear(); } diff --git a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc index fc9b825def6..72d63312355 100644 --- a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc @@ -337,7 +337,7 @@ Real64 CoolingAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, b if (Util::SameString(this->compType, "ZoneHVAC:FourPipeFanCoil")) { this->sizingString = "Maximum Supply Air Flow Rate [m3/s]"; if (this->isEpJSON) this->sizingString = "maximum_supply_air_flow_rate [m3/s]"; - } else if (this->coilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + } else if (this->coilType == HVAC::CoilType::DXCoolingTwoSpeed) { if (this->dataDXSpeedNum == 1) { // mode 1 is high speed in DXCoils loop if (this->isEpJSON) { this->sizingString = "high_speed_rated_air_flow_rate [m3/s]"; @@ -377,7 +377,7 @@ Real64 CoolingAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, b if (this->isCoilReportObject) { // SizingResult is airflow in m3/s state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow( - state, this->compName, this->compType, this->autoSizedValue, this->wasAutoSized); + state, this->compName, this->coilType, this->autoSizedValue, this->wasAutoSized); } if (this->isFanReportObject) { // fill fan peak day and time here diff --git a/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc b/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc index e1adfb828b5..ca088b25e28 100644 --- a/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc @@ -165,7 +165,7 @@ Real64 CoolingCapacitySizer::size(EnergyPlusData &state, Real64 _originalValue, if (DDNum > 0 && TimeStepNumAtMax > 0) { OutTemp = state.dataSize->DesDayWeath(DDNum).Temp(TimeStepNumAtMax); } - if (this->dataCoolCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) { + if (this->dataCoolCoilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { OutTemp = VariableSpeedCoils::GetVSCoilRatedSourceTemp(state, this->dataCoolCoilIndex); } Real64 CoilInEnth = Psychrometrics::PsyHFnTdbW(CoilInTemp, CoilInHumRat); @@ -270,11 +270,11 @@ Real64 CoolingCapacitySizer::size(EnergyPlusData &state, Real64 _originalValue, FanCoolLoad = state.dataSize->DataCoilSizingFanCoolLoad; TotCapTempModFac = state.dataSize->DataCoilSizingCapFT; if (state.dataRptCoilSelection->coilSelectionReportObj->isCompTypeCoil(this->compType)) { - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, CoilInHumRat); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->coilType, CoilInHumRat); state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp( - state, this->compName, this->compType, CoilInTemp, this->curSysNum, this->curZoneEqNum); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->compType, CoilOutTemp); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->compType, CoilOutHumRat); + state, this->compName, this->coilType, CoilInTemp, this->curSysNum, this->curZoneEqNum); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->coilType, CoilOutTemp); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->coilType, CoilOutHumRat); } } else if (this->curOASysNum > 0 && this->outsideAirSys(this->curOASysNum).AirLoopDOASNum > -1) { auto &thisAirloopDOAS = this->airloopDOAS[this->outsideAirSys(this->curOASysNum).AirLoopDOASNum]; @@ -376,7 +376,7 @@ Real64 CoolingCapacitySizer::size(EnergyPlusData &state, Real64 _originalValue, if (this->dataDesInletAirHumRat > 0.0) CoilInHumRat = this->dataDesInletAirHumRat; } Real64 OutTemp = thisFinalSysSizing.OutTempAtCoolPeak; - if (this->dataCoolCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) { + if (this->dataCoolCoilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { OutTemp = VariableSpeedCoils::GetVSCoilRatedSourceTemp(state, this->dataCoolCoilIndex); } CoilOutTemp = min(CoilInTemp, CoilOutTemp); @@ -552,16 +552,16 @@ Real64 CoolingCapacitySizer::size(EnergyPlusData &state, Real64 _originalValue, if (this->isCoilReportObject && this->curSysNum <= state.dataHVACGlobal->NumPrimaryAirSys) { if (CoilInTemp > -999.0) { // set inlet air properties used during capacity sizing if available, allow for negative winter temps state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp( - state, this->compName, this->compType, CoilInTemp, this->curSysNum, this->curZoneEqNum); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, CoilInHumRat); + state, this->compName, this->coilType, CoilInTemp, this->curSysNum, this->curZoneEqNum); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->coilType, CoilInHumRat); } if (CoilOutTemp > -999.0) { // set outlet air properties used during capacity sizing if available - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->compType, CoilOutTemp); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->compType, CoilOutHumRat); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->coilType, CoilOutTemp); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->coilType, CoilOutHumRat); } state.dataRptCoilSelection->coilSelectionReportObj->setCoilCoolingCapacity(state, this->compName, - this->compType, + this->coilType, this->autoSizedValue, this->wasAutoSized, this->curSysNum, diff --git a/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc b/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc index 393940ed423..88eb43f9de9 100644 --- a/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc @@ -101,7 +101,7 @@ Real64 CoolingSHRSizer::size(EnergyPlusData &state, Real64 _originalValue, bool // check that the autosized SHR corresponds to a valid apperatus dew point (ADP) temperature this->autoSizedValue = DXCoils::ValidateADP(state, - this->compType, + this->coilType, this->compName, RatedInletAirTemp, RatedInletAirHumRat, @@ -134,7 +134,7 @@ void CoolingSHRSizer::updateSizingString(EnergyPlusData &state) { if (!overrideSizeString) return; // override sizingString to match existing text - if (this->coilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (this->coilType == HVAC::CoilType::DXCoolingTwoSpeed) { if (this->dataDXSpeedNum == 1) { // mode 1 is high speed in DXCoils loop if (this->isEpJSON) { this->sizingString = "high_speed_rated_sensible_heat_ratio"; @@ -148,19 +148,19 @@ void CoolingSHRSizer::updateSizingString(EnergyPlusData &state) this->sizingString = "Low Speed Gross Rated Sensible Heat Ratio"; } } - } else if (this->coilType_Num == HVAC::CoilDX_MultiSpeedCooling) { + } else if (this->coilType == HVAC::CoilType::DXMultiSpeedCooling) { if (this->isEpJSON) { this->sizingString = fmt::format("speed_{}_rated_sensible_heat_ratio", state.dataSize->DataDXSpeedNum); } else { this->sizingString = fmt::format("Speed {} Rated Sensible Heat Ratio", state.dataSize->DataDXSpeedNum); } - } else if (this->coilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { + } else if (this->coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { if (this->isEpJSON) { this->sizingString = "rated_sensible_heat_ratio"; } else { this->sizingString = "Rated Sensible Heat Ratio"; } - } else if (this->coilType_Num == HVAC::CoilDX_CurveFit_Speed) { + } else if (this->coilType == HVAC::CoilType::DXCurveFitSpeed) { if (this->isEpJSON) { this->sizingString = "gross_sensible_heat_ratio"; } else { diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc index b91823fae1e..f17a38c1e0f 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc @@ -105,7 +105,7 @@ Real64 CoolingWaterDesAirInletHumRatSizer::size(EnergyPlusData &state, Real64 _o } this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, this->autoSizedValue); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->coilType, this->autoSizedValue); return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc index 88b324b5064..bb62821d9be 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc @@ -131,7 +131,7 @@ Real64 CoolingWaterDesAirInletTempSizer::size(EnergyPlusData &state, Real64 _ori if (this->isCoilReportObject) { if (this->curSysNum <= this->numPrimaryAirSys) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp( - state, this->compName, this->compType, this->autoSizedValue, this->curSysNum, this->curZoneEqNum); + state, this->compName, this->coilType, this->autoSizedValue, this->curSysNum, this->curZoneEqNum); } } return this->autoSizedValue; diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc index 9ec2877b7f9..4a655e87c0d 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc @@ -159,7 +159,7 @@ Real64 CoolingWaterDesAirOutletHumRatSizer::size(EnergyPlusData &state, Real64 _ } this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->compType, this->autoSizedValue); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->coilType, this->autoSizedValue); return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc index 346ae5060eb..aff2ab4e9c4 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc @@ -179,7 +179,7 @@ Real64 CoolingWaterDesAirOutletTempSizer::size(EnergyPlusData &state, Real64 _or } this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) { - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->compType, this->autoSizedValue); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->coilType, this->autoSizedValue); } return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc index 4a975f5870c..8543c02f4dc 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc @@ -70,7 +70,7 @@ Real64 CoolingWaterDesWaterInletTempSizer::size(EnergyPlusData &state, Real64 _o } this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp(state, this->compName, this->compType, this->autoSizedValue); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp(state, this->compName, this->coilType, this->autoSizedValue); return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc index 632cc673590..63cfcde0b6a 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc @@ -149,7 +149,7 @@ Real64 CoolingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue, } // override sizing string for detailed coil model if (this->overrideSizeString) { - if (this->coilType_Num == HVAC::Coil_CoolingWaterDetailed) { + if (this->coilType == HVAC::CoilType::CoolingWaterDetailed) { if (this->isEpJSON) { this->sizingString = "maximum_water_flow_rate [m3/s]"; } else { @@ -162,17 +162,17 @@ Real64 CoolingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue, this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterFlowPltSizNum( - state, this->compName, this->compType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizCoolNum, this->dataWaterLoopNum); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterDeltaT(state, this->compName, this->compType, CoilDesWaterDeltaT); + state, this->compName, this->coilType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizCoolNum, this->dataWaterLoopNum); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterDeltaT(state, this->compName, this->coilType, CoilDesWaterDeltaT); if (this->dataDesInletWaterTemp > 0.0) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp( - state, this->compName, this->compType, this->dataDesInletWaterTemp); + state, this->compName, this->coilType, this->dataDesInletWaterTemp); state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgWaterTemp( - state, this->compName, this->compType, this->dataDesInletWaterTemp + CoilDesWaterDeltaT); + state, this->compName, this->coilType, this->dataDesInletWaterTemp + CoilDesWaterDeltaT); } else { - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp(state, this->compName, this->compType, Constant::CWInitConvTemp); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp(state, this->compName, this->coilType, Constant::CWInitConvTemp); state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgWaterTemp( - state, this->compName, this->compType, Constant::CWInitConvTemp + CoilDesWaterDeltaT); + state, this->compName, this->coilType, Constant::CWInitConvTemp + CoilDesWaterDeltaT); } } return this->autoSizedValue; diff --git a/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc b/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc index 582af45ff94..7d13f4c5166 100644 --- a/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc @@ -279,7 +279,7 @@ Real64 HeatingAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, b if (this->isCoilReportObject) { // SizingResult is airflow in m3/s state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow( - state, this->compName, this->compType, this->autoSizedValue, this->wasAutoSized); + state, this->compName, this->coilType, this->autoSizedValue, this->wasAutoSized); } if (this->isFanReportObject) { // fill fan peak day and time here diff --git a/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc b/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc index e9b09692fbb..09c01a99e4e 100644 --- a/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc @@ -450,19 +450,19 @@ Real64 HeatingCapacitySizer::size(EnergyPlusData &state, Real64 _originalValue, if (this->isCoilReportObject) { if (CoilInTemp > -999.0) { // set inlet air properties used during capacity sizing if available, allow for negative winter temps state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp( - state, this->compName, this->compType, CoilInTemp, this->curSysNum, this->curZoneEqNum); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, CoilInHumRat); + state, this->compName, this->coilType, CoilInTemp, this->curSysNum, this->curZoneEqNum); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->coilType, CoilInHumRat); } if (CoilOutTemp > -999.0) { // set outlet air properties used during capacity sizing if available - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->compType, CoilOutTemp); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->compType, CoilOutHumRat); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->coilType, CoilOutTemp); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->coilType, CoilOutHumRat); } - state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow(state, this->compName, this->compType, DesVolFlow, this->wasAutoSized); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow(state, this->compName, this->coilType, DesVolFlow, this->wasAutoSized); Real64 constexpr FanCoolLoad = 0.0; Real64 constexpr TotCapTempModFac = 1.0; state.dataRptCoilSelection->coilSelectionReportObj->setCoilHeatingCapacity(state, this->compName, - this->compType, + this->coilType, this->autoSizedValue, this->wasAutoSized, this->curSysNum, diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc index 5da9ab78fc8..c92c9451148 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc @@ -115,7 +115,7 @@ Real64 HeatingWaterDesAirInletHumRatSizer::size(EnergyPlusData &state, Real64 _o } this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, this->autoSizedValue); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->coilType, this->autoSizedValue); return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc index 952c440acc4..6e58a88a1ec 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc @@ -125,7 +125,7 @@ Real64 HeatingWaterDesAirInletTempSizer::size(EnergyPlusData &state, Real64 _ori if (this->curSysNum <= this->numPrimaryAirSys) { if (this->isCoilReportObject) state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp( - state, this->compName, this->compType, this->autoSizedValue, this->curSysNum, this->curZoneEqNum); + state, this->compName, this->coilType, this->autoSizedValue, this->curSysNum, this->curZoneEqNum); } return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc index 01b0f62484f..79fc55c0f5f 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc @@ -80,7 +80,7 @@ Real64 HeatingWaterDesCoilLoadUsedForUASizer::size(EnergyPlusData &state, Real64 state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, this->callingRoutine); this->autoSizedValue = this->dataWaterFlowUsedForSizing * this->dataWaterCoilSizHeatDeltaT * Cp * rho; - state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->compType, 1.0); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->coilType, 1.0); } else if ((this->termUnitPIU || this->termUnitIU) && (this->curTermUnitSizingNum > 0)) { Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, @@ -106,7 +106,7 @@ Real64 HeatingWaterDesCoilLoadUsedForUASizer::size(EnergyPlusData &state, Real64 state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, this->callingRoutine); this->autoSizedValue = this->dataWaterFlowUsedForSizing * this->dataWaterCoilSizHeatDeltaT * Cp * rho; - state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->compType, 1.0); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->coilType, 1.0); } else { Real64 DesMassFlow = 0.0; if (this->zoneEqSizing(this->curZoneEqNum).SystemAirFlow) { @@ -198,7 +198,7 @@ Real64 HeatingWaterDesCoilLoadUsedForUASizer::size(EnergyPlusData &state, Real64 Real64 constexpr DXFlowPerCapMaxRatio = 1.0; state.dataRptCoilSelection->coilSelectionReportObj->setCoilHeatingCapacity(state, this->compName, - this->compType, + this->coilType, this->autoSizedValue, this->wasAutoSized, this->curSysNum, diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc index 857aef7f562..3ef90c5146b 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc @@ -82,9 +82,9 @@ Real64 HeatingWaterDesCoilWaterVolFlowUsedForUASizer::size(EnergyPlusData &state this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterFlowPltSizNum( - state, this->compName, this->compType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizHeatNum, this->dataWaterLoopNum); + state, this->compName, this->coilType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizHeatNum, this->dataWaterLoopNum); if (this->termUnitSingDuct || this->zoneEqFanCoil || ((this->termUnitPIU || this->termUnitIU) && this->curTermUnitSizingNum > 0)) { - state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->compType, 1.0); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->coilType, 1.0); } } return this->autoSizedValue; diff --git a/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc index 3cbbc559d06..31de38dd4ec 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc @@ -156,13 +156,13 @@ Real64 HeatingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue, this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterFlowPltSizNum( - state, this->compName, this->compType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizHeatNum, this->dataWaterLoopNum); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp(state, this->compName, this->compType, Constant::HWInitConvTemp); + state, this->compName, this->coilType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizHeatNum, this->dataWaterLoopNum); + state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp(state, this->compName, this->coilType, Constant::HWInitConvTemp); if (this->plantSizData.size() > 0 && this->dataPltSizHeatNum > 0) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterDeltaT( - state, this->compName, this->compType, this->plantSizData(this->dataPltSizHeatNum).DeltaT); + state, this->compName, this->coilType, this->plantSizData(this->dataPltSizHeatNum).DeltaT); state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgWaterTemp( - state, this->compName, this->compType, Constant::HWInitConvTemp - this->plantSizData(this->dataPltSizHeatNum).DeltaT); + state, this->compName, this->coilType, Constant::HWInitConvTemp - this->plantSizData(this->dataPltSizHeatNum).DeltaT); } } return this->autoSizedValue; diff --git a/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc b/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc index 4a185e17550..502b6567f66 100644 --- a/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc +++ b/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc @@ -161,7 +161,7 @@ Real64 WaterHeatingCapacitySizer::size(EnergyPlusData &state, Real64 _originalVa this->selectSizerOutput(state, errorsFound); if (this->isCoilReportObject) state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterHeaterCapacityPltSizNum( - state, this->compName, this->compType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizHeatNum, this->dataWaterLoopNum); + state, this->compName, this->coilType, this->autoSizedValue, this->wasAutoSized, this->dataPltSizHeatNum, this->dataWaterLoopNum); return this->autoSizedValue; } diff --git a/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc b/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc index 3a5a60cbaec..3b8a7dcfe06 100644 --- a/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc +++ b/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc @@ -393,7 +393,7 @@ Real64 WaterHeatingCoilUASizer::size(EnergyPlusData &state, Real64 _originalValu if (this->isCoilReportObject && this->curSysNum <= state.dataHVACGlobal->NumPrimaryAirSys) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilUA(state, this->compName, - this->compType, + this->coilType, this->autoSizedValue, this->dataCapacityUsedForSizing, this->wasAutoSized, diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index dd975cdfb6d..020f239c57a 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -76,13 +76,13 @@ using namespace EnergyPlus; int CoilCoolingDX::factory(EnergyPlus::EnergyPlusData &state, std::string const &coilName) { - if (state.dataCoilCooingDX->coilCoolingDXGetInputFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXGetInputFlag) { CoilCoolingDX::getInput(state); - state.dataCoilCooingDX->coilCoolingDXGetInputFlag = false; + state.dataCoilCoolingDX->coilCoolingDXGetInputFlag = false; } int handle = -1; std::string coilNameUpper = Util::makeUPPER(coilName); - for (auto const &thisCoil : state.dataCoilCooingDX->coilCoolingDXs) { + for (auto const &thisCoil : state.dataCoilCoolingDX->coilCoolingDXs) { handle++; if (coilNameUpper == Util::makeUPPER(thisCoil.name)) { return handle; @@ -94,7 +94,7 @@ int CoilCoolingDX::factory(EnergyPlus::EnergyPlusData &state, std::string const void CoilCoolingDX::getInput(EnergyPlusData &state) { - int numCoolingCoilDXs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataCoilCooingDX->coilCoolingDXObjectName); + int numCoolingCoilDXs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType]); if (numCoolingCoilDXs <= 0) { ShowFatalError(state, R"(No "Coil:Cooling:DX" objects in input file)"); } @@ -103,7 +103,7 @@ void CoilCoolingDX::getInput(EnergyPlusData &state) int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataCoilCooingDX->coilCoolingDXObjectName, + HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType], coilNum, state.dataIPShortCut->cAlphaArgs, NumAlphas, @@ -123,20 +123,22 @@ void CoilCoolingDX::getInput(EnergyPlusData &state) input_specs.evaporative_condenser_supply_water_storage_tank_name = state.dataIPShortCut->cAlphaArgs(10); CoilCoolingDX thisCoil; thisCoil.instantiateFromInputSpec(state, input_specs); - state.dataCoilCooingDX->coilCoolingDXs.push_back(thisCoil); + state.dataCoilCoolingDX->coilCoolingDXs.push_back(thisCoil); } } void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXInputSpecification &input_data) { static constexpr std::string_view routineName("CoilCoolingDX::instantiateFromInputSpec: "); - this->original_input_specs = input_data; + + ErrorObjectHeader eoh{routineName, HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType], input_data.name}; + this->original_input_specs = input_data; bool errorsFound = false; this->name = input_data.name; // initialize reclaim heat parameters this->reclaimHeat.Name = this->name; - this->reclaimHeat.SourceType = state.dataCoilCooingDX->coilCoolingDXObjectName; + this->reclaimHeat.coilType = state.dataCoilCoolingDX->coilType; this->performance = CoilCoolingDXCurveFitPerformance(state, input_data.performance_object_name); @@ -189,7 +191,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo if (!input_data.condensate_collection_water_storage_tank_name.empty()) { WaterManager::SetupTankSupplyComponent(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType], input_data.condensate_collection_water_storage_tank_name, errorsFound, this->condensateTankIndex, @@ -199,7 +201,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo if (!input_data.evaporative_condenser_supply_water_storage_tank_name.empty()) { WaterManager::SetupTankDemandComponent(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType], // Can this be more than coils? input_data.evaporative_condenser_supply_water_storage_tank_name, errorsFound, this->evaporativeCondSupplyTankIndex, @@ -213,8 +215,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo } if (this->availScheduleIndex == 0) { - ShowSevereError(state, std::string{routineName} + state.dataCoilCooingDX->coilCoolingDXObjectName + "=\"" + this->name + "\", invalid"); - ShowContinueError(state, "...Availability Schedule Name=\"" + input_data.availability_schedule_name + "\"."); + ShowSevereItemNotFound(state, eoh, "availability_schedule_name", input_data.availability_schedule_name); errorsFound = true; } @@ -224,7 +225,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo } BranchNodeConnections::TestCompSet(state, - state.dataCoilCooingDX->coilCoolingDXObjectName, + HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType], this->name, input_data.evaporator_inlet_node_name, input_data.evaporator_outlet_node_name, @@ -232,8 +233,8 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo if (errorsFound) { ShowFatalError(state, - std::string{routineName} + "Errors found in getting " + state.dataCoilCooingDX->coilCoolingDXObjectName + - " input. Preceding condition(s) causes termination."); + format("{}: Errors found in getting {} input. Preceding conditions causes termination.", + HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType])); } } @@ -805,7 +806,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, ratedSensCap = this->performance.normalMode.ratedGrossTotalCap * this->normModeNomSpeed().grossRatedSHR; state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilType, this->performance.normalMode.ratedGrossTotalCap, ratedSensCap, this->performance.normalMode.ratedEvapAirFlowRate, @@ -816,7 +817,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, if (this->supplyFanIndex > 0) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilType, state.dataFans->fans(this->supplyFanIndex)->Name, state.dataFans->fans(this->supplyFanIndex)->type, this->supplyFanIndex); @@ -903,7 +904,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, state, dummyEvapOutlet.Temp, dummyEvapOutlet.HumRat, DataEnvironment::StdPressureSeaLevel, "Coil:Cooling:DX::simulate"); state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilType, coolingRate, sensCoolingRate, ratedInletEvapMassFlowRate, @@ -987,7 +988,7 @@ void PopulateCoolingCoilStandardRatingInformation(InputOutputFile &eio, void CoilCoolingDX::reportAllStandardRatings(EnergyPlusData &state) { - if (!state.dataCoilCooingDX->coilCoolingDXs.empty()) { + if (!state.dataCoilCoolingDX->coilCoolingDXs.empty()) { Real64 constexpr ConvFromSIToIP(3.412141633); // Conversion from SI to IP [3.412 Btu/hr-W] if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag) { static constexpr std::string_view Format_994( @@ -998,7 +999,7 @@ void CoilCoolingDX::reportAllStandardRatings(EnergyPlusData &state) print(state.files.eio, "{}\n", Format_994); state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag = false; } - for (auto &coil : state.dataCoilCooingDX->coilCoolingDXs) { + for (auto &coil : state.dataCoilCoolingDX->coilCoolingDXs) { coil.performance.calcStandardRatings210240(state); PopulateCoolingCoilStandardRatingInformation(state.files.eio, coil.name, @@ -1141,5 +1142,5 @@ void CoilCoolingDX::reportAllStandardRatings(EnergyPlusData &state) "4 - Value for the Full Speed of the coil."); } } - state.dataCoilCooingDX->stillNeedToReportStandardRatings = false; + state.dataCoilCoolingDX->stillNeedToReportStandardRatings = false; } diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.hh b/src/EnergyPlus/Coils/CoilCoolingDX.hh index 73df3f109c0..dbeb9db252d 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDX.hh @@ -179,7 +179,7 @@ struct CoilCoolingDXData : BaseGlobalStruct { std::vector coilCoolingDXs; bool coilCoolingDXGetInputFlag = true; - std::string const coilCoolingDXObjectName = "Coil:Cooling:DX"; + HVAC::CoilType coilType = HVAC::CoilType::DXCooling; // Why is this a state variable and not an object member variable? bool stillNeedToReportStandardRatings = true; // standard ratings flag for all coils to report at the same time void init_state([[maybe_unused]] EnergyPlusData &state) override { diff --git a/src/EnergyPlus/CostEstimateManager.cc b/src/EnergyPlus/CostEstimateManager.cc index 9025dd4e95f..fea2c41eee9 100644 --- a/src/EnergyPlus/CostEstimateManager.cc +++ b/src/EnergyPlus/CostEstimateManager.cc @@ -718,7 +718,7 @@ namespace CostEstimateManager { // Input validation happens before we get to this point // The factory throws a severe error when the coil is not found // Finding the coil like this here to protects against another SevereError being thrown out of context - auto &v = state.dataCoilCooingDX->coilCoolingDXs; + auto &v = state.dataCoilCoolingDX->coilCoolingDXs; auto isInCoils = [&parentObjName](const CoilCoolingDX &coil) { return coil.name == parentObjName; }; auto it = std::find_if(v.begin(), v.end(), isInCoils); if (it != v.end()) { @@ -730,7 +730,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : state.dataCoilCooingDX->coilCoolingDXs) + for (auto const &e : state.dataCoilCoolingDX->coilCoolingDXs) Qty += e.performance.normalMode.ratedGrossTotalCap; state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot cool cap.)"; @@ -740,7 +740,7 @@ namespace CostEstimateManager { } if (coilFound) { state.dataCostEstimateManager->CostLineItem(Item).Qty = - state.dataCoilCooingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; + state.dataCoilCoolingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot cool cap.)"; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = @@ -750,7 +750,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerEach > 0.0) { if (WildcardObjNames) - state.dataCostEstimateManager->CostLineItem(Item).Qty = double(state.dataCoilCooingDX->coilCoolingDXs.size()); + state.dataCostEstimateManager->CostLineItem(Item).Qty = double(state.dataCoilCoolingDX->coilCoolingDXs.size()); if (coilFound) state.dataCostEstimateManager->CostLineItem(Item).Qty = 1.0; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerEach; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = @@ -761,7 +761,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : state.dataCoilCooingDX->coilCoolingDXs) { + for (auto const &e : state.dataCoilCoolingDX->coilCoolingDXs) { auto const &maxSpeed = e.performance.normalMode.speeds.back(); Real64 COP = maxSpeed.original_input_specs.gross_rated_cooling_COP; Qty += COP * e.performance.normalMode.ratedGrossTotalCap; @@ -773,10 +773,10 @@ namespace CostEstimateManager { state.dataCostEstimateManager->CostLineItem(Item).Qty * state.dataCostEstimateManager->CostLineItem(Item).ValuePer; } if (coilFound) { - auto const &maxSpeed = state.dataCoilCooingDX->coilCoolingDXs[thisCoil].performance.normalMode.speeds.back(); + auto const &maxSpeed = state.dataCoilCoolingDX->coilCoolingDXs[thisCoil].performance.normalMode.speeds.back(); Real64 COP = maxSpeed.original_input_specs.gross_rated_cooling_COP; state.dataCostEstimateManager->CostLineItem(Item).Qty = - COP * state.dataCoilCooingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; + COP * state.dataCoilCoolingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW*COP (total, rated) "; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 05dab5bf21a..b2b4c26355a 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -206,39 +206,46 @@ void SimDXCoil(EnergyPlusData &state, InitDXCoil(state, DXCoilNum); // Select the correct unit type - switch (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num) { // Autodesk:OPTIONAL PartLoadRatio, MaxCap used in this block without PRESENT check - case HVAC::CoilDX_CoolingSingleSpeed: { + switch (state.dataDXCoils->DXCoil(DXCoilNum).coilType) { // Autodesk:OPTIONAL PartLoadRatio, MaxCap used in this block without PRESENT check + case HVAC::CoilType::DXCoolingSingleSpeed: { if (present(CoilCoolingHeatingPLRRatio)) { CalcDoe2DXCoil(state, DXCoilNum, compressorOp, FirstHVACIteration, PartLoadRatio, fanOp, _, AirFlowRatio, CoilCoolingHeatingPLRRatio); } else { CalcDoe2DXCoil(state, DXCoilNum, compressorOp, FirstHVACIteration, PartLoadRatio, fanOp, _, AirFlowRatio); } } break; - case HVAC::CoilDX_HeatingEmpirical: { + + case HVAC::CoilType::DXHeatingEmpirical: { CalcDXHeatingCoil(state, DXCoilNum, PartLoadRatio, fanOp, AirFlowRatio); } break; - case HVAC::CoilDX_HeatPumpWaterHeaterPumped: - case HVAC::CoilDX_HeatPumpWaterHeaterWrapped: { + + case HVAC::CoilType::DXHeatPumpWaterHeaterPumped: + case HVAC::CoilType::DXHeatPumpWaterHeaterWrapped: { // call the HPWHDXCoil routine to calculate water side performance set up the DX coil info for air-side calcs CalcHPWHDXCoil(state, DXCoilNum, PartLoadRatio); // CALL CalcDoe2DXCoil(state, DXCoilNum, compressorOp, FirstHVACIteration,PartLoadRatio), perform air-side calculations CalcDoe2DXCoil(state, DXCoilNum, HVAC::CompressorOp::On, FirstHVACIteration, PartLoadRatio, fanOp); } break; - case HVAC::CoilVRF_Cooling: { + + case HVAC::CoilType::VRFCooling: { CalcVRFCoolingCoil(state, DXCoilNum, HVAC::CompressorOp::On, FirstHVACIteration, PartLoadRatio, fanOp, CompCycRatio, _, AirFlowRatio, MaxCap); } break; - case HVAC::CoilVRF_Heating: { + + case HVAC::CoilType::VRFHeating: { CalcDXHeatingCoil(state, DXCoilNum, PartLoadRatio, fanOp, AirFlowRatio, MaxCap); } break; - case HVAC::CoilVRF_FluidTCtrl_Cooling: { + + case HVAC::CoilType::VRFFluidTCtrlCooling: { CalcVRFCoolingCoil_FluidTCtrl(state, DXCoilNum, HVAC::CompressorOp::On, FirstHVACIteration, PartLoadRatio, fanOp, CompCycRatio, _, _, MaxCap); } break; - case HVAC::CoilVRF_FluidTCtrl_Heating: { + + case HVAC::CoilType::VRFFluidTCtrlHeating: { CalcVRFHeatingCoil_FluidTCtrl(state, compressorOp, DXCoilNum, PartLoadRatio, fanOp, _, MaxCap); } break; + default: { ShowSevereError(state, format("Error detected in DX Coil={}", CompName)); - ShowContinueError(state, format("Invalid DX Coil Type={}", state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType)); + ShowContinueError(state, format("Invalid DX Coil Type={}", HVAC::coilTypeNamesUC[(int)state.dataDXCoils->DXCoil(DXCoilNum).coilType])); ShowFatalError(state, "Preceding condition causes termination."); } break; } @@ -327,11 +334,13 @@ void SimDXCoilMultiSpeed(EnergyPlusData &state, InitDXCoil(state, DXCoilNum); // Select the correct unit type - switch (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num) { - case HVAC::CoilDX_CoolingTwoSpeed: { + switch (state.dataDXCoils->DXCoil(DXCoilNum).coilType) { + + case HVAC::CoilType::DXCoolingTwoSpeed: { CalcMultiSpeedDXCoil(state, DXCoilNum, SpeedRatio, CycRatio); } break; - case HVAC::CoilDX_MultiSpeedCooling: { + + case HVAC::CoilType::DXMultiSpeedCooling: { if (present(SpeedNum)) CalcMultiSpeedDXCoilCooling(state, DXCoilNum, @@ -343,7 +352,8 @@ void SimDXCoilMultiSpeed(EnergyPlusData &state, SingleModeOper); // Autodesk:OPTIONAL fanOp, CompressorOp used without PRESENT check } break; - case HVAC::CoilDX_MultiSpeedHeating: { + + case HVAC::CoilType::DXMultiSpeedHeating: { if (present(SpeedNum)) CalcMultiSpeedDXCoilHeating(state, DXCoilNum, @@ -356,7 +366,7 @@ void SimDXCoilMultiSpeed(EnergyPlusData &state, } break; default: { ShowSevereError(state, format("Error detected in DX Coil={}", CompName)); - ShowContinueError(state, format("Invalid DX Coil Type={}", state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType)); + ShowContinueError(state, format("Invalid DX Coil Type={}", HVAC::coilTypeNamesUC[(int)state.dataDXCoils->DXCoil(DXCoilNum).coilType])); ShowFatalError(state, "Preceding condition causes termination."); } break; } @@ -473,7 +483,7 @@ void SimDXCoilMultiMode(EnergyPlusData &state, auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); // Select the correct unit type - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { // Initialize local variables S1RuntimeFraction = 0.0; S1OutletAirEnthalpy = thisDXCoil.InletAirEnthalpy; @@ -502,7 +512,7 @@ void SimDXCoilMultiMode(EnergyPlusData &state, thisDXCoil.DehumidificationMode = DehumidMode; if ((int)DehumidMode > thisDXCoil.NumDehumidModes) { ShowFatalError(state, - format("{} \"{}\" - Requested enhanced dehumidification mode not available.", thisDXCoil.DXCoilType, thisDXCoil.Name)); + format("{} \"{}\" - Requested enhanced dehumidification mode not available.", HVAC::coilTypeNamesUC[(int)thisDXCoil.coilType], thisDXCoil.Name)); } // If a single-stage coil OR If part load is zero, @@ -680,7 +690,7 @@ void SimDXCoilMultiMode(EnergyPlusData &state, CalcBasinHeaterPowerForMultiModeDXCoil(state, DXCoilNum, DehumidMode); } else { ShowSevereError(state, format("Error detected in DX Coil={}", CompName)); - ShowContinueError(state, format("Invalid DX Coil Type={}", thisDXCoil.DXCoilType)); + ShowContinueError(state, format("Invalid DX Coil Type={}", HVAC::coilTypeNamesUC[(int)thisDXCoil.coilType])); ShowFatalError(state, "Preceding condition causes termination."); } @@ -780,19 +790,19 @@ void GetDXCoils(EnergyPlusData &state) state.dataDXCoils->NumDXMulModeCoils = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:TwoStageWithHumidityControlMode"); state.dataDXCoils->NumDXHeatPumpWaterHeaterPumpedCoils = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterPumped)); + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::coilTypeNames[(int)HVAC::CoilType::DXHeatPumpWaterHeaterPumped]); state.dataDXCoils->NumDXHeatPumpWaterHeaterWrappedCoils = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterWrapped)); + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::coilTypeNames[(int)HVAC::CoilType::DXHeatPumpWaterHeaterWrapped]); state.dataDXCoils->NumDXMulSpeedCoolCoils = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:MultiSpeed"); state.dataDXCoils->NumDXMulSpeedHeatCoils = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Coil:Heating:DX:MultiSpeed"); state.dataDXCoils->NumVRFCoolingCoils = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling)); + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFCooling]); state.dataDXCoils->NumVRFHeatingCoils = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating)); + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFHeating]); state.dataDXCoils->NumVRFCoolingFluidTCtrlCoils = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling)); + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFFluidTCtrlCooling]); state.dataDXCoils->NumVRFHeatingFluidTCtrlCoils = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating)); + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFFluidTCtrlHeating]); state.dataDXCoils->NumDXCoils = state.dataDXCoils->NumDoe2DXCoils + state.dataDXCoils->NumDXHeatingCoils + state.dataDXCoils->NumDXMulSpeedCoils + state.dataDXCoils->NumDXMulModeCoils + state.dataDXCoils->NumDXHeatPumpWaterHeaterPumpedCoils + @@ -816,11 +826,11 @@ void GetDXCoils(EnergyPlusData &state) MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( - state, HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterPumped), TotalArgs, NumAlphas, NumNumbers); + state, HVAC::coilTypeNames[(int)HVAC::CoilType::DXHeatPumpWaterHeaterPumped], TotalArgs, NumAlphas, NumNumbers); MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( - state, HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterWrapped), TotalArgs, NumAlphas, NumNumbers); + state, HVAC::coilTypeNames[(int)HVAC::CoilType::DXHeatPumpWaterHeaterWrapped], TotalArgs, NumAlphas, NumNumbers); MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Coil:Cooling:DX:MultiSpeed", TotalArgs, NumAlphas, NumNumbers); @@ -830,19 +840,19 @@ void GetDXCoils(EnergyPlusData &state) MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( - state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling), TotalArgs, NumAlphas, NumNumbers); + state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFCooling], TotalArgs, NumAlphas, NumNumbers); MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( - state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating), TotalArgs, NumAlphas, NumNumbers); + state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFHeating], TotalArgs, NumAlphas, NumNumbers); MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( - state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling), TotalArgs, NumAlphas, NumNumbers); + state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFFluidTCtrlCooling], TotalArgs, NumAlphas, NumNumbers); MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( - state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating), TotalArgs, NumAlphas, NumNumbers); + state, HVAC::coilTypeNames[(int)HVAC::CoilType::VRFFluidTCtrlHeating], TotalArgs, NumAlphas, NumNumbers); MaxNumbers = max(MaxNumbers, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "CoilPerformance:DX:Cooling", TotalArgs, NumAlphas, NumNumbers); @@ -924,9 +934,8 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_CoolingSingleSpeed; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXCoolingSingleSpeed; + thisDXCoil.coilType = HVAC::CoilType::DXCoolingSingleSpeed; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -1409,9 +1418,8 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_CoolingTwoStageWHumControl; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXCoolingTwoStageWHumControl; + thisDXCoil.coilType = HVAC::CoilType::DXCoolingTwoStageWHumControl; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -1508,16 +1516,15 @@ void GetDXCoils(EnergyPlusData &state) PerfObjectType = Alphas(AlphaIndex); PerfObjectName = Alphas(AlphaIndex + 1); PerfModeNum = DehumidModeNum * 2 + CapacityStageNum; - thisDXCoil.CoilPerformanceType(PerfModeNum) = PerfObjectType; if (Util::SameString(PerfObjectType, "CoilPerformance:DX:Cooling")) { - thisDXCoil.CoilPerformanceType_Num(PerfModeNum) = HVAC::CoilPerfDX_CoolBypassEmpirical; + thisDXCoil.coilPerformanceTypes(PerfModeNum) = HVAC::CoilType::DXCooling; } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); ShowContinueError(state, format("...illegal {}=\"{}\".", cAlphaFields(AlphaIndex), PerfObjectType)); ShowContinueError(state, "Must be \"CoilPerformance:DX:Cooling\"."); ErrorsFound = true; } - thisDXCoil.CoilPerformanceName(PerfModeNum) = PerfObjectName; + thisDXCoil.coilPerformanceNames(PerfModeNum) = PerfObjectName; // Get for CoilPerformance object PerfObjectNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, PerfObjectType, PerfObjectName); if (PerfObjectNum > 0) { @@ -1971,8 +1978,7 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); thisDXCoil.Name = Alphas(1); - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_HeatingEmpirical; + thisDXCoil.coilType = HVAC::CoilType::DXHeatingEmpirical; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -2437,9 +2443,8 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_CoolingTwoSpeed; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXCoolingTwoSpeed; + thisDXCoil.coilType = HVAC::CoilType::DXCoolingTwoSpeed; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -2985,7 +2990,7 @@ void GetDXCoils(EnergyPlusData &state) } // Loop over the Pumped DX Water Heater Coils and get & load the data - CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterPumped); + CurrentModuleObject = HVAC::coilTypeNames[(int)HVAC::CoilType::DXHeatPumpWaterHeaterPumped]; for (DXHPWaterHeaterCoilNum = 1; DXHPWaterHeaterCoilNum <= state.dataDXCoils->NumDXHeatPumpWaterHeaterPumpedCoils; ++DXHPWaterHeaterCoilNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -3012,8 +3017,7 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); thisDXCoil.Name = Alphas(1); - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_HeatPumpWaterHeaterPumped; + thisDXCoil.coilType = HVAC::CoilType::DXHeatPumpWaterHeaterPumped; thisDXCoil.SchedPtr = 0; // heat pump water heater DX coil has no schedule // Store the HPWH DX coil heating capacity in RatedTotCap2. After backing off pump and fan heat, @@ -3478,7 +3482,7 @@ void GetDXCoils(EnergyPlusData &state) format("{}Errors found in getting {} input. Preceding condition(s) causes termination.", RoutineName, CurrentModuleObject)); } // Loop over the Wrapped DX Water Heater Coils and get & load the data - CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterWrapped); + CurrentModuleObject = HVAC::coilTypeNames[(int)HVAC::CoilType::DXHeatPumpWaterHeaterWrapped]; for (DXHPWaterHeaterCoilNum = 1; DXHPWaterHeaterCoilNum <= state.dataDXCoils->NumDXHeatPumpWaterHeaterWrappedCoils; ++DXHPWaterHeaterCoilNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -3505,8 +3509,7 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); thisDXCoil.Name = Alphas(1); - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_HeatPumpWaterHeaterWrapped; + thisDXCoil.coilType = HVAC::CoilType::DXHeatPumpWaterHeaterWrapped; thisDXCoil.SchedPtr = 0; // heat pump water heater DX coil has no schedule // Store the HPWH DX coil heating capacity in RatedTotCap2. After backing off pump and fan heat, @@ -3901,9 +3904,8 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedCooling; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXMultiSpeedCooling; + thisDXCoil.coilType = HVAC::CoilType::DXMultiSpeedCooling; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -4451,9 +4453,8 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedHeating; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXMultiSpeedHeating; + thisDXCoil.coilType = HVAC::CoilType::DXMultiSpeedHeating; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -4915,7 +4916,7 @@ void GetDXCoils(EnergyPlusData &state) } // Loop over the VRF Cooling Coils and get & load the data - CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling); + CurrentModuleObject = HVAC::coilTypeNames[(int)HVAC::CoilType::VRFCooling]; for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFCoolingCoils; ++DXCoilIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -4942,8 +4943,7 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); thisDXCoil.Name = Alphas(1); - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_Cooling; + thisDXCoil.coilType = HVAC::CoilType::VRFCooling; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -5059,7 +5059,7 @@ void GetDXCoils(EnergyPlusData &state) } // Loop over the VRF Heating Coils and get & load the data - CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating); + CurrentModuleObject = HVAC::coilTypeNames[(int)HVAC::CoilType::VRFHeating]; for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFHeatingCoils; ++DXCoilIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -5086,8 +5086,7 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); thisDXCoil.Name = Alphas(1); - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_Heating; + thisDXCoil.coilType = HVAC::CoilType::VRFHeating; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -5192,7 +5191,7 @@ void GetDXCoils(EnergyPlusData &state) } // Loop over the VRF Cooling Coils for VRF FluidTCtrl Model_zrp 2015 - CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling); + CurrentModuleObject = HVAC::coilTypeNames[(int)HVAC::CoilType::VRFFluidTCtrlCooling]; for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFCoolingFluidTCtrlCoils; ++DXCoilIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -5219,8 +5218,7 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); thisDXCoil.Name = Alphas(1); - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_FluidTCtrl_Cooling; + thisDXCoil.coilType = HVAC::CoilType::VRFFluidTCtrlCooling; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -5310,7 +5308,7 @@ void GetDXCoils(EnergyPlusData &state) } // Loop over the VRF Heating Coils for VRF FluidTCtrl Model_zrp 2015 - CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating); + CurrentModuleObject = HVAC::coilTypeNames[(int)HVAC::CoilType::VRFFluidTCtrlHeating]; for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFHeatingFluidTCtrlCoils; ++DXCoilIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -5337,8 +5335,7 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); thisDXCoil.Name = Alphas(1); - thisDXCoil.DXCoilType = CurrentModuleObject; - thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_FluidTCtrl_Heating; + thisDXCoil.coilType = HVAC::CoilType::VRFFluidTCtrlHeating; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -5415,7 +5412,8 @@ void GetDXCoils(EnergyPlusData &state) auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { // Setup Report Variables for Cooling Equipment // CurrentModuleObject='Coil:Cooling:DX:SingleSpeed/Coil:Cooling:DX:TwoStageWithHumidityControlMode' SetupOutputVariable(state, @@ -5584,7 +5582,7 @@ void GetDXCoils(EnergyPlusData &state) } } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { // Setup Report Variables for Cooling Equipment // CurrentModuleObject='Cooling:DX:TwoStageWithHumidityControlMode' SetupOutputVariable(state, @@ -5605,7 +5603,7 @@ void GetDXCoils(EnergyPlusData &state) } - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical) { + else if (thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical) { // Setup Report Variables for Heating Equipment // CurrentModuleObject='Coil:Heating:DX:SingleSpeed' SetupOutputVariable(state, @@ -5722,7 +5720,7 @@ void GetDXCoils(EnergyPlusData &state) } } - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + else if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { // Setup Report Variables for Cooling Equipment // CurrentModuleObject='Coil:Cooling:DX:TwoSpeed' SetupOutputVariable(state, @@ -5872,8 +5870,8 @@ void GetDXCoils(EnergyPlusData &state) } - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + else if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { // Setup Report Variables for Cooling Equipment // CurrentModuleObject='Coil:WaterHeating:AirToWaterHeatPump:Pumped' // or 'Coil:WaterHeating:AirToWaterHeatPump:Wrapped' @@ -5997,7 +5995,7 @@ void GetDXCoils(EnergyPlusData &state) OutputProcessor::EndUseCat::WaterSystem); // DHW } - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling) { + else if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling) { // Setup Report Variables for Cooling Equipment: // CurrentModuleObject='Coil:Cooling:DX:MultiSpeed' SetupOutputVariable(state, @@ -6169,7 +6167,7 @@ void GetDXCoils(EnergyPlusData &state) } - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { + else if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { // Setup Report Variables for Heating Equipment: // CurrentModuleObject='Coil:Heating:DX:MultiSpeed' SetupOutputVariable(state, @@ -6325,7 +6323,7 @@ void GetDXCoils(EnergyPlusData &state) } // VRF cooling coil report variables - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Cooling) { + else if (thisDXCoil.coilType == HVAC::CoilType::VRFCooling) { // Setup Report Variables for Cooling Equipment: // CurrentModuleObject='Coil:Cooling:DX:VariableRefrigerantFlow SetupOutputVariable(state, @@ -6402,7 +6400,7 @@ void GetDXCoils(EnergyPlusData &state) } // VRF heating coil report variables - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating) { + else if (thisDXCoil.coilType == HVAC::CoilType::VRFHeating) { // Setup Report Variables for Heating Equipment: // CurrentModuleObject='Coil:Heating:DX:VariableRefrigerantFlow SetupOutputVariable(state, @@ -6432,7 +6430,7 @@ void GetDXCoils(EnergyPlusData &state) } // VRF cooling coil for FluidTCtrl, report variables - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { + else if (thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { // Setup Report Variables for Cooling Equipment: // CurrentModuleObject='Coil:Cooling:DX:VariableRefrigerantFlow:FluidTemperatureControl SetupOutputVariable(state, @@ -6525,7 +6523,7 @@ void GetDXCoils(EnergyPlusData &state) } // VRF heating coil for FluidTCtrl, report variables - else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating) { + else if (thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlHeating) { // Setup Report Variables for Heating Equipment: // CurrentModuleObject='Coil:Heating:DX:VariableRefrigerantFlow:FluidTemperatureControl SetupOutputVariable(state, @@ -6664,8 +6662,8 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur // if "ISHundredPercentDOASDXCoil" =.TRUE., then set coil as 100% DOAS dx coil state.dataHVACGlobal->DXCT = (thisDXCoil.ISHundredPercentDOASDXCoil) ? HVAC::DXCoilType::DOAS : HVAC::DXCoilType::Regular; - if ((thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) && + if ((thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) && state.dataDXCoils->MyEnvrnFlag(DXCoilNum)) { SizeDXCoil(state, DXCoilNum); @@ -6675,7 +6673,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur ((RatedVolFlowPerRatedTotCap - HVAC::MaxHeatVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT]) > SmallDifferenceTest)) { ShowWarningError(state, format("{} \"{}\": Rated air volume flow rate per watt of rated total water heating capacity is out of range", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6701,7 +6699,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } thisDXCoil.RatedCBF(1) = CalcCBF(state, - thisDXCoil.DXCoilType, + thisDXCoil.coilType, thisDXCoil.Name, thisDXCoil.RatedInletDBTemp, HPInletAirHumRat, @@ -6712,7 +6710,8 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur state.dataDXCoils->MyEnvrnFlag(DXCoilNum) = false; } - if ((thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) && + if ((thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling || + thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) && state.dataDXCoils->MyEnvrnFlag(DXCoilNum)) { if (thisDXCoil.FuelType != Constant::eFuel::Electricity) { if (thisDXCoil.MSHPHeatRecActive) { @@ -6732,8 +6731,8 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur // Find the companion upstream coil (DX cooling coil) that is used with DX heating coils (HP AC units only) if (thisDXCoil.FindCompanionUpStreamCoil) { - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { - thisDXCoil.CompanionUpstreamDXCoil = GetHPCoolingCoilIndex(state, thisDXCoil.DXCoilType, thisDXCoil.Name, DXCoilNum); + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical || thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { + thisDXCoil.CompanionUpstreamDXCoil = GetHPCoolingCoilIndex(state, thisDXCoil.coilType, thisDXCoil.Name, DXCoilNum); if (thisDXCoil.CompanionUpstreamDXCoil > 0) { state.dataDXCoils->DXCoil(thisDXCoil.CompanionUpstreamDXCoil).ReportCoolingCoilCrankcasePower = false; thisDXCoil.FindCompanionUpStreamCoil = false; @@ -6753,9 +6752,9 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur if (state.dataAirLoop->AirLoopInputsFilled) { // Set report variables for DX cooling coils that will have a crankcase heater (all DX coils not used in a HP AC unit) for (DXCoilNumTemp = 1; DXCoilNumTemp <= state.dataDXCoils->NumDXCoils; ++DXCoilNumTemp) { - if ((state.dataDXCoils->DXCoil(DXCoilNumTemp).DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) || - (state.dataDXCoils->DXCoil(DXCoilNumTemp).DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) || - (state.dataDXCoils->DXCoil(DXCoilNumTemp).DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling)) { + if ((state.dataDXCoils->DXCoil(DXCoilNumTemp).coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) || + (state.dataDXCoils->DXCoil(DXCoilNumTemp).coilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (state.dataDXCoils->DXCoil(DXCoilNumTemp).coilType == HVAC::CoilType::DXMultiSpeedCooling)) { if (state.dataDXCoils->DXCoil(DXCoilNumTemp).ReportCoolingCoilCrankcasePower) { SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Rate", @@ -6787,17 +6786,19 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur SizeDXCoil(state, DXCoilNum); state.dataDXCoils->MySizeFlag(DXCoilNum) = false; - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed || - thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Cooling || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed || + thisDXCoil.coilType == HVAC::CoilType::VRFCooling || + thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { Mode = 1; // Check for zero capacity or zero max flow rate if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { - ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ErrorsFound = true; } if (thisDXCoil.RatedAirVolFlowRate(Mode) <= 0.0) { - ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ErrorsFound = true; } if (ErrorsFound) { @@ -6805,14 +6806,14 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - if (thisDXCoil.DXCoilType_Num != - HVAC::CoilVRF_FluidTCtrl_Cooling) { // the VolFlowPerRatedTotCap check is not applicable for VRF-FluidTCtrl coil + // the VolFlowPerRatedTotCap check is not applicable for VRF-FluidTCtrl coil + if (thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlCooling) { RatedVolFlowPerRatedTotCap = thisDXCoil.RatedAirVolFlowRate(Mode) / thisDXCoil.RatedTotCap(Mode); if (((HVAC::MinRatedVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT] - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - HVAC::MaxRatedVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT]) > SmallDifferenceTest)) { ShowWarningError(state, format("Sizing: {} \"{}\": Rated air volume flow rate per watt of rated total cooling capacity is out of range.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6828,7 +6829,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get high speed rated coil bypass factor thisDXCoil.RatedCBF(Mode) = CalcCBF(state, - thisDXCoil.DXCoilType, + thisDXCoil.coilType, thisDXCoil.Name, RatedInletAirTemp, RatedInletAirHumRat, @@ -6866,13 +6867,13 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } // calculate coil model at rating point - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed) { CalcDoe2DXCoil(state, DXCoilNum, HVAC::CompressorOp::On, false, 1.0, HVAC::FanOp::Cycling, _, 1.0); - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { CalcMultiSpeedDXCoil(state, DXCoilNum, 1.0, 1.0); - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Cooling) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFCooling) { CalcVRFCoolingCoil(state, DXCoilNum, HVAC::CompressorOp::On, false, 1.0, HVAC::FanOp::Cycling, 1.0, _, _, _); - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { CalcVRFCoolingCoil_FluidTCtrl( state, DXCoilNum, HVAC::CompressorOp::On, false, 1.0, HVAC::FanOp::Cycling, 1.0, _, _, Constant::MaxCap); } @@ -6885,7 +6886,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions( state, thisDXCoil.Name, - thisDXCoil.DXCoilType, + thisDXCoil.coilType, thisDXCoil.TotalCoolingEnergyRate, // this is the report variable thisDXCoil.SensCoolingEnergyRate, // this is the report variable thisDXCoil.InletAirMassFlowRate, @@ -6907,19 +6908,19 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur state.dataEnvrn->OutBaroPress = holdOutBaroPress; } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { for (DehumidModeNum = 0; DehumidModeNum <= thisDXCoil.NumDehumidModes; ++DehumidModeNum) { for (CapacityStageNum = 1; CapacityStageNum <= thisDXCoil.NumCapacityStages; ++CapacityStageNum) { Mode = DehumidModeNum * 2 + CapacityStageNum; // Check for zero capacity or zero max flow rate if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { - ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity", thisDXCoil.DXCoilType, thisDXCoil.Name)); - ShowContinueError(state, format("for CoilPerformance:DX:Cooling mode: {}", thisDXCoil.CoilPerformanceName(Mode))); + ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); + ShowContinueError(state, format("for CoilPerformance:DX:Cooling mode: {}", thisDXCoil.coilPerformanceNames(Mode))); ErrorsFound = true; } if (thisDXCoil.RatedAirVolFlowRate(Mode) <= 0.0) { - ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate", thisDXCoil.DXCoilType, thisDXCoil.Name)); - ShowContinueError(state, format("for CoilPerformance:DX:Cooling mode: {}", thisDXCoil.CoilPerformanceName(Mode))); + ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); + ShowContinueError(state, format("for CoilPerformance:DX:Cooling mode: {}", thisDXCoil.coilPerformanceNames(Mode))); ErrorsFound = true; } if (ErrorsFound) { @@ -6932,7 +6933,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur ShowWarningError( state, format("Sizing: {} \"{}\": Rated air volume flow rate per watt of rated total cooling capacity is out of range.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6940,15 +6941,15 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur HVAC::MinRatedVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT], RatedVolFlowPerRatedTotCap, HVAC::MaxRatedVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT])); - ShowContinueError(state, format("for CoilPerformance:DX:Cooling mode: {}", thisDXCoil.CoilPerformanceName(Mode))); + ShowContinueError(state, format("for CoilPerformance:DX:Cooling mode: {}", thisDXCoil.coilPerformanceNames(Mode))); } thisDXCoil.RatedAirMassFlowRate(Mode) = thisDXCoil.RatedAirVolFlowRate(Mode) * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get rated coil bypass factor thisDXCoil.RatedCBF(Mode) = CalcCBF(state, - thisDXCoil.CoilPerformanceType(Mode), - thisDXCoil.CoilPerformanceName(Mode), + thisDXCoil.coilPerformanceTypes(Mode), + thisDXCoil.coilPerformanceNames(Mode), RatedInletAirTemp, RatedInletAirHumRat, thisDXCoil.RatedTotCap(Mode), @@ -6958,16 +6959,17 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } // End dehumidification modes loop } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating || - thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical || + thisDXCoil.coilType == HVAC::CoilType::VRFHeating || + thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlHeating) { Mode = 1; if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { - ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ErrorsFound = true; } if (thisDXCoil.RatedAirVolFlowRate(Mode) <= 0.0) { - ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ErrorsFound = true; } if (ErrorsFound) { @@ -6980,14 +6982,14 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - if (thisDXCoil.DXCoilType_Num != - HVAC::CoilVRF_FluidTCtrl_Heating) { // the VolFlowPerRatedTotCap check is not applicable for VRF-FluidTCtrl coil + // the VolFlowPerRatedTotCap check is not applicable for VRF-FluidTCtrl coil + if (thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlHeating) { RatedVolFlowPerRatedTotCap = thisDXCoil.RatedAirVolFlowRate(Mode) / thisDXCoil.RatedTotCap(Mode); if (((HVAC::MinRatedVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT] - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - HVAC::MaxRatedVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT]) > SmallDifferenceTest)) { ShowWarningError(state, format("Sizing: {} {}: Rated air volume flow rate per watt of rated total heating capacity is out of range.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -7029,11 +7031,11 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } // calculate coil model at rating point - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical) { CalcDXHeatingCoil(state, DXCoilNum, 1.0, HVAC::FanOp::Cycling, 1.0); - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFHeating) { CalcDXHeatingCoil(state, DXCoilNum, 1.0, HVAC::FanOp::Cycling, _, _); - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlHeating) { CalcVRFHeatingCoil_FluidTCtrl(state, HVAC::CompressorOp::On, DXCoilNum, 1.0, HVAC::FanOp::Cycling, _, _); } // coil outlets @@ -7044,7 +7046,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions( state, thisDXCoil.Name, - thisDXCoil.DXCoilType, + thisDXCoil.coilType, thisDXCoil.TotalHeatingEnergyRate, // this is the report variable thisDXCoil.TotalHeatingEnergyRate, // this is the report variable thisDXCoil.InletAirMassFlowRate, @@ -7066,7 +7068,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur state.dataEnvrn->OutBaroPress = holdOutBaroPress; } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) RatedVolFlowPerRatedTotCap = thisDXCoil.RatedAirVolFlowRate2 / thisDXCoil.RatedTotCap2; if (((HVAC::MinRatedVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT] - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || @@ -7088,7 +7090,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get low speed rated coil bypass factor thisDXCoil.RatedCBF2 = CalcCBF(state, - thisDXCoil.DXCoilType, + thisDXCoil.coilType, thisDXCoil.Name, RatedInletAirTemp, RatedInletAirHumRat, @@ -7103,17 +7105,17 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } // Multispeed Cooling - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling) { + if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling) { for (Mode = 1; Mode <= thisDXCoil.NumOfSpeeds; ++Mode) { // Check for zero capacity or zero max flow rate if (thisDXCoil.MSRatedTotCap(Mode) <= 0.0) { ShowSevereError(state, - format("Sizing: {} {} has zero rated total capacity at speed {}", thisDXCoil.DXCoilType, thisDXCoil.Name, Mode)); + format("Sizing: {} {} has zero rated total capacity at speed {}", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode)); ErrorsFound = true; } if (thisDXCoil.MSRatedAirVolFlowRate(Mode) <= 0.0) { ShowSevereError(state, - format("Sizing: {} {} has zero rated air flow rate at speed {}", thisDXCoil.DXCoilType, thisDXCoil.Name, Mode)); + format("Sizing: {} {} has zero rated air flow rate at speed {}", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode)); ErrorsFound = true; } if (ErrorsFound) { @@ -7126,7 +7128,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur ShowWarningError( state, format("Sizing: {} \"{}\": Rated air volume flow rate per watt of rated total cooling capacity is out of range at speed {}", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode)); ShowContinueError(state, @@ -7141,7 +7143,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get high speed rated coil bypass factor thisDXCoil.MSRatedCBF(Mode) = CalcCBF(state, - thisDXCoil.DXCoilType, + thisDXCoil.coilType, thisDXCoil.Name, RatedInletAirTemp, RatedInletAirHumRat, @@ -7152,7 +7154,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } // Multispeed Heating - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { + if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { RatedHeatPumpIndoorAirTemp = 21.11; // 21.11C or 70F RatedHeatPumpIndoorHumRat = 0.00881; // Humidity ratio corresponding to 70F dry bulb/60F wet bulb for (Mode = 1; Mode <= thisDXCoil.NumOfSpeeds; ++Mode) { @@ -7181,7 +7183,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur // store fan info for coil state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( - state, thisDXCoil.Name, thisDXCoil.DXCoilType, thisDXCoil.SupplyFanName, thisDXCoil.supplyFanType, thisDXCoil.SupplyFanIndex); + state, thisDXCoil.Name, thisDXCoil.coilType, thisDXCoil.SupplyFanName, thisDXCoil.supplyFanType, thisDXCoil.SupplyFanIndex); } AirInletNode = thisDXCoil.AirInNode; @@ -7197,7 +7199,8 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // DXCoil(DXCoilNum)%InletAirPressure = Node(AirInletNode)%Press - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical || + thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { if (thisDXCoil.IsSecondaryDXCoilInZone) { thisDXCoil.EvapInletWetBulb = PsyTwbFnTdbWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr).ZT, @@ -7207,7 +7210,8 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { thisDXCoil.TotalHeatingEnergyRate = 0.0; thisDXCoil.ElecWaterHeatingPower = 0.0; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line @@ -7339,13 +7343,13 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) for (DehumidModeNum = 0; DehumidModeNum <= thisDXCoil.NumDehumidModes; ++DehumidModeNum) { for (CapacityStageNum = 1; CapacityStageNum <= thisDXCoil.NumCapacityStages; ++CapacityStageNum) { Mode = DehumidModeNum * 2 + CapacityStageNum; - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { if (thisDXCoil.RatedAirVolFlowRate(1) == Constant::AutoCalculate) { // report autocalculated sizing PrintFlag = true; CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // DXCoil( DXCoilNum ).RatedAirVolFlowRate( 1 ) = DXCoil( DXCoilNum ).RatedTotCap2 * 0.00005035 state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap2; state.dataSize->DataFractionUsedForSizing = 0.00005035; @@ -7363,7 +7367,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // report autocalculated sizing PrintFlag = true; CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // DXCoil( DXCoilNum ).RatedAirVolFlowRate( 1 ) = DXCoil( DXCoilNum ).RatedTotCap2 * 0.00000004487 state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap2; state.dataSize->DataFractionUsedForSizing = 0.00000004487; @@ -7379,11 +7383,11 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } else { PrintFlag = true; FieldNum = 0; - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - CompName = thisDXCoil.Name + ":" + thisDXCoil.CoilPerformanceName(Mode); + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + CompName = thisDXCoil.Name + ":" + thisDXCoil.coilPerformanceNames(Mode); FieldNum = 4; state.dataSize->DataBypassFrac = thisDXCoil.BypassedFlowFrac(Mode); - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical) { CompName = thisDXCoil.Name; FieldNum = 3; // doesn't look like this is needed for air flow sizing, only for heating capacity sizing @@ -7394,21 +7398,21 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) DataHeatBalance::RefrigCondenserType::Air)) { // secondary DX coil in secondary zone is specified SizeSecDXCoil = true; } - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFHeating) { CompName = thisDXCoil.Name; FieldNum = 2; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Cooling) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFCooling) { CompName = thisDXCoil.Name; FieldNum = 3; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlHeating) { CompName = thisDXCoil.Name; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { CompName = thisDXCoil.Name; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling) { thisDXCoil.RatedAirVolFlowRate(Mode) = thisDXCoil.MSRatedAirVolFlowRate(thisDXCoil.NumOfSpeeds); CompName = thisDXCoil.Name; PrintFlag = false; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { thisDXCoil.RatedAirVolFlowRate(Mode) = thisDXCoil.MSRatedAirVolFlowRate(thisDXCoil.NumOfSpeeds); CompName = thisDXCoil.Name; PrintFlag = false; @@ -7423,12 +7427,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } else { SizingString = "Rated Air Flow Rate [m3/s]"; } - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; state.dataSize->DataIsDXCoil = true; state.dataSize->DataEMSOverrideON = thisDXCoil.RatedAirVolFlowRateEMSOverrideON(Mode); state.dataSize->DataEMSOverride = thisDXCoil.RatedAirVolFlowRateEMSOverrideValue(Mode); - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating || - thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical) { + if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating || thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlHeating || + thisDXCoil.coilType == HVAC::CoilType::VRFHeating || thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical) { bool errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); @@ -7455,16 +7459,16 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // suite was not run with this code included. *** The question here is if the autosized air flow rate or the user specified air flow // rate should be used to calculate capacity removing this for now until more is known // if ( DXCoil( DXCoilNum ).RatedTotCap( Mode ) != AutoSize && ( ( SysSizingRunDone && CurSysNum > 0 ) || - //( ZoneSizingRunDone && CurZoneEqNum > 0 ) ) ) { if ( DXCoil( DXCoilNum ).DXCoilType_Num == - // HVAC::CoilDX_CoolingTwoStageWHumControl ) { SizingMethod = CoolingAirflowSizing; + //( ZoneSizingRunDone && CurZoneEqNum > 0 ) ) ) { if ( DXCoil( DXCoilNum ).coilType == + // HVAC::CoilType::DX_CoolingTwoStageWHumControl ) { SizingMethod = CoolingAirflowSizing; // DataBypassFrac = DXCoil ( DXCoilNum ).BypassedFlowFrac ( Mode ); - // } else if ( DXCoil( DXCoilNum ).DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical ) { + // } else if ( DXCoil( DXCoilNum ).coilType == HVAC::CoilType::DX_HeatingEmpirical ) { // SizingMethod = HeatingAirflowSizing; //// DataCoolCoilCap = DXCoolCap; // pass global variable used only for heat pumps (i.e., /// DX cooling and heating coils) - // } else if ( DXCoil( DXCoilNum ).DXCoilType_Num == HVAC::CoilVRF_Heating ) { + // } else if ( DXCoil( DXCoilNum ).coilType == HVAC::CoilType::VRF_Heating ) { // SizingMethod = HeatingAirflowSizing; - // } else if ( DXCoil( DXCoilNum ).DXCoilType_Num == HVAC::CoilVRF_Cooling ) { + // } else if ( DXCoil( DXCoilNum ).coilType == HVAC::CoilType::VRF_Cooling ) { // SizingMethod = CoolingAirflowSizing; // } else { // SizingMethod = CoolingAirflowSizing; @@ -7487,20 +7491,21 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // } PrintFlag = true; state.dataSize->DataTotCapCurveIndex = thisDXCoil.CCapFTemp(Mode); - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - CompName = thisDXCoil.Name + ":" + thisDXCoil.CoilPerformanceName(Mode); + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + CompName = thisDXCoil.Name + ":" + thisDXCoil.coilPerformanceNames(Mode); FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating || - thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical || + thisDXCoil.coilType == HVAC::CoilType::VRFHeating || + thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlHeating) { CompName = thisDXCoil.Name; FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; state.dataSize->DataCoolCoilCap = state.dataSize->DXCoolCap; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { CompName = thisDXCoil.Name; FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); @@ -7508,7 +7513,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) PrintFlag = false; state.dataLoopNodes->Node(thisDXCoil.WaterInNode).Temp = thisDXCoil.RatedInletWaterTemp; // set the rated water inlet node for HPWHs for use in CalcHPWHDXCoil - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { + } else if (thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { CompName = thisDXCoil.Name; FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); @@ -7526,14 +7531,14 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } } CalcVRFCoilCapModFac(state, 0, _, CompName, CoilInTemp, _, _, _, state.dataSize->DataTotCapCurveValue); - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling) { CompName = thisDXCoil.Name; FieldNum = 7 + (thisDXCoil.NumOfSpeeds - 1) * 13; state.dataSize->DataTotCapCurveIndex = thisDXCoil.MSCCapFTemp(thisDXCoil.NumOfSpeeds); TempSize = thisDXCoil.MSRatedTotCap(thisDXCoil.NumOfSpeeds); PrintFlag = false; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { + } else if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { CompName = thisDXCoil.Name; FieldNum = 10 + (thisDXCoil.NumOfSpeeds - 1) * 6; state.dataSize->DataTotCapCurveIndex = thisDXCoil.MSCCapFTemp(thisDXCoil.NumOfSpeeds); @@ -7546,12 +7551,13 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) TempSize = thisDXCoil.RatedTotCap(Mode); SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; } - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; state.dataSize->DataIsDXCoil = true; state.dataSize->DataEMSOverrideON = thisDXCoil.RatedTotCapEMSOverrideOn(Mode); state.dataSize->DataEMSOverride = thisDXCoil.RatedTotCapEMSOverrideValue(Mode); - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical || - thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating) { + if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating || + thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical || + thisDXCoil.coilType == HVAC::CoilType::VRFHeating || thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlHeating) { HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); @@ -7573,23 +7579,28 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataSize->DataTotCapCurveValue = 0.0; // Cooling coil capacity - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Cooling || - thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl || + thisDXCoil.coilType == HVAC::CoilType::VRFCooling || + thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { state.dataSize->DXCoolCap = thisDXCoil.RatedTotCap(Mode); } // Sizing DX cooling coil SHR - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Cooling || - thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { - - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - CompName = thisDXCoil.Name + ":" + thisDXCoil.CoilPerformanceName(Mode); + // Why is this complex condition exactly the same as the previous one? + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl || + thisDXCoil.coilType == HVAC::CoilType::VRFCooling || + thisDXCoil.coilType == HVAC::CoilType::VRFFluidTCtrlCooling) { + + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + CompName = thisDXCoil.Name + ":" + thisDXCoil.coilPerformanceNames(Mode); } else { CompName = thisDXCoil.Name; } - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; TempSize = thisDXCoil.RatedSHR(Mode); state.dataSize->DataDXSpeedNum = Mode; state.dataSize->DataFlowUsedForSizing = thisDXCoil.RatedAirVolFlowRate(Mode); @@ -7609,17 +7620,18 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // Sizing evaporator condenser air flow if (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap && thisDXCoil.EvapCondAirFlow(Mode) != 0.0 && - (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { AutoCalculateSizer sizerEvapCondAirFlow; std::string stringOverride = "Evaporative Condenser Air Flow Rate [m3/s]"; if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_air_flow_rate [m3/s]"; - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - CompName = thisDXCoil.Name + ":" + thisDXCoil.CoilPerformanceName(Mode); + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + CompName = thisDXCoil.Name + ":" + thisDXCoil.coilPerformanceNames(Mode); } else { CompName = thisDXCoil.Name; - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { stringOverride = "High Speed Evaporative Condenser Air Flow Rate [m3/s]"; if (state.dataGlobal->isEpJSON) stringOverride = "high_speed_evaporative_condenser_air_flow_rate [m3/s]"; } else { @@ -7627,7 +7639,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_air_flow_rate [m3/s]"; } } - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Auto-size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton) state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap(Mode); state.dataSize->DataFractionUsedForSizing = 0.000114; @@ -7647,12 +7659,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (IsAutoSize) { thisDXCoil.SecCoilAirFlow = SecCoilAirFlowDes; BaseSizer::reportSizerOutput( - state, thisDXCoil.DXCoilType, thisDXCoil.Name, "Design Size Secondary Coil Air Flow Rate [m3/s]", SecCoilAirFlowDes); + state, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, "Design Size Secondary Coil Air Flow Rate [m3/s]", SecCoilAirFlowDes); } else { if (thisDXCoil.SecCoilAirFlow > 0.0 && SecCoilAirFlowDes > 0.0 && !HardSizeNoDesRun) { SecCoilAirFlowUser = thisDXCoil.SecCoilAirFlow; BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, "Design Size Secondary Coil Air Flow Rate [m3/s]", SecCoilAirFlowDes, @@ -7662,7 +7674,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if ((std::abs(SecCoilAirFlowDes - SecCoilAirFlowUser) / SecCoilAirFlowUser) > state.dataSize->AutoVsHardSizingThreshold) { ShowMessage( state, - format("SizeDxCoil: Potential issue with equipment sizing for {} {}", thisDXCoil.DXCoilType, thisDXCoil.Name)); + format("SizeDxCoil: Potential issue with equipment sizing for {} {}", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("User-Specified Secondary Coil Air Flow Rate of {:.5R} [m3/s]", SecCoilAirFlowUser)); ShowContinueError( state, format("differs from Design Size Secondary Coil Air Flow Rate of {:.5R} [m3/s]", SecCoilAirFlowDes)); @@ -7677,11 +7689,11 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // Sizing evaporative condenser air flow 2 PrintFlag = true; if (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap && thisDXCoil.EvapCondAirFlow2 != 0.0 && - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { CompName = thisDXCoil.Name; FieldNum = 15; // Low Speed Evaporative Condenser Air Flow Rate SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [m3/s]"; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Autosize low speed condenser air flow to 1/3 Total Capacity * 0.000114 m3/s/w (850 cfm/ton) state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap(Mode); state.dataSize->DataFractionUsedForSizing = 0.000114 * 0.3333; @@ -7696,17 +7708,18 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // Sizing evaporative condenser pump electric nominal power if (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap && thisDXCoil.EvapCondPumpElecNomPower(Mode) != 0.0 && - (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed || + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { AutoCalculateSizer sizerEvapCondPumpPower; std::string stringOverride = "Evaporative Condenser Pump Rated Power Consumption [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_pump_rated_power_consumption [W]"; - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - CompName = thisDXCoil.Name + ":" + thisDXCoil.CoilPerformanceName(Mode); + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + CompName = thisDXCoil.Name + ":" + thisDXCoil.coilPerformanceNames(Mode); } else { CompName = thisDXCoil.Name; - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { stringOverride = "High Speed Evaporative Condenser Pump Rated Power Consumption [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "high_speed_evaporative_condenser_pump_rated_power_consumption [W]"; } else { @@ -7714,7 +7727,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_pump_rated_power_consumption [W]"; } } - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Autosize high speed evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap(Mode); state.dataSize->DataFractionUsedForSizing = 0.004266; @@ -7726,9 +7739,9 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // Sizing low speed evaporative condenser pump electric nominal power if (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap && thisDXCoil.EvapCondPumpElecNomPower2 != 0.0 && - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Autosize low speed evap condenser pump power to 1/3 Total Capacity * 0.004266 w/w (15 w/ton) state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap(Mode); state.dataSize->DataFractionUsedForSizing = 0.004266 * 0.3333; @@ -7742,9 +7755,9 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } // // Sizing rated low speed air flow rate - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Autosize low speed air flow rate to 1/3 high speed air flow rate state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedAirVolFlowRate(Mode); state.dataSize->DataFractionUsedForSizing = 0.3333; @@ -7758,9 +7771,9 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } // // Sizing rated low speed total cooling capacity - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Autosize low speed capacity to 1/3 high speed capacity state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap(Mode); state.dataSize->DataFractionUsedForSizing = 0.3333; @@ -7773,12 +7786,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) thisDXCoil.RatedTotCap2 = sizerLowSpdCap.size(state, TempSize, ErrorsFound); } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { if (thisDXCoil.EvapCondAirFlow2 > thisDXCoil.EvapCondAirFlow(Mode)) { ShowSevereError( state, format("SizeDXCoil: {} {}, Evaporative Condenser low speed air flow must be less than or equal to high speed air flow.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", thisDXCoil.EvapCondAirFlow2, thisDXCoil.EvapCondAirFlow(Mode))); ShowFatalError(state, "Preceding conditions cause termination."); @@ -7788,7 +7801,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ShowSevereError( state, format("SizeDXCoil: {} {}, Evaporative Condenser low speed pump power must be less than or equal to high speed pump power.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format("Instead, {:.2R} > {:.2R}", thisDXCoil.EvapCondPumpElecNomPower2, thisDXCoil.EvapCondPumpElecNomPower(Mode))); @@ -7799,7 +7812,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ShowSevereError(state, format("SizeDXCoil: {} {}, Rated Total Cooling Capacity, Low Speed must be less than or equal to Rated Total " "Cooling Capacity, High Speed.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", thisDXCoil.RatedTotCap2, thisDXCoil.RatedTotCap(Mode))); ShowFatalError(state, "Preceding conditions cause termination."); @@ -7809,7 +7822,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ShowFatalError(state, format("SizeDXCoil: {} {}, Rated Air Volume Flow Rate, low speed must be less than or equal to Rated Air Volume " "Flow Rate, high speed.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", thisDXCoil.RatedAirVolFlowRate2, thisDXCoil.RatedAirVolFlowRate(Mode))); @@ -7818,11 +7831,11 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } // // Sizing rated low speed SHR2 - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed) { CompName = thisDXCoil.Name; FieldNum = 7; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum); - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Autosize low speed SHR to be the same as high speed SHR state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedSHR(Mode); state.dataSize->DataFractionUsedForSizing = 1.0; @@ -7837,13 +7850,14 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } // // Sizing resistive defrost heater capacity - if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating && thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_FluidTCtrl_Heating && - thisDXCoil.DXCoilType_Num != HVAC::CoilDX_MultiSpeedHeating) { - // IF (DXCoil(DXCoilNum)%DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating .OR. & - // DXCoil(DXCoilNum)%DXCoilType_Num == Coil_HeatingAirToAirVariableSpeed) THEN + if (thisDXCoil.coilType != HVAC::CoilType::VRFHeating && + thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlHeating && + thisDXCoil.coilType != HVAC::CoilType::DXMultiSpeedHeating) { + // IF (DXCoil(DXCoilNum)%coilType == HVAC::CoilType::DX_MultiSpeedHeating .OR. & + // DXCoil(DXCoilNum)%coilType == Coil_HeatingAirToAirVariableSpeed) THEN if (thisDXCoil.DefrostStrategy == StandardRatings::DefrostStrat::Resistive) { CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Autosize low speed capacity to 1/3 high speed capacity state.dataSize->DataConstantUsedForSizing = state.dataSize->DXCoolCap; state.dataSize->DataFractionUsedForSizing = 1.0; @@ -7863,7 +7877,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } // End dehumidification modes loop // Autosizing for multispeed cooling coil - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling) { + if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling) { // flow rate autosize for (Mode = thisDXCoil.NumOfSpeeds; Mode >= 1; --Mode) { // Sizing multispeed air volume flow rate @@ -7873,7 +7887,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } state.dataSize->DataIsDXCoil = true; CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; if (Mode == thisDXCoil.NumOfSpeeds) { FieldNum = 10 + (Mode - 1) * 14; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; @@ -7930,7 +7944,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (thisDXCoil.MSRatedAirVolFlowRate(Mode) > thisDXCoil.MSRatedAirVolFlowRate(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Air Flow Rate must be less than or equal to Speed {} Rated Air Flow Rate.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode, Mode + 1)); @@ -7947,7 +7961,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) IsAutoSize = true; } CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; state.dataSize->DataIsDXCoil = true; state.dataSize->DataTotCapCurveIndex = thisDXCoil.MSCCapFTemp(Mode); if (Mode == thisDXCoil.NumOfSpeeds) { @@ -8020,7 +8034,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Total Cooling Capacity must be less than or equal to Speed {} Rated " "Total Cooling Capacity.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode, Mode + 1)); @@ -8036,7 +8050,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) IsAutoSize = true; } if (Mode == thisDXCoil.NumOfSpeeds) { - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; CompName = thisDXCoil.Name; TempSize = thisDXCoil.MSRatedSHR(Mode); state.dataSize->DataFlowUsedForSizing = MSRatedAirVolFlowRateDes; @@ -8087,7 +8101,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (IsAutoSize) { thisDXCoil.MSEvapCondAirFlow(Mode) = MSEvapCondAirFlowDes; BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, format("Design Size Speed {} Evaporative Condenser Air Flow Rate [m3/s]", Mode), MSEvapCondAirFlowDes); @@ -8095,7 +8109,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (thisDXCoil.MSEvapCondAirFlow(Mode) > 0.0 && MSEvapCondAirFlowDes > 0.0 && !HardSizeNoDesRun) { MSEvapCondAirFlowUser = thisDXCoil.MSEvapCondAirFlow(Mode); BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, format("Design Size Speed {} Evaporative Condenser Air Flow Rate [m3/s]", Mode), MSEvapCondAirFlowDes, @@ -8105,7 +8119,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if ((std::abs(MSEvapCondAirFlowDes - MSEvapCondAirFlowUser) / MSEvapCondAirFlowUser) > state.dataSize->AutoVsHardSizingThreshold) { ShowMessage( - state, format("SizeDxCoil: Potential issue with equipment sizing for {} {}", thisDXCoil.DXCoilType, thisDXCoil.Name)); + state, format("SizeDxCoil: Potential issue with equipment sizing for {} {}", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("User-Specified Evaporative Condenser Air Flow Rate of {:.5R} [m3/s]", MSEvapCondAirFlowUser)); ShowContinueError( @@ -8124,7 +8138,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Evaporative Condenser Air Flow Rate must be less than or equal to Speed {} " "Evaporative Condenser Air Flow Rate.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode, Mode + 1)); @@ -8152,7 +8166,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (IsAutoSize) { thisDXCoil.MSEvapCondPumpElecNomPower(Mode) = MSEvapCondPumpElecNomPowerDes; BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, format("Design Size Speed {} Rated Evaporative Condenser Pump Power Consumption [W]", Mode), MSEvapCondPumpElecNomPowerDes); @@ -8160,7 +8174,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (thisDXCoil.MSEvapCondPumpElecNomPower(Mode) > 0.0 && MSEvapCondPumpElecNomPowerDes > 0.0 && !HardSizeNoDesRun) { MSEvapCondPumpElecNomPowerUser = thisDXCoil.MSEvapCondPumpElecNomPower(Mode); BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, format("Design Size Speed {} Rated Evaporative Condenser Pump Power Consumption [W]", Mode), MSEvapCondPumpElecNomPowerDes, @@ -8170,7 +8184,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if ((std::abs(MSEvapCondPumpElecNomPowerDes - MSEvapCondPumpElecNomPowerUser) / MSEvapCondPumpElecNomPowerUser) > state.dataSize->AutoVsHardSizingThreshold) { ShowMessage( - state, format("SizeDxCoil: Potential issue with equipment sizing for {} {}", thisDXCoil.DXCoilType, thisDXCoil.Name)); + state, format("SizeDxCoil: Potential issue with equipment sizing for {} {}", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("User-Specified Evaporative Condenser Pump Rated Power Consumption of {:.2R} [W]", MSEvapCondPumpElecNomPowerUser)); @@ -8191,7 +8205,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Evaporative Condenser Pump Power Consumption must be less than or " "equal to Speed {} Rated Evaporative Condenser Pump Power Consumption.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode, Mode + 1)); @@ -8204,7 +8218,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } // Autosizing for multispeed heating coil - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { + if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { // flow rate autosize for (Mode = thisDXCoil.NumOfSpeeds; Mode >= 1; --Mode) { IsAutoSize = false; @@ -8213,7 +8227,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } state.dataSize->DataIsDXCoil = true; CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; // Sizing rated air flow rate if (Mode == thisDXCoil.NumOfSpeeds) { FieldNum = 12 + (Mode - 1) * 6; @@ -8268,7 +8282,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (thisDXCoil.MSRatedAirVolFlowRate(Mode) > thisDXCoil.MSRatedAirVolFlowRate(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Air Flow Rate must be less than or equal to Speed {} Rated Air Flow Rate.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode, Mode + 1)); @@ -8289,7 +8303,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (IsAutoSize) { thisDXCoil.MSSecCoilAirFlow(Mode) = SecCoilAirFlowDes; BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, format("Design Size Speed {} Secondary Coil Air Flow Rate [m3/s]", Mode), SecCoilAirFlowDes); @@ -8297,7 +8311,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (thisDXCoil.MSSecCoilAirFlow(Mode) > 0.0 && SecCoilAirFlowDes > 0.0 && !HardSizeNoDesRun) { SecCoilAirFlowUser = thisDXCoil.MSSecCoilAirFlow(Mode); BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, format("Design Size Speed {} Secondary Coil Air Flow Rate [m3/s]", Mode), SecCoilAirFlowDes, @@ -8307,7 +8321,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if ((std::abs(SecCoilAirFlowDes - SecCoilAirFlowUser) / SecCoilAirFlowUser) > state.dataSize->AutoVsHardSizingThreshold) { ShowMessage( state, - format("SizeDxCoil: Potential issue with equipment sizing for {} {}", thisDXCoil.DXCoilType, thisDXCoil.Name)); + format("SizeDxCoil: Potential issue with equipment sizing for {} {}", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("User-Specified Secondary Coil Air Flow Rate of {:.5R} [m3/s]", SecCoilAirFlowUser)); ShowContinueError( state, format("differs from Design Size Secondary Coil Air Flow Rate of {:.5R} [m3/s]", SecCoilAirFlowDes)); @@ -8328,7 +8342,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } state.dataSize->DataIsDXCoil = true; CompName = thisDXCoil.Name; - CompType = thisDXCoil.DXCoilType; + CompType = HVAC::coilTypeNames[(int)thisDXCoil.coilType]; if (Mode == thisDXCoil.NumOfSpeeds) { state.dataSize->DataFlowUsedForSizing = thisDXCoil.MSRatedAirVolFlowRate(Mode); FieldNum = 10 + (Mode - 1) * 6; @@ -8405,7 +8419,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Total Heating Capacity must be less than or equal to Speed {} Rated " "Total Heating Capacity.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, Mode, Mode + 1)); @@ -8428,12 +8442,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (IsAutoSize) { thisDXCoil.DefrostCapacity = DefrostCapacityDes; BaseSizer::reportSizerOutput( - state, thisDXCoil.DXCoilType, thisDXCoil.Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes); + state, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes); } else { if (thisDXCoil.DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0 && !HardSizeNoDesRun) { DefrostCapacityUser = thisDXCoil.DefrostCapacity; BaseSizer::reportSizerOutput(state, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes, @@ -8442,7 +8456,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(DefrostCapacityDes - DefrostCapacityUser) / DefrostCapacityUser) > state.dataSize->AutoVsHardSizingThreshold) { ShowWarningMessage( - state, format("SizeDxCoil: Potential issue with equipment sizing for {} {}", thisDXCoil.DXCoilType, thisDXCoil.Name)); + state, format("SizeDxCoil: Potential issue with equipment sizing for {} {}", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("User-Specified Resistive Defrost Heater Capacity of {:.2R}[W]", DefrostCapacityUser)); ShowContinueError(state, format("differs from Design Size Resistive Defrost Heater Capacity of {:.2R}[W]", DefrostCapacityDes)); @@ -8455,14 +8469,13 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } // Call routine that computes AHRI certified rating for single-speed DX Coils - if ((thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed && + if ((thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed && (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Air || thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap)) || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical) { + thisDXCoil.coilType == HVAC::CoilType::DXHeatingEmpirical) { CalcDXCoilStandardRating(state, thisDXCoil.Name, - thisDXCoil.DXCoilType, - thisDXCoil.DXCoilType_Num, + thisDXCoil.coilType, 1, thisDXCoil.RatedTotCap(1), thisDXCoil.RatedCOP(1), @@ -8483,11 +8496,11 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) thisDXCoil.ASHRAE127StdRprt); } // Call routine that computes AHRI certified rating for multi-speed DX cooling Coils - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { + if (thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling || + thisDXCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { CalcDXCoilStandardRating(state, thisDXCoil.Name, - thisDXCoil.DXCoilType, - thisDXCoil.DXCoilType_Num, + thisDXCoil.coilType, thisDXCoil.NumOfSpeeds, thisDXCoil.MSRatedTotCap, thisDXCoil.MSRatedCOP, @@ -8508,12 +8521,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) ObjexxFCL::Optional_bool_const()); } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed && (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Air || - thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap)) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed && + (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Air || + thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap)) { StandardRatings::CalcTwoSpeedDXCoilRating(state, thisDXCoil.Name, - thisDXCoil.DXCoilType, - thisDXCoil.DXCoilType_Num, + thisDXCoil.coilType, thisDXCoil.RatedTotCap, thisDXCoil.RatedTotCap2, thisDXCoil.RatedCOP, @@ -8535,12 +8548,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // create predefined report entries equipName = thisDXCoil.Name; // put tables for cooling and heating separate - switch (thisDXCoil.DXCoilType_Num) { - case HVAC::CoilDX_CoolingSingleSpeed: - case HVAC::CoilDX_CoolingTwoSpeed: - case HVAC::CoilDX_CoolingTwoStageWHumControl: - case HVAC::CoilDX_MultiSpeedCooling: { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilType, equipName, thisDXCoil.DXCoilType); + switch (thisDXCoil.coilType) { + case HVAC::CoilType::DXCoolingSingleSpeed: + case HVAC::CoilType::DXCoolingTwoSpeed: + case HVAC::CoilType::DXCoolingTwoStageWHumControl: + case HVAC::CoilType::DXMultiSpeedCooling: { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilType, equipName, HVAC::coilTypeNames[(int)thisDXCoil.coilType]); if (thisDXCoil.NumOfSpeeds == 0) { if (thisDXCoil.NumCapacityStages == 1) { PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, equipName, thisDXCoil.RatedTotCap(1)); @@ -8580,11 +8593,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataOutRptPredefined->pdstCoolCoil, "Nominal values are gross at rated conditions, i.e., the supply air fan heat and electric power NOT accounted for."); } break; - case HVAC::CoilDX_HeatingEmpirical: - case HVAC::CoilDX_MultiSpeedHeating: - case HVAC::CoilDX_HeatPumpWaterHeaterPumped: - case HVAC::CoilDX_HeatPumpWaterHeaterWrapped: { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilType, equipName, thisDXCoil.DXCoilType); + + case HVAC::CoilType::DXHeatingEmpirical: + case HVAC::CoilType::DXMultiSpeedHeating: + case HVAC::CoilType::DXHeatPumpWaterHeaterPumped: + case HVAC::CoilType::DXHeatPumpWaterHeaterWrapped: { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilType, equipName, HVAC::coilTypeNames[(int)thisDXCoil.coilType]); if (thisDXCoil.NumOfSpeeds == 0) { if (thisDXCoil.NumCapacityStages == 1) { PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, equipName, thisDXCoil.RatedTotCap(1)); @@ -8721,7 +8735,7 @@ void CalcHPWHDXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (HeatCapFTemp < 0.0) { if (Coil.HCapFTempErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", Coil.DXCoilType, Coil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name)); ShowContinueError( state, format(" HPWH Heating Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", HeatCapFTemp)); if (state.dataCurveManager->PerfCurve(Coil.HCapFTemp)->numDims == 2) { @@ -8737,8 +8751,8 @@ void CalcHPWHDXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - Coil.DXCoilType + " \"" + Coil.Name + - "\": HPWH Heating Capacity Modifier curve (function of temperature) output is negative warning continues...", + format("{} \"{}\": HPWH Heating Capacity Modifier curve (function of temperature) output is negative warning continues...", + HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name), Coil.HCapFTempErrorIndex, HeatCapFTemp, HeatCapFTemp, @@ -8760,7 +8774,7 @@ void CalcHPWHDXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (HeatCOPFTemp < 0.0) { if (Coil.HCOPFTempErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", Coil.DXCoilType, Coil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name)); ShowContinueError(state, format(" HPWH Heating COP Modifier curve (function of temperature) output is negative ({:.3T}).", HeatCOPFTemp)); if (state.dataCurveManager->PerfCurve(Coil.HCOPFTemp)->numDims == 2) { @@ -8776,8 +8790,8 @@ void CalcHPWHDXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - Coil.DXCoilType + " \"" + Coil.Name + - "\": HPWH Heating COP Modifier curve (function of temperature) output is negative warning continues...", + format("{} \"{}\": HPWH Heating COP Modifier curve (function of temperature) output is negative warning continues...", + HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name), Coil.HCOPFTempErrorIndex, HeatCOPFTemp, HeatCOPFTemp, @@ -8796,7 +8810,7 @@ void CalcHPWHDXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (HeatCapFAirFlow < 0.0) { if (Coil.HCapFAirFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", Coil.DXCoilType, Coil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name)); ShowContinueError( state, format(" HPWH Heating Capacity Modifier curve (function of air flow fraction) output is negative ({:.3T}).", HeatCapFAirFlow)); @@ -8805,8 +8819,8 @@ void CalcHPWHDXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - Coil.DXCoilType + " \"" + Coil.Name + - "\": HPWH Heating Capacity Modifier curve (function of air flow fraction) output is negative warning continues...", + format("{} \"{}\": HPWH Heating Capacity Modifier curve (function of air flow fraction) output is negative warning continues...", + HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name), Coil.HCapFAirFlowErrorIndex, HeatCapFAirFlow, HeatCapFAirFlow); @@ -8822,7 +8836,7 @@ void CalcHPWHDXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (HeatCOPFAirFlow < 0.0) { if (Coil.HCOPFAirFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", Coil.DXCoilType, Coil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name)); ShowContinueError( state, format(" HPWH Heating COP Modifier curve (function of air flow fraction) output is negative ({:.3T}).", HeatCOPFAirFlow)); ShowContinueError(state, format(" Negative value occurs using an air flow fraction of {:.3T}.", AirFlowRateRatio)); @@ -8830,8 +8844,8 @@ void CalcHPWHDXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - Coil.DXCoilType + " \"" + Coil.Name + - "\": HPWH Heating COP Modifier curve (function of air flow fraction) output is negative warning continues...", + format("{} \"{}\": HPWH Heating COP Modifier curve (function of air flow fraction) output is negative warning continues...", + HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name), Coil.HCOPFAirFlowErrorIndex, HeatCOPFAirFlow, HeatCOPFAirFlow); @@ -8847,7 +8861,7 @@ void CalcHPWHDXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (HeatCapFWaterFlow < 0.0) { if (Coil.HCapFWaterFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", Coil.DXCoilType, Coil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name)); ShowContinueError(state, format(" HPWH Heating Capacity Modifier curve (function of water flow fraction) output is negative ({:.3T}).", HeatCapFWaterFlow)); @@ -8856,8 +8870,8 @@ void CalcHPWHDXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - Coil.DXCoilType + " \"" + Coil.Name + - "\": HPWH Heating Capacity Modifier curve (function of water flow fraction) output is negative warning continues...", + format("{} \"{}\": HPWH Heating Capacity Modifier curve (function of water flow fraction) output is negative warning continues...", + HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name), Coil.HCapFWaterFlowErrorIndex, HeatCapFWaterFlow, HeatCapFWaterFlow); @@ -8873,7 +8887,7 @@ void CalcHPWHDXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (HeatCOPFWaterFlow < 0.0) { if (Coil.HCOPFWaterFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", Coil.DXCoilType, Coil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name)); ShowContinueError( state, format(" HPWH Heating COP Modifier curve (function of water flow fraction) output is negative ({:.3T}).", HeatCOPFWaterFlow)); @@ -8882,8 +8896,8 @@ void CalcHPWHDXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - Coil.DXCoilType + " \"" + Coil.Name + - "\": HPWH Heating COP Modifier curve (function of water flow fraction) output is negative warning continues...", + format("{} \"{}\": HPWH Heating COP Modifier curve (function of water flow fraction) output is negative warning continues...", + HVAC::coilTypeNames[(int)Coil.coilType], Coil.Name), Coil.HCOPFWaterFlowErrorIndex, HeatCOPFWaterFlow, HeatCOPFWaterFlow); @@ -9043,6 +9057,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcDoe2DXCoil: "); + static constexpr std::string_view routineName = "CalcDoe2DXCoil"; static constexpr std::string_view calcDoe2DXCoil("CalcDoe2DXCoil"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -9248,8 +9263,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } if (thisDXCoil.CondenserType(Mode) == DataHeatBalance::RefrigCondenserType::Air) { ShowRecurringWarningErrorAtEnd(state, - std::string{RoutineName} + thisDXCoil.DXCoilType + "=\"" + thisDXCoil.Name + - "\" - Low condenser dry-bulb temperature error continues...", + format("{}: {}=\"{}\" - Low condenser dry-bulb temperature error continues...", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.LowAmbErrIndex, thisDXCoil.LowTempLast, thisDXCoil.LowTempLast, @@ -9258,8 +9273,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, "[C]"); } else { ShowRecurringWarningErrorAtEnd(state, - std::string{RoutineName} + thisDXCoil.DXCoilType + "=\"" + thisDXCoil.Name + - "\" - Low condenser wet-bulb temperature error continues...", + format("{}: {}=\"{}\" - Low condenser wet-bulb temperature error continues...", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.LowAmbErrIndex, thisDXCoil.LowTempLast, thisDXCoil.LowTempLast, @@ -9284,9 +9299,10 @@ void CalcDoe2DXCoil(EnergyPlusData &state, " 3) is used as part of a HX assisted cooling coil which uses a high sensible effectiveness. Check inputs."); } ShowRecurringWarningErrorAtEnd(state, - std::string{RoutineName} + thisDXCoil.DXCoilType + "=\"" + thisDXCoil.Name + - "\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " - "Outlet air temperature statistics follow:", + format("{}: {}=\"{}\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " + "Outlet air temperature statistics follow:", + + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.LowOutletTempIndex, thisDXCoil.FullLoadOutAirTempLast, thisDXCoil.FullLoadOutAirTempLast); @@ -9300,13 +9316,13 @@ void CalcDoe2DXCoil(EnergyPlusData &state, thisDXCoil.PrintLowOutTempMessage = false; if ((AirMassFlow > 0.0) && - (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0 || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) && + (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0 || thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) && (PartLoadRatio > 0.0) && (compressorOp == HVAC::CompressorOp::On) && CompAmbTemp > thisDXCoil.MinOATCompressor) { // criteria for coil operation if (fanOp == HVAC::FanOp::Cycling) { AirMassFlow /= (PartLoadRatio / DXcoolToHeatPLRRatio); - } else if (fanOp == HVAC::FanOp::Continuous && thisDXCoil.DXCoilType_Num != HVAC::CoilDX_CoolingTwoSpeed) { + } else if (fanOp == HVAC::FanOp::Continuous && thisDXCoil.coilType != HVAC::CoilType::DXCoolingTwoSpeed) { AirMassFlow *= AirFlowRatio; } else { AirMassFlow = thisDXCoil.RatedAirMassFlowRate(Mode); @@ -9324,16 +9340,17 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // AirVolumeFlowRate = AirMassFlow/ PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { ShowFatalError( - state, format("{}{}=\"{}\" - Rated total cooling capacity is zero or less.", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + state, format("{}{}=\"{}\" - Rated total cooling capacity is zero or less.", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { VolFlowperRatedTotCap = AirVolumeFlowRate / thisDXCoil.RatedTotCap2; } else { VolFlowperRatedTotCap = AirVolumeFlowRate / thisDXCoil.RatedTotCap(Mode); } - if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag && thisDXCoil.DXCoilType_Num != HVAC::CoilDX_HeatPumpWaterHeaterPumped && - thisDXCoil.DXCoilType_Num != HVAC::CoilDX_HeatPumpWaterHeaterWrapped && + if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag && + thisDXCoil.coilType != HVAC::CoilType::DXHeatPumpWaterHeaterPumped && + thisDXCoil.coilType != HVAC::CoilType::DXHeatPumpWaterHeaterWrapped && ((VolFlowperRatedTotCap < HVAC::MinOperVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT]) || (VolFlowperRatedTotCap > HVAC::MaxCoolVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT]))) { if (thisDXCoil.ErrIndex1 == 0) { @@ -9341,7 +9358,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, state, format("{}{}=\"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at {:.3R} m3/s/W.", RoutineName, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); @@ -9354,14 +9371,14 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - std::string{RoutineName} + thisDXCoil.DXCoilType + "=\"" + thisDXCoil.Name + - "\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", - thisDXCoil.ErrIndex1, + format("{}: {}=\"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), + thisDXCoil.ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); } else if (!state.dataGlobal->WarmupFlag && - (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) && + (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) && ((VolFlowperRatedTotCap < HVAC::MinOperVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT]) || (VolFlowperRatedTotCap > HVAC::MaxHeatVolFlowPerRatedTotCap[(int)state.dataHVACGlobal->DXCT]))) { if (thisDXCoil.ErrIndex1 == 0) { @@ -9369,7 +9386,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, state, format("{}{}=\"{}\" - Air volume flow rate per watt of rated total water heating capacity is out of range at {:.2R} m3/s/W.", RoutineName, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); @@ -9383,8 +9400,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - std::string{RoutineName} + thisDXCoil.DXCoilType + "=\"" + thisDXCoil.Name + - "\" - Air volume flow rate per watt of rated total water heating capacity is out of range error continues...", + format("{}: {}=\"{}\" - Air volume flow rate per watt of rated total water heating capacity is out of range error continues...", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); @@ -9413,7 +9430,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, if (thisDXCoil.LowAmbErrIndex == 0) { thisDXCoil.LowAmbBuffer1 = format("{} \"{}\" - Air-cooled condenser inlet dry-bulb temperature below 0 C. Outdoor dry-bulb temperature = {:.2R}", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, OutdoorDryBulb); thisDXCoil.LowAmbBuffer2 = " ... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + @@ -9427,7 +9444,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, if (thisDXCoil.LowAmbErrIndex == 0) { thisDXCoil.LowAmbBuffer1 = format("{} \"{}\" - Evap-cooled condenser inlet wet-bulb temperature below 10 C. Outdoor wet-bulb temperature = {:.2R}", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, OutdoorWetBulb); thisDXCoil.LowAmbBuffer2 = " ... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + @@ -9441,8 +9458,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, InletAirHumRatTemp = InletAirHumRat; AirMassFlowRatio = AirMassFlow / thisDXCoil.RatedAirMassFlowRate(Mode); while (true) { - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { // Coil:DX:HeatPumpWaterHeater does not have total cooling capacity as a function of temp or flow curve TotCapTempModFac = 1.0; TotCapFlowModFac = 1.0; @@ -9456,7 +9473,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (TotCapTempModFac < 0.0) { if (thisDXCoil.CCapFTempErrorIndex == 0) { - ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format(" Total Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCapTempModFac)); @@ -9477,8 +9494,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - std::string{RoutineName} + thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\": Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", + format("{}; {}=\"{}\" - Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.CCapFTempErrorIndex, TotCapTempModFac, TotCapTempModFac); @@ -9490,7 +9507,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (TotCapFlowModFac < 0.0) { if (thisDXCoil.CCapFFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format(" Total Cooling Capacity Modifier curve (function of flow fraction) output is negative ({:.3T}).", TotCapFlowModFac)); @@ -9502,8 +9519,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - std::string{RoutineName} + thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\": Total Cooling Capacity Modifier curve (function of flow fraction) output is negative warning continues...", + format("{}: {}=\"{}\" - Total Cooling Capacity Modifier curve (function of flow fraction) output is negative warning continues..", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.CCapFFlowErrorIndex, TotCapFlowModFac, TotCapFlowModFac); @@ -9564,26 +9581,31 @@ void CalcDoe2DXCoil(EnergyPlusData &state, if (PLF < 0.7) { if (thisDXCoil.ErrIndex2 == 0) { - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { - ShowWarningMessage(state, format("{}{}=\"{}\", PLF curve value", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { + ShowWarningMessage(state, format("{}{}=\"{}\", PLF curve value", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("The PLF curve value = {:.3T} for part-load ratio = {:.3T}", PLF, PartLoadRatio)); ShowContinueErrorTimeStamp(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); - ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", thisDXCoil.DXCoilType)); + ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", HVAC::coilTypeNames[(int)thisDXCoil.coilType])); } else { - ShowWarningMessage(state, format("{}{}=\"{}\", PLF curve value", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{}=\"{}\", PLF curve value", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, format("The PLF curve value = {:.3T} for part-load ratio = {:.3T}", PLF, PartLoadRatio)); ShowContinueErrorTimeStamp(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); - ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", thisDXCoil.DXCoilType)); + ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", HVAC::coilTypeNames[(int)thisDXCoil.coilType])); } } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { ShowRecurringWarningErrorAtEnd( - state, thisDXCoil.Name + ", " + thisDXCoil.DXCoilType + " PLF curve < 0.7 warning continues...", thisDXCoil.ErrIndex2, PLF, PLF); + state, + format("{}=\"{}\" - PLF curve < 0.7 warning continues...", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), + thisDXCoil.ErrIndex2, PLF, PLF); } else { ShowRecurringWarningErrorAtEnd( - state, thisDXCoil.Name + ", " + thisDXCoil.DXCoilType + " PLF curve < 0.7 warning continues...", thisDXCoil.ErrIndex2, PLF, PLF); + state, + format("{}=\"{}\" - PLF curve < 0.7 warning continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), + thisDXCoil.ErrIndex2, PLF, PLF); } PLF = 0.7; } @@ -9592,31 +9614,33 @@ void CalcDoe2DXCoil(EnergyPlusData &state, thisDXCoil.CoolingCoilRuntimeFraction = PartLoadRatio / PLF; if (thisDXCoil.CoolingCoilRuntimeFraction > 1.0 && std::abs(thisDXCoil.CoolingCoilRuntimeFraction - 1.0) > 0.001) { if (thisDXCoil.ErrIndex3 == 0) { - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { - ShowWarningMessage(state, format("{}{}=\"{}\", runtime fraction", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { + ShowWarningMessage(state, format("{}{}=\"{}\", runtime fraction", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowWarningMessage(state, format("The runtime fraction exceeded 1.0. [{:.4R}].", thisDXCoil.CoolingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction reset to 1 and the simulation will continue."); - ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", thisDXCoil.DXCoilType)); + ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", HVAC::coilTypeNames[(int)thisDXCoil.coilType])); ShowContinueErrorTimeStamp(state, ""); } else { - ShowWarningMessage(state, format("{}{}=\"{}\", runtime fraction", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{}=\"{}\", runtime fraction", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowWarningMessage(state, format("The runtime fraction exceeded 1.0. [{:.4R}].", thisDXCoil.CoolingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction reset to 1 and the simulation will continue."); - ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", thisDXCoil.DXCoilType)); + ShowContinueError(state, format("Check the IO reference manual for PLF curve guidance [{}].", HVAC::coilTypeNames[(int)thisDXCoil.coilType])); ShowContinueErrorTimeStamp(state, ""); } } - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { ShowRecurringWarningErrorAtEnd(state, - thisDXCoil.Name + ", " + thisDXCoil.DXCoilType + " runtime fraction > 1.0 warning continues...", + format("{}=\"{}\" - runtime fraction > 1.0 warning continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex3, thisDXCoil.CoolingCoilRuntimeFraction, thisDXCoil.CoolingCoilRuntimeFraction); } else { ShowRecurringWarningErrorAtEnd(state, - thisDXCoil.Name + ", " + thisDXCoil.DXCoilType + " runtime fraction > 1.0 warning continues...", + format("{}=\"{}\" - runtime fraction > 1.0 warning continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex3, thisDXCoil.CoolingCoilRuntimeFraction, thisDXCoil.CoolingCoilRuntimeFraction); @@ -9675,7 +9699,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, thisDXCoil.FullLoadInletAirTempLast = InletAirDryBulbTemp; thisDXCoil.LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " "possibility of coil frost/freeze. Outlet temperature = {:.2R} C.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, FullLoadOutAirTemp); thisDXCoil.LowOutTempBuffer2 = " ...Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + @@ -9816,8 +9840,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { + if (thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterPumped || + thisDXCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterWrapped) { // Coil:DX:HeatPumpWaterHeater does not have EIR temp or flow curves EIRTempModFac = 1.0; EIRFlowModFac = 1.0; @@ -9827,7 +9851,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (EIRTempModFac < 0.0) { if (thisDXCoil.EIRFTempErrorIndex == 0) { - ShowWarningMessage(state, format("{}{}=\"{}\":", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{}=\"{}\":", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format(" Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).", EIRTempModFac)); if (state.dataCurveManager->PerfCurve(thisDXCoil.EIRFTemp(Mode))->numDims == 2) { @@ -9846,8 +9870,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - std::string{RoutineName} + thisDXCoil.DXCoilType + "=\"" + thisDXCoil.Name + - "\": Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...", + format("{}: {}=\"{}\" - Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.EIRFTempErrorIndex, EIRTempModFac, EIRTempModFac); @@ -9859,7 +9883,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (EIRFlowModFac < 0.0) { if (thisDXCoil.EIRFFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{}{}=\"{}\":", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{}=\"{}\":", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format(" Energy Input Ratio Modifier curve (function of flow fraction) output is negative ({:.3T}).", EIRFlowModFac)); ShowContinueError(state, format(" Negative value occurs using an air flow fraction of {:.3T}.", AirMassFlowRatio)); @@ -9870,8 +9894,8 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - std::string{RoutineName} + thisDXCoil.DXCoilType + "=\"" + thisDXCoil.Name + - "\": Energy Input Ratio Modifier curve (function of flow fraction) output is negative warning continues...", + format("{}: {}=\"{}\" - Energy Input Ratio Modifier curve (function of flow fraction) output is negative warning continues...", + routineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.EIRFFlowErrorIndex, EIRFlowModFac, EIRFlowModFac); @@ -9931,7 +9955,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, thisDXCoil.BasinHeaterSchedulePtr, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed) { thisDXCoil.BasinHeaterPower *= (1.0 - thisDXCoil.CoolingCoilRuntimeFraction); } } @@ -9968,7 +9992,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } // Calculate basin heater power - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { + if (thisDXCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { if (any_eq(thisDXCoil.CondenserType, DataHeatBalance::RefrigCondenserType::Evap)) { CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, @@ -10233,8 +10257,8 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, ShowContinueError(state, "... Operation at low inlet temperatures may require special performance curves."); } ShowRecurringWarningErrorAtEnd(state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\" - Low condenser inlet temperature error continues...", + format("{}=\"{}\" - Low condenser inlet temperature error continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.LowAmbErrIndex, thisDXCoil.LowTempLast, thisDXCoil.LowTempLast, @@ -10252,8 +10276,8 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, ShowContinueError(state, "... Operation at high inlet temperatures may require special performance curves."); } ShowRecurringWarningErrorAtEnd(state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\" - High condenser inlet temperature error continues...", + format("{}=\"{}\" - High condenser inlet temperature error continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.HighAmbErrIndex, thisDXCoil.HighTempLast, thisDXCoil.HighTempLast, @@ -10277,9 +10301,9 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, " 3) is used as part of a HX assisted cooling coil which uses a high sensible effectiveness. Check inputs."); } ShowRecurringWarningErrorAtEnd(state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " - "Outlet air temperature statistics follow:", + format("{}=\"{}\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " + "Outlet air temperature statistics follow:", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.LowOutletTempIndex, thisDXCoil.FullLoadOutAirTempLast, thisDXCoil.FullLoadOutAirTempLast); @@ -10312,7 +10336,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, VolFlowperRatedTotCap = AirVolumeFlowRate / thisDXCoil.RatedTotCap(Mode); if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { - ShowFatalError(state, format("{} \"{}\" - Rated total cooling capacity is zero or less.", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowFatalError(state, format("{} \"{}\" - Rated total cooling capacity is zero or less.", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); } if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag && @@ -10322,7 +10346,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at {:.3R} m3/s/W.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); @@ -10349,8 +10373,8 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", + format("{}=\"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); @@ -10377,7 +10401,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, thisDXCoil.LowTempLast = OutdoorDryBulb; if (thisDXCoil.LowAmbErrIndex == 0) { thisDXCoil.LowAmbBuffer1 = format("{} \"{}\" - Condenser inlet temperature below {:.2R} C. Condenser inlet temperature = {:.2R}", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, thisDXCoil.MinOATCompressor, OutdoorDryBulb); @@ -10392,7 +10416,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, thisDXCoil.HighTempLast = OutdoorDryBulb; if (thisDXCoil.HighAmbErrIndex == 0) { thisDXCoil.HighAmbBuffer1 = format("{} \"{}\" - Condenser inlet temperature above {:.2R} C. Condenser temperature = {:.2R}", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, thisDXCoil.MaxOATCompressor, OutdoorDryBulb); @@ -10419,7 +10443,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (TotCapTempModFac < 0.0) { if (thisDXCoil.CCapFTempErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCapTempModFac)); ShowContinueError( @@ -10434,8 +10458,8 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\": Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", + format("{}=\"{}\" - Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.CCapFTempErrorIndex, TotCapTempModFac, TotCapTempModFac); @@ -10449,7 +10473,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, // Warn user if curve output goes negative if (TotCapFlowModFac < 0.0) { if (thisDXCoil.CCapFFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{} \"{}\":", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{} \"{}\":", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of flow fraction) output is negative ({:.3T}).", TotCapFlowModFac)); @@ -10461,8 +10485,8 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\": Total Cooling Capacity Modifier curve (function of flow fraction) output is negative warning continues...", + format("{}=\"{}\" - Total Cooling Capacity Modifier curve (function of flow fraction) output is negative warning continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.CCapFFlowErrorIndex, TotCapFlowModFac, TotCapFlowModFac); @@ -10585,7 +10609,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, thisDXCoil.FullLoadInletAirTempLast = InletAirDryBulbTemp; thisDXCoil.LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " "possibility of coil frost/freeze. Outlet temperature = {:.2R} C.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, FullLoadOutAirTemp); thisDXCoil.LowOutTempBuffer2 = " ...Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + @@ -10889,7 +10913,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range at {:.3R} m3/s/W.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); @@ -10902,8 +10926,8 @@ void CalcDXHeatingCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues...", + format("{}=\"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); @@ -10928,14 +10952,16 @@ void CalcDXHeatingCoil(EnergyPlusData &state, } else { switch (thisDXCoil.HeatingPerformanceOATType) { case HVAC::OATType::DryBulb: { - if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating && thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_FluidTCtrl_Heating) { + if (thisDXCoil.coilType != HVAC::CoilType::VRFHeating && + thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlHeating) { TotCapTempModFac = CurveValue(state, thisDXCoil.CCapFTemp(Mode), OutdoorDryBulb); } else { TotCapTempModFac = CurveValue(state, thisDXCoil.CCapFTemp(Mode), InletAirDryBulbTemp); } } break; case HVAC::OATType::WetBulb: { - if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating && thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_FluidTCtrl_Heating) { + if (thisDXCoil.coilType != HVAC::CoilType::VRFHeating && + thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlHeating) { TotCapTempModFac = CurveValue(state, thisDXCoil.CCapFTemp(Mode), OutdoorWetBulb); } else { TotCapTempModFac = CurveValue(state, thisDXCoil.CCapFTemp(Mode), InletAirDryBulbTemp); @@ -10954,7 +10980,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, ShowContinueError(state, "TotCapTempModFac curve value must be > 0. TotCapTempModFac curve value has been reset to 0.0 and " "simulation is continuing."); - ShowContinueError(state, format("Check the IO reference manual for TotCapTempModFac curve guidance [ {} ].", thisDXCoil.DXCoilType)); + ShowContinueError(state, format("Check the IO reference manual for TotCapTempModFac curve guidance [ {} ].", HVAC::coilTypeNames[(int)thisDXCoil.coilType])); ShowContinueErrorTimeStamp(state, ""); } ShowRecurringWarningErrorAtEnd(state, @@ -11052,7 +11078,8 @@ void CalcDXHeatingCoil(EnergyPlusData &state, // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quadratic curve if sufficient manufacturer data is available. - if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating && thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_FluidTCtrl_Heating) { + if (thisDXCoil.coilType != HVAC::CoilType::VRFHeating && + thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlHeating) { if (state.dataCurveManager->PerfCurve(thisDXCoil.EIRFTemp(Mode))->numDims == 1) { EIRTempModFac = CurveValue(state, thisDXCoil.EIRFTemp(Mode), OutdoorDryBulb); } else { @@ -11069,7 +11096,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, ShowWarningMessage(state, format("The EIRTempModFac curve value for DX heating coil {} ={:.2R}", thisDXCoil.Name, EIRTempModFac)); ShowContinueError( state, "EIRTempModFac curve value must be > 0. EIRTempModFac curve value has been reset to 0.0 and simulation is continuing."); - ShowContinueError(state, format("Check the IO reference manual for EIRTempModFac curve guidance [ {} ].", thisDXCoil.DXCoilType)); + ShowContinueError(state, format("Check the IO reference manual for EIRTempModFac curve guidance [ {} ].", HVAC::coilTypeNames[(int)thisDXCoil.coilType])); ShowContinueErrorTimeStamp(state, ""); } ShowRecurringWarningErrorAtEnd(state, @@ -11087,7 +11114,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, } else { PLRHeating = 0.0; } - if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating) { + if (thisDXCoil.coilType != HVAC::CoilType::VRFHeating) { PLF = CurveValue(state, thisDXCoil.PLFFPLR(Mode), PLRHeating); // Calculate part-load factor } else { PLF = 1.0; @@ -11794,7 +11821,7 @@ Real64 AdjustCBF(Real64 const CBFNom, // nominal coil bypass factor } Real64 CalcCBF(EnergyPlusData &state, - std::string const &UnitType, + HVAC::CoilType coilType, std::string const &UnitName, Real64 const InletAirTemp, // inlet air temperature [C] Real64 const InletAirHumRat, // inlet air humidity ratio [kg water / kg dry air] @@ -11872,7 +11899,7 @@ Real64 CalcCBF(EnergyPlusData &state, // Pressure will have to be pass into this subroutine to fix this one OutletAirRH = PsyRhFnTdbWPb(state, OutletAirTemp, OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); if (OutletAirRH >= 1.0 && PrintFlag) { - ShowWarningError(state, format("For object = {}, name = \"{}\"", UnitType, UnitName)); + ShowWarningError(state, format("For object = {}, name = \"{}\"", HVAC::coilTypeNames[(int)coilType], UnitName)); 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"); @@ -11909,7 +11936,7 @@ Real64 CalcCBF(EnergyPlusData &state, } DeltaT = InletAirTemp - OutletAirTemp; if (DeltaT <= 0.0) { - ShowSevereError(state, format("For object = {}, name = \"{}\"", UnitType, UnitName)); + ShowSevereError(state, format("For object = {}, name = \"{}\"", HVAC::coilTypeNames[(int)coilType], UnitName)); ShowContinueError(state, "Calculated coil delta T is less than or equal to 0. The combination of"); ShowContinueError(state, "rated air volume flow rate, total cooling capacity and sensible heat ratio yields coil exiting"); ShowContinueError(state, "air conditions that are not reasonable. Possible fixes are to adjust the rated total cooling"); @@ -11941,7 +11968,7 @@ Real64 CalcCBF(EnergyPlusData &state, if (SlopeAtConds < 0.0 || OutletAirHumRat <= 0.0) { // Invalid conditions, slope can't be less than zero (SHR > 1) or // outlet air humidity ratio can't be less than zero. - ShowSevereError(state, format("{} \"{}\"", UnitType, UnitName)); + ShowSevereError(state, format("{} \"{}\"", HVAC::coilTypeNames[(int)coilType], UnitName)); 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", InletAirTemp)); @@ -12007,7 +12034,7 @@ Real64 CalcCBF(EnergyPlusData &state, ADPEnthalpy = PsyHFnTdbW(ADPTemp, ADPHumRat); CBF = min(1.0, (OutletAirEnthalpy - ADPEnthalpy) / (InletAirEnthalpy - ADPEnthalpy)); if (Iter > IterMax && PrintFlag) { - ShowSevereError(state, format("{} \"{}\" -- coil bypass factor calculation did not converge after max iterations.", UnitType, UnitName)); + ShowSevereError(state, format("{} \"{}\" -- coil bypass factor calculation did not converge after max iterations.", HVAC::coilTypeNames[(int)coilType], UnitName)); ShowContinueError(state, format("The RatedSHR of [{:.3R}], entered by the user or autosized (see *.eio file),", SHR)); 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"); @@ -12021,7 +12048,7 @@ Real64 CalcCBF(EnergyPlusData &state, CBFErrors = true; // Didn't converge within MaxIter iterations } if (CBF < 0.0 && PrintFlag) { - ShowSevereError(state, format("{} \"{}\" -- negative coil bypass factor calculated.", UnitType, UnitName)); + ShowSevereError(state, format("{} \"{}\" -- negative coil bypass factor calculated.", HVAC::coilTypeNames[(int)coilType], UnitName)); ShowContinueErrorTimeStamp(state, ""); CBFErrors = true; // Negative CBF not valid } @@ -12029,14 +12056,14 @@ Real64 CalcCBF(EnergyPlusData &state, // Show fatal error for specific coil that caused a CBF error if (CBFErrors) { - ShowFatalError(state, format("{} \"{}\" Errors found in calculating coil bypass factors", UnitType, UnitName)); + ShowFatalError(state, format("{} \"{}\" Errors found in calculating coil bypass factors", HVAC::coilTypeNames[(int)coilType], UnitName)); } return CBF; } Real64 ValidateADP(EnergyPlusData &state, - std::string const &UnitType, // component name + HVAC::CoilType coilType, // component name std::string const &UnitName, // component type Real64 const RatedInletAirTemp, // coil inlet air temperature [C] Real64 const RatedInletAirHumRat, // coil inlet air humidity ratio [kg/kg] @@ -12090,7 +12117,7 @@ Real64 ValidateADP(EnergyPlusData &state, AirMassFlow = AirVolFlowRate * PsyRhoAirFnPbTdbW(state, DataEnvironment::StdPressureSeaLevel, RatedInletAirTemp, RatedInletAirHumRat, CallingRoutine); while (bStillValidating) { - CBF_calculated = max(0.0, CalcCBF(state, UnitType, UnitName, RatedInletAirTemp, RatedInletAirHumRat, TotCap, AirMassFlow, SHR, bNoReporting)); + CBF_calculated = max(0.0, CalcCBF(state, coilType, UnitName, RatedInletAirTemp, RatedInletAirHumRat, TotCap, AirMassFlow, SHR, bNoReporting)); DeltaH = TotCap / AirMassFlow; InletAirEnthalpy = PsyHFnTdbW(RatedInletAirTemp, RatedInletAirHumRat); HTinHumRatOut = InletAirEnthalpy - (1.0 - SHR) * DeltaH; @@ -12197,7 +12224,7 @@ Real64 CalcEffectiveSHR(EnergyPlusData &state, auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); - if (thisDXCoil.DXCoilType_Num != HVAC::CoilDX_MultiSpeedCooling) { + if (thisDXCoil.coilType != HVAC::CoilType::DXMultiSpeedCooling) { Twet_Rated = thisDXCoil.Twet_Rated(Mode); Gamma_Rated = thisDXCoil.Gamma_Rated(Mode); Nmax = thisDXCoil.MaxONOFFCyclesperHour(Mode); @@ -12581,7 +12608,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, if ((AirMassFlow > 0.0) && (CycRatio > 0.0) && (MSHPMassFlowRateHigh == 0.0)) { ShowSevereError( state, - format("CalcMultiSpeedDXCoilCooling: {} \"{} Developer error - inconsistent airflow rates.", thisDXCoil.DXCoilType, thisDXCoil.Name)); + format("CalcMultiSpeedDXCoilCooling: {} \"{} Developer error - inconsistent airflow rates.", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); if (MSHPMassFlowRateLow == 0.0 && SpeedNum > 1) { ShowContinueError(state, "When AirMassFlow > 0.0 and CycRatio > 0.0 and SpeedNum > 1, then MSHPMassFlowRateLow and MSHPMassFlowRateHigh " @@ -12605,7 +12632,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, } else if (CycRatio > 1.0 || SpeedRatio > 1.0) { ShowSevereError( state, - format("CalcMultiSpeedDXCoilCooling: {} \"{} Developer error - inconsistent speed ratios.", thisDXCoil.DXCoilType, thisDXCoil.Name)); + format("CalcMultiSpeedDXCoilCooling: {} \"{} Developer error - inconsistent speed ratios.", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, "CycRatio and SpeedRatio must be between 0.0 and 1.0"); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format("CycRatio={:.1R}, SpeedRatio = {:.1R}", CycRatio, SpeedRatio)); @@ -12656,7 +12683,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at speed {}.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumLS)); ShowContinueErrorTimeStamp(state, ""); @@ -12671,7 +12698,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range " "at speed {} error continues...", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumLS), thisDXCoil.MSErrIndex(SpeedNumLS), @@ -12691,7 +12718,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at speed {}.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumHS)); ShowContinueErrorTimeStamp(state, ""); @@ -12706,7 +12733,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range " "at speed {} error continues...", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumHS), thisDXCoil.MSErrIndex(SpeedNumHS), @@ -12994,7 +13021,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at speed {}.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNum)); ShowContinueErrorTimeStamp(state, ""); @@ -13009,7 +13036,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range " "at speed {} error continues...", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumHS), thisDXCoil.MSErrIndex(SpeedNumHS), @@ -13391,7 +13418,8 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, if ((AirMassFlow > 0.0) && (CycRatio > 0.0) && (MSHPMassFlowRateHigh == 0.0)) { ShowSevereError( state, - format("CalcMultiSpeedDXCoilHeating: {} \"{} Developer error - inconsistent airflow rates.", thisDXCoil.DXCoilType, thisDXCoil.Name)); + format("CalcMultiSpeedDXCoilHeating: {} \"{} Developer error - inconsistent airflow rates.", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); if (MSHPMassFlowRateLow == 0.0 && SpeedNum > 1) { ShowContinueError(state, "When AirMassFlow > 0.0 and CycRatio > 0.0 and SpeedNum > 1, then MSHPMassFlowRateLow and MSHPMassFlowRateHigh " @@ -13415,7 +13443,8 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, } else if (CycRatio > 1.0 || SpeedRatio > 1.0) { ShowSevereError( state, - format("CalcMultiSpeedDXCoilHeating: {} \"{} Developer error - inconsistent speed ratios.", thisDXCoil.DXCoilType, thisDXCoil.Name)); + format("CalcMultiSpeedDXCoilHeating: {} \"{} Developer error - inconsistent speed ratios.", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError(state, "CycRatio and SpeedRatio must be between 0.0 and 1.0"); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format("CycRatio={:.1R}, SpeedRatio = {:.1R}", CycRatio, SpeedRatio)); @@ -13493,7 +13522,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range at speed {}.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumLS)); ShowContinueErrorTimeStamp(state, ""); @@ -13508,7 +13537,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range " "at speed {} error continues...", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumLS), thisDXCoil.MSErrIndex(SpeedNumLS), @@ -13527,7 +13556,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range at speed {}.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumHS)); ShowContinueErrorTimeStamp(state, ""); @@ -13542,7 +13571,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range " "at speed {} error continues...", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, SpeedNumHS), thisDXCoil.MSErrIndex(SpeedNumHS), @@ -13775,7 +13804,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, if (thisDXCoil.ErrIndex1 == 0) { ShowWarningMessage(state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range at speed 1.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -13788,8 +13817,9 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues at speed 1...", + format("{}=\"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues at speed 1...", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), + thisDXCoil.ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); @@ -14083,17 +14113,17 @@ void ReportDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the c Real64 ratedSensCap(0.0); ratedSensCap = thisDXCoil.RatedTotCap(1) * thisDXCoil.RatedSHR(1); state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes( - state, thisDXCoil.Name, thisDXCoil.DXCoilType, thisDXCoil.RatedTotCap(1), ratedSensCap, thisDXCoil.RatedAirVolFlowRate(1), -999.0); + state, thisDXCoil.Name, thisDXCoil.coilType, thisDXCoil.RatedTotCap(1), ratedSensCap, thisDXCoil.RatedAirVolFlowRate(1), -999.0); thisDXCoil.reportCoilFinalSizes = false; } } Real64 ReportingConstant = state.dataHVACGlobal->TimeStepSysSec; - switch (thisDXCoil.DXCoilType_Num) { - case HVAC::CoilDX_HeatingEmpirical: - case HVAC::CoilVRF_Heating: - case HVAC::CoilVRF_FluidTCtrl_Heating: { + switch (thisDXCoil.coilType) { + case HVAC::CoilType::DXHeatingEmpirical: + case HVAC::CoilType::VRFHeating: + case HVAC::CoilType::VRFFluidTCtrlHeating: { thisDXCoil.TotalHeatingEnergy = thisDXCoil.TotalHeatingEnergyRate * ReportingConstant; thisDXCoil.ElecHeatingConsumption = thisDXCoil.ElecHeatingPower * ReportingConstant; thisDXCoil.DefrostConsumption = thisDXCoil.DefrostPower * ReportingConstant; @@ -14101,7 +14131,8 @@ void ReportDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the c state.dataHVACGlobal->DXElecHeatingPower = thisDXCoil.ElecHeatingPower + thisDXCoil.CrankcaseHeaterPower; state.dataHVACGlobal->DefrostElecPower = thisDXCoil.DefrostPower; } break; - case HVAC::CoilDX_MultiSpeedHeating: { + + case HVAC::CoilType::DXMultiSpeedHeating: { thisDXCoil.TotalHeatingEnergy = thisDXCoil.TotalHeatingEnergyRate * ReportingConstant; if (thisDXCoil.FuelType == Constant::eFuel::Electricity) { thisDXCoil.ElecHeatingConsumption = thisDXCoil.ElecHeatingPower * ReportingConstant; @@ -14113,7 +14144,8 @@ void ReportDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the c state.dataHVACGlobal->DXElecHeatingPower = thisDXCoil.ElecHeatingPower + thisDXCoil.CrankcaseHeaterPower; state.dataHVACGlobal->DefrostElecPower = thisDXCoil.DefrostPower; } break; - case HVAC::CoilDX_MultiSpeedCooling: { + + case HVAC::CoilType::DXMultiSpeedCooling: { thisDXCoil.TotalCoolingEnergy = thisDXCoil.TotalCoolingEnergyRate * ReportingConstant; thisDXCoil.SensCoolingEnergy = thisDXCoil.SensCoolingEnergyRate * ReportingConstant; thisDXCoil.LatCoolingEnergy = thisDXCoil.TotalCoolingEnergy - thisDXCoil.SensCoolingEnergy; @@ -14130,8 +14162,9 @@ void ReportDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the c thisDXCoil.BasinHeaterConsumption = thisDXCoil.BasinHeaterPower * ReportingConstant; } } break; - case HVAC::CoilDX_HeatPumpWaterHeaterPumped: - case HVAC::CoilDX_HeatPumpWaterHeaterWrapped: { + + case HVAC::CoilType::DXHeatPumpWaterHeaterPumped: + case HVAC::CoilType::DXHeatPumpWaterHeaterWrapped: { // water heating energy for HP water heater DX Coil condenser thisDXCoil.TotalHeatingEnergy = thisDXCoil.TotalHeatingEnergyRate * ReportingConstant; // water heating power for HP water heater @@ -14557,7 +14590,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum // Warn user if curve output goes negative if (TotCapFlowModFac < 0.0) { if (thisDXCoil.CCapFFlowErrorIndex == 0) { - ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of flow fraction) output is negative ({:.3T}).", TotCapFlowModFac)); @@ -14568,7 +14601,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum state, format("{}{}\"{}\": Total Cooling Capacity Modifier curve (function of flow fraction) output is negative warning continues...", RoutineName, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.CCapFFlowErrorIndex, TotCapFlowModFac, @@ -14581,7 +14614,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum // Warn user if curve output goes negative if (TotCapTempModFac < 0.0) { if (thisDXCoil.CCapFTempErrorIndex == 0) { - ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCapTempModFac)); @@ -14596,7 +14629,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum state, format("{}{} \"{}\": Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", RoutineName, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.CCapFTempErrorIndex, TotCapTempModFac, @@ -14623,7 +14656,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum // Warn user if curve output goes negative if (TotCapTempModFac < 0.0) { if (thisDXCoil.CCapFTempErrorIndex == 0) { - ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowWarningMessage(state, format("{}{} \"{}\":", RoutineName, HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCapTempModFac)); @@ -14638,7 +14671,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum state, format("{}{} \"{}\": Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", RoutineName, - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.CCapFTempErrorIndex, TotCapTempModFac, @@ -14734,7 +14767,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum for (index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { if (state.dataDXCoils->DXCoil(index).RateWithInternalStaticAndFanObject && - state.dataDXCoils->DXCoil(index).DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { + state.dataDXCoils->DXCoil(index).coilType == HVAC::CoilType::DXCoolingTwoSpeed) { ++countStaticInputs; } } @@ -15075,7 +15108,7 @@ Real64 GetCoilCapacity(EnergyPlusData &state, Real64 GetCoilCapacityByIndexType(EnergyPlusData &state, int const CoilIndex, // must match coil index for the coil type - int const CoilType_Num, // must match coil types in this module + HVAC::CoilType const coilType, // must match coil types in this module bool &ErrorsFound // set to true if problem ) { @@ -15106,15 +15139,15 @@ Real64 GetCoilCapacityByIndexType(EnergyPlusData &state, return CoilCapacity; } - if (CoilType_Num != state.dataDXCoils->DXCoil(CoilIndex).DXCoilType_Num) { + if (coilType != state.dataDXCoils->DXCoil(CoilIndex).coilType) { ShowSevereError(state, "GetCoilCapacityByIndexType: Index passed does not match DX Coil type passed."); ShowContinueError(state, "... returning capacity as -1000."); ErrorsFound = true; CoilCapacity = -1000.0; } else { - switch (state.dataDXCoils->DXCoil(CoilIndex).DXCoilType_Num) { - case HVAC::CoilDX_MultiSpeedCooling: - case HVAC::CoilDX_MultiSpeedHeating: { + switch (state.dataDXCoils->DXCoil(CoilIndex).coilType) { + case HVAC::CoilType::DXMultiSpeedCooling: + case HVAC::CoilType::DXMultiSpeedHeating: { CoilCapacity = state.dataDXCoils->DXCoil(CoilIndex).MSRatedTotCap(state.dataDXCoils->DXCoil(CoilIndex).NumOfSpeeds); } break; default: { @@ -15126,6 +15159,7 @@ Real64 GetCoilCapacityByIndexType(EnergyPlusData &state, return CoilCapacity; } +#ifdef GET_OUT int GetCoilTypeNum(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -15164,7 +15198,7 @@ int GetCoilTypeNum(EnergyPlusData &state, WhichCoil = Util::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - TypeNum = state.dataDXCoils->DXCoil(WhichCoil).DXCoilType_Num; + TypeNum = state.dataDXCoils->DXCoil(WhichCoil).coilType; } else { if (PrintMessage) { ShowSevereError(state, format("GetCoilTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); @@ -15175,6 +15209,7 @@ int GetCoilTypeNum(EnergyPlusData &state, return TypeNum; } +#endif // GET_OUT Real64 GetMinOATCompressor(EnergyPlusData &state, int const CoilIndex, // index to cooling coil @@ -15410,7 +15445,7 @@ Real64 GetDXCoilBypassedFlowFrac(EnergyPlusData &state, } int GetHPCoolingCoilIndex(EnergyPlusData &state, - std::string const &HeatingCoilType, // Type of DX heating coil used in HP + HVAC::CoilType heatingCoilType, // Type of DX heating coil used in HP std::string const &HeatingCoilName, // Name of DX heating coil used in HP int const HeatingCoilIndex // Index of DX heating coil used in HP ) @@ -15434,7 +15469,7 @@ int GetHPCoolingCoilIndex(EnergyPlusData &state, DXCoolingCoilIndex = 0; DataLoopNode::ConnectionObjectType HeatingCoilTypeNum = static_cast( - getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, Util::makeUPPER(HeatingCoilType))); + getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, HVAC::coilTypeNamesUC[(int)heatingCoilType])); DataLoopNode::ConnectionObjectType CompSetsParentType; // Parent object type which uses DX heating coil pass into this function std::string CompSetsParentName; @@ -15623,7 +15658,7 @@ int GetDXCoilAvailSchPtr(EnergyPlusData &state, } Real64 GetDXCoilAirFlow(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module + HVAC::CoilType coilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ) @@ -15651,31 +15686,43 @@ Real64 GetDXCoilAirFlow(EnergyPlusData &state, } WhichCoil = Util::FindItemInList(CoilName, state.dataDXCoils->DXCoil); - if (WhichCoil != 0) { - switch (state.dataDXCoils->DXCoil(WhichCoil).DXCoilType_Num) { - case HVAC::CoilDX_CoolingSingleSpeed: - case HVAC::CoilDX_CoolingTwoSpeed: - case HVAC::CoilDX_HeatingEmpirical: - case HVAC::CoilDX_CoolingTwoStageWHumControl: { - AirFlow = state.dataDXCoils->DXCoil(WhichCoil).RatedAirVolFlowRate(1); - } break; - case HVAC::CoilDX_MultiSpeedCooling: - case HVAC::CoilDX_MultiSpeedHeating: { - AirFlow = state.dataDXCoils->DXCoil(WhichCoil).MSRatedAirVolFlowRate(1); - } break; - default: { - ShowSevereError( - state, - format("GetDXCoilAirFlow: Could not find Coil, Type=\"{}\" Name=\"{}\" when accessing coil air flow rate.", CoilType, CoilName)); - ErrorsFound = true; - AirFlow = -1.0; - } break; - } - } else { + + if (WhichCoil == 0) { ShowSevereError( - state, format("GetDXCoilAirFlow: Could not find Coil, Type=\"{}\" Name=\"{}\" when accessing coil air flow rate.", CoilType, CoilName)); + state, format("GetDXCoilAirFlow: Could not find Coil, Type=\"{}\" Name=\"{}\" when accessing coil air flow rate.", coilType, CoilName)); + ErrorsFound = true; + return -1.0; + } + + auto &dxCoil = state.dataDXCoils->DXCoil(WhichCoil); + + if (dxCoil.coilType != coilType) { + ShowSevereError( + state, format("GetDXCoilAirFlow: Coil \"{}\" has unexpected type.", CoilName, HVAC::coilTypeNames[(int)coilType])); + ErrorsFound = true; + return -1.0; + } + + switch (dxCoil.coilType) { + case HVAC::CoilType::DXCoolingSingleSpeed: + case HVAC::CoilType::DXCoolingTwoSpeed: + case HVAC::CoilType::DXHeatingEmpirical: + case HVAC::CoilType::DXCoolingTwoStageWHumControl: { + AirFlow = dxCoil.RatedAirVolFlowRate(1); + } break; + + case HVAC::CoilType::DXMultiSpeedCooling: + case HVAC::CoilType::DXMultiSpeedHeating: { + AirFlow = dxCoil.MSRatedAirVolFlowRate(1); + } break; + + default: { + ShowSevereError( + state, + format("GetDXCoilAirFlow: Could not find Coil, Type=\"{}\" Name=\"{}\" when accessing coil air flow rate.", HVAC::coilTypeNames[(int)coilType], CoilName)); ErrorsFound = true; AirFlow = -1.0; + } break; } return AirFlow; @@ -15705,34 +15752,36 @@ int GetDXCoilCapFTCurveIndex(EnergyPlusData &state, state.dataDXCoils->GetCoilsInputFlag = false; } - if (CoilIndex != 0) { - switch (state.dataDXCoils->DXCoil(CoilIndex).DXCoilType_Num) { - case HVAC::CoilDX_CoolingSingleSpeed: - case HVAC::CoilDX_CoolingTwoSpeed: - case HVAC::CoilDX_HeatingEmpirical: - case HVAC::CoilDX_CoolingTwoStageWHumControl: { - CapFTCurveIndex = state.dataDXCoils->DXCoil(CoilIndex).CCapFTemp(1); - } break; - case HVAC::CoilDX_MultiSpeedCooling: - case HVAC::CoilDX_MultiSpeedHeating: { - CapFTCurveIndex = state.dataDXCoils->DXCoil(CoilIndex).MSCCapFTemp(state.dataDXCoils->DXCoil(CoilIndex).NumOfSpeeds); - } break; - case HVAC::CoilVRF_Heating: { - CapFTCurveIndex = state.dataDXCoils->DXCoil(CoilIndex).CCapFTemp(1); - } break; - default: { - // CALL ShowSevereError(state, 'GetDXCoilCapFTCurveIndex: Could not find Coil, Type="'// & - // TRIM(cAllCoilTypes(DXCoil(CoilIndex)%DXCoilType_Num))//'" Name="'//TRIM(DXCoil(CoilIndex)%Name)// & - // '" when accessing coil capacity as a function of temperature curve.') - ErrorsFound = true; - CapFTCurveIndex = 0; - } break; - } - } else { - // CALL ShowSevereError(state, 'GetDXCoilCapFTCurveIndex: Could not find Coil, Index = 0'// & - // ' when accessing coil air flow rate.') + if (CoilIndex == 0) { ErrorsFound = true; - CapFTCurveIndex = 0; + return 0; + } + + auto &dxCoil = state.dataDXCoils->DXCoil(CoilIndex); + switch (dxCoil.coilType) { + case HVAC::CoilType::DXCoolingSingleSpeed: + case HVAC::CoilType::DXCoolingTwoSpeed: + case HVAC::CoilType::DXHeatingEmpirical: + case HVAC::CoilType::DXCoolingTwoStageWHumControl: { + CapFTCurveIndex = dxCoil.CCapFTemp(1); + } break; + + case HVAC::CoilType::DXMultiSpeedCooling: + case HVAC::CoilType::DXMultiSpeedHeating: { + CapFTCurveIndex = dxCoil.MSCCapFTemp(dxCoil.NumOfSpeeds); + } break; + + case HVAC::CoilType::VRFHeating: { + CapFTCurveIndex = dxCoil.CCapFTemp(1); + } break; + + default: { + // CALL ShowSevereError(state, 'GetDXCoilCapFTCurveIndex: Could not find Coil, Type="'// & + // TRIM(cAllCoilTypes(DXCoil(CoilIndex)%coilType))//'" Name="'//TRIM(DXCoil(CoilIndex)%Name)// & + // '" when accessing coil capacity as a function of temperature curve.') + ErrorsFound = true; + CapFTCurveIndex = 0; + } break; } return CapFTCurveIndex; @@ -15882,7 +15931,7 @@ void SetDXCoolingCoilData( if (thisDXCoil.SupplyFanIndex > 0) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(state, thisDXCoil.Name, - thisDXCoil.DXCoilType, + thisDXCoil.coilType, state.dataFans->fans(thisDXCoil.SupplyFanIndex)->Name, state.dataFans->fans(thisDXCoil.SupplyFanIndex)->type, thisDXCoil.SupplyFanIndex); @@ -16101,10 +16150,10 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); // Select the correct unit type - switch (thisDXCoil.DXCoilType_Num) { - case HVAC::CoilDX_CoolingSingleSpeed: - case HVAC::CoilDX_CoolingTwoSpeed: - case HVAC::CoilDX_MultiSpeedCooling: { + switch (thisDXCoil.coilType) { + case HVAC::CoilType::DXCoolingSingleSpeed: + case HVAC::CoilType::DXCoolingTwoSpeed: + case HVAC::CoilType::DXMultiSpeedCooling: { // total sensible heat gain of the secondary zone from the secondary coil (condenser) if (thisDXCoil.ElecCoolingPower > 0.0) { TotalHeatRejectionRate = thisDXCoil.TotalCoolingEnergyRate + thisDXCoil.ElecCoolingPower; @@ -16114,7 +16163,7 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) } thisDXCoil.SecCoilSensibleHeatGainRate = TotalHeatRejectionRate; } break; - case HVAC::CoilDX_HeatingEmpirical: { + case HVAC::CoilType::DXHeatingEmpirical: { // evaporator coil in the secondary zone if (thisDXCoil.ElecHeatingPower > 0.0) { TotalHeatRemovalRate = max(0.0, thisDXCoil.TotalHeatingEnergyRate - thisDXCoil.ElecHeatingPower); @@ -16180,7 +16229,7 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) } thisDXCoil.SecCoilSHR = SHR; } break; - case HVAC::CoilDX_MultiSpeedHeating: { + case HVAC::CoilType::DXMultiSpeedHeating: { EvapInletDryBulb = secZoneHB.ZT; EvapInletHumRat = secZoneHB.airHumRat; RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, EvapInletDryBulb, EvapInletHumRat); @@ -16629,9 +16678,9 @@ void CalcVRFCoolingCoil_FluidTCtrl(EnergyPlusData &state, " 3) is used as part of a HX assisted cooling coil which uses a high sensible effectiveness. Check inputs."); } ShowRecurringWarningErrorAtEnd(state, - thisDXCoil.DXCoilType + " \"" + thisDXCoil.Name + - "\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " - "Outlet air temperature statistics follow:", + format("{}=\"{}\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " + "Outlet air temperature statistics follow:", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.LowOutletTempIndex, thisDXCoil.FullLoadOutAirTempLast, thisDXCoil.FullLoadOutAirTempLast); @@ -16648,7 +16697,8 @@ void CalcVRFCoolingCoil_FluidTCtrl(EnergyPlusData &state, (compressorOp == HVAC::CompressorOp::On)) { // for cycling fan, reset mass flow to full on rate if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { - ShowFatalError(state, format("{} \"{}\" - Rated total cooling capacity is zero or less.", thisDXCoil.DXCoilType, thisDXCoil.Name)); + ShowFatalError(state, format("{} \"{}\" - Rated total cooling capacity is zero or less.", + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name)); } TotCap = min(MaxCoolCap, thisDXCoil.RatedTotCap(Mode)); @@ -16813,7 +16863,7 @@ void CalcVRFCoolingCoil_FluidTCtrl(EnergyPlusData &state, thisDXCoil.FullLoadInletAirTempLast = InletAirDryBulbTemp; thisDXCoil.LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " "possibility of coil frost/freeze. Outlet temperature = {:.2R} C.", - thisDXCoil.DXCoilType, + HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name, OutletAirTemp); thisDXCoil.LowOutTempBuffer2 = " ...Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + " " + @@ -17062,7 +17112,8 @@ void CalcVRFHeatingCoil_FluidTCtrl(EnergyPlusData &state, // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quaratic curve if sufficient manufacturer data is available. - if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating && thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_FluidTCtrl_Heating) { + if (thisDXCoil.coilType != HVAC::CoilType::VRFHeating && + thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlHeating) { if (state.dataCurveManager->PerfCurve(thisDXCoil.EIRFTemp(Mode))->numDims == 1) { EIRTempModFac = CurveValue(state, thisDXCoil.EIRFTemp(Mode), OutdoorDryBulb); } else { @@ -17082,7 +17133,8 @@ void CalcVRFHeatingCoil_FluidTCtrl(EnergyPlusData &state, PLRHeating = min(1.0, PartLoadRatio); } - if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating && thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_FluidTCtrl_Heating) { + if (thisDXCoil.coilType != HVAC::CoilType::VRFHeating && + thisDXCoil.coilType != HVAC::CoilType::VRFFluidTCtrlHeating) { PLF = CurveValue(state, thisDXCoil.PLFFPLR(Mode), PLRHeating); // Calculate part-load factor } else { PLF = 1.0; diff --git a/src/EnergyPlus/DXCoils.hh b/src/EnergyPlus/DXCoils.hh index 2b56a621a28..8575d5bd820 100644 --- a/src/EnergyPlus/DXCoils.hh +++ b/src/EnergyPlus/DXCoils.hh @@ -111,8 +111,7 @@ namespace DXCoils { // Some variables in this type are arrays (dimension=MaxModes) to support coil type // COIL:DX:MultiMode:CoolingEmpirical. Other coil types only use the first element. std::string Name; // Name of the DX Coil - std::string DXCoilType; // type of coil - int DXCoilType_Num; // Integer equivalent to DXCoilType + HVAC::CoilType coilType = HVAC::CoilType::Invalid; // Integer equivalent to DXCoilType std::string Schedule; // WaterCoil Operation Schedule int SchedPtr; // Pointer to the correct schedule // RatedCoolCap, RatedSHR and RatedCOP do not include the thermal or electrical @@ -281,9 +280,8 @@ namespace DXCoils { // always 1 for other coils int NumDehumidModes; // number of enhanced dehumidification modes, up to MaxDehumidModes for Multimode DX coil, // always 0 for other coils) - Array1D_string CoilPerformanceType; // Coil Performance object type - Array1D_int CoilPerformanceType_Num; // Coil Performance object type number - Array1D_string CoilPerformanceName; // Coil Performance object names + Array1D coilPerformanceTypes; // Coil Performance object type number + Array1D_string coilPerformanceNames; // Coil Performance object names Real64 CoolingCoilStg2RuntimeFrac; // Run time fraction of stage 2 HVAC::CoilMode DehumidificationMode = HVAC::CoilMode::Invalid; // Dehumidification mode for multimode coil, // 0=normal, 1+=enhanced dehumidification mode @@ -455,7 +453,7 @@ namespace DXCoils { // Default Constructor DXCoilData() - : DXCoilType_Num(0), SchedPtr(0), RatedTotCap(MaxModes, 0.0), HeatSizeRatio(1.0), RatedTotCapEMSOverrideOn(MaxModes, false), + : SchedPtr(0), RatedTotCap(MaxModes, 0.0), HeatSizeRatio(1.0), RatedTotCapEMSOverrideOn(MaxModes, false), RatedTotCapEMSOverrideValue(MaxModes, 0.0), RatedSHR(MaxModes, 0.0), RatedSHREMSOverrideOn(MaxModes, false), RatedSHREMSOverrideValue(MaxModes, 0.0), RatedCOP(MaxModes, 0.0), RatedAirVolFlowRate(MaxModes, 0.0), RatedAirVolFlowRateEMSOverrideON(MaxModes, false), RatedAirVolFlowRateEMSOverrideValue(MaxModes, 0.0), @@ -484,8 +482,8 @@ namespace DXCoils { ReportEvapCondVars(false), EvapCondEffect(MaxModes, 0.0), CondInletTemp(0.0), EvapCondAirFlow(MaxModes, 0.0), EvapCondPumpElecNomPower(MaxModes, 0.0), EvapCondPumpElecPower(0.0), EvapCondPumpElecConsumption(0.0), EvapWaterConsumpRate(0.0), EvapWaterConsump(0.0), EvapCondAirFlow2(0.0), EvapCondEffect2(0.0), EvapCondPumpElecNomPower2(0.0), BasinHeaterPower(0.0), - BasinHeaterConsumption(0.0), NumCapacityStages(1), NumDehumidModes(0), CoilPerformanceType(MaxModes), - CoilPerformanceType_Num(MaxModes, 0), CoilPerformanceName(MaxModes), CoolingCoilStg2RuntimeFrac(0.0), WaterInNode(0), WaterOutNode(0), + BasinHeaterConsumption(0.0), NumCapacityStages(1), NumDehumidModes(0), coilPerformanceTypes(MaxModes, HVAC::CoilType::Invalid), + coilPerformanceNames(MaxModes), CoolingCoilStg2RuntimeFrac(0.0), WaterInNode(0), WaterOutNode(0), HCOPFTemp(0), HCOPFTempErrorIndex(0), HCOPFAirFlow(0), HCOPFAirFlowErrorIndex(0), HCOPFWaterFlow(0), HCOPFWaterFlowErrorIndex(0), HCapFTemp(0), HCapFTempErrorIndex(0), HCapFAirFlow(0), HCapFAirFlowErrorIndex(0), HCapFWaterFlow(0), HCapFWaterFlowErrorIndex(0), RatedInletDBTemp(0.0), RatedInletWBTemp(0.0), RatedInletWaterTemp(0.0), HPWHCondPumpElecNomPower(0.0), HPWHCondPumpFracToWater(0.0), @@ -626,7 +624,7 @@ namespace DXCoils { ); Real64 CalcCBF(EnergyPlusData &state, - std::string const &UnitType, + HVAC::CoilType coilType, std::string const &UnitName, Real64 const InletAirTemp, // inlet air temperature [C] Real64 const InletAirHumRat, // inlet air humidity ratio [kg water / kg dry air] @@ -637,7 +635,7 @@ namespace DXCoils { ); Real64 ValidateADP(EnergyPlusData &state, - std::string const &UnitType, // component name + HVAC::CoilType coilType, // component name std::string const &UnitName, // component type Real64 const RatedInletAirTemp, // coil inlet air temperature [C] Real64 const RatedInletAirHumRat, // coil inlet air humidity ratio [kg/kg] @@ -723,7 +721,7 @@ namespace DXCoils { Real64 GetCoilCapacityByIndexType(EnergyPlusData &state, int const CoilIndex, // must match coil index for the coil type - int const CoilType_Num, // must match coil types in this module + HVAC::CoilType const coilType, // must match coil types in this module bool &ErrorsFound // set to true if problem ); @@ -774,7 +772,7 @@ namespace DXCoils { ); int GetHPCoolingCoilIndex(EnergyPlusData &state, - std::string const &HeatingCoilType, // Type of DX heating coil used in HP + HVAC::CoilType heatingCoilType, // Type of DX heating coil used in HP std::string const &HeatingCoilName, // Name of DX heating coil used in HP int const HeatingCoilIndex // Index of DX heating coil used in HP ); diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index 85bcc23d13a..741ce971e1e 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -78,7 +78,7 @@ EnergyPlusData::EnergyPlusData() this->dataChillerIndirectAbsorption = std::make_unique(); this->dataChillerReformulatedEIR = std::make_unique(); this->dataChillerElectricASHRAE205 = std::make_unique(); - this->dataCoilCooingDX = std::make_unique(); + this->dataCoilCoolingDX = std::make_unique(); this->dataCondenserLoopTowers = std::make_unique(); this->dataConstruction = std::make_unique(); this->dataContaminantBalance = std::make_unique(); @@ -334,7 +334,7 @@ void EnergyPlusData::clear_state() this->dataChillerIndirectAbsorption->clear_state(); this->dataChillerReformulatedEIR->clear_state(); this->dataChillerElectricASHRAE205->clear_state(); - this->dataCoilCooingDX->clear_state(); + this->dataCoilCoolingDX->clear_state(); this->dataCondenserLoopTowers->clear_state(); this->dataConstruction->clear_state(); this->dataContaminantBalance->clear_state(); @@ -606,7 +606,7 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataChillerIndirectAbsorption->init_state(state); this->dataChillerReformulatedEIR->init_state(state); this->dataChillerElectricASHRAE205->init_state(state); - this->dataCoilCooingDX->init_state(state); + this->dataCoilCoolingDX->init_state(state); this->dataCondenserLoopTowers->init_state(state); this->dataConstruction->init_state(state); this->dataContaminantBalance->init_state(state); diff --git a/src/EnergyPlus/Data/EnergyPlusData.hh b/src/EnergyPlus/Data/EnergyPlusData.hh index 5d5ea335399..89ea1afdf9d 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.hh +++ b/src/EnergyPlus/Data/EnergyPlusData.hh @@ -338,7 +338,7 @@ struct EnergyPlusData : BaseGlobalStruct std::unique_ptr dataChillerIndirectAbsorption; std::unique_ptr dataChillerReformulatedEIR; std::unique_ptr dataChillerElectricASHRAE205; - std::unique_ptr dataCoilCooingDX; + std::unique_ptr dataCoilCoolingDX; std::unique_ptr dataCondenserLoopTowers; std::unique_ptr dataConstruction; std::unique_ptr dataContaminantBalance; diff --git a/src/EnergyPlus/DataHVACGlobals.cc b/src/EnergyPlus/DataHVACGlobals.cc index b488976c4ba..25a7b5e00be 100644 --- a/src/EnergyPlus/DataHVACGlobals.cc +++ b/src/EnergyPlus/DataHVACGlobals.cc @@ -90,123 +90,283 @@ namespace HVAC { constexpr std::array mixerTypeLocNames = {"InletSide", "SupplySide"}; constexpr std::array mixerTypeLocNamesUC = {"INLETSIDE", "SUPPLYSIDE"}; - Array1D_string const cAllCoilTypes(NumAllCoilTypes, - {"Coil:Cooling:DX:SingleSpeed", - "Coil:Heating:DX:SingleSpeed", - "Coil:Cooling:DX:TwoSpeed", - "CoilSystem:Cooling:DX:HeatExchangerAssisted", - "Coil:Cooling:DX:TwoStageWithHumidityControlMode", - "Coil:WaterHeating:AirToWaterHeatPump:Pumped", - "Coil:WaterHeating:AirToWaterHeatPump:Wrapped", - "Coil:Cooling:DX:MultiSpeed", - "Coil:Heating:DX:MultiSpeed", - "Coil:Heating:Fuel", - "Coil:Heating:Gas:MultiStage", - "Coil:Heating:Electric", - "Coil:Heating:Electric:MultiStage", - "Coil:Heating:Desuperheater", - "Coil:Cooling:Water", - "Coil:Cooling:Water:DetailedGeometry", - "Coil:Heating:Water", - "Coil:Heating:Steam", - "CoilSystem:Cooling:Water:HeatExchangerAssisted", - "Coil:Cooling:WaterToAirHeatPump:ParameterEstimation", - "Coil:Heating:WaterToAirHeatPump:ParameterEstimation", - "Coil:Cooling:WaterToAirHeatPump:EquationFit", - "Coil:Heating:WaterToAirHeatPump:EquationFit", - "Coil:Cooling:DX:VariableRefrigerantFlow", - "Coil:Heating:DX:VariableRefrigerantFlow", - "Coil:UserDefined", - "Coil:Cooling:DX:SingleSpeed:ThermalStorage", - "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit", - "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit", - "Coil:Cooling:DX:VariableSpeed", - "Coil:Heating:DX:VariableSpeed", - "Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed", - "Coil:Cooling:DX:VariableRefrigerantFlow:FluidTemperatureControl", - "Coil:Heating:DX:VariableRefrigerantFlow:FluidTemperatureControl", - "Coil:Cooling:DX", - "Coil:Cooling:DX:SubcoolReheat", - "Coil:Cooling:DX:CurveFit:Speed"}); + constexpr std::array coilTypeNames = { + "Coil:Cooling:DX:SingleSpeed", + "Coil:Heating:DX:SingleSpeed", + "Coil:Cooling:DX:TwoSpeed", + "CoilSystem:Cooling:DX:HeatExchangerAssisted", + "Coil:Cooling:DX:TwoStageWithHumidityControlMode", + "Coil:WaterHeating:AirToWaterHeatPump:Pumped", + "Coil:WaterHeating:AirToWaterHeatPump:Wrapped", + "Coil:Cooling:DX:MultiSpeed", + "Coil:Heating:DX:MultiSpeed", + "Coil:Heating:Fuel", + "Coil:Heating:Gas:MultiStage", + "Coil:Heating:Electric", + "Coil:Heating:Electric:MultiStage", + "Coil:Heating:Desuperheater", + "Coil:Cooling:Water", + "Coil:Cooling:Water:DetailedGeometry", + "Coil:Heating:Water", + "Coil:Heating:Steam", + "CoilSystem:Cooling:Water:HeatExchangerAssisted", + "Coil:Cooling:WaterToAirHeatPump:ParameterEstimation", + "Coil:Heating:WaterToAirHeatPump:ParameterEstimation", + "Coil:Cooling:WaterToAirHeatPump:EquationFit", + "Coil:Heating:WaterToAirHeatPump:EquationFit", + "Coil:Cooling:DX:VariableRefrigerantFlow", + "Coil:Heating:DX:VariableRefrigerantFlow", + "Coil:UserDefined", + "Coil:Cooling:DX:SingleSpeed:ThermalStorage", + "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit", + "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit", + "Coil:Cooling:DX:VariableSpeed", + "Coil:Heating:DX:VariableSpeed", + "Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed", + "Coil:Cooling:DX:VariableRefrigerantFlow:FluidTemperatureControl", + "Coil:Heating:DX:VariableRefrigerantFlow:FluidTemperatureControl", + "Coil:Cooling:DX", + "Coil:Cooling:DX:SubcoolReheat", + "Coil:Cooling:DX:CurveFit:Speed"}; + + constexpr std::array coilTypeNamesUC = { + "COIL:COOLING:DX:SINGLESPEED", + "COIL:HEATING:DX:SINGLESPEED", + "COIL:COOLING:DX:TWOSPEED", + "COILSYSTEM:COOLING:DX:HEATEXCHANGERASSISTED", + "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE", + "COIL:WATERHEATING:AIRTOWATERHEATPUMP:PUMPED", + "COIL:WATERHEATING:AIRTOWATERHEATPUMP:WRAPPED", + "COIL:COOLING:DX:MULTISPEED", + "COIL:HEATING:DX:MULTISPEED", + "COIL:HEATING:FUEL", + "COIL:HEATING:GAS:MULTISTAGE", + "COIL:HEATING:ELECTRIC", + "COIL:HEATING:ELECTRIC:MULTISTAGE", + "COIL:HEATING:DESUPERHEATER", + "COIL:COOLING:WATER", + "COIL:COOLING:WATER:DETAILEDGEOMETRY", + "COIL:HEATING:WATER", + "COIL:HEATING:STEAM", + "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED", + "COIL:COOLING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION", + "COIL:HEATING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION", + "COIL:COOLING:WATERTOAIRHEATPUMP:EQUATIONFIT", + "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT", + "COIL:COOLING:DX:VARIABLEREFRIGERANTFLOW", + "COIL:HEATING:DX:VARIABLEREFRIGERANTFLOW", + "COIL:USERDEFINED", + "COIL:COOLING:DX:SINGLESPEED:THERMALSTORAGE", + "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT", + "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT", + "COIL:COOLING:DX:VARIABLESPEED", + "COIL:HEATING:DX:VARIABLESPEED", + "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED", + "COIL:COOLING:DX:VARIABLEREFRIGERANTFLOW:FLUIDTEMPERATURECONTROL", + "COIL:HEATING:DX:VARIABLEREFRIGERANTFLOW:FLUIDTEMPERATURECONTROL", + "COIL:COOLING:DX", + "COIL:COOLING:DX:SUBCOOLREHEAT", + "COIL:COOLING:DX:CURVEFIT:SPEED"}; - Array1D_string const cCoolingCoilTypes(NumAllCoilTypes, - {"Coil:Cooling:DX:SingleSpeed", - "", - "Coil:Cooling:DX:TwoSpeed", - "CoilSystem:Cooling:DX:HeatExchangerAssisted", - "Coil:Cooling:DX:TwoStageWithHumidityControlMode", - "", - "", - "Coil:Cooling:DX:MultiSpeed", - "", - "", - "", - "", - "", - "", - "Coil:Cooling:Water", - "Coil:Cooling:Water:DetailedGeometry", - "", - "", - "CoilSystem:Cooling:Water:HeatExchangerAssisted", - "Coil:Cooling:WaterToAirHeatPump:ParameterEstimation", - "", - "Coil:Cooling:WaterToAirHeatPump:EquationFit", - "", - "Coil:Cooling:DX:VariableRefrigerantFlow", - "", - "", - "Coil:Cooling:DX:SingleSpeed:ThermalStorage", - "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit", - "", - "Coil:Cooling:DX:VariableSpeed", - "", - "", - "Coil:Cooling:DX:VariableRefrigerantFlow:FluidTemperatureControl", - "", - "Coil:Cooling:DX", - "Coil:Cooling:DX:SubcoolReheat", - "Coil:Cooling:DX:CurveFit:Speed"}); + constexpr std::array coilTypeIsCooling = { + true, // DXCoolingSingleSpeed, + false, // DXHeatingEmpirical, + true, // DXCoolingTwoSpeed, + true, // DXCoolingHXAssisted, + true, // DXCoolingTwoStageWHumControl, + false, // DXHeatPumpWaterHeaterPumped, + false, // DXHeatPumpWaterHeaterWrapped, + true, // DXMultiSpeedCooling, + false, // DXMultiSpeedHeating, + false, // HeatingGasOrOtherFuel, + false, // HeatingGasMultiStage, + false, // HeatingElectric, + false, // HeatingElectricMultiStage, + false, // HeatingDesuperheater, + true, // CoolingWater, + true, // CoolingWaterDetailed, + false, // HeatingWater, + false, // HeatingSteam, + true, // WaterCoolingHXAssisted, + true, // CoolingWaterToAirHP, + false, // HeatingWaterToAirHP, + true, // CoolingWaterToAirHPSimple, + false, // HeatingWaterToAirHPSimple, + true, // VRFCooling, + false, // VRFHeating, + false, // UserDefined, + true, // DXPackagedThermalStorageCooling, + true, // CoolingWaterToAirHPVSEquationFit, + false, // HeatingWaterToAirHPVSEquationFit, + true, // CoolingAirToAirVariableSpeed, + false, // HeatingAirToAirVariableSpeed, + false, // DXHeatPumpWaterHeaterVariableSpeed, + true, // VRFFluidTCtrlCooling, + false, // VRFFluidTCtrlHeating, + true, // DXCooling, + true, // DXSubcoolReheat, + true, // DXCurveFitSpeed, + }; + + constexpr std::array coilTypeIsHeating = { + false, // DXCoolingSingleSpeed, + true, // DXHeatingEmpirical, + false, // DXCoolingTwoSpeed, + false, // DXCoolingHXAssisted, + false, // DXCoolingTwoStageWHumControl, + true, // DXHeatPumpWaterHeaterPumped, + true, // DXHeatPumpWaterHeaterWrapped, + false, // DXMultiSpeedCooling, + true, // DXMultiSpeedHeating, + true, // HeatingGasOrOtherFuel, + true, // HeatingGasMultiStage, + true, // HeatingElectric, + true, // HeatingElectricMultiStage, + true, // HeatingDesuperheater, + false, // CoolingWater, + false, // CoolingWaterDetailed, + true, // HeatingWater, + true, // HeatingSteam, + false, // WaterCoolingHXAssisted, + false, // CoolingWaterToAirHP, + true, // HeatingWaterToAirHP, + false, // CoolingWaterToAirHPSimple, + true, // HeatingWaterToAirHPSimple, + false, // VRFCooling, + true, // VRFHeating, + false, // UserDefined, + false, // DXPackagedThermalStorageCooling, + false, // CoolingWaterToAirHPVSEquationFit, + true, // HeatingWaterToAirHPVSEquationFit, + false, // CoolingAirToAirVariableSpeed, + true, // HeatingAirToAirVariableSpeed, + true, // DXHeatPumpWaterHeaterVariableSpeed, + false, // VRFFluidTCtrlCooling, + true, // VRFFluidTCtrlHeating, + false, // DXCooling, + false, // DXSubcoolReheat, + false // DXCurveFitSpeed + }; + +#ifdef GET_OUT + Array1D_string const cAllCoilTypes(NumAllCoilTypes, { + "Coil:Cooling:DX:SingleSpeed", + "Coil:Heating:DX:SingleSpeed", + "Coil:Cooling:DX:TwoSpeed", + "CoilSystem:Cooling:DX:HeatExchangerAssisted", + "Coil:Cooling:DX:TwoStageWithHumidityControlMode", + "Coil:WaterHeating:AirToWaterHeatPump:Pumped", + "Coil:WaterHeating:AirToWaterHeatPump:Wrapped", + "Coil:Cooling:DX:MultiSpeed", + "Coil:Heating:DX:MultiSpeed", + "Coil:Heating:Fuel", + "Coil:Heating:Gas:MultiStage", + "Coil:Heating:Electric", + "Coil:Heating:Electric:MultiStage", + "Coil:Heating:Desuperheater", + "Coil:Cooling:Water", + "Coil:Cooling:Water:DetailedGeometry", + "Coil:Heating:Water", + "Coil:Heating:Steam", + "CoilSystem:Cooling:Water:HeatExchangerAssisted", + "Coil:Cooling:WaterToAirHeatPump:ParameterEstimation", + "Coil:Heating:WaterToAirHeatPump:ParameterEstimation", + "Coil:Cooling:WaterToAirHeatPump:EquationFit", + "Coil:Heating:WaterToAirHeatPump:EquationFit", + "Coil:Cooling:DX:VariableRefrigerantFlow", + "Coil:Heating:DX:VariableRefrigerantFlow", + "Coil:UserDefined", + "Coil:Cooling:DX:SingleSpeed:ThermalStorage", + "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit", + "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit", + "Coil:Cooling:DX:VariableSpeed", + "Coil:Heating:DX:VariableSpeed", + "Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed", + "Coil:Cooling:DX:VariableRefrigerantFlow:FluidTemperatureControl", + "Coil:Heating:DX:VariableRefrigerantFlow:FluidTemperatureControl", + "Coil:Cooling:DX", + "Coil:Cooling:DX:SubcoolReheat", + "Coil:Cooling:DX:CurveFit:Speed"}); - Array1D_string const cHeatingCoilTypes(NumAllCoilTypes, - {"", - "Coil:Heating:DX:SingleSpeed", - "", - "", - "", - "Coil:WaterHeating:AirToWaterHeatPump:Pumped", - "Coil:WaterHeating:AirToWaterHeatPump:Wrapped", - "", - "Coil:Heating:DX:MultiSpeed", - "Coil:Heating:Fuel", - "Coil:Heating:Gas:MultiStage", - "Coil:Heating:Electric", - "Coil:Heating:Electric:MultiStage", - "Coil:Heating:Desuperheater", - "", - "", - "Coil:Heating:Water", - "Coil:Heating:Steam", - "", - "", - "Coil:Heating:WaterToAirHeatPump:ParameterEstimation", - "", - "Coil:Heating:WaterToAirHeatPump:EquationFit", - "", - "Coil:Heating:DX:VariableRefrigerantFlow", - "", - "", - "", - "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit", - "", - "Coil:Heating:DX:VariableSpeed", - "Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed", - "", - "Coil:Heating:DX:VariableRefrigerantFlow:FluidTemperatureControl", - "", - "", - ""}); + Array1D_string const cCoolingCoilTypes(NumAllCoilTypes, { + "Coil:Cooling:DX:SingleSpeed", + "", + "Coil:Cooling:DX:TwoSpeed", + "CoilSystem:Cooling:DX:HeatExchangerAssisted", + "Coil:Cooling:DX:TwoStageWithHumidityControlMode", + "", + "", + "Coil:Cooling:DX:MultiSpeed", + "", + "", + "", + "", + "", + "", + "Coil:Cooling:Water", + "Coil:Cooling:Water:DetailedGeometry", + "", + "", + "CoilSystem:Cooling:Water:HeatExchangerAssisted", + "Coil:Cooling:WaterToAirHeatPump:ParameterEstimation", + "", + "Coil:Cooling:WaterToAirHeatPump:EquationFit", + "", + "Coil:Cooling:DX:VariableRefrigerantFlow", + "", + "", + "Coil:Cooling:DX:SingleSpeed:ThermalStorage", + "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit", + "", + "Coil:Cooling:DX:VariableSpeed", + "", + "", + "Coil:Cooling:DX:VariableRefrigerantFlow:FluidTemperatureControl", + "", + "Coil:Cooling:DX", + "Coil:Cooling:DX:SubcoolReheat", + "Coil:Cooling:DX:CurveFit:Speed"}); + + Array1D_string const cHeatingCoilTypes(NumAllCoilTypes, { + "", + "Coil:Heating:DX:SingleSpeed", + "", + "", + "", + "Coil:WaterHeating:AirToWaterHeatPump:Pumped", + "Coil:WaterHeating:AirToWaterHeatPump:Wrapped", + "", + "Coil:Heating:DX:MultiSpeed", + "Coil:Heating:Fuel", + "Coil:Heating:Gas:MultiStage", + "Coil:Heating:Electric", + "Coil:Heating:Electric:MultiStage", + "Coil:Heating:Desuperheater", + "", + "", + "Coil:Heating:Water", + "Coil:Heating:Steam", + "", + "", + "Coil:Heating:WaterToAirHeatPump:ParameterEstimation", + "", + "Coil:Heating:WaterToAirHeatPump:EquationFit", + "", + "Coil:Heating:DX:VariableRefrigerantFlow", + "", + "", + "", + "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit", + "", + "Coil:Heating:DX:VariableSpeed", + "Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed", + "", + "Coil:Heating:DX:VariableRefrigerantFlow:FluidTemperatureControl", + "", + "", + ""}); +#endif // GET_OUT constexpr std::array hxTypeNames = { "HeatExchanger:AirToAir:FlatPlate", "HeatExchanger:AirToAir:SensibleAndLatent", "HeatExchanger:Desiccant:BalancedFlow"}; diff --git a/src/EnergyPlus/DataHVACGlobals.hh b/src/EnergyPlus/DataHVACGlobals.hh index 7e8fc0e2727..88e15cf0277 100644 --- a/src/EnergyPlus/DataHVACGlobals.hh +++ b/src/EnergyPlus/DataHVACGlobals.hh @@ -257,45 +257,14 @@ namespace HVAC { DXCurveFitSpeed, Num }; - static constexpr std::array(CoilType::Num)> coilTypeNamesUC = { - "COIL:COOLING:DX:SINGLESPEED", - "COIL:HEATING:DX:SINGLESPEED", - "COIL:COOLING:DX:TWOSPEED", - "COILSYSTEM:COOLING:DX:HEATEXCHANGERASSISTED", - "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE", - "COIL:WATERHEATING:AIRTOWATERHEATPUMP:PUMPED", - "COIL:WATERHEATING:AIRTOWATERHEATPUMP:WRAPPED", - "COIL:COOLING:DX:MULTISPEED", - "COIL:HEATING:DX:MULTISPEED", - "COIL:HEATING:FUEL", - "COIL:HEATING:GAS:MULTISTAGE", - "COIL:HEATING:ELECTRIC", - "COIL:HEATING:ELECTRIC:MULTISTAGE", - "COIL:HEATING:DESUPERHEATER", - "COIL:COOLING:WATER", - "COIL:COOLING:WATER:DETAILEDGEOMETRY", - "COIL:HEATING:WATER", - "COIL:HEATING:STEAM", - "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED", - "COIL:COOLING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION", - "COIL:HEATING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION", - "COIL:COOLING:WATERTOAIRHEATPUMP:EQUATIONFIT", - "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT", - "COIL:COOLING:DX:VARIABLEREFRIGERANTFLOW", - "COIL:HEATING:DX:VARIABLEREFRIGERANTFLOW", - "COIL:USERDEFINED", - "COIL:COOLING:DX:SINGLESPEED:THERMALSTORAGE", - "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT", - "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT", - "COIL:COOLING:DX:VARIABLESPEED", - "COIL:HEATING:DX:VARIABLESPEED", - "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED", - "COIL:COOLING:DX:VARIABLEREFRIGERANTFLOW:FLUIDTEMPERATURECONTROL", - "COIL:HEATING:DX:VARIABLEREFRIGERANTFLOW:FLUIDTEMPERATURECONTROL", - "COIL:COOLING:DX", - "COIL:COOLING:DX:SUBCOOLREHEAT", - "COIL:COOLING:DX:CURVEFIT:SPEED"}; + extern const std::array coilTypeNames; + extern const std::array coilTypeNamesUC; + + extern const std::array coilTypeIsHeating; + extern const std::array coilTypeIsCooling; + +#ifdef GET_OUT // parameters describing coil types int constexpr NumAllCoilTypes(37); int constexpr CoilDX_CoolingSingleSpeed(1); @@ -335,7 +304,8 @@ namespace HVAC { int constexpr CoilDX_Cooling(35); // int constexpr CoilDX_SubcoolReheat(36); int constexpr CoilDX_CurveFit_Speed(37); - +#endif // GET_OUT + enum class CoilMode { Invalid = -1, @@ -432,7 +402,10 @@ namespace HVAC { int constexpr MaxSpeedLevels = 10; +#ifdef GET_OUT extern Array1D_string const cAllCoilTypes; +#endif // GET_OUT + extern Array1D_string const cCoolingCoilTypes; extern Array1D_string const cHeatingCoilTypes; diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index 3a0ce7bdea1..9f6195d8ea9 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -1348,7 +1349,7 @@ namespace DataHeatBalance { { // Members std::string Name; // Name of Coil - std::string SourceType; // SourceType for Coil + HVAC::CoilType coilType = HVAC::CoilType::Invalid; // SourceType for Coil Real64 AvailCapacity = 0.0; // Total available heat reclaim capacity Real64 ReclaimEfficiencyTotal = 0.0; // Total reclaimed portion Real64 WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; // total reclaimed heat by water heating desuperheater coils diff --git a/src/EnergyPlus/DataSizing.cc b/src/EnergyPlus/DataSizing.cc index c012ff51b24..42d08ee48fd 100644 --- a/src/EnergyPlus/DataSizing.cc +++ b/src/EnergyPlus/DataSizing.cc @@ -468,7 +468,7 @@ void resetHVACSizingGlobals(EnergyPlusData &state, state.dataSize->DataCoilSizingAirInHumRat = 0.0; state.dataSize->DataCoilSizingAirOutTemp = 0.0; state.dataSize->DataCoilSizingAirOutHumRat = 0.0; - state.dataSize->DataCoolCoilType = -1; + state.dataSize->DataCoolCoilType = HVAC::CoilType::Invalid; state.dataSize->DataCoolCoilIndex = -1; // These zone specific sizing variables are set in zone equipment to use for sizing. diff --git a/src/EnergyPlus/DataSizing.hh b/src/EnergyPlus/DataSizing.hh index 396cbb19bdc..b9639bd6cf3 100644 --- a/src/EnergyPlus/DataSizing.hh +++ b/src/EnergyPlus/DataSizing.hh @@ -1296,7 +1296,7 @@ struct SizingData : BaseGlobalStruct int DataFanIndex = -1; // Fan index used during sizing HVAC::FanPlace DataFanPlacement = HVAC::FanPlace::Invalid; // identifies location of fan wrt coil int DataDXSpeedNum = 0; - int DataCoolCoilType = -1; + HVAC::CoilType DataCoolCoilType = HVAC::CoilType::Invalid; // Why the 'Data' prefix? int DataCoolCoilIndex = -1; EPVector OARequirements; EPVector ZoneAirDistribution; diff --git a/src/EnergyPlus/DesiccantDehumidifiers.cc b/src/EnergyPlus/DesiccantDehumidifiers.cc index f612e5aeb6a..6d313294747 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.cc +++ b/src/EnergyPlus/DesiccantDehumidifiers.cc @@ -390,15 +390,15 @@ namespace DesiccantDehumidifiers { if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric") || Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) { - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric")) desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingElectric; - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingGasOrOtherFuel; + if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric")) desicDehum.regenCoilType = HVAC::CoilType::HeatingElectric; + if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) desicDehum.regenCoilType = HVAC::CoilType::HeatingGasOrOtherFuel; ValidateComponent(state, desicDehum.RegenCoilType, desicDehum.RegenCoilName, ErrorsFound2, CurrentModuleObject + '=' + Alphas(1)); if (ErrorsFound2) ErrorsFound = true; HeatingCoils::GetCoilIndex(state, desicDehum.RegenCoilName, desicDehum.RegenCoilIndex, ErrorsFound2); if (ErrorsFound2) ErrorsFound = true; } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Water")) { - desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingWater; + desicDehum.regenCoilType = HVAC::CoilType::HeatingWater; ValidateComponent(state, RegenCoilType, RegenCoilName, IsNotOK, CurrentModuleObject); if (IsNotOK) { ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); @@ -447,7 +447,7 @@ namespace DesiccantDehumidifiers { } } } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Steam")) { - desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingSteam; + desicDehum.regenCoilType = HVAC::CoilType::HeatingSteam; ValidateComponent(state, Alphas(8), RegenCoilName, IsNotOK, CurrentModuleObject); if (IsNotOK) { ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); @@ -827,9 +827,9 @@ namespace DesiccantDehumidifiers { if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric") || Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) { if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric")) - desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingElectric; + desicDehum.regenCoilType = HVAC::CoilType::HeatingElectric; if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) - desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingGasOrOtherFuel; + desicDehum.regenCoilType = HVAC::CoilType::HeatingGasOrOtherFuel; ErrorsFound2 = false; ValidateComponent(state, RegenCoilType, RegenCoilName, ErrorsFound2, desicDehum.DehumType + " \"" + desicDehum.Name + "\""); if (ErrorsFound2) ErrorsFoundGeneric = true; @@ -889,7 +889,7 @@ namespace DesiccantDehumidifiers { } } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Water")) { - desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingWater; + desicDehum.regenCoilType = HVAC::CoilType::HeatingWater; ValidateComponent(state, RegenCoilType, RegenCoilName, IsNotOK, CurrentModuleObject); if (IsNotOK) { ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); @@ -951,7 +951,7 @@ namespace DesiccantDehumidifiers { } } } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Steam")) { - desicDehum.RegenCoilType_Num = HVAC::Coil_HeatingSteam; + desicDehum.regenCoilType = HVAC::CoilType::HeatingSteam; ValidateComponent(state, RegenCoilType, RegenCoilName, IsNotOK, CurrentModuleObject); if (IsNotOK) { ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); @@ -1195,11 +1195,11 @@ namespace DesiccantDehumidifiers { if (ErrorsFound2) ErrorsFoundGeneric = true; if ((Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:SINGLESPEED"))) { - desicDehum.coolingCoil_TypeNum = HVAC::CoilDX_CoolingSingleSpeed; + desicDehum.coolingCoilType = HVAC::CoilType::DXCoolingSingleSpeed; } else if ((Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE"))) { - desicDehum.coolingCoil_TypeNum = HVAC::CoilDX_CoolingTwoStageWHumControl; + desicDehum.coolingCoilType = HVAC::CoilType::DXCoolingTwoStageWHumControl; } else if ((Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:VARIABLESPEED"))) { - desicDehum.coolingCoil_TypeNum = HVAC::Coil_CoolingAirToAirVariableSpeed; + desicDehum.coolingCoilType = HVAC::CoilType::CoolingAirToAirVariableSpeed; } } else { @@ -1208,8 +1208,8 @@ namespace DesiccantDehumidifiers { ErrorsFoundGeneric = true; } - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { ErrorsFound2 = false; desicDehum.CoolingCoilOutletNode = DXCoils::GetCoilOutletNode(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); @@ -1220,7 +1220,7 @@ namespace DesiccantDehumidifiers { ErrorsFound2 = false; DXCoils::GetDXCoilIndex(state, desicDehum.CoolingCoilName, desicDehum.DXCoilIndex, ErrorsFound2, desicDehum.CoolingCoilType); if (ErrorsFound2) ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.CoolingCoilName)); - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { ErrorsFound2 = false; desicDehum.CoolingCoilOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed( state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); @@ -1285,12 +1285,12 @@ namespace DesiccantDehumidifiers { // ErrorsFoundGeneric = .TRUE. } } - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { ErrorsFound2 = false; desicDehum.CondenserInletNode = DXCoils::GetCoilCondenserInletNode(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { ErrorsFound2 = false; desicDehum.CondenserInletNode = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, desicDehum.CoolingCoilName, ErrorsFound2); } @@ -1344,12 +1344,12 @@ namespace DesiccantDehumidifiers { } if (desicDehum.DXCoilIndex > 0 && desicDehum.CoilUpstreamOfProcessSide == Selection::Yes) { - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { ErrorsFound2 = false; CoilBypassedFlowFrac = DXCoils::GetDXCoilBypassedFlowFrac(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { ErrorsFound2 = false; CoilBypassedFlowFrac = 0.0; // bypass flow fraction not in VS coil model } @@ -1632,8 +1632,9 @@ namespace DesiccantDehumidifiers { } if (state.dataDesiccantDehumidifiers->MyPlantScanFlag(DesicDehumNum) && allocated(state.dataPlnt->PlantLoop)) { - if ((desicDehum.RegenCoilType_Num == HVAC::Coil_HeatingWater) || (desicDehum.RegenCoilType_Num == HVAC::Coil_HeatingSteam)) { - if (desicDehum.RegenCoilType_Num == HVAC::Coil_HeatingWater) { + if (desicDehum.regenCoilType == HVAC::CoilType::HeatingWater || + desicDehum.regenCoilType == HVAC::CoilType::HeatingSteam) { + if (desicDehum.regenCoilType == HVAC::CoilType::HeatingWater) { ErrorFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, desicDehum.RegenCoilName, @@ -1661,7 +1662,7 @@ namespace DesiccantDehumidifiers { desicDehum.MaxCoilFluidFlow *= FluidDensity; } - } else if (desicDehum.RegenCoilType_Num == HVAC::Coil_HeatingSteam) { + } else if (desicDehum.regenCoilType == HVAC::CoilType::HeatingSteam) { ErrorFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, @@ -1759,7 +1760,7 @@ namespace DesiccantDehumidifiers { if (desicDehum.CoilControlNode > 0) { // If water coil max water flow rate is autosized, simulate once in order to mine max water flow rate if (desicDehum.MaxCoilFluidFlow == DataSizing::AutoSize) { - if (desicDehum.RegenCoilType_Num == HVAC::Coil_HeatingWater) { + if (desicDehum.regenCoilType == HVAC::CoilType::HeatingWater) { WaterCoils::SimulateWaterCoilComponents(state, desicDehum.RegenCoilName, FirstHVACIteration, desicDehum.RegenCoilIndex); ErrorFlag = false; Real64 CoilMaxVolFlowRate = @@ -1777,7 +1778,7 @@ namespace DesiccantDehumidifiers { desicDehum.MaxCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; } } - if (desicDehum.RegenCoilType_Num == HVAC::Coil_HeatingSteam) { + if (desicDehum.regenCoilType == HVAC::CoilType::HeatingSteam) { SteamCoils::SimulateSteamCoilComponents(state, desicDehum.RegenCoilName, FirstHVACIteration, @@ -2417,8 +2418,8 @@ namespace DesiccantDehumidifiers { } if (desicDehum.CoilUpstreamOfProcessSide == Selection::Yes) { - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { if (state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex) == 0.0) { UnitOn = false; } @@ -2440,11 +2441,11 @@ namespace DesiccantDehumidifiers { if (desicDehum.Preheat == Selection::Yes) { // condenser waste heat is proportional to DX coil PLR - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { CondenserWasteHeat = state.dataHeatBal->HeatReclaimDXCoil(desicDehum.DXCoilIndex).AvailCapacity; state.dataHeatBal->HeatReclaimDXCoil(desicDehum.DXCoilIndex).AvailCapacity = 0.0; - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { CondenserWasteHeat = state.dataHeatBal->HeatReclaimVS_DXCoil(desicDehum.DXCoilIndex).AvailCapacity; state.dataHeatBal->HeatReclaimVS_DXCoil(desicDehum.DXCoilIndex).AvailCapacity = 0.0; } @@ -2463,8 +2464,8 @@ namespace DesiccantDehumidifiers { if (CompanionCoilIndexNum > 0) { // calculate PLR and actual condenser outlet node (regen inlet node) temperature - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex); if (state.dataDXCoils->DXCoilFanOp(desicDehum.DXCoilIndex) == HVAC::FanOp::Continuous) { NewRegenInTemp = @@ -2475,7 +2476,7 @@ namespace DesiccantDehumidifiers { NewRegenInTemp = state.dataLoopNodes->Node(desicDehum.CondenserInletNode).Temp + CondenserWasteHeat / (CpAir * (state.dataLoopNodes->Node(desicDehum.RegenAirInNode).MassFlowRate)); } - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down NewRegenInTemp = state.dataLoopNodes->Node(desicDehum.CondenserInletNode).Temp + CondenserWasteHeat / (CpAir * (state.dataLoopNodes->Node(desicDehum.RegenAirInNode).MassFlowRate)); @@ -2560,7 +2561,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoil_TypeNum); + desicDehum.coolingCoilType); // calculate desiccant part-load ratio if (state.dataLoopNodes->Node(desicDehum.ProcAirInNode).HumRat != state.dataLoopNodes->Node(desicDehum.ProcAirOutNode).HumRat) { @@ -2638,7 +2639,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoil_TypeNum); + desicDehum.coolingCoilType); // calculate desiccant part-load ratio if (state.dataLoopNodes->Node(desicDehum.ProcAirInNode).HumRat != @@ -2651,10 +2652,10 @@ namespace DesiccantDehumidifiers { DDPartLoadRatio = 1.0; } } else { - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex); - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down } } @@ -2709,7 +2710,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoil_TypeNum); + desicDehum.coolingCoilType); if (desicDehum.regenFanPlace == HVAC::FanPlace::DrawThru) { state.dataFans->fans(desicDehum.RegenFanIndex)->simulate(state, FirstHVACIteration, _, _); @@ -2723,11 +2724,11 @@ namespace DesiccantDehumidifiers { // If preheat is Yes, exhaust fan is condenser fan, if CoilUpstreamOfProcessSide is No, DD runs an its own PLR if (desicDehum.Preheat == Selection::Yes && desicDehum.CoilUpstreamOfProcessSide == Selection::No) { // should actually use DX coil RTF instead of PLR since fan power is being calculated - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { desicDehum.ExhaustFanPower += max( 0.0, (desicDehum.ExhaustFanMaxPower * (state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex) - DDPartLoadRatio))); - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { desicDehum.ExhaustFanPower += max(0.0, (desicDehum.ExhaustFanMaxPower * (1.0 - DDPartLoadRatio))); } } @@ -2760,7 +2761,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoil_TypeNum); + desicDehum.coolingCoilType); if (desicDehum.regenFanPlace == HVAC::FanPlace::DrawThru) { state.dataFans->fans(desicDehum.RegenFanIndex)->simulate(state, FirstHVACIteration, _, _); @@ -2769,10 +2770,10 @@ namespace DesiccantDehumidifiers { // Turn on exhaust fan if DX Coil is operating if (desicDehum.ExhaustFanMaxVolFlowRate > 0) { if (desicDehum.DXCoilIndex > 0) { - if ((desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingSingleSpeed) || - (desicDehum.coolingCoil_TypeNum == HVAC::CoilDX_CoolingTwoStageWHumControl)) { + if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex); - } else if (desicDehum.coolingCoil_TypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down } desicDehum.ExhaustFanPower = desicDehum.ExhaustFanMaxPower * DDPartLoadRatio; @@ -2939,13 +2940,13 @@ namespace DesiccantDehumidifiers { RegenCoilActual = 0.0; if (RegenCoilLoad > HVAC::SmallLoad) { - switch (desicDehum.RegenCoilType_Num) { - case HVAC::Coil_HeatingGasOrOtherFuel: - case HVAC::Coil_HeatingElectric: { + switch (desicDehum.regenCoilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: { HeatingCoils::SimulateHeatingCoilComponents( state, desicDehum.RegenCoilName, FirstHVACIteration, RegenCoilLoad, desicDehum.RegenCoilIndex, RegenCoilActual); } break; - case HVAC::Coil_HeatingWater: { + case HVAC::CoilType::HeatingWater: { MaxHotWaterFlow = desicDehum.MaxCoilFluidFlow; PlantUtilities::SetComponentFlowRate( state, MaxHotWaterFlow, desicDehum.CoilControlNode, desicDehum.CoilOutletNode, desicDehum.plantLoc); @@ -3025,7 +3026,8 @@ namespace DesiccantDehumidifiers { state, desicDehum.RegenCoilName, FirstHVACIteration, desicDehum.RegenCoilIndex, RegenCoilActual); } } break; - case HVAC::Coil_HeatingSteam: { + + case HVAC::CoilType::HeatingSteam: { mdot = desicDehum.MaxCoilFluidFlow; PlantUtilities::SetComponentFlowRate(state, mdot, desicDehum.CoilControlNode, desicDehum.CoilOutletNode, desicDehum.plantLoc); // simulate the regenerator steam heating coil @@ -3036,13 +3038,13 @@ namespace DesiccantDehumidifiers { break; } } else { - switch (desicDehum.RegenCoilType_Num) { - case HVAC::Coil_HeatingGasOrOtherFuel: - case HVAC::Coil_HeatingElectric: { + switch (desicDehum.regenCoilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: { HeatingCoils::SimulateHeatingCoilComponents( state, desicDehum.RegenCoilName, FirstHVACIteration, RegenCoilLoad, desicDehum.RegenCoilIndex, RegenCoilActual); } break; - case HVAC::Coil_HeatingWater: { + case HVAC::CoilType::HeatingWater: { mdot = 0.0; PlantUtilities::SetComponentFlowRate(state, mdot, desicDehum.CoilControlNode, desicDehum.CoilOutletNode, desicDehum.plantLoc); RegenCoilActual = RegenCoilLoad; @@ -3050,7 +3052,8 @@ namespace DesiccantDehumidifiers { WaterCoils::SimulateWaterCoilComponents( state, desicDehum.RegenCoilName, FirstHVACIteration, desicDehum.RegenCoilIndex, RegenCoilActual); } break; - case HVAC::Coil_HeatingSteam: { + + case HVAC::CoilType::HeatingSteam: { mdot = 0.0; PlantUtilities::SetComponentFlowRate(state, mdot, desicDehum.CoilControlNode, desicDehum.CoilOutletNode, desicDehum.plantLoc); // simulate the regenerator steam heating coil diff --git a/src/EnergyPlus/DesiccantDehumidifiers.hh b/src/EnergyPlus/DesiccantDehumidifiers.hh index b5f121df468..4075cfd74cd 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.hh +++ b/src/EnergyPlus/DesiccantDehumidifiers.hh @@ -181,7 +181,7 @@ namespace DesiccantDehumidifiers { std::string ExhaustFanCurveObject; // exhaust fan curve object std::string CoolingCoilType; // type of cooling coil used with desiccant heat exchanger std::string CoolingCoilName; // name of cooling coil used with desiccant heat exchanger - int coolingCoil_TypeNum; // type of cooling coil, DataHVACGlobals coil type constants + HVAC::CoilType coolingCoilType = HVAC::CoilType::Invalid; // type of cooling coil, DataHVACGlobals coil type constants Selection Preheat; // determine condenser waste heat usage for pre heating regen air Real64 RegenSetPointTemp; // heating set-point for regeneration air [C] Real64 ExhaustFanMaxVolFlowRate; // exhaust fan maximum allowable air flow rate [m3/s] @@ -208,7 +208,7 @@ namespace DesiccantDehumidifiers { int ErrIndex1; // error index Selection CoilUpstreamOfProcessSide; // used to determine if process inlet is pre-cooled bool RegenInletIsOutsideAirNode; // regen inlet is connected to an outside air node - int RegenCoilType_Num; // type number of regen coil + HVAC::CoilType regenCoilType = HVAC::CoilType::Invalid; int CoilControlNode; // heating coil hot water or steam inlet node int CoilOutletNode; // outlet node for water coil PlantLocation plantLoc; // plant loop component location for water heating coil @@ -230,12 +230,12 @@ namespace DesiccantDehumidifiers { RegenAirVel(0.0), DehumTypeCode(DesicDehumType::Invalid), WaterRemove(0.0), WaterRemoveRate(0.0), SpecRegenEnergy(0.0), QRegen(0.0), RegenEnergy(0.0), ElecUseEnergy(0.0), ElecUseRate(0.0), PartLoad(0.0), RegenCapErrorIndex1(0), RegenCapErrorIndex2(0), RegenCapErrorIndex3(0), RegenCapErrorIndex4(0), RegenFanErrorIndex1(0), RegenFanErrorIndex2(0), RegenFanErrorIndex3(0), - RegenFanErrorIndex4(0), HXTypeNum(0), coolingCoil_TypeNum(0), Preheat(Selection::Invalid), RegenSetPointTemp(0.0), + RegenFanErrorIndex4(0), HXTypeNum(0), Preheat(Selection::Invalid), RegenSetPointTemp(0.0), ExhaustFanMaxVolFlowRate(0.0), ExhaustFanMaxMassFlowRate(0.0), ExhaustFanMaxPower(0.0), ExhaustFanPower(0.0), ExhaustFanElecConsumption(0.0), CompanionCoilCapacity(0.0), regenFanPlace(HVAC::FanPlace::Invalid), ControlNodeNum(0), ExhaustFanCurveIndex(0), CompIndex(0), CoolingCoilOutletNode(0), RegenFanOutNode(0), RegenCoilInletNode(0), RegenCoilOutletNode(0), HXProcInNode(0), HXProcOutNode(0), HXRegenInNode(0), HXRegenOutNode(0), CondenserInletNode(0), DXCoilIndex(0), ErrCount(0), - ErrIndex1(0), CoilUpstreamOfProcessSide(Selection::Invalid), RegenInletIsOutsideAirNode(false), RegenCoilType_Num(0), + ErrIndex1(0), CoilUpstreamOfProcessSide(Selection::Invalid), RegenInletIsOutsideAirNode(false), CoilControlNode(0), CoilOutletNode(0), HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0), MaxCoilFluidFlow(0.0), RegenCoilCapacity(0.0) { diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 1cd51472648..aa0525cbe31 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -370,46 +370,47 @@ namespace FanCoilUnits { fanCoil.MinColdWaterVolFlow = Numbers(6); fanCoil.ColdControlOffset = Numbers(7); fanCoil.HCoilName = Alphas(14); - fanCoil.HCoilType = Alphas(13); + + fanCoil.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(13))); + if (fanCoil.coolCoilType == HVAC::CoilType::Invalid) { + ShowSevereInvalidKey(state, eoh, cAlphaFields(13), Alphas(13)); + ErrorsFound = true; + } + fanCoil.MaxHotWaterVolFlow = Numbers(8); fanCoil.MinHotWaterVolFlow = Numbers(9); fanCoil.HotControlOffset = Numbers(10); - if (Util::SameString(Alphas(11), "Coil:Cooling:Water") || Util::SameString(Alphas(11), "Coil:Cooling:Water:DetailedGeometry") || - Util::SameString(Alphas(11), "CoilSystem:Cooling:Water:HeatExchangerAssisted")) { - fanCoil.CCoilType = Alphas(11); - if (Util::SameString(Alphas(11), "Coil:Cooling:Water")) { - fanCoil.CCoilType_Num = CCoil::Water; - fanCoil.CCoilPlantName = fanCoil.CCoilName; + fanCoil.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(11))); + if (fanCoil.coolCoilType == HVAC::CoilType::Invalid) { + ShowSevereInvalidKey(state, eoh, cAlphaFields(11), Alphas(11)); + ErrorsFound = true; + } else if (fanCoil.coolCoilType == HVAC::CoilType::CoolingWater) { + fanCoil.CCoilPlantName = fanCoil.CCoilName; + fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterCooling; + } else if (fanCoil.coolCoilType == HVAC::CoilType::CoolingWaterDetailed) { + fanCoil.CCoilPlantName = fanCoil.CCoilName; + fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; + } else if (fanCoil.coolCoilType == HVAC::CoilType::WaterCoolingHXAssisted) { + HVAC::CoilType hxCoilType = HVAC::CoilType::Invalid; + HVACHXAssistedCoolingCoil::GetHXCoilTypeAndName( + state, fanCoil.coolCoilType, fanCoil.CCoilName, ErrorsFound, hxCoilType, fanCoil.CCoilPlantName); + if (hxCoilType == HVAC::CoilType::CoolingWater) { fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterCooling; - } - if (Util::SameString(Alphas(11), "Coil:Cooling:Water:DetailedGeometry")) { - fanCoil.CCoilType_Num = CCoil::Detailed; - fanCoil.CCoilPlantName = fanCoil.CCoilName; + } else if (hxCoilType == HVAC::CoilType::CoolingWaterDetailed) { fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; - } - std::string CCoilType; - if (Util::SameString(Alphas(11), "CoilSystem:Cooling:Water:HeatExchangerAssisted")) { - fanCoil.CCoilType_Num = CCoil::HXAssist; - HVACHXAssistedCoolingCoil::GetHXCoilTypeAndName( - state, fanCoil.CCoilType, fanCoil.CCoilName, ErrorsFound, CCoilType, fanCoil.CCoilPlantName); - if (Util::SameString(CCoilType, "Coil:Cooling:Water")) { - fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterCooling; - } else if (Util::SameString(CCoilType, "Coil:Cooling:Water:DetailedGeometry")) { - fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; - } else { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, fanCoil.Name)); - ShowContinueError(state, format("For: {}=\"{}\".", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("Invalid Coil Type={}, Name={}", CCoilType, fanCoil.CCoilPlantName)); - ShowContinueError(state, "must be \"Coil:Cooling:Water\" or \"Coil:Cooling:Water:DetailedGeometry\""); - ErrorsFound = true; - } - } - IsNotOK = false; - ValidateComponent(state, fanCoil.CCoilType, fanCoil.CCoilName, IsNotOK, fanCoil.UnitType); - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); + } else { + ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, fanCoil.Name)); + ShowContinueError(state, format("For: {}=\"{}\".", cAlphaFields(11), Alphas(11))); + ShowContinueError(state, format("Invalid Coil Type={}, Name={}", HVAC::coilTypeNames[(int)hxCoilType], fanCoil.CCoilPlantName)); + ShowContinueError(state, "must be \"Coil:Cooling:Water\" or \"Coil:Cooling:Water:DetailedGeometry\""); ErrorsFound = true; + } + } + + if (!ValidateComponent(state, HVAC::coilTypeNames[(int)fanCoil.coolCoilType], fanCoil.CCoilName, fanCoil.UnitType)) { + ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); + ErrorsFound = true; } else { if (fanCoil.CCoilType_Num != CCoil::HXAssist) { // mine the cold water node from the coil object @@ -437,11 +438,7 @@ namespace FanCoilUnits { } } } - } else { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, fanCoil.Name)); - ShowContinueError(state, format("illegal value: {}=\"{}\".", cAlphaFields(11), Alphas(11))); - ErrorsFound = true; - } + } if (Util::SameString(Alphas(13), "Coil:Heating:Water")) { fanCoil.HCoilType_Num = HCoil::Water; diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 43451f4728f..bc99f60b602 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -142,11 +142,10 @@ namespace FanCoilUnits { int FanIndex = 0; // index for fan std::string CCoilName; // name of cooling coil int CCoilName_Index = 0; // Index for this Cooling Coil in SimWaterComp - std::string CCoilType; // type of cooling coil: + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; // type of cooling coil: // 'Coil:Cooling:Water' or // 'Coil:Cooling:Water:DetailedGeometry' or // 'CoilSystem:Cooling:Water:HeatExchangerAssisted' - CCoil CCoilType_Num = CCoil::Invalid; // Numeric equivalent for type of cooling coil std::string CCoilPlantName; // name of cooling coil (child<=CoilSystem:Cooling:Water:HeatExchangerAssisted) DataPlant::PlantEquipmentType CCoilPlantType = DataPlant::PlantEquipmentType::Invalid; int ControlCompTypeNum = 0; @@ -157,9 +156,9 @@ namespace FanCoilUnits { Real64 ColdControlOffset = 0.0; // control tolerance std::string HCoilName; // name of heating coil int HCoilName_Index = 0; - std::string HCoilType; // type of heating coil: + // 'Coil:Heating:Water' or - HCoil HCoilType_Num = HCoil::Invalid; // Numeric equivalent for type of cooling coil + HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; // Numeric equivalent for type of cooling coil DataPlant::PlantEquipmentType HCoilPlantTypeOf = DataPlant::PlantEquipmentType::Invalid; Real64 MaxHotWaterVolFlow = 0.0; // m3/s Real64 MinHotWaterVolFlow = 0.0; // m3/s diff --git a/src/EnergyPlus/GeneralRoutines.cc b/src/EnergyPlus/GeneralRoutines.cc index 353ba010edf..ba06dcd8548 100644 --- a/src/EnergyPlus/GeneralRoutines.cc +++ b/src/EnergyPlus/GeneralRoutines.cc @@ -756,6 +756,26 @@ void ValidateComponent(EnergyPlusData &state, } } +bool ValidateComponent(EnergyPlusData &state, + std::string_view CompType, // Component Type (e.g. Chiller:Electric) + std::string const &CompName, // Component Name (e.g. Big Chiller) + std::string_view CallString // Context of this pair -- for error message +) +{ + int ItemNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, std::string{CompType}, CompName); + + if (ItemNum < 0) { + ShowSevereError(state, format("During {} Input, Invalid Component Type input={}", CallString, CompType)); + ShowContinueError(state, format("Component name={}", CompName)); + return false; + } else if (ItemNum == 0) { + ShowSevereError(state, format("During {} Input, Invalid Component Name input={}", CallString, CompName)); + ShowContinueError(state, format("Component type={}", CompType)); + return false; + } + return true; +} + void ValidateComponent(EnergyPlusData &state, std::string_view CompType, // Component Type (e.g. Chiller:Electric) std::string const &CompValType, // Component "name" field type @@ -796,6 +816,28 @@ void ValidateComponent(EnergyPlusData &state, } } +bool ValidateComponent(EnergyPlusData &state, + std::string_view CompType, // Component Type (e.g. Chiller:Electric) + std::string const &CompValType, // Component "name" field type + std::string const &CompName, // Component Name (e.g. Big Chiller) + std::string_view CallString // Context of this pair -- for error message +) +{ + int ItemNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, CompType, CompValType, CompName); + + if (ItemNum < 0) { + ShowSevereError(state, format("During {} Input, Invalid Component Type input={}", CallString, CompType)); + ShowContinueError(state, format("Component name={}", CompName)); + return false; + } else if (ItemNum == 0) { + ShowSevereError(state, format("During {} Input, Invalid Component Name input={}", CallString, CompName)); + ShowContinueError(state, format("Component type={}", CompType)); + return false; + } + + return true; +} + void CalcBasinHeaterPower(EnergyPlusData &state, Real64 const Capacity, // Basin heater capacity per degree C below setpoint (W/C) int const SchedulePtr, // Pointer to basin heater schedule diff --git a/src/EnergyPlus/GeneralRoutines.hh b/src/EnergyPlus/GeneralRoutines.hh index 80b2a1eccba..bf2807f81f1 100644 --- a/src/EnergyPlus/GeneralRoutines.hh +++ b/src/EnergyPlus/GeneralRoutines.hh @@ -160,6 +160,12 @@ void CheckThisZoneForSizing(EnergyPlusData &state, int const ZoneNum, // zone index to be checked bool &ZoneWasSized); +bool ValidateComponent(EnergyPlusData &state, + std::string_view CompType, // Component Type (e.g. Chiller:Electric) + std::string const &CompName, // Component Name (e.g. Big Chiller) + std::string_view CallString // Context of this pair -- for error message +); + void ValidateComponent(EnergyPlusData &state, std::string_view CompType, // Component Type (e.g. Chiller:Electric) std::string const &CompName, // Component Name (e.g. Big Chiller) @@ -167,6 +173,13 @@ void ValidateComponent(EnergyPlusData &state, std::string_view CallString // Context of this pair -- for error message ); +bool ValidateComponent(EnergyPlusData &state, + std::string_view CompType, // Component Type (e.g. Chiller:Electric) + std::string const &CompValType, // Component "name" field type + std::string const &CompName, // Component Name (e.g. Big Chiller) + std::string_view CallString // Context of this pair -- for error message +); + void ValidateComponent(EnergyPlusData &state, std::string_view CompType, // Component Type (e.g. Chiller:Electric) std::string const &CompValType, // Component "name" field type diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index 16a310c32ef..147f344824f 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -1593,11 +1593,11 @@ namespace HVACHXAssistedCoolingCoil { } void GetHXCoilTypeAndName(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module + HVAC::CoilType coilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound, // set to true if problem - std::string &CoolingCoilType, // returned type of cooling coil - std::string &CoolingCoilName // returned name of cooling coil + HVAC::CoilType &hxCoilType, // returned type of cooling coil + std::string &hxCoilName // returned name of cooling coil ) { @@ -1621,15 +1621,25 @@ namespace HVACHXAssistedCoolingCoil { WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); } - if (WhichCoil != 0) { - CoolingCoilType = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType; - CoolingCoilName = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName; - } else { + if (WhichCoil == 0) { ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); ErrorsFound = true; - CoolingCoilType = ""; - CoolingCoilName = ""; + hxCoilType = HVAC::CoilType::Invalid; + hxCoilName = ""; + return; + } + + auto &coil = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil); + if (coil.coilType != coilType) { + ShowSevereError(state, format("Coil \"{}\" has unexpected type {}.", CoilName, HVAC::coilTypeNames[(int)coil.coilType])); + ErrorsFound = true; + hxCoilType = HVAC::CoilType::Invalid; + hxCoilName = ""; + return; } + + hxCoilType = coil.CoolingCoilType; + hxCoilName = coil.CoolingCoilName; } Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state, diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh index 61645275dc2..a5f78c6ebd4 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh @@ -209,11 +209,11 @@ namespace HVACHXAssistedCoolingCoil { ); void GetHXCoilTypeAndName(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module + HVAC::CoilType coilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound, // set to true if problem - std::string &CoolingCoilType, // returned type of cooling coil - std::string &CoolingCoilName // returned name of cooling coil + HVAC::CoilType &hxCoilType, // returned type of cooling coil + std::string &hxCoilName // returned name of cooling coil ); Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state, diff --git a/src/EnergyPlus/HeatRecovery.hh b/src/EnergyPlus/HeatRecovery.hh index 54ea64fd6a9..5c0a3ec62f5 100644 --- a/src/EnergyPlus/HeatRecovery.hh +++ b/src/EnergyPlus/HeatRecovery.hh @@ -401,7 +401,7 @@ namespace HeatRecovery { ObjexxFCL::Optional_bool_const RegenInletIsOANode = _, // flag to determine if supply inlet is OA node, if so air flow cycles ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer operation flag passed by airloop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _, // high humidity control flag passed by airloop or OA sys - ObjexxFCL::Optional_int_const CompanionCoilType_Num = _ // cooling coil type of coil + ObjexxFCL::Optional CompanionCoilType = _ // cooling coil type of coil ); void GetHeatRecoveryInput(EnergyPlusData &state); diff --git a/src/EnergyPlus/ReportCoilSelection.hh b/src/EnergyPlus/ReportCoilSelection.hh index 803c565d38d..deef120eaa0 100644 --- a/src/EnergyPlus/ReportCoilSelection.hh +++ b/src/EnergyPlus/ReportCoilSelection.hh @@ -232,7 +232,7 @@ public: // methods void setCoilFinalSizes(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilObjName, // coil object name, e.g., Coil:Cooling:Water + HVAC::CoilType coilType, // coil type, e.g., Coil:Cooling:Water Real64 const totGrossCap, // total capacity [W] Real64 const sensGrossCap, // sensible capacity [W] Real64 const airFlowRate, // design or reference or rated air flow rate [m3/s] @@ -241,7 +241,7 @@ public: // methods void setRatedCoilConditions(EnergyPlusData &state, std::string const &coilName, // ! user-defined name of the coil - std::string const &coilObjName, // coil object name, e.g., Coil:Cooling:Water + HVAC::CoilType coilObjName, // coil object name, e.g., Coil:Cooling:Water Real64 const RatedCoilTotCap, // ! rated coil total capacity [W] Real64 const RatedCoilSensCap, // rated coil sensible capacity [W] Real64 const RatedAirMassFlow, // rated coil design air mass flow rate [m3/s] @@ -260,14 +260,14 @@ public: // methods void setCoilAirFlow(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const airVdot, // air flow rate in m3/s bool const isAutoSized // true if air flow was autosized ); void setCoilWaterFlowNodeNums(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const waterVdot, // water flow rate in m3/s bool const isAutoSized, // true if water flow was autosized int const inletNodeNum, // coil chw inlet node num @@ -277,7 +277,7 @@ public: // methods void setCoilWaterFlowPltSizNum(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const waterVdot, // water flow rate in m3/s bool const isAutoSized, // true if water flow was autosized int const DataPltSizNum, // plant sizing structure index @@ -286,7 +286,7 @@ public: // methods void setCoilEntAirTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const entAirDryBulbTemp, // ideal loads sizing result for air entering coil drybulb temp (C) int const curSysNum, // airloop system number index, if non zero int const curZoneEqNum // zone equipment list index, if non-zero @@ -294,42 +294,42 @@ public: // methods void setCoilEntAirHumRat(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const entAirHumRat); void setCoilEntWaterTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const entWaterTemp // degree C ); void setCoilLvgWaterTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const lvgWaterTemp // degree C ); void setCoilWaterDeltaT(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const CoilWaterDeltaT // degree C temperature difference used to size coil ); void setCoilLvgAirTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const lvgAirDryBulbTemp // air temperature leaving coil {C} ); void setCoilLvgAirHumRat(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const lvgAirHumRat // ); void setCoilCoolingCapacity(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const totalCoolingCap, // {W} coil cooling capacity bool const isAutoSize, // true if value was autosized int const curSysNum, // airloop system number index, if non zero @@ -343,7 +343,7 @@ public: // methods void setCoilHeatingCapacity(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const totalHeatingCap, // {W} coil Heating capacity bool const isAutoSize, // true if value was autosized int const curSysNum, // airloop system number index, if non zero @@ -357,7 +357,7 @@ public: // methods void setCoilWaterCoolingCapacity(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const totalCoolingCap, // {W} coil cooling capacity bool const isAutoSize, // true if value was autosized int const inletNodeNum, // coil chw inlet node num @@ -367,7 +367,7 @@ public: // methods void setCoilWaterHeaterCapacityNodeNums(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const totalHeatingCap, // {W} coil Heating capacity bool const isAutoSize, // true if value was autosized int const inletNodeNum, // coil chw inlet node num @@ -377,7 +377,7 @@ public: // methods void setCoilWaterHeaterCapacityPltSizNum(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const totalHeatingCap, // {W} coil Heating capacity bool const isAutoSize, // true if value was autosized int const dataPltSizNum, // plant sizing structure index @@ -386,7 +386,7 @@ public: // methods void setCoilUA(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const UAvalue, // [W/k] UA value for coil, Real64 const dataCapacityUsedForSizing, // [W] sizing global bool const isAutoSize, // true if value was autosized @@ -396,19 +396,19 @@ public: // methods void setCoilReheatMultiplier(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil Real64 const multiplierReheatLoad); void setCoilSupplyFanInfo(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType coilType, // idf input object class name of coil std::string const &fanName, HVAC::FanType fanType, int fanIndex); void setCoilEqNum(EnergyPlusData &state, std::string const &coilName, - std::string const &coilType, + HVAC::CoilType coilType, int const curSysNum, int const curOASysNum, int const curZoneEqNum); diff --git a/src/EnergyPlus/StandardRatings.hh b/src/EnergyPlus/StandardRatings.hh index 89c287ffb6f..4240c067de3 100644 --- a/src/EnergyPlus/StandardRatings.hh +++ b/src/EnergyPlus/StandardRatings.hh @@ -144,8 +144,7 @@ namespace StandardRatings { void CalcDXCoilStandardRating( EnergyPlusData &state, std::string const &DXCoilName, // Name of DX coil for which HSPF is calculated - std::string const &DXCoilType, // Type of DX coil for which HSPF is calculated - int const DXCoilType_Num, // Integer Type of DX coil - heating or cooling + HVAC::CoilType coilType, // Integer Type of DX coil - heating or cooling int const ns, // Number of compressor speeds Array1A const RatedTotalCapacity, // Reference capacity of DX coil [W] Array1A const RatedCOP, // Reference coefficient of performance [W/W] @@ -176,8 +175,7 @@ namespace StandardRatings { void CalcTwoSpeedDXCoilRating(EnergyPlusData &state, std::string const &DXCoilName, - std::string const &DXCoilType, - int const DXCoilType_Num, + HVAC::CoilType coilType, Array1A const &RatedTotalCapacity, Real64 const RatedTotCap2, Array1A const &RatedCOP, From 80e6deea104b679d919ae27cc2beb14a380c9e80 Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Thu, 23 Jan 2025 13:02:59 -0500 Subject: [PATCH 02/12] Partial non-working commit for develop merge purposes --- src/EnergyPlus/AirLoopHVACDOAS.cc | 6 +- src/EnergyPlus/Coils/CoilCoolingDX.cc | 2 +- src/EnergyPlus/CostEstimateManager.cc | 4 +- src/EnergyPlus/DXCoils.cc | 144 +- src/EnergyPlus/DXCoils.hh | 86 +- src/EnergyPlus/DataHeatBalance.hh | 2 +- src/EnergyPlus/DesiccantDehumidifiers.cc | 635 +- src/EnergyPlus/DesiccantDehumidifiers.hh | 27 +- src/EnergyPlus/FanCoilUnits.cc | 472 +- src/EnergyPlus/FanCoilUnits.hh | 36 +- src/EnergyPlus/FluidProperties.cc | 38 +- src/EnergyPlus/Furnaces.cc | 6305 +++++++---------- src/EnergyPlus/Furnaces.hh | 75 +- src/EnergyPlus/GeneralRoutines.cc | 6 +- src/EnergyPlus/GeneralRoutines.hh | 2 +- src/EnergyPlus/HVACDXHeatPumpSystem.cc | 142 +- src/EnergyPlus/HVACDXHeatPumpSystem.hh | 7 +- src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 1396 +--- src/EnergyPlus/HVACHXAssistedCoolingCoil.hh | 189 +- src/EnergyPlus/HVACManager.cc | 2 +- src/EnergyPlus/HVACMultiSpeedHeatPump.cc | 2375 +++---- src/EnergyPlus/HVACMultiSpeedHeatPump.hh | 117 +- src/EnergyPlus/HVACStandAloneERV.cc | 2 +- src/EnergyPlus/HVACUnitaryBypassVAV.cc | 2441 ++++--- src/EnergyPlus/HVACUnitaryBypassVAV.hh | 40 +- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 3690 ++++------ src/EnergyPlus/HVACVariableRefrigerantFlow.hh | 21 +- src/EnergyPlus/HeatBalanceHAMTManager.cc | 12 +- src/EnergyPlus/HeatBalanceManager.cc | 84 +- src/EnergyPlus/HeatRecovery.cc | 226 +- src/EnergyPlus/HeatRecovery.hh | 29 +- src/EnergyPlus/HeatingCoils.cc | 611 +- src/EnergyPlus/HeatingCoils.hh | 33 +- src/EnergyPlus/IntegratedHeatPump.hh | 4 + src/EnergyPlus/Material.cc | 100 +- src/EnergyPlus/MixedAir.cc | 38 +- src/EnergyPlus/MoistureBalanceEMPDManager.cc | 2 +- src/EnergyPlus/OutdoorAirUnit.cc | 440 +- src/EnergyPlus/OutputReportTabular.cc | 36 +- .../PhaseChangeModeling/HysteresisModel.cc | 8 +- src/EnergyPlus/ReportCoilSelection.cc | 113 +- src/EnergyPlus/ReportCoilSelection.hh | 8 +- src/EnergyPlus/SZVAVModel.cc | 22 +- src/EnergyPlus/SetPointManager.cc | 2 +- src/EnergyPlus/SimAirServingZones.cc | 12 +- src/EnergyPlus/SingleDuct.cc | 1912 +++-- src/EnergyPlus/SingleDuct.hh | 26 +- src/EnergyPlus/StandardRatings.cc | 110 +- src/EnergyPlus/StandardRatings.hh | 9 +- src/EnergyPlus/SteamCoils.cc | 16 +- src/EnergyPlus/SteamCoils.hh | 39 +- src/EnergyPlus/UnitHeater.cc | 667 +- src/EnergyPlus/UnitHeater.hh | 44 +- src/EnergyPlus/UnitVentilator.cc | 229 +- src/EnergyPlus/UnitVentilator.hh | 59 +- src/EnergyPlus/UnitarySystem.hh | 9 +- src/EnergyPlus/UtilityRoutines.hh | 2 +- src/EnergyPlus/VariableSpeedCoils.cc | 4239 ++++++----- src/EnergyPlus/VariableSpeedCoils.hh | 37 +- src/EnergyPlus/WaterCoils.cc | 25 +- src/EnergyPlus/WaterCoils.hh | 34 +- src/EnergyPlus/WaterToAirHeatPump.hh | 16 + src/EnergyPlus/WaterToAirHeatPumpSimple.hh | 20 + 63 files changed, 11837 insertions(+), 15698 deletions(-) diff --git a/src/EnergyPlus/AirLoopHVACDOAS.cc b/src/EnergyPlus/AirLoopHVACDOAS.cc index 3e4db94f349..9b9fb6a0947 100644 --- a/src/EnergyPlus/AirLoopHVACDOAS.cc +++ b/src/EnergyPlus/AirLoopHVACDOAS.cc @@ -622,9 +622,9 @@ namespace AirLoopHVACDOAS { case ValidEquipListType::CoilSystemCoolingWaterHeatExchangerAssisted: thisOutsideAirSys.InletNodeNum(CompNum) = - HVACHXAssistedCoolingCoil::GetCoilInletNode(state, CompType, CompName, InletNodeErrFlag); + HVACHXAssistedCoolingCoil::GetHXCoilInletNode(state, CompType, CompName, InletNodeErrFlag); thisOutsideAirSys.OutletNodeNum(CompNum) = - HVACHXAssistedCoolingCoil::GetCoilOutletNode(state, CompType, CompName, OutletNodeErrFlag); + HVACHXAssistedCoolingCoil::GetHXCoilOutletNode(state, CompType, CompName, OutletNodeErrFlag); break; case ValidEquipListType::CoilSystemCoolingDX: @@ -888,7 +888,7 @@ namespace AirLoopHVACDOAS { if (Util::SameString(CompType, "COIL:HEATING:WATER")) { WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_HeatCoilNum); - Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", CompName, ErrorsFound); + Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, this->m_HeatCoilNum); rho = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); PlantUtilities::InitComponentNodes(state, 0.0, diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 020f239c57a..90faf19294a 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -138,7 +138,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo // initialize reclaim heat parameters this->reclaimHeat.Name = this->name; - this->reclaimHeat.coilType = state.dataCoilCoolingDX->coilType; + this->reclaimHeat.SourceType = HVAC::coilTypeNames[(int)state.dataCoilCoolingDX->coilType]; this->performance = CoilCoolingDXCurveFitPerformance(state, input_data.performance_object_name); diff --git a/src/EnergyPlus/CostEstimateManager.cc b/src/EnergyPlus/CostEstimateManager.cc index fea2c41eee9..e29c3200102 100644 --- a/src/EnergyPlus/CostEstimateManager.cc +++ b/src/EnergyPlus/CostEstimateManager.cc @@ -798,7 +798,7 @@ namespace CostEstimateManager { if (WildcardObjNames) { Real64 Qty(0.0); for (auto const &e : state.dataHeatingCoils->HeatingCoil) - if (e.HCoilType_Num == 1) Qty += e.NominalCapacity; + if (e.coilType == HVAC::CoilType::DXCoolingSingleSpeed) Qty += e.NominalCapacity; state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot heat cap.)"; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap; @@ -828,7 +828,7 @@ namespace CostEstimateManager { if (WildcardObjNames) { Real64 Qty(0.0); for (auto const &e : state.dataHeatingCoils->HeatingCoil) - if (e.HCoilType_Num == 1) Qty += e.Efficiency * e.NominalCapacity; + if (e.coilType == HVAC::CoilType::DXCoolingSingleSpeed) Qty += e.Efficiency * e.NominalCapacity; state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW*Eff (total, rated) "; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP; diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index b2b4c26355a..ee8ea0ed519 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -934,7 +934,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXCoolingSingleSpeed; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = HVAC::coilTypeNames[(int)HVAC::CoilType::DXCoolingSingleSpeed]; thisDXCoil.coilType = HVAC::CoilType::DXCoolingSingleSpeed; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -1418,7 +1418,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXCoolingTwoStageWHumControl; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = HVAC::coilTypeNames[(int)HVAC::CoilType::DXCoolingTwoStageWHumControl]; thisDXCoil.coilType = HVAC::CoilType::DXCoolingTwoStageWHumControl; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -2443,7 +2443,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXCoolingTwoSpeed; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = HVAC::coilTypeNames[(int)HVAC::CoilType::DXCoolingTwoSpeed]; thisDXCoil.coilType = HVAC::CoilType::DXCoolingTwoSpeed; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -3904,7 +3904,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXMultiSpeedCooling; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = HVAC::coilTypeNames[(int)HVAC::CoilType::DXMultiSpeedCooling]; thisDXCoil.coilType = HVAC::CoilType::DXMultiSpeedCooling; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -4453,7 +4453,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name = thisDXCoil.Name; - state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).coilType = HVAC::CoilType::DXMultiSpeedHeating; + state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = HVAC::coilTypeNames[(int)HVAC::CoilType::DXMultiSpeedHeating]; thisDXCoil.coilType = HVAC::CoilType::DXMultiSpeedHeating; thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -14106,113 +14106,113 @@ void ReportDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the c // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); + auto &dxCoil = state.dataDXCoils->DXCoil(DXCoilNum); - if (thisDXCoil.reportCoilFinalSizes) { + if (dxCoil.reportCoilFinalSizes) { if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) { Real64 ratedSensCap(0.0); - ratedSensCap = thisDXCoil.RatedTotCap(1) * thisDXCoil.RatedSHR(1); + ratedSensCap = dxCoil.RatedTotCap(1) * dxCoil.RatedSHR(1); state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes( - state, thisDXCoil.Name, thisDXCoil.coilType, thisDXCoil.RatedTotCap(1), ratedSensCap, thisDXCoil.RatedAirVolFlowRate(1), -999.0); - thisDXCoil.reportCoilFinalSizes = false; + state, dxCoil.Name, dxCoil.coilType, dxCoil.RatedTotCap(1), ratedSensCap, dxCoil.RatedAirVolFlowRate(1), -999.0); + dxCoil.reportCoilFinalSizes = false; } } Real64 ReportingConstant = state.dataHVACGlobal->TimeStepSysSec; - switch (thisDXCoil.coilType) { + switch (dxCoil.coilType) { case HVAC::CoilType::DXHeatingEmpirical: case HVAC::CoilType::VRFHeating: case HVAC::CoilType::VRFFluidTCtrlHeating: { - thisDXCoil.TotalHeatingEnergy = thisDXCoil.TotalHeatingEnergyRate * ReportingConstant; - thisDXCoil.ElecHeatingConsumption = thisDXCoil.ElecHeatingPower * ReportingConstant; - thisDXCoil.DefrostConsumption = thisDXCoil.DefrostPower * ReportingConstant; - thisDXCoil.CrankcaseHeaterConsumption = thisDXCoil.CrankcaseHeaterPower * ReportingConstant; - state.dataHVACGlobal->DXElecHeatingPower = thisDXCoil.ElecHeatingPower + thisDXCoil.CrankcaseHeaterPower; - state.dataHVACGlobal->DefrostElecPower = thisDXCoil.DefrostPower; + dxCoil.TotalHeatingEnergy = dxCoil.TotalHeatingEnergyRate * ReportingConstant; + dxCoil.ElecHeatingConsumption = dxCoil.ElecHeatingPower * ReportingConstant; + dxCoil.DefrostConsumption = dxCoil.DefrostPower * ReportingConstant; + dxCoil.CrankcaseHeaterConsumption = dxCoil.CrankcaseHeaterPower * ReportingConstant; + state.dataHVACGlobal->DXElecHeatingPower = dxCoil.ElecHeatingPower + dxCoil.CrankcaseHeaterPower; + state.dataHVACGlobal->DefrostElecPower = dxCoil.DefrostPower; } break; case HVAC::CoilType::DXMultiSpeedHeating: { - thisDXCoil.TotalHeatingEnergy = thisDXCoil.TotalHeatingEnergyRate * ReportingConstant; - if (thisDXCoil.FuelType == Constant::eFuel::Electricity) { - thisDXCoil.ElecHeatingConsumption = thisDXCoil.ElecHeatingPower * ReportingConstant; + dxCoil.TotalHeatingEnergy = dxCoil.TotalHeatingEnergyRate * ReportingConstant; + if (dxCoil.FuelType == Constant::eFuel::Electricity) { + dxCoil.ElecHeatingConsumption = dxCoil.ElecHeatingPower * ReportingConstant; } else { - thisDXCoil.FuelConsumed = thisDXCoil.FuelUsed * ReportingConstant; + dxCoil.FuelConsumed = dxCoil.FuelUsed * ReportingConstant; } - thisDXCoil.DefrostConsumption = thisDXCoil.DefrostPower * ReportingConstant; - thisDXCoil.CrankcaseHeaterConsumption = thisDXCoil.CrankcaseHeaterPower * ReportingConstant; - state.dataHVACGlobal->DXElecHeatingPower = thisDXCoil.ElecHeatingPower + thisDXCoil.CrankcaseHeaterPower; - state.dataHVACGlobal->DefrostElecPower = thisDXCoil.DefrostPower; + dxCoil.DefrostConsumption = dxCoil.DefrostPower * ReportingConstant; + dxCoil.CrankcaseHeaterConsumption = dxCoil.CrankcaseHeaterPower * ReportingConstant; + state.dataHVACGlobal->DXElecHeatingPower = dxCoil.ElecHeatingPower + dxCoil.CrankcaseHeaterPower; + state.dataHVACGlobal->DefrostElecPower = dxCoil.DefrostPower; } break; case HVAC::CoilType::DXMultiSpeedCooling: { - thisDXCoil.TotalCoolingEnergy = thisDXCoil.TotalCoolingEnergyRate * ReportingConstant; - thisDXCoil.SensCoolingEnergy = thisDXCoil.SensCoolingEnergyRate * ReportingConstant; - thisDXCoil.LatCoolingEnergy = thisDXCoil.TotalCoolingEnergy - thisDXCoil.SensCoolingEnergy; - thisDXCoil.CrankcaseHeaterConsumption = thisDXCoil.CrankcaseHeaterPower * ReportingConstant; - state.dataHVACGlobal->DXElecCoolingPower = thisDXCoil.ElecCoolingPower; - thisDXCoil.EvapCondPumpElecConsumption = thisDXCoil.EvapCondPumpElecPower * ReportingConstant; - thisDXCoil.EvapWaterConsump = thisDXCoil.EvapWaterConsumpRate * ReportingConstant; - if (thisDXCoil.FuelType == Constant::eFuel::Electricity) { - thisDXCoil.ElecCoolingConsumption = thisDXCoil.ElecCoolingPower * ReportingConstant; + dxCoil.TotalCoolingEnergy = dxCoil.TotalCoolingEnergyRate * ReportingConstant; + dxCoil.SensCoolingEnergy = dxCoil.SensCoolingEnergyRate * ReportingConstant; + dxCoil.LatCoolingEnergy = dxCoil.TotalCoolingEnergy - dxCoil.SensCoolingEnergy; + dxCoil.CrankcaseHeaterConsumption = dxCoil.CrankcaseHeaterPower * ReportingConstant; + state.dataHVACGlobal->DXElecCoolingPower = dxCoil.ElecCoolingPower; + dxCoil.EvapCondPumpElecConsumption = dxCoil.EvapCondPumpElecPower * ReportingConstant; + dxCoil.EvapWaterConsump = dxCoil.EvapWaterConsumpRate * ReportingConstant; + if (dxCoil.FuelType == Constant::eFuel::Electricity) { + dxCoil.ElecCoolingConsumption = dxCoil.ElecCoolingPower * ReportingConstant; } else { - thisDXCoil.FuelConsumed = thisDXCoil.FuelUsed * ReportingConstant; + dxCoil.FuelConsumed = dxCoil.FuelUsed * ReportingConstant; } - if (any_eq(thisDXCoil.CondenserType, DataHeatBalance::RefrigCondenserType::Evap)) { - thisDXCoil.BasinHeaterConsumption = thisDXCoil.BasinHeaterPower * ReportingConstant; + if (any_eq(dxCoil.CondenserType, DataHeatBalance::RefrigCondenserType::Evap)) { + dxCoil.BasinHeaterConsumption = dxCoil.BasinHeaterPower * ReportingConstant; } } break; case HVAC::CoilType::DXHeatPumpWaterHeaterPumped: case HVAC::CoilType::DXHeatPumpWaterHeaterWrapped: { // water heating energy for HP water heater DX Coil condenser - thisDXCoil.TotalHeatingEnergy = thisDXCoil.TotalHeatingEnergyRate * ReportingConstant; + dxCoil.TotalHeatingEnergy = dxCoil.TotalHeatingEnergyRate * ReportingConstant; // water heating power for HP water heater - thisDXCoil.ElecWaterHeatingConsumption = thisDXCoil.ElecWaterHeatingPower * ReportingConstant; + dxCoil.ElecWaterHeatingConsumption = dxCoil.ElecWaterHeatingPower * ReportingConstant; // other usual DX cooling coil outputs - thisDXCoil.TotalCoolingEnergy = thisDXCoil.TotalCoolingEnergyRate * ReportingConstant; - thisDXCoil.SensCoolingEnergy = thisDXCoil.SensCoolingEnergyRate * ReportingConstant; - thisDXCoil.LatCoolingEnergy = thisDXCoil.TotalCoolingEnergy - thisDXCoil.SensCoolingEnergy; - thisDXCoil.ElecCoolingConsumption = thisDXCoil.ElecCoolingPower * ReportingConstant; - thisDXCoil.CrankcaseHeaterConsumption = thisDXCoil.CrankcaseHeaterPower * ReportingConstant; + dxCoil.TotalCoolingEnergy = dxCoil.TotalCoolingEnergyRate * ReportingConstant; + dxCoil.SensCoolingEnergy = dxCoil.SensCoolingEnergyRate * ReportingConstant; + dxCoil.LatCoolingEnergy = dxCoil.TotalCoolingEnergy - dxCoil.SensCoolingEnergy; + dxCoil.ElecCoolingConsumption = dxCoil.ElecCoolingPower * ReportingConstant; + dxCoil.CrankcaseHeaterConsumption = dxCoil.CrankcaseHeaterPower * ReportingConstant; // DXElecCoolingPower global is only used for air-to-air cooling and heating coils state.dataHVACGlobal->DXElecCoolingPower = 0.0; } break; default: { - thisDXCoil.TotalCoolingEnergy = thisDXCoil.TotalCoolingEnergyRate * ReportingConstant; - thisDXCoil.SensCoolingEnergy = thisDXCoil.SensCoolingEnergyRate * ReportingConstant; - thisDXCoil.LatCoolingEnergy = thisDXCoil.TotalCoolingEnergy - thisDXCoil.SensCoolingEnergy; - thisDXCoil.ElecCoolingConsumption = thisDXCoil.ElecCoolingPower * ReportingConstant; - thisDXCoil.CrankcaseHeaterConsumption = thisDXCoil.CrankcaseHeaterPower * ReportingConstant; - state.dataHVACGlobal->DXElecCoolingPower = thisDXCoil.ElecCoolingPower; - thisDXCoil.EvapCondPumpElecConsumption = thisDXCoil.EvapCondPumpElecPower * ReportingConstant; - thisDXCoil.EvapWaterConsump = thisDXCoil.EvapWaterConsumpRate * ReportingConstant; - if (any_eq(thisDXCoil.CondenserType, DataHeatBalance::RefrigCondenserType::Evap)) { - thisDXCoil.BasinHeaterConsumption = thisDXCoil.BasinHeaterPower * ReportingConstant; + dxCoil.TotalCoolingEnergy = dxCoil.TotalCoolingEnergyRate * ReportingConstant; + dxCoil.SensCoolingEnergy = dxCoil.SensCoolingEnergyRate * ReportingConstant; + dxCoil.LatCoolingEnergy = dxCoil.TotalCoolingEnergy - dxCoil.SensCoolingEnergy; + dxCoil.ElecCoolingConsumption = dxCoil.ElecCoolingPower * ReportingConstant; + dxCoil.CrankcaseHeaterConsumption = dxCoil.CrankcaseHeaterPower * ReportingConstant; + state.dataHVACGlobal->DXElecCoolingPower = dxCoil.ElecCoolingPower; + dxCoil.EvapCondPumpElecConsumption = dxCoil.EvapCondPumpElecPower * ReportingConstant; + dxCoil.EvapWaterConsump = dxCoil.EvapWaterConsumpRate * ReportingConstant; + if (any_eq(dxCoil.CondenserType, DataHeatBalance::RefrigCondenserType::Evap)) { + dxCoil.BasinHeaterConsumption = dxCoil.BasinHeaterPower * ReportingConstant; } } break; } - if (thisDXCoil.CondensateCollectMode == CondensateCollectAction::ToTank) { + if (dxCoil.CondensateCollectMode == CondensateCollectAction::ToTank) { // calculate and report condensation rates (how much water extracted from the air stream) // water flow of water in m3/s for water system interactions // put here to catch all types of DX coils - Real64 Tavg = (thisDXCoil.InletAirTemp + thisDXCoil.OutletAirTemp) / 2.0; + Real64 Tavg = (dxCoil.InletAirTemp + dxCoil.OutletAirTemp) / 2.0; // CR9155 Remove specific humidity calculations // mdot * del HumRat / rho water - thisDXCoil.CondensateVdot = - max(0.0, (thisDXCoil.InletAirMassFlowRate * (thisDXCoil.InletAirHumRat - thisDXCoil.OutletAirHumRat) / Psychrometrics::RhoH2O(Tavg))); - thisDXCoil.CondensateVol = thisDXCoil.CondensateVdot * ReportingConstant; + dxCoil.CondensateVdot = + max(0.0, (dxCoil.InletAirMassFlowRate * (dxCoil.InletAirHumRat - dxCoil.OutletAirHumRat) / Psychrometrics::RhoH2O(Tavg))); + dxCoil.CondensateVol = dxCoil.CondensateVdot * ReportingConstant; - state.dataWaterData->WaterStorage(thisDXCoil.CondensateTankID).VdotAvailSupply(thisDXCoil.CondensateTankSupplyARRID) = - thisDXCoil.CondensateVdot; - state.dataWaterData->WaterStorage(thisDXCoil.CondensateTankID).TwaterSupply(thisDXCoil.CondensateTankSupplyARRID) = thisDXCoil.OutletAirTemp; + state.dataWaterData->WaterStorage(dxCoil.CondensateTankID).VdotAvailSupply(dxCoil.CondensateTankSupplyARRID) = + dxCoil.CondensateVdot; + state.dataWaterData->WaterStorage(dxCoil.CondensateTankID).TwaterSupply(dxCoil.CondensateTankSupplyARRID) = dxCoil.OutletAirTemp; } - state.dataAirLoop->LoopDXCoilRTF = max(thisDXCoil.CoolingCoilRuntimeFraction, thisDXCoil.HeatingCoilRuntimeFraction); - if (thisDXCoil.AirLoopNum > 0) { - state.dataAirLoop->AirLoopAFNInfo(thisDXCoil.AirLoopNum).AFNLoopDXCoilRTF = - max(thisDXCoil.CoolingCoilRuntimeFraction, thisDXCoil.HeatingCoilRuntimeFraction); + state.dataAirLoop->LoopDXCoilRTF = max(dxCoil.CoolingCoilRuntimeFraction, dxCoil.HeatingCoilRuntimeFraction); + if (dxCoil.AirLoopNum > 0) { + state.dataAirLoop->AirLoopAFNInfo(dxCoil.AirLoopNum).AFNLoopDXCoilRTF = + max(dxCoil.CoolingCoilRuntimeFraction, dxCoil.HeatingCoilRuntimeFraction); } } @@ -15010,6 +15010,18 @@ void GetDXCoilIndex(EnergyPlusData &state, } } +int GetDXCoilIndex(EnergyPlusData &state, + std::string const &DXCoilName +) +{ + if (state.dataDXCoils->GetCoilsInputFlag) { + GetDXCoils(state); + state.dataDXCoils->GetCoilsInputFlag = false; + } + + return Util::FindItemInList(DXCoilName, state.dataDXCoils->DXCoil); +} + std::string GetDXCoilName(EnergyPlusData &state, int &DXCoilIndex, bool &ErrorsFound, std::string_view const ThisObjectType, bool const SuppressWarning) { diff --git a/src/EnergyPlus/DXCoils.hh b/src/EnergyPlus/DXCoils.hh index 8575d5bd820..fe14609fd65 100644 --- a/src/EnergyPlus/DXCoils.hh +++ b/src/EnergyPlus/DXCoils.hh @@ -710,6 +710,9 @@ namespace DXCoils { std::string_view const ThisObjectType = {}, bool const SuppressWarning = false); + int GetDXCoilIndex(EnergyPlusData &state, + std::string const &DXCoilName); + std::string GetDXCoilName( EnergyPlusData &state, int &DXCoilIndex, bool &ErrorsFound, std::string_view const ThisObjectType = {}, bool const SuppressWarning = false); @@ -719,6 +722,10 @@ namespace DXCoils { bool &ErrorsFound // set to true if problem ); + Real64 GetCoilCapacity(EnergyPlusData &state, + int coilNum + ); + Real64 GetCoilCapacityByIndexType(EnergyPlusData &state, int const CoilIndex, // must match coil index for the coil type HVAC::CoilType const coilType, // must match coil types in this module @@ -732,9 +739,12 @@ namespace DXCoils { ObjexxFCL::Optional_bool_const PrintWarning = _ // prints warning when true ); + HVAC::CoilType GetCoilTypeNum(EnergyPlusData &state, + int const coilNum + ); + Real64 GetMinOATCompressor(EnergyPlusData &state, - int const CoilIndex, // index to coil - bool &ErrorsFound // set to true if problem + int const coilNum ); int GetCoilInletNode(EnergyPlusData &state, @@ -743,12 +753,20 @@ namespace DXCoils { bool &ErrorsFound // set to true if problem ); + int GetCoilInletNode(EnergyPlusData &state, + int coilNum + ); + int GetCoilOutletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilOutletNode(EnergyPlusData &state, + int coilNum + ); + int getCoilInNodeIndex(EnergyPlusData &state, int CoilIndex, // coil index bool &ErrorsFound // set to true if problem @@ -765,12 +783,20 @@ namespace DXCoils { bool &ErrorsFound // set to true if problem ); + int GetCoilCondenserInletNode(EnergyPlusData &state, + int const coilNum + ); + Real64 GetDXCoilBypassedFlowFrac(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + Real64 GetDXCoilBypassedFlowFrac(EnergyPlusData &state, + int const coilNum + ); + int GetHPCoolingCoilIndex(EnergyPlusData &state, HVAC::CoilType heatingCoilType, // Type of DX heating coil used in HP std::string const &HeatingCoilName, // Name of DX heating coil used in HP @@ -783,6 +809,10 @@ namespace DXCoils { bool &ErrorsFound // set to true if problem ); + int GetDXCoilNumberOfSpeeds(EnergyPlusData &state, + int const coilNum + ); + int GetDXCoilAvailSchPtr(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -790,6 +820,10 @@ namespace DXCoils { ObjexxFCL::Optional_int_const CoilIndex = _ // Coil index number ); + int GetDXCoilAvailSchPtr(EnergyPlusData &state, + int const coilNum + ); + Real64 GetDXCoilAirFlow(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -797,8 +831,7 @@ namespace DXCoils { ); int GetDXCoilCapFTCurveIndex(EnergyPlusData &state, - int const CoilIndex, // coil index pointer - bool &ErrorsFound // set to true if problem + int const CoilIndex ); void SetDXCoolingCoilData( @@ -828,6 +861,51 @@ namespace DXCoils { ObjexxFCL::Optional_string SupplyFanName = _, ObjexxFCL::Optional supplyFanType = _); + void SetDXCoilHeatingPLFCurve(EnergyPlusData &state, int const DXCoilNum, int HeatingCoilPLFCurvePTR); + + void SetDXCoilCondenserType(EnergyPlusData &state, int const DXCoilNum, DataHeatBalance::RefrigCondenserType CondenserType); + + void SetDXCoilCondenserInletNode(EnergyPlusData &state, int const DXCoilNum, int const condenserInletNode); + + void SetDXCoilMaxOATCrankcaseHeater(EnergyPlusData &state, int const DXCoilNum, Real64 maxOATCrankcaseHeater); + + void SetDXCoilMinOATCooling(EnergyPlusData &state, int const DXCoilNum, Real64 minOATCooling); + + void SetDXCoilMaxOATCooling(EnergyPlusData &state, int const DXCoilNum, Real64 maxOATCooling); + + void SetDXCoilMinOATHeating(EnergyPlusData &state, int const DXCoilNum, Real64 minOATHeating); + + void SetDXCoilMaxOATHeating(EnergyPlusData &state, int const DXCoilNum, Real64 maxOATHeating); + + void SetDXCoilHeatingPerformanceOATType(EnergyPlusData &state, int const DXCoilNum, HVAC::OATType heatingPerformanceOATType); + + void SetDXCoilDefrostStrategy(EnergyPlusData &state, int const DXCoilNum, StandardRatings::DefrostStrat defrostStrategy); + + void SetDXCoilDefrostControl(EnergyPlusData &state, int const DXCoilNum, StandardRatings::HPdefrostControl defrostControl); + + void SetDXCoilDefrostEIR(EnergyPlusData &state, int const DXCoilNum, int defrostEIR); + + void SetDXCoilDefrostFraction(EnergyPlusData &state, int const DXCoilNum, Real64 defrostFraction); + + void SetDXCoilDefrostCapacity(EnergyPlusData &state, int const DXCoilNum, Real64 defrostCapacity); + + void SetDXCoilMaxOATDefrost(EnergyPlusData &state, int const DXCoilNum, Real64 maxOATDefrost); + + void SetDXCoilHeatingCoilPresent(EnergyPlusData &state, int const DXCoilNum, bool heatCoilPresent); + + void SetDXCoilCoolingCoilPresent(EnergyPlusData &state, int const DXCoilNum, bool coolCoilPresent); + + void SetDXCoilHeatSizeRatio(EnergyPlusData &state, int const DXCoilNum, Real64 heatSizeRatio); + + void SetDXCoilTotalCapacity(EnergyPlusData &state, int const DXCoilNum, Real64 totalCapacity); + + void SetDXCoilSupplyFanIndex(EnergyPlusData &state, int const DXCoilNum, int supplyFanIndex); + + void SetDXCoilSupplyFanName(EnergyPlusData &state, int const DXCoilNum, std::string const &supplyFanIndex); + + void SetDXCoilSupplyFanType(EnergyPlusData &state, int const DXCoilNum, HVAC::FanType supplyFanType); + + void SetCoilSystemHeatingDXFlag(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName // must match coil names for the coil type diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index 9f6195d8ea9..caa3658c499 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -1349,7 +1349,7 @@ namespace DataHeatBalance { { // Members std::string Name; // Name of Coil - HVAC::CoilType coilType = HVAC::CoilType::Invalid; // SourceType for Coil + std::string SourceType; Real64 AvailCapacity = 0.0; // Total available heat reclaim capacity Real64 ReclaimEfficiencyTotal = 0.0; // Total reclaimed portion Real64 WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; // total reclaimed heat by water heating desuperheater coils diff --git a/src/EnergyPlus/DesiccantDehumidifiers.cc b/src/EnergyPlus/DesiccantDehumidifiers.cc index 1e092d82e09..2a304a731d1 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.cc +++ b/src/EnergyPlus/DesiccantDehumidifiers.cc @@ -377,125 +377,51 @@ namespace DesiccantDehumidifiers { desicDehum.NomProcAirVolFlow = Numbers(2); desicDehum.NomProcAirVel = Numbers(3); - desicDehum.RegenCoilType = Alphas(8); + desicDehum.regenCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(8))); desicDehum.RegenCoilName = Alphas(9); desicDehum.regenFanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(10))); assert(desicDehum.regenFanType != HVAC::FanType::Invalid); - RegenCoilType = Alphas(8); - RegenCoilName = Alphas(9); - - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric") || - Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) { - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric")) desicDehum.regenCoilType = HVAC::CoilType::HeatingElectric; - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) desicDehum.regenCoilType = HVAC::CoilType::HeatingGasOrOtherFuel; - ValidateComponent(state, desicDehum.RegenCoilType, desicDehum.RegenCoilName, ErrorsFound2, CurrentModuleObject + '=' + Alphas(1)); - if (ErrorsFound2) ErrorsFound = true; - HeatingCoils::GetCoilIndex(state, desicDehum.RegenCoilName, desicDehum.RegenCoilIndex, ErrorsFound2); - if (ErrorsFound2) ErrorsFound = true; - - } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Water")) { - desicDehum.regenCoilType = HVAC::CoilType::HeatingWater; - ValidateComponent(state, RegenCoilType, RegenCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (desicDehum.regenCoilType == HVAC::CoilType::HeatingElectric || + desicDehum.regenCoilType == HVAC::CoilType::HeatingGasOrOtherFuel) { + desicDehum.RegenCoilIndex = HeatingCoils::GetCoilIndex(state, desicDehum.RegenCoilName); + if (desicDehum.RegenCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), desicDehum.RegenCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - errFlag = false; - desicDehum.RegenCoilIndex = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", RegenCoilName, errFlag); - if (desicDehum.RegenCoilIndex == 0) { - ShowSevereError(state, format("{}{} illegal {} = {}", RoutineName, CurrentModuleObject, cAlphaFields(9), RegenCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil Hot water Inlet or control Node number - errFlag = false; - desicDehum.CoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", RegenCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the Regeneration Heating Coil hot water max volume flow rate - errFlag = false; - desicDehum.MaxCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", RegenCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the Regeneration Heating Coil Inlet Node - errFlag = false; - int RegenCoilAirInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", RegenCoilName, errFlag); - desicDehum.RegenCoilInletNode = RegenCoilAirInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the Regeneration Heating Coil Outlet Node - errFlag = false; - int RegenCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", RegenCoilName, errFlag); - desicDehum.RegenCoilOutletNode = RegenCoilAirOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } } - } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Steam")) { - desicDehum.regenCoilType = HVAC::CoilType::HeatingSteam; - ValidateComponent(state, Alphas(8), RegenCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + + } else if (desicDehum.regenCoilType == HVAC::CoilType::HeatingWater) { + desicDehum.RegenCoilIndex = WaterCoils::GetWaterCoilIndex(state, desicDehum.RegenCoilName); + if (desicDehum.RegenCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), desicDehum.RegenCoilName); ErrorsFound = true; - } else { // mine data from the regeneration heating coil object - - errFlag = false; - desicDehum.RegenCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", RegenCoilName, errFlag); - if (desicDehum.RegenCoilIndex == 0) { - ShowSevereError(state, format("{}{} illegal {} = {}", RoutineName, CurrentModuleObject, cAlphaFields(9), RegenCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - + } else { + desicDehum.CoilControlNode = WaterCoils::GetCoilWaterInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.MaxCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, desicDehum.RegenCoilIndex); + desicDehum.RegenCoilInletNode = WaterCoils::GetCoilInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.RegenCoilOutletNode = WaterCoils::GetCoilOutletNode(state, desicDehum.RegenCoilIndex); + } + + } else if (desicDehum.regenCoilType == HVAC::CoilType::HeatingSteam) { + desicDehum.RegenCoilIndex = SteamCoils::GetSteamCoilIndex(state, desicDehum.RegenCoilName); + if (desicDehum.RegenCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), desicDehum.RegenCoilName); + ErrorsFound = true; + } else { // Get the regeneration Heating Coil steam inlet node number - errFlag = false; - desicDehum.CoilControlNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", RegenCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the regeneration heating Coil steam max volume flow rate - desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, errFlag); + desicDehum.CoilControlNode = SteamCoils::GetCoilSteamInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex); if (desicDehum.MaxCoilFluidFlow > 0.0) { Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans); desicDehum.MaxCoilFluidFlow *= SteamDensity; } - // Get the regeneration heating Coil Inlet Node - errFlag = false; - int RegenCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, desicDehum.RegenCoilIndex, RegenCoilName, errFlag); - desicDehum.RegenCoilInletNode = RegenCoilAirInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the regeneration heating Coil Outlet Node - errFlag = false; - int RegenCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, desicDehum.RegenCoilIndex, RegenCoilName, errFlag); - desicDehum.RegenCoilOutletNode = RegenCoilAirOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } + desicDehum.RegenCoilInletNode = SteamCoils::GetCoilAirInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.RegenCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, desicDehum.RegenCoilIndex); } } else { - ShowSevereError(state, format("{}{} = {}", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(8), desicDehum.RegenCoilType)); + ShowSevereInvalidKey(state, eoh, cAlphaFields(8), Alphas(8)); ErrorsFound = true; } @@ -780,7 +706,8 @@ namespace DesiccantDehumidifiers { desicDehum.RegenFanName = Alphas(7); - if (desicDehum.regenFanType == HVAC::FanType::OnOff || desicDehum.regenFanType == HVAC::FanType::Constant || + if (desicDehum.regenFanType == HVAC::FanType::OnOff || + desicDehum.regenFanType == HVAC::FanType::Constant || desicDehum.regenFanType == HVAC::FanType::SystemModel) { ErrorsFound2 = false; ValidateComponent(state, @@ -813,63 +740,32 @@ namespace DesiccantDehumidifiers { desicDehum.RegenFanOutNode = fan->outletNodeNum; } - desicDehum.RegenCoilType = Alphas(9); + desicDehum.regenCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(9))); desicDehum.RegenCoilName = Alphas(10); - RegenCoilType = Alphas(9); - RegenCoilName = Alphas(10); desicDehum.RegenSetPointTemp = Numbers(1); - if (!lAlphaBlanks(10)) { - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric") || - Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) { - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Electric")) - desicDehum.regenCoilType = HVAC::CoilType::HeatingElectric; - if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Fuel")) - desicDehum.regenCoilType = HVAC::CoilType::HeatingGasOrOtherFuel; - ErrorsFound2 = false; - ValidateComponent(state, RegenCoilType, RegenCoilName, ErrorsFound2, desicDehum.DehumType + " \"" + desicDehum.Name + "\""); - if (ErrorsFound2) ErrorsFoundGeneric = true; - - if (desicDehum.RegenSetPointTemp <= 0.0) { - ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ShowContinueError(state, format("{} must be greater than 0.", cNumericFields(1))); - ErrorsFoundGeneric = true; - } - - ErrorsFound2 = false; - desicDehum.RegenCoilInletNode = HeatingCoils::GetCoilInletNode(state, RegenCoilType, RegenCoilName, ErrorsFound2); - if (ErrorsFound2) { - ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ErrorsFoundGeneric = true; - } - - ErrorsFound2 = false; - desicDehum.RegenCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, RegenCoilType, RegenCoilName, ErrorsFound2); - if (ErrorsFound2) { - ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ErrorsFoundGeneric = true; - } - - ErrorsFound2 = false; - HeatingCoils::GetCoilIndex(state, RegenCoilName, desicDehum.RegenCoilIndex, ErrorsFound2); - if (ErrorsFound2) { - ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ErrorsFoundGeneric = true; - } - - ErrorsFound2 = false; - RegenCoilControlNodeNum = HeatingCoils::GetCoilControlNodeNum(state, RegenCoilType, RegenCoilName, ErrorsFound2); - if (ErrorsFound2) { - ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ErrorsFoundGeneric = true; - } + if (desicDehum.regenCoilType == HVAC::CoilType::HeatingElectric || + desicDehum.regenCoilType == HVAC::CoilType::HeatingGasOrOtherFuel) { + if (desicDehum.RegenSetPointTemp <= 0.0) { + ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); + ShowContinueError(state, format("{} must be greater than 0.", cNumericFields(1))); + ErrorsFoundGeneric = true; + } - if (RegenCoilControlNodeNum > 0) { + desicDehum.RegenCoilIndex = HeatingCoils::GetCoilIndex(state, desicDehum.RegenCoilName); + if (desicDehum.RegenCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(10), desicDehum.RegenCoilName); + ErrorsFoundGeneric = true; + } else { + desicDehum.RegenCoilInletNode = HeatingCoils::GetCoilInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.RegenCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, desicDehum.RegenCoilIndex); + int RegenCoilControlNode = HeatingCoils::GetCoilControlNodeNum(state, desicDehum.RegenCoilIndex); + if (RegenCoilControlNode > 0) { ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ShowContinueError(state, format("{} is specified as {:.3R} C in this object.", cNumericFields(1), desicDehum.RegenSetPointTemp)); ShowContinueError(state, " Do not specify a coil temperature setpoint node name in the regeneration air heater object."); - ShowContinueError(state, format("...{} = {}", cAlphaFields(9), desicDehum.RegenCoilType)); + ShowContinueError(state, format("...{} = {}", cAlphaFields(9), Alphas(9))); ShowContinueError(state, format("...{} = {}", cAlphaFields(10), desicDehum.RegenCoilName)); ShowContinueError( state, format("...heating coil temperature setpoint node = {}", state.dataLoopNodes->NodeID(RegenCoilControlNodeNum))); @@ -883,138 +779,63 @@ namespace DesiccantDehumidifiers { ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ErrorsFoundGeneric = true; } + } + + } else if (desicDehum.regenCoilType == HVAC::CoilType::HeatingWater) { + if (desicDehum.RegenSetPointTemp <= 0.0) { + ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); + ShowContinueError(state, format("{} must be greater than 0.", cNumericFields(1))); + ErrorsFoundGeneric = true; + } + + desicDehum.RegenCoilIndex = WaterCoils::GetWaterCoilIndex(state, desicDehum.RegenCoilName); + if (desicDehum.RegenCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(10), desicDehum.RegenCoilName); + ErrorsFound = true; + } else { - } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Water")) { - desicDehum.regenCoilType = HVAC::CoilType::HeatingWater; - ValidateComponent(state, RegenCoilType, RegenCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } else { // mine data from heating coil object - errFlag = false; - desicDehum.RegenCoilIndex = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", RegenCoilName, errFlag); - if (desicDehum.RegenCoilIndex == 0) { - ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(9), RegenCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - if (desicDehum.RegenSetPointTemp <= 0.0) { - ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ShowContinueError(state, format("{} must be greater than 0.", cNumericFields(1))); - ErrorsFoundGeneric = true; - } - - // Get the Heating Coil Hot water Inlet or control Node number - errFlag = false; - desicDehum.CoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", RegenCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the Regeneration Heating Coil hot water max volume flow rate - errFlag = false; - desicDehum.MaxCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", RegenCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the Regeneration Heating Coil Inlet Node - errFlag = false; - int RegenCoilAirInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", RegenCoilName, errFlag); - desicDehum.RegenCoilInletNode = RegenCoilAirInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the Regeneration Heating Coil Outlet Node - errFlag = false; - int RegenCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", RegenCoilName, errFlag); - desicDehum.RegenCoilOutletNode = RegenCoilAirOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - RegairHeatingCoilFlag = true; - WaterCoils::SetWaterCoilData(state, desicDehum.RegenCoilIndex, ErrorsFound2, RegairHeatingCoilFlag, DesicDehumNum); - if (ErrorsFound2) { - ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ErrorsFoundGeneric = true; - } - } - } else if (Util::SameString(desicDehum.RegenCoilType, "Coil:Heating:Steam")) { - desicDehum.regenCoilType = HVAC::CoilType::HeatingSteam; - ValidateComponent(state, RegenCoilType, RegenCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } else { // mine data from the regeneration heating coil object - if (desicDehum.RegenSetPointTemp <= 0.0) { - ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ShowContinueError(state, format("{} must be greater than 0.", cNumericFields(1))); - ErrorsFoundGeneric = true; - } - - errFlag = false; - desicDehum.RegenCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", RegenCoilName, errFlag); - if (desicDehum.RegenCoilIndex == 0) { - ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(9), RegenCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the regeneration Heating Coil steam inlet node number - errFlag = false; - desicDehum.CoilControlNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", RegenCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the regeneration heating Coil steam max volume flow rate - desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, errFlag); - if (desicDehum.MaxCoilFluidFlow > 0.0) { - Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans); - desicDehum.MaxCoilFluidFlow *= SteamDensity; - } - - // Get the regeneration heating Coil Inlet Node - errFlag = false; - int RegenCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, desicDehum.RegenCoilIndex, RegenCoilName, errFlag); - desicDehum.RegenCoilInletNode = RegenCoilAirInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - - // Get the regeneration heating Coil Outlet Node - errFlag = false; - int RegenCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, desicDehum.RegenCoilIndex, RegenCoilName, errFlag); - desicDehum.RegenCoilOutletNode = RegenCoilAirOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, desicDehum.Name)); - ErrorsFound = true; - } - } - - ErrorsFound2 = false; - RegenCoilControlNodeNum = SteamCoils::GetSteamCoilControlNodeNum(state, RegenCoilType, RegenCoilName, ErrorsFound2); - + desicDehum.CoilControlNode = WaterCoils::GetCoilWaterInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.MaxCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, desicDehum.RegenCoilIndex); + desicDehum.RegenCoilInletNode = WaterCoils::GetCoilInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.RegenCoilOutletNode = WaterCoils::GetCoilOutletNode(state, desicDehum.RegenCoilIndex); + + RegairHeatingCoilFlag = true; + WaterCoils::SetWaterCoilData(state, desicDehum.RegenCoilIndex, ErrorsFound2, RegairHeatingCoilFlag, DesicDehumNum); if (ErrorsFound2) { ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ErrorsFoundGeneric = true; } + } + + } else if (desicDehum.regenCoilType == HVAC::CoilType::HeatingSteam) { + if (desicDehum.RegenSetPointTemp <= 0.0) { + ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); + ShowContinueError(state, format("{} must be greater than 0.", cNumericFields(1))); + ErrorsFoundGeneric = true; + } - if (RegenCoilControlNodeNum > 0) { + desicDehum.RegenCoilIndex = SteamCoils::GetSteamCoilIndex(state, RegenCoilName); + if (desicDehum.RegenCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), desicDehum.RegenCoilName); + ErrorsFound = true; + } else { + desicDehum.CoilControlNode = SteamCoils::GetCoilSteamInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex); + if (desicDehum.MaxCoilFluidFlow > 0.0) { + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans); + desicDehum.MaxCoilFluidFlow *= SteamDensity; + } + + desicDehum.RegenCoilInletNode = SteamCoils::GetCoilAirInletNode(state, desicDehum.RegenCoilIndex); + desicDehum.RegenCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, desicDehum.RegenCoilIndex); + int RegenCoilControlNode = SteamCoils::GetSteamCoilControlNodeNum(state, desicDehum.RegenCoilIndex); + + if (RegenCoilControlNode > 0) { ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ShowContinueError(state, format("{} is specified as {:.3R} C in this object.", cNumericFields(1), desicDehum.RegenSetPointTemp)); ShowContinueError(state, " Do not specify a coil temperature setpoint node name in the regeneration air heater object."); - ShowContinueError(state, format("...{} = {}", cAlphaFields(9), desicDehum.RegenCoilType)); + ShowContinueError(state, format("...{} = {}", cAlphaFields(9), Alphas(9))); ShowContinueError(state, format("...{} = {}", cAlphaFields(10), desicDehum.RegenCoilName)); ShowContinueError( state, format("...heating coil temperature setpoint node = {}", state.dataLoopNodes->NodeID(RegenCoilControlNodeNum))); @@ -1028,25 +849,20 @@ namespace DesiccantDehumidifiers { ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ErrorsFoundGeneric = true; } - - } else { - ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(9), desicDehum.RegenCoilType)); - ErrorsFoundGeneric = true; } + + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(9), Alphas(9)); + ErrorsFoundGeneric = true; } std::string RegenAirInlet = state.dataLoopNodes->NodeID(desicDehum.HXRegenInNode); - std::string RegenAirOutlet = state.dataLoopNodes->NodeID(desicDehum.HXRegenOutNode); - std::string RegenFanInlet = state.dataLoopNodes->NodeID(desicDehum.RegenFanInNode); - std::string RegenFanOutlet = state.dataLoopNodes->NodeID(desicDehum.RegenFanOutNode); if (!lAlphaBlanks(10)) { RegenCoilInlet = state.dataLoopNodes->NodeID(desicDehum.RegenCoilInletNode); - RegenCoilOutlet = state.dataLoopNodes->NodeID(desicDehum.RegenCoilOutletNode); } @@ -1065,7 +881,7 @@ namespace DesiccantDehumidifiers { BranchNodeConnections::SetUpCompSets(state, desicDehum.DehumType, desicDehum.Name, - desicDehum.RegenCoilType, + HVAC::coilTypeNames[(int)desicDehum.regenCoilType], desicDehum.RegenCoilName, RegenCoilInlet, RegenCoilOutlet); @@ -1173,99 +989,53 @@ namespace DesiccantDehumidifiers { } } - desicDehum.CoolingCoilType = Alphas(11); + desicDehum.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(11))); desicDehum.CoolingCoilName = Alphas(12); - if (!lAlphaBlanks(12)) { - if ((Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:SINGLESPEED")) || - (Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) || - (Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:VARIABLESPEED"))) { - ErrorsFound2 = false; - ValidateComponent(state, - desicDehum.CoolingCoilType, - desicDehum.CoolingCoilName, - ErrorsFound2, - desicDehum.DehumType + " \"" + desicDehum.Name + "\""); - if (ErrorsFound2) ErrorsFoundGeneric = true; - - if ((Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:SINGLESPEED"))) { - desicDehum.coolingCoilType = HVAC::CoilType::DXCoolingSingleSpeed; - } else if ((Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE"))) { - desicDehum.coolingCoilType = HVAC::CoilType::DXCoolingTwoStageWHumControl; - } else if ((Util::SameString(desicDehum.CoolingCoilType, "COIL:COOLING:DX:VARIABLESPEED"))) { - desicDehum.coolingCoilType = HVAC::CoilType::CoolingAirToAirVariableSpeed; - } + if (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { - } else { - ShowSevereError(state, format("{}={}", desicDehum.DehumType, desicDehum.Name)); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(11), desicDehum.CoolingCoilType)); - ErrorsFoundGeneric = true; + desicDehum.CoolingCoilIndex = DXCoils::GetDXCoilIndex(state, desicDehum.CoolingCoilName); + if (desicDehum.CoolingCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), Alphas(12)); + ErrorsFound = true; + } else { + desicDehum.CoolingCoilOutletNode = DXCoils::GetCoilOutletNode(state, desicDehum.CoolingCoilIndex); + desicDehum.CompanionCoilCapacity = DXCoils::GetCoilCapacity(state, desicDehum.CoolingCoilIndex); } - - if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || - (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { - ErrorsFound2 = false; - desicDehum.CoolingCoilOutletNode = - DXCoils::GetCoilOutletNode(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - desicDehum.CompanionCoilCapacity = - DXCoils::GetCoilCapacity(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - if (ErrorsFound2) ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.CoolingCoilName)); - - ErrorsFound2 = false; - DXCoils::GetDXCoilIndex(state, desicDehum.CoolingCoilName, desicDehum.DXCoilIndex, ErrorsFound2, desicDehum.CoolingCoilType); - if (ErrorsFound2) ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.CoolingCoilName)); - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { - ErrorsFound2 = false; - desicDehum.CoolingCoilOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed( - state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - ErrorsFound2 = false; - desicDehum.CompanionCoilCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - if (ErrorsFound2) ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.CoolingCoilName)); - ErrorsFound2 = false; - desicDehum.DXCoilIndex = - VariableSpeedCoils::GetCoilIndexVariableSpeed(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - if (ErrorsFound2) ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.CoolingCoilName)); + + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + desicDehum.CoolingCoilIndex = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, desicDehum.CoolingCoilName); + if (desicDehum.CoolingCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), Alphas(12)); + ErrorsFound = true; + } else { + desicDehum.CoolingCoilOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, desicDehum.CoolingCoilIndex); + desicDehum.CompanionCoilCapacity = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, desicDehum.CoolingCoilIndex); } } // (desicDehum%CoolingCoilName /= Blank)THEN - if (Util::SameString(Alphas(13), "Yes")) { - desicDehum.CoilUpstreamOfProcessSide = Selection::Yes; - } else if (lAlphaBlanks(13)) { - desicDehum.CoilUpstreamOfProcessSide = Selection::No; - } else if (Util::SameString(Alphas(13), "No")) { - desicDehum.CoilUpstreamOfProcessSide = Selection::No; + if (lAlphaBlanks(13)) { + desicDehum.CoilUpstreamOfProcessSide = false; + } else if (BooleanSwitch bs = getYesNoValue(Alphas(13)); bs != BooleanSwitch::Invalid) { + desicDehum.CoilUpstreamOfProcessSide = static_cast(bs); } else { - ShowWarningError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ShowContinueError(state, format("Invalid choice for {} = {}", cAlphaFields(13), Alphas(13))); - ShowContinueError(state, "...resetting to the default value of No"); - desicDehum.CoilUpstreamOfProcessSide = Selection::No; + ShowSevereInvalidKey(state, eoh, cAlphaFields(13), Alphas(13)); + ErrorsFound = true; } - if (Util::SameString(Alphas(14), "Yes")) { - desicDehum.Preheat = Selection::Yes; - } else if (Util::SameString(Alphas(14), "No")) { - desicDehum.Preheat = Selection::No; - } else if (lAlphaBlanks(14)) { - desicDehum.Preheat = Selection::No; + if (lAlphaBlanks(14)) { + desicDehum.Preheat = false; + } else if (BooleanSwitch bs = getYesNoValue(Alphas(14)); bs != BooleanSwitch::Invalid) { + desicDehum.Preheat = static_cast(bs); } else { - ShowWarningError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ShowContinueError(state, format("Invalid choice for {} = {}", cAlphaFields(14), Alphas(14))); - ShowContinueError(state, "...resetting to the default value of NO"); - desicDehum.Preheat = Selection::No; + ShowSevereInvalidBool(state, eoh, cAlphaFields(14), Alphas(14)); } - if (desicDehum.DXCoilIndex > 0) { - - if (desicDehum.Preheat == Selection::Yes) { // Companion coil waste heat used for regeneration of desiccant - ErrorsFound2 = false; - DesuperHeaterIndex = - HeatingCoils::GetHeatReclaimSourceIndex(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - if (ErrorsFound2) { - ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); - ErrorsFoundGeneric = true; - } + if (desicDehum.CoolingCoilIndex > 0) { + if (desicDehum.Preheat) { // Companion coil waste heat used for regeneration of desiccant + DesuperHeaterIndex = HeatingCoils::GetHeatReclaimSourceIndex(state, desicDehum.CoolingCoilIndex); if (DesuperHeaterIndex > 0) { ShowWarningError(state, format("{}={}", desicDehum.DehumType, desicDehum.Name)); @@ -1274,21 +1044,20 @@ namespace DesiccantDehumidifiers { "desiccant regeneration."); ShowContinueError(state, format("A Coil:Heating:Desuperheater object was found using waste heat from the {} \"{}\" object.", - desicDehum.CoolingCoilType, + HVAC::coilTypeNames[(int)desicDehum.coolCoilType], desicDehum.CoolingCoilName)); // ErrorsFoundGeneric = .TRUE. } } - if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || - (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { - ErrorsFound2 = false; - desicDehum.CondenserInletNode = - DXCoils::GetCoilCondenserInletNode(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { - ErrorsFound2 = false; - desicDehum.CondenserInletNode = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, desicDehum.CoolingCoilName, ErrorsFound2); + + if ((desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { + desicDehum.CondenserInletNode = DXCoils::GetCoilCondenserInletNode(state, desicDehum.CoolingCoilIndex); + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + desicDehum.CondenserInletNode = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, desicDehum.CoolingCoilIndex); } - if (desicDehum.CondenserInletNode == 0 && desicDehum.Preheat == Selection::Yes) { + + if (desicDehum.CondenserInletNode == 0 && desicDehum.Preheat) { desicDehum.CondenserInletNode = NodeInputManager::GetOnlySingleNode(state, desicDehum.CoolingCoilName + " Condenser Inlet Node", @@ -1307,12 +1076,13 @@ namespace DesiccantDehumidifiers { "companion cooling coil.", cAlphaFields(14))); ShowContinueError( - state, format("Adding condenser inlet air node for {} \"{}\"", desicDehum.CoolingCoilType, desicDehum.CoolingCoilName)); + state, format("Adding condenser inlet air node for {} \"{}\"", HVAC::coilTypeNames[(int)desicDehum.coolCoilType], desicDehum.CoolingCoilName)); ShowContinueError( state, format("...condenser inlet air node name = {}", state.dataLoopNodes->NodeID(desicDehum.CondenserInletNode))); ShowContinueError(state, "...this node name will be specified as an outdoor air node."); } - } else if (desicDehum.Preheat == Selection::Yes) { + + } else if (desicDehum.Preheat) { if (!OutAirNodeManager::CheckOutAirNodeNumber(state, desicDehum.CondenserInletNode)) { ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ShowContinueError( @@ -1328,26 +1098,23 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode = true; } - if (desicDehum.DXCoilIndex == 0 && desicDehum.Preheat == Selection::Yes) { + if (desicDehum.CoolingCoilIndex == 0 && desicDehum.Preheat) { ShowWarningError(state, format("{}={}", desicDehum.DehumType, desicDehum.Name)); ShowContinueError( state, format("A valid {} must be used when condenser waste heat is reclaimed for desiccant regeneration.", cAlphaFields(12))); - ShowContinueError(state, format("... {} = {}", cAlphaFields(11), desicDehum.CoolingCoilType)); + ShowContinueError(state, format("... {} = {}", cAlphaFields(11), HVAC::coilTypeNames[(int)desicDehum.coolCoilType])); ShowContinueError(state, format("... {} = {}", cAlphaFields(12), desicDehum.CoolingCoilName)); ErrorsFoundGeneric = true; } - if (desicDehum.DXCoilIndex > 0 && desicDehum.CoilUpstreamOfProcessSide == Selection::Yes) { - if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || - (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { - ErrorsFound2 = false; - CoilBypassedFlowFrac = - DXCoils::GetDXCoilBypassedFlowFrac(state, desicDehum.CoolingCoilType, desicDehum.CoolingCoilName, ErrorsFound2); - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { - ErrorsFound2 = false; + if (desicDehum.CoolingCoilIndex > 0 && desicDehum.CoilUpstreamOfProcessSide) { + if ((desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { + CoilBypassedFlowFrac = DXCoils::GetDXCoilBypassedFlowFrac(state, desicDehum.CoolingCoilIndex); + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { CoilBypassedFlowFrac = 0.0; // bypass flow fraction not in VS coil model } - if (ErrorsFound2) ShowContinueError(state, format("...occurs in {} \"{}\"", desicDehum.DehumType, desicDehum.CoolingCoilName)); + if (CoilBypassedFlowFrac > 0.0) { ShowWarningError(state, format("{}={}", desicDehum.DehumType, desicDehum.Name)); ShowContinueError( @@ -1358,17 +1125,17 @@ namespace DesiccantDehumidifiers { format("A DX coil with a bypassed air flow fraction greater than 0 may be upstream of the process inlet " "however the input for {} must be specified as No.", cAlphaFields(13))); - ShowContinueError(state, format("... {} = {}", cAlphaFields(11), desicDehum.CoolingCoilType)); + ShowContinueError(state, format("... {} = {}", cAlphaFields(11), HVAC::coilTypeNames[(int)desicDehum.coolCoilType])); ShowContinueError(state, format("... {} = {}", cAlphaFields(12), desicDehum.CoolingCoilName)); ErrorsFoundGeneric = true; } - } else if (desicDehum.DXCoilIndex == 0 && desicDehum.CoilUpstreamOfProcessSide == Selection::Yes) { + } else if (desicDehum.CoolingCoilIndex == 0 && desicDehum.CoilUpstreamOfProcessSide) { ShowSevereError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ShowContinueError(state, format("A valid companion coil must be specified when {} is specified as Yes.", cAlphaFields(13))); ErrorsFoundGeneric = true; } - if (!desicDehum.RegenInletIsOutsideAirNode && desicDehum.Preheat == Selection::Yes) { + if (!desicDehum.RegenInletIsOutsideAirNode && desicDehum.Preheat) { ShowWarningError(state, format("{}={}", desicDehum.DehumType, desicDehum.Name)); ShowContinueError( state, @@ -1380,12 +1147,12 @@ namespace DesiccantDehumidifiers { ErrorsFoundGeneric = true; } - if (desicDehum.CoilUpstreamOfProcessSide == Selection::Yes) { + if (desicDehum.CoilUpstreamOfProcessSide) { if (desicDehum.ProcAirInNode != desicDehum.CoolingCoilOutletNode) { ShowSevereError(state, format("For {} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ShowContinueError(state, "Node names are inconsistent in companion cooling coil and desiccant heat exchanger objects."); ShowContinueError(state, - format("For companion cooling coil = {} \"{}\"", desicDehum.CoolingCoilType, desicDehum.CoolingCoilName)); + format("For companion cooling coil = {} \"{}\"", HVAC::coilTypeNames[(int)desicDehum.coolCoilType], desicDehum.CoolingCoilName)); ShowContinueError( state, format("The outlet node name in cooling coil = {}", state.dataLoopNodes->NodeID(desicDehum.CoolingCoilOutletNode))); ShowContinueError(state, format("For desiccant heat exchanger = {} \"{}\"", desicDehum.HXType, desicDehum.HXName)); @@ -1409,7 +1176,7 @@ namespace DesiccantDehumidifiers { cAlphaFields(15)); // Field Name } - if (desicDehum.Preheat == Selection::Yes) { + if (desicDehum.Preheat) { ErrorsFound2 = false; if (desicDehum.ExhaustFanMaxVolFlowRate <= 0) { ErrorsFound2 = true; @@ -1422,7 +1189,7 @@ namespace DesiccantDehumidifiers { ShowContinueError( state, format("{} and {} must be defined if {} field is \"Yes\".", cNumericFields(2), cNumericFields(3), cAlphaFields(14))); } - } else if (desicDehum.Preheat == Selection::No) { + } else if (desicDehum.Preheat) { if (desicDehum.ExhaustFanMaxVolFlowRate > 0.0) { ShowWarningError(state, format("{} \"{}\"", desicDehum.DehumType, desicDehum.Name)); ShowContinueError(state, format("{} should be 0 if {} field is \"No\".", cNumericFields(2), cAlphaFields(14))); @@ -1671,7 +1438,7 @@ namespace DesiccantDehumidifiers { ShowFatalError(state, "InitDesiccantDehumidifier: Program terminated for previous conditions."); } ErrorFlag = false; - desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, ErrorFlag); + desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex); if (desicDehum.MaxCoilFluidFlow > 0.0) { Real64 FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); @@ -1772,7 +1539,7 @@ namespace DesiccantDehumidifiers { 1.0, QCoilActual); // simulate any load > 0 to get max capacity of steam coil ErrorFlag = false; - Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, ErrorFlag); + Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex); // if (ErrorFlag) { // ErrorsFound = true; //} @@ -2305,7 +2072,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenCapErrorIndex1); ShowRecurringContinueErrorAtEnd(state, desicDehum.DehumType + '=' + desicDehum.Name, desicDehum.RegenCapErrorIndex2); ShowRecurringContinueErrorAtEnd(state, - format("Load requested [W] from {} = {}", desicDehum.RegenCoilType, desicDehum.RegenCoilName), + format("Load requested [W] from {} = {}", HVAC::coilTypeNames[(int)desicDehum.regenCoilType], desicDehum.RegenCoilName), desicDehum.RegenCapErrorIndex3, QRegen); ShowRecurringContinueErrorAtEnd(state, "Load request exceeded delivered by [W]", desicDehum.RegenCapErrorIndex4, (QRegen - QDelivered)); @@ -2388,10 +2155,10 @@ namespace DesiccantDehumidifiers { OnOffFanPLF = state.dataHVACGlobal->OnOffFanPartLoadFraction; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; - if (desicDehum.CoilUpstreamOfProcessSide == Selection::Yes) { + if (desicDehum.CoilUpstreamOfProcessSide) { // Cooling coil directly upstream of desiccant dehumidifier, dehumidifier runs in tandem with DX coil - CompanionCoilIndexNum = desicDehum.DXCoilIndex; + CompanionCoilIndexNum = desicDehum.CoolingCoilIndex; } else { // desiccant dehumidifier determines its own PLR CompanionCoilIndexNum = 0; @@ -2401,10 +2168,10 @@ namespace DesiccantDehumidifiers { UnitOn = true; } - if (desicDehum.CoilUpstreamOfProcessSide == Selection::Yes) { - if (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed || - desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { - if (state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex) == 0.0) { + if (desicDehum.CoilUpstreamOfProcessSide) { + if (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + if (state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.CoolingCoilIndex) == 0.0) { UnitOn = false; } } @@ -2422,16 +2189,16 @@ namespace DesiccantDehumidifiers { } // Get conditions from DX Coil condenser if present (DXCoilIndex verified > 0 in GetInput) - if (desicDehum.Preheat == Selection::Yes) { + if (desicDehum.Preheat) { // condenser waste heat is proportional to DX coil PLR - if (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed || - desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { - CondenserWasteHeat = state.dataHeatBal->HeatReclaimDXCoil(desicDehum.DXCoilIndex).AvailCapacity; - state.dataHeatBal->HeatReclaimDXCoil(desicDehum.DXCoilIndex).AvailCapacity = 0.0; - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { - CondenserWasteHeat = state.dataHeatBal->HeatReclaimVS_DXCoil(desicDehum.DXCoilIndex).AvailCapacity; - state.dataHeatBal->HeatReclaimVS_DXCoil(desicDehum.DXCoilIndex).AvailCapacity = 0.0; + if (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + CondenserWasteHeat = state.dataHeatBal->HeatReclaimDXCoil(desicDehum.CoolingCoilIndex).AvailCapacity; + state.dataHeatBal->HeatReclaimDXCoil(desicDehum.CoolingCoilIndex).AvailCapacity = 0.0; + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + CondenserWasteHeat = state.dataHeatBal->HeatReclaimVS_DXCoil(desicDehum.CoolingCoilIndex).AvailCapacity; + state.dataHeatBal->HeatReclaimVS_DXCoil(desicDehum.CoolingCoilIndex).AvailCapacity = 0.0; } CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(desicDehum.CondenserInletNode).HumRat); @@ -2448,10 +2215,10 @@ namespace DesiccantDehumidifiers { if (CompanionCoilIndexNum > 0) { // calculate PLR and actual condenser outlet node (regen inlet node) temperature - if (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed || - desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { - DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex); - if (state.dataDXCoils->DXCoilFanOp(desicDehum.DXCoilIndex) == HVAC::FanOp::Continuous) { + if (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.CoolingCoilIndex); + if (state.dataDXCoils->DXCoilFanOp(desicDehum.CoolingCoilIndex) == HVAC::FanOp::Continuous) { NewRegenInTemp = state.dataLoopNodes->Node(desicDehum.CondenserInletNode).Temp + CondenserWasteHeat / (CpAir * (state.dataLoopNodes->Node(desicDehum.RegenAirInNode).MassFlowRate) * DDPartLoadRatio); @@ -2460,7 +2227,7 @@ namespace DesiccantDehumidifiers { NewRegenInTemp = state.dataLoopNodes->Node(desicDehum.CondenserInletNode).Temp + CondenserWasteHeat / (CpAir * (state.dataLoopNodes->Node(desicDehum.RegenAirInNode).MassFlowRate)); } - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down NewRegenInTemp = state.dataLoopNodes->Node(desicDehum.CondenserInletNode).Temp + CondenserWasteHeat / (CpAir * (state.dataLoopNodes->Node(desicDehum.RegenAirInNode).MassFlowRate)); @@ -2545,7 +2312,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoilType); + desicDehum.coolCoilType); // calculate desiccant part-load ratio if (state.dataLoopNodes->Node(desicDehum.ProcAirInNode).HumRat != state.dataLoopNodes->Node(desicDehum.ProcAirOutNode).HumRat) { @@ -2623,7 +2390,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoilType); + desicDehum.coolCoilType); // calculate desiccant part-load ratio if (state.dataLoopNodes->Node(desicDehum.ProcAirInNode).HumRat != @@ -2636,10 +2403,10 @@ namespace DesiccantDehumidifiers { DDPartLoadRatio = 1.0; } } else { - if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || - (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { - DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex); - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + if ((desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { + DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.CoolingCoilIndex); + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down } } @@ -2694,7 +2461,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoilType); + desicDehum.coolCoilType); if (desicDehum.regenFanPlace == HVAC::FanPlace::DrawThru) { state.dataFans->fans(desicDehum.RegenFanIndex)->simulate(state, FirstHVACIteration, _, _); @@ -2706,13 +2473,13 @@ namespace DesiccantDehumidifiers { (state.dataLoopNodes->Node(desicDehum.ProcAirInNode).HumRat - state.dataLoopNodes->Node(desicDehum.ProcAirOutNode).HumRat); // If preheat is Yes, exhaust fan is condenser fan, if CoilUpstreamOfProcessSide is No, DD runs an its own PLR - if (desicDehum.Preheat == Selection::Yes && desicDehum.CoilUpstreamOfProcessSide == Selection::No) { + if (desicDehum.Preheat && !desicDehum.CoilUpstreamOfProcessSide) { // should actually use DX coil RTF instead of PLR since fan power is being calculated - if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || - (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { + if ((desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { desicDehum.ExhaustFanPower += max( - 0.0, (desicDehum.ExhaustFanMaxPower * (state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex) - DDPartLoadRatio))); - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + 0.0, (desicDehum.ExhaustFanMaxPower * (state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.CoolingCoilIndex) - DDPartLoadRatio))); + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { desicDehum.ExhaustFanPower += max(0.0, (desicDehum.ExhaustFanMaxPower * (1.0 - DDPartLoadRatio))); } } @@ -2745,7 +2512,7 @@ namespace DesiccantDehumidifiers { desicDehum.RegenInletIsOutsideAirNode, _, _, - desicDehum.coolingCoilType); + desicDehum.coolCoilType); if (desicDehum.regenFanPlace == HVAC::FanPlace::DrawThru) { state.dataFans->fans(desicDehum.RegenFanIndex)->simulate(state, FirstHVACIteration, _, _); @@ -2753,11 +2520,11 @@ namespace DesiccantDehumidifiers { // Turn on exhaust fan if DX Coil is operating if (desicDehum.ExhaustFanMaxVolFlowRate > 0) { - if (desicDehum.DXCoilIndex > 0) { - if ((desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || - (desicDehum.coolingCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { - DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.DXCoilIndex); - } else if (desicDehum.coolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + if (desicDehum.CoolingCoilIndex > 0) { + if ((desicDehum.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) || + (desicDehum.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl)) { + DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(desicDehum.CoolingCoilIndex); + } else if (desicDehum.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down } desicDehum.ExhaustFanPower = desicDehum.ExhaustFanMaxPower * DDPartLoadRatio; diff --git a/src/EnergyPlus/DesiccantDehumidifiers.hh b/src/EnergyPlus/DesiccantDehumidifiers.hh index 4075cfd74cd..71ac605a50b 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.hh +++ b/src/EnergyPlus/DesiccantDehumidifiers.hh @@ -82,14 +82,6 @@ namespace DesiccantDehumidifiers { Num }; - enum class Selection - { - Invalid = -1, - No, // Condenser waste heat NOT reclaimed for desiccant regeneration - Yes, // Condenser waste heat reclaimed for desiccant regeneration - Num - }; - enum class PerformanceModel { Invalid = -1, @@ -107,7 +99,7 @@ namespace DesiccantDehumidifiers { // User Input data std::string Name; // unique name of component std::string Sched; // name of availability schedule - std::string RegenCoilType; // type of regen coil + HVAC::CoilType regenCoilType = HVAC::CoilType::Invalid; std::string RegenCoilName; // name of regen coil std::string RegenFanName; // name of regen fan PerformanceModel PerformanceModel_Num; // type of performance model, default or user curves @@ -179,10 +171,9 @@ namespace DesiccantDehumidifiers { std::string HXName; // name of desiccant heat exchanger int HXTypeNum; // parameter number of desiccant heat exchanger std::string ExhaustFanCurveObject; // exhaust fan curve object - std::string CoolingCoilType; // type of cooling coil used with desiccant heat exchanger std::string CoolingCoilName; // name of cooling coil used with desiccant heat exchanger - HVAC::CoilType coolingCoilType = HVAC::CoilType::Invalid; // type of cooling coil, DataHVACGlobals coil type constants - Selection Preheat; // determine condenser waste heat usage for pre heating regen air + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; // type of cooling coil, DataHVACGlobals coil type constants + bool Preheat = false; // determine condenser waste heat usage for pre heating regen air Real64 RegenSetPointTemp; // heating set-point for regeneration air [C] Real64 ExhaustFanMaxVolFlowRate; // exhaust fan maximum allowable air flow rate [m3/s] Real64 ExhaustFanMaxMassFlowRate; // exhaust fan maximum allowable air mass flow rate [kg/s] @@ -198,17 +189,17 @@ namespace DesiccantDehumidifiers { int RegenFanOutNode; // fan outlet node number mined from regen fan object int RegenCoilInletNode; // regen heating coil inlet node number mined from regen heater object int RegenCoilOutletNode; // regen heating coil outlet node number mined from regen heater object + int RegenCoilControlNode; int HXProcInNode; // process inlet node num mined from desiccant heat exchanger object int HXProcOutNode; // process outlet node num mined from desiccant heat exchanger object int HXRegenInNode; // regen inlet node number mined from desiccant heat exchanger object int HXRegenOutNode; // regen outlet node number mined from desiccant heat exchanger object int CondenserInletNode; // regen outlet node number mined from desiccant heat exchanger object - int DXCoilIndex; // DX Coil index mined from coil object + int CoolingCoilIndex; // DX Coil index mined from coil object int ErrCount; // error count int ErrIndex1; // error index - Selection CoilUpstreamOfProcessSide; // used to determine if process inlet is pre-cooled + bool CoilUpstreamOfProcessSide = false; // used to determine if process inlet is pre-cooled bool RegenInletIsOutsideAirNode; // regen inlet is connected to an outside air node - HVAC::CoilType regenCoilType = HVAC::CoilType::Invalid; int CoilControlNode; // heating coil hot water or steam inlet node int CoilOutletNode; // outlet node for water coil PlantLocation plantLoc; // plant loop component location for water heating coil @@ -230,12 +221,12 @@ namespace DesiccantDehumidifiers { RegenAirVel(0.0), DehumTypeCode(DesicDehumType::Invalid), WaterRemove(0.0), WaterRemoveRate(0.0), SpecRegenEnergy(0.0), QRegen(0.0), RegenEnergy(0.0), ElecUseEnergy(0.0), ElecUseRate(0.0), PartLoad(0.0), RegenCapErrorIndex1(0), RegenCapErrorIndex2(0), RegenCapErrorIndex3(0), RegenCapErrorIndex4(0), RegenFanErrorIndex1(0), RegenFanErrorIndex2(0), RegenFanErrorIndex3(0), - RegenFanErrorIndex4(0), HXTypeNum(0), Preheat(Selection::Invalid), RegenSetPointTemp(0.0), + RegenFanErrorIndex4(0), HXTypeNum(0), RegenSetPointTemp(0.0), ExhaustFanMaxVolFlowRate(0.0), ExhaustFanMaxMassFlowRate(0.0), ExhaustFanMaxPower(0.0), ExhaustFanPower(0.0), ExhaustFanElecConsumption(0.0), CompanionCoilCapacity(0.0), regenFanPlace(HVAC::FanPlace::Invalid), ControlNodeNum(0), ExhaustFanCurveIndex(0), CompIndex(0), CoolingCoilOutletNode(0), RegenFanOutNode(0), RegenCoilInletNode(0), RegenCoilOutletNode(0), - HXProcInNode(0), HXProcOutNode(0), HXRegenInNode(0), HXRegenOutNode(0), CondenserInletNode(0), DXCoilIndex(0), ErrCount(0), - ErrIndex1(0), CoilUpstreamOfProcessSide(Selection::Invalid), RegenInletIsOutsideAirNode(false), + HXProcInNode(0), HXProcOutNode(0), HXRegenInNode(0), HXRegenOutNode(0), CondenserInletNode(0), CoolingCoilIndex(0), ErrCount(0), + ErrIndex1(0), RegenInletIsOutsideAirNode(false), CoilControlNode(0), CoilOutletNode(0), HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0), MaxCoilFluidFlow(0.0), RegenCoilCapacity(0.0) { diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index f11c91ccc4c..b75f51cce6d 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -365,18 +365,12 @@ namespace FanCoilUnits { } } - fanCoil.CCoilName = Alphas(12); + fanCoil.CoolCoilName = Alphas(12); fanCoil.MaxColdWaterVolFlow = Numbers(5); fanCoil.MinColdWaterVolFlow = Numbers(6); fanCoil.ColdControlOffset = Numbers(7); - fanCoil.HCoilName = Alphas(14); + fanCoil.HeatCoilName = Alphas(14); - fanCoil.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(13))); - if (fanCoil.coolCoilType == HVAC::CoilType::Invalid) { - ShowSevereInvalidKey(state, eoh, cAlphaFields(13), Alphas(13)); - ErrorsFound = true; - } - fanCoil.MaxHotWaterVolFlow = Numbers(8); fanCoil.MinHotWaterVolFlow = Numbers(9); fanCoil.HotControlOffset = Numbers(10); @@ -385,106 +379,88 @@ namespace FanCoilUnits { if (fanCoil.coolCoilType == HVAC::CoilType::Invalid) { ShowSevereInvalidKey(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; - } else if (fanCoil.coolCoilType == HVAC::CoilType::CoolingWater) { - fanCoil.CCoilPlantName = fanCoil.CCoilName; - fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterCooling; - } else if (fanCoil.coolCoilType == HVAC::CoilType::CoolingWaterDetailed) { - fanCoil.CCoilPlantName = fanCoil.CCoilName; - fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; - } else if (fanCoil.coolCoilType == HVAC::CoilType::WaterCoolingHXAssisted) { - HVAC::CoilType hxCoilType = HVAC::CoilType::Invalid; - HVACHXAssistedCoolingCoil::GetHXCoilTypeAndName( - state, fanCoil.coolCoilType, fanCoil.CCoilName, ErrorsFound, hxCoilType, fanCoil.CCoilPlantName); - if (hxCoilType == HVAC::CoilType::CoolingWater) { - fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterCooling; - } else if (hxCoilType == HVAC::CoilType::CoolingWaterDetailed) { - fanCoil.CCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; - } else { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, fanCoil.Name)); - ShowContinueError(state, format("For: {}=\"{}\".", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("Invalid Coil Type={}, Name={}", HVAC::coilTypeNames[(int)hxCoilType], fanCoil.CCoilPlantName)); - ShowContinueError(state, "must be \"Coil:Cooling:Water\" or \"Coil:Cooling:Water:DetailedGeometry\""); + + } else if (fanCoil.coolCoilType == HVAC::CoilType::CoolingWater || + fanCoil.coolCoilType == HVAC::CoilType::CoolingWaterDetailed) { + fanCoil.CoolCoilPlantType = fanCoil.coolCoilType == HVAC::CoilType::CoolingWater ? + DataPlant::PlantEquipmentType::CoilWaterCooling : + DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; + + fanCoil.CoolCoilNum = WaterCoils::GetWaterCoilIndex(state, fanCoil.CoolCoilName); + if (fanCoil.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), fanCoil.CoolCoilName); ErrorsFound = true; + } else { + auto &waterCoil = state.dataWaterCoils->WaterCoil(fanCoil.CoolCoilNum); + fanCoil.CoolCoilFluidInletNode = waterCoil.WaterInletNodeNum; + fanCoil.CoolCoilAirInletNode = waterCoil.AirInletNodeNum; + fanCoil.CoolCoilAirOutletNode = waterCoil.AirOutletNodeNum; } - } - - if (!ValidateComponent(state, HVAC::coilTypeNames[(int)fanCoil.coolCoilType], fanCoil.CCoilName, fanCoil.UnitType)) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); - ErrorsFound = true; + + } else if (fanCoil.coolCoilType == HVAC::CoilType::WaterCoolingHXAssisted) { + fanCoil.hxCoolCoilType = HVAC::CoilType::WaterCoolingHXAssisted; + fanCoil.hxCoolCoilName = fanCoil.CoolCoilName; + fanCoil.hxCoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, fanCoil.hxCoolCoilName); + if (fanCoil.hxCoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), fanCoil.hxCoolCoilName); + ErrorsFound = true; } else { - if (fanCoil.CCoilType_Num != CCoil::HXAssist) { - // mine the cold water node from the coil object - int coilIndex = WaterCoils::GetWaterCoilIndex(state, fanCoil.CCoilType, fanCoil.CCoilName, IsNotOK); - // Other error checks should trap before it gets to this point in the code, but including just in case. - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); - ErrorsFound = true; - } else { - fanCoil.CoolCoilFluidInletNode = state.dataWaterCoils->WaterCoil(coilIndex).WaterInletNodeNum; - fanCoil.CoolCoilInletNodeNum = state.dataWaterCoils->WaterCoil(coilIndex).AirInletNodeNum; - fanCoil.CoolCoilOutletNodeNum = state.dataWaterCoils->WaterCoil(coilIndex).AirOutletNodeNum; - } + fanCoil.coolCoilType = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilType(state, fanCoil.hxCoolCoilNum); + if (fanCoil.coolCoilType == HVAC::CoilType::CoolingWater) { + fanCoil.CoolCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterCooling; + } else if (fanCoil.coolCoilType == HVAC::CoilType::CoolingWaterDetailed) { + fanCoil.CoolCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; } else { - // mine the cold water node from the coil object - int coilIndex = WaterCoils::GetWaterCoilIndex(state, CCoilType, fanCoil.CCoilPlantName, IsNotOK); - // Other error checks should trap before it gets to this point in the code, but including just in case. - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); - ErrorsFound = true; - } else { - fanCoil.CoolCoilFluidInletNode = state.dataWaterCoils->WaterCoil(coilIndex).WaterInletNodeNum; - fanCoil.CoolCoilInletNodeNum = state.dataWaterCoils->WaterCoil(coilIndex).AirInletNodeNum; - fanCoil.CoolCoilOutletNodeNum = state.dataWaterCoils->WaterCoil(coilIndex).AirOutletNodeNum; - } + ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, fanCoil.Name)); + ShowContinueError(state, format("For: {}=\"{}\".", cAlphaFields(11), Alphas(11))); + ShowContinueError(state, format("Invalid Coil Type={}, Name={}", HVAC::coilTypeNames[(int)fanCoil.coolCoilType], fanCoil.CoolCoilName)); + ShowContinueError(state, "must be \"Coil:Cooling:Water\" or \"Coil:Cooling:Water:DetailedGeometry\""); + ErrorsFound = true; } + + // mine the cold water node from the coil object + fanCoil.CoolCoilName = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilName(state, fanCoil.hxCoolCoilNum); + fanCoil.CoolCoilNum = WaterCoils::GetWaterCoilIndex(state, fanCoil.CoolCoilName); + auto &waterCoil = state.dataWaterCoils->WaterCoil(fanCoil.CoolCoilNum); + fanCoil.CoolCoilFluidInletNode = waterCoil.WaterInletNodeNum; + fanCoil.CoolCoilAirInletNode = waterCoil.AirInletNodeNum; + fanCoil.CoolCoilAirOutletNode = waterCoil.AirOutletNodeNum; } } - if (Util::SameString(Alphas(13), "Coil:Heating:Water")) { - fanCoil.HCoilType_Num = HCoil::Water; - fanCoil.HCoilPlantTypeOf = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - IsNotOK = false; - ValidateComponent(state, fanCoil.HCoilType, fanCoil.HCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); + fanCoil.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(13))); + if (fanCoil.coolCoilType == HVAC::CoilType::Invalid) { + ShowSevereInvalidKey(state, eoh, cAlphaFields(13), Alphas(13)); + ErrorsFound = true; + + } else if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { + fanCoil.HeatCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + + // mine the hot water node from the coil object + fanCoil.HeatCoilNum = WaterCoils::GetWaterCoilIndex(state, fanCoil.HeatCoilName); + if (fanCoil.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(14), fanCoil.HeatCoilName); ErrorsFound = true; } else { - // mine the hot water node from the coil object - int coilIndex = WaterCoils::GetWaterCoilIndex(state, fanCoil.HCoilType, fanCoil.HCoilName, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); - ErrorsFound = true; - } else { - fanCoil.HeatCoilFluidInletNode = state.dataWaterCoils->WaterCoil(coilIndex).WaterInletNodeNum; - fanCoil.HeatCoilInletNodeNum = state.dataWaterCoils->WaterCoil(coilIndex).AirInletNodeNum; - fanCoil.HeatCoilOutletNodeNum = state.dataWaterCoils->WaterCoil(coilIndex).AirOutletNodeNum; - } + auto &waterCoil = state.dataWaterCoils->WaterCoil(fanCoil.HeatCoilNum); + fanCoil.HeatCoilFluidInletNode = waterCoil.WaterInletNodeNum; + fanCoil.HeatCoilAirInletNode = waterCoil.AirInletNodeNum; + fanCoil.HeatCoilAirOutletNode = waterCoil.AirOutletNodeNum; } - } else if (Util::SameString(Alphas(13), "Coil:Heating:Electric")) { - fanCoil.HCoilType_Num = HCoil::Electric; - IsNotOK = false; - ValidateComponent(state, fanCoil.HCoilType, fanCoil.HCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, fanCoil.Name)); + + } else if (fanCoil.heatCoilType == HVAC::CoilType::HeatingElectric) { + fanCoil.HeatCoilNum = HeatingCoils::GetCoilIndex(state, fanCoil.HeatCoilName); + if (fanCoil.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(14), fanCoil.HeatCoilName); ErrorsFound = true; } else { - int coilIndex; - HeatingCoils::GetCoilIndex(state, fanCoil.HCoilName, coilIndex, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, fanCoil.Name)); - ErrorsFound = true; - } else { - fanCoil.DesignHeatingCapacity = state.dataHeatingCoils->HeatingCoil(coilIndex).NominalCapacity; - fanCoil.HeatCoilInletNodeNum = state.dataHeatingCoils->HeatingCoil(coilIndex).AirInletNodeNum; - fanCoil.HeatCoilOutletNodeNum = state.dataHeatingCoils->HeatingCoil(coilIndex).AirOutletNodeNum; - } + auto &waterCoil = state.dataHeatingCoils->HeatingCoil(fanCoil.HeatCoilNum); + fanCoil.DesignHeatingCapacity = waterCoil.NominalCapacity; + fanCoil.HeatCoilAirInletNode = waterCoil.AirInletNodeNum; + fanCoil.HeatCoilAirOutletNode = waterCoil.AirOutletNodeNum; } - } else { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, fanCoil.Name)); - ShowContinueError(state, format("illegal value: {}=\"{}\".", cAlphaFields(13), Alphas(13))); - ErrorsFound = true; } - + fanCoil.FanName = Alphas(10); if (!lAlphaBlanks(15)) { @@ -510,19 +486,21 @@ namespace FanCoilUnits { Alphas(9), "Fan Type must be Fan:OnOff, Fan:ConstantVolume, Fan:VariableVolume, or Fan:SystemModel."); ErrorsFound = true; + } else if ((fanCoil.FanIndex = Fans::GetFanIndex(state, fanCoil.FanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(10), Alphas(10)); ErrorsFound = true; + } else { auto *fan = state.dataFans->fans(fanCoil.FanIndex); if (fanCoil.fanType != fan->type) { - ShowSevereCustomMessage(state, - eoh, - format("{} was specified as having type {}, but has type {}", - fanCoil.FanName, - HVAC::fanTypeNamesUC[(int)fanCoil.fanType], - HVAC::fanTypeNamesUC[(int)fan->type])); + ShowSevereCustom(state, + eoh, + format("{} was specified as having type {}, but has type {}", + fanCoil.FanName, + HVAC::fanTypeNamesUC[(int)fanCoil.fanType], + HVAC::fanTypeNamesUC[(int)fan->type])); ErrorsFound = true; } @@ -820,14 +798,14 @@ namespace FanCoilUnits { } // Set up component set for cooling coil BranchNodeConnections::SetUpCompSets( - state, fanCoil.UnitType, fanCoil.Name, fanCoil.CCoilType, fanCoil.CCoilName, "UNDEFINED", "UNDEFINED"); + state, fanCoil.UnitType, fanCoil.Name, HVAC::coilTypeNames[(int)fanCoil.coolCoilType], fanCoil.CoolCoilName, "UNDEFINED", "UNDEFINED"); // Set up component set for heating coil BranchNodeConnections::SetUpCompSets(state, fanCoil.UnitType, fanCoil.Name, - fanCoil.HCoilType, - fanCoil.HCoilName, + HVAC::coilTypeNames[(int)fanCoil.heatCoilType], + fanCoil.HeatCoilName, "UNDEFINED", state.dataLoopNodes->NodeID(fanCoil.AirOutNode)); @@ -963,9 +941,9 @@ namespace FanCoilUnits { fanCoil.Name); state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( - state, fanCoil.CCoilName, fanCoil.CCoilType, fanCoil.FanName, fanCoil.fanType, fanCoil.FanIndex); + state, fanCoil.CoolCoilName, fanCoil.coolCoilType, fanCoil.FanName, fanCoil.fanType, fanCoil.FanIndex); state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( - state, fanCoil.HCoilName, fanCoil.HCoilType, fanCoil.FanName, fanCoil.fanType, fanCoil.FanIndex); + state, fanCoil.HeatCoilName, fanCoil.heatCoilType, fanCoil.FanName, fanCoil.fanType, fanCoil.FanIndex); } } @@ -1017,32 +995,32 @@ namespace FanCoilUnits { if (state.dataFanCoilUnits->MyPlantScanFlag(FanCoilNum) && allocated(state.dataPlnt->PlantLoop)) { bool errFlag = false; - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { PlantUtilities::ScanPlantLoopsForObject( - state, fanCoil.HCoilName, fanCoil.HCoilPlantTypeOf, fanCoil.HeatCoilPlantLoc, errFlag, _, _, _, _, _); + state, fanCoil.HeatCoilName, fanCoil.HeatCoilPlantType, fanCoil.HeatCoilPlantLoc, errFlag, _, _, _, _, _); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type={}", fanCoil.Name, fanCoil.UnitType)); ShowFatalError(state, "InitFanCoilUnits: Program terminated for previous conditions."); } - fanCoil.HeatCoilFluidOutletNodeNum = DataPlant::CompData::getPlantComponent(state, fanCoil.HeatCoilPlantLoc).NodeNumOut; + fanCoil.HeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, fanCoil.HeatCoilPlantLoc).NodeNumOut; - } else if (fanCoil.HCoilType_Num == HCoil::Electric) { + } else if (fanCoil.heatCoilType == HVAC::CoilType::HeatingElectric) { // do nothing, valid type } else { ShowFatalError(state, format("InitFanCoilUnits: FanCoil={}, invalid heating coil type. Program terminated.", fanCoil.Name)); } - if ((fanCoil.CCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterCooling) || - (fanCoil.CCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling)) { + if ((fanCoil.CoolCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterCooling) || + (fanCoil.CoolCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling)) { PlantUtilities::ScanPlantLoopsForObject( - state, fanCoil.CCoilPlantName, fanCoil.CCoilPlantType, fanCoil.CoolCoilPlantLoc, errFlag, _, _, _, _, _); + state, fanCoil.CoolCoilName, fanCoil.CoolCoilPlantType, fanCoil.CoolCoilPlantLoc, errFlag, _, _, _, _, _); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type={}", fanCoil.Name, fanCoil.UnitType)); ShowFatalError(state, "InitFanCoilUnits: Program terminated for previous conditions."); } - fanCoil.CoolCoilFluidOutletNodeNum = DataPlant::CompData::getPlantComponent(state, fanCoil.CoolCoilPlantLoc).NodeNumOut; + fanCoil.CoolCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, fanCoil.CoolCoilPlantLoc).NodeNumOut; } else { ShowFatalError(state, format("InitFanCoilUnits: FanCoil={}, invalid cooling coil type. Program terminated.", fanCoil.Name)); } @@ -1079,7 +1057,7 @@ namespace FanCoilUnits { fanCoil.MaxAirMassFlow = RhoAir * fanCoil.MaxAirVolFlow; fanCoil.OutAirMassFlow = RhoAir * fanCoil.OutAirVolFlow; - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { Real64 rho = state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); fanCoil.MaxHeatCoilFluidFlow = rho * fanCoil.MaxHotWaterVolFlow; @@ -1091,13 +1069,13 @@ namespace FanCoilUnits { fanCoil.MinColdWaterFlow = rho * fanCoil.MinColdWaterVolFlow; // set the node max and min mass flow rates - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { PlantUtilities::InitComponentNodes( - state, fanCoil.MinHotWaterFlow, fanCoil.MaxHeatCoilFluidFlow, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum); + state, fanCoil.MinHotWaterFlow, fanCoil.MaxHeatCoilFluidFlow, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode); } PlantUtilities::InitComponentNodes( - state, fanCoil.MinColdWaterFlow, fanCoil.MaxCoolCoilFluidFlow, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum); + state, fanCoil.MinColdWaterFlow, fanCoil.MaxCoolCoilFluidFlow, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode); if (fanCoil.OutsideAirNode > 0) { state.dataLoopNodes->Node(fanCoil.OutsideAirNode).MassFlowRateMax = fanCoil.OutAirMassFlow; @@ -1181,8 +1159,6 @@ namespace FanCoilUnits { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 DesCoilLoad; // coil load used for sizing [W] - std::string CoolingCoilName; - std::string CoolingCoilType; Real64 rho; Real64 Cp; int zoneHVACIndex; // index of zoneHVAC equipment sizing specification @@ -1505,7 +1481,7 @@ namespace FanCoilUnits { } } - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { IsAutoSize = false; if (fanCoil.MaxHotWaterVolFlow == DataSizing::AutoSize) { IsAutoSize = true; @@ -1518,21 +1494,17 @@ namespace FanCoilUnits { state, fanCoil.UnitType, fanCoil.Name, "User-Specified Maximum Hot Water Flow [m3/s]", fanCoil.MaxHotWaterVolFlow); } } else { - state.dataFanCoilUnits->CoilWaterInletNode = - WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", fanCoil.HCoilName, ErrorsFound); - state.dataFanCoilUnits->CoilWaterOutletNode = - WaterCoils::GetCoilWaterOutletNode(state, "Coil:Heating:Water", fanCoil.HCoilName, ErrorsFound); if (IsAutoSize) { int PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(state, "Coil:Heating:Water", - fanCoil.HCoilName, - state.dataFanCoilUnits->CoilWaterInletNode, - state.dataFanCoilUnits->CoilWaterOutletNode, + fanCoil.HeatCoilName, + fanCoil.HeatCoilFluidInletNode, + fanCoil.HeatCoilFluidOutletNode, ErrorsFound); - CoilNum = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", fanCoil.HCoilName, ErrorsFound); bool DoWaterCoilSizing; // if TRUE do water coil sizing calculation - if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { - WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; + auto &waterCoil = state.dataWaterCoils->WaterCoil(fanCoil.HeatCoilNum); + if (waterCoil.UseDesignWaterDeltaTemp) { + WaterCoilSizDeltaT = waterCoil.DesignWaterDeltaTemp; DoWaterCoilSizing = true; } else { if (PltSizHeatNum > 0) { @@ -1663,10 +1635,10 @@ namespace FanCoilUnits { } } } - } else if (fanCoil.HCoilType_Num == HCoil::Electric) { + } else if (fanCoil.heatCoilType == HVAC::CoilType::HeatingElectric) { if (fanCoil.DesignHeatingCapacity == DataSizing::AutoSize) { - CompName = fanCoil.HCoilName; - CompType = fanCoil.HCoilType; + CompName = fanCoil.HeatCoilName; + CompType = HVAC::coilTypeNames[(int)fanCoil.heatCoilType]; SizingMethod = HVAC::HeatingCapacitySizing; PrintFlag = false; TempSize = fanCoil.DesignHeatingCapacity; @@ -1691,27 +1663,18 @@ namespace FanCoilUnits { state, fanCoil.UnitType, fanCoil.Name, "User-Specified Maximum Cold Water Flow [m3/s]", fanCoil.MaxColdWaterVolFlow); } } else { - if (Util::SameString(fanCoil.CCoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) { - CoolingCoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, fanCoil.CCoilType, fanCoil.CCoilName, ErrorsFound); - CoolingCoilType = HVACHXAssistedCoolingCoil::GetHXCoilType(state, fanCoil.CCoilType, fanCoil.CCoilName, ErrorsFound); - } else { - CoolingCoilName = fanCoil.CCoilName; - CoolingCoilType = fanCoil.CCoilType; - } - state.dataFanCoilUnits->CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); - state.dataFanCoilUnits->CoilWaterOutletNode = - WaterCoils::GetCoilWaterOutletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); if (IsAutoSize) { int PltSizCoolNum = PlantUtilities::MyPlantSizingIndex(state, - CoolingCoilType, - CoolingCoilName, - state.dataFanCoilUnits->CoilWaterInletNode, - state.dataFanCoilUnits->CoilWaterOutletNode, + HVAC::coilTypeNames[(int)fanCoil.coolCoilType], + fanCoil.CoolCoilName, + fanCoil.CoolCoilFluidInletNode, + fanCoil.CoolCoilFluidOutletNode, ErrorsFound); - CoilNum = WaterCoils::GetWaterCoilIndex(state, CoolingCoilType, CoolingCoilName, ErrorsFound); + bool DoWaterCoilSizing; // if TRUE do water coil sizing calculation - if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { - WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; + auto &waterCoil = state.dataWaterCoils->WaterCoil(fanCoil.CoolCoilNum); + if (waterCoil.UseDesignWaterDeltaTemp) { + WaterCoilSizDeltaT = waterCoil.DesignWaterDeltaTemp; DoWaterCoilSizing = true; } else { if (PltSizCoolNum > 0) { @@ -1907,25 +1870,16 @@ namespace FanCoilUnits { } // if ( CurZoneEqNum > 0 ) - // set the design air flow rates for the heating and cooling coils - if (Util::SameString(fanCoil.CCoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) { - CoolingCoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, fanCoil.CCoilType, fanCoil.CCoilName, ErrorsFound); - CoolingCoilType = HVACHXAssistedCoolingCoil::GetHXCoilType(state, fanCoil.CCoilType, fanCoil.CCoilName, ErrorsFound); - } else { - CoolingCoilName = fanCoil.CCoilName; - CoolingCoilType = fanCoil.CCoilType; - } if (state.dataSize->ZoneSizingRunDone) { - WaterCoils::SetCoilDesFlow( - state, CoolingCoilType, CoolingCoilName, state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow, ErrorsFound); WaterCoils::SetCoilDesFlow(state, - fanCoil.HCoilType, - fanCoil.HCoilName, - state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow, - ErrorsFound); + fanCoil.CoolCoilNum, + state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow); + WaterCoils::SetCoilDesFlow(state, + fanCoil.HeatCoilNum, + state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow); } else { - WaterCoils::SetCoilDesFlow(state, CoolingCoilType, CoolingCoilName, fanCoil.MaxAirVolFlow, ErrorsFound); - WaterCoils::SetCoilDesFlow(state, fanCoil.HCoilType, fanCoil.HCoilName, fanCoil.MaxAirVolFlow, ErrorsFound); + WaterCoils::SetCoilDesFlow(state, fanCoil.CoolCoilNum, fanCoil.MaxAirVolFlow); + WaterCoils::SetCoilDesFlow(state, fanCoil.HeatCoilNum, fanCoil.MaxAirVolFlow); } if (state.dataSize->CurZoneEqNum > 0) { zoneEqSizing.MaxHWVolFlow = fanCoil.MaxHotWaterVolFlow; @@ -2032,15 +1986,15 @@ namespace FanCoilUnits { // set water coil flow rate to 0 to calculate coil off capacity (only valid while flow is unlocked) mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); if (state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).LoopSide(fanCoil.CoolCoilPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Locked) { ColdFlowLocked = true; // check for flow lock } - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); if (state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).LoopSide(fanCoil.HeatCoilPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Locked) { HotFlowLocked = true; // save locked flow @@ -2075,7 +2029,7 @@ namespace FanCoilUnits { // get full load result mdot = MaxWaterFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOutMaxC); if (!ColdFlowLocked) { fanCoil.QUnitOutMaxC = QUnitOutMaxC; @@ -2154,7 +2108,7 @@ namespace FanCoilUnits { if (!ColdFlowLocked) { mdot = CWFlow; // not flowlocked - set flow to CWFlow PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut); // get QUnitOut } else { // flow lock on @@ -2166,23 +2120,23 @@ namespace FanCoilUnits { QUnitOut); // get QUnitOut with CWFlow; rest will be bypassed state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).MassFlowRate = MdotLockC; // reset flow to locked value. Since lock is on, must do this by hand - state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNodeNum).MassFlowRate = MdotLockC; + state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNode).MassFlowRate = MdotLockC; // Keep soln flow rate but reset outlet water temperature - i.e. bypass extra water CWFlowBypass = MdotLockC - CWFlow; // change water outlet temperature and enthalpy - state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNodeNum).Temp = + state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNode).Temp = (CWFlowBypass * state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).Temp + - CWFlow * state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNodeNum).Temp) / + CWFlow * state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNode).Temp) / MdotLockC; - state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNodeNum).Enthalpy = + state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNode).Enthalpy = (CWFlowBypass * state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).Enthalpy + - CWFlow * state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNodeNum).Enthalpy) / + CWFlow * state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNode).Enthalpy) / MdotLockC; } else { // if MdotLockC <= CWFlow use MdotLockC as is state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).MassFlowRate = MdotLockC; // reset flow to locked value. Since lock is on, must do this by hand - state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNodeNum).MassFlowRate = MdotLockC; + state.dataLoopNodes->Node(fanCoil.CoolCoilFluidOutletNode).MassFlowRate = MdotLockC; Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut); } } @@ -2195,7 +2149,7 @@ namespace FanCoilUnits { } else if (UnitOn && QCoilHeatSP > HVAC::SmallLoad && state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling) { // get full load result - if (fanCoil.HCoilType_Num == HCoil::Water) { // if HW Coil + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { // if HW Coil int ControlNode = fanCoil.HeatCoilFluidInletNode; ControlOffset = fanCoil.HotControlOffset; MaxWaterFlow = fanCoil.MaxHeatCoilFluidFlow; @@ -2208,7 +2162,7 @@ namespace FanCoilUnits { } mdot = MaxWaterFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOutMaxH); if (!HotFlowLocked) { fanCoil.QUnitOutMaxH = QUnitOutMaxH; @@ -2223,7 +2177,7 @@ namespace FanCoilUnits { QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToHeatSP; if (QUnitOutMaxH > QZnReq) { // more heating than required, find reduced water flow rate to meet the load - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { // solve for the hot water flow rate with no limit set by flow rate lockdown auto f = [&state, FirstHVACIteration, FanCoilNum, ControlledZoneNum, QZnReq](Real64 HWFlow) { // To calculate the part-load ratio for the FCU with electric heating coil @@ -2302,17 +2256,17 @@ namespace FanCoilUnits { } } else { // demand greater than capacity - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { HWFlow = MaxWaterFlow; } else { Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, 1.0); } } - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { if (!HotFlowLocked) { mdot = HWFlow; // not flowlocked - set flow to HWFlow PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut); // get QUnitOut } else { // flow lock on @@ -2324,23 +2278,23 @@ namespace FanCoilUnits { QUnitOut); // get QUnitOut with HWFlow; rest will be bypassed state.dataLoopNodes->Node(fanCoil.HeatCoilFluidInletNode).MassFlowRate = MdotLockH; // reset flow to locked value. Since lock is on, must do this by hand - state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNodeNum).MassFlowRate = MdotLockH; + state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNode).MassFlowRate = MdotLockH; // Keep soln flow rate but reset outlet water temperature - i.e. bypass extra water HWFlowBypass = MdotLockH - HWFlow; // change outlet water temperature and enthalpy - state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNodeNum).Temp = + state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNode).Temp = (HWFlowBypass * state.dataLoopNodes->Node(fanCoil.HeatCoilFluidInletNode).Temp + - HWFlow * state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNodeNum).Temp) / + HWFlow * state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNode).Temp) / MdotLockH; - state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNodeNum).Enthalpy = + state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNode).Enthalpy = (HWFlowBypass * state.dataLoopNodes->Node(fanCoil.HeatCoilFluidInletNode).Enthalpy + - HWFlow * state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNodeNum).Enthalpy) / + HWFlow * state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNode).Enthalpy) / MdotLockH; } else { // if MdotLockH <= HWFlow use MdotLockH as is state.dataLoopNodes->Node(fanCoil.HeatCoilFluidInletNode).MassFlowRate = MdotLockH; // reset flow to locked value. Since lock is on, must do this by hand - state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNodeNum).MassFlowRate = MdotLockH; + state.dataLoopNodes->Node(fanCoil.HeatCoilFluidOutletNode).MassFlowRate = MdotLockH; Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut); } } @@ -2378,15 +2332,15 @@ namespace FanCoilUnits { // zero the hot & cold water flows mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); if (state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).LoopSide(fanCoil.CoolCoilPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Locked) { ColdFlowLocked = true; // check for flow lock } - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); if (state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).LoopSide(fanCoil.HeatCoilPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Locked) { HotFlowLocked = true; // save locked flow @@ -2407,7 +2361,7 @@ namespace FanCoilUnits { // set water side mass flow rate if (QCoilCoolSP < 0) { state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).MassFlowRate = fanCoil.MaxCoolCoilFluidFlow; - } else if (QCoilHeatSP > 0 && fanCoil.HCoilType_Num != HCoil::Electric) { + } else if (QCoilHeatSP > 0 && fanCoil.heatCoilType != HVAC::CoilType::HeatingElectric) { state.dataLoopNodes->Node(fanCoil.HeatCoilFluidInletNode).MassFlowRate = fanCoil.MaxHeatCoilFluidFlow; } @@ -2436,7 +2390,7 @@ namespace FanCoilUnits { // cooling coil action, maximum cold water flow mdot = fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToCoolSP; ControlOffset = fanCoil.ColdControlOffset; @@ -2514,12 +2468,12 @@ namespace FanCoilUnits { } mdot = PLR * fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); } else { PLR = 1.0; mdot = PLR * fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); } // at the end calculate output @@ -2529,10 +2483,10 @@ namespace FanCoilUnits { state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling) { // heating coil action, maximun hot water flow - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = fanCoil.MaxHeatCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToHeatSP; @@ -2543,7 +2497,7 @@ namespace FanCoilUnits { // calculate the PLR, if load greater than output, PLR = 1 (output = max) if (QUnitOutMax > QZnReq) { // more heating than required, find reduced water flow rate to meet the load - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { // solve for the hot water flow rate with no limit set by flow rate lockdown auto f = [&state, FanCoilNum, FirstHVACIteration, ControlledZoneNum, QZnReq](Real64 const PLR) { return CalcFanCoilPLRResidual(state, @@ -2616,7 +2570,7 @@ namespace FanCoilUnits { } HWFlow = PLR * fanCoil.MaxHeatCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, HWFlow, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, HWFlow, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } else { auto f = [&state, FirstHVACIteration, FanCoilNum, ControlledZoneNum, QZnReq](Real64 const PartLoadRatio) { @@ -2626,10 +2580,10 @@ namespace FanCoilUnits { } } else { PLR = 1.0; - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = PLR * fanCoil.MaxHeatCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } } @@ -2669,12 +2623,12 @@ namespace FanCoilUnits { // zero the hot & cold water flows mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } OAMassFlow = 0.0; @@ -2736,16 +2690,16 @@ namespace FanCoilUnits { mdot = fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); } else if (state.dataFanCoilUnits->HeatingLoad) { state.dataLoopNodes->Node(InletNode).MassFlowRate = MaxSAMassFlowRate; - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = fanCoil.MaxHeatCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } } @@ -2760,12 +2714,12 @@ namespace FanCoilUnits { MinSAMassFlowRate; // = min air flow rate + ((max-min) air flow rate * FanPartLoadRatio) mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } } else { Real64 OnOffAirFlowRatio = 1.0; @@ -2814,12 +2768,12 @@ namespace FanCoilUnits { // Node(fanCoil%HeatCoilFluidInletNode)%MassFlowRate = 0.0 mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } Calc4PipeFanCoil(state, FanCoilNum, @@ -2834,7 +2788,7 @@ namespace FanCoilUnits { // cooling coil action, maximum cold water flow mdot = fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToCoolSP; ControlOffset = fanCoil.ColdControlOffset; @@ -2878,10 +2832,10 @@ namespace FanCoilUnits { } else if (UnitOn && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToHeatSP > HVAC::SmallLoad && state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling) { // heating coil action, maximun hot water flow - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = fanCoil.MaxHeatCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToHeatSP; ControlOffset = fanCoil.HotControlOffset; @@ -3090,7 +3044,7 @@ namespace FanCoilUnits { Real64 PLR = 1.0; // operating part-load ratio if (WaterControlNode == fanCoil.CoolCoilFluidInletNode) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxCoolCoilFluidFlow; - } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.HCoilType_Num != HCoil::Electric) { + } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.heatCoilType != HVAC::CoilType::HeatingElectric) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxHeatCoilFluidFlow; } Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, PLR); @@ -3100,7 +3054,7 @@ namespace FanCoilUnits { // RegulaFalsi can reach max iteration when low water flow rate is required to meet load. Test at 10% of flow before iterating if (WaterControlNode == fanCoil.CoolCoilFluidInletNode) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxCoolCoilFluidFlow; - } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.HCoilType_Num != HCoil::Electric) { + } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.heatCoilType != HVAC::CoilType::HeatingElectric) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxHeatCoilFluidFlow; } Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, PLR); @@ -3110,7 +3064,7 @@ namespace FanCoilUnits { // RegulaFalsi can reach max iteration when low water flow rate is required to meet load. Test at 1% of flow before iterating if (WaterControlNode == fanCoil.CoolCoilFluidInletNode) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxCoolCoilFluidFlow; - } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.HCoilType_Num != HCoil::Electric) { + } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.heatCoilType != HVAC::CoilType::HeatingElectric) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxHeatCoilFluidFlow; } Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, PLR); @@ -3120,7 +3074,7 @@ namespace FanCoilUnits { // RegulaFalsi can reach max iteration when low water flow rate is required to meet load. Test at 0.1% of flow before iterating if (WaterControlNode == fanCoil.CoolCoilFluidInletNode) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxCoolCoilFluidFlow; - } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.HCoilType_Num != HCoil::Electric) { + } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.heatCoilType != HVAC::CoilType::HeatingElectric) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxHeatCoilFluidFlow; } Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, PLR); @@ -3131,7 +3085,7 @@ namespace FanCoilUnits { // iterating if (WaterControlNode == fanCoil.CoolCoilFluidInletNode) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxCoolCoilFluidFlow; - } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.HCoilType_Num != HCoil::Electric) { + } else if (WaterControlNode == fanCoil.HeatCoilFluidInletNode && fanCoil.heatCoilType != HVAC::CoilType::HeatingElectric) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * fanCoil.MaxHeatCoilFluidFlow; } Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, PLR); @@ -3265,23 +3219,23 @@ namespace FanCoilUnits { } else { // using 1.0 here for fan speed ratio seems wrong if FCU max flow rate is different than the fan maximum flow rate state.dataFans->fans(fanCoil.FanIndex)->simulate(state, FirstHVACIteration, 0.0, _, 0.0); } - if (fanCoil.CCoilType_Num == CCoil::HXAssist) { + if (fanCoil.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( - state, fanCoil.CCoilName, FirstHVACIteration, HVAC::CompressorOp::On, 0.0, fanCoil.CCoilName_Index, HVAC::FanOp::Continuous); + state, fanCoil.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::On, 0.0, fanCoil.hxCoolCoilNum, HVAC::FanOp::Continuous); } else { WaterCoils::SimulateWaterCoilComponents( - state, fanCoil.CCoilName, FirstHVACIteration, fanCoil.CCoilName_Index, _, HVAC::FanOp::Cycling, PLR); + state, fanCoil.CoolCoilName, FirstHVACIteration, fanCoil.CoolCoilNum, _, HVAC::FanOp::Cycling, PLR); } - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { WaterCoils::SimulateWaterCoilComponents( - state, fanCoil.HCoilName, FirstHVACIteration, fanCoil.HCoilName_Index, _, HVAC::FanOp::Cycling, PLR); + state, fanCoil.HeatCoilName, FirstHVACIteration, fanCoil.HeatCoilNum, _, HVAC::FanOp::Cycling, PLR); } else { if (state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).MassFlowRate > 0.0) ElecHeaterControl = 0.0; HeatingCoils::SimulateHeatingCoilComponents(state, - fanCoil.HCoilName, + fanCoil.HeatCoilName, FirstHVACIteration, fanCoil.DesignHeatingCapacity * PartLoad * ElecHeaterControl, - fanCoil.HCoilName_Index, + fanCoil.HeatCoilNum, _, false, HVAC::FanOp::Continuous, @@ -3296,16 +3250,16 @@ namespace FanCoilUnits { Real64 ActFanFlowRatio = state.dataFanCoilUnits->FanFlowRatio * PartLoad; state.dataFans->fans(fanCoil.FanIndex)->simulate(state, FirstHVACIteration, _, _, ActFanFlowRatio); } - if (fanCoil.CCoilType_Num == CCoil::HXAssist) { + if (fanCoil.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( - state, fanCoil.CCoilName, FirstHVACIteration, HVAC::CompressorOp::On, 0.0, fanCoil.CCoilName_Index, HVAC::FanOp::Continuous); + state, fanCoil.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::On, 0.0, fanCoil.hxCoolCoilNum, HVAC::FanOp::Continuous); } else { WaterCoils::SimulateWaterCoilComponents( - state, fanCoil.CCoilName, FirstHVACIteration, fanCoil.CCoilName_Index, _, HVAC::FanOp::Cycling, PLR); + state, fanCoil.CoolCoilName, FirstHVACIteration, fanCoil.CoolCoilNum, _, HVAC::FanOp::Cycling, PLR); } - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { WaterCoils::SimulateWaterCoilComponents( - state, fanCoil.HCoilName, FirstHVACIteration, fanCoil.HCoilName_Index, _, HVAC::FanOp::Cycling, PLR); + state, fanCoil.HeatCoilName, FirstHVACIteration, fanCoil.HeatCoilNum, _, HVAC::FanOp::Cycling, PLR); } else { if (state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).MassFlowRate > 0.0) ElecHeaterControl = 0.0; Real64 QZnReq = 0.0; @@ -3316,10 +3270,10 @@ namespace FanCoilUnits { QZnReq = fanCoil.DesignHeatingCapacity * state.dataFanCoilUnits->FanFlowRatio * PartLoad * eHeatCoilCyclingR * ElecHeaterControl; } HeatingCoils::SimulateHeatingCoilComponents(state, - fanCoil.HCoilName, + fanCoil.HeatCoilName, FirstHVACIteration, QZnReq, - fanCoil.HCoilName_Index, + fanCoil.HeatCoilNum, _, false, fanCoil.fanOp, // fanCoil.FanOpMode, // FanOp::Continuous, FanOp::Cycling @@ -3335,21 +3289,21 @@ namespace FanCoilUnits { state.dataFans->fans(fanCoil.FanIndex)->simulate(state, FirstHVACIteration, FanSpeedRatio, _, FanSpeedRatio); - if (fanCoil.CCoilType_Num == CCoil::HXAssist) { + if (fanCoil.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( - state, fanCoil.CCoilName, FirstHVACIteration, HVAC::CompressorOp::On, 0.0, fanCoil.CCoilName_Index, HVAC::FanOp::Continuous); + state, fanCoil.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::On, 0.0, fanCoil.hxCoolCoilNum, HVAC::FanOp::Continuous); } else { - WaterCoils::SimulateWaterCoilComponents(state, fanCoil.CCoilName, FirstHVACIteration, fanCoil.CCoilName_Index); + WaterCoils::SimulateWaterCoilComponents(state, fanCoil.CoolCoilName, FirstHVACIteration, fanCoil.CoolCoilNum); } - if (fanCoil.HCoilType_Num == HCoil::Water) { - WaterCoils::SimulateWaterCoilComponents(state, fanCoil.HCoilName, FirstHVACIteration, fanCoil.HCoilName_Index); + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SimulateWaterCoilComponents(state, fanCoil.HeatCoilName, FirstHVACIteration, fanCoil.HeatCoilNum); } else { if (state.dataLoopNodes->Node(fanCoil.CoolCoilFluidInletNode).MassFlowRate > 0.0) ElecHeaterControl = 0.0; HeatingCoils::SimulateHeatingCoilComponents(state, - fanCoil.HCoilName, + fanCoil.HeatCoilName, FirstHVACIteration, fanCoil.DesignHeatingCapacity * PartLoad * ElecHeaterControl, - fanCoil.HCoilName_Index, + fanCoil.HeatCoilNum, _, false, HVAC::FanOp::Continuous, @@ -3431,14 +3385,14 @@ namespace FanCoilUnits { state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AirMassFlow; state.dataLoopNodes->Node(InletNode).MassFlowRateMinAvail = AirMassFlow; - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); // no load output, requires setting eHeatCoilCyclingR = 0.0, for electric heating coils Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutNoHC, _, 0.0); @@ -3560,14 +3514,14 @@ namespace FanCoilUnits { } if (UnitOn && QZnReq < (-1.0 * FanCoilUnits::Small5WLoad) && CoolingLoad) { - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } mdot = fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); // select fan speed fanCoil.SpeedFanSel = 1; fanCoil.SpeedFanRatSel = fanCoil.LowSpeedRatio; @@ -3605,12 +3559,12 @@ namespace FanCoilUnits { mdot = 0.0; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = fanCoil.MaxHeatCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } // select fan speed fanCoil.SpeedFanSel = 1; @@ -3672,12 +3626,12 @@ namespace FanCoilUnits { } mdot = 0.0; - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); } PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); // No load output, eHeatCoilCyclingR = 0.0 for electric heating coil Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, PartLoadRatio, 0.0); } @@ -3756,7 +3710,7 @@ namespace FanCoilUnits { inletNode.MassFlowRateMinAvail = inletNode.MassFlowRate; mdot = PLR * fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNodeNum, fanCoil.CoolCoilPlantLoc); + state, mdot, fanCoil.CoolCoilFluidInletNode, fanCoil.CoolCoilFluidOutletNode, fanCoil.CoolCoilPlantLoc); if (fanCoil.fanOp == HVAC::FanOp::Continuous) { Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut); } else { @@ -3869,13 +3823,13 @@ namespace FanCoilUnits { Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutMax); PLR = std::abs(QZnReq / QUnitOutMax); if (PLR > 1.0) PLR = 1.0; - if (fanCoil.HCoilType_Num == HCoil::Water) { + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { // adjust the PLR to meet the heating load by calling Calc4PipeFanCoil repeatedly while (std::abs(Error) > ControlOffset && std::abs(AbsError) > FanCoilUnits::Small5WLoad && Iter < MaxIterCycl && PLR != 1.0) { inletNode.MassFlowRateMinAvail = inletNode.MassFlowRate; mdot = PLR * fanCoil.MaxHeatCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNodeNum, fanCoil.HeatCoilPlantLoc); + state, mdot, fanCoil.HeatCoilFluidInletNode, fanCoil.HeatCoilFluidOutletNode, fanCoil.HeatCoilPlantLoc); if (fanCoil.fanOp == HVAC::FanOp::Continuous) { Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut); } else { @@ -4220,7 +4174,7 @@ namespace FanCoilUnits { QUnitOut, PLR); // needs PLR=0 for electric heating coil, otherwise will run a full capacity } else if (WaterControlNode == state.dataFanCoilUnits->FanCoil(FanCoilNum).HeatCoilFluidInletNode && - state.dataFanCoilUnits->FanCoil(FanCoilNum).HCoilType_Num != HCoil::Electric) { + state.dataFanCoilUnits->FanCoil(FanCoilNum).heatCoilType != HVAC::CoilType::HeatingElectric) { state.dataLoopNodes->Node(WaterControlNode).MassFlowRate = PLR * state.dataFanCoilUnits->FanCoil(FanCoilNum).MaxHeatCoilFluidFlow; Calc4PipeFanCoil(state, FanCoilNum, @@ -4320,7 +4274,7 @@ namespace FanCoilUnits { Real64 QUnitOut; if (WaterControlNode == state.dataFanCoilUnits->FanCoil(FanCoilNum).CoolCoilFluidInletNode || (WaterControlNode == state.dataFanCoilUnits->FanCoil(FanCoilNum).HeatCoilFluidInletNode && - state.dataFanCoilUnits->FanCoil(FanCoilNum).HCoilType_Num != HCoil::Electric)) { + state.dataFanCoilUnits->FanCoil(FanCoilNum).heatCoilType != HVAC::CoilType::HeatingElectric)) { Calc4PipeFanCoil(state, FanCoilNum, diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index bc99f60b602..ba745440d07 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -140,26 +140,34 @@ namespace FanCoilUnits { int OAMixIndex = 0; std::string FanName; // name of fan int FanIndex = 0; // index for fan - std::string CCoilName; // name of cooling coil - int CCoilName_Index = 0; // Index for this Cooling Coil in SimWaterComp + + // If the cooling coil is HX assisted, then this is the HX coil + // object and CoolCoilName/Index/Type becomes the embedded coil + std::string hxCoolCoilName; + int hxCoolCoilNum = 0; + HVAC::CoilType hxCoolCoilType = HVAC::CoilType::Invalid; + + std::string CoolCoilName; // name of cooling coil + int CoolCoilNum = 0; // Index for this Cooling Coil in SimWaterComp HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; // type of cooling coil: // 'Coil:Cooling:Water' or // 'Coil:Cooling:Water:DetailedGeometry' or // 'CoilSystem:Cooling:Water:HeatExchangerAssisted' - std::string CCoilPlantName; // name of cooling coil (child<=CoilSystem:Cooling:Water:HeatExchangerAssisted) - DataPlant::PlantEquipmentType CCoilPlantType = DataPlant::PlantEquipmentType::Invalid; + DataPlant::PlantEquipmentType CoolCoilPlantType = DataPlant::PlantEquipmentType::Invalid; + int ControlCompTypeNum = 0; int CompErrIndex = 0; Real64 MaxColdWaterVolFlow = 0.0; // m3/s Real64 MinColdWaterVolFlow = 0.0; // m3/s Real64 MinColdWaterFlow = 0.0; // kg/s Real64 ColdControlOffset = 0.0; // control tolerance - std::string HCoilName; // name of heating coil - int HCoilName_Index = 0; + + std::string HeatCoilName; // name of heating coil + int HeatCoilNum = 0; // 'Coil:Heating:Water' or HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; // Numeric equivalent for type of cooling coil - DataPlant::PlantEquipmentType HCoilPlantTypeOf = DataPlant::PlantEquipmentType::Invalid; + DataPlant::PlantEquipmentType HeatCoilPlantType = DataPlant::PlantEquipmentType::Invalid; Real64 MaxHotWaterVolFlow = 0.0; // m3/s Real64 MinHotWaterVolFlow = 0.0; // m3/s Real64 MinHotWaterFlow = 0.0; // kg/s @@ -215,15 +223,15 @@ namespace FanCoilUnits { Real64 LowSpeedCoolFanRatio = 0.0; // ratio of min air flow to max air flow Real64 LowSpeedHeatFanRatio = 0.0; // ratio of min air flow to max air flow int CoolCoilFluidInletNode = 0; // chilled water control node - int CoolCoilFluidOutletNodeNum = 0; // chilled water coil outlet plant node + int CoolCoilFluidOutletNode = 0; // chilled water coil outlet plant node int HeatCoilFluidInletNode = 0; // hot water control node - int HeatCoilFluidOutletNodeNum = 0; // hot water coil outlet plant node + int HeatCoilFluidOutletNode = 0; // hot water coil outlet plant node PlantLocation CoolCoilPlantLoc{}; // index for plant location for chilled water coil PlantLocation HeatCoilPlantLoc{}; // index for plant location for hot water coil - int CoolCoilInletNodeNum = 0; // index of cooling coil inlet node number - int CoolCoilOutletNodeNum = 0; // index of cooling coil outlet node number - int HeatCoilInletNodeNum = 0; // index of heating coil inlet node number - int HeatCoilOutletNodeNum = 0; // index of heating coil outlet node number + int CoolCoilAirInletNode = 0; // index of cooling coil inlet node number + int CoolCoilAirOutletNode = 0; // index of cooling coil outlet node number + int HeatCoilAirInletNode = 0; // index of heating coil inlet node number + int HeatCoilAirOutletNode = 0; // index of heating coil outlet node number int ControlZoneNum = 0; // pointer to a zone served by a fancoil unit int NodeNumOfControlledZone = 0; // node number of controlled zone bool ATMixerExists = false; // True if there is an ATMixer @@ -413,8 +421,6 @@ struct FanCoilUnitsData : BaseGlobalStruct Array1D_bool MyEnvrnFlag; Array1D_bool MyPlantScanFlag; Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers - int CoilWaterInletNode = 0; - int CoilWaterOutletNode = 0; int ATMixOutNode = 0; // outlet node of ATM Mixer int ZoneNode = 0; // zone node diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index 88a39db4ca3..fb473100383 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -804,7 +804,7 @@ namespace Fluid { } if (refrig->satTempArrayName != "" && refrig->satTempArrayName != Alphas(4)) { - ShowSevereCustomMessage(state, eoh, "Saturated temperature arrays are not the same for different properties"); + ShowSevereCustom(state, eoh, "Saturated temperature arrays are not the same for different properties"); ErrorsFound = true; continue; } @@ -902,7 +902,7 @@ namespace Fluid { ErrorObjectHeader eoh{routineName, CurrentModuleObject, refrig->Name}; if (refrig->PsValues.size() == 0) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format(R"(No Gas/Fluid Saturation Pressure found. Need properties with {}="Pressure" and {}="FluidGas".)", cAlphaFields(2), @@ -911,7 +911,7 @@ namespace Fluid { } if (refrig->HfValues.size() == 0) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format(R"(No Saturated Fluid Enthalpy found. Need properties with {}="Enthalpy" and {}="Fluid".)", cAlphaFields(2), @@ -920,7 +920,7 @@ namespace Fluid { } if (refrig->HfgValues.size() == 0) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format(R"(No Saturated Gas/Fluid Enthalpy found. Need properties with {}="Enthalpy" and {}="FluidGas".)", cAlphaFields(2), @@ -929,7 +929,7 @@ namespace Fluid { } if (refrig->CpfValues.size() == 0) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format(R"(No Saturated Fluid Specific Heat found. Need properties with {}="SpecificHeat" and {}="Fluid".)", cAlphaFields(2), @@ -938,7 +938,7 @@ namespace Fluid { } if (refrig->CpfgValues.size() == 0) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format(R"(No Saturated Gas/Fluid Specific Heat found. Need properties with {}="SpecificHeat" and {}="FluidGas".)", @@ -948,7 +948,7 @@ namespace Fluid { } if (refrig->RhofValues.size() == 0) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format(R"(No Saturated Fluid Density found. Need properties with {}="Density" and {}="Fluid".)", cAlphaFields(2), @@ -957,7 +957,7 @@ namespace Fluid { } if (refrig->RhofgValues.size() == 0) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format(R"(No Saturated Gas/Fluid Density found. Need properties with {}="Density" and {}="FluidGas".)", cAlphaFields(2), @@ -1020,7 +1020,7 @@ namespace Fluid { } if (refrig->supTempArrayName != "" && refrig->supTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, eoh, "Saturated temperature arrays are not the same for different properties"); + ShowSevereCustom(state, eoh, "Saturated temperature arrays are not the same for different properties"); ErrorsFound = true; continue; } @@ -1090,7 +1090,7 @@ namespace Fluid { } if ((NumNumbers - 1) != refrig->NumSupTempPoints) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Number of superheated {} points ({}) not equal to number of temperature points ({})", Alphas(2), @@ -1348,7 +1348,7 @@ namespace Fluid { } if (Numbers(1) < 0.0) { - ShowSevereCustomMessage(state, eoh, "Negative concentrations not allowed in fluid property input data"); + ShowSevereCustom(state, eoh, "Negative concentrations not allowed in fluid property input data"); ErrorsFound = true; continue; } @@ -1356,7 +1356,7 @@ namespace Fluid { // Can temperatue and pressure points be different for different properties? Why is this allowed? if (Alphas(2) == "SPECIFICHEAT") { if (glycolRaw->CpTempArrayName != "" && glycolRaw->CpTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("All specific heat data for the same glycol must use the same temperature list" "Expected name={}, Entered name={}", @@ -1375,7 +1375,7 @@ namespace Fluid { } else if (Alphas(2) == "DENSITY") { if (glycolRaw->RhoTempArrayName != "" && glycolRaw->RhoTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("All density data for the same glycol must use the same temperature list" "Expected name={}, Entered name={}", @@ -1394,7 +1394,7 @@ namespace Fluid { } else if (Alphas(2) == "CONDUCTIVITY") { if (glycolRaw->CondTempArrayName != "" && glycolRaw->CondTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("All conductivity data for the same glycol must use the same temperature list" "Expected name={}, Entered name={}", @@ -1413,7 +1413,7 @@ namespace Fluid { } else if (Alphas(2) == "VISCOSITY") { if (glycolRaw->ViscTempArrayName != "" && glycolRaw->ViscTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("All conductivity data for the same glycol must use the same temperature list" "Expected name={}, Entered name={}", @@ -1509,7 +1509,7 @@ namespace Fluid { if (Alphas(2) == "SPECIFICHEAT") { if ((NumNumbers - 1) != glycolRaw->NumCpTempPoints) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Number of specific heat points ({}) not equal to number of temperature points ({})", NumNumbers - 1, @@ -1524,7 +1524,7 @@ namespace Fluid { } else if (Alphas(2) == "DENSITY") { if ((NumNumbers - 1) != glycolRaw->NumRhoTempPoints) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Number of density points ({}) not equal to number of temperature points ({})", NumNumbers - 1, @@ -1539,7 +1539,7 @@ namespace Fluid { } else if (Alphas(2) == "CONDUCTIVITY") { if ((NumNumbers - 1) != glycolRaw->NumCondTempPoints) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Number of conductivity points ({}) not equal to number of temperature points ({})", NumNumbers - 1, @@ -1554,7 +1554,7 @@ namespace Fluid { } else if (Alphas(2) == "VISCOSITY") { if ((NumNumbers - 1) != glycolRaw->NumViscTempPoints) { - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Number of viscosity points ({}) not equal to number of temperature points ({})", NumNumbers - 1, diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index b901a205b13..5b7cb294534 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -212,7 +212,7 @@ namespace Furnaces { // Find the correct Furnace if (CompIndex == 0) { - FurnaceNum = Util::FindItemInList(FurnaceName, state.dataFurnaces->Furnace); + FurnaceNum = Util::FindItemInList(FurnaceName, state.dataFurnaces->Furnaces); if (FurnaceNum == 0) { ShowFatalError(state, format("SimFurnace: Unit not found={}", FurnaceName)); } @@ -227,12 +227,12 @@ namespace Furnaces { FurnaceName)); } if (state.dataFurnaces->CheckEquipName(FurnaceNum)) { - if (FurnaceName != state.dataFurnaces->Furnace(FurnaceNum).Name) { + if (FurnaceName != state.dataFurnaces->Furnaces(FurnaceNum).Name) { ShowFatalError(state, format("SimFurnace: Invalid CompIndex passed={}, Unit name={}, stored Unit Name for that index={}", FurnaceNum, FurnaceName, - state.dataFurnaces->Furnace(FurnaceNum).Name)); + state.dataFurnaces->Furnaces(FurnaceNum).Name)); } state.dataFurnaces->CheckEquipName(FurnaceNum) = false; } @@ -243,12 +243,12 @@ namespace Furnaces { // here we need to deal with sequenced zone equip sensible load in control zone Real64 ZoneLoad = 0.0; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - auto &zoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum); - if (thisFurnace.ZoneSequenceCoolingNum > 0 && thisFurnace.ZoneSequenceHeatingNum > 0) { - Real64 ZoneLoadToCoolSPSequenced = zoneSysEnergyDemand.SequencedOutputRequiredToCoolingSP(thisFurnace.ZoneSequenceCoolingNum); - Real64 ZoneLoadToHeatSPSequenced = zoneSysEnergyDemand.SequencedOutputRequiredToHeatingSP(thisFurnace.ZoneSequenceHeatingNum); - auto const &tempControlType = state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + auto &zoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum); + if (furnace.ZoneSequenceCoolingNum > 0 && furnace.ZoneSequenceHeatingNum > 0) { + Real64 ZoneLoadToCoolSPSequenced = zoneSysEnergyDemand.SequencedOutputRequiredToCoolingSP(furnace.ZoneSequenceCoolingNum); + Real64 ZoneLoadToHeatSPSequenced = zoneSysEnergyDemand.SequencedOutputRequiredToHeatingSP(furnace.ZoneSequenceHeatingNum); + auto const &tempControlType = state.dataHeatBalFanSys->TempControlType(furnace.ControlZoneNum); if (ZoneLoadToHeatSPSequenced > 0.0 && ZoneLoadToCoolSPSequenced > 0.0 && tempControlType != HVAC::ThermostatType::SingleCooling) { ZoneLoad = ZoneLoadToHeatSPSequenced; } else if (ZoneLoadToHeatSPSequenced > 0.0 && ZoneLoadToCoolSPSequenced > 0.0 && tempControlType == HVAC::ThermostatType::SingleCooling) { @@ -260,66 +260,66 @@ namespace Furnaces { } else if (ZoneLoadToHeatSPSequenced <= 0.0 && ZoneLoadToCoolSPSequenced >= 0.0) { ZoneLoad = 0.0; } - MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(thisFurnace.ControlZoneNum) - .SequencedOutputRequiredToDehumidSP(thisFurnace.ZoneSequenceCoolingNum); + MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(furnace.ControlZoneNum) + .SequencedOutputRequiredToDehumidSP(furnace.ZoneSequenceCoolingNum); } else { ZoneLoad = zoneSysEnergyDemand.RemainingOutputRequired; - MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(thisFurnace.ControlZoneNum).OutputRequiredToDehumidifyingSP; + MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(furnace.ControlZoneNum).OutputRequiredToDehumidifyingSP; } // H2OHtOfVap - MoistureLoad *= Psychrometrics::PsyHfgAirFnWTdb(state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).HumRat, - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).Temp); + MoistureLoad *= Psychrometrics::PsyHfgAirFnWTdb(state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).HumRat, + state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).Temp); // Initialize Furnace Flows InitFurnace(state, FurnaceNum, AirLoopNum, OnOffAirFlowRatio, fanOp, ZoneLoad, MoistureLoad, FirstHVACIteration); - int FurnaceInletNode = thisFurnace.FurnaceInletNodeNum; + int FurnaceInletNode = furnace.FurnaceInletNode; // MassFlowRateMaxAvail issues are impeding non-VAV air loop equipment by limiting air flow // temporarily open up flow limits while simulating, and then set this same value at the INLET after this parent has simulated Real64 TempMassFlowRateMaxAvail = state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRateMaxAvail; - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRateMaxAvail = thisFurnace.DesignMassFlowRate; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRateMaxAvail = furnace.DesignMassFlowRate; Real64 FurnaceSavMdot = state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate; HVAC::CompressorOp compressorOp = HVAC::CompressorOp::On; state.dataFurnaces->CoolHeatPLRRat = 1.0; // Simulate correct system type (1 of 4 choices) - switch (thisFurnace.type) { + switch (furnace.type) { // Simulate HeatOnly systems: case HVAC::UnitarySysType::Furnace_HeatOnly: case HVAC::UnitarySysType::Unitary_HeatOnly: { // Update the furnace flow rates CalcNewZoneHeatOnlyFlowRates(state, FurnaceNum, FirstHVACIteration, ZoneLoad, HeatCoilLoad, OnOffAirFlowRatio); - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { // simulate fan - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // simulate furnace heating coil SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); - if (thisFurnace.fanPlace == HVAC::FanPlace::DrawThru) { + if (furnace.fanPlace == HVAC::FanPlace::DrawThru) { // simulate fan - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } } break; // Simulate HeatCool systems: case HVAC::UnitarySysType::Furnace_HeatCool: case HVAC::UnitarySysType::Unitary_HeatCool: { - if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // variable speed cooling coil HeatCoilLoad = 0.0; - if (thisFurnace.bIsIHP) - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).ControlledZoneTemp = - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).Temp; + if (furnace.isIHP) + state.dataIntegratedHP->IntegratedHeatPumps(furnace.CoolCoilNum).ControlledZoneTemp = + state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).Temp; SimVariableSpeedHP(state, FurnaceNum, FirstHVACIteration, AirLoopNum, ZoneLoad, MoistureLoad, OnOffAirFlowRatio); } else { // calculate the system flow rate - if (!FirstHVACIteration && thisFurnace.fanOp == HVAC::FanOp::Cycling && state.dataFurnaces->CoolingLoad && + if (!FirstHVACIteration && furnace.fanOp == HVAC::FanOp::Cycling && state.dataFurnaces->CoolingLoad && state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive) { // for cycling fan, cooling load, check whether furnace can meet load with compressor off compressorOp = HVAC::CompressorOp::Off; @@ -333,8 +333,8 @@ namespace Furnaces { ReheatCoilLoad, OnOffAirFlowRatio, HXUnitOn); - if (thisFurnace.CoolPartLoadRatio >= 1.0 || thisFurnace.HeatPartLoadRatio >= 1.0 || - (thisFurnace.CoolPartLoadRatio <= 0.0 && thisFurnace.HeatPartLoadRatio <= 0.0)) { + if (furnace.CoolPartLoadRatio >= 1.0 || furnace.HeatPartLoadRatio >= 1.0 || + (furnace.CoolPartLoadRatio <= 0.0 && furnace.HeatPartLoadRatio <= 0.0)) { // compressor on (reset inlet air mass flow rate to starting value) state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = FurnaceSavMdot; compressorOp = HVAC::CompressorOp::On; @@ -363,54 +363,54 @@ namespace Furnaces { HXUnitOn); } - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { // simulate fan - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } - if (!thisFurnace.CoolingCoilUpstream) { + if (!furnace.CoolCoilUpstream) { // simulate furnace heating coil SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } // simulate furnace DX cooling coil - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, - BlankString, + furnace.hxCoolCoilName, FirstHVACIteration, compressorOp, - thisFurnace.CoolPartLoadRatio, - thisFurnace.CoolingCoilIndex, + furnace.CoolPartLoadRatio, + furnace.hxCoolCoilNum, fanOp, HXUnitOn, OnOffAirFlowRatio, state.dataFurnaces->EconomizerFlag); } else { DXCoils::SimDXCoil(state, - BlankString, + furnace.CoolCoilName, compressorOp, FirstHVACIteration, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, - thisFurnace.CoolPartLoadRatio, + furnace.CoolPartLoadRatio, OnOffAirFlowRatio, state.dataFurnaces->CoolHeatPLRRat); } - if (thisFurnace.CoolingCoilUpstream) { + if (furnace.CoolCoilUpstream) { // simulate furnace heating coil SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } - if (thisFurnace.fanPlace == HVAC::FanPlace::DrawThru) { + if (furnace.fanPlace == HVAC::FanPlace::DrawThru) { // simulate fan - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate furnace reheat coil if a humidistat is used or if the reheat coil is present - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || thisFurnace.SuppHeatCoilIndex > 0) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || furnace.SuppCoilNum > 0) { SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } @@ -418,21 +418,21 @@ namespace Furnaces { } break; // Simulate air-to-air heat pumps: case HVAC::UnitarySysType::Unitary_HeatPump_AirToAir: { - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (furnace.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { // variable speed heat pump HeatCoilLoad = 0.0; - if (thisFurnace.bIsIHP) { - auto &integratedHP = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex); - integratedHP.ControlledZoneTemp = state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).Temp; - integratedHP.IDFanID = thisFurnace.FanIndex; // why do this every time? + if (furnace.isIHP) { + auto &integratedHP = state.dataIntegratedHP->IntegratedHeatPumps(furnace.CoolCoilNum); + integratedHP.ControlledZoneTemp = state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).Temp; + integratedHP.IDFanID = furnace.FanIndex; // why do this every time? integratedHP.IDFanName = BlankString; - integratedHP.fanPlace = thisFurnace.fanPlace; + integratedHP.fanPlace = furnace.fanPlace; } SimVariableSpeedHP(state, FurnaceNum, FirstHVACIteration, AirLoopNum, ZoneLoad, MoistureLoad, OnOffAirFlowRatio); } else { // Update the furnace flow rates - if (!FirstHVACIteration && thisFurnace.fanOp == HVAC::FanOp::Cycling && state.dataFurnaces->CoolingLoad && + if (!FirstHVACIteration && furnace.fanOp == HVAC::FanOp::Cycling && state.dataFurnaces->CoolingLoad && state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive) { // for cycling fan, cooling load, check whether furnace can meet load with compressor off compressorOp = HVAC::CompressorOp::Off; @@ -446,8 +446,8 @@ namespace Furnaces { ReheatCoilLoad, OnOffAirFlowRatio, HXUnitOn); - if (thisFurnace.CoolPartLoadRatio >= 1.0 || thisFurnace.HeatPartLoadRatio >= 1.0 || - (thisFurnace.CoolPartLoadRatio <= 0.0 && thisFurnace.HeatPartLoadRatio <= 0.0)) { + if (furnace.CoolPartLoadRatio >= 1.0 || furnace.HeatPartLoadRatio >= 1.0 || + (furnace.CoolPartLoadRatio <= 0.0 && furnace.HeatPartLoadRatio <= 0.0)) { // compressor on (reset inlet air mass flow rate to starting value) compressorOp = HVAC::CompressorOp::On; state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = FurnaceSavMdot; @@ -476,17 +476,17 @@ namespace Furnaces { HXUnitOn); } - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, BlankString, FirstHVACIteration, compressorOp, - thisFurnace.CoolPartLoadRatio, - thisFurnace.CoolingCoilIndex, + furnace.CoolPartLoadRatio, + furnace.CoolCoilNum, fanOp, HXUnitOn, OnOffAirFlowRatio, @@ -496,26 +496,26 @@ namespace Furnaces { BlankString, compressorOp, FirstHVACIteration, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, - thisFurnace.CoolPartLoadRatio, + furnace.CoolPartLoadRatio, OnOffAirFlowRatio); } DXCoils::SimDXCoil(state, BlankString, compressorOp, FirstHVACIteration, - thisFurnace.HeatingCoilIndex, + furnace.HeatCoilNum, fanOp, - thisFurnace.HeatPartLoadRatio, + furnace.HeatPartLoadRatio, OnOffAirFlowRatio); - if (thisFurnace.fanPlace == HVAC::FanPlace::DrawThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::DrawThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate furnace reheat coil if a humidistat is present, the dehumidification type of coolreheat and // reheat coil load exists - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } else { @@ -526,11 +526,11 @@ namespace Furnaces { } break; // Simulate water-to-air systems: case HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir: { - if (thisFurnace.WatertoAirHPType == WAHPCoilType::Simple) { + if (furnace.WatertoAirHPType == WAHPCoilType::Simple) { // Update the furnace flow rates // When CompressorOp logic is added to the child cooling coil (COIL:WaterToAirHP:EquationFit:Cooling), then this logic // needs to be reinstated... to align with Unitary/Furnace HeatCool and Unitary Air-to-Air Heat Pump (see above). - if (!FirstHVACIteration && thisFurnace.fanOp == HVAC::FanOp::Cycling && state.dataFurnaces->CoolingLoad && + if (!FirstHVACIteration && furnace.fanOp == HVAC::FanOp::Cycling && state.dataFurnaces->CoolingLoad && state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive) { // for cycling fan, cooling load, check whether furnace can meet load with compressor off compressorOp = HVAC::CompressorOp::Off; @@ -544,8 +544,8 @@ namespace Furnaces { ReheatCoilLoad, OnOffAirFlowRatio, HXUnitOn); - if (thisFurnace.CoolPartLoadRatio >= 1.0 || thisFurnace.HeatPartLoadRatio >= 1.0 || - (thisFurnace.CoolPartLoadRatio <= 0.0 && thisFurnace.HeatPartLoadRatio <= 0.0)) { + if (furnace.CoolPartLoadRatio >= 1.0 || furnace.HeatPartLoadRatio >= 1.0 || + (furnace.CoolPartLoadRatio <= 0.0 && furnace.HeatPartLoadRatio <= 0.0)) { // compressor on (reset inlet air mass flow rate to starting value) compressorOp = HVAC::CompressorOp::On; state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = FurnaceSavMdot; @@ -573,53 +573,53 @@ namespace Furnaces { OnOffAirFlowRatio, HXUnitOn); } - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.CoolingCoilSensDemand, - thisFurnace.CoolingCoilLatentDemand, - thisFurnace.fanOp, + furnace.CoolCoilNum, + furnace.CoolingCoilSensDemand, + furnace.CoolingCoilLatentDemand, + furnace.fanOp, compressorOp, - thisFurnace.CoolPartLoadRatio, + furnace.CoolPartLoadRatio, FirstHVACIteration); WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.HeatingCoilSensDemand, + furnace.HeatCoilNum, + furnace.HeatingCoilSensDemand, Dummy, - thisFurnace.fanOp, + furnace.fanOp, compressorOp, - thisFurnace.HeatPartLoadRatio, + furnace.HeatPartLoadRatio, FirstHVACIteration); - if (thisFurnace.fanPlace == HVAC::FanPlace::DrawThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::DrawThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } else { SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } - } else if (thisFurnace.WatertoAirHPType == WAHPCoilType::ParEst) { + } else if (furnace.WatertoAirHPType == WAHPCoilType::ParEst) { // simulate the heat pump HeatCoilLoad = 0.0; CalcWaterToAirHeatPump(state, FurnaceNum, FirstHVACIteration, compressorOp, ZoneLoad, MoistureLoad); - } else if (thisFurnace.WatertoAirHPType == WAHPCoilType::VarSpeedEquationFit) { + } else if (furnace.WatertoAirHPType == WAHPCoilType::VarSpeedEquationFit) { // simulate the heat pump HeatCoilLoad = 0.0; - if (thisFurnace.bIsIHP) - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).ControlledZoneTemp = - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).Temp; + if (furnace.isIHP) + state.dataIntegratedHP->IntegratedHeatPumps(furnace.CoolCoilNum).ControlledZoneTemp = + state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).Temp; SimVariableSpeedHP(state, FurnaceNum, FirstHVACIteration, AirLoopNum, ZoneLoad, MoistureLoad, OnOffAirFlowRatio); - } else if (thisFurnace.WatertoAirHPType == WAHPCoilType::VarSpeedLookupTable) { + } else if (furnace.WatertoAirHPType == WAHPCoilType::VarSpeedLookupTable) { HeatCoilLoad = 0.0; // Added: Used below } else { assert(false); //? If all possible states covered by if conditions change to HeatCoilLoad = 0.0; @@ -633,21 +633,21 @@ namespace Furnaces { // set the econo lockout flags auto &airLoopControlInfo = state.dataAirLoop->AirLoopControlInfo(AirLoopNum); - if (thisFurnace.CompPartLoadRatio > 0.0 && airLoopControlInfo.CanLockoutEconoWithCompressor) { + if (furnace.CompPartLoadRatio > 0.0 && airLoopControlInfo.CanLockoutEconoWithCompressor) { airLoopControlInfo.ReqstEconoLockoutWithCompressor = true; } else { airLoopControlInfo.ReqstEconoLockoutWithCompressor = false; } - if ((HeatCoilLoad > 0.0 || thisFurnace.HeatPartLoadRatio > 0.0) && + if ((HeatCoilLoad > 0.0 || furnace.HeatPartLoadRatio > 0.0) && (airLoopControlInfo.CanLockoutEconoWithCompressor || airLoopControlInfo.CanLockoutEconoWithHeating)) { airLoopControlInfo.ReqstEconoLockoutWithHeating = true; } else { airLoopControlInfo.ReqstEconoLockoutWithHeating = false; } - if (thisFurnace.fanOp == HVAC::FanOp::Cycling) { - state.dataAirLoop->AirLoopFlow(AirLoopNum).FanPLR = thisFurnace.FanPartLoadRatio; + if (furnace.fanOp == HVAC::FanOp::Cycling) { + state.dataAirLoop->AirLoopFlow(AirLoopNum).FanPLR = furnace.FanPartLoadRatio; } else { state.dataAirLoop->AirLoopFlow(AirLoopNum).FanPLR = 1.0; // 1 means constant fan does not cycle. } @@ -712,31 +712,13 @@ namespace Furnaces { int TstatZoneNum; // Used to determine if control zone has a thermostat object int HStatZoneNum; // Used to determine if control zone has a humidistat object bool errFlag; // Mining function error flag - int FanInletNode; // Used for node checking warning messages - int FanOutletNode; // Used for node checking warning messages - int CoolingCoilInletNode; // Used for node checking warning messages - int CoolingCoilOutletNode; // Used for node checking warning messages - int HeatingCoilInletNode; // Used for node checking warning messages - int HeatingCoilOutletNode; // Used for node checking warning messages - int SupHeatCoilInletNode; // Used for node checking warning messages - int SupHeatCoilOutletNode; // Used for node checking warning messages - std::string CoolingCoilType; // Used in mining function CALLS - std::string CoolingCoilName; // Used in mining function CALLS - std::string HeatingCoilType; // Used in mining function CALLS - std::string HeatingCoilName; // Used in mining function CALLS - std::string ReheatingCoilType; // Used in mining function CALLS - std::string ReheatingCoilName; // Used in mining function CALLS - std::string SuppHeatCoilType; // Used in mining function CALLS - std::string SuppHeatCoilName; // Used in mining function CALLS std::string FanName; // Used in mining function CALLS bool PrintMessage; // Used in mining function CALLS - int HeatingCoilPLFCurveIndex; // index of heating coil PLF curve - Real64 SteamDensity; // density of steam at 100C - int DXCoilIndex; // Index to DX coil in HXAssited object - std::string IHPCoilName; // IHP cooling coil name auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; DataLoopNode::ConnectionObjectType currentModuleObjectType; + auto &s_node = state.dataLoopNodes; + state.dataFurnaces->GetFurnaceInputFlag = false; int MaxNumbers = 0; int MaxAlphas = 0; @@ -787,7 +769,7 @@ namespace Furnaces { state.dataFurnaces->NumFurnaces = NumHeatOnly + NumHeatCool + NumUnitaryHeatOnly + NumUnitaryHeatCool + NumHeatPump + NumWaterToAirHeatPump; if (state.dataFurnaces->NumFurnaces > 0) { - state.dataFurnaces->Furnace.allocate(state.dataFurnaces->NumFurnaces); + state.dataFurnaces->Furnaces.allocate(state.dataFurnaces->NumFurnaces); state.dataFurnaces->UniqueFurnaceNames.reserve(state.dataFurnaces->NumFurnaces); } state.dataFurnaces->CheckEquipName.dimension(state.dataFurnaces->NumFurnaces, true); @@ -797,33 +779,24 @@ namespace Furnaces { // Get the data for the HeatOnly Furnace for (int HeatOnlyNum = 1; HeatOnlyNum <= NumHeatOnly + NumUnitaryHeatOnly; ++HeatOnlyNum) { - FanInletNode = 0; - FanOutletNode = 0; - HeatingCoilInletNode = 0; - HeatingCoilOutletNode = 0; - CoolingCoilType = ' '; - CoolingCoilName = ' '; - HeatingCoilType = ' '; - HeatingCoilName = ' '; - FurnaceNum = HeatOnlyNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Furnace and UnitarySystem objects are both read in here. // Will still have 2 differently named objects for the user, but read in with 1 DO loop. if (HeatOnlyNum <= NumHeatOnly) { CurrentModuleObject = "AirLoopHVAC:Unitary:Furnace:HeatOnly"; currentModuleObjectType = DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryFurnaceHeatOnly; - thisFurnace.type = HVAC::UnitarySysType::Furnace_HeatOnly; + furnace.type = HVAC::UnitarySysType::Furnace_HeatOnly; GetObjectNum = HeatOnlyNum; } else { CurrentModuleObject = "AirLoopHVAC:UnitaryHeatOnly"; currentModuleObjectType = DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryHeatOnly; - thisFurnace.type = HVAC::UnitarySysType::Unitary_HeatOnly; + furnace.type = HVAC::UnitarySysType::Unitary_HeatOnly; GetObjectNum = HeatOnlyNum - NumHeatOnly; } - thisFurnace.iterationMode.allocate(3); + furnace.iterationMode.allocate(3); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -841,21 +814,21 @@ namespace Furnaces { GlobalNames::VerifyUniqueInterObjectName( state, state.dataFurnaces->UniqueFurnaceNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - thisFurnace.Name = Alphas(1); - ErrorObjectHeader eoh{routineName, cAlphaFields(1), thisFurnace.Name}; + furnace.Name = Alphas(1); + ErrorObjectHeader eoh{routineName, cAlphaFields(1), furnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + furnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { + furnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); + if (furnace.SchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); ErrorsFound = true; } } - thisFurnace.FurnaceInletNodeNum = NodeInputManager::GetOnlySingleNode(state, + furnace.FurnaceInletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(3), ErrorsFound, currentModuleObjectType, @@ -864,7 +837,7 @@ namespace Furnaces { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisFurnace.FurnaceOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, + furnace.FurnaceOutletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(4), ErrorsFound, currentModuleObjectType, @@ -876,31 +849,31 @@ namespace Furnaces { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); - if (!lAlphaBlanks(5) && thisFurnace.FanSchedPtr == 0) { + furnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); + if (!lAlphaBlanks(5) && furnace.FanSchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(5), Alphas(5))); ErrorsFound = true; } else if (lAlphaBlanks(5)) { - thisFurnace.fanOp = HVAC::FanOp::Cycling; + furnace.fanOp = HVAC::FanOp::Cycling; } // Get the Controlling Zone or Location of the Furnace Thermostat - thisFurnace.ControlZoneNum = Util::FindItemInList(Alphas(6), state.dataHeatBal->Zone); - if (thisFurnace.ControlZoneNum == 0) { + furnace.ControlZoneNum = Util::FindItemInList(Alphas(6), state.dataHeatBal->Zone); + if (furnace.ControlZoneNum == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(6), Alphas(6))); ErrorsFound = true; } // Get the node number for the zone with the thermostat - if (thisFurnace.ControlZoneNum > 0) { + if (furnace.ControlZoneNum > 0) { AirNodeFound = false; AirLoopFound = false; - int ControlledZoneNum = thisFurnace.ControlZoneNum; + int ControlledZoneNum = furnace.ControlZoneNum; // Find the controlled zone number for the specified thermostat location - thisFurnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; + furnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; // Determine if furnace is on air loop served by the thermostat location specified for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++zoneInNode) { int AirLoopNumber = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNodeAirLoopNum(zoneInNode); @@ -910,23 +883,23 @@ namespace Furnaces { CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNumber).Branch(BranchNum).TotalComponents; ++CompNum) { if (!Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNumber).Branch(BranchNum).Comp(CompNum).Name, - thisFurnace.Name) || + furnace.Name) || !Util::SameString( state.dataAirSystemsData->PrimaryAirSystems(AirLoopNumber).Branch(BranchNum).Comp(CompNum).TypeOf, CurrentModuleObject)) continue; AirLoopFound = true; - thisFurnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); + furnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); break; } if (AirLoopFound) break; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } } @@ -952,27 +925,27 @@ namespace Furnaces { FanName = Alphas(8); errFlag = false; - thisFurnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(7))); - if (thisFurnace.fanType != HVAC::FanType::OnOff && thisFurnace.fanType != HVAC::FanType::Constant) { + furnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(7))); + if (furnace.fanType != HVAC::FanType::OnOff && furnace.fanType != HVAC::FanType::Constant) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(7), Alphas(7))); ErrorsFound = true; - } else if ((thisFurnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { + } else if ((furnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(8), FanName); ErrorsFound = true; } else { - auto *fan = state.dataFans->fans(thisFurnace.FanIndex); - thisFurnace.ActualFanVolFlowRate = fan->maxAirFlowRate; - FanInletNode = fan->inletNodeNum; - FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; + auto *fan = state.dataFans->fans(furnace.FanIndex); + furnace.ActualFanVolFlowRate = fan->maxAirFlowRate; + furnace.FanInletNode = fan->inletNodeNum; + furnace.FanOutletNode = fan->outletNodeNum; + furnace.FanAvailSchedPtr = fan->availSchedNum; // Check fan's schedule for cycling fan operation if constant volume fan is used - if (thisFurnace.FanSchedPtr > 0 && thisFurnace.fanType == HVAC::FanType::Constant) { + if (furnace.FanSchedPtr > 0 && furnace.fanType == HVAC::FanType::Constant) { if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisFurnace.FanSchedPtr, ScheduleManager::Clusivity::Exclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { + state, furnace.FanSchedPtr, ScheduleManager::Clusivity::Exclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("For {} = {}", cAlphaFields(7), Alphas(7))); ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); @@ -980,290 +953,166 @@ namespace Furnaces { ShowContinueError(state, "...schedule values must be (>0., <=1.)"); ErrorsFound = true; } - } else if (lAlphaBlanks(5) && thisFurnace.fanType != HVAC::FanType::OnOff) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, thisFurnace.Name)); + } else if (lAlphaBlanks(5) && furnace.fanType != HVAC::FanType::OnOff) { + ShowSevereError(state, format("{} = {}", CurrentModuleObject, furnace.Name)); ShowContinueError(state, format("{} = {}", cAlphaFields(7), Alphas(7))); ShowContinueError(state, format("Fan type must be Fan:OnOff when {} = Blank.", cAlphaFields(5))); ErrorsFound = true; } } - thisFurnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(9))); - assert(thisFurnace.fanPlace != HVAC::FanPlace::Invalid); + furnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(9))); + assert(furnace.fanPlace != HVAC::FanPlace::Invalid); // Get coil data - HeatingCoilType = Alphas(10); - HeatingCoilName = Alphas(11); - thisFurnace.HeatingCoilType = HeatingCoilType; - thisFurnace.HeatingCoilName = HeatingCoilName; - if (Util::SameString(HeatingCoilType, "Coil:Heating:Fuel") || Util::SameString(HeatingCoilType, "Coil:Heating:Electric")) { - errFlag = false; - thisFurnace.HeatingCoilType_Num = HeatingCoils::GetHeatingCoilTypeNum(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.HeatCoilName = Alphas(11); + furnace.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(10))); + + if (furnace.heatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + furnace.heatCoilType == HVAC::CoilType::HeatingElectric) { + + // Get index to Heating Coil + furnace.HeatCoilNum = HeatingCoils::GetCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; } else { - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - - } else { // mine data from heating coil object - - // Get index to Heating Coil - errFlag = false; - HeatingCoils::GetCoilIndex(state, HeatingCoilName, thisFurnace.HeatingCoilIndex, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the furnace design capacity - errFlag = false; - thisFurnace.DesignHeatingCapacity = HeatingCoils::GetCoilCapacity(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} ={}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = HeatingCoils::GetCoilInletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - thisFurnace.HWCoilAirInletNode = HeatingCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("...occurs in {} ={}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} ={}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + furnace.DesignHeatingCapacity = HeatingCoils::GetCoilCapacity(state, furnace.HeatCoilNum); + furnace.HeatCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, furnace.HeatCoilNum); - } // IF (IsNotOK) THEN + assert(furnace.HeatCoilAirInletNode != 0 && furnace.HeatCoilAirOutletNode != 0); } + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWater) { - } else if (Util::SameString(HeatingCoilType, "Coil:Heating:Water")) { - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingWater; - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.HeatCoilNum = WaterCoils::GetWaterCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; - } else { // mine data from heating coil object - - // Get the Heating Coil water Inlet or control Node number - errFlag = false; - thisFurnace.CoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil hot water max volume flow rate - errFlag = false; - thisFurnace.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - thisFurnace.HWCoilAirInletNode = HeatingCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - thisFurnace.HWCoilAirOutletNode = HeatingCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // check if user has also used a water coil controller, which they should not do - errFlag = false; - HVACControllers::CheckCoilWaterInletNode(state, thisFurnace.CoilControlNode, errFlag); + } else { + furnace.HeatCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, furnace.HeatCoilNum); + furnace.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.HeatCoilNum); + furnace.HeatCoilAirInletNode = WaterCoils::GetCoilInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, furnace.HeatCoilNum); + + HVACControllers::CheckCoilWaterInletNode(state, furnace.HeatCoilControlNode, errFlag); if (!errFlag) { // then did find a controller so that is bad ShowSevereError(state, - format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, thisFurnace.Name)); + format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, furnace.Name)); ShowContinueError(state, "Hot water coils are controlled directly by unitary and furnace systems."); ShowContinueError(state, "No water coil controller should be input for the coil."); ErrorsFound = true; } } - } else if (Util::SameString(HeatingCoilType, "Coil:Heating:Steam")) { - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingSteam; - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingSteam) { + furnace.HeatCoilNum = SteamCoils::GetSteamCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.HeatCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - errFlag = false; - thisFurnace.HeatingCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", HeatingCoilName, errFlag); - if (thisFurnace.HeatingCoilIndex == 0) { - ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(11), HeatingCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil steam inlet node number - errFlag = false; - thisFurnace.CoilControlNode = SteamCoils::GetCoilSteamInletNode(state, "COIL:HEATING:STEAM", HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil steam max volume flow rate - thisFurnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, errFlag); - if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getUnitaryHeatOnly); - thisFurnace.MaxHeatCoilFluidFlow *= SteamDensity; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisFurnace.HeatingCoilIndex, HeatingCoilName, errFlag); - thisFurnace.HWCoilAirInletNode = HeatingCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; + } else { + furnace.HeatCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, furnace.HeatCoilNum); + furnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.HeatCoilNum); + if (furnace.MaxHeatCoilFluidFlow > 0.0) { + furnace.MaxHeatCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, getUnitaryHeatOnly); } - // Get the Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisFurnace.HeatingCoilIndex, HeatingCoilName, errFlag); - thisFurnace.HWCoilAirOutletNode = HeatingCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } + furnace.HeatCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, furnace.HeatCoilNum); } - } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(11), Alphas(11))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; } // IF (Furnace(FurnaceNum)%HeatingCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc. // Add component sets array - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { CompSetFanInlet = Alphas(3); - CompSetFanOutlet = state.dataLoopNodes->NodeID(FanOutletNode); - CompSetHeatInlet = state.dataLoopNodes->NodeID(FanOutletNode); + CompSetFanOutlet = s_node->NodeID(furnace.FanOutletNode); + CompSetHeatInlet = s_node->NodeID(furnace.FanOutletNode); CompSetHeatOutlet = Alphas(4); // Fan inlet node name must not be the same as the furnace inlet node name - if (FanInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { - ShowContinueError( - state, "When a blow through fan is specified, the fan inlet node name must be the same as the furnace inlet node name."); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); - ShowContinueError(state, - format("...Furnace inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + if (furnace.FanInletNode != furnace.FurnaceInletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { + ShowSevereCustom(state, eoh, + "When a blow through fan is specified, the fan inlet node name must be the same as the furnace inlet node name."); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); + ShowContinueError(state, format("...Furnace inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } else { - ShowContinueError( - state, - "When a blow through fan is specified, the fan inlet node name must be the same as the unitary system inlet node name."); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); - ShowContinueError( - state, format("...Unitary System inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + ShowSevereCustom(state, eoh, + "When a blow through fan is specified, the fan inlet node name must be the same as the unitary system inlet node name."); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); + ShowContinueError(state, format("...Unitary System inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } ErrorsFound = true; } // Fan outlet node name must be the same as the heating coil inlet node name - if (FanOutletNode != HeatingCoilInletNode) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, - "When a blow through fan is specified, the fan outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + if (furnace.FanOutletNode != furnace.HeatCoilAirInletNode) { + ShowSevereCustom(state, eoh, + "When a blow through fan is specified, the fan outlet node name must be the same as the heating coil inlet node name."); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } // Heating coil outlet node name must be the same as the furnace outlet node name - if (HeatingCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { - ShowContinueError(state, - "When a blow through fan is specified, the heating coil outlet node name must be the same as the furnace " - "outlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError( - state, format("...Furnace outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.HeatCoilAirOutletNode != furnace.FurnaceOutletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { + ShowSevereCustom(state, eoh, + "When a blow through fan is specified, the heating coil outlet node name must be the same as the furnace " + "outlet node name."); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Furnace outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } else { - ShowContinueError(state, - "When a blow through fan is specified, the heating coil outlet node name must be the same as the unitary " - "system outlet node name."); - ShowContinueError(state, - format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError( - state, format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowSevereCustom(state, eoh, + "When a blow through fan is specified, the heating coil outlet node name must be the same as the unitary " + "system outlet node name."); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...UnitarySystem outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } ErrorsFound = true; } } else { // draw through fan CompSetHeatInlet = Alphas(3); - CompSetHeatOutlet = state.dataLoopNodes->NodeID(FanInletNode); - CompSetFanInlet = state.dataLoopNodes->NodeID(FanInletNode); + CompSetHeatOutlet = s_node->NodeID(furnace.FanInletNode); + CompSetFanInlet = s_node->NodeID(furnace.FanInletNode); CompSetFanOutlet = Alphas(4); // Heating coil inlet node name must not be the same as the furnace inlet node name - if (HeatingCoilInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { - ShowContinueError(state, - "When a draw through fan is specified, the heating coil inlet node name must be the same as the furnace " - "inlet node name."); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); - ShowContinueError( - state, format("...Furnace inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + if (furnace.HeatCoilAirInletNode != furnace.FurnaceInletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the heating coil inlet node name must be the same as the furnace " + "inlet node name."); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); + ShowContinueError(state, format("...Furnace inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } else { - ShowContinueError(state, - "When a draw through fan is specified, the heating coil inlet node name must be the same as the unitary " - "system inlet node name."); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); - ShowContinueError( - state, format("...UnitarySystem inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the heating coil inlet node name must be the same as the unitary " + "system inlet node name."); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); + ShowContinueError(state, format("...UnitarySystem inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } ErrorsFound = true; } // Heating coil outlet node name must be the same as the fan inlet node name - if (HeatingCoilOutletNode != FanInletNode) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, - "When a draw through fan is specified, the heating coil outlet node name must be the same as the fan inlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); + if (furnace.HeatCoilAirOutletNode != furnace.FanInletNode) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the heating coil outlet node name must be the same as the fan inlet node name."); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); ErrorsFound = true; } // Fan coil outlet node name must be the same as the furnace outlet node name - if (FanOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { - ShowContinueError( - state, - "When a draw through fan is specified, the fan outlet node name must be the same as the furnace outlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, - format("...Furnace outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.FanOutletNode != furnace.FurnaceOutletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the fan outlet node name must be the same as the furnace outlet node name."); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Furnace outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } else { - ShowContinueError(state, - "When a draw through fan is specified, the fan outlet node name must be the same as the unitary system " - "outlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError( - state, format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the fan outlet node name must be the same as the unitary system " + "outlet node name."); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...UnitarySystem outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } ErrorsFound = true; } @@ -1271,50 +1120,50 @@ namespace Furnaces { // Add fan to component sets array BranchNodeConnections::SetUpCompSets( - state, CurrentModuleObject, thisFurnace.Name, Alphas(7), Alphas(8), CompSetFanInlet, CompSetFanOutlet); + state, CurrentModuleObject, furnace.Name, Alphas(7), Alphas(8), CompSetFanInlet, CompSetFanOutlet); // Add heating coil to component sets array BranchNodeConnections::SetUpCompSets( - state, CurrentModuleObject, thisFurnace.Name, Alphas(10), Alphas(11), CompSetHeatInlet, CompSetHeatOutlet); + state, CurrentModuleObject, furnace.Name, Alphas(10), Alphas(11), CompSetHeatInlet, CompSetHeatOutlet); // Set the furnace max outlet temperature - thisFurnace.DesignMaxOutletTemp = Numbers(1); + furnace.DesignMaxOutletTemp = Numbers(1); // Set the furnace design fan volumetric flow rate - thisFurnace.DesignFanVolFlowRate = Numbers(2); + furnace.DesignFanVolFlowRate = Numbers(2); // Compare the flow rates. - if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize && thisFurnace.DesignFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.DesignFanVolFlowRate > thisFurnace.ActualFanVolFlowRate) { + if (furnace.ActualFanVolFlowRate != DataSizing::AutoSize && furnace.DesignFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.DesignFanVolFlowRate > furnace.ActualFanVolFlowRate) { ShowWarningError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError( state, format("... The {} > Max Volume Flow Rate defined in the associated fan object, should be <=.", cNumericFields(2))); ShowContinueError(state, format("... Entered value = {:.4R}... Fan [{} = {}] Max Value = {:.4R}", - thisFurnace.DesignFanVolFlowRate, - HVAC::fanTypeNames[(int)thisFurnace.fanType], + furnace.DesignFanVolFlowRate, + HVAC::fanTypeNames[(int)furnace.fanType], FanName, - thisFurnace.ActualFanVolFlowRate)); + furnace.ActualFanVolFlowRate)); ShowContinueError(state, " The HVAC system flow rate is reset to the fan flow rate and the simulation continues."); - thisFurnace.DesignFanVolFlowRate = thisFurnace.ActualFanVolFlowRate; + furnace.DesignFanVolFlowRate = furnace.ActualFanVolFlowRate; } } - if (thisFurnace.DesignFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.DesignFanVolFlowRate <= 0.0) { + if (furnace.DesignFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.DesignFanVolFlowRate <= 0.0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("... The {} <= 0.0, it must be > 0.0.", cNumericFields(2))); - ShowContinueError(state, format("... Entered value = {:.2R}", thisFurnace.DesignFanVolFlowRate)); + ShowContinueError(state, format("... Entered value = {:.2R}", furnace.DesignFanVolFlowRate)); ErrorsFound = true; } } // HeatOnly furnace has only 1 flow rate, initialize other variables used in this module - thisFurnace.MaxHeatAirVolFlow = thisFurnace.DesignFanVolFlowRate; - thisFurnace.MaxCoolAirVolFlow = thisFurnace.DesignFanVolFlowRate; - thisFurnace.MaxNoCoolHeatAirVolFlow = thisFurnace.DesignFanVolFlowRate; - thisFurnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; + furnace.MaxHeatAirVolFlow = furnace.DesignFanVolFlowRate; + furnace.MaxCoolAirVolFlow = furnace.DesignFanVolFlowRate; + furnace.MaxNoCoolHeatAirVolFlow = furnace.DesignFanVolFlowRate; + furnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; // Set heating convergence tolerance - thisFurnace.HeatingConvergenceTolerance = 0.001; + furnace.HeatingConvergenceTolerance = 0.001; // set minimum outdoor temperature for compressor operation SetMinOATCompressor(state, FurnaceNum, cCurrentModuleObject, ErrorsFound); @@ -1324,37 +1173,24 @@ namespace Furnaces { // Get the data for the HeatCool Furnace or UnitarySystem for (int HeatCoolNum = 1; HeatCoolNum <= NumHeatCool + NumUnitaryHeatCool; ++HeatCoolNum) { - FanInletNode = 0; - FanOutletNode = 0; - CoolingCoilInletNode = 0; - CoolingCoilOutletNode = 0; - HeatingCoilInletNode = 0; - HeatingCoilOutletNode = 0; - int ReheatCoilInletNode = 0; - int ReheatCoilOutletNode = 0; - CoolingCoilType = ' '; - CoolingCoilName = ' '; - HeatingCoilType = ' '; - HeatingCoilName = ' '; - FurnaceNum = HeatCoolNum + NumHeatOnly + NumUnitaryHeatOnly; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Furnace and UnitarySystem objects are both read in here. // Will still have 2 differently named objects for the user, but read in with 1 DO loop. if (HeatCoolNum <= NumHeatCool) { CurrentModuleObject = "AirLoopHVAC:Unitary:Furnace:HeatCool"; currentModuleObjectType = DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryFurnaceHeatCool; - thisFurnace.type = HVAC::UnitarySysType::Furnace_HeatCool; + furnace.type = HVAC::UnitarySysType::Furnace_HeatCool; GetObjectNum = HeatCoolNum; } else { CurrentModuleObject = "AirLoopHVAC:UnitaryHeatCool"; currentModuleObjectType = DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryHeatCool; - thisFurnace.type = HVAC::UnitarySysType::Unitary_HeatCool; + furnace.type = HVAC::UnitarySysType::Unitary_HeatCool; GetObjectNum = HeatCoolNum - NumHeatCool; } - thisFurnace.iterationMode.allocate(3); + furnace.iterationMode.allocate(3); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -1372,22 +1208,22 @@ namespace Furnaces { GlobalNames::VerifyUniqueInterObjectName( state, state.dataFurnaces->UniqueFurnaceNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - thisFurnace.Name = Alphas(1); + furnace.Name = Alphas(1); - ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisFurnace.Name}; + ErrorObjectHeader eoh{routineName, CurrentModuleObject, furnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + furnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { + furnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); + if (furnace.SchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); ErrorsFound = true; } } - thisFurnace.FurnaceInletNodeNum = NodeInputManager::GetOnlySingleNode(state, + furnace.FurnaceInletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(3), ErrorsFound, currentModuleObjectType, @@ -1396,7 +1232,7 @@ namespace Furnaces { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisFurnace.FurnaceOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, + furnace.FurnaceOutletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(4), ErrorsFound, currentModuleObjectType, @@ -1408,30 +1244,30 @@ namespace Furnaces { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); - if (!lAlphaBlanks(5) && thisFurnace.FanSchedPtr == 0) { + furnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); + if (!lAlphaBlanks(5) && furnace.FanSchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(5), Alphas(5))); ErrorsFound = true; } else if (lAlphaBlanks(5)) { - thisFurnace.fanOp = HVAC::FanOp::Cycling; + furnace.fanOp = HVAC::FanOp::Cycling; } // Get the Controlling Zone or Location of the Furnace Thermostat - thisFurnace.ControlZoneNum = Util::FindItemInList(Alphas(6), state.dataHeatBal->Zone); - if (thisFurnace.ControlZoneNum == 0) { + furnace.ControlZoneNum = Util::FindItemInList(Alphas(6), state.dataHeatBal->Zone); + if (furnace.ControlZoneNum == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(6), Alphas(6))); ErrorsFound = true; } // Get the node number for the zone with the thermostat - if (thisFurnace.ControlZoneNum > 0) { + if (furnace.ControlZoneNum > 0) { AirNodeFound = false; AirLoopFound = false; - int ControlledZoneNum = thisFurnace.ControlZoneNum; + int ControlledZoneNum = furnace.ControlZoneNum; // Find the controlled zone number for the specified thermostat location - thisFurnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; + furnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; // Determine if system is on air loop served by the thermostat location specified for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++zoneInNode) { int AirLoopNumber = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNodeAirLoopNum(zoneInNode); @@ -1447,17 +1283,17 @@ namespace Furnaces { CurrentModuleObject)) continue; AirLoopFound = true; - thisFurnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); + furnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); break; } if (AirLoopFound) break; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } } @@ -1482,28 +1318,28 @@ namespace Furnaces { // Get fan data FanName = Alphas(8); - thisFurnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(7))); + furnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(7))); - if (thisFurnace.fanType != HVAC::FanType::OnOff && thisFurnace.fanType != HVAC::FanType::Constant) { + if (furnace.fanType != HVAC::FanType::OnOff && furnace.fanType != HVAC::FanType::Constant) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(7), Alphas(7))); ErrorsFound = true; - } else if ((thisFurnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { + } else if ((furnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(8), FanName); ErrorsFound = true; } else { - auto *fan = state.dataFans->fans(thisFurnace.FanIndex); - thisFurnace.ActualFanVolFlowRate = fan->maxAirFlowRate; - FanInletNode = fan->inletNodeNum; - FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; + auto *fan = state.dataFans->fans(furnace.FanIndex); + furnace.ActualFanVolFlowRate = fan->maxAirFlowRate; + furnace.FanInletNode = fan->inletNodeNum; + furnace.FanOutletNode = fan->outletNodeNum; + furnace.FanAvailSchedPtr = fan->availSchedNum; // Check fan's schedule for cycling fan operation if constant volume fan is used - if (thisFurnace.FanSchedPtr > 0 && thisFurnace.fanType == HVAC::FanType::Constant) { + if (furnace.FanSchedPtr > 0 && furnace.fanType == HVAC::FanType::Constant) { if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisFurnace.FanSchedPtr, ScheduleManager::Clusivity::Exclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { + state, furnace.FanSchedPtr, ScheduleManager::Clusivity::Exclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("For {} = {}", cAlphaFields(7), Alphas(7))); ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); @@ -1511,783 +1347,417 @@ namespace Furnaces { ShowContinueError(state, "...schedule values must be (>0., <=1.)"); ErrorsFound = true; } - } else if (lAlphaBlanks(5) && thisFurnace.fanType != HVAC::FanType::OnOff) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, thisFurnace.Name)); + } else if (lAlphaBlanks(5) && furnace.fanType != HVAC::FanType::OnOff) { + ShowSevereError(state, format("{} = {}", CurrentModuleObject, furnace.Name)); ShowContinueError(state, format("{} = {}", cAlphaFields(7), Alphas(7))); ShowContinueError(state, format("Fan type must be Fan:OnOff when {} = Blank.", cAlphaFields(5))); ErrorsFound = true; } } - thisFurnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(9))); - assert(thisFurnace.fanPlace != HVAC::FanPlace::Invalid); + furnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(9))); + assert(furnace.fanPlace != HVAC::FanPlace::Invalid); // Get coil data - HeatingCoilType = Alphas(10); - HeatingCoilName = Alphas(11); - HeatingCoilPLFCurveIndex = 0; - thisFurnace.HeatingCoilType = HeatingCoilType; - thisFurnace.HeatingCoilName = HeatingCoilName; - if (Util::SameString(HeatingCoilType, "Coil:Heating:Fuel") || Util::SameString(HeatingCoilType, "Coil:Heating:Electric")) { - errFlag = false; - thisFurnace.HeatingCoilType_Num = HeatingCoils::GetHeatingCoilTypeNum(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(10))); + furnace.HeatCoilName = Alphas(11); + furnace.HeatCoilPLFCurveIndex = 0; + + if (furnace.heatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + furnace.heatCoilType == HVAC::CoilType::HeatingElectric) { + + furnace.HeatCoilNum = HeatingCoils::GetCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; } else { - - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - - } else { // mine data from heating coil - - // Get heating coil index - errFlag = false; - HeatingCoils::GetCoilIndex(state, HeatingCoilName, thisFurnace.HeatingCoilIndex, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the design heating capacity - errFlag = false; - thisFurnace.DesignHeatingCapacity = HeatingCoils::GetCoilCapacity(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = HeatingCoils::GetCoilInletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Heating Coil PLF Curve Index - errFlag = false; - HeatingCoilPLFCurveIndex = HeatingCoils::GetHeatingCoilPLFCurveIndex(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - } // IF (IsNotOK) THEN + furnace.DesignHeatingCapacity = HeatingCoils::GetCoilCapacity(state, furnace.HeatCoilNum); + furnace.HeatCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilPLFCurveIndex = HeatingCoils::GetHeatingCoilPLFCurveIndex(state, furnace.HeatCoilNum); } - } else if (Util::SameString(HeatingCoilType, "Coil:Heating:Water")) { - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingWater; - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWater) { + furnace.HeatCoilNum = WaterCoils::GetWaterCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; - } else { // mine data from heating coil object - - // Get the Heating Coil water Inlet or control Node number - errFlag = false; - thisFurnace.CoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil hot water max volume flow rate - errFlag = false; - thisFurnace.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - thisFurnace.HWCoilAirInletNode = HeatingCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", HeatingCoilName, errFlag); - thisFurnace.HWCoilAirOutletNode = HeatingCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - + } else { + furnace.HeatCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, furnace.HeatCoilNum); + furnace.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.HeatCoilNum); + furnace.HeatCoilAirInletNode = WaterCoils::GetCoilInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, furnace.HeatCoilNum); // check if user has also used a water coil controller, which they should not do errFlag = false; - HVACControllers::CheckCoilWaterInletNode(state, thisFurnace.CoilControlNode, errFlag); + HVACControllers::CheckCoilWaterInletNode(state, furnace.HeatCoilControlNode, errFlag); if (!errFlag) { // then did find a controller so that is bad ShowSevereError(state, - format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, thisFurnace.Name)); + format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, furnace.Name)); ShowContinueError(state, "Hot water coils are controlled directly by unitary and furnace systems."); ShowContinueError(state, "No water coil controller should be input for the coil."); ErrorsFound = true; } } - - } else if (Util::SameString(HeatingCoilType, "Coil:Heating:Steam")) { - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingSteam; - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingSteam) { + furnace.HeatCoilNum = SteamCoils::GetSteamCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.HeatCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - errFlag = false; - thisFurnace.HeatingCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", HeatingCoilName, errFlag); - if (thisFurnace.HeatingCoilIndex == 0) { - ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(11), HeatingCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil steam inlet node number - errFlag = false; - thisFurnace.CoilControlNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil steam max volume flow rate - thisFurnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, errFlag); - if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - SteamDensity = - Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); - thisFurnace.MaxHeatCoilFluidFlow *= SteamDensity; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisFurnace.HeatingCoilIndex, HeatingCoilName, errFlag); - thisFurnace.HWCoilAirInletNode = HeatingCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; + } else { + furnace.HeatCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, furnace.HeatCoilNum); + furnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.HeatCoilNum); + if (furnace.MaxHeatCoilFluidFlow > 0.0) { + furnace.MaxHeatCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, getAirLoopHVACHeatCoolInput); } - // Get the Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisFurnace.HeatingCoilIndex, HeatingCoilName, errFlag); - thisFurnace.HWCoilAirOutletNode = HeatingCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } + furnace.HeatCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, furnace.HeatCoilNum); } } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(11), Alphas(11))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; } // IF (Furnace(FurnaceNum)%HeatingCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc. // Get Cooling Coil Information if available - CoolingCoilType = Alphas(12); - CoolingCoilName = Alphas(13); + furnace.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(12))); + furnace.CoolCoilName = Alphas(13); // Find the type of coil. Do not print message since this may not be the correct coil type. - errFlag = false; - PrintMessage = false; - - if (Util::SameString(CoolingCoilType, "COIL:COOLING:DX:VARIABLESPEED") || - Util::SameString(CoolingCoilType, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) { - thisFurnace.CoolingCoilType_Num = HVAC::Coil_CoolingAirToAirVariableSpeed; - if (Util::SameString(CoolingCoilType, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) thisFurnace.bIsIHP = true; - } else { - thisFurnace.CoolingCoilType_Num = DXCoils::GetCoilTypeNum(state, CoolingCoilType, CoolingCoilName, errFlag, PrintMessage); - } - - // If coil type not found, check to see if a HX assisted cooling coil is used. - if (thisFurnace.CoolingCoilType_Num == 0) { - errFlag = false; - thisFurnace.CoolingCoilType_Num = - HVACHXAssistedCoolingCoil::GetCoilGroupTypeNum(state, CoolingCoilType, CoolingCoilName, errFlag, PrintMessage); + if (Util::SameString(Alphas(12), "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) { + furnace.coolCoilType = HVAC::CoilType::CoolingAirToAirVariableSpeed; + furnace.isIHP = true; } + + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.CoolCoilNum = DXCoils::GetDXCoilIndex(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.CoolCoilName); ErrorsFound = true; + } else { + furnace.DesignCoolingCapacity = DXCoils::GetCoilCapacity(state, furnace.CoolCoilNum); + furnace.CoolCoilAirInletNode = DXCoils::GetCoilInletNode(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = DXCoils::GetCoilOutletNode(state, furnace.CoolCoilNum); + } - } else { // mine data from DX cooling coil - - // Get DX cooling coil index - DXCoils::GetDXCoilIndex(state, CoolingCoilName, thisFurnace.CoolingCoilIndex, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + if (furnace.isIHP) { + furnace.ihpName = furnace.CoolCoilName; + furnace.ihpNum = IntegratedHeatPump::GetCoilIndexIHP(state, furnace.ihpName); + if (furnace.ihpNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.ihpName); ErrorsFound = true; + } else { + furnace.CoolCoilName = state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).SCCoilName; + furnace.CoolCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, furnace.CoolCoilName); + // This probably doesn't need to be done because the IHP itself did this check. + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, format("{}.SCCoilName", cAlphaFields(13)), furnace.CoolCoilName); + ErrorsFound = true; + } } - - // Get DX cooling coil capacity - errFlag = false; - thisFurnace.DesignCoolingCapacity = DXCoils::GetCoilCapacity(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else { // !furnace.isIHP + furnace.CoolCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.CoolCoilName); ErrorsFound = true; } + } - // Get the Cooling Coil Nodes - errFlag = false; - CoolingCoilInletNode = DXCoils::GetCoilInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = DXCoils::GetCoilOutletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; + // At this point, CoolCoilNum should be set correctly regardless of whether this is an IHP or not + if (furnace.CoolCoilNum != 0) { + furnace.CoolCoilAirInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, furnace.CoolCoilNum); + furnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, furnace.CoolCoilNum); + furnace.DesignCoolingCapacity = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, furnace.CoolCoilNum); + furnace.MaxCoolAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, furnace.CoolCoilNum); + } + + // Push heating coil PLF curve index to DX coil + if (furnace.HeatCoilPLFCurveIndex > 0) { + DXCoils::SetDXCoolingCoilData(state, furnace.CoolCoilNum, ErrorsFound, furnace.HeatCoilPLFCurveIndex); + } + + } else if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { + // At this point, the variables that reference the + // HXAssisted coil become the hxCoolCoil vars so that + // the (plain) CoolCoil vars can reference the child DX Coil + // that is embedded in the HXAssisted coil + furnace.hxCoolCoilName = furnace.CoolCoilName; + furnace.hxCoolCoilType = furnace.coolCoilType; + furnace.CoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, furnace.hxCoolCoilName); + if (furnace.hxCoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.hxCoolCoilName); + ErrorsFound = true; + } else { + furnace.DesignCoolingCapacity = HVACHXAssistedCoolingCoil::GetHXCoilCapacity(state, furnace.hxCoolCoilNum); + furnace.CoolCoilAirInletNode = HVACHXAssistedCoolingCoil::GetHXCoilInletNode(state, furnace.hxCoolCoilNum); + furnace.CoolCoilAirOutletNode = HVACHXAssistedCoolingCoil::GetHXCoilOutletNode(state, furnace.hxCoolCoilNum); + + furnace.CoolCoilName = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilName(state, furnace.hxCoolCoilNum); + furnace.coolCoilType = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilType(state, furnace.hxCoolCoilNum); + furnace.CoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilIndex(state, furnace.hxCoolCoilNum); + + // if (furnace.CoolingCoilType_Num == CoilDX_CoolingHXAssisted) { + if (furnace.coolCoilType == HVAC::CoilType::DXCooling) { + auto const &coilDX = state.dataCoilCoolingDX->coilCoolingDXs[furnace.CoolCoilNum]; + furnace.CondenserNodeNum = coilDX.condInletNodeIndex; + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + furnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, furnace.CoolCoilNum); + } else { + furnace.CondenserNodeNum = DXCoils::GetCoilCondenserInletNode(state, furnace.CoolCoilNum); } - // Get outdoor condenser node from DX coil object - errFlag = false; - if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (thisFurnace.bIsIHP) { - IHPCoilIndex = IntegratedHeatPump::GetCoilIndexIHP(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(IHPCoilIndex).SCCoilName; - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, IHPCoilName, errFlag); + // Push heating coil PLF curve index to DX coil + if (furnace.HeatCoilPLFCurveIndex > 0) { + // get the actual index to the DX cooling coil object + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + DXCoils::SetDXCoilHeatingPLFCurve(state, furnace.CoolCoilNum, furnace.HeatCoilPLFCurveIndex); + } + // what could we do for VS coil here? odd thing here + } + } + + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(12), Alphas(12)); + ErrorsFound = true; + } + + if (Util::SameString(Alphas(14), "None") || Util::SameString(Alphas(14), "Multimode") || Util::SameString(Alphas(14), "CoolReheat")) { + AirNodeFound = false; + if (Util::SameString(Alphas(14), "Multimode")) { + furnace.DehumidControlType_Num = DehumidificationControlMode::Multimode; + furnace.Humidistat = true; + if (furnace.coolCoilType != HVAC::CoilType::DXCoolingHXAssisted) { + ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); + ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(14), Alphas(14))); + ShowContinueError(state, "Multimode control must be used with a Heat Exchanger Assisted Cooling Coil."); + if (lAlphaBlanks(15)) { + ShowContinueError(state, + "Dehumidification control type is assumed to be None since a reheat coil has not been specified and " + "the simulation continues."); + furnace.Humidistat = false; + furnace.DehumidControlType_Num = DehumidificationControlMode::None; } else { - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, CoolingCoilName, errFlag); + ShowContinueError(state, "Dehumidification control type is assumed to be CoolReheat and the simulation continues."); + furnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; } - } else { - thisFurnace.CondenserNodeNum = DXCoils::GetCoilCondenserInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); } - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else if (Util::SameString(Alphas(14), "CoolReheat")) { + furnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; + furnace.Humidistat = true; + if (lAlphaBlanks(15)) { + ShowWarningError(state, format("{} \"{}\"", CurrentModuleObject, Alphas(1))); + ShowContinueError(state, + "Dehumidification control type is assumed to be None since a reheat coil has not been specified and the " + "simulation continues."); + furnace.Humidistat = false; + furnace.DehumidControlType_Num = DehumidificationControlMode::None; + } + } else if (Util::SameString(Alphas(14), "None")) { + furnace.DehumidControlType_Num = DehumidificationControlMode::None; + furnace.Humidistat = false; + } + + if (furnace.Humidistat) { + for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) { + if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; + AirNodeFound = true; + } + if (!AirNodeFound) { + ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); + ShowContinueError(state, "Did not find Air Node (Zone with Humidistat)."); + ShowContinueError(state, format("Specified {} = {}", cAlphaFields(6), Alphas(6))); ErrorsFound = true; } - - } // IF (IsNotOK) THEN - - // Push heating coil PLF curve index to DX coil - if (HeatingCoilPLFCurveIndex > 0) { - DXCoils::SetDXCoolingCoilData(state, thisFurnace.CoolingCoilIndex, ErrorsFound, HeatingCoilPLFCurveIndex); } + } else { // invalid input + ShowSevereInvalidKey(state, eoh, cAlphaFields(14), Alphas(14)); + furnace.Humidistat = false; + ErrorsFound = true; + } - } else if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; + // Check placement of cooling coil with respect to fan placement and dehumidification control type + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.FanOutletNode == furnace.HeatCoilAirInletNode && + furnace.DehumidControlType_Num != DehumidificationControlMode::CoolReheat) { + furnace.CoolCoilUpstream = false; + } + } else { + if (furnace.HeatCoilAirOutletNode == furnace.CoolCoilAirInletNode && + furnace.DehumidControlType_Num != DehumidificationControlMode::CoolReheat) { + furnace.CoolCoilUpstream = false; + } + } - } else { // mine data from heat exchanger assisted cooling coil + // Get reheat coil data if humidistat is used + furnace.suppHeatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(15))); + furnace.SuppCoilName = Alphas(16); - // Get DX heat exchanger assisted cooling coil index - HVACHXAssistedCoolingCoil::GetHXDXCoilIndex(state, CoolingCoilName, thisFurnace.CoolingCoilIndex, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (!lAlphaBlanks(15)) { + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + furnace.suppHeatCoilType == HVAC::CoilType::HeatingElectric || + furnace.suppHeatCoilType == HVAC::CoilType::HeatingDesuperheater) { + + // Get the heating coil index + furnace.SuppCoilNum = HeatingCoils::GetCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), furnace.SuppCoilName); ErrorsFound = true; + } else { + furnace.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, furnace.SuppCoilNum); + furnace.SuppCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, furnace.SuppCoilNum); } - // Get DX cooling coil capacity - errFlag = false; - thisFurnace.DesignCoolingCapacity = HVACHXAssistedCoolingCoil::GetCoilCapacity(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Cooling Coil Nodes - errFlag = false; - CoolingCoilInletNode = HVACHXAssistedCoolingCoil::GetCoilInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = HVACHXAssistedCoolingCoil::GetCoilOutletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get outdoor condenser node from heat exchanger assisted DX coil object - errFlag = false; - std::string ChildCoolingCoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, CoolingCoilType, CoolingCoilName, IsNotOK); - std::string ChildCoolingCoilType = HVACHXAssistedCoolingCoil::GetHXDXCoilType(state, CoolingCoilType, CoolingCoilName, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // if (thisFurnace.CoolingCoilType_Num == CoilDX_CoolingHXAssisted) { - if (Util::SameString(ChildCoolingCoilType, "COIL:COOLING:DX")) { - - int childCCIndex = CoilCoolingDX::factory(state, ChildCoolingCoilName); - if (childCCIndex < 0) { - ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, Alphas(1))); - errFlag = true; - ErrorsFound = true; - } - auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex]; - - thisFurnace.CondenserNodeNum = newCoil.condInletNodeIndex; - - } - // else if (thisFurnace.CoolingCoilType_Num == Coil_CoolingAirToAirVariableSpeed) { - else if (Util::SameString(ChildCoolingCoilType, "Coil:Cooling:DX:VariableSpeed")) { - if (thisFurnace.bIsIHP) { - IHPCoilIndex = IntegratedHeatPump::GetCoilIndexIHP(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(IHPCoilIndex).SCCoilName; - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, IHPCoilName, errFlag); - } else { - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, CoolingCoilName, errFlag); - } - } else { - thisFurnace.CondenserNodeNum = DXCoils::GetCoilCondenserInletNode( - state, - "COIL:COOLING:DX:SINGLESPEED", - HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, CoolingCoilType, CoolingCoilName, errFlag), - errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Push heating coil PLF curve index to DX coil - if (HeatingCoilPLFCurveIndex > 0) { - // get the actual index to the DX cooling coil object - DXCoilIndex = HVACHXAssistedCoolingCoil::GetActualDXCoilIndex(state, CoolingCoilType, CoolingCoilName, ErrorsFound); - thisFurnace.ActualDXCoilIndexForHXAssisted = DXCoilIndex; - int ActualCoolCoilType = - HVACHXAssistedCoolingCoil::GetCoilObjectTypeNum(state, CoolingCoilType, CoolingCoilName, errFlag, true); - if (ActualCoolCoilType == HVAC::CoilDX_CoolingSingleSpeed) { - DXCoils::SetDXCoolingCoilData(state, DXCoilIndex, ErrorsFound, HeatingCoilPLFCurveIndex); - } - // what could we do for VS coil here? odd thing here - } - - } // IF (IsNotOK) THEN - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - // BOS ADDED, AUG/2012, VARIIABLE SPEED DX COOLING COIL - // Furnace(FurnaceNum)%DXCoolCoilType = 'COIL:COOLING:DX:VARIABLESPEED' - // Furnace(FurnaceNum)%DXCoolCoilName = CoolingCoilName - if (Util::SameString(CoolingCoilType, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) thisFurnace.bIsIHP = true; - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); - - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } else { - errFlag = false; - if (thisFurnace.bIsIHP) { - thisFurnace.CoolingCoilIndex = IntegratedHeatPump::GetCoilIndexIHP(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilName; - } else { - thisFurnace.CoolingCoilIndex = - VariableSpeedCoils::GetCoilIndexVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = CoolingCoilName; - } - - if (errFlag) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - if (thisFurnace.bIsIHP) { - CoolingCoilInletNode = - VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); - CoolingCoilOutletNode = - VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, IHPCoilName, errFlag); - } else { - CoolingCoilInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, CoolingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } - } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(12), Alphas(12))); - ErrorsFound = true; - } - - if (Util::SameString(Alphas(14), "None") || Util::SameString(Alphas(14), "Multimode") || Util::SameString(Alphas(14), "CoolReheat")) { - AirNodeFound = false; - if (Util::SameString(Alphas(14), "Multimode")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::Multimode; - thisFurnace.Humidistat = true; - if (thisFurnace.CoolingCoilType_Num != HVAC::CoilDX_CoolingHXAssisted) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(14), Alphas(14))); - ShowContinueError(state, "Multimode control must be used with a Heat Exchanger Assisted Cooling Coil."); - if (lAlphaBlanks(15)) { - ShowContinueError(state, - "Dehumidification control type is assumed to be None since a reheat coil has not been specified and " - "the simulation continues."); - thisFurnace.Humidistat = false; - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; - } else { - ShowContinueError(state, "Dehumidification control type is assumed to be CoolReheat and the simulation continues."); - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; - } - } - } - if (Util::SameString(Alphas(14), "CoolReheat")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; - thisFurnace.Humidistat = true; - if (lAlphaBlanks(15)) { - ShowWarningError(state, format("{} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - "Dehumidification control type is assumed to be None since a reheat coil has not been specified and the " - "simulation continues."); - thisFurnace.Humidistat = false; - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; - } - } - if (Util::SameString(Alphas(14), "None")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; - thisFurnace.Humidistat = false; - } - if (thisFurnace.Humidistat) { - for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) { - if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; - AirNodeFound = true; - } - if (!AirNodeFound) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, "Did not find Air Node (Zone with Humidistat)."); - ShowContinueError(state, format("Specified {} = {}", cAlphaFields(6), Alphas(6))); - ErrorsFound = true; - } - } - } else { // invalid input - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(14), Alphas(14))); - thisFurnace.Humidistat = false; - ErrorsFound = true; - } - - // Check placement of cooling coil with respect to fan placement and dehumidification control type - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - if (FanOutletNode == HeatingCoilInletNode && thisFurnace.DehumidControlType_Num != DehumidificationControlMode::CoolReheat) { - thisFurnace.CoolingCoilUpstream = false; - } - } else { - if (HeatingCoilOutletNode == CoolingCoilInletNode && thisFurnace.DehumidControlType_Num != DehumidificationControlMode::CoolReheat) { - thisFurnace.CoolingCoilUpstream = false; - } - } - - // Get reheat coil data if humidistat is used - ReheatingCoilType = Alphas(15); - ReheatingCoilName = Alphas(16); - thisFurnace.SuppHeatCoilType = ReheatingCoilType; - thisFurnace.SuppHeatCoilName = ReheatingCoilName; - errFlag = false; - if (!lAlphaBlanks(15)) { - if (Util::SameString(ReheatingCoilType, "Coil:Heating:Fuel") || Util::SameString(ReheatingCoilType, "Coil:Heating:Electric") || - Util::SameString(ReheatingCoilType, "Coil:Heating:Desuperheater")) { - - thisFurnace.SuppHeatCoilType_Num = HeatingCoils::GetHeatingCoilTypeNum(state, ReheatingCoilType, ReheatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingWater) { + // Get the Heating Coil water Inlet or control Node number + furnace.SuppCoilNum = WaterCoils::GetWaterCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(16), furnace.SuppCoilName); ErrorsFound = true; } else { - - ValidateComponent(state, ReheatingCoilType, ReheatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("In {} \"{}\"", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - - } else { // mine data from reheat coil - - // Get the heating coil index - HeatingCoils::GetCoilIndex(state, ReheatingCoilName, thisFurnace.SuppHeatCoilIndex, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the design supplemental heating capacity - errFlag = false; - thisFurnace.DesignSuppHeatingCapacity = - HeatingCoils::GetCoilCapacity(state, ReheatingCoilType, ReheatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Reheat Coil Inlet Node - errFlag = false; - ReheatCoilInletNode = HeatingCoils::GetCoilInletNode(state, ReheatingCoilType, ReheatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Reheat Coil Outlet Node - errFlag = false; - ReheatCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, ReheatingCoilType, ReheatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - } // IF (IsNotOK) THEN - } - - } else if (Util::SameString(ReheatingCoilType, "Coil:Heating:Water")) { - thisFurnace.SuppHeatCoilType_Num = HVAC::Coil_HeatingWater; - ValidateComponent(state, ReheatingCoilType, ReheatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } else { // mine data from heating coil object - - // Get the Heating Coil water Inlet or control Node number - errFlag = false; - thisFurnace.SuppCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", ReheatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil hot water max volume flow rate - errFlag = false; - thisFurnace.MaxSuppCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", ReheatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil Inlet Node - errFlag = false; - ReheatCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", ReheatingCoilName, errFlag); - thisFurnace.SuppCoilAirInletNode = ReheatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil Outlet Node - errFlag = false; - ReheatCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", ReheatingCoilName, errFlag); - thisFurnace.SuppCoilAirOutletNode = ReheatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - + furnace.SuppCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, furnace.SuppCoilNum); + furnace.MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.SuppCoilNum); + furnace.SuppCoilAirInletNode = WaterCoils::GetCoilInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, furnace.SuppCoilNum); // check if user has also used a water coil controller, which they should not do errFlag = false; - HVACControllers::CheckCoilWaterInletNode(state, thisFurnace.CoilControlNode, errFlag); + HVACControllers::CheckCoilWaterInletNode(state, furnace.SuppCoilControlNode, errFlag); if (!errFlag) { // then did find a controller so that is bad ShowSevereError(state, - format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, thisFurnace.Name)); + format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, furnace.Name)); ShowContinueError(state, "Hot water coils are controlled directly by unitary and furnace systems."); ShowContinueError(state, "No water coil controller should be input for the coil."); ErrorsFound = true; } } - } else if (Util::SameString(ReheatingCoilType, "Coil:Heating:Steam")) { - thisFurnace.SuppHeatCoilType_Num = HVAC::Coil_HeatingSteam; - ValidateComponent(state, ReheatingCoilType, ReheatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { + furnace.SuppCoilNum = SteamCoils::GetSteamCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(16), furnace.SuppCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - errFlag = false; - thisFurnace.SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", ReheatingCoilName, errFlag); - if (thisFurnace.SuppHeatCoilIndex == 0) { - ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(11), ReheatingCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil steam inlet node number - errFlag = false; - thisFurnace.SuppCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", ReheatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - + } else { + furnace.SuppCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, furnace.SuppCoilNum); // Get the Heating Coil steam max volume flow rate - thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag); - if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - SteamDensity = - Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); - thisFurnace.MaxSuppCoilFluidFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag) * SteamDensity; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - ReheatCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisFurnace.SuppHeatCoilIndex, ReheatingCoilName, errFlag); - thisFurnace.SuppCoilAirInletNode = ReheatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; + furnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.SuppCoilNum); + if (furnace.MaxSuppCoilFluidFlow > 0.0) { + furnace.MaxSuppCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, getAirLoopHVACHeatCoolInput); } - // Get the Heating Coil Outlet Node - errFlag = false; - ReheatCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisFurnace.SuppHeatCoilIndex, ReheatingCoilName, errFlag); - thisFurnace.SuppCoilAirOutletNode = ReheatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } + furnace.SuppCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, furnace.SuppCoilNum); } } else { // Illegal heating coil - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(15), Alphas(15))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(15), Alphas(15)); ErrorsFound = true; - } // IF (Furnace(FurnaceNum)%SuppHeatCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc. + } // IF (Furnace(FurnaceNum)%SuppCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc. } // IF(.NOT. lAlphaBlanks(15))THEN - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { - if (FanInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { - ShowContinueError( - state, "When a blow through fan is specified, the fan inlet node name must be the same as the furnace inlet node name."); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); - ShowContinueError(state, - format("...Furnace inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + if (furnace.FanInletNode != furnace.FurnaceInletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { + ShowSevereCustom(state, eoh, + "When a blow through fan is specified, the fan inlet node name must be the same as the furnace inlet node name."); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); + ShowContinueError(state, format("...Furnace inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } else { - ShowContinueError( - state, + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the fan inlet node name must be the same as the unitary system inlet node name."); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); - ShowContinueError( - state, format("...UnitarySystem inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); + ShowContinueError(state, format("...UnitarySystem inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } ErrorsFound = true; } - if (thisFurnace.CoolingCoilUpstream) { - if (FanOutletNode != CoolingCoilInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, + if (furnace.CoolCoilUpstream) { + if (furnace.FanOutletNode != furnace.CoolCoilAirInletNode) { + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the fan outlet node name must be the same as the cooling coil inlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + if (furnace.CoolCoilAirOutletNode != furnace.HeatCoilAirInletNode) { + ShowSevereCustom(state, eoh, + "The cooling coil outlet node name must be the same as the heating coil inlet node name."); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } - if ((thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) || - ReheatCoilInletNode > 0) { - if (HeatingCoilOutletNode != ReheatCoilInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, + if ((furnace.Humidistat && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) || + furnace.SuppCoilAirInletNode > 0) { + if (furnace.HeatCoilAirOutletNode != furnace.SuppCoilAirInletNode) { + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the heating coil outlet node name must be the same as the " "reheat coil inlet node name."); - ShowContinueError(state, - format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, - format("...Reheat coil inlet node name = {}", state.dataLoopNodes->NodeID(ReheatCoilInletNode))); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Reheat coil inlet node name = {}", s_node->NodeID(furnace.SuppCoilAirInletNode))); ErrorsFound = true; } - if (ReheatCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { - ShowContinueError(state, "The reheat coil outlet node name must be the same as the furnace outlet node name."); - ShowContinueError(state, - format("...Reheat coil outlet node name = {}", state.dataLoopNodes->NodeID(ReheatCoilOutletNode))); - ShowContinueError( - state, - format("...Furnace outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.SuppCoilAirOutletNode != furnace.FurnaceOutletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { + ShowSevereCustom(state, eoh, "The reheat coil outlet node name must be the same as the furnace outlet node name."); + ShowContinueError(state, format("...Reheat coil outlet node name = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); + ShowContinueError(state, format("...Furnace outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } else { ShowContinueError(state, "The reheat coil outlet node name must be the same as the unitary system outlet node name."); - ShowContinueError( - state, format("...Reheat coil outlet node name = {}", state.dataLoopNodes->NodeID(ReheatCoilOutletNode))); - ShowContinueError( - state, - format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowContinueError(state, format("...Reheat coil outlet node name = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); + ShowContinueError(state, format("...UnitarySystem outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } ErrorsFound = true; } } else { // IF((Furnace(FurnaceNum)%Humidistat ... // Heating coil outlet node name must be the same as the furnace outlet node name - if (HeatingCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { - ShowContinueError(state, - "When a blow through fan is specified, the heating coil outlet node name must be the same as the " - "furnace outlet node name."); - ShowContinueError( - state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError( - state, - format("...Furnace outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.HeatCoilAirOutletNode != furnace.FurnaceOutletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatOnly) { + ShowSevereCustom(state, eoh, + "When a blow through fan is specified, the heating coil outlet node name must be the same as the " + "furnace outlet node name."); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Furnace outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } else { - ShowContinueError(state, + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the heating coil outlet node name must be the same as the " "unitary system outlet node name."); - ShowContinueError( - state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError( - state, - format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...UnitarySystem outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } ErrorsFound = true; } } } else { // IF(Furnace(FurnaceNum)%CoolingCoilUpstream)THEN - if (FanOutletNode != HeatingCoilInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, + if (furnace.FanOutletNode != furnace.HeatCoilAirInletNode) { + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the fan outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != CoolingCoilInletNode) { + if (furnace.HeatCoilAirOutletNode != furnace.CoolCoilAirInletNode) { ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, "The heating coil outlet node name must be the same as the cooling coil inlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { - ShowContinueError(state, + if (furnace.CoolCoilAirOutletNode != furnace.FurnaceOutletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the cooling coil outlet node name must be the same as the " "furnace outlet node name."); - ShowContinueError(state, - format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError( - state, - format("...Furnace outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Furnace outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } else { - ShowContinueError(state, + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the cooling coil outlet node name must be the same as the " "unitary system outlet node name."); - ShowContinueError(state, - format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError( - state, - format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...UnitarySystem outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } ErrorsFound = true; } @@ -2295,142 +1765,114 @@ namespace Furnaces { } else { // ELSE from IF(Furnace(FurnaceNum)%FanPlace .EQ. BlowThru)THEN - if (thisFurnace.CoolingCoilUpstream) { - if (CoolingCoilInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { - ShowContinueError(state, - "When a draw through fan is specified, the cooling coil inlet node name must be the same as the " - "furnace inlet node name."); - ShowContinueError(state, - format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); - ShowContinueError( - state, format("...Furnace inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + if (furnace.CoolCoilUpstream) { + if (furnace.CoolCoilAirInletNode != furnace.FurnaceInletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the cooling coil inlet node name must be the same as the " + "furnace inlet node name."); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); + ShowContinueError(state, format("...Furnace inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } else { - ShowContinueError(state, - "When a draw through fan is specified, the cooling coil inlet node name must be the same as the " - "unitary system inlet node name."); - ShowContinueError(state, - format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); - ShowContinueError( - state, format("...UnitarySystem inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the cooling coil inlet node name must be the same as the " + "unitary system inlet node name."); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); + ShowContinueError(state, format("...UnitarySystem inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { + if (furnace.CoolCoilAirOutletNode != furnace.HeatCoilAirInletNode) { ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != FanInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, + if (furnace.HeatCoilAirOutletNode != furnace.FanInletNode) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the heating coil outlet node name must be the same as the fan inlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); ErrorsFound = true; } - if ((thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) || - ReheatCoilInletNode > 0) { - if (FanOutletNode != ReheatCoilInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, + if ((furnace.Humidistat && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) || + furnace.SuppCoilAirInletNode > 0) { + if (furnace.FanOutletNode != furnace.SuppCoilAirInletNode) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the fan outlet node name must be the same as the reheat coil " "inlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, format("...Reheat coil inlet node name = {}", state.dataLoopNodes->NodeID(ReheatCoilInletNode))); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Reheat coil inlet node name = {}", s_node->NodeID(furnace.SuppCoilAirInletNode))); ErrorsFound = true; } - if (ReheatCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { - ShowContinueError(state, "The reheat coil outlet node name must be the same as the furnace outlet node name."); - ShowContinueError(state, - format("...Reheat coil outlet node name = {}", state.dataLoopNodes->NodeID(ReheatCoilOutletNode))); - ShowContinueError( - state, - format("...Furnace outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.SuppCoilAirOutletNode != furnace.FurnaceOutletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { + ShowSevereCustom(state, eoh, "The reheat coil outlet node name must be the same as the furnace outlet node name."); + ShowContinueError(state, format("...Reheat coil outlet node name = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); + ShowContinueError(state, format("...Furnace outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } else { ShowContinueError(state, "The reheat coil outlet node name must be the same as the unitary system outlet node name."); ShowContinueError( - state, format("...Reheat coil outlet node name = {}", state.dataLoopNodes->NodeID(ReheatCoilOutletNode))); + state, format("...Reheat coil outlet node name = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); ShowContinueError( state, - format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + format("...UnitarySystem outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } ErrorsFound = true; } } else { - if (FanOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, + if (furnace.FanOutletNode != furnace.FurnaceOutletNode) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the fan outlet node name must be the same as the unitary system " "outlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError( - state, - format("...Unitary system outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Unitary system outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); ErrorsFound = true; } } } else { // IF(Furnace(FurnaceNum)%CoolingCoilUpstream)THEN - if (HeatingCoilInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { - ShowContinueError(state, + if (furnace.HeatCoilAirInletNode != furnace.FurnaceInletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the heating coil inlet node name must be the same as the " "furnace inlet node name."); - ShowContinueError(state, - format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); - ShowContinueError( - state, format("...Furnace inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); + ShowContinueError(state, format("...Furnace inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } else { - ShowContinueError(state, - "When a draw through fan is specified, the heating coil inlet node name must be the same as the " - "unitary system inlet node name."); - ShowContinueError(state, - format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); - ShowContinueError( - state, format("...UnitarySystem inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the heating coil inlet node name must be the same as the " + "unitary system inlet node name."); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); + ShowContinueError(state, format("...UnitarySystem inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); } ErrorsFound = true; } - if (HeatingCoilOutletNode != CoolingCoilInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, "The heating coil outlet node name must be the same as the cooling coil inlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); + if (furnace.HeatCoilAirOutletNode != furnace.CoolCoilAirInletNode) { + ShowSevereCustom(state, eoh, "The heating coil outlet node name must be the same as the cooling coil inlet node name."); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != FanInletNode) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, + if (furnace.CoolCoilAirOutletNode != furnace.FanInletNode) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the cooling coil outlet node name must be the same as the fan inlet node name."); - ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); ErrorsFound = true; } - if (FanOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - if (thisFurnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { - ShowContinueError( - state, - "When a draw through fan is specified, the fan outlet node name must be the same as the furnace outlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError( - state, format("...Furnace outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.FanOutletNode != furnace.FurnaceOutletNode) { + if (furnace.type == HVAC::UnitarySysType::Furnace_HeatCool) { + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the fan outlet node name must be the same as the furnace outlet node name."); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Furnace outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } else { - ShowContinueError(state, + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the fan outlet node name must be the same as the unitary system " "outlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError( - state, - format("...UnitarySystem outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...UnitarySystem outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); } ErrorsFound = true; } @@ -2443,48 +1885,48 @@ namespace Furnaces { Alphas(1), Alphas(7), Alphas(8), - state.dataLoopNodes->NodeID(FanInletNode), - state.dataLoopNodes->NodeID(FanOutletNode)); + s_node->NodeID(furnace.FanInletNode), + s_node->NodeID(furnace.FanOutletNode)); // Add DX cooling coil to component sets array - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(12), Alphas(13) + " Cooling Coil", - state.dataLoopNodes->NodeID(CoolingCoilInletNode), - state.dataLoopNodes->NodeID(CoolingCoilOutletNode)); + s_node->NodeID(furnace.CoolCoilAirInletNode), + s_node->NodeID(furnace.CoolCoilAirOutletNode)); } else { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(12), Alphas(13), - state.dataLoopNodes->NodeID(CoolingCoilInletNode), - state.dataLoopNodes->NodeID(CoolingCoilOutletNode)); + s_node->NodeID(furnace.CoolCoilAirInletNode), + s_node->NodeID(furnace.CoolCoilAirOutletNode)); } // Add heating coil to component sets array - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(10), Alphas(11) + " Heating Coil", - state.dataLoopNodes->NodeID(HeatingCoilInletNode), - state.dataLoopNodes->NodeID(HeatingCoilOutletNode)); + s_node->NodeID(furnace.HeatCoilAirInletNode), + s_node->NodeID(furnace.HeatCoilAirOutletNode)); } else { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(10), Alphas(11), - state.dataLoopNodes->NodeID(HeatingCoilInletNode), - state.dataLoopNodes->NodeID(HeatingCoilOutletNode)); + s_node->NodeID(furnace.HeatCoilAirInletNode), + s_node->NodeID(furnace.HeatCoilAirOutletNode)); } - if (ReheatCoilInletNode > 0) { + if (furnace.SuppCoilAirInletNode > 0) { // Add reheating coil to component sets array BranchNodeConnections::SetUpCompSets(state, @@ -2492,127 +1934,94 @@ namespace Furnaces { Alphas(1), Alphas(15), Alphas(16), - state.dataLoopNodes->NodeID(ReheatCoilInletNode), - state.dataLoopNodes->NodeID(ReheatCoilOutletNode)); + s_node->NodeID(furnace.SuppCoilAirInletNode), + s_node->NodeID(furnace.SuppCoilAirOutletNode)); } // Set the furnace max outlet temperature - thisFurnace.DesignMaxOutletTemp = Numbers(1); + furnace.DesignMaxOutletTemp = Numbers(1); - thisFurnace.MaxCoolAirVolFlow = Numbers(2); - if (thisFurnace.MaxCoolAirVolFlow <= 0 && thisFurnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { + furnace.MaxCoolAirVolFlow = Numbers(2); + if (furnace.MaxCoolAirVolFlow <= 0 && furnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {:.7T}", cNumericFields(2), Numbers(2))); ErrorsFound = true; } - thisFurnace.MaxHeatAirVolFlow = Numbers(3); - if (thisFurnace.MaxHeatAirVolFlow <= 0 && thisFurnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { + furnace.MaxHeatAirVolFlow = Numbers(3); + if (furnace.MaxHeatAirVolFlow <= 0 && furnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {:.7T}", cNumericFields(3), Numbers(3))); ErrorsFound = true; } - thisFurnace.MaxNoCoolHeatAirVolFlow = Numbers(4); - if (thisFurnace.MaxNoCoolHeatAirVolFlow < 0 && thisFurnace.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) { + furnace.MaxNoCoolHeatAirVolFlow = Numbers(4); + if (furnace.MaxNoCoolHeatAirVolFlow < 0 && furnace.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {:.7T}", cNumericFields(4), Numbers(4))); ErrorsFound = true; } if (Numbers(2) != DataSizing::AutoSize && Numbers(3) != DataSizing::AutoSize && Numbers(4) != DataSizing::AutoSize) { - thisFurnace.DesignFanVolFlowRate = max(Numbers(2), Numbers(3), Numbers(4)); + furnace.DesignFanVolFlowRate = max(Numbers(2), Numbers(3), Numbers(4)); } else { - thisFurnace.DesignFanVolFlowRate = DataSizing::AutoSize; + furnace.DesignFanVolFlowRate = DataSizing::AutoSize; } - if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - errFlag = false; - if (thisFurnace.bIsIHP) { - thisFurnace.CoolingCoilIndex = IntegratedHeatPump::GetCoilIndexIHP(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilName; - thisFurnace.MaxCoolAirVolFlow = - VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); + if (furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + furnace.MaxNoCoolHeatAirVolFlow = min(furnace.MaxHeatAirVolFlow, furnace.MaxCoolAirVolFlow); + if (furnace.MaxHeatAirVolFlow != DataSizing::AutoSize && furnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { + furnace.DesignFanVolFlowRate = max(furnace.MaxHeatAirVolFlow, furnace.MaxCoolAirVolFlow); } else { - thisFurnace.MaxCoolAirVolFlow = - VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - thisFurnace.MaxNoCoolHeatAirVolFlow = min(thisFurnace.MaxHeatAirVolFlow, thisFurnace.MaxCoolAirVolFlow); - if (thisFurnace.MaxHeatAirVolFlow != DataSizing::AutoSize && thisFurnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { - thisFurnace.DesignFanVolFlowRate = max(thisFurnace.MaxHeatAirVolFlow, thisFurnace.MaxCoolAirVolFlow); - } else { - thisFurnace.DesignFanVolFlowRate = DataSizing::AutoSize; + furnace.DesignFanVolFlowRate = DataSizing::AutoSize; } } - if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.ActualFanVolFlowRate < thisFurnace.MaxCoolAirVolFlow && thisFurnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { + if (furnace.ActualFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.ActualFanVolFlowRate < furnace.MaxCoolAirVolFlow && furnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError( state, format("... air flow rate = {:.7T} in fan object {} is less than the maximum HVAC system air flow rate in cooling mode.", - thisFurnace.ActualFanVolFlowRate, + furnace.ActualFanVolFlowRate, FanName)); ShowContinueError(state, format(" The {} is reset to the fan flow rate and the simulation continues.", cNumericFields(2))); - thisFurnace.MaxCoolAirVolFlow = thisFurnace.ActualFanVolFlowRate; - thisFurnace.DesignFanVolFlowRate = thisFurnace.ActualFanVolFlowRate; + furnace.MaxCoolAirVolFlow = furnace.ActualFanVolFlowRate; + furnace.DesignFanVolFlowRate = furnace.ActualFanVolFlowRate; } - if (thisFurnace.ActualFanVolFlowRate < thisFurnace.MaxHeatAirVolFlow && thisFurnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { + if (furnace.ActualFanVolFlowRate < furnace.MaxHeatAirVolFlow && furnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError( state, format("... air flow rate = {:.7T} in fan object {} is less than the maximum HVAC system air flow rate in heating mode.", - thisFurnace.ActualFanVolFlowRate, + furnace.ActualFanVolFlowRate, FanName)); ShowContinueError(state, format(" The {} is reset to the fan flow rate and the simulation continues.", cNumericFields(3))); - thisFurnace.MaxHeatAirVolFlow = thisFurnace.ActualFanVolFlowRate; - thisFurnace.DesignFanVolFlowRate = thisFurnace.ActualFanVolFlowRate; + furnace.MaxHeatAirVolFlow = furnace.ActualFanVolFlowRate; + furnace.DesignFanVolFlowRate = furnace.ActualFanVolFlowRate; } } - if (thisFurnace.FanSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisFurnace.FanSchedPtr, ">=", 0.0, "<=", 0.0)) { + if (furnace.FanSchedPtr > 0) { + if (!ScheduleManager::CheckScheduleValueMinMax(state, furnace.FanSchedPtr, ">=", 0.0, "<=", 0.0)) { // set air flow control mode: // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off // UseCompressorOffFlow = operate at value specified by user // AirFlowControl only valid if fan opmode = ContFanCycComp - if (thisFurnace.MaxNoCoolHeatAirVolFlow == 0.0) { - thisFurnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; + if (furnace.MaxNoCoolHeatAirVolFlow == 0.0) { + furnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; } else { - thisFurnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOffFlow; + furnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOffFlow; } } } - if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - errFlag = false; - if (thisFurnace.bIsIHP) { - thisFurnace.CoolingCoilIndex = IntegratedHeatPump::GetCoilIndexIHP(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilName; - thisFurnace.DesignCoolingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); - } else { - thisFurnace.DesignCoolingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } // Set heating convergence tolerance - thisFurnace.HeatingConvergenceTolerance = 0.001; + furnace.HeatingConvergenceTolerance = 0.001; // Set cooling convergence tolerance - thisFurnace.CoolingConvergenceTolerance = 0.001; + furnace.CoolingConvergenceTolerance = 0.001; // set minimum outdoor temperature for compressor operation SetMinOATCompressor(state, FurnaceNum, cCurrentModuleObject, ErrorsFound); @@ -2623,22 +2032,10 @@ namespace Furnaces { for (int HeatPumpNum = 1; HeatPumpNum <= NumHeatPump; ++HeatPumpNum) { CurrentModuleObject = "AirLoopHVAC:UnitaryHeatPump:AirToAir"; - FanInletNode = 0; - FanOutletNode = 0; - CoolingCoilInletNode = 0; - CoolingCoilOutletNode = 0; - HeatingCoilInletNode = 0; - HeatingCoilOutletNode = 0; - SupHeatCoilInletNode = 0; - SupHeatCoilOutletNode = 0; - CoolingCoilType = ' '; - CoolingCoilName = ' '; - HeatingCoilType = ' '; - HeatingCoilName = ' '; FurnaceNum = NumHeatOnly + NumHeatCool + NumUnitaryHeatOnly + NumUnitaryHeatCool + HeatPumpNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - thisFurnace.iterationMode.allocate(3); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + furnace.iterationMode.allocate(3); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -2656,23 +2053,23 @@ namespace Furnaces { GlobalNames::VerifyUniqueInterObjectName( state, state.dataFurnaces->UniqueFurnaceNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - thisFurnace.type = HVAC::UnitarySysType::Unitary_HeatPump_AirToAir; - thisFurnace.Name = Alphas(1); + furnace.type = HVAC::UnitarySysType::Unitary_HeatPump_AirToAir; + furnace.Name = Alphas(1); - ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisFurnace.Name}; + ErrorObjectHeader eoh{routineName, CurrentModuleObject, furnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + furnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { + furnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); + if (furnace.SchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); ErrorsFound = true; } } - thisFurnace.FurnaceInletNodeNum = + furnace.FurnaceInletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -2683,7 +2080,7 @@ namespace Furnaces { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisFurnace.FurnaceOutletNodeNum = + furnace.FurnaceOutletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -2697,20 +2094,20 @@ namespace Furnaces { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); // Get the Controlling Zone or Location of the Furnace Thermostat - thisFurnace.ControlZoneNum = Util::FindItemInList(Alphas(5), state.dataHeatBal->Zone); - if (thisFurnace.ControlZoneNum == 0) { + furnace.ControlZoneNum = Util::FindItemInList(Alphas(5), state.dataHeatBal->Zone); + if (furnace.ControlZoneNum == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(5), Alphas(5))); ErrorsFound = true; } // Get the node number for the zone with the thermostat - if (thisFurnace.ControlZoneNum > 0) { + if (furnace.ControlZoneNum > 0) { AirNodeFound = false; AirLoopFound = false; - int ControlledZoneNum = thisFurnace.ControlZoneNum; + int ControlledZoneNum = furnace.ControlZoneNum; // Find the controlled zone number for the specified thermostat location - thisFurnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; + furnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; // Determine if furnace is on air loop served by the thermostat location specified for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++zoneInNode) { int AirLoopNumber = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNodeAirLoopNum(zoneInNode); @@ -2726,17 +2123,17 @@ namespace Furnaces { CurrentModuleObject)) continue; AirLoopFound = true; - thisFurnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); + furnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); break; } if (AirLoopFound) break; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } } @@ -2761,426 +2158,266 @@ namespace Furnaces { // Get fan data FanName = Alphas(7); - thisFurnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(6))); + furnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(6))); - if (thisFurnace.fanType == HVAC::FanType::OnOff || thisFurnace.fanType == HVAC::FanType::Constant) { + if (furnace.fanType == HVAC::FanType::OnOff || furnace.fanType == HVAC::FanType::Constant) { - if ((thisFurnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { + if ((furnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(7), FanName); ErrorsFound = true; } else { - auto *fan = state.dataFans->fans(thisFurnace.FanIndex); - FanInletNode = fan->inletNodeNum; - FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; - thisFurnace.ActualFanVolFlowRate = fan->maxAirFlowRate; + auto *fan = state.dataFans->fans(furnace.FanIndex); + furnace.FanInletNode = fan->inletNodeNum; + furnace.FanOutletNode = fan->outletNodeNum; + furnace.FanAvailSchedPtr = fan->availSchedNum; + furnace.ActualFanVolFlowRate = fan->maxAirFlowRate; } } // Get heating coil type and name data - HeatingCoilType = Alphas(8); - HeatingCoilName = Alphas(9); - - errFlag = false; - - if (Util::SameString(HeatingCoilType, "COIL:HEATING:DX:VARIABLESPEED") || - Util::SameString(HeatingCoilType, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) { - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingAirToAirVariableSpeed; - if (Util::SameString(HeatingCoilType, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) thisFurnace.bIsIHP = true; - } else { - thisFurnace.HeatingCoilType_Num = DXCoils::GetCoilTypeNum(state, HeatingCoilType, HeatingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; + furnace.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(8))); + furnace.HeatCoilName = Alphas(9); + + if (Util::SameString(Alphas(8), "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) { + furnace.isIHP = true; + furnace.ihpName = furnace.HeatCoilName; + furnace.ihpNum = IntegratedHeatPump::GetCoilIndexIHP(state, furnace.ihpName); + if (furnace.ihpNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), furnace.ihpName); + ErrorsFound = true; + } else { + // HeatCoilName and HeatCoilType now reference the + // VariableSpeedCoil in the IHP, not the enclosing + // IHP + furnace.heatCoilType = HVAC::CoilType::HeatingAirToAirVariableSpeed; + furnace.HeatCoilName = state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).SHCoilName; + } } - if (thisFurnace.HeatingCoilType_Num == HVAC::CoilDX_HeatingEmpirical) { - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (furnace.heatCoilType == HVAC::CoilType::DXHeatingEmpirical) { + furnace.HeatCoilNum = DXCoils::GetDXCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), furnace.HeatCoilName); ErrorsFound = true; - - } else { // mine data from DX heating coil - - DXCoils::GetDXCoilIndex(state, HeatingCoilName, thisFurnace.HeatingCoilIndex, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("...occurs {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Heating Coil Node Names - errFlag = false; - HeatingCoilInletNode = DXCoils::GetCoilInletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilOutletNode = DXCoils::GetCoilOutletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the design heating capacity - errFlag = false; - thisFurnace.DesignHeatingCapacity = DXCoils::GetCoilCapacity(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} ={}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - } // IF (IsNotOK) THEN - } else if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else { + furnace.HeatCoilAirInletNode = DXCoils::GetCoilInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = DXCoils::GetCoilOutletNode(state, furnace.HeatCoilNum); + furnace.DesignHeatingCapacity = DXCoils::GetCoilCapacity(state, furnace.HeatCoilNum); + } + + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + // At this point, it shouldn't matter whether the coil is embedded in an IHP or not + furnace.HeatCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), furnace.HeatCoilName); ErrorsFound = true; } else { - if (thisFurnace.bIsIHP) { - thisFurnace.HeatingCoilIndex = IntegratedHeatPump::GetCoilIndexIHP(state, HeatingCoilType, HeatingCoilName, errFlag); - IHPCoilIndex = thisFurnace.HeatingCoilIndex; - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(IHPCoilIndex).SHCoilName; - HeatingCoilInletNode = - VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, "COIL:HEATING:DX:VARIABLESPEED", IHPCoilName, errFlag); - HeatingCoilOutletNode = - VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, "COIL:HEATING:DX:VARIABLESPEED", IHPCoilName, errFlag); - } else { - thisFurnace.HeatingCoilIndex = - VariableSpeedCoils::GetCoilIndexVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - } + furnace.HeatCoilAirInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, furnace.HeatCoilNum); + furnace.DesignHeatingCapacity = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, furnace.HeatCoilNum); } } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(8), Alphas(8))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(8), Alphas(8)); ErrorsFound = true; } // Get Cooling Coil Information if available - CoolingCoilType = Alphas(10); - CoolingCoilName = Alphas(11); - - if (Util::SameString(CoolingCoilType, "COIL:COOLING:DX:VARIABLESPEED") || - Util::SameString(CoolingCoilType, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) { - thisFurnace.CoolingCoilType_Num = HVAC::Coil_CoolingAirToAirVariableSpeed; - if (Util::SameString(CoolingCoilType, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) thisFurnace.bIsIHP = true; - } - - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); + furnace.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(10))); + furnace.CoolCoilName = Alphas(11); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - - } else { // mine data from DX cooling coil - - errFlag = false; - PrintMessage = false; + if (Util::SameString(Alphas(10), "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE")) { - if (thisFurnace.CoolingCoilType_Num != HVAC::Coil_CoolingAirToAirVariableSpeed) { - thisFurnace.CoolingCoilType_Num = DXCoils::GetCoilTypeNum(state, CoolingCoilType, CoolingCoilName, errFlag, PrintMessage); - } - - // If coil type not found, check to see if a HX assisted cooling coil is used. - if (thisFurnace.CoolingCoilType_Num == 0) { - errFlag = false; - PrintMessage = false; - thisFurnace.CoolingCoilType_Num = - HVACHXAssistedCoolingCoil::GetCoilGroupTypeNum(state, CoolingCoilType, CoolingCoilName, errFlag, PrintMessage); - } - - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { - - // Get the cooling coil node numbers - errFlag = false; - DXCoils::GetDXCoilIndex(state, CoolingCoilName, thisFurnace.CoolingCoilIndex, errFlag); - CoolingCoilInletNode = DXCoils::GetCoilInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = DXCoils::GetCoilOutletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the DX cooling coil design capacity - errFlag = false; - thisFurnace.DesignCoolingCapacity = DXCoils::GetCoilCapacity(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - } else if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { - - // Get the cooling coil node numbers - errFlag = false; - HVACHXAssistedCoolingCoil::GetHXDXCoilIndex(state, CoolingCoilName, thisFurnace.CoolingCoilIndex, errFlag); - CoolingCoilInletNode = HVACHXAssistedCoolingCoil::GetCoilInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = HVACHXAssistedCoolingCoil::GetCoilOutletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the heat exchanger assisted cooling coil design capacity - errFlag = false; - thisFurnace.DesignCoolingCapacity = HVACHXAssistedCoolingCoil::GetCoilCapacity(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // get the actual index to the DX cooling coil object - DXCoilIndex = HVACHXAssistedCoolingCoil::GetActualDXCoilIndex(state, CoolingCoilType, CoolingCoilName, ErrorsFound); - thisFurnace.ActualDXCoilIndexForHXAssisted = DXCoilIndex; - - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - // BOS ADDED, AUG/2012, VARIIABLE SPEED DX COOLING COIL - // Furnace(FurnaceNum)%DXCoolCoilType = 'COIL:COOLING:DX:VARIABLESPEED' - // Furnace(FurnaceNum)%DXCoolCoilName = CoolingCoilName - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } else { - errFlag = false; - if (thisFurnace.bIsIHP) { - thisFurnace.CoolingCoilIndex = IntegratedHeatPump::GetCoilIndexIHP(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilName; - } else { - thisFurnace.CoolingCoilIndex = - VariableSpeedCoils::GetCoilIndexVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - IHPCoilName = CoolingCoilName; - } - - if (errFlag) { - ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - if (thisFurnace.bIsIHP) { - CoolingCoilInletNode = - VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); - CoolingCoilOutletNode = - VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, IHPCoilName, errFlag); - } else { - CoolingCoilInletNode = - VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = - VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, CoolingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } - } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(10), Alphas(10))); + // Is this a legitimate check? Both heating and cooling colis have to be the same integrated heat pump? + if (!furnace.isIHP) { + ShowSevereCustom(state, eoh, "Cooling Coil is an integrated heat pump, but heating coil is not."); ErrorsFound = true; + } else if (!Util::SameString(furnace.CoolCoilName, furnace.ihpName)) { + ShowSevereCustom(state, eoh, "Cooling Coil and cooling coil name different integrated heat pumps."); + ErrorsFound = true; + } else { + furnace.coolCoilType = HVAC::CoilType::CoolingAirToAirVariableSpeed; } } - - if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed && - thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { - // Furnace(FurnaceNum)%WatertoAirHPType = WatertoAir_VarSpeedEquationFit - if (thisFurnace.bIsIHP) { - VariableSpeedCoils::SetVarSpeedCoilData(state, - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilIndex, - ErrorsFound, - _, - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SHCoilIndex); + + // If coil type not found, check to see if a HX assisted cooling coil is used. + // Is this actually needed? +#ifdef GET_OUT + if (furnace.coolCoilType == HVAC::CoilType::Invalid) { + int hxCoilIndex = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, furnace.CoolCoilName); + if (hxCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), furnace.CoolCoilName); + ErrorsFound = true; } else { - VariableSpeedCoils::SetVarSpeedCoilData(state, thisFurnace.CoolingCoilIndex, ErrorsFound, _, thisFurnace.HeatingCoilIndex); + furnace.coolCoilType = HVACHXAssistedCoolingCoil::GetHXCoilType(state, furnace.CoolCoilName); } } - - // Get supplemental heating coil information - SuppHeatCoilType = Alphas(12); - SuppHeatCoilName = Alphas(13); - thisFurnace.SuppHeatCoilType = SuppHeatCoilType; - thisFurnace.SuppHeatCoilName = SuppHeatCoilName; - errFlag = false; - if (Util::SameString(SuppHeatCoilType, "Coil:Heating:Fuel") || Util::SameString(SuppHeatCoilType, "Coil:Heating:Electric")) { - - thisFurnace.SuppHeatCoilType_Num = HeatingCoils::GetHeatingCoilTypeNum(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); +#endif // GET_OUT + + // Single-speed DX Coil + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + furnace.CoolCoilNum = DXCoils::GetDXCoilIndex(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.CoolCoilName); ErrorsFound = true; } else { - IsNotOK = false; - ValidateComponent(state, SuppHeatCoilType, SuppHeatCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("In {} \"{}\"", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - - } else { // mine data from the supplemental heating coil - - HeatingCoils::GetCoilIndex(state, SuppHeatCoilName, thisFurnace.SuppHeatCoilIndex, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Inlet Node Number - errFlag = false; - SupHeatCoilInletNode = HeatingCoils::GetCoilInletNode(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Outlet Node Number - errFlag = false; - SupHeatCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the supplemental heating coil design capacity - errFlag = false; - thisFurnace.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - } // IF (IsNotOK) THEN - } - } else if (Util::SameString(SuppHeatCoilType, "Coil:Heating:Water")) { - thisFurnace.SuppHeatCoilType_Num = HVAC::Coil_HeatingWater; - ValidateComponent(state, SuppHeatCoilType, SuppHeatCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.CoolCoilAirInletNode = DXCoils::GetCoilInletNode(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = DXCoils::GetCoilOutletNode(state, furnace.CoolCoilNum); + furnace.DesignCoolingCapacity = DXCoils::GetCoilCapacity(state, furnace.CoolCoilNum); + furnace.CondenserNodeNum = DXCoils::GetCoilCondenserInletNode(state, furnace.CoolCoilNum); + } + + } else if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { + // hxCoolCoil are the HXAssisted object parameters + // CoolCoil variables become the embedded DXCoil parameters + furnace.hxCoolCoilType = furnace.coolCoilType; + furnace.hxCoolCoilName = furnace.CoolCoilName; + furnace.hxCoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, furnace.hxCoolCoilName); + if (furnace.hxCoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.hxCoolCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - // Get the Heating Coil water Inlet or control Node number - errFlag = false; - thisFurnace.SuppCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil hot water max volume flow rate - errFlag = false; - thisFurnace.MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil Inlet Node - errFlag = false; - SupHeatCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirInletNode = SupHeatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil Outlet Node - errFlag = false; - SupHeatCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirOutletNode = SupHeatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); + } else { + furnace.coolCoilType = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilType(state, furnace.hxCoolCoilNum); + furnace.CoolCoilName = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilName(state, furnace.hxCoolCoilNum); + furnace.CoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilIndex(state, furnace.hxCoolCoilNum); + + furnace.CoolCoilAirInletNode = DXCoils::GetCoilInletNode(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = DXCoils::GetCoilOutletNode(state, furnace.CoolCoilNum); + furnace.DesignCoolingCapacity = DXCoils::GetCoilCapacity(state, furnace.CoolCoilNum); + + furnace.CondenserNodeNum = DXCoils::GetCoilCondenserInletNode(state, furnace.CoolCoilNum); + } + + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + // BOS ADDED, AUG/2012, VARIIABLE SPEED DX COOLING COIL + // Furnace(FurnaceNum)%DXCoolCoilType = 'COIL:COOLING:DX:VARIABLESPEED' + // Furnace(FurnaceNum)%DXCoolCoilName = CoolingCoilName + if (furnace.isIHP) { + furnace.ihpNum = IntegratedHeatPump::GetCoilIndexIHP(state, furnace.ihpName); + if (furnace.ihpNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.ihpName); ErrorsFound = true; + } else { + furnace.CoolCoilName = state.dataIntegratedHP->IntegratedHeatPumps(furnace.CoolCoilNum).SCCoilName; + furnace.CoolCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, format("{}.SCCoilName", furnace.ihpName), furnace.CoolCoilName); + ErrorsFound = true; + } } - errFlag = false; - HVACControllers::CheckCoilWaterInletNode(state, thisFurnace.CoilControlNode, errFlag); - if (!errFlag) { // then did find a controller so that is bad - ShowSevereError(state, - format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, thisFurnace.Name)); - ShowContinueError(state, "Hot water coils are controlled directly by unitary and furnace systems."); - ShowContinueError(state, "No water coil controller should be input for the coil."); + } else { // furnace.bIsHP + furnace.CoolCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.CoolCoilName); ErrorsFound = true; } } - } else if (Util::SameString(SuppHeatCoilType, "Coil:Heating:Steam")) { - thisFurnace.SuppHeatCoilType_Num = HVAC::Coil_HeatingSteam; - ValidateComponent(state, SuppHeatCoilType, SuppHeatCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } else { // mine data from heating coil object + // Shoud be properly set up whether this is an IHP or not + if (furnace.CoolCoilNum != 0) { + furnace.CoolCoilAirInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, furnace.CoolCoilNum); + furnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, furnace.CoolCoilNum); + furnace.DesignCoolingCapacity = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, furnace.CoolCoilNum); + } + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(10), Alphas(10)); + ErrorsFound = true; + } - errFlag = false; - thisFurnace.SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", SuppHeatCoilName, errFlag); - if (thisFurnace.SuppHeatCoilIndex == 0) { - ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(12), SuppHeatCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } + if (furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed && + furnace.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + // Furnace(FurnaceNum)%WatertoAirHPType = WatertoAir_VarSpeedEquationFit + if (furnace.isIHP) { + VariableSpeedCoils::SetVarSpeedCoilData(state, + state.dataIntegratedHP->IntegratedHeatPumps(furnace.CoolCoilNum).SCCoilIndex, + ErrorsFound, + _, + state.dataIntegratedHP->IntegratedHeatPumps(furnace.CoolCoilNum).SHCoilIndex); + } else { + VariableSpeedCoils::SetVarSpeedCoilData(state, furnace.CoolCoilNum, ErrorsFound, _, furnace.HeatCoilNum); + } + } - // Get the Heating Coil steam inlet node number - errFlag = false; - thisFurnace.SuppCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } + // Get supplemental heating coil information + furnace.suppHeatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(12))); + furnace.SuppCoilName = Alphas(13); - // Get the Heating Coil steam max volume flow rate - thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag); - if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - SteamDensity = - Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); - thisFurnace.MaxSuppCoilFluidFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag) * SteamDensity; - } + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + furnace.suppHeatCoilType == HVAC::CoilType::HeatingElectric) { - // Get the Heating Coil Inlet Node - errFlag = false; - SupHeatCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisFurnace.SuppHeatCoilIndex, SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirInletNode = SupHeatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } + furnace.SuppCoilNum = HeatingCoils::GetCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.SuppCoilName); + ErrorsFound = true; + } else { + furnace.SuppCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, furnace.SuppCoilNum); + furnace.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, furnace.SuppCoilNum); + } - // Get the Heating Coil Outlet Node - errFlag = false; - SupHeatCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisFurnace.SuppHeatCoilIndex, SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirOutletNode = SupHeatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); + } else if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingWater) { + furnace.SuppCoilNum = WaterCoils::GetWaterCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.SuppCoilName); + ErrorsFound = true; + } else { + furnace.SuppCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, furnace.SuppCoilNum); + furnace.MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.SuppCoilNum); + furnace.SuppCoilAirInletNode = WaterCoils::GetCoilInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, furnace.SuppCoilNum); + + HVACControllers::CheckCoilWaterInletNode(state, furnace.SuppCoilControlNode, errFlag); + if (!errFlag) { // then did find a controller so that is bad + ShowSevereError(state, + format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, furnace.Name)); + ShowContinueError(state, "Hot water coils are controlled directly by unitary and furnace systems."); + ShowContinueError(state, "No water coil controller should be input for the coil."); ErrorsFound = true; } } + } else if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { + furnace.SuppCoilNum = SteamCoils::GetSteamCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.SuppCoilName); + ErrorsFound = true; + } else { + furnace.SuppCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, furnace.SuppCoilNum); + furnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.SuppCoilNum); + if (furnace.MaxSuppCoilFluidFlow > 0.0) { + furnace.MaxSuppCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, getAirLoopHVACHeatCoolInput); + } + + furnace.SuppCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, furnace.SuppCoilNum); + } + } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(12), Alphas(12))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(12), Alphas(12)); ErrorsFound = true; } // IF (Furnace(FurnaceNum)%HeatingCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc. - thisFurnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(14))); - assert(thisFurnace.fanPlace != HVAC::FanPlace::Invalid); + furnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(14))); + assert(furnace.fanPlace != HVAC::FanPlace::Invalid); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(15)); - if (!lAlphaBlanks(15) && thisFurnace.FanSchedPtr == 0) { + furnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(15)); + if (!lAlphaBlanks(15) && furnace.FanSchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(15), Alphas(15))); ErrorsFound = true; } else if (lAlphaBlanks(15)) { - thisFurnace.fanOp = HVAC::FanOp::Cycling; - if (thisFurnace.fanType != HVAC::FanType::OnOff) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, thisFurnace.Name)); + furnace.fanOp = HVAC::FanOp::Cycling; + if (furnace.fanType != HVAC::FanType::OnOff) { + ShowSevereError(state, format("{} = {}", CurrentModuleObject, furnace.Name)); ShowContinueError(state, format("{} = {}", cAlphaFields(6), Alphas(6))); ShowContinueError(state, format("Fan type must be Fan:OnOff when {} = Blank.", cAlphaFields(15))); ErrorsFound = true; } } - if (thisFurnace.fanType == HVAC::FanType::Constant) { - if (thisFurnace.FanSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisFurnace.FanSchedPtr, ">", 0.0, "<=", 1.0)) { + if (furnace.fanType == HVAC::FanType::Constant) { + if (furnace.FanSchedPtr > 0) { + if (!ScheduleManager::CheckScheduleValueMinMax(state, furnace.FanSchedPtr, ">", 0.0, "<=", 1.0)) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("For {} = {}", cAlphaFields(7), Alphas(7))); ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); @@ -3195,26 +2432,24 @@ namespace Furnaces { if (Util::SameString(Alphas(16), "None") || Util::SameString(Alphas(16), "Multimode") || Util::SameString(Alphas(16), "CoolReheat")) { AirNodeFound = false; if (Util::SameString(Alphas(16), "Multimode")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::Multimode; - thisFurnace.Humidistat = true; - if (thisFurnace.CoolingCoilType_Num != HVAC::CoilDX_CoolingHXAssisted) { + furnace.DehumidControlType_Num = DehumidificationControlMode::Multimode; + furnace.Humidistat = true; + if (furnace.coolCoilType != HVAC::CoilType::DXCoolingHXAssisted) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(16), Alphas(16))); ShowContinueError(state, "Multimode control must be used with a Heat Exchanger Assisted Cooling Coil."); ErrorsFound = true; } + } else if (Util::SameString(Alphas(16), "CoolReheat")) { + furnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; + furnace.Humidistat = true; + } else if (Util::SameString(Alphas(16), "None")) { + furnace.DehumidControlType_Num = DehumidificationControlMode::None; + furnace.Humidistat = false; } - if (Util::SameString(Alphas(16), "CoolReheat")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; - thisFurnace.Humidistat = true; - } - if (Util::SameString(Alphas(16), "None")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; - thisFurnace.Humidistat = false; - } - if (thisFurnace.Humidistat) { + if (furnace.Humidistat) { for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) { - if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } if (!AirNodeFound) { @@ -3230,114 +2465,83 @@ namespace Furnaces { ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(16), Alphas(16))); ErrorsFound = true; } else { - thisFurnace.Humidistat = false; - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; + furnace.Humidistat = false; + furnace.DehumidControlType_Num = DehumidificationControlMode::None; } } // Check node names for child components - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - if (FanInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, - "When a blow through fan is specified, the fan inlet node name must be the same as the unitary system inlet node name."); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); - ShowContinueError(state, - format("...Unitary system inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.FanInletNode != furnace.FurnaceInletNode) { + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the fan inlet node name must be the same as the unitary system inlet node name."); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); + ShowContinueError(state, format("...Unitary system inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); ErrorsFound = true; } - if (FanOutletNode != CoolingCoilInletNode) { + if (furnace.FanOutletNode != furnace.CoolCoilAirInletNode) { ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, - "When a blow through fan is specified, the fan outlet node name must be the same as the cooling coil inlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); + ShowContinueError(state, "When a blow through fan is specified, the fan outlet node name must be the same as the cooling coil inlet node name."); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + if (furnace.CoolCoilAirOutletNode != furnace.HeatCoilAirInletNode) { + ShowSevereCustom(state, eoh, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != SupHeatCoilInletNode) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - "When a blow through fan is specified, the heating coil outlet node name must be the same as the supplemental " - "heating coil inlet node name."); - ShowContinueError( - state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError( - state, format("...Supplemental heating coil inlet node name = {}", state.dataLoopNodes->NodeID(SupHeatCoilInletNode))); + if (furnace.HeatCoilAirOutletNode != furnace.SuppCoilAirInletNode) { + ShowSevereCustom(state, eoh, "When a blow through fan is specified, the heating coil outlet node name must be the same as the supplemental " + "heating coil inlet node name."); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Supplemental heating coil inlet node name = {}", s_node->NodeID(furnace.SuppCoilAirInletNode))); ErrorsFound = true; } - if (SupHeatCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - "The supplemental heating coil outlet node name must be the same as the unitary system outlet node name."); - ShowContinueError( - state, format("...Supplemental heating coil outlet node name = {}", state.dataLoopNodes->NodeID(SupHeatCoilOutletNode))); - ShowContinueError( - state, - format("...Unitary system outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.SuppCoilAirOutletNode != furnace.FurnaceOutletNode) { + ShowSevereCustom(state, eoh, "The supplemental heating coil outlet node name must be the same as the unitary system outlet node name."); + ShowContinueError(state, format("...Supplemental heating coil outlet node name = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); + ShowContinueError(state, format("...Unitary system outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); ErrorsFound = true; } } else { - if (CoolingCoilInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - "When a draw through fan is specified, the cooling coil inlet node name must be the same as the unitary system " - "inlet node name."); - ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); - ShowContinueError(state, - format("...Unitary system inlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); + if (furnace.CoolCoilAirInletNode != furnace.FurnaceInletNode) { + ShowSevereCustom(state, eoh, + "When a draw through fan is specified, the cooling coil inlet node name must be the same as the unitary system " + "inlet node name."); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); + ShowContinueError(state, format("...Unitary system inlet node name = {}", s_node->NodeID(furnace.FurnaceInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + if (furnace.CoolCoilAirOutletNode != furnace.HeatCoilAirInletNode) { + ShowSevereCustom(state, eoh, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != FanInletNode) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError( - state, - "When a draw through fan is specified, the heating coil outlet node name must be the same as the fan inlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(FanInletNode))); + if (furnace.HeatCoilAirOutletNode != furnace.FanInletNode) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the heating coil outlet node name must be the same as the fan inlet node name."); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(furnace.FanInletNode))); ErrorsFound = true; } - if (FanOutletNode != SupHeatCoilInletNode) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - "When a draw through fan is specified, the fan outlet node name must be the same as the supplemental heating " - "coil inlet node name."); - ShowContinueError(state, - format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError( - state, format("...Supplemental heating coil inlet node name = {}", state.dataLoopNodes->NodeID(SupHeatCoilInletNode))); + if (furnace.FanOutletNode != furnace.SuppCoilAirInletNode) { + ShowSevereCustom(state, eoh, "When a draw through fan is specified, the fan outlet node name must be the same as the supplemental heating " + "coil inlet node name."); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("...Supplemental heating coil inlet node name = {}", s_node->NodeID(furnace.SuppCoilAirInletNode))); ErrorsFound = true; } - if (SupHeatCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, format("For {} \"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - "The supplemental heating coil outlet node name must be the same as the unitary system outlet node name."); - ShowContinueError( - state, format("...Supplemental heating coil outlet node name = {}", state.dataLoopNodes->NodeID(SupHeatCoilOutletNode))); - ShowContinueError( - state, - format("...Unitary system outlet node name = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.SuppCoilAirOutletNode != furnace.FurnaceOutletNode) { + ShowSevereCustom(state, eoh, "The supplemental heating coil outlet node name must be the same as the unitary system outlet node name."); + ShowContinueError(state, format("...Supplemental heating coil outlet node name = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); + ShowContinueError(state, format("...Unitary system outlet node name = {}", s_node->NodeID(furnace.FurnaceOutletNode))); ErrorsFound = true; } } // Add component sets array - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { CompSetFanInlet = Alphas(3); CompSetCoolInlet = "UNDEFINED"; } else { @@ -3347,14 +2551,14 @@ namespace Furnaces { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(6), Alphas(7), CompSetFanInlet, "UNDEFINED"); // Add DX cooling coil to component sets array - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { BranchNodeConnections::SetUpCompSets( state, CurrentModuleObject, Alphas(1), Alphas(10), Alphas(11) + " Cooling Coil", CompSetCoolInlet, "UNDEFINED"); } else { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(10), Alphas(11), CompSetCoolInlet, "UNDEFINED"); } // Add DX heating coil to component sets array - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { BranchNodeConnections::SetUpCompSets( state, CurrentModuleObject, Alphas(1), Alphas(8), Alphas(9) + " Heating Coil", "UNDEFINED", "UNDEFINED"); } else { @@ -3364,173 +2568,99 @@ namespace Furnaces { // Add supplemental heating coil to component sets array BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(12), Alphas(13), "UNDEFINED", Alphas(4)); - thisFurnace.MaxCoolAirVolFlow = Numbers(1); - if (thisFurnace.MaxCoolAirVolFlow <= 0 && thisFurnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { + furnace.MaxCoolAirVolFlow = Numbers(1); + if (furnace.MaxCoolAirVolFlow <= 0 && furnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {:.7T}", cNumericFields(1), Numbers(1))); ErrorsFound = true; } - thisFurnace.MaxHeatAirVolFlow = Numbers(2); - if (thisFurnace.MaxHeatAirVolFlow <= 0 && thisFurnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { + furnace.MaxHeatAirVolFlow = Numbers(2); + if (furnace.MaxHeatAirVolFlow <= 0 && furnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {:.7T}", cNumericFields(2), Numbers(2))); ErrorsFound = true; } - thisFurnace.MaxNoCoolHeatAirVolFlow = Numbers(3); - if (thisFurnace.MaxNoCoolHeatAirVolFlow < 0 && thisFurnace.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) { + furnace.MaxNoCoolHeatAirVolFlow = Numbers(3); + if (furnace.MaxNoCoolHeatAirVolFlow < 0 && furnace.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {:.7T}", cNumericFields(3), Numbers(3))); ErrorsFound = true; } - if (thisFurnace.FanSchedPtr > 0) { + if (furnace.FanSchedPtr > 0) { if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisFurnace.FanSchedPtr, ">=", 0.0, "<=", 0.0)) { // Autodesk:Note Range is 0 to 0? + state, furnace.FanSchedPtr, ">=", 0.0, "<=", 0.0)) { // Autodesk:Note Range is 0 to 0? // set air flow control mode: // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off // UseCompressorOffFlow = operate at value specified by user // AirFlowControl only valid if fan opmode = ContFanCycComp - if (thisFurnace.MaxNoCoolHeatAirVolFlow == 0.0) { - thisFurnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; + if (furnace.MaxNoCoolHeatAirVolFlow == 0.0) { + furnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; } else { - thisFurnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOffFlow; + furnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOffFlow; } } } if (Numbers(1) != DataSizing::AutoSize && Numbers(2) != DataSizing::AutoSize && Numbers(3) != DataSizing::AutoSize) { - thisFurnace.DesignFanVolFlowRate = max(Numbers(1), Numbers(2), Numbers(3)); + furnace.DesignFanVolFlowRate = max(Numbers(1), Numbers(2), Numbers(3)); } else { - thisFurnace.DesignFanVolFlowRate = DataSizing::AutoSize; + furnace.DesignFanVolFlowRate = DataSizing::AutoSize; } - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { - errFlag = false; - - if (thisFurnace.bIsIHP) { - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SHCoilName; - thisFurnace.MaxHeatAirVolFlow = - VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, "COIL:HEATING:DX:VARIABLESPEED", IHPCoilName, errFlag); - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilName; - thisFurnace.MaxCoolAirVolFlow = - VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); - } else { - thisFurnace.MaxHeatAirVolFlow = - VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - thisFurnace.MaxCoolAirVolFlow = - VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (furnace.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + // We've done the IHP thing, HeatCoilNum and CoolCoilNum should be properly set + furnace.MaxHeatAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, furnace.HeatCoilNum); + furnace.MaxCoolAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, furnace.CoolCoilNum); - thisFurnace.MaxNoCoolHeatAirVolFlow = min(thisFurnace.MaxHeatAirVolFlow, thisFurnace.MaxCoolAirVolFlow); - if (thisFurnace.MaxHeatAirVolFlow != DataSizing::AutoSize && thisFurnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { - thisFurnace.DesignFanVolFlowRate = max(thisFurnace.MaxHeatAirVolFlow, thisFurnace.MaxCoolAirVolFlow); + furnace.MaxNoCoolHeatAirVolFlow = min(furnace.MaxHeatAirVolFlow, furnace.MaxCoolAirVolFlow); + if (furnace.MaxHeatAirVolFlow != DataSizing::AutoSize && furnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { + furnace.DesignFanVolFlowRate = max(furnace.MaxHeatAirVolFlow, furnace.MaxCoolAirVolFlow); } else { - thisFurnace.DesignFanVolFlowRate = DataSizing::AutoSize; + furnace.DesignFanVolFlowRate = DataSizing::AutoSize; } } - if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.ActualFanVolFlowRate < thisFurnace.MaxCoolAirVolFlow && thisFurnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { + if (furnace.ActualFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.ActualFanVolFlowRate < furnace.MaxCoolAirVolFlow && furnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError( state, format("... air flow rate = {:.7T} in fan object {} is less than the maximum HVAC system air flow rate in cooling mode.", - thisFurnace.ActualFanVolFlowRate, + furnace.ActualFanVolFlowRate, FanName)); ShowContinueError(state, format(" The {} is reset to the fan flow rate and the simulation continues.", cNumericFields(1))); - thisFurnace.MaxCoolAirVolFlow = thisFurnace.ActualFanVolFlowRate; - thisFurnace.DesignFanVolFlowRate = thisFurnace.ActualFanVolFlowRate; + furnace.MaxCoolAirVolFlow = furnace.ActualFanVolFlowRate; + furnace.DesignFanVolFlowRate = furnace.ActualFanVolFlowRate; } - if (thisFurnace.ActualFanVolFlowRate < thisFurnace.MaxHeatAirVolFlow && thisFurnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { + if (furnace.ActualFanVolFlowRate < furnace.MaxHeatAirVolFlow && furnace.MaxHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError( state, format("... air flow rate = {:.7T} in fan object {} is less than the maximum HVAC system air flow rate in heating mode.", - thisFurnace.ActualFanVolFlowRate, + furnace.ActualFanVolFlowRate, FanName)); ShowContinueError(state, format(" The {} is reset to the fan flow rate and the simulation continues.", cNumericFields(2))); - thisFurnace.MaxHeatAirVolFlow = thisFurnace.ActualFanVolFlowRate; - thisFurnace.DesignFanVolFlowRate = thisFurnace.ActualFanVolFlowRate; + furnace.MaxHeatAirVolFlow = furnace.ActualFanVolFlowRate; + furnace.DesignFanVolFlowRate = furnace.ActualFanVolFlowRate; } } // Set heating convergence tolerance - thisFurnace.HeatingConvergenceTolerance = 0.001; - - // Mine heatpump outdoor condenser node from DX coil object - errFlag = false; - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { - thisFurnace.CondenserNodeNum = DXCoils::GetCoilCondenserInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (thisFurnace.bIsIHP) { - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilName; - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, IHPCoilName, errFlag); - } else { - thisFurnace.CondenserNodeNum = VariableSpeedCoils::GetVSCoilCondenserInletNode(state, CoolingCoilName, errFlag); - } - } else { - thisFurnace.CondenserNodeNum = - DXCoils::GetCoilCondenserInletNode(state, - "Coil:Cooling:DX:SingleSpeed", - HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, CoolingCoilType, CoolingCoilName, errFlag), - errFlag); - } - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { - errFlag = false; - if (thisFurnace.bIsIHP) { - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SHCoilName; - thisFurnace.DesignHeatingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, "Coil:Heating:DX:VariableSpeed", IHPCoilName, errFlag); - } else { - thisFurnace.DesignHeatingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } - - if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - errFlag = false; - if (thisFurnace.bIsIHP) { - IHPCoilName = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilName; - thisFurnace.DesignCoolingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, "COIL:COOLING:DX:VARIABLESPEED", IHPCoilName, errFlag); - } else { - thisFurnace.DesignCoolingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - } - - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } + furnace.HeatingConvergenceTolerance = 0.001; // Set cooling convergence tolerance - thisFurnace.CoolingConvergenceTolerance = 0.001; + furnace.CoolingConvergenceTolerance = 0.001; // Set the furnace max outlet temperature - thisFurnace.DesignMaxOutletTemp = Numbers(4); + furnace.DesignMaxOutletTemp = Numbers(4); // Set maximum supply air temperature for supplemental heating coil - thisFurnace.MaxOATSuppHeat = Numbers(5); + furnace.MaxOATSuppHeat = Numbers(5); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchDXHeatCoilSuppHiT, HeatingCoilName, thisFurnace.MaxOATSuppHeat); + state, state.dataOutRptPredefined->pdchDXHeatCoilSuppHiT, furnace.HeatCoilName, furnace.MaxOATSuppHeat); // set minimum outdoor temperature for compressor operation SetMinOATCompressor(state, FurnaceNum, cCurrentModuleObject, ErrorsFound); @@ -3541,22 +2671,10 @@ namespace Furnaces { for (int HeatPumpNum = 1; HeatPumpNum <= NumWaterToAirHeatPump; ++HeatPumpNum) { CurrentModuleObject = "AirLoopHVAC:UnitaryHeatPump:WaterToAir"; - FanInletNode = 0; - FanOutletNode = 0; - CoolingCoilInletNode = 0; - CoolingCoilOutletNode = 0; - HeatingCoilInletNode = 0; - HeatingCoilOutletNode = 0; - SupHeatCoilInletNode = 0; - SupHeatCoilOutletNode = 0; - CoolingCoilType = ' '; - CoolingCoilName = ' '; - HeatingCoilType = ' '; - HeatingCoilName = ' '; FurnaceNum = NumHeatOnly + NumHeatCool + NumUnitaryHeatOnly + NumUnitaryHeatCool + NumHeatPump + HeatPumpNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - thisFurnace.iterationMode.allocate(3); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + furnace.iterationMode.allocate(3); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -3574,23 +2692,23 @@ namespace Furnaces { GlobalNames::VerifyUniqueInterObjectName( state, state.dataFurnaces->UniqueFurnaceNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - thisFurnace.type = HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir; - thisFurnace.Name = Alphas(1); + furnace.type = HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir; + furnace.Name = Alphas(1); - ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisFurnace.Name}; + ErrorObjectHeader eoh{routineName, CurrentModuleObject, furnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + furnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { + furnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); + if (furnace.SchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); ErrorsFound = true; } } - thisFurnace.FurnaceInletNodeNum = + furnace.FurnaceInletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -3601,7 +2719,7 @@ namespace Furnaces { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisFurnace.FurnaceOutletNodeNum = + furnace.FurnaceOutletNode = NodeInputManager::GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -3615,20 +2733,20 @@ namespace Furnaces { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); // Get the Controlling Zone or Location of the Furnace Thermostat - thisFurnace.ControlZoneNum = Util::FindItemInList(Alphas(5), state.dataHeatBal->Zone); - if (thisFurnace.ControlZoneNum == 0) { + furnace.ControlZoneNum = Util::FindItemInList(Alphas(5), state.dataHeatBal->Zone); + if (furnace.ControlZoneNum == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(5), Alphas(5))); ErrorsFound = true; } // Get the node number for the zone with the thermostat - if (thisFurnace.ControlZoneNum > 0) { + if (furnace.ControlZoneNum > 0) { AirNodeFound = false; AirLoopFound = false; - int ControlledZoneNum = thisFurnace.ControlZoneNum; + int ControlledZoneNum = furnace.ControlZoneNum; // Find the controlled zone number for the specified thermostat location - thisFurnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; + furnace.NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode; // Determine if furnace is on air loop served by the thermostat location specified for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++zoneInNode) { int AirLoopNumber = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNodeAirLoopNum(zoneInNode); @@ -3644,17 +2762,17 @@ namespace Furnaces { CurrentModuleObject)) continue; AirLoopFound = true; - thisFurnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); + furnace.ZoneInletNode = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(zoneInNode); break; } if (AirLoopFound) break; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } for (TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } } @@ -3679,307 +2797,184 @@ namespace Furnaces { // Get fan data FanName = Alphas(7); errFlag = false; - thisFurnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(6))); + furnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(6))); - if (thisFurnace.fanType != HVAC::FanType::OnOff) { + if (furnace.fanType != HVAC::FanType::OnOff) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(6), Alphas(6))); ErrorsFound = true; - } else if ((thisFurnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { + } else if ((furnace.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(7), FanName); ErrorsFound = true; } else { - auto *fan = state.dataFans->fans(thisFurnace.FanIndex); - FanInletNode = fan->inletNodeNum; - FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; + auto *fan = state.dataFans->fans(furnace.FanIndex); + furnace.FanInletNode = fan->inletNodeNum; + furnace.FanOutletNode = fan->outletNodeNum; + furnace.FanAvailSchedPtr = fan->availSchedNum; } + furnace.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(8))); + furnace.HeatCoilName = Alphas(9); + // Get heating coil type and name data - if (Alphas(8) == "COIL:HEATING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION") { - HeatingCoilType = Alphas(8); - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingWaterToAirHP; - HeatingCoilName = Alphas(9); - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHP) { + furnace.HeatCoilNum = WaterToAirHeatPump::GetCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), furnace.HeatCoilName); ErrorsFound = true; } else { - thisFurnace.HeatingCoilIndex = WaterToAirHeatPump::GetCoilIndex(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilInletNode = WaterToAirHeatPump::GetCoilInletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilOutletNode = WaterToAirHeatPump::GetCoilOutletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - } - } else if (Alphas(8) == "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT") { - HeatingCoilType = Alphas(8); - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingWaterToAirHPSimple; - HeatingCoilName = Alphas(9); - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.HeatCoilAirInletNode = WaterToAirHeatPump::GetCoilInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = WaterToAirHeatPump::GetCoilOutletNode(state, furnace.HeatCoilNum); + } + + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPSimple) { + furnace.HeatCoilNum = WaterToAirHeatPumpSimple::GetCoilIndex(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), furnace.HeatCoilName); ErrorsFound = true; } else { - thisFurnace.HeatingCoilIndex = WaterToAirHeatPumpSimple::GetCoilIndex(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilInletNode = WaterToAirHeatPumpSimple::GetCoilInletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilOutletNode = WaterToAirHeatPumpSimple::GetCoilOutletNode(state, HeatingCoilType, HeatingCoilName, errFlag); - } - } else if (Alphas(8) == "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT") { - HeatingCoilType = Alphas(8); - thisFurnace.HeatingCoilType_Num = HVAC::Coil_HeatingWaterToAirHPVSEquationFit; - HeatingCoilName = Alphas(9); - ValidateComponent(state, HeatingCoilType, HeatingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.HeatCoilAirInletNode = WaterToAirHeatPumpSimple::GetCoilInletNode(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = WaterToAirHeatPumpSimple::GetCoilOutletNode(state, furnace.HeatCoilNum); + } + + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { + furnace.HeatCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, furnace.HeatCoilName); + if (furnace.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), furnace.HeatCoilName); ErrorsFound = true; } else { - thisFurnace.HeatingCoilIndex = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - HeatingCoilOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); + furnace.HeatCoilAirInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, furnace.HeatCoilNum); + furnace.HeatCoilAirOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, furnace.HeatCoilNum); } } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(8), Alphas(8))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(8), Alphas(8)); ErrorsFound = true; } // Get Cooling Coil Information if available - if (Alphas(10) == "COIL:COOLING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION") { - CoolingCoilType = Alphas(10); - thisFurnace.CoolingCoilType_Num = HVAC::Coil_CoolingWaterToAirHP; - CoolingCoilName = Alphas(11); - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(10))); + furnace.CoolCoilName = Alphas(11); + + if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHP) { + furnace.CoolCoilNum = WaterToAirHeatPump::GetCoilIndex(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.CoolCoilName); ErrorsFound = true; } else { - thisFurnace.CoolingCoilIndex = WaterToAirHeatPump::GetCoilIndex(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilInletNode = WaterToAirHeatPump::GetCoilInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = WaterToAirHeatPump::GetCoilOutletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - } - } else if (Alphas(10) == "COIL:COOLING:WATERTOAIRHEATPUMP:EQUATIONFIT") { - CoolingCoilType = Alphas(10); - thisFurnace.CoolingCoilType_Num = HVAC::Coil_CoolingWaterToAirHPSimple; - CoolingCoilName = Alphas(11); - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.CoolCoilAirInletNode = WaterToAirHeatPump::GetCoilInletNode(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = WaterToAirHeatPump::GetCoilOutletNode(state, furnace.CoolCoilNum); + } + + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPSimple) { + furnace.CoolCoilNum = WaterToAirHeatPumpSimple::GetCoilIndex(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.CoolCoilName); ErrorsFound = true; } else { - thisFurnace.CoolingCoilIndex = WaterToAirHeatPumpSimple::GetCoilIndex(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilInletNode = WaterToAirHeatPumpSimple::GetCoilInletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = WaterToAirHeatPumpSimple::GetCoilOutletNode(state, CoolingCoilType, CoolingCoilName, errFlag); - } - } else if (Alphas(10) == "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT") { - CoolingCoilType = Alphas(10); - thisFurnace.CoolingCoilType_Num = HVAC::Coil_CoolingWaterToAirHPVSEquationFit; - CoolingCoilName = Alphas(11); - ValidateComponent(state, CoolingCoilType, CoolingCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.CoolCoilAirInletNode = WaterToAirHeatPumpSimple::GetCoilInletNode(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = WaterToAirHeatPumpSimple::GetCoilOutletNode(state, furnace.CoolCoilNum); + } + + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { + furnace.CoolCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, furnace.CoolCoilName); + if (furnace.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.CoolCoilName); ErrorsFound = true; } else { - thisFurnace.CoolingCoilIndex = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - CoolingCoilOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); + furnace.CoolCoilAirInletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, furnace.CoolCoilNum); + furnace.CoolCoilAirOutletNode = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, furnace.CoolCoilNum); } } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(10), Alphas(10))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(10), Alphas(10)); ErrorsFound = true; } - thisFurnace.WaterCyclingMode = (NumAlphas < 18 || lAlphaBlanks(18)) + furnace.WaterCyclingMode = (NumAlphas < 18 || lAlphaBlanks(18)) ? HVAC::WaterFlow::Cycling : static_cast(getEnumValue(HVAC::waterFlowNamesUC, Alphas(18))); // end get water flow mode info - if (Alphas(8) == "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT" && Alphas(10) == "COIL:COOLING:WATERTOAIRHEATPUMP:EQUATIONFIT") { - thisFurnace.WatertoAirHPType = WAHPCoilType::Simple; + if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPSimple && + furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPSimple) { + furnace.WatertoAirHPType = WAHPCoilType::Simple; WaterToAirHeatPumpSimple::SetSimpleWSHPData( - state, thisFurnace.CoolingCoilIndex, ErrorsFound, thisFurnace.WaterCyclingMode, _, thisFurnace.HeatingCoilIndex); - } else if (Alphas(8) == "COIL:HEATING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION" && - Alphas(10) == "COIL:COOLING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION") { - thisFurnace.WatertoAirHPType = WAHPCoilType::ParEst; - } else if (Alphas(8) == "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT" && - Alphas(10) == "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT") { - thisFurnace.WatertoAirHPType = WAHPCoilType::VarSpeedEquationFit; - VariableSpeedCoils::SetVarSpeedCoilData(state, thisFurnace.CoolingCoilIndex, ErrorsFound, _, thisFurnace.HeatingCoilIndex); + state, furnace.CoolCoilNum, ErrorsFound, furnace.WaterCyclingMode, _, furnace.HeatCoilNum); + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHP && + furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHP) { + furnace.WatertoAirHPType = WAHPCoilType::ParEst; + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit && + furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { + furnace.WatertoAirHPType = WAHPCoilType::VarSpeedEquationFit; + VariableSpeedCoils::SetVarSpeedCoilData(state, furnace.CoolCoilNum, ErrorsFound, _, furnace.HeatCoilNum); } else { - ShowContinueError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, "Cooling coil and heating coil should be of same general type"); + ShowSevereCustom(state, eoh, "Cooling coil and heating coil should be of same general type"); ErrorsFound = true; } // Get supplemental heating coil information + furnace.suppHeatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(12))); + furnace.SuppCoilName = Alphas(13); - SuppHeatCoilType = Alphas(12); - SuppHeatCoilName = Alphas(13); - thisFurnace.SuppHeatCoilType = SuppHeatCoilType; - thisFurnace.SuppHeatCoilName = SuppHeatCoilName; - errFlag = false; - if (Util::SameString(SuppHeatCoilType, "Coil:Heating:Fuel") || Util::SameString(SuppHeatCoilType, "Coil:Heating:Electric")) { + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + furnace.suppHeatCoilType == HVAC::CoilType::HeatingElectric) { - thisFurnace.SuppHeatCoilType_Num = HeatingCoils::GetHeatingCoilTypeNum(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.SuppCoilNum = HeatingCoils::GetCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.SuppCoilName); ErrorsFound = true; } else { - IsNotOK = false; - ValidateComponent(state, SuppHeatCoilType, SuppHeatCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("In {} \"{}\"", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - - } else { // mine data from the supplemental heating coil - - HeatingCoils::GetCoilIndex(state, SuppHeatCoilName, thisFurnace.SuppHeatCoilIndex, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Inlet Node Number - errFlag = false; - SupHeatCoilInletNode = HeatingCoils::GetCoilInletNode(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Outlet Node Number - errFlag = false; - SupHeatCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - // Get the supplemental heating coil design capacity - errFlag = false; - thisFurnace.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - - } // IF (IsNotOK) THEN - } - } else if (Util::SameString(SuppHeatCoilType, "Coil:Heating:Water")) { - thisFurnace.SuppHeatCoilType_Num = HVAC::Coil_HeatingWater; - ValidateComponent(state, SuppHeatCoilType, SuppHeatCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + furnace.SuppCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, furnace.SuppCoilNum); + furnace.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, furnace.SuppCoilNum); + } + + } else if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingWater) { + furnace.SuppCoilNum = WaterCoils::GetWaterCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.SuppCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - // Get the Heating Coil water Inlet or control Node number - errFlag = false; - thisFurnace.SuppCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil hot water max volume flow rate - errFlag = false; - thisFurnace.MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil Inlet Node - errFlag = false; - SupHeatCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirInletNode = SupHeatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil Outlet Node - errFlag = false; - SupHeatCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirOutletNode = SupHeatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - errFlag = false; - HVACControllers::CheckCoilWaterInletNode(state, thisFurnace.CoilControlNode, errFlag); + } else { + furnace.SuppCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, furnace.SuppCoilNum); + furnace.MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.SuppCoilNum); + furnace.SuppCoilAirInletNode = WaterCoils::GetCoilInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, furnace.SuppCoilNum); + HVACControllers::CheckCoilWaterInletNode(state, furnace.SuppCoilControlNode, errFlag); if (!errFlag) { // then did find a controller so that is bad ShowSevereError(state, - format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, thisFurnace.Name)); + format("{} = {} has a conflicting Controller:WaterCoil object", CurrentModuleObject, furnace.Name)); ShowContinueError(state, "Hot water coils are controlled directly by unitary and furnace systems."); ShowContinueError(state, "No water coil controller should be input for the coil."); ErrorsFound = true; } } - } else if (Util::SameString(SuppHeatCoilType, "Coil:Heating:Steam")) { - thisFurnace.SuppHeatCoilType_Num = HVAC::Coil_HeatingSteam; - ValidateComponent(state, SuppHeatCoilType, SuppHeatCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); + } else if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { + furnace.SuppCoilNum = SteamCoils::GetSteamCoilIndex(state, furnace.SuppCoilName); + if (furnace.SuppCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), furnace.SuppCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - errFlag = false; - thisFurnace.SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, SuppHeatCoilType, SuppHeatCoilName, errFlag); - if (thisFurnace.SuppHeatCoilIndex == 0) { - ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(12), SuppHeatCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil steam inlet node number - errFlag = false; - thisFurnace.SuppCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } - - // Get the Heating Coil steam max volume flow rate - thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag); - if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - SteamDensity = - Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); - thisFurnace.MaxSuppCoilFluidFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag) * SteamDensity; - } - - // Get the Heating Coil Inlet Node - errFlag = false; - SupHeatCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisFurnace.SuppHeatCoilIndex, SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirInletNode = SupHeatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; + } else { + furnace.SuppCoilControlNode = SteamCoils::GetCoilSteamInletNode(state, furnace.SuppCoilNum); + furnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.SuppCoilNum); + if (furnace.MaxSuppCoilFluidFlow > 0.0) { + furnace.MaxSuppCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, getAirLoopHVACHeatCoolInput); } - // Get the Heating Coil Outlet Node - errFlag = false; - SupHeatCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisFurnace.SuppHeatCoilIndex, SuppHeatCoilName, errFlag); - thisFurnace.SuppCoilAirOutletNode = SupHeatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisFurnace.Name)); - ErrorsFound = true; - } + furnace.SuppCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, furnace.SuppCoilNum); + furnace.SuppCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, furnace.SuppCoilNum); } } else { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(12), Alphas(12))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(12), Alphas(12)); ErrorsFound = true; } // IF (Furnace(FurnaceNum)%HeatingCoilType_Num == Coil_HeatingGasOrOtherFuel .OR. &, etc. if (lAlphaBlanks(14)) { - thisFurnace.CondenserNodeNum = 0; + furnace.CondenserNodeNum = 0; } else { - thisFurnace.CondenserNodeNum = + furnace.CondenserNodeNum = NodeInputManager::GetOnlySingleNode(state, Alphas(14), ErrorsFound, @@ -3990,7 +2985,7 @@ namespace Furnaces { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); // need better verification. - if (!OutAirNodeManager::CheckOutAirNodeNumber(state, thisFurnace.CondenserNodeNum)) { + if (!OutAirNodeManager::CheckOutAirNodeNumber(state, furnace.CondenserNodeNum)) { ShowSevereError(state, format("For {} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format(" Node name of outdoor dry-bulb temperature sensor not valid outdoor air node= {}", Alphas(14))); ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); @@ -3998,18 +2993,18 @@ namespace Furnaces { } } - thisFurnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(15))); - assert(thisFurnace.fanPlace != HVAC::FanPlace::Invalid); + furnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(15))); + assert(furnace.fanPlace != HVAC::FanPlace::Invalid); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(16)); - if (!lAlphaBlanks(16) && thisFurnace.FanSchedPtr == 0) { + furnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(16)); + if (!lAlphaBlanks(16) && furnace.FanSchedPtr == 0) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(16), Alphas(16))); ErrorsFound = true; } else if (lAlphaBlanks(16)) { - thisFurnace.fanOp = HVAC::FanOp::Cycling; - if (thisFurnace.fanType != HVAC::FanType::OnOff) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, thisFurnace.Name)); + furnace.fanOp = HVAC::FanOp::Cycling; + if (furnace.fanType != HVAC::FanType::OnOff) { + ShowSevereError(state, format("{} = {}", CurrentModuleObject, furnace.Name)); ShowContinueError(state, format("{} = {}", cAlphaFields(6), Alphas(6))); ShowContinueError(state, format("Fan type must be Fan:OnOff when {} = Blank.", cAlphaFields(16))); ErrorsFound = true; @@ -4020,24 +3015,24 @@ namespace Furnaces { if (Util::SameString(Alphas(17), "None") || Util::SameString(Alphas(17), "CoolReheat")) { AirNodeFound = false; if (Util::SameString(Alphas(17), "CoolReheat")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; - thisFurnace.Humidistat = true; + furnace.DehumidControlType_Num = DehumidificationControlMode::CoolReheat; + furnace.Humidistat = true; if (lAlphaBlanks(17)) { ShowWarningError(state, format("{} \"{}\"", CurrentModuleObject, Alphas(1))); ShowContinueError(state, "Dehumidification control type is assumed to be None since a supplemental reheat coil has not been " "specified and the simulation continues."); - thisFurnace.Humidistat = false; - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; + furnace.Humidistat = false; + furnace.DehumidControlType_Num = DehumidificationControlMode::None; } } if (Util::SameString(Alphas(17), "None")) { - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; - thisFurnace.Humidistat = false; + furnace.DehumidControlType_Num = DehumidificationControlMode::None; + furnace.Humidistat = false; } - if (thisFurnace.Humidistat) { + if (furnace.Humidistat) { for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) { - if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum != thisFurnace.ControlZoneNum) continue; + if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum != furnace.ControlZoneNum) continue; AirNodeFound = true; } if (!AirNodeFound) { @@ -4053,124 +3048,86 @@ namespace Furnaces { ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(17), Alphas(17))); ErrorsFound = true; } else { - thisFurnace.Humidistat = false; - thisFurnace.DehumidControlType_Num = DehumidificationControlMode::None; + furnace.Humidistat = false; + furnace.DehumidControlType_Num = DehumidificationControlMode::None; } } // Add fan to component sets array - - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { CompSetFanInlet = Alphas(3); CompSetCoolInlet = "UNDEFINED"; - if (FanInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError( - state, format("For {} = {}, Mismatch between unitary system inlet node and fan inlet node.", CurrentModuleObject, Alphas(1))); + if (furnace.FanInletNode != furnace.FurnaceInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between unitary system inlet node and fan inlet node."); ShowContinueError(state, "..For \"BlowThrough\" fan, the inlet node name for the HeatPump should match the fan inlet node name."); - ShowContinueError(state, format("..HeatPump Inlet Node = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); - ShowContinueError(state, format("..Fan Inlet Node = {}", state.dataLoopNodes->NodeID(FanInletNode))); + ShowContinueError(state, format("..HeatPump Inlet Node = {}", s_node->NodeID(furnace.FurnaceInletNode))); + ShowContinueError(state, format("..Fan Inlet Node = {}", s_node->NodeID(furnace.FanInletNode))); ErrorsFound = true; } - if (FanOutletNode != CoolingCoilInletNode) { - ShowSevereError( - state, format("For {} = {}, Mismatch between fan outlet node and cooling coil inlet node.", CurrentModuleObject, Alphas(1))); + if (furnace.FanOutletNode != furnace.CoolCoilAirInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between fan outlet node and cooling coil inlet node."); ShowContinueError(state, "..For \"BlowThrough\" fan, the fan outlet node name must match the cooling coil inlet node name."); - ShowContinueError(state, format("..Fan outlet node = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, format("..Cooling coil inlet node = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); + ShowContinueError(state, format("..Fan outlet node = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("..Cooling coil inlet node = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { - ShowSevereError(state, - format("For {} = {}, Mismatch between cooling coil outlet node and heating coil inlet node.", - CurrentModuleObject, - Alphas(1))); + if (furnace.CoolCoilAirOutletNode != furnace.HeatCoilAirInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between cooling coil outlet node and heating coil inlet node."); ShowContinueError(state, "..The cooling coil outlet node name must match the heating coil inlet node name."); - ShowContinueError(state, format("..Cooling coil outlet node = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("..Heating coil inlet node = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + ShowContinueError(state, format("..Cooling coil outlet node = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("..Heating coil inlet node = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != SupHeatCoilInletNode) { - ShowSevereError(state, - format("For {} = {}, Mismatch between heating coil outlet node and supplemental heating coil inlet node.", - CurrentModuleObject, - Alphas(1))); - ShowContinueError( - state, - "..For \"BlowThrough\" fan, the heating coil outlet node name must match the supplemental heating coil inlet node name."); - ShowContinueError(state, - format("..Heating coil outlet node = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, - format("..Supplemental heating coil inlet node = {}", state.dataLoopNodes->NodeID(SupHeatCoilInletNode))); + if (furnace.HeatCoilAirOutletNode != furnace.SuppCoilAirInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between heating coil outlet node and supplemental heating coil inlet node."); + ShowContinueError(state, "..For \"BlowThrough\" fan, the heating coil outlet node name must match the supplemental heating coil inlet node name."); + ShowContinueError(state, format("..Heating coil outlet node = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("..Supplemental heating coil inlet node = {}", s_node->NodeID(furnace.SuppCoilAirInletNode))); ErrorsFound = true; } - if (SupHeatCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, - format("For {} = {}, Mismatch between supplemental heating coil outlet node and HeatPump outlet node.", - CurrentModuleObject, - Alphas(1))); + if (furnace.SuppCoilAirOutletNode != furnace.FurnaceOutletNode) { + ShowSevereCustom(state, eoh, "Mismatch between supplemental heating coil outlet node and HeatPump outlet node."); ShowContinueError(state, "..The supplemental heating coil outlet node name must match the HeatPump outlet node name."); - ShowContinueError(state, - format("..Supplemental heating coil outlet node = {}", state.dataLoopNodes->NodeID(SupHeatCoilOutletNode))); - ShowContinueError( - state, format("..HeatPump outlet node = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + ShowContinueError(state, format("..Supplemental heating coil outlet node = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); + ShowContinueError(state, format("..HeatPump outlet node = {}", s_node->NodeID(furnace.FurnaceOutletNode))); ErrorsFound = true; } } else { CompSetFanInlet = "UNDEFINED"; CompSetCoolInlet = Alphas(3); - if (CoolingCoilInletNode != thisFurnace.FurnaceInletNodeNum) { - ShowSevereError(state, - format("For {} = {}, Mismatch between unitary system inlet node and cooling coil inlet node.", - CurrentModuleObject, - Alphas(1))); - ShowContinueError( - state, "..For \"DrawThrough\" fan, the inlet node name for the HeatPump should match the cooling coil inlet node name."); - ShowContinueError(state, format("..HeatPump inlet node = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceInletNodeNum))); - ShowContinueError(state, format("..Cooling coil inlet node = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); + if (furnace.CoolCoilAirInletNode != furnace.FurnaceInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between unitary system inlet node and cooling coil inlet node."); + ShowContinueError(state, "..For \"DrawThrough\" fan, the inlet node name for the HeatPump should match the cooling coil inlet node name."); + ShowContinueError(state, format("..HeatPump inlet node = {}", s_node->NodeID(furnace.FurnaceInletNode))); + ShowContinueError(state, format("..Cooling coil inlet node = {}", s_node->NodeID(furnace.CoolCoilAirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { - ShowSevereError(state, - format("For {} = {}, Mismatch between cooling coil outlet node and heating coil inlet node.", - CurrentModuleObject, - Alphas(1))); + if (furnace.CoolCoilAirOutletNode != furnace.HeatCoilAirInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between cooling coil outlet node and heating coil inlet node."); ShowContinueError(state, "..The outlet node name for the cooling coil should match the heating coil inlet node name."); - ShowContinueError(state, format("..Cooling coil outlet node = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("..Heating coil inlet node = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + ShowContinueError(state, format("..Cooling coil outlet node = {}", s_node->NodeID(furnace.CoolCoilAirOutletNode))); + ShowContinueError(state, format("..Heating coil inlet node = {}", s_node->NodeID(furnace.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != FanInletNode) { - ShowSevereError( - state, format("For {} = {}, Mismatch between heating coil outlet node and fan inlet node.", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - "..For \"DrawThrough\" fan, the outlet node name for the heating coil should match the fan inlet node name."); - ShowContinueError(state, format("..Heating coil outlet node = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("..Fan inlet node = {}", state.dataLoopNodes->NodeID(FanInletNode))); + if (furnace.HeatCoilAirOutletNode != furnace.FanInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between heating coil outlet node and fan inlet node."); + ShowContinueError(state, "..For \"DrawThrough\" fan, the outlet node name for the heating coil should match the fan inlet node name."); + ShowContinueError(state, format("..Heating coil outlet node = {}", s_node->NodeID(furnace.HeatCoilAirOutletNode))); + ShowContinueError(state, format("..Fan inlet node = {}", s_node->NodeID(furnace.FanInletNode))); ErrorsFound = true; } - if (FanOutletNode != SupHeatCoilInletNode) { - ShowSevereError(state, - format("For {} = {}, Mismatch between fan outlet node and supplemental heating coil inlet node.", - CurrentModuleObject, - Alphas(1))); - ShowContinueError( - state, - "..For \"DrawThrough\" fan, the outlet node name for the fan should match the supplemental heating coil inlet node name."); - ShowContinueError(state, format("..Fan outlet node = {}", state.dataLoopNodes->NodeID(FanOutletNode))); - ShowContinueError(state, - format("..Supplemental heating coil inlet node = {}", state.dataLoopNodes->NodeID(SupHeatCoilInletNode))); + if (furnace.FanOutletNode != furnace.SuppCoilAirInletNode) { + ShowSevereCustom(state, eoh, "Mismatch between fan outlet node and supplemental heating coil inlet node."); + ShowContinueError(state, "For \"DrawThrough\" fan, the outlet node name for the fan should match the supplemental heating coil inlet node name."); + ShowContinueError(state, format("..Fan outlet node = {}", s_node->NodeID(furnace.FanOutletNode))); + ShowContinueError(state, format("..Supplemental heating coil inlet node = {}", s_node->NodeID(furnace.SuppCoilAirInletNode))); ErrorsFound = true; } - if (SupHeatCoilOutletNode != thisFurnace.FurnaceOutletNodeNum) { - ShowSevereError(state, - format("For {} = {}, Mismatch between supplemental heating coil outlet node and HeatPump outlet node.", - CurrentModuleObject, - Alphas(1))); - ShowContinueError(state, "..The supplemental heating coil outlet node name must match the HeatPump outlet node name."); - ShowContinueError(state, - format("..Supplemental heating coil outlet node = {}", state.dataLoopNodes->NodeID(SupHeatCoilOutletNode))); - ShowContinueError( - state, format("..HeatPump outlet node = {}", state.dataLoopNodes->NodeID(thisFurnace.FurnaceOutletNodeNum))); + if (furnace.SuppCoilAirOutletNode != furnace.FurnaceOutletNode) { + ShowSevereCustom(state, eoh, "Mismatch between supplemental heating coil outlet node and HeatPump outlet node." + "..The supplemental heating coil outlet node name must match the HeatPump outlet node name."); + ShowContinueError(state, format("..Supplemental heating coil outlet node = {}", s_node->NodeID(furnace.SuppCoilAirOutletNode))); + ShowContinueError(state, format("..HeatPump outlet node = {}", s_node->NodeID(furnace.FurnaceOutletNode))); ErrorsFound = true; } } @@ -4187,7 +3144,7 @@ namespace Furnaces { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, Alphas(1), Alphas(12), Alphas(13), "UNDEFINED", Alphas(4)); // Set the Design Fan Volume Flow Rate - thisFurnace.ActualFanVolFlowRate = state.dataFans->fans(thisFurnace.FanIndex)->maxAirFlowRate; + furnace.ActualFanVolFlowRate = state.dataFans->fans(furnace.FanIndex)->maxAirFlowRate; // CR8094 - simple water to air heat pump MUST operate at the same flow rate specified in the coil objects // Furnace(FurnaceNum)%DesignFanVolFlowRate = Numbers(1) @@ -4195,124 +3152,84 @@ namespace Furnaces { // Furnace(FurnaceNum)%MaxCoolAirVolFlow = Furnace(FurnaceNum)%DesignFanVolFlowRate // parameter estimate model only specifies air flow rate in parent object - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHP) { - thisFurnace.MaxHeatAirVolFlow = Numbers(1); - thisFurnace.MaxCoolAirVolFlow = Numbers(1); - // simple HP model specifies air flow rate in both the parent and child coils. Use coil air flow rates. - // simple HP model air flow rate input will not be used. - } else if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPSimple) { - errFlag = false; - thisFurnace.MaxHeatAirVolFlow = WaterToAirHeatPumpSimple::GetCoilAirFlowRate(state, HeatingCoilType, HeatingCoilName, errFlag); - thisFurnace.MaxCoolAirVolFlow = WaterToAirHeatPumpSimple::GetCoilAirFlowRate(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } else if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { - errFlag = false; - thisFurnace.MaxHeatAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - thisFurnace.MaxCoolAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHP) { + furnace.MaxHeatAirVolFlow = Numbers(1); + furnace.MaxCoolAirVolFlow = Numbers(1); + + // simple HP model specifies air flow rate in both the parent and child coils. Use coil air flow rates. + // simple HP model air flow rate input will not be used. + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPSimple) { + furnace.MaxHeatAirVolFlow = WaterToAirHeatPumpSimple::GetCoilAirFlowRate(state, furnace.HeatCoilNum); + furnace.MaxCoolAirVolFlow = WaterToAirHeatPumpSimple::GetCoilAirFlowRate(state, furnace.CoolCoilNum); + + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { + furnace.MaxHeatAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, furnace.HeatCoilNum); + furnace.MaxCoolAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, furnace.CoolCoilNum); } - thisFurnace.MaxNoCoolHeatAirVolFlow = min(thisFurnace.MaxHeatAirVolFlow, thisFurnace.MaxCoolAirVolFlow); - if (thisFurnace.MaxHeatAirVolFlow != DataSizing::AutoSize && thisFurnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { - thisFurnace.DesignFanVolFlowRate = max(thisFurnace.MaxHeatAirVolFlow, thisFurnace.MaxCoolAirVolFlow); + furnace.MaxNoCoolHeatAirVolFlow = min(furnace.MaxHeatAirVolFlow, furnace.MaxCoolAirVolFlow); + if (furnace.MaxHeatAirVolFlow != DataSizing::AutoSize && furnace.MaxCoolAirVolFlow != DataSizing::AutoSize) { + furnace.DesignFanVolFlowRate = max(furnace.MaxHeatAirVolFlow, furnace.MaxCoolAirVolFlow); } else { - thisFurnace.DesignFanVolFlowRate = DataSizing::AutoSize; + furnace.DesignFanVolFlowRate = DataSizing::AutoSize; } - thisFurnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; + furnace.AirFlowControl = AirFlowControlConstFan::UseCompressorOnFlow; - if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize && thisFurnace.DesignFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.DesignFanVolFlowRate > thisFurnace.ActualFanVolFlowRate) { + if (furnace.ActualFanVolFlowRate != DataSizing::AutoSize && furnace.DesignFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.DesignFanVolFlowRate > furnace.ActualFanVolFlowRate) { ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, "... has a Cooling or Heating Air Flow Rate > Max Fan Volume Flow Rate, should be <=."); ShowContinueError(state, format("... Entered value={:.2R}... Fan [{}:{}] Max Value={:.2R}", - thisFurnace.DesignFanVolFlowRate, - HVAC::fanTypeNames[(int)thisFurnace.fanType], + furnace.DesignFanVolFlowRate, + HVAC::fanTypeNames[(int)furnace.fanType], FanName, - thisFurnace.ActualFanVolFlowRate)); + furnace.ActualFanVolFlowRate)); } } - if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize && thisFurnace.DesignFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.DesignFanVolFlowRate <= 0.0) { + if (furnace.ActualFanVolFlowRate != DataSizing::AutoSize && furnace.DesignFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.DesignFanVolFlowRate <= 0.0) { ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, "... has a Design Fan Flow Rate <= 0.0, it must be >0.0"); - ShowContinueError(state, format("... Entered value={:.2R}", thisFurnace.DesignFanVolFlowRate)); + ShowContinueError(state, format("... Entered value={:.2R}", furnace.DesignFanVolFlowRate)); ErrorsFound = true; } } // Set the heat pump heating coil capacity // Get from coil module. - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHP) { - errFlag = false; - thisFurnace.DesignHeatingCapacity = WaterToAirHeatPump::GetCoilCapacity(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } else if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPSimple) { - errFlag = false; - thisFurnace.DesignHeatingCapacity = WaterToAirHeatPumpSimple::GetCoilCapacity(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } else if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { - errFlag = false; - thisFurnace.DesignHeatingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, HeatingCoilType, HeatingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHP) { + furnace.DesignHeatingCapacity = WaterToAirHeatPump::GetCoilCapacity(state, furnace.HeatCoilNum); + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPSimple) { + furnace.DesignHeatingCapacity = WaterToAirHeatPumpSimple::GetCoilCapacity(state, furnace.HeatCoilNum); + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { + furnace.DesignHeatingCapacity = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, furnace.HeatCoilNum); } // Set the heat pump heating coil convergence - thisFurnace.HeatingConvergenceTolerance = Numbers(2); + furnace.HeatingConvergenceTolerance = Numbers(2); // Set the heat pump cooling coil capacity (Total capacity) // Get from coil module. - if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHP) { - errFlag = false; - thisFurnace.DesignCoolingCapacity = WaterToAirHeatPump::GetCoilCapacity(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPSimple) { - errFlag = false; - thisFurnace.DesignCoolingCapacity = WaterToAirHeatPumpSimple::GetCoilCapacity(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) { - errFlag = false; - thisFurnace.DesignCoolingCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, CoolingCoilType, CoolingCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHP) { + furnace.DesignCoolingCapacity = WaterToAirHeatPump::GetCoilCapacity(state, furnace.CoolCoilNum); + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPSimple) { + furnace.DesignCoolingCapacity = WaterToAirHeatPumpSimple::GetCoilCapacity(state, furnace.CoolCoilNum); + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { + furnace.DesignCoolingCapacity = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, furnace.CoolCoilNum); } // Set the heat pump cooling coil convergence - thisFurnace.CoolingConvergenceTolerance = Numbers(3); + furnace.CoolingConvergenceTolerance = Numbers(3); // Set the heatpump design supplemental heating capacity // Get from coil module. // Set the heatpump max outlet temperature - thisFurnace.DesignMaxOutletTemp = Numbers(4); + furnace.DesignMaxOutletTemp = Numbers(4); // Set maximum supply air temperature for supplemental heating coil - thisFurnace.MaxOATSuppHeat = Numbers(5); + furnace.MaxOATSuppHeat = Numbers(5); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchDXHeatCoilSuppHiT, HeatingCoilName, thisFurnace.MaxOATSuppHeat); + state, state.dataOutRptPredefined->pdchDXHeatCoilSuppHiT, furnace.HeatCoilName, furnace.MaxOATSuppHeat); // set minimum outdoor temperature for compressor operation SetMinOATCompressor(state, FurnaceNum, cCurrentModuleObject, ErrorsFound); @@ -4328,96 +3245,96 @@ namespace Furnaces { for (int HeatOnlyNum = 1; HeatOnlyNum <= NumHeatOnly; ++HeatOnlyNum) { FurnaceNum = HeatOnlyNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Setup Report variables for the Furnace that are not reported in the components themselves SetupOutputVariable(state, "Unitary System Fan Part Load Ratio", Constant::Units::None, - thisFurnace.FanPartLoadRatio, + furnace.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "AirLoopHVAC:Unitary:Furnace:HeatOnly", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate", "[m3/s]", - thisFurnace.DesignFanVolFlowRateEMSOverrideOn, - thisFurnace.DesignFanVolFlowRateEMSOverrideValue); + furnace.DesignFanVolFlowRateEMSOverrideOn, + furnace.DesignFanVolFlowRateEMSOverrideValue); } } for (int UnitaryHeatOnlyNum = NumHeatOnly + 1; UnitaryHeatOnlyNum <= NumHeatOnly + NumUnitaryHeatOnly; ++UnitaryHeatOnlyNum) { FurnaceNum = UnitaryHeatOnlyNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Setup Report variables for Unitary System that are not reported in the components themselves SetupOutputVariable(state, "Unitary System Fan Part Load Ratio", Constant::Units::None, - thisFurnace.FanPartLoadRatio, + furnace.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "AirLoopHVAC:UnitaryHeatOnly", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate", "[m3/s]", - thisFurnace.DesignFanVolFlowRateEMSOverrideOn, - thisFurnace.DesignFanVolFlowRateEMSOverrideValue); + furnace.DesignFanVolFlowRateEMSOverrideOn, + furnace.DesignFanVolFlowRateEMSOverrideValue); } } for (int HeatCoolNum = NumHeatOnly + NumUnitaryHeatOnly + 1; HeatCoolNum <= NumHeatOnly + NumUnitaryHeatOnly + NumHeatCool; ++HeatCoolNum) { FurnaceNum = HeatCoolNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Setup Report variables for the Furnace that are not reported in the components themselves SetupOutputVariable(state, "Unitary System Fan Part Load Ratio", Constant::Units::None, - thisFurnace.FanPartLoadRatio, + furnace.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Compressor Part Load Ratio", Constant::Units::None, - thisFurnace.CompPartLoadRatio, + furnace.CompPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "AirLoopHVAC:Unitary:Furnace:HeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate", "[m3/s]", - thisFurnace.DesignFanVolFlowRateEMSOverrideOn, - thisFurnace.DesignFanVolFlowRateEMSOverrideValue); + furnace.DesignFanVolFlowRateEMSOverrideOn, + furnace.DesignFanVolFlowRateEMSOverrideValue); SetupEMSActuator(state, "AirLoopHVAC:Unitary:Furnace:HeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate During Cooling Operation", "[m3/s]", - thisFurnace.MaxCoolAirVolFlowEMSOverrideOn, - thisFurnace.MaxCoolAirVolFlowEMSOverrideValue); + furnace.MaxCoolAirVolFlowEMSOverrideOn, + furnace.MaxCoolAirVolFlowEMSOverrideValue); SetupEMSActuator(state, "AirLoopHVAC:Unitary:Furnace:HeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate During Heating Operation", "[m3/s]", - thisFurnace.MaxHeatAirVolFlowEMSOverrideOn, - thisFurnace.MaxHeatAirVolFlowEMSOverrideValue); + furnace.MaxHeatAirVolFlowEMSOverrideOn, + furnace.MaxHeatAirVolFlowEMSOverrideValue); SetupEMSActuator(state, "AirLoopHVAC:Unitary:Furnace:HeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate During No Heating or Cooling Operation", "[m3/s]", - thisFurnace.MaxNoCoolHeatAirVolFlowEMSOverrideOn, - thisFurnace.MaxNoCoolHeatAirVolFlowEMSOverrideValue); + furnace.MaxNoCoolHeatAirVolFlowEMSOverrideOn, + furnace.MaxNoCoolHeatAirVolFlowEMSOverrideValue); } } @@ -4425,51 +3342,51 @@ namespace Furnaces { UnitaryHeatCoolNum <= NumHeatOnly + NumHeatCool + NumUnitaryHeatOnly + NumUnitaryHeatCool; ++UnitaryHeatCoolNum) { FurnaceNum = UnitaryHeatCoolNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Setup Report variables for Unitary System that are not reported in the components themselves SetupOutputVariable(state, "Unitary System Fan Part Load Ratio", Constant::Units::None, - thisFurnace.FanPartLoadRatio, + furnace.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Compressor Part Load Ratio", Constant::Units::None, - thisFurnace.CompPartLoadRatio, + furnace.CompPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "AirLoopHVAC:UnitaryHeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate", "[m3/s]", - thisFurnace.DesignFanVolFlowRateEMSOverrideOn, - thisFurnace.DesignFanVolFlowRateEMSOverrideValue); + furnace.DesignFanVolFlowRateEMSOverrideOn, + furnace.DesignFanVolFlowRateEMSOverrideValue); SetupEMSActuator(state, "AirLoopHVAC:UnitaryHeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate During Cooling Operation", "[m3/s]", - thisFurnace.MaxCoolAirVolFlowEMSOverrideOn, - thisFurnace.MaxCoolAirVolFlowEMSOverrideValue); + furnace.MaxCoolAirVolFlowEMSOverrideOn, + furnace.MaxCoolAirVolFlowEMSOverrideValue); SetupEMSActuator(state, "AirLoopHVAC:UnitaryHeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate During Heating Operation", "[m3/s]", - thisFurnace.MaxHeatAirVolFlowEMSOverrideOn, - thisFurnace.MaxHeatAirVolFlowEMSOverrideValue); + furnace.MaxHeatAirVolFlowEMSOverrideOn, + furnace.MaxHeatAirVolFlowEMSOverrideValue); SetupEMSActuator(state, "AirLoopHVAC:UnitaryHeatCool", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate During No Heating or Cooling Operation", "[m3/s]", - thisFurnace.MaxNoCoolHeatAirVolFlowEMSOverrideOn, - thisFurnace.MaxNoCoolHeatAirVolFlowEMSOverrideValue); + furnace.MaxNoCoolHeatAirVolFlowEMSOverrideOn, + furnace.MaxNoCoolHeatAirVolFlowEMSOverrideValue); } } @@ -4477,38 +3394,38 @@ namespace Furnaces { HeatPumpNum <= state.dataFurnaces->NumFurnaces - NumWaterToAirHeatPump; ++HeatPumpNum) { FurnaceNum = HeatPumpNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Setup Report variables for Unitary System that are not reported in the components themselves SetupOutputVariable(state, "Unitary System Fan Part Load Ratio", Constant::Units::None, - thisFurnace.FanPartLoadRatio, + furnace.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Compressor Part Load Ratio", Constant::Units::None, - thisFurnace.CompPartLoadRatio, + furnace.CompPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Dehumidification Induced Heating Demand Rate", Constant::Units::W, - thisFurnace.DehumidInducedHeatingDemandRate, + furnace.DehumidInducedHeatingDemandRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "AirLoopHVAC:UnitaryHeatPump:AirToAir", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate", "[m3/s]", - thisFurnace.DesignFanVolFlowRateEMSOverrideOn, - thisFurnace.DesignFanVolFlowRateEMSOverrideValue); + furnace.DesignFanVolFlowRateEMSOverrideOn, + furnace.DesignFanVolFlowRateEMSOverrideValue); } } @@ -4516,81 +3433,81 @@ namespace Furnaces { HeatPumpNum <= state.dataFurnaces->NumFurnaces; ++HeatPumpNum) { FurnaceNum = HeatPumpNum; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Setup Report variables for Unitary System that are not reported in the components themselves SetupOutputVariable(state, "Unitary System Fan Part Load Ratio", Constant::Units::None, - thisFurnace.FanPartLoadRatio, + furnace.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Compressor Part Load Ratio", Constant::Units::None, - thisFurnace.CompPartLoadRatio, + furnace.CompPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Requested Sensible Cooling Rate", Constant::Units::W, - thisFurnace.CoolingCoilSensDemand, + furnace.CoolingCoilSensDemand, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Requested Latent Cooling Rate", Constant::Units::W, - thisFurnace.CoolingCoilLatentDemand, + furnace.CoolingCoilLatentDemand, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Requested Heating Rate", Constant::Units::W, - thisFurnace.HeatingCoilSensDemand, + furnace.HeatingCoilSensDemand, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); SetupOutputVariable(state, "Unitary System Dehumidification Induced Heating Demand Rate", Constant::Units::W, - thisFurnace.DehumidInducedHeatingDemandRate, + furnace.DehumidInducedHeatingDemandRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisFurnace.Name); + furnace.Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "AirLoopHVAC:UnitaryHeatPump:WaterToAir", - thisFurnace.Name, + furnace.Name, "Autosized Supply Air Flow Rate", "[m3/s]", - thisFurnace.DesignFanVolFlowRateEMSOverrideOn, - thisFurnace.DesignFanVolFlowRateEMSOverrideValue); + furnace.DesignFanVolFlowRateEMSOverrideOn, + furnace.DesignFanVolFlowRateEMSOverrideValue); } } if (state.dataGlobal->AnyEnergyManagementSystemInModel) { for (FurnaceNum = 1; FurnaceNum <= state.dataFurnaces->NumFurnaces; ++FurnaceNum) { - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - SetupEMSInternalVariable(state, "Unitary HVAC Design Heating Capacity", thisFurnace.Name, "[W]", thisFurnace.DesignHeatingCapacity); - SetupEMSInternalVariable(state, "Unitary HVAC Design Cooling Capacity", thisFurnace.Name, "[W]", thisFurnace.DesignCoolingCapacity); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + SetupEMSInternalVariable(state, "Unitary HVAC Design Heating Capacity", furnace.Name, "[W]", furnace.DesignHeatingCapacity); + SetupEMSInternalVariable(state, "Unitary HVAC Design Cooling Capacity", furnace.Name, "[W]", furnace.DesignCoolingCapacity); SetupEMSActuator(state, "Unitary HVAC", - thisFurnace.Name, + furnace.Name, "Sensible Load Request", "[W]", - thisFurnace.EMSOverrideSensZoneLoadRequest, - thisFurnace.EMSSensibleZoneLoadValue); + furnace.EMSOverrideSensZoneLoadRequest, + furnace.EMSSensibleZoneLoadValue); SetupEMSActuator(state, "Unitary HVAC", - thisFurnace.Name, + furnace.Name, "Moisture Load Request", "[W]", - thisFurnace.EMSOverrideMoistZoneLoadRequest, - thisFurnace.EMSMoistureZoneLoadValue); + furnace.EMSOverrideMoistZoneLoadRequest, + furnace.EMSMoistureZoneLoadValue); } } bool anyRan; @@ -4657,7 +3574,6 @@ namespace Furnaces { bool ErrorsFound(false); // flag returned from mining call Real64 mdot(0.0); // local temporary for mass flow rate (kg/s) Real64 rho(0.0); // local for fluid density - Real64 SteamDensity(0.0); // density of steam at 100C, used for steam heating coils Real64 CoilMaxVolFlowRate(0.0); // coil fluid maximum volume flow rate Real64 QActual(0.0); // coil actual capacity Real64 SUPHEATERLOAD(0.0); // SUPPLEMENTAL HEATER LOAD @@ -4667,9 +3583,9 @@ namespace Furnaces { Furnaces::ModeOfOperation OperatingModeMinusTwo; bool Oscillate; // detection of oscillating operating modes - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - int InNode = thisFurnace.FurnaceInletNodeNum; - int OutNode = thisFurnace.FurnaceOutletNodeNum; + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + int InNode = furnace.FurnaceInletNode; + int OutNode = furnace.FurnaceOutletNode; if (state.dataFurnaces->InitFurnaceMyOneTimeFlag) { // initialize the environment and sizing flags @@ -4706,47 +3622,47 @@ namespace Furnaces { if (!state.dataGlobal->SysSizingCalc && state.dataFurnaces->MySizeFlag(FurnaceNum)) { // for each furnace, do the sizing once. SizeFurnace(state, FurnaceNum, FirstHVACIteration); - thisFurnace.ControlZoneMassFlowFrac = 1.0; + furnace.ControlZoneMassFlowFrac = 1.0; state.dataFurnaces->MySizeFlag(FurnaceNum) = false; // Pass the fan cycling schedule index up to the air loop. Set the air loop unitary system flag. - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = thisFurnace.FanSchedPtr; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = furnace.FanSchedPtr; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySys = true; // RR this is wrong, Op mode needs to be updated each time atep - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = thisFurnace.fanOp; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = furnace.fanOp; // Check that heat pump heating capacity is within 20% of cooling capacity - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { - if (std::abs(thisFurnace.DesignCoolingCapacity - thisFurnace.DesignHeatingCapacity) / thisFurnace.DesignCoolingCapacity > 0.2) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { + if (std::abs(furnace.DesignCoolingCapacity - furnace.DesignHeatingCapacity) / furnace.DesignCoolingCapacity > 0.2) { ShowWarningError(state, format("{} \"{}\" heating capacity is disproportionate (> 20% different) to total cooling capacity", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); } } } if (!state.dataGlobal->DoingSizing && state.dataFurnaces->MySecondOneTimeFlag(FurnaceNum)) { // sizing all done. check fan air flow rates - thisFurnace.ActualFanVolFlowRate = state.dataFans->fans(thisFurnace.FanIndex)->maxAirFlowRate; - if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.DesignFanVolFlowRate > thisFurnace.ActualFanVolFlowRate) { + furnace.ActualFanVolFlowRate = state.dataFans->fans(furnace.FanIndex)->maxAirFlowRate; + if (furnace.ActualFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.DesignFanVolFlowRate > furnace.ActualFanVolFlowRate) { ShowWarningError(state, format("{}={} has a Design Fan Volume Flow Rate > Max Fan Volume Flow Rate, should be <=", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, format("... Entered value={:.2R}... Fan [{}] Max Value={:.2R}", - thisFurnace.DesignFanVolFlowRate, - HVAC::fanTypeNames[(int)thisFurnace.fanType], - thisFurnace.ActualFanVolFlowRate)); + furnace.DesignFanVolFlowRate, + HVAC::fanTypeNames[(int)furnace.fanType], + furnace.ActualFanVolFlowRate)); } - if (thisFurnace.DesignFanVolFlowRate <= 0.0) { + if (furnace.DesignFanVolFlowRate <= 0.0) { ShowSevereError(state, format("{}={} has a Design Fan Volume Flow Rate <= 0.0, it must be >0.0", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); - ShowContinueError(state, format("... Entered value={:.2R}", thisFurnace.DesignFanVolFlowRate)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); + ShowContinueError(state, format("... Entered value={:.2R}", furnace.DesignFanVolFlowRate)); } state.dataFurnaces->MySecondOneTimeFlag(FurnaceNum) = false; @@ -4755,15 +3671,16 @@ namespace Furnaces { // Scan hot water and steam heating coil plant components for one time initializations if (state.dataFurnaces->MyPlantScanFlag(FurnaceNum) && allocated(state.dataPlnt->PlantLoop)) { - if ((thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWater) || (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingSteam)) { + if (furnace.heatCoilType == HVAC::CoilType::HeatingWater || + furnace.heatCoilType == HVAC::CoilType::HeatingSteam) { - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWater) { + if (furnace.heatCoilType == HVAC::CoilType::HeatingWater) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - thisFurnace.HeatingCoilName, + furnace.HeatCoilName, DataPlant::PlantEquipmentType::CoilWaterSimpleHeating, - thisFurnace.plantLoc, + furnace.plantLoc, errFlag, _, _, @@ -4773,20 +3690,18 @@ namespace Furnaces { if (errFlag) { ShowFatalError(state, "InitFurnace: Program terminated for previous conditions."); } - thisFurnace.MaxHeatCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.HeatingCoilName, ErrorsFound); - if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - rho = - state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - thisFurnace.MaxHeatCoilFluidFlow *= rho; + furnace.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.HeatCoilNum); + if (furnace.MaxHeatCoilFluidFlow > 0.0) { + Real64 rho = state.dataPlnt->PlantLoop(furnace.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + furnace.MaxHeatCoilFluidFlow *= rho; } - } else if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingSteam) { + } else if (furnace.heatCoilType == HVAC::CoilType::HeatingSteam) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - thisFurnace.HeatingCoilName, + furnace.HeatCoilName, DataPlant::PlantEquipmentType::CoilSteamAirHeating, - thisFurnace.plantLoc, + furnace.plantLoc, errFlag, _, _, @@ -4796,14 +3711,13 @@ namespace Furnaces { if (errFlag) { ShowFatalError(state, "InitFurnace: Program terminated for previous conditions."); } - thisFurnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, ErrorsFound); - if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); - thisFurnace.MaxHeatCoilFluidFlow *= SteamDensity; + furnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.HeatCoilNum); + if (furnace.MaxHeatCoilFluidFlow > 0.0) { + furnace.MaxHeatCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } } // fill outlet node for coil - thisFurnace.CoilOutletNode = DataPlant::CompData::getPlantComponent(state, thisFurnace.plantLoc).NodeNumOut; + furnace.CoilOutletNode = DataPlant::CompData::getPlantComponent(state, furnace.plantLoc).NodeNumOut; state.dataFurnaces->MyPlantScanFlag(FurnaceNum) = false; } else { // pthp not connected to plant state.dataFurnaces->MyPlantScanFlag(FurnaceNum) = false; @@ -4814,14 +3728,15 @@ namespace Furnaces { // Scan Supplemental hot water and steam heating coil plant components for one time initializations if (state.dataFurnaces->MySuppCoilPlantScanFlag(FurnaceNum) && allocated(state.dataPlnt->PlantLoop)) { - if ((thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) || (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam)) { + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingWater || + furnace.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { - if (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingWater) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - thisFurnace.SuppHeatCoilName, + furnace.SuppCoilName, DataPlant::PlantEquipmentType::CoilWaterSimpleHeating, - thisFurnace.SuppPlantLoc, + furnace.SuppPlantLoc, errFlag, _, _, @@ -4831,19 +3746,18 @@ namespace Furnaces { if (errFlag) { ShowFatalError(state, "InitFurnace: Program terminated for previous conditions."); } - thisFurnace.MaxSuppCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.SuppHeatCoilName, ErrorsFound); - if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - rho = state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum) + furnace.MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.SuppCoilNum); + if (furnace.MaxSuppCoilFluidFlow > 0.0) { + Real64 rho = state.dataPlnt->PlantLoop(furnace.SuppPlantLoc.loopNum) .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - thisFurnace.MaxSuppCoilFluidFlow *= rho; + furnace.MaxSuppCoilFluidFlow *= rho; } - } else if (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { + } else if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - thisFurnace.SuppHeatCoilName, + furnace.SuppCoilName, DataPlant::PlantEquipmentType::CoilSteamAirHeating, - thisFurnace.SuppPlantLoc, + furnace.SuppPlantLoc, errFlag, _, _, @@ -4853,14 +3767,13 @@ namespace Furnaces { if (errFlag) { ShowFatalError(state, "InitFurnace: Program terminated for previous conditions."); } - thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, ErrorsFound); - if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); - thisFurnace.MaxSuppCoilFluidFlow *= SteamDensity; + furnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.SuppCoilNum); + if (furnace.MaxSuppCoilFluidFlow > 0.0) { + furnace.MaxSuppCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } } // fill outlet node for coil - thisFurnace.SuppCoilOutletNode = DataPlant::CompData::getPlantComponent(state, thisFurnace.SuppPlantLoc).NodeNumOut; + furnace.SuppCoilOutletNode = DataPlant::CompData::getPlantComponent(state, furnace.SuppPlantLoc).NodeNumOut; state.dataFurnaces->MySuppCoilPlantScanFlag(FurnaceNum) = false; } else { // pthp not connected to plant state.dataFurnaces->MySuppCoilPlantScanFlag(FurnaceNum) = false; @@ -4873,83 +3786,78 @@ namespace Furnaces { // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataFurnaces->MyEnvrnFlag(FurnaceNum)) { // Change the Volume Flow Rates to Mass Flow Rates - thisFurnace.DesignMassFlowRate = thisFurnace.DesignFanVolFlowRate * state.dataEnvrn->StdRhoAir; - thisFurnace.MaxCoolAirMassFlow = thisFurnace.MaxCoolAirVolFlow * state.dataEnvrn->StdRhoAir; - thisFurnace.MaxHeatAirMassFlow = thisFurnace.MaxHeatAirVolFlow * state.dataEnvrn->StdRhoAir; - thisFurnace.MaxNoCoolHeatAirMassFlow = thisFurnace.MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir; - thisFurnace.CompPartLoadRatio = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; - thisFurnace.HeatingCoilSensDemand = 0.0; + furnace.DesignMassFlowRate = furnace.DesignFanVolFlowRate * state.dataEnvrn->StdRhoAir; + furnace.MaxCoolAirMassFlow = furnace.MaxCoolAirVolFlow * state.dataEnvrn->StdRhoAir; + furnace.MaxHeatAirMassFlow = furnace.MaxHeatAirVolFlow * state.dataEnvrn->StdRhoAir; + furnace.MaxNoCoolHeatAirMassFlow = furnace.MaxNoCoolHeatAirVolFlow * state.dataEnvrn->StdRhoAir; + furnace.CompPartLoadRatio = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; + furnace.HeatingCoilSensDemand = 0.0; - thisFurnace.SenLoadLoss = 0.0; - if (thisFurnace.Humidistat) { - thisFurnace.LatLoadLoss = 0.0; + furnace.SenLoadLoss = 0.0; + if (furnace.Humidistat) { + furnace.LatLoadLoss = 0.0; } // set fluid-side hardware limits - if (thisFurnace.CoilControlNode > 0) { + if (furnace.HeatCoilControlNode > 0) { - if (thisFurnace.MaxHeatCoilFluidFlow == DataSizing::AutoSize) { + if (furnace.MaxHeatCoilFluidFlow == DataSizing::AutoSize) { // If water coil max water flow rate is autosized, simulate once in order to mine max flow rate - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWater) { - WaterCoils::SimulateWaterCoilComponents(state, thisFurnace.HeatingCoilName, FirstHVACIteration, thisFurnace.HeatingCoilIndex); - CoilMaxVolFlowRate = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.HeatingCoilName, ErrorsFound); + if (furnace.heatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SimulateWaterCoilComponents(state, furnace.HeatCoilName, FirstHVACIteration, furnace.HeatCoilNum); + CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.HeatCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum) - .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - thisFurnace.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * rho; + furnace.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * + state.dataPlnt->PlantLoop(furnace.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } } // If steam coil max steam flow rate is autosized, simulate once in order to mine max flow rate - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingSteam) { + if (furnace.heatCoilType == HVAC::CoilType::HeatingSteam) { SteamCoils::SimulateSteamCoilComponents(state, - thisFurnace.HeatingCoilName, + furnace.HeatCoilName, FirstHVACIteration, - thisFurnace.HeatingCoilIndex, + furnace.HeatCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity - CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, ErrorsFound); + CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.HeatCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); - thisFurnace.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; + furnace.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } } } PlantUtilities::InitComponentNodes( - state, 0.0, thisFurnace.MaxHeatCoilFluidFlow, thisFurnace.CoilControlNode, thisFurnace.CoilOutletNode); + state, 0.0, furnace.MaxHeatCoilFluidFlow, furnace.HeatCoilControlNode, furnace.CoilOutletNode); } - if (thisFurnace.SuppCoilControlNode > 0) { - if (thisFurnace.MaxSuppCoilFluidFlow == DataSizing::AutoSize) { - if (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { + if (furnace.SuppCoilControlNode > 0) { + if (furnace.MaxSuppCoilFluidFlow == DataSizing::AutoSize) { + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingWater) { // If water coil max water flow rate is autosized, simulate once in order to mine max flow rate WaterCoils::SimulateWaterCoilComponents( - state, thisFurnace.SuppHeatCoilName, FirstHVACIteration, thisFurnace.SuppHeatCoilIndex); - CoilMaxVolFlowRate = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.SuppHeatCoilName, ErrorsFound); + state, furnace.SuppCoilName, FirstHVACIteration, furnace.SuppCoilNum); + CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, furnace.SuppCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum) + rho = state.dataPlnt->PlantLoop(furnace.SuppPlantLoc.loopNum) .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - thisFurnace.MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho; + furnace.MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho; } } - if (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { SteamCoils::SimulateSteamCoilComponents(state, - thisFurnace.SuppHeatCoilName, + furnace.SuppCoilName, FirstHVACIteration, - thisFurnace.SuppHeatCoilIndex, + furnace.SuppCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity - CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, ErrorsFound); + CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, furnace.SuppCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); - thisFurnace.MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; + furnace.MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } } PlantUtilities::InitComponentNodes( - state, 0.0, thisFurnace.MaxSuppCoilFluidFlow, thisFurnace.SuppCoilControlNode, thisFurnace.SuppCoilOutletNode); + state, 0.0, furnace.MaxSuppCoilFluidFlow, furnace.SuppCoilControlNode, furnace.SuppCoilOutletNode); } } state.dataFurnaces->MyEnvrnFlag(FurnaceNum) = false; @@ -4960,56 +3868,56 @@ namespace Furnaces { } if (state.dataFurnaces->MyFanFlag(FurnaceNum)) { - if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize) { - if (thisFurnace.ActualFanVolFlowRate > 0.0) { - thisFurnace.HeatingSpeedRatio = thisFurnace.MaxHeatAirVolFlow / thisFurnace.ActualFanVolFlowRate; - thisFurnace.CoolingSpeedRatio = thisFurnace.MaxCoolAirVolFlow / thisFurnace.ActualFanVolFlowRate; - thisFurnace.NoHeatCoolSpeedRatio = thisFurnace.MaxNoCoolHeatAirVolFlow / thisFurnace.ActualFanVolFlowRate; - } - if (dynamic_cast(state.dataFans->fans(thisFurnace.FanIndex))->powerRatioAtSpeedRatioCurveNum > 0) { - if (thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxHeatAirVolFlow && - thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxCoolAirVolFlow && - thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxNoCoolHeatAirVolFlow) { - std::string FanName = state.dataFans->fans(thisFurnace.FanIndex)->Name; - ShowWarningError(state, format("{} \"{}\"", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); + if (furnace.ActualFanVolFlowRate != DataSizing::AutoSize) { + if (furnace.ActualFanVolFlowRate > 0.0) { + furnace.HeatingSpeedRatio = furnace.MaxHeatAirVolFlow / furnace.ActualFanVolFlowRate; + furnace.CoolingSpeedRatio = furnace.MaxCoolAirVolFlow / furnace.ActualFanVolFlowRate; + furnace.NoHeatCoolSpeedRatio = furnace.MaxNoCoolHeatAirVolFlow / furnace.ActualFanVolFlowRate; + } + if (dynamic_cast(state.dataFans->fans(furnace.FanIndex))->powerRatioAtSpeedRatioCurveNum > 0) { + if (furnace.ActualFanVolFlowRate == furnace.MaxHeatAirVolFlow && + furnace.ActualFanVolFlowRate == furnace.MaxCoolAirVolFlow && + furnace.ActualFanVolFlowRate == furnace.MaxNoCoolHeatAirVolFlow) { + std::string FanName = state.dataFans->fans(furnace.FanIndex)->Name; + ShowWarningError(state, format("{} \"{}\"", HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name)); ShowContinueError(state, - format("...For fan type and name = {} \"{}\"", HVAC::fanTypeNames[(int)thisFurnace.fanType], FanName)); + format("...For fan type and name = {} \"{}\"", HVAC::fanTypeNames[(int)furnace.fanType], FanName)); ShowContinueError(state, "...Fan power ratio function of speed ratio curve has no impact if fan volumetric flow rate is the same as " "the unitary system volumetric flow rate."); - ShowContinueError(state, format("...Fan volumetric flow rate = {:.5R} m3/s.", thisFurnace.ActualFanVolFlowRate)); - ShowContinueError(state, format("...Unitary system volumetric flow rate = {:.5R} m3/s.", thisFurnace.MaxHeatAirVolFlow)); + ShowContinueError(state, format("...Fan volumetric flow rate = {:.5R} m3/s.", furnace.ActualFanVolFlowRate)); + ShowContinueError(state, format("...Unitary system volumetric flow rate = {:.5R} m3/s.", furnace.MaxHeatAirVolFlow)); } } state.dataFurnaces->MyFanFlag(FurnaceNum) = false; } else { - thisFurnace.ActualFanVolFlowRate = state.dataFans->fans(thisFurnace.FanIndex)->maxAirFlowRate; + furnace.ActualFanVolFlowRate = state.dataFans->fans(furnace.FanIndex)->maxAirFlowRate; } } if (allocated(state.dataZoneEquip->ZoneEquipConfig) && state.dataFurnaces->MyCheckFlag(FurnaceNum)) { - int zoneNum = thisFurnace.ControlZoneNum; - int zoneInlet = thisFurnace.ZoneInletNode; + int zoneNum = furnace.ControlZoneNum; + int zoneInlet = furnace.ZoneInletNode; // setup furnace zone equipment sequence information based on finding matching air terminal if (state.dataZoneEquip->ZoneEquipConfig(zoneNum).EquipListIndex > 0) { int coolingPriority = 0; int heatingPriority = 0; state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(zoneNum).EquipListIndex) .getPrioritiesForInletNode(state, zoneInlet, coolingPriority, heatingPriority); - thisFurnace.ZoneSequenceCoolingNum = coolingPriority; - thisFurnace.ZoneSequenceHeatingNum = heatingPriority; + furnace.ZoneSequenceCoolingNum = coolingPriority; + furnace.ZoneSequenceHeatingNum = heatingPriority; } state.dataFurnaces->MyCheckFlag(FurnaceNum) = false; - if (thisFurnace.ZoneSequenceCoolingNum == 0 || thisFurnace.ZoneSequenceHeatingNum == 0) { + if (furnace.ZoneSequenceCoolingNum == 0 || furnace.ZoneSequenceHeatingNum == 0) { ShowSevereError(state, format("{} \"{}\": Airloop air terminal in the zone equipment list for zone = {} not found or is not allowed Zone " "Equipment Cooling or Heating Sequence = 0.", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, - state.dataHeatBal->Zone(thisFurnace.ControlZoneNum).Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, + state.dataHeatBal->Zone(furnace.ControlZoneNum).Name)); ShowFatalError(state, format("Subroutine InitFurnace: Errors found in getting {} input. Preceding condition(s) causes termination.", - HVAC::unitarySysTypeNames[(int)thisFurnace.type])); + HVAC::unitarySysTypeNames[(int)furnace.type])); } } @@ -5042,22 +3950,22 @@ namespace Furnaces { for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) { int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex); SumOfMassFlowRateMax += state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax; - if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZoneInSysIndex) == thisFurnace.ControlZoneNum) { + if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZoneInSysIndex) == furnace.ControlZoneNum) { CntrlZoneTerminalUnitMassFlowRateMax = state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax; } } if (SumOfMassFlowRateMax != 0.0) { if (CntrlZoneTerminalUnitMassFlowRateMax >= HVAC::SmallAirVolFlow) { - thisFurnace.ControlZoneMassFlowFrac = CntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax; + furnace.ControlZoneMassFlowFrac = CntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax; } else { - ShowSevereError(state, format("{} = {}", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); + ShowSevereError(state, format("{} = {}", HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name)); ShowContinueError(state, " The Fraction of Supply Air Flow That Goes Through the Controlling Zone is set to 1."); } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Fraction of Supply Air Flow That Goes Through the Controlling Zone", - thisFurnace.ControlZoneMassFlowFrac); + furnace.ControlZoneMassFlowFrac); state.dataFurnaces->MyFlowFracFlag(FurnaceNum) = false; } } @@ -5065,14 +3973,14 @@ namespace Furnaces { // Calculate air distribution losses if (!FirstHVACIteration && state.dataFurnaces->AirLoopPass == 1) { - int ZoneInNode = thisFurnace.ZoneInletNode; - MassFlowRate = state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / thisFurnace.ControlZoneMassFlowFrac; + int ZoneInNode = furnace.ZoneInletNode; + MassFlowRate = state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / furnace.ControlZoneMassFlowFrac; if (state.afn->distribution_simulated) { - DeltaMassRate = state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).MassFlowRate - - state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / thisFurnace.ControlZoneMassFlowFrac; + DeltaMassRate = state.dataLoopNodes->Node(furnace.FurnaceOutletNode).MassFlowRate - + state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / furnace.ControlZoneMassFlowFrac; if (DeltaMassRate < 0.0) DeltaMassRate = 0.0; } else { - MassFlowRate = state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).MassFlowRate; + MassFlowRate = state.dataLoopNodes->Node(furnace.FurnaceOutletNode).MassFlowRate; DeltaMassRate = 0.0; } Real64 TotalOutput(0.0); // total output rate, {W} @@ -5080,62 +3988,62 @@ namespace Furnaces { Real64 LatentOutputDelta(0.0); // delta latent output rate, {W} Real64 TotalOutputDelta(0.0); // delta total output rate, {W} CalcZoneSensibleLatentOutput(MassFlowRate, - state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).Temp, - state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).HumRat, + state.dataLoopNodes->Node(furnace.FurnaceOutletNode).Temp, + state.dataLoopNodes->Node(furnace.FurnaceOutletNode).HumRat, state.dataLoopNodes->Node(ZoneInNode).Temp, state.dataLoopNodes->Node(ZoneInNode).HumRat, - thisFurnace.SenLoadLoss, - thisFurnace.LatLoadLoss, + furnace.SenLoadLoss, + furnace.LatLoadLoss, TotalOutput); CalcZoneSensibleLatentOutput(DeltaMassRate, - state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).Temp, - state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).HumRat, - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).Temp, - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).HumRat, + state.dataLoopNodes->Node(furnace.FurnaceOutletNode).Temp, + state.dataLoopNodes->Node(furnace.FurnaceOutletNode).HumRat, + state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).Temp, + state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).HumRat, SensibleOutputDelta, LatentOutputDelta, TotalOutputDelta); - thisFurnace.SenLoadLoss = thisFurnace.SenLoadLoss + SensibleOutputDelta; - if (std::abs(thisFurnace.SensibleLoadMet) > 0.0) { - if (std::abs(thisFurnace.SenLoadLoss / thisFurnace.SensibleLoadMet) < 0.001) thisFurnace.SenLoadLoss = 0.0; + furnace.SenLoadLoss = furnace.SenLoadLoss + SensibleOutputDelta; + if (std::abs(furnace.SensibleLoadMet) > 0.0) { + if (std::abs(furnace.SenLoadLoss / furnace.SensibleLoadMet) < 0.001) furnace.SenLoadLoss = 0.0; } - if (thisFurnace.Humidistat) { - thisFurnace.LatLoadLoss = thisFurnace.LatLoadLoss + LatentOutputDelta; - if (std::abs(thisFurnace.LatentLoadMet) > 0.0) { - if (std::abs(thisFurnace.LatLoadLoss / thisFurnace.LatentLoadMet) < 0.001) thisFurnace.LatLoadLoss = 0.0; + if (furnace.Humidistat) { + furnace.LatLoadLoss = furnace.LatLoadLoss + LatentOutputDelta; + if (std::abs(furnace.LatentLoadMet) > 0.0) { + if (std::abs(furnace.LatLoadLoss / furnace.LatentLoadMet) < 0.001) furnace.LatLoadLoss = 0.0; } } } - if (thisFurnace.FanSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.FanSchedPtr) == 0.0) { - thisFurnace.fanOp = HVAC::FanOp::Cycling; + if (furnace.FanSchedPtr > 0) { + if (ScheduleManager::GetCurrentScheduleValue(state, furnace.FanSchedPtr) == 0.0) { + furnace.fanOp = HVAC::FanOp::Cycling; } else { - thisFurnace.fanOp = HVAC::FanOp::Continuous; + furnace.fanOp = HVAC::FanOp::Continuous; } if (AirLoopNum > 0) { - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = thisFurnace.fanOp; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = furnace.fanOp; } } - fanOp = thisFurnace.fanOp; + fanOp = furnace.fanOp; state.dataFurnaces->EconomizerFlag = state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive; - if (thisFurnace.ControlZoneMassFlowFrac > 0.0) { - QZnReq = ZoneLoad / thisFurnace.ControlZoneMassFlowFrac; - MoistureLoad /= thisFurnace.ControlZoneMassFlowFrac; + if (furnace.ControlZoneMassFlowFrac > 0.0) { + QZnReq = ZoneLoad / furnace.ControlZoneMassFlowFrac; + MoistureLoad /= furnace.ControlZoneMassFlowFrac; ZoneLoad = QZnReq; } else { QZnReq = ZoneLoad; } // Original thermostat control logic (works only for cycling fan systems) - if (QZnReq > HVAC::SmallLoad && QZnReq > (Small5WLoad / thisFurnace.ControlZoneMassFlowFrac) && - !state.dataZoneEnergyDemand->CurDeadBandOrSetback(thisFurnace.ControlZoneNum)) { + if (QZnReq > HVAC::SmallLoad && QZnReq > (Small5WLoad / furnace.ControlZoneMassFlowFrac) && + !state.dataZoneEnergyDemand->CurDeadBandOrSetback(furnace.ControlZoneNum)) { state.dataFurnaces->HeatingLoad = true; state.dataFurnaces->CoolingLoad = false; - } else if (QZnReq < -HVAC::SmallLoad && std::abs(QZnReq) > (Small5WLoad / thisFurnace.ControlZoneMassFlowFrac) && - !state.dataZoneEnergyDemand->CurDeadBandOrSetback(thisFurnace.ControlZoneNum)) { + } else if (QZnReq < -HVAC::SmallLoad && std::abs(QZnReq) > (Small5WLoad / furnace.ControlZoneMassFlowFrac) && + !state.dataZoneEnergyDemand->CurDeadBandOrSetback(furnace.ControlZoneNum)) { state.dataFurnaces->HeatingLoad = false; state.dataFurnaces->CoolingLoad = true; } else { @@ -5143,10 +4051,10 @@ namespace Furnaces { state.dataFurnaces->CoolingLoad = false; } - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && - (thisFurnace.WatertoAirHPType == WAHPCoilType::Simple || thisFurnace.WatertoAirHPType == WAHPCoilType::VarSpeedEquationFit))) { - if (MoistureLoad < 0.0 && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && + (furnace.WatertoAirHPType == WAHPCoilType::Simple || furnace.WatertoAirHPType == WAHPCoilType::VarSpeedEquationFit))) { + if (MoistureLoad < 0.0 && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { state.dataFurnaces->HPDehumidificationLoadFlag = true; state.dataFurnaces->HeatingLoad = false; state.dataFurnaces->CoolingLoad = true; @@ -5156,10 +4064,10 @@ namespace Furnaces { } // Check for heat only furnace - if (thisFurnace.type != HVAC::UnitarySysType::Furnace_HeatOnly && thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatOnly) { + if (furnace.type != HVAC::UnitarySysType::Furnace_HeatOnly && furnace.type != HVAC::UnitarySysType::Unitary_HeatOnly) { - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) { - if ((state.dataFurnaces->HeatingLoad || state.dataFurnaces->CoolingLoad) || (thisFurnace.Humidistat && MoistureLoad < 0.0)) { + if (ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0) { + if ((state.dataFurnaces->HeatingLoad || state.dataFurnaces->CoolingLoad) || (furnace.Humidistat && MoistureLoad < 0.0)) { PartLoadRatio = 1.0; } else { PartLoadRatio = 0.0; @@ -5174,193 +4082,192 @@ namespace Furnaces { // get current time step operating capacity of water and steam coils // (dependent on entering water and steam temperature) if (FirstHVACIteration) { - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWater) { + if (furnace.heatCoilType == HVAC::CoilType::HeatingWater) { // set water-side mass flow rates - state.dataLoopNodes->Node(thisFurnace.HWCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; - mdot = thisFurnace.MaxHeatCoilFluidFlow; - PlantUtilities::SetComponentFlowRate(state, mdot, thisFurnace.CoilControlNode, thisFurnace.CoilOutletNode, thisFurnace.plantLoc); + state.dataLoopNodes->Node(furnace.HeatCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; + mdot = furnace.MaxHeatCoilFluidFlow; + PlantUtilities::SetComponentFlowRate(state, mdot, furnace.HeatCoilControlNode, furnace.CoilOutletNode, furnace.plantLoc); // simulate water coil to find operating capacity WaterCoils::SimulateWaterCoilComponents( - state, thisFurnace.HeatingCoilName, FirstHVACIteration, thisFurnace.HeatingCoilIndex, QActual); - thisFurnace.DesignHeatingCapacity = QActual; + state, furnace.HeatCoilName, FirstHVACIteration, furnace.HeatCoilNum, QActual); + furnace.DesignHeatingCapacity = QActual; - } // from IF(furnace%HeatingCoilType_Num == Coil_HeatingWater) THEN + } // from IF(furnace%heatCoilType == Coil_HeatingWater) THEN - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingSteam) { + if (furnace.heatCoilType == HVAC::CoilType::HeatingSteam) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(thisFurnace.HWCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; - mdot = thisFurnace.MaxHeatCoilFluidFlow; - PlantUtilities::SetComponentFlowRate(state, mdot, thisFurnace.CoilControlNode, thisFurnace.CoilOutletNode, thisFurnace.plantLoc); + state.dataLoopNodes->Node(furnace.HeatCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; + mdot = furnace.MaxHeatCoilFluidFlow; + PlantUtilities::SetComponentFlowRate(state, mdot, furnace.HeatCoilControlNode, furnace.CoilOutletNode, furnace.plantLoc); // simulate steam coil to find operating capacity SteamCoils::SimulateSteamCoilComponents(state, - thisFurnace.HeatingCoilName, + furnace.HeatCoilName, FirstHVACIteration, - thisFurnace.HeatingCoilIndex, + furnace.HeatCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - thisFurnace.DesignHeatingCapacity = - SteamCoils::GetCoilCapacity(state, thisFurnace.HeatingCoilType, thisFurnace.HeatingCoilName, ErrorsFound); + furnace.DesignHeatingCapacity = SteamCoils::GetCoilCapacity(state, furnace.HeatCoilNum); - } // from IF(Furnace(FurnaceNum)%HeatingCoilType_Num == Coil_HeatingSteam) THEN + } // from IF(Furnace(FurnaceNum)%heatCoilType == Coil_HeatingSteam) THEN - if (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingWater) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(thisFurnace.SuppCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; - mdot = thisFurnace.MaxSuppCoilFluidFlow; + state.dataLoopNodes->Node(furnace.SuppCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; + mdot = furnace.MaxSuppCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, thisFurnace.SuppCoilControlNode, thisFurnace.SuppCoilOutletNode, thisFurnace.SuppPlantLoc); + state, mdot, furnace.SuppCoilControlNode, furnace.SuppCoilOutletNode, furnace.SuppPlantLoc); // simulate water coil to find operating capacity WaterCoils::SimulateWaterCoilComponents( - state, thisFurnace.SuppHeatCoilName, FirstHVACIteration, thisFurnace.SuppHeatCoilIndex, QActual); - thisFurnace.DesignSuppHeatingCapacity = QActual; + state, furnace.SuppCoilName, FirstHVACIteration, furnace.SuppCoilNum, QActual); + furnace.DesignSuppHeatingCapacity = QActual; - } // from IF(Furnace(FurnaceNum)%SuppHeatCoilType_Num == Coil_HeatingWater) THEN - if (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { + } // from IF(Furnace(FurnaceNum)%suppHeatCoilType == Coil_HeatingWater) THEN + if (furnace.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(thisFurnace.SuppCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; - mdot = thisFurnace.MaxSuppCoilFluidFlow; + state.dataLoopNodes->Node(furnace.SuppCoilAirInletNode).MassFlowRate = state.dataFurnaces->CompOnMassFlow; + mdot = furnace.MaxSuppCoilFluidFlow; PlantUtilities::SetComponentFlowRate( - state, mdot, thisFurnace.SuppCoilControlNode, thisFurnace.SuppCoilOutletNode, thisFurnace.SuppPlantLoc); + state, mdot, furnace.SuppCoilControlNode, furnace.SuppCoilOutletNode, furnace.SuppPlantLoc); // simulate steam coil to find operating capacity SteamCoils::SimulateSteamCoilComponents(state, - thisFurnace.SuppHeatCoilName, + furnace.SuppCoilName, FirstHVACIteration, - thisFurnace.SuppHeatCoilIndex, + furnace.SuppCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - thisFurnace.DesignSuppHeatingCapacity = - SteamCoils::GetCoilCapacity(state, thisFurnace.SuppHeatCoilType, thisFurnace.SuppHeatCoilName, ErrorsFound); + furnace.DesignSuppHeatingCapacity = SteamCoils::GetCoilCapacity(state, furnace.SuppCoilNum); - } // from IF(Furnace(FurnaceNum)%SuppHeatCoilType_Num == Coil_HeatingSteam) THEN + } // from IF(Furnace(FurnaceNum)%suppHeatCoilType == Coil_HeatingSteam) THEN } // from IF( FirstHVACIteration ) THEN - if (thisFurnace.NumOfSpeedCooling > 0) { // BoS, variable-speed water source hp + if (furnace.NumOfSpeedCooling > 0) { // BoS, variable-speed water source hp // Furnace(FurnaceNum)%IdleMassFlowRate = RhoAir*Furnace(FurnaceNum)%IdleVolumeAirRate - int NumOfSpeedCooling = thisFurnace.NumOfSpeedCooling; - int NumOfSpeedHeating = thisFurnace.NumOfSpeedHeating; + int NumOfSpeedCooling = furnace.NumOfSpeedCooling; + int NumOfSpeedHeating = furnace.NumOfSpeedHeating; // IF MSHP system was not autosized and the fan is autosized, check that fan volumetric flow rate is greater than MSHP flow rates - if (thisFurnace.CheckFanFlow) { + if (furnace.CheckFanFlow) { state.dataFurnaces->CurrentModuleObject = "AirLoopHVAC:UnitaryHeatPump:VariableSpeed"; - thisFurnace.FanVolFlow = state.dataFans->fans(thisFurnace.FanIndex)->maxAirFlowRate; + furnace.FanVolFlow = state.dataFans->fans(furnace.FanIndex)->maxAirFlowRate; - if (thisFurnace.FanVolFlow != DataSizing::AutoSize) { + if (furnace.FanVolFlow != DataSizing::AutoSize) { // Check fan versus system supply air flow rates - if (thisFurnace.FanVolFlow + 1e-10 < thisFurnace.CoolVolumeFlowRate(NumOfSpeedCooling)) { + if (furnace.FanVolFlow + 1e-10 < furnace.CoolVolumeFlowRate(NumOfSpeedCooling)) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object is less than the MSHP system air flow rate when cooling " "is required ({:.7T}).", state.dataFurnaces->CurrentModuleObject, - thisFurnace.FanVolFlow, - thisFurnace.CoolVolumeFlowRate(NumOfSpeedCooling))); + furnace.FanVolFlow, + furnace.CoolVolumeFlowRate(NumOfSpeedCooling))); ShowContinueError( state, " The MSHP system flow rate when cooling is required is reset to the fan flow rate and the simulation continues."); - ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, thisFurnace.Name)); - thisFurnace.CoolVolumeFlowRate(NumOfSpeedCooling) = thisFurnace.FanVolFlow; + ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, furnace.Name)); + furnace.CoolVolumeFlowRate(NumOfSpeedCooling) = furnace.FanVolFlow; - if (thisFurnace.bIsIHP) // set max fan flow rate to the IHP collection + if (furnace.isIHP) // set max fan flow rate to the IHP collection { - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).MaxCoolAirVolFlow = thisFurnace.FanVolFlow; - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).MaxCoolAirMassFlow = - thisFurnace.FanVolFlow * state.dataEnvrn->StdRhoAir; + state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).MaxCoolAirVolFlow = furnace.FanVolFlow; + state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).MaxCoolAirMassFlow = + furnace.FanVolFlow * state.dataEnvrn->StdRhoAir; } // Check flow rates in other speeds and ensure flow rates are not above the max flow rate for (int i = NumOfSpeedCooling - 1; i >= 1; --i) { - if (thisFurnace.CoolVolumeFlowRate(i) > thisFurnace.CoolVolumeFlowRate(i + 1)) { + if (furnace.CoolVolumeFlowRate(i) > furnace.CoolVolumeFlowRate(i + 1)) { ShowContinueError(state, format(" The MSHP system flow rate when cooling is required is reset to the flow rate at higher " "speed and the simulation continues at Speed{}.", i)); - ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, thisFurnace.Name)); - thisFurnace.CoolVolumeFlowRate(i) = thisFurnace.CoolVolumeFlowRate(i + 1); + ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, furnace.Name)); + furnace.CoolVolumeFlowRate(i) = furnace.CoolVolumeFlowRate(i + 1); } } } if (NumOfSpeedHeating > 0) { - if (thisFurnace.FanVolFlow + 1e-10 < thisFurnace.HeatVolumeFlowRate(NumOfSpeedHeating)) { + if (furnace.FanVolFlow + 1e-10 < furnace.HeatVolumeFlowRate(NumOfSpeedHeating)) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object is less than the MSHP system air flow rate when " "heating is required ({:.7T}).", state.dataFurnaces->CurrentModuleObject, - thisFurnace.FanVolFlow, - thisFurnace.HeatVolumeFlowRate(NumOfSpeedHeating))); + furnace.FanVolFlow, + furnace.HeatVolumeFlowRate(NumOfSpeedHeating))); ShowContinueError( state, " The MSHP system flow rate when heating is required is reset to the fan flow rate and the simulation continues."); - ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, thisFurnace.Name)); - thisFurnace.HeatVolumeFlowRate(NumOfSpeedHeating) = thisFurnace.FanVolFlow; + ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, furnace.Name)); + furnace.HeatVolumeFlowRate(NumOfSpeedHeating) = furnace.FanVolFlow; - if (thisFurnace.bIsIHP) // set max fan flow rate to the IHP collection + if (furnace.isIHP) // set max fan flow rate to the IHP collection { - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).MaxHeatAirVolFlow = thisFurnace.FanVolFlow; - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).MaxHeatAirMassFlow = - thisFurnace.FanVolFlow * state.dataEnvrn->StdRhoAir; + // ihpIndex is the index of the IHP, CoolCoilNum is the index of the coil in the IHP + state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).MaxHeatAirVolFlow = furnace.FanVolFlow; + state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).MaxHeatAirMassFlow = + furnace.FanVolFlow * state.dataEnvrn->StdRhoAir; } for (int i = NumOfSpeedHeating - 1; i >= 1; --i) { - if (thisFurnace.HeatVolumeFlowRate(i) > thisFurnace.HeatVolumeFlowRate(i + 1)) { + if (furnace.HeatVolumeFlowRate(i) > furnace.HeatVolumeFlowRate(i + 1)) { ShowContinueError(state, format(" The MSHP system flow rate when heating is required is reset to the flow rate at " "higher speed and the simulation continues at Speed{}.", i)); ShowContinueError(state, - format(" Occurs in {} system = {}", state.dataFurnaces->CurrentModuleObject, thisFurnace.Name)); - thisFurnace.HeatVolumeFlowRate(i) = thisFurnace.HeatVolumeFlowRate(i + 1); + format(" Occurs in {} system = {}", state.dataFurnaces->CurrentModuleObject, furnace.Name)); + furnace.HeatVolumeFlowRate(i) = furnace.HeatVolumeFlowRate(i + 1); } } } } - if (thisFurnace.FanVolFlow < thisFurnace.IdleVolumeAirRate && thisFurnace.IdleVolumeAirRate != 0.0) { + if (furnace.FanVolFlow < furnace.IdleVolumeAirRate && furnace.IdleVolumeAirRate != 0.0) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object is less than the MSHP system air flow rate when no " "heating or cooling is needed ({:.7T}).", state.dataFurnaces->CurrentModuleObject, - thisFurnace.FanVolFlow, - thisFurnace.IdleVolumeAirRate)); + furnace.FanVolFlow, + furnace.IdleVolumeAirRate)); ShowContinueError(state, " The MSHP system flow rate when no heating or cooling is needed is reset to the fan flow rate and the " "simulation continues."); - ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, thisFurnace.Name)); - thisFurnace.IdleVolumeAirRate = thisFurnace.FanVolFlow; + ShowContinueError(state, format(" Occurs in {} = {}", state.dataFurnaces->CurrentModuleObject, furnace.Name)); + furnace.IdleVolumeAirRate = furnace.FanVolFlow; } RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the reset volume flow rates for (int i = 1; i <= NumOfSpeedCooling; ++i) { - thisFurnace.CoolMassFlowRate(i) = RhoAir * thisFurnace.CoolVolumeFlowRate(i); - if (thisFurnace.FanVolFlow > 0.0) { - thisFurnace.MSCoolingSpeedRatio(i) = thisFurnace.CoolVolumeFlowRate(i) / thisFurnace.FanVolFlow; + furnace.CoolMassFlowRate(i) = RhoAir * furnace.CoolVolumeFlowRate(i); + if (furnace.FanVolFlow > 0.0) { + furnace.MSCoolingSpeedRatio(i) = furnace.CoolVolumeFlowRate(i) / furnace.FanVolFlow; } } for (int i = 1; i <= NumOfSpeedHeating; ++i) { - thisFurnace.HeatMassFlowRate(i) = RhoAir * thisFurnace.HeatVolumeFlowRate(i); - if (thisFurnace.FanVolFlow > 0.0) { - thisFurnace.MSHeatingSpeedRatio(i) = thisFurnace.HeatVolumeFlowRate(i) / thisFurnace.FanVolFlow; + furnace.HeatMassFlowRate(i) = RhoAir * furnace.HeatVolumeFlowRate(i); + if (furnace.FanVolFlow > 0.0) { + furnace.MSHeatingSpeedRatio(i) = furnace.HeatVolumeFlowRate(i) / furnace.FanVolFlow; } } - thisFurnace.IdleMassFlowRate = RhoAir * thisFurnace.IdleVolumeAirRate; - if (thisFurnace.FanVolFlow > 0.0) { - thisFurnace.IdleSpeedRatio = thisFurnace.IdleVolumeAirRate / thisFurnace.FanVolFlow; + furnace.IdleMassFlowRate = RhoAir * furnace.IdleVolumeAirRate; + if (furnace.FanVolFlow > 0.0) { + furnace.IdleSpeedRatio = furnace.IdleVolumeAirRate / furnace.FanVolFlow; } // set the node max and min mass flow rates based on reset volume flow rates if (NumOfSpeedCooling > 0 && NumOfSpeedHeating == 0) { state.dataLoopNodes->Node(InNode).MassFlowRateMax = - max(thisFurnace.CoolMassFlowRate(NumOfSpeedCooling), thisFurnace.MaxHeatAirMassFlow); + max(furnace.CoolMassFlowRate(NumOfSpeedCooling), furnace.MaxHeatAirMassFlow); state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = - max(thisFurnace.CoolMassFlowRate(NumOfSpeedCooling), thisFurnace.MaxHeatAirMassFlow); + max(furnace.CoolMassFlowRate(NumOfSpeedCooling), furnace.MaxHeatAirMassFlow); } else if (NumOfSpeedCooling == 0 && NumOfSpeedHeating > 0) { state.dataLoopNodes->Node(InNode).MassFlowRateMax = - max(thisFurnace.MaxCoolAirMassFlow, thisFurnace.HeatMassFlowRate(NumOfSpeedHeating)); + max(furnace.MaxCoolAirMassFlow, furnace.HeatMassFlowRate(NumOfSpeedHeating)); state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = - max(thisFurnace.MaxCoolAirMassFlow, thisFurnace.HeatMassFlowRate(NumOfSpeedHeating)); + max(furnace.MaxCoolAirMassFlow, furnace.HeatMassFlowRate(NumOfSpeedHeating)); } else { state.dataLoopNodes->Node(InNode).MassFlowRateMax = - max(thisFurnace.CoolMassFlowRate(NumOfSpeedCooling), thisFurnace.HeatMassFlowRate(NumOfSpeedHeating)); + max(furnace.CoolMassFlowRate(NumOfSpeedCooling), furnace.HeatMassFlowRate(NumOfSpeedHeating)); state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = - max(thisFurnace.CoolMassFlowRate(NumOfSpeedCooling), thisFurnace.HeatMassFlowRate(NumOfSpeedHeating)); + max(furnace.CoolMassFlowRate(NumOfSpeedCooling), furnace.HeatMassFlowRate(NumOfSpeedHeating)); } state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0; @@ -5368,7 +4275,7 @@ namespace Furnaces { } } - thisFurnace.CheckFanFlow = false; + furnace.CheckFanFlow = false; } SetOnOffMassFlowRate(state, FurnaceNum, AirLoopNum, OnOffAirFlowRatio, fanOp, QZnReq, MoistureLoad, PartLoadRatio); @@ -5377,11 +4284,11 @@ namespace Furnaces { QToCoolSetPt = 0.0; QToHeatSetPt = 0.0; - if (fanOp == HVAC::FanOp::Continuous && ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0 && - ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && + if (fanOp == HVAC::FanOp::Continuous && ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0 && + ((ScheduleManager::GetCurrentScheduleValue(state, furnace.FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff)) { - if (thisFurnace.NumOfSpeedCooling > 0) { + if (furnace.NumOfSpeedCooling > 0) { CalcVarSpeedHeatPump(state, FurnaceNum, false, @@ -5411,43 +4318,43 @@ namespace Furnaces { false); } - if (thisFurnace.ControlZoneMassFlowFrac > 0.0) { - if (thisFurnace.ZoneSequenceCoolingNum > 0 && thisFurnace.ZoneSequenceHeatingNum > 0) { - QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum) - .SequencedOutputRequiredToCoolingSP(thisFurnace.ZoneSequenceCoolingNum) / - thisFurnace.ControlZoneMassFlowFrac; - QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum) - .SequencedOutputRequiredToHeatingSP(thisFurnace.ZoneSequenceHeatingNum) / - thisFurnace.ControlZoneMassFlowFrac; + if (furnace.ControlZoneMassFlowFrac > 0.0) { + if (furnace.ZoneSequenceCoolingNum > 0 && furnace.ZoneSequenceHeatingNum > 0) { + QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum) + .SequencedOutputRequiredToCoolingSP(furnace.ZoneSequenceCoolingNum) / + furnace.ControlZoneMassFlowFrac; + QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum) + .SequencedOutputRequiredToHeatingSP(furnace.ZoneSequenceHeatingNum) / + furnace.ControlZoneMassFlowFrac; } else { - QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum).OutputRequiredToCoolingSP / - thisFurnace.ControlZoneMassFlowFrac; - QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum).OutputRequiredToHeatingSP / - thisFurnace.ControlZoneMassFlowFrac; + QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum).OutputRequiredToCoolingSP / + furnace.ControlZoneMassFlowFrac; + QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum).OutputRequiredToHeatingSP / + furnace.ControlZoneMassFlowFrac; } // If the furnace has a net cooling capacity (SensibleOutput < 0) and // the zone temp is above the Tstat heating setpoint (QToHeatSetPt < 0) and // the net cooling capacity does not just offset the cooling load if (SensibleOutput < 0.0 && QToHeatSetPt < 0.0 && - std::abs(QToCoolSetPt - SensibleOutput) > (Small5WLoad / thisFurnace.ControlZoneMassFlowFrac)) { + std::abs(QToCoolSetPt - SensibleOutput) > (Small5WLoad / furnace.ControlZoneMassFlowFrac)) { // Only switch modes when humidistat is not used or no moisture load exists, otherwise let // reheat coil pick up load // IF((SensibleOutput .LT. QToHeatSetPt .AND. .NOT. Furnace(FurnaceNum)%Humidistat) .OR. & // (SensibleOutput .LT. QToHeatSetPt .AND. Furnace(FurnaceNum)%Humidistat .AND. MoistureLoad .GE. 0.0))THEN - if ((SensibleOutput < QToHeatSetPt && !thisFurnace.Humidistat) || - (SensibleOutput < QToHeatSetPt && thisFurnace.Humidistat && MoistureLoad >= 0.0)) { + if ((SensibleOutput < QToHeatSetPt && !furnace.Humidistat) || + (SensibleOutput < QToHeatSetPt && furnace.Humidistat && MoistureLoad >= 0.0)) { QZnReq = QToHeatSetPt; state.dataFurnaces->CoolingLoad = false; // Don't set mode TRUE unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::SingleCooling || - state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(furnace.ControlZoneNum) == HVAC::ThermostatType::SingleCooling || + state.dataHeatBalFanSys->TempControlType(furnace.ControlZoneNum) == HVAC::ThermostatType::Uncontrolled) { state.dataFurnaces->HeatingLoad = false; } else { state.dataFurnaces->HeatingLoad = true; } SetOnOffMassFlowRate(state, FurnaceNum, AirLoopNum, OnOffAirFlowRatio, fanOp, QZnReq, MoistureLoad, PartLoadRatio); - if (thisFurnace.NumOfSpeedCooling > 0) { + if (furnace.NumOfSpeedCooling > 0) { CalcVarSpeedHeatPump(state, FurnaceNum, false, @@ -5495,7 +4402,7 @@ namespace Furnaces { } // the net cooling capacity just offsets the cooling load, turn off cooling } else if (SensibleOutput < 0.0 && QToCoolSetPt < 0.0 && - std::abs(QToCoolSetPt - SensibleOutput) < (Small5WLoad / thisFurnace.ControlZoneMassFlowFrac)) { + std::abs(QToCoolSetPt - SensibleOutput) < (Small5WLoad / furnace.ControlZoneMassFlowFrac)) { state.dataFurnaces->CoolingLoad = false; if (state.dataFurnaces->HPDehumidificationLoadFlag) { state.dataFurnaces->CoolingLoad = true; @@ -5506,12 +4413,12 @@ namespace Furnaces { // If the furnace has a net heating capacity and the zone temp is below the Tstat cooling setpoint and // the net heating capacity does not just offset the heating load if (SensibleOutput > 0.0 && QToCoolSetPt > 0.0 && - std::abs(SensibleOutput - QToHeatSetPt) > (Small5WLoad / thisFurnace.ControlZoneMassFlowFrac)) { + std::abs(SensibleOutput - QToHeatSetPt) > (Small5WLoad / furnace.ControlZoneMassFlowFrac)) { if (SensibleOutput > QToCoolSetPt) { QZnReq = QToCoolSetPt; // Don't set mode TRUE unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::SingleHeating || - state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(furnace.ControlZoneNum) == HVAC::ThermostatType::SingleHeating || + state.dataHeatBalFanSys->TempControlType(furnace.ControlZoneNum) == HVAC::ThermostatType::Uncontrolled) { state.dataFurnaces->CoolingLoad = false; } else { state.dataFurnaces->CoolingLoad = true; @@ -5519,7 +4426,7 @@ namespace Furnaces { state.dataFurnaces->HeatingLoad = false; SetOnOffMassFlowRate(state, FurnaceNum, AirLoopNum, OnOffAirFlowRatio, fanOp, QZnReq, MoistureLoad, PartLoadRatio); - if (thisFurnace.NumOfSpeedCooling > 0) { + if (furnace.NumOfSpeedCooling > 0) { CalcVarSpeedHeatPump(state, FurnaceNum, false, @@ -5567,7 +4474,7 @@ namespace Furnaces { } // the net heating capacity just offsets the heating load, turn off heating } else if (SensibleOutput > 0.0 && QToHeatSetPt > 0.0 && - std::abs(SensibleOutput - QToHeatSetPt) < (Small5WLoad / thisFurnace.ControlZoneMassFlowFrac)) { + std::abs(SensibleOutput - QToHeatSetPt) < (Small5WLoad / furnace.ControlZoneMassFlowFrac)) { state.dataFurnaces->HeatingLoad = false; } // SensibleOutput .GT. 0.0d0 .AND. QToCoolSetPt .GT. 0.0d0 } // Furnace(FurnaceNum)%ControlZoneMassFlowFrac .GT. 0.0d0 @@ -5575,20 +4482,20 @@ namespace Furnaces { } // fanOp .EQ. FanOp::Continuous if (FirstHVACIteration) { - thisFurnace.iterationCounter = 0; - thisFurnace.iterationMode = Furnaces::ModeOfOperation::NoCoolHeat; + furnace.iterationCounter = 0; + furnace.iterationMode = Furnaces::ModeOfOperation::NoCoolHeat; } - thisFurnace.iterationCounter += 1; + furnace.iterationCounter += 1; // push iteration mode stack and set current mode - thisFurnace.iterationMode(3) = thisFurnace.iterationMode(2); - thisFurnace.iterationMode(2) = thisFurnace.iterationMode(1); + furnace.iterationMode(3) = furnace.iterationMode(2); + furnace.iterationMode(2) = furnace.iterationMode(1); if (state.dataFurnaces->CoolingLoad) { - thisFurnace.iterationMode(1) = Furnaces::ModeOfOperation::CoolingMode; + furnace.iterationMode(1) = Furnaces::ModeOfOperation::CoolingMode; } else if (state.dataFurnaces->HeatingLoad) { - thisFurnace.iterationMode(1) = Furnaces::ModeOfOperation::HeatingMode; + furnace.iterationMode(1) = Furnaces::ModeOfOperation::HeatingMode; } else { - thisFurnace.iterationMode(1) = Furnaces::ModeOfOperation::NoCoolHeat; + furnace.iterationMode(1) = Furnaces::ModeOfOperation::NoCoolHeat; } // IF small loads to meet or not converging, just shut down unit @@ -5596,11 +4503,11 @@ namespace Furnaces { ZoneLoad = 0.0; state.dataFurnaces->CoolingLoad = false; state.dataFurnaces->HeatingLoad = false; - } else if (thisFurnace.iterationCounter > (state.dataHVACGlobal->MinAirLoopIterationsAfterFirst + 4)) { + } else if (furnace.iterationCounter > (state.dataHVACGlobal->MinAirLoopIterationsAfterFirst + 4)) { // attempt to lock output (air flow) if oscillations are detected - OperatingMode = thisFurnace.iterationMode(1); - OperatingModeMinusOne = thisFurnace.iterationMode(2); - OperatingModeMinusTwo = thisFurnace.iterationMode(3); + OperatingMode = furnace.iterationMode(1); + OperatingModeMinusOne = furnace.iterationMode(2); + OperatingModeMinusTwo = furnace.iterationMode(3); Oscillate = true; if (OperatingMode == OperatingModeMinusOne && OperatingMode == OperatingModeMinusTwo) Oscillate = false; if (Oscillate) { @@ -5621,17 +4528,17 @@ namespace Furnaces { } // EMS override point - if (thisFurnace.EMSOverrideSensZoneLoadRequest) ZoneLoad = thisFurnace.EMSSensibleZoneLoadValue; - if (thisFurnace.EMSOverrideMoistZoneLoadRequest) MoistureLoad = thisFurnace.EMSMoistureZoneLoadValue; - if (thisFurnace.EMSOverrideSensZoneLoadRequest || thisFurnace.EMSOverrideMoistZoneLoadRequest) { - if ((ZoneLoad != 0.0) && (thisFurnace.EMSOverrideSensZoneLoadRequest)) { + if (furnace.EMSOverrideSensZoneLoadRequest) ZoneLoad = furnace.EMSSensibleZoneLoadValue; + if (furnace.EMSOverrideMoistZoneLoadRequest) MoistureLoad = furnace.EMSMoistureZoneLoadValue; + if (furnace.EMSOverrideSensZoneLoadRequest || furnace.EMSOverrideMoistZoneLoadRequest) { + if ((ZoneLoad != 0.0) && (furnace.EMSOverrideSensZoneLoadRequest)) { PartLoadRatio = 1.0; - } else if ((MoistureLoad != 0.0) && (thisFurnace.EMSOverrideMoistZoneLoadRequest)) { + } else if ((MoistureLoad != 0.0) && (furnace.EMSOverrideMoistZoneLoadRequest)) { PartLoadRatio = 1.0; } else { PartLoadRatio = 0.0; } - if (thisFurnace.NumOfSpeedCooling > 0) { + if (furnace.NumOfSpeedCooling > 0) { SetOnOffMassFlowRate(state, FurnaceNum, AirLoopNum, OnOffAirFlowRatio, fanOp, QZnReq, MoistureLoad, PartLoadRatio); } else { // This line is suspicious - all other calls to SetOnOffMassFlowRate pass in QZnReq, not ZoneLoad @@ -5670,9 +4577,10 @@ namespace Furnaces { // air flow rates. Use these flow rates during the Calc routines to set the average mass flow rates // based on PLR. - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Check for heat only furnace - if (thisFurnace.type != HVAC::UnitarySysType::Furnace_HeatOnly && thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatOnly) { + if (furnace.type != HVAC::UnitarySysType::Furnace_HeatOnly && + furnace.type != HVAC::UnitarySysType::Unitary_HeatOnly) { // Set the system mass flow rates if (fanOp == HVAC::FanOp::Continuous) { @@ -5680,39 +4588,39 @@ namespace Furnaces { // constant fan mode if (state.dataFurnaces->HeatingLoad) { // IF a heating and moisture load exists, operate at the cooling mass flow rate ELSE operate at the heating flow rate - if (MoistureLoad < 0.0 && thisFurnace.Humidistat && - thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.CoolingSpeedRatio; + if (MoistureLoad < 0.0 && furnace.Humidistat && + furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + state.dataFurnaces->CompOnMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.CoolingSpeedRatio; } else { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxHeatAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.HeatingSpeedRatio; + state.dataFurnaces->CompOnMassFlow = furnace.MaxHeatAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.HeatingSpeedRatio; } - thisFurnace.LastMode = Furnaces::ModeOfOperation::HeatingMode; + furnace.LastMode = Furnaces::ModeOfOperation::HeatingMode; // IF a cooling load exists, operate at the cooling mass flow rate } else if (state.dataFurnaces->CoolingLoad) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.CoolingSpeedRatio; - thisFurnace.LastMode = Furnaces::ModeOfOperation::CoolingMode; + state.dataFurnaces->CompOnMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.CoolingSpeedRatio; + furnace.LastMode = Furnaces::ModeOfOperation::CoolingMode; // If no load exists, set the compressor on mass flow rate. // Set equal the mass flow rate when no heating or cooling is needed if no moisture load exists. // If the user has set the off mass flow rate to 0, set according to the last operating mode. } else { - if (MoistureLoad < 0.0 && thisFurnace.Humidistat && - thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.CoolingSpeedRatio; + if (MoistureLoad < 0.0 && furnace.Humidistat && + furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + state.dataFurnaces->CompOnMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.CoolingSpeedRatio; } else { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxNoCoolHeatAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.HeatingSpeedRatio; + state.dataFurnaces->CompOnMassFlow = furnace.MaxNoCoolHeatAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.HeatingSpeedRatio; // User may have entered a 0 for MaxNoCoolHeatAirMassFlow if (state.dataFurnaces->CompOnMassFlow == 0.0) { - if (thisFurnace.LastMode == Furnaces::ModeOfOperation::HeatingMode) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxHeatAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.HeatingSpeedRatio; + if (furnace.LastMode == Furnaces::ModeOfOperation::HeatingMode) { + state.dataFurnaces->CompOnMassFlow = furnace.MaxHeatAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.HeatingSpeedRatio; } else { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.CoolingSpeedRatio; + state.dataFurnaces->CompOnMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.CoolingSpeedRatio; } } } @@ -5720,43 +4628,43 @@ namespace Furnaces { // Set the compressor or coil OFF mass flow rate based on LOGICAL flag // UseCompressorOnFlow is used when the user does not enter a value for no cooling or heating flow rate - if (thisFurnace.AirFlowControl == AirFlowControlConstFan::UseCompressorOnFlow) { - if (thisFurnace.LastMode == Furnaces::ModeOfOperation::HeatingMode) { - if (MoistureLoad < 0.0 && thisFurnace.Humidistat && - thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { - state.dataFurnaces->CompOffMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOffFlowRatio = thisFurnace.CoolingSpeedRatio; + if (furnace.AirFlowControl == AirFlowControlConstFan::UseCompressorOnFlow) { + if (furnace.LastMode == Furnaces::ModeOfOperation::HeatingMode) { + if (MoistureLoad < 0.0 && furnace.Humidistat && + furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + state.dataFurnaces->CompOffMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOffFlowRatio = furnace.CoolingSpeedRatio; } else { - state.dataFurnaces->CompOffMassFlow = thisFurnace.MaxHeatAirMassFlow; - state.dataFurnaces->CompOffFlowRatio = thisFurnace.HeatingSpeedRatio; + state.dataFurnaces->CompOffMassFlow = furnace.MaxHeatAirMassFlow; + state.dataFurnaces->CompOffFlowRatio = furnace.HeatingSpeedRatio; } } else { - state.dataFurnaces->CompOffMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOffFlowRatio = thisFurnace.CoolingSpeedRatio; + state.dataFurnaces->CompOffMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOffFlowRatio = furnace.CoolingSpeedRatio; } // ELSE use the user specified value } else { - state.dataFurnaces->CompOffMassFlow = thisFurnace.MaxNoCoolHeatAirMassFlow; - state.dataFurnaces->CompOffFlowRatio = thisFurnace.NoHeatCoolSpeedRatio; + state.dataFurnaces->CompOffMassFlow = furnace.MaxNoCoolHeatAirMassFlow; + state.dataFurnaces->CompOffFlowRatio = furnace.NoHeatCoolSpeedRatio; } } else { // cycling fan mode if (state.dataFurnaces->HeatingLoad || - (thisFurnace.Humidistat && MoistureLoad < 0.0 && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat)) { + (furnace.Humidistat && MoistureLoad < 0.0 && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat)) { - if (thisFurnace.Humidistat && MoistureLoad < 0.0 && - thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.CoolingSpeedRatio; - thisFurnace.LastMode = Furnaces::ModeOfOperation::CoolingMode; + if (furnace.Humidistat && MoistureLoad < 0.0 && + furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + state.dataFurnaces->CompOnMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.CoolingSpeedRatio; + furnace.LastMode = Furnaces::ModeOfOperation::CoolingMode; } else { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxHeatAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.HeatingSpeedRatio; - thisFurnace.LastMode = Furnaces::ModeOfOperation::HeatingMode; + state.dataFurnaces->CompOnMassFlow = furnace.MaxHeatAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.HeatingSpeedRatio; + furnace.LastMode = Furnaces::ModeOfOperation::HeatingMode; } } else if (state.dataFurnaces->CoolingLoad) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.CoolingSpeedRatio; + state.dataFurnaces->CompOnMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.CoolingSpeedRatio; } else { state.dataFurnaces->CompOnMassFlow = 0.0; state.dataFurnaces->CompOnFlowRatio = 0.0; @@ -5766,11 +4674,11 @@ namespace Furnaces { } } else { // Is a HeatOnly furnace - state.dataFurnaces->CompOnMassFlow = thisFurnace.DesignMassFlowRate; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.HeatingSpeedRatio; + state.dataFurnaces->CompOnMassFlow = furnace.DesignMassFlowRate; + state.dataFurnaces->CompOnFlowRatio = furnace.HeatingSpeedRatio; if (fanOp == HVAC::FanOp::Continuous) { - state.dataFurnaces->CompOffMassFlow = thisFurnace.MaxNoCoolHeatAirMassFlow; - state.dataFurnaces->CompOffFlowRatio = thisFurnace.HeatingSpeedRatio; + state.dataFurnaces->CompOffMassFlow = furnace.MaxNoCoolHeatAirMassFlow; + state.dataFurnaces->CompOffFlowRatio = furnace.HeatingSpeedRatio; } else { state.dataFurnaces->CompOffMassFlow = 0.0; state.dataFurnaces->CompOffFlowRatio = 0.0; @@ -5807,7 +4715,6 @@ namespace Furnaces { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Iter; // iteration count Real64 MulSpeedFlowScale; // variable speed air flow scaling factor - int IHPCoilIndex; // refer to cooling or heating coil in IHP Real64 dummy(0.0); bool anyRan; EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::UnitarySystemSizing, anyRan, ObjexxFCL::Optional_int_const()); // calling point @@ -5815,65 +4722,59 @@ namespace Furnaces { state.dataSize->DXCoolCap = 0.0; state.dataSize->UnitaryHeatCap = 0.0; state.dataSize->SuppHeatCap = 0.0; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - - state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanNum = thisFurnace.FanIndex; - state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanType = thisFurnace.fanType; - state.dataSize->DataFanType = thisFurnace.fanType; - state.dataSize->DataFanIndex = thisFurnace.FanIndex; - - state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanPlace = thisFurnace.fanPlace; - - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { - DXCoils::SimDXCoil(state, BlankString, HVAC::CompressorOp::On, true, thisFurnace.CoolingCoilIndex, HVAC::FanOp::Cycling, 0.0); - } else if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { - int HXCC_Index = thisFurnace.CoolingCoilIndex; - int childCCType_Num = state.dataHVACAssistedCC->HXAssistedCoil(HXCC_Index).CoolingCoilType_Num; - if (childCCType_Num == HVAC::CoilDX_Cooling) { - int childCCIndex = state.dataHVACAssistedCC->HXAssistedCoil(HXCC_Index).CoolingCoilIndex; - if (childCCIndex < 0) { - ShowContinueError(state, "Occurs in sizing HeatExchangerAssistedCoolingCoil."); - } - auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex]; - newCoil.size(state); - } - HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( - state, BlankString, true, HVAC::CompressorOp::On, 0.0, thisFurnace.CoolingCoilIndex, HVAC::FanOp::Cycling, false, 1.0, false); - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPSimple) { + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + + state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanNum = furnace.FanIndex; + state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanType = furnace.fanType; + state.dataSize->DataFanType = furnace.fanType; + state.dataSize->DataFanIndex = furnace.FanIndex; + + state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanPlace = furnace.fanPlace; + + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + DXCoils::SimDXCoil(state, BlankString, HVAC::CompressorOp::On, true, furnace.CoolCoilNum, HVAC::FanOp::Cycling, 0.0); + } else if (furnace.coolCoilType == HVAC::CoilType::DXCooling) { + auto &dxCoil = state.dataCoilCoolingDX->coilCoolingDXs[furnace.CoolCoilNum]; + dxCoil.size(state); + if (furnace.hxCoolCoilNum != 0) + HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( + state, furnace.hxCoolCoilName, true, HVAC::CompressorOp::On, 0.0, furnace.hxCoolCoilNum, HVAC::FanOp::Cycling, false, 1.0, false); + + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPSimple) { WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.CoolingCoilSensDemand, - thisFurnace.CoolingCoilLatentDemand, + furnace.CoolCoilNum, + furnace.CoolingCoilSensDemand, + furnace.CoolingCoilLatentDemand, HVAC::FanOp::Invalid, // Using invalid to mean off? HVAC::CompressorOp::Off, 0.0, FirstHVACIteration); // CoolPartLoadRatio - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPSimple) { + if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPSimple) { WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.HeatingCoilSensDemand, + furnace.HeatCoilNum, + furnace.HeatingCoilSensDemand, dummy, HVAC::FanOp::Invalid, // using Invalid to mean off? HVAC::CompressorOp::Off, 0.0, FirstHVACIteration); } - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (thisFurnace.bIsIHP) { - IntegratedHeatPump::SizeIHP(state, thisFurnace.CoolingCoilIndex); - IHPCoilIndex = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SCCoilIndex; - thisFurnace.NumOfSpeedCooling = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex) - .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NormSpedLevel); - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).CoolVolFlowScale = MulSpeedFlowScale; + + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + auto const &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.CoolCoilNum); + furnace.NumOfSpeedCooling = vsCoil.NumOfSpeeds; + MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); + + if (furnace.isIHP) { + IntegratedHeatPump::SizeIHP(state, furnace.ihpNum); + state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).CoolVolFlowScale = MulSpeedFlowScale; } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, HVAC::FanOp::Invalid, // USing Invalid for off? HVAC::CompressorOp::Off, 0.0, @@ -5882,39 +4783,31 @@ namespace Furnaces { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP - thisFurnace.NumOfSpeedCooling = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.CoolingCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = - state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.CoolingCoilIndex).RatedAirVolFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.CoolingCoilIndex) - .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.CoolingCoilIndex).NormSpedLevel); - IHPCoilIndex = thisFurnace.CoolingCoilIndex; - } - - for (Iter = 1; Iter <= thisFurnace.NumOfSpeedCooling; ++Iter) { - thisFurnace.CoolVolumeFlowRate(Iter) = - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; - thisFurnace.CoolMassFlowRate(Iter) = - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; - thisFurnace.MSCoolingSpeedRatio(Iter) = - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) / - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(thisFurnace.NumOfSpeedCooling); - } - - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { - - if (thisFurnace.bIsIHP) { - IntegratedHeatPump::SizeIHP(state, thisFurnace.CoolingCoilIndex); - IHPCoilIndex = state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).SHCoilIndex; - thisFurnace.NumOfSpeedHeating = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex) - .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NormSpedLevel); - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).HeatVolFlowScale = MulSpeedFlowScale; + } + + for (Iter = 1; Iter <= furnace.NumOfSpeedCooling; ++Iter) { + furnace.CoolVolumeFlowRate(Iter) = vsCoil.MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; + furnace.CoolMassFlowRate(Iter) = vsCoil.MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; + furnace.MSCoolingSpeedRatio(Iter) = vsCoil.MSRatedAirVolFlowRate(Iter) / vsCoil.MSRatedAirVolFlowRate(furnace.NumOfSpeedCooling); + } + + if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit || + furnace.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + + // In the case of IHP, HeatCoilNum is the index of + // the Coil in the IHP. IHP index is the index of the + // IHP object. + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.HeatCoilNum); + furnace.NumOfSpeedHeating = vsCoil.NumOfSpeeds; + MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); + + if (furnace.isIHP) { + IntegratedHeatPump::SizeIHP(state, furnace.ihpNum); + state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).HeatVolFlowScale = MulSpeedFlowScale; } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.HeatingCoilIndex, + furnace.HeatCoilNum, HVAC::FanOp::Invalid, // Invalid for off? HVAC::CompressorOp::Off, 0.0, @@ -5923,237 +4816,227 @@ namespace Furnaces { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP - thisFurnace.NumOfSpeedHeating = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.HeatingCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = - state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.HeatingCoilIndex).RatedAirVolFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.HeatingCoilIndex) - .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.HeatingCoilIndex).NormSpedLevel); - IHPCoilIndex = thisFurnace.HeatingCoilIndex; } - for (Iter = 1; Iter <= thisFurnace.NumOfSpeedHeating; ++Iter) { - thisFurnace.HeatVolumeFlowRate(Iter) = - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; - thisFurnace.HeatMassFlowRate(Iter) = - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; - thisFurnace.MSHeatingSpeedRatio(Iter) = - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) / - state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(thisFurnace.NumOfSpeedHeating); + for (Iter = 1; Iter <= furnace.NumOfSpeedHeating; ++Iter) { + furnace.HeatVolumeFlowRate(Iter) = vsCoil.MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; + furnace.HeatMassFlowRate(Iter) = vsCoil.MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; + furnace.MSHeatingSpeedRatio(Iter) = vsCoil.MSRatedAirVolFlowRate(Iter) / vsCoil.MSRatedAirVolFlowRate(furnace.NumOfSpeedHeating); } } - if (thisFurnace.NumOfSpeedHeating > 0) { - thisFurnace.IdleMassFlowRate = min(thisFurnace.HeatMassFlowRate(1), thisFurnace.CoolMassFlowRate(1)); - thisFurnace.IdleSpeedRatio = min(thisFurnace.MSHeatingSpeedRatio(1), thisFurnace.MSCoolingSpeedRatio(1)); - thisFurnace.IdleVolumeAirRate = min(thisFurnace.HeatVolumeFlowRate(1), thisFurnace.CoolVolumeFlowRate(1)); + if (furnace.NumOfSpeedHeating > 0) { + furnace.IdleMassFlowRate = min(furnace.HeatMassFlowRate(1), furnace.CoolMassFlowRate(1)); + furnace.IdleSpeedRatio = min(furnace.MSHeatingSpeedRatio(1), furnace.MSCoolingSpeedRatio(1)); + furnace.IdleVolumeAirRate = min(furnace.HeatVolumeFlowRate(1), furnace.CoolVolumeFlowRate(1)); } else { - thisFurnace.IdleMassFlowRate = thisFurnace.CoolMassFlowRate(1); - thisFurnace.IdleSpeedRatio = thisFurnace.MSCoolingSpeedRatio(1); - thisFurnace.IdleVolumeAirRate = thisFurnace.CoolVolumeFlowRate(1); + furnace.IdleMassFlowRate = furnace.CoolMassFlowRate(1); + furnace.IdleSpeedRatio = furnace.MSCoolingSpeedRatio(1); + furnace.IdleVolumeAirRate = furnace.CoolVolumeFlowRate(1); } - if (thisFurnace.fanOp == HVAC::FanOp::Continuous) { - thisFurnace.MaxNoCoolHeatAirVolFlow = thisFurnace.IdleVolumeAirRate; - thisFurnace.MaxNoCoolHeatAirMassFlow = thisFurnace.IdleMassFlowRate; - thisFurnace.NoHeatCoolSpeedRatio = thisFurnace.IdleSpeedRatio; + if (furnace.fanOp == HVAC::FanOp::Continuous) { + furnace.MaxNoCoolHeatAirVolFlow = furnace.IdleVolumeAirRate; + furnace.MaxNoCoolHeatAirMassFlow = furnace.IdleMassFlowRate; + furnace.NoHeatCoolSpeedRatio = furnace.IdleSpeedRatio; } } - if (thisFurnace.DesignFanVolFlowRate == DataSizing::AutoSize) { + if (furnace.DesignFanVolFlowRate == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); if (state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow >= HVAC::SmallAirVolFlow) { - thisFurnace.DesignFanVolFlowRate = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; + furnace.DesignFanVolFlowRate = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; } else { - thisFurnace.DesignFanVolFlowRate = 0.0; + furnace.DesignFanVolFlowRate = 0.0; } - if (thisFurnace.DesignFanVolFlowRateEMSOverrideOn) { - thisFurnace.DesignFanVolFlowRate = thisFurnace.DesignFanVolFlowRateEMSOverrideValue; + if (furnace.DesignFanVolFlowRateEMSOverrideOn) { + furnace.DesignFanVolFlowRate = furnace.DesignFanVolFlowRateEMSOverrideValue; } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Supply Air Flow Rate [m3/s]", - thisFurnace.DesignFanVolFlowRate); + furnace.DesignFanVolFlowRate); } } - if (thisFurnace.MaxHeatAirVolFlow == DataSizing::AutoSize) { + if (furnace.MaxHeatAirVolFlow == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); if (state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow >= HVAC::SmallAirVolFlow) { - thisFurnace.MaxHeatAirVolFlow = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; + furnace.MaxHeatAirVolFlow = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; } else { - thisFurnace.MaxHeatAirVolFlow = 0.0; + furnace.MaxHeatAirVolFlow = 0.0; } - if (thisFurnace.MaxHeatAirVolFlowEMSOverrideOn) { - thisFurnace.MaxHeatAirVolFlow = thisFurnace.MaxHeatAirVolFlowEMSOverrideValue; + if (furnace.MaxHeatAirVolFlowEMSOverrideOn) { + furnace.MaxHeatAirVolFlow = furnace.MaxHeatAirVolFlowEMSOverrideValue; } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Supply Air Flow Rate During Heating Operation [m3/s]", - thisFurnace.MaxHeatAirVolFlow); + furnace.MaxHeatAirVolFlow); } } - if (thisFurnace.MaxCoolAirVolFlow == DataSizing::AutoSize) { + if (furnace.MaxCoolAirVolFlow == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); if (state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow >= HVAC::SmallAirVolFlow) { - thisFurnace.MaxCoolAirVolFlow = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; + furnace.MaxCoolAirVolFlow = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; } else { - thisFurnace.MaxCoolAirVolFlow = 0.0; + furnace.MaxCoolAirVolFlow = 0.0; } - if (thisFurnace.MaxCoolAirVolFlowEMSOverrideOn) { - thisFurnace.MaxCoolAirVolFlow = thisFurnace.MaxCoolAirVolFlowEMSOverrideValue; + if (furnace.MaxCoolAirVolFlowEMSOverrideOn) { + furnace.MaxCoolAirVolFlow = furnace.MaxCoolAirVolFlowEMSOverrideValue; } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Supply Air Flow Rate During Cooling Operation [m3/s]", - thisFurnace.MaxCoolAirVolFlow); + furnace.MaxCoolAirVolFlow); } } - if (thisFurnace.MaxNoCoolHeatAirVolFlow == DataSizing::AutoSize) { + if (furnace.MaxNoCoolHeatAirVolFlow == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); if (state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow >= HVAC::SmallAirVolFlow) { - thisFurnace.MaxNoCoolHeatAirVolFlow = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; + furnace.MaxNoCoolHeatAirVolFlow = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; } else { - thisFurnace.MaxNoCoolHeatAirVolFlow = 0.0; + furnace.MaxNoCoolHeatAirVolFlow = 0.0; } - if (thisFurnace.MaxNoCoolHeatAirVolFlowEMSOverrideOn) { - thisFurnace.MaxNoCoolHeatAirVolFlow = thisFurnace.MaxNoCoolHeatAirVolFlowEMSOverrideValue; + if (furnace.MaxNoCoolHeatAirVolFlowEMSOverrideOn) { + furnace.MaxNoCoolHeatAirVolFlow = furnace.MaxNoCoolHeatAirVolFlowEMSOverrideValue; } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Supply Air Flow Rate When No Cooling or Heating is Needed [m3/s]", - thisFurnace.MaxNoCoolHeatAirVolFlow); + furnace.MaxNoCoolHeatAirVolFlow); } } - if (thisFurnace.DesignHeatingCapacity == DataSizing::AutoSize) { + if (furnace.DesignHeatingCapacity == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPSimple) { - thisFurnace.DesignHeatingCapacity = - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(thisFurnace.HeatingCoilIndex).RatedCapHeat; + if (furnace.heatCoilType == HVAC::CoilType::HeatingWaterToAirHPSimple) { + furnace.DesignHeatingCapacity = + state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(furnace.HeatCoilNum).RatedCapHeat; } else { - thisFurnace.DesignHeatingCapacity = state.dataSize->DXCoolCap; + furnace.DesignHeatingCapacity = state.dataSize->DXCoolCap; } } else { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); - thisFurnace.DesignHeatingCapacity = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatCap; + furnace.DesignHeatingCapacity = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatCap; } - if (thisFurnace.DesignHeatingCapacity < HVAC::SmallLoad) { - thisFurnace.DesignHeatingCapacity = 0.0; + if (furnace.DesignHeatingCapacity < HVAC::SmallLoad) { + furnace.DesignHeatingCapacity = 0.0; } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Nominal Heating Capacity [W]", - thisFurnace.DesignHeatingCapacity); + furnace.DesignHeatingCapacity); } } - if (thisFurnace.DesignCoolingCapacity == DataSizing::AutoSize) { + if (furnace.DesignCoolingCapacity == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); if (state.dataSize->DXCoolCap >= HVAC::SmallLoad) { - thisFurnace.DesignCoolingCapacity = state.dataSize->DXCoolCap; + furnace.DesignCoolingCapacity = state.dataSize->DXCoolCap; } else { - thisFurnace.DesignCoolingCapacity = 0.0; + furnace.DesignCoolingCapacity = 0.0; } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Nominal Cooling Capacity [W]", - thisFurnace.DesignCoolingCapacity); + furnace.DesignCoolingCapacity); } } - if (thisFurnace.DesignMaxOutletTemp == DataSizing::AutoSize) { + if (furnace.DesignMaxOutletTemp == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); - thisFurnace.DesignMaxOutletTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatSupTemp; + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); + furnace.DesignMaxOutletTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatSupTemp; BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Maximum Supply Air Temperature from Supplemental Heater [C]", - thisFurnace.DesignMaxOutletTemp); + furnace.DesignMaxOutletTemp); } } - if (thisFurnace.DesignSuppHeatingCapacity == DataSizing::AutoSize) { + if (furnace.DesignSuppHeatingCapacity == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name); - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + CheckSysSizing(state, HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name); + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { // set the supplemental heating capacity to the actual heating load - thisFurnace.DesignSuppHeatingCapacity = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatCap; + furnace.DesignSuppHeatingCapacity = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatCap; // if reheat needed for humidity control, make sure supplemental heating is at least as big // as the cooling capacity - if (thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { - thisFurnace.DesignSuppHeatingCapacity = max(thisFurnace.DesignSuppHeatingCapacity, thisFurnace.DesignCoolingCapacity); - if (thisFurnace.DesignSuppHeatingCapacity < HVAC::SmallLoad) { - thisFurnace.DesignSuppHeatingCapacity = 0.0; + if (furnace.Humidistat && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + furnace.DesignSuppHeatingCapacity = max(furnace.DesignSuppHeatingCapacity, furnace.DesignCoolingCapacity); + if (furnace.DesignSuppHeatingCapacity < HVAC::SmallLoad) { + furnace.DesignSuppHeatingCapacity = 0.0; } } } else { - if (thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { - thisFurnace.DesignSuppHeatingCapacity = thisFurnace.DesignCoolingCapacity; + if (furnace.Humidistat && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + furnace.DesignSuppHeatingCapacity = furnace.DesignCoolingCapacity; } else { - thisFurnace.DesignSuppHeatingCapacity = 0.0; + furnace.DesignSuppHeatingCapacity = 0.0; } } BaseSizer::reportSizerOutput(state, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, "Supplemental Heating Coil Nominal Capacity [W]", - thisFurnace.DesignSuppHeatingCapacity); + furnace.DesignSuppHeatingCapacity); } } - state.dataSize->UnitaryHeatCap = thisFurnace.DesignHeatingCapacity; - state.dataSize->SuppHeatCap = thisFurnace.DesignSuppHeatingCapacity; + state.dataSize->UnitaryHeatCap = furnace.DesignHeatingCapacity; + state.dataSize->SuppHeatCap = furnace.DesignSuppHeatingCapacity; } // End Initialization Section of the Module @@ -6200,14 +5083,14 @@ namespace Furnaces { Real64 ActualLatentOutput; // Actual furnace latent capacity = 0 Real64 deltaT; // Heater outlet temp minus design heater outlet temp - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Retrieve the load on the controlled zone - auto &furnaceInNode = state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum); - auto const &furnaceOutNode = state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum); - int ControlZoneNode = thisFurnace.NodeNumOfControlledZone; - HVAC::FanOp fanOp = thisFurnace.fanOp; // fan operating mode - thisFurnace.MdotFurnace = thisFurnace.DesignMassFlowRate; - thisFurnace.CoolPartLoadRatio = 0.0; + auto &furnaceInNode = state.dataLoopNodes->Node(furnace.FurnaceInletNode); + auto const &furnaceOutNode = state.dataLoopNodes->Node(furnace.FurnaceOutletNode); + int ControlZoneNode = furnace.NodeNumOfControlledZone; + HVAC::FanOp fanOp = furnace.fanOp; // fan operating mode + furnace.MdotFurnace = furnace.DesignMassFlowRate; + furnace.CoolPartLoadRatio = 0.0; // Calculate the Cp Air of zone Real64 cpair = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ControlZoneNode).HumRat); @@ -6217,11 +5100,11 @@ namespace Furnaces { state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; } else { // If Furnace runs then set HeatCoilLoad on Heating Coil and the Mass Flow - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && + if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && (state.dataFurnaces->HeatingLoad)) { - furnaceInNode.MassFlowRate = thisFurnace.MdotFurnace; - HeatCoilLoad = thisFurnace.DesignHeatingCapacity; + furnaceInNode.MassFlowRate = furnace.MdotFurnace; + HeatCoilLoad = furnace.DesignHeatingCapacity; SystemSensibleLoad = ZoneLoad; // Get no load result @@ -6250,7 +5133,7 @@ namespace Furnaces { OnOffAirFlowRatio, false); - furnaceInNode.MassFlowRate = thisFurnace.MdotFurnace; + furnaceInNode.MassFlowRate = furnace.MdotFurnace; // Set fan part-load fraction equal to 1 while getting full load result state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; @@ -6278,12 +5161,12 @@ namespace Furnaces { PartLoadRatio = max(MinPLR, min(1.0, std::abs(SystemSensibleLoad - NoSensibleOutput) / std::abs(FullSensibleOutput - NoSensibleOutput))); if (fanOp == HVAC::FanOp::Cycling) { - furnaceInNode.MassFlowRate = thisFurnace.MdotFurnace * PartLoadRatio; - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * PartLoadRatio; + furnaceInNode.MassFlowRate = furnace.MdotFurnace * PartLoadRatio; + HeatCoilLoad = furnace.DesignHeatingCapacity * PartLoadRatio; } else { // FanOp::Continuous - if (furnaceOutNode.Temp > thisFurnace.DesignMaxOutletTemp) { - deltaT = furnaceOutNode.Temp - thisFurnace.DesignMaxOutletTemp; - if (HeatCoilLoad > thisFurnace.DesignHeatingCapacity) HeatCoilLoad = thisFurnace.DesignHeatingCapacity; + if (furnaceOutNode.Temp > furnace.DesignMaxOutletTemp) { + deltaT = furnaceOutNode.Temp - furnace.DesignMaxOutletTemp; + if (HeatCoilLoad > furnace.DesignHeatingCapacity) HeatCoilLoad = furnace.DesignHeatingCapacity; HeatCoilLoad -= furnaceInNode.MassFlowRate * cpair * deltaT; } else { HeatCoilLoad = SystemSensibleLoad - NoSensibleOutput; @@ -6291,13 +5174,13 @@ namespace Furnaces { } // Calculate the part load ratio through iteration - HeatErrorToler = thisFurnace.HeatingConvergenceTolerance; // Error tolerance for convergence from input deck + HeatErrorToler = furnace.HeatingConvergenceTolerance; // Error tolerance for convergence from input deck Error = 1.0; // initialize error value for comparison against tolerance state.dataFurnaces->Iter = 0; // initialize iteration counter IterRelax = 0.9; // relaxation factor for iterations while (state.dataFurnaces->Iter <= MaxIter) { - if (fanOp == HVAC::FanOp::Cycling) furnaceInNode.MassFlowRate = thisFurnace.MdotFurnace * PartLoadRatio; + if (fanOp == HVAC::FanOp::Cycling) furnaceInNode.MassFlowRate = furnace.MdotFurnace * PartLoadRatio; CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -6320,9 +5203,9 @@ namespace Furnaces { PartLoadRatio + IterRelax * (SystemSensibleLoad - ActualSensibleOutput) / (FullSensibleOutput - NoSensibleOutput))); // limit the heating coil outlet air temperature to DesignMaxOutletTemp - if (furnaceOutNode.Temp > thisFurnace.DesignMaxOutletTemp) { - deltaT = furnaceOutNode.Temp - thisFurnace.DesignMaxOutletTemp; - if (HeatCoilLoad > thisFurnace.DesignHeatingCapacity) HeatCoilLoad = thisFurnace.DesignHeatingCapacity; + if (furnaceOutNode.Temp > furnace.DesignMaxOutletTemp) { + deltaT = furnaceOutNode.Temp - furnace.DesignMaxOutletTemp; + if (HeatCoilLoad > furnace.DesignHeatingCapacity) HeatCoilLoad = furnace.DesignHeatingCapacity; HeatCoilLoad -= furnaceInNode.MassFlowRate * cpair * deltaT; CalcFurnaceOutput(state, FurnaceNum, @@ -6344,7 +5227,7 @@ namespace Furnaces { PartLoadRatio + IterRelax * (SystemSensibleLoad - ActualSensibleOutput) / (FullSensibleOutput - NoSensibleOutput))); } else { - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * PartLoadRatio; + HeatCoilLoad = furnace.DesignHeatingCapacity * PartLoadRatio; } if (PartLoadRatio == MinPLR) break; @@ -6355,45 +5238,45 @@ namespace Furnaces { } if (state.dataFurnaces->Iter > MaxIter) { - if (thisFurnace.HeatingMaxIterIndex2 == 0) { + if (furnace.HeatingMaxIterIndex2 == 0) { ShowWarningMessage(state, format("{} \"{}\" -- Exceeded max heating iterations ({}) while adjusting furnace runtime.", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name, MaxIter)); ShowContinueErrorTimeStamp(state, ""); } ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" -- Exceeded max heating iterations error continues...", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.HeatingMaxIterIndex2); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.HeatingMaxIterIndex2); } } else { // ELSE from IF(FullSensibleOutput.GT.NoSensibleOutput)THEN above // Set part load ratio to 1 and run heater at design heating capacity PartLoadRatio = 1.0; - HeatCoilLoad = thisFurnace.DesignHeatingCapacity; + HeatCoilLoad = furnace.DesignHeatingCapacity; } // Set the final results // IF (fanOp .EQ. FanOp::Cycling) THEN // Furnace(FurnaceNum)%MdotFurnace = Furnace(FurnaceNum)%MdotFurnace * PartLoadRatio // END IF - thisFurnace.MdotFurnace = furnaceInNode.MassFlowRate; + furnace.MdotFurnace = furnaceInNode.MassFlowRate; - } else if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && + } else if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && (fanOp == HVAC::FanOp::Continuous)) { HeatCoilLoad = 0.0; } else { // no heating and no flow - thisFurnace.MdotFurnace = 0.0; + furnace.MdotFurnace = 0.0; HeatCoilLoad = 0.0; } // End of the Scheduled Furnace If block } // End of the FirstHVACIteration control of the mass flow If block // Set the fan inlet node flow rates - furnaceInNode.MassFlowRateMaxAvail = thisFurnace.MdotFurnace; - furnaceInNode.MassFlowRate = thisFurnace.MdotFurnace; + furnaceInNode.MassFlowRateMaxAvail = furnace.MdotFurnace; + furnaceInNode.MassFlowRate = furnace.MdotFurnace; } void CalcNewZoneHeatCoolFlowRates(EnergyPlusData &state, @@ -6492,12 +5375,12 @@ namespace Furnaces { Real64 OutdoorDryBulbTemp; // secondary coil (condenser) entering dry bulb temperature Real64 &SystemSensibleLoad = state.dataFurnaces->SystemSensibleLoad; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Set local variables - int FurnaceOutletNode = thisFurnace.FurnaceOutletNodeNum; - int FurnaceInletNode = thisFurnace.FurnaceInletNodeNum; - int ControlZoneNode = thisFurnace.NodeNumOfControlledZone; - HVAC::FanOp fanOp = thisFurnace.fanOp; // fan operating mode + int FurnaceOutletNode = furnace.FurnaceOutletNode; + int FurnaceInletNode = furnace.FurnaceInletNode; + int ControlZoneNode = furnace.NodeNumOfControlledZone; + HVAC::FanOp fanOp = furnace.fanOp; // fan operating mode bool HumControl = false; // Calculate the Cp Air of zone Real64 cpair = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ControlZoneNode).HumRat); @@ -6508,17 +5391,17 @@ namespace Furnaces { ReheatCoilLoad = 0.0; PartLoadRatio = 0.0; - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { - if (state.dataDXCoils->DXCoil(thisFurnace.HeatingCoilIndex) + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { + if (state.dataDXCoils->DXCoil(furnace.HeatCoilNum) .IsSecondaryDXCoilInZone) { // assumes compressor is in same location as secondary coil OutdoorDryBulbTemp = - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(thisFurnace.HeatingCoilIndex).SecZonePtr).ZT; - } else if (state.dataDXCoils->DXCoil(thisFurnace.CoolingCoilIndex).IsSecondaryDXCoilInZone) { + state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(furnace.HeatCoilNum).SecZonePtr).ZT; + } else if (state.dataDXCoils->DXCoil(furnace.CoolCoilNum).IsSecondaryDXCoilInZone) { OutdoorDryBulbTemp = - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(thisFurnace.CoolingCoilIndex).SecZonePtr).ZT; + state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(furnace.CoolCoilNum).SecZonePtr).ZT; } else { - if (thisFurnace.CondenserNodeNum > 0) { - OutdoorDryBulbTemp = state.dataLoopNodes->Node(thisFurnace.CondenserNodeNum).Temp; + if (furnace.CondenserNodeNum > 0) { + OutdoorDryBulbTemp = state.dataLoopNodes->Node(furnace.CondenserNodeNum).Temp; } else { OutdoorDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; } @@ -6531,44 +5414,44 @@ namespace Furnaces { // Init for heating if (state.dataFurnaces->HeatingLoad) { - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && thisFurnace.WatertoAirHPType == WAHPCoilType::Simple)) { - thisFurnace.HeatPartLoadRatio = 1.0; + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && furnace.WatertoAirHPType == WAHPCoilType::Simple)) { + furnace.HeatPartLoadRatio = 1.0; HeatCoilLoad = 0.0; - thisFurnace.HeatingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; + furnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; } else { // for furnaces - thisFurnace.HeatPartLoadRatio = 0.0; + furnace.HeatPartLoadRatio = 0.0; HeatCoilLoad = ZoneLoad; - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; - thisFurnace.HeatingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; + furnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; } ReheatCoilLoad = 0.0; - thisFurnace.CoolPartLoadRatio = 0.0; + furnace.CoolPartLoadRatio = 0.0; // Init for cooling } else if (state.dataFurnaces->CoolingLoad) { // air to air heat pumps - thisFurnace.CoolPartLoadRatio = 1.0; - thisFurnace.HeatPartLoadRatio = 0.0; + furnace.CoolPartLoadRatio = 1.0; + furnace.HeatPartLoadRatio = 0.0; HeatCoilLoad = 0.0; ReheatCoilLoad = 0.0; // Init for moisture load only } else { - thisFurnace.CoolPartLoadRatio = 0.0; - thisFurnace.HeatPartLoadRatio = 0.0; + furnace.CoolPartLoadRatio = 0.0; + furnace.HeatPartLoadRatio = 0.0; HeatCoilLoad = 0.0; ReheatCoilLoad = 0.0; - thisFurnace.HeatingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; + furnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; } - SetAverageAirFlow(state, FurnaceNum, max(thisFurnace.HeatPartLoadRatio, thisFurnace.CoolPartLoadRatio), OnOffAirFlowRatio); + SetAverageAirFlow(state, FurnaceNum, max(furnace.HeatPartLoadRatio, furnace.CoolPartLoadRatio), OnOffAirFlowRatio); // if dehumidification load exists (for heat pumps) turn on the supplemental heater if (state.dataFurnaces->HPDehumidificationLoadFlag) HumControl = true; } else { // not FirstHVACIteration @@ -6576,14 +5459,14 @@ namespace Furnaces { Real64 &CoolCoilLoad = state.dataFurnaces->CoolCoilLoad; if (state.dataFurnaces->HeatingLoad) { CoolCoilLoad = 0.0; - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && thisFurnace.WatertoAirHPType == WAHPCoilType::Simple)) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && furnace.WatertoAirHPType == WAHPCoilType::Simple)) { SystemSensibleLoad = ZoneLoad; SystemMoistureLoad = 0.0; HeatCoilLoad = 0.0; - thisFurnace.HeatingCoilSensDemand = SystemSensibleLoad; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; + furnace.HeatingCoilSensDemand = SystemSensibleLoad; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; } else { SystemMoistureLoad = MoistureLoad; HeatCoilLoad = ZoneLoad; @@ -6594,9 +5477,9 @@ namespace Furnaces { CoolCoilLoad = ZoneLoad; SystemMoistureLoad = MoistureLoad; HeatCoilLoad = 0.0; - thisFurnace.CoolingCoilSensDemand = std::abs(CoolCoilLoad); - thisFurnace.CoolingCoilLatentDemand = std::abs(SystemMoistureLoad); - thisFurnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = std::abs(CoolCoilLoad); + furnace.CoolingCoilLatentDemand = std::abs(SystemMoistureLoad); + furnace.HeatingCoilSensDemand = 0.0; // Init for latent } else { @@ -6604,30 +5487,30 @@ namespace Furnaces { CoolCoilLoad = 0.0; HeatCoilLoad = 0.0; // set report variables - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = SystemMoistureLoad; - thisFurnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = SystemMoistureLoad; + furnace.HeatingCoilSensDemand = 0.0; } HeatingSensibleOutput = 0.0; HeatingLatentOutput = 0.0; ReheatCoilLoad = 0.0; - thisFurnace.CoolPartLoadRatio = 0.0; - thisFurnace.HeatPartLoadRatio = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; - thisFurnace.DehumidInducedHeatingDemandRate = 0.0; + furnace.CoolPartLoadRatio = 0.0; + furnace.HeatPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; + furnace.DehumidInducedHeatingDemandRate = 0.0; // When humidity control is used with cycling fan control and a heating load exists, if a moisture load // also exists, the heating PLR must be available for the cooling coil calculations. //*********** Heating Section ************ // If Furnace runs with a heating load then set HeatCoilLoad on Heating Coil and the Mass Flow // (Node(FurnaceInletNode)%MassFlowRate .gt. 0.0d0) .and. & - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && (state.dataFurnaces->HeatingLoad)) { + if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0) && (state.dataFurnaces->HeatingLoad)) { // Heat pumps only calculate a single PLR each time step (i.e. only cooling or heating allowed in a single time step) - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && thisFurnace.WatertoAirHPType == WAHPCoilType::Simple)) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && furnace.WatertoAirHPType == WAHPCoilType::Simple)) { - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; // Get no load result if (fanOp == HVAC::FanOp::Cycling) { @@ -6640,7 +5523,7 @@ namespace Furnaces { SetAverageAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); // Set the input parameters for CalcFurnaceOutput - thisFurnace.CompPartLoadRatio = 0.0; // compressor off + furnace.CompPartLoadRatio = 0.0; // compressor off CalcFurnaceOutput(state, FurnaceNum, @@ -6657,9 +5540,9 @@ namespace Furnaces { false); PartLoadRatio = 1.0; - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; - thisFurnace.CompPartLoadRatio = 1.0; // compressor ON + furnace.CompPartLoadRatio = 1.0; // compressor ON // Set fan part-load fraction equal to 1 while getting full load result state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; @@ -6685,7 +5568,7 @@ namespace Furnaces { if (SystemSensibleLoad < FullSensibleOutput && SystemSensibleLoad > NoHeatOutput) { // Calculate the part load ratio through iteration - HeatErrorToler = thisFurnace.HeatingConvergenceTolerance; // Error tolerance for convergence from input deck + HeatErrorToler = furnace.HeatingConvergenceTolerance; // Error tolerance for convergence from input deck int SolFlag = 0; // # of iterations if positive, -1 means failed to converge, -2 means bounds are incorrect // HeatErrorToler is in fraction of load, MaxIter = 30, SolFalg = # of iterations or error as appropriate @@ -6721,11 +5604,11 @@ namespace Furnaces { OnOffAirFlowRatio, false); if (std::abs(SystemSensibleLoad - TempHeatOutput) > HVAC::SmallLoad) { - if (thisFurnace.DXHeatingMaxIterIndex == 0) { + if (furnace.DXHeatingMaxIterIndex == 0) { ShowWarningMessage(state, format("Heating coil control failed to converge for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Iteration limit exceeded in calculating DX heating coil sensible part-load ratio."); ShowContinueErrorTimeStamp( @@ -6739,18 +5622,18 @@ namespace Furnaces { format("{} \"{}\" - Iteration limit exceeded in calculating DX sensible heating " "part-load ratio error continues. " "Sensible load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.DXHeatingMaxIterIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.DXHeatingMaxIterIndex, SystemSensibleLoad, SystemSensibleLoad); } } else if (SolFlag == -2) { - if (thisFurnace.DXHeatingRegulaFalsiFailedIndex == 0) { + if (furnace.DXHeatingRegulaFalsiFailedIndex == 0) { ShowWarningMessage(state, format("Heating coil control failed for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " DX sensible heating part-load ratio determined to be outside the range of 0-1."); ShowContinueErrorTimeStamp( state, @@ -6760,50 +5643,50 @@ namespace Furnaces { ShowRecurringWarningErrorAtEnd( state, format("{} \"{}\" - DX sensible heating part-load ratio out of range error continues. Sensible load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.DXHeatingRegulaFalsiFailedIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.DXHeatingRegulaFalsiFailedIndex, SystemSensibleLoad, SystemSensibleLoad); } } - thisFurnace.HeatPartLoadRatio = PartLoadRatio; + furnace.HeatPartLoadRatio = PartLoadRatio; // Check if Heat Pump compressor is allowed to run based on outdoor temperature - if (OutdoorDryBulbTemp > thisFurnace.MinOATCompressorHeating) { - thisFurnace.CompPartLoadRatio = PartLoadRatio; + if (OutdoorDryBulbTemp > furnace.MinOATCompressorHeating) { + furnace.CompPartLoadRatio = PartLoadRatio; } else { - thisFurnace.CompPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; } } else if (SystemSensibleLoad > FullSensibleOutput) { // SystemSensibleLoad is greater than full DX Heating coil output so heat pump runs entire // timestep and additional supplemental heating is required - thisFurnace.HeatPartLoadRatio = 1.0; - if (OutdoorDryBulbTemp > thisFurnace.MinOATCompressorHeating) { + furnace.HeatPartLoadRatio = 1.0; + if (OutdoorDryBulbTemp > furnace.MinOATCompressorHeating) { // Check to see if Heat Pump compressor was allowed to run based on outdoor temperature - thisFurnace.CompPartLoadRatio = 1.0; + furnace.CompPartLoadRatio = 1.0; } else { - thisFurnace.CompPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; } } else if (SystemSensibleLoad < NoHeatOutput) { // SystemSensibleLoad is less than minimum DX Heating coil output so heat pump does not run and // the load will be met by the supplemental heater - thisFurnace.CompPartLoadRatio = 0.0; - thisFurnace.HeatPartLoadRatio = 1.0; + furnace.CompPartLoadRatio = 0.0; + furnace.HeatPartLoadRatio = 1.0; } - if (thisFurnace.HeatPartLoadRatio == 1.0) { + if (furnace.HeatPartLoadRatio == 1.0) { // Determine the load on the supplemental heating coil - if ((SystemSensibleLoad - FullSensibleOutput) > thisFurnace.DesignSuppHeatingCapacity) { - HeatCoilLoad = thisFurnace.DesignSuppHeatingCapacity; - TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceOutletNode).Temp + HeatCoilLoad / (cpair * thisFurnace.MdotFurnace); + if ((SystemSensibleLoad - FullSensibleOutput) > furnace.DesignSuppHeatingCapacity) { + HeatCoilLoad = furnace.DesignSuppHeatingCapacity; + TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceOutletNode).Temp + HeatCoilLoad / (cpair * furnace.MdotFurnace); } else if (SystemSensibleLoad < NoHeatOutput) { HeatCoilLoad = max(0.0, SystemSensibleLoad); // BG 10/22/2008 need a case for when its all suppl heat - TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceInletNode).Temp + HeatCoilLoad / (cpair * thisFurnace.MdotFurnace); + TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceInletNode).Temp + HeatCoilLoad / (cpair * furnace.MdotFurnace); } else { HeatCoilLoad = max(0.0, (SystemSensibleLoad - FullSensibleOutput)); - TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceOutletNode).Temp + HeatCoilLoad / (cpair * thisFurnace.MdotFurnace); + TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceOutletNode).Temp + HeatCoilLoad / (cpair * furnace.MdotFurnace); } - if (OutdoorDryBulbTemp > thisFurnace.MaxOATSuppHeat) { + if (OutdoorDryBulbTemp > furnace.MaxOATSuppHeat) { HeatCoilLoad = 0.0; if (SystemSensibleLoad < NoHeatOutput) { TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceInletNode).Temp; @@ -6811,13 +5694,13 @@ namespace Furnaces { TempOutHeatingCoil = state.dataLoopNodes->Node(FurnaceOutletNode).Temp; } } - if ((TempOutHeatingCoil > thisFurnace.DesignMaxOutletTemp) && (HeatCoilLoad > 0.0)) { + if ((TempOutHeatingCoil > furnace.DesignMaxOutletTemp) && (HeatCoilLoad > 0.0)) { // deltaT = Furnace(FurnaceNum)%DesignMaxOutletTemp - Node(FurnaceOutletNode)%Temp // BG 10/22/2008 above made no sense if DX heat is off and its all supplemental, // because Node(FurnaceOutletNode)%Temp will have been calc'd with full DX heat in last faux call to CalcFurnaceOutput Real64 cpairSupply = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(FurnaceInletNode).HumRat); - deltaT = (thisFurnace.DesignMaxOutletTemp - TempOutHeatingCoil); + deltaT = (furnace.DesignMaxOutletTemp - TempOutHeatingCoil); HeatCoilLoad += (state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate * cpairSupply * deltaT); HeatCoilLoad = max(0.0, HeatCoilLoad); } @@ -6831,8 +5714,8 @@ namespace Furnaces { } else { // else not a heatpump DX coil ** non-HP heating coils are not DX so testing if OutdoorDryBulbTemp < MinOATCompressorHeating // is not necessary ** - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; - HeatCoilLoad = thisFurnace.DesignHeatingCapacity; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; + HeatCoilLoad = furnace.DesignHeatingCapacity; SystemSensibleLoad = ZoneLoad; // Get no load result @@ -6862,7 +5745,7 @@ namespace Furnaces { false); if (NoHeatOutput < SystemSensibleLoad) { - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; // Set fan part-load fraction equal to 1 while getting full load result state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; @@ -6898,7 +5781,7 @@ namespace Furnaces { if (state.dataFurnaces->ModifiedHeatCoilLoad > 0.0) { HeatCoilLoad = state.dataFurnaces->ModifiedHeatCoilLoad; } else { - HeatCoilLoad = thisFurnace.DesignHeatingCapacity; + HeatCoilLoad = furnace.DesignHeatingCapacity; } } else if (NoHeatOutput >= SystemSensibleLoad) { PartLoadRatio = 0.0; @@ -6906,7 +5789,7 @@ namespace Furnaces { } else { // Calculate the part load ratio through iteration - HeatErrorToler = thisFurnace.HeatingConvergenceTolerance; // Error tolerance for convergence from input deck + HeatErrorToler = furnace.HeatingConvergenceTolerance; // Error tolerance for convergence from input deck int SolFlag = 0; // # of iterations if positive, -1 means failed to converge, -2 means bounds are incorrect // HeatErrorToler is in fraction load, MaxIter = 30, SolFalg = # of iterations or error as appropriate @@ -6931,7 +5814,7 @@ namespace Furnaces { if (state.dataFurnaces->ModifiedHeatCoilLoad > 0.0) { HeatCoilLoad = state.dataFurnaces->ModifiedHeatCoilLoad; } else { - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * PartLoadRatio; + HeatCoilLoad = furnace.DesignHeatingCapacity * PartLoadRatio; } if (SolFlag == -1) { @@ -6942,7 +5825,7 @@ namespace Furnaces { while ((TempHeatOutput - SystemSensibleLoad) < 0.0 && TempMaxPLR < 1.0) { // find upper limit of HeatingPLR TempMaxPLR += 0.1; - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * TempMaxPLR; + HeatCoilLoad = furnace.DesignHeatingCapacity * TempMaxPLR; CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -6965,7 +5848,7 @@ namespace Furnaces { // find minimum limit of HeatingPLR TempMinPLR -= 0.01; - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * TempMinPLR; + HeatCoilLoad = furnace.DesignHeatingCapacity * TempMinPLR; CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -6999,7 +5882,7 @@ namespace Furnaces { if (state.dataFurnaces->ModifiedHeatCoilLoad > 0.0) { HeatCoilLoad = state.dataFurnaces->ModifiedHeatCoilLoad; } else { - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * PartLoadRatio; + HeatCoilLoad = furnace.DesignHeatingCapacity * PartLoadRatio; } CalcFurnaceOutput(state, FurnaceNum, @@ -7017,11 +5900,11 @@ namespace Furnaces { // After iterating with tighter boundaries, if still out of tolerance, show warning. if (SolFlag == -1 && std::abs(SystemSensibleLoad - TempHeatOutput) > HVAC::SmallLoad) { - if (thisFurnace.HeatingMaxIterIndex == 0) { + if (furnace.HeatingMaxIterIndex == 0) { ShowWarningMessage(state, format("Heating coil control failed to converge for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Iteration limit exceeded in calculating heating coil sensible part-load ratio."); ShowContinueErrorTimeStamp(state, format("Sensible load to be met by heating coil = {:.2T} (watts), sensible output " @@ -7033,18 +5916,18 @@ namespace Furnaces { state, format("{} \"{}\" - Iteration limit exceeded in calculating sensible heating part-load " "ratio error continues. Sensible load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.HeatingMaxIterIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.HeatingMaxIterIndex, SystemSensibleLoad, SystemSensibleLoad); } } else if (SolFlag == -2) { - if (thisFurnace.HeatingRegulaFalsiFailedIndex == 0) { + if (furnace.HeatingRegulaFalsiFailedIndex == 0) { ShowWarningMessage(state, format("Heating coil control failed for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Sensible heating part-load ratio determined to be outside the range of 0-1."); ShowContinueErrorTimeStamp( state, @@ -7054,9 +5937,9 @@ namespace Furnaces { ShowRecurringWarningErrorAtEnd( state, format("{} \"{}\" - Sensible heating part-load ratio out of range error continues. Sensible load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.HeatingRegulaFalsiFailedIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.HeatingRegulaFalsiFailedIndex, SystemSensibleLoad, SystemSensibleLoad); } @@ -7065,7 +5948,7 @@ namespace Furnaces { } else { // ELSE from IF(FullSensibleOutput.GT.NoSensibleOutput)THEN above // Set part load ratio to 1 and run heater at design heating capacity PartLoadRatio = 1.0; - HeatCoilLoad = thisFurnace.DesignHeatingCapacity; + HeatCoilLoad = furnace.DesignHeatingCapacity; } } // End of IF HeatPump @@ -7074,14 +5957,14 @@ namespace Furnaces { // Non-heat pump systems do not set a heating PLR, set it here for use with the DX cooling coil calculations. // Set this variable back to 0 for non-heat pump systems at the end of this routine. - thisFurnace.HeatPartLoadRatio = max(PartLoadRatio, thisFurnace.HeatPartLoadRatio); + furnace.HeatPartLoadRatio = max(PartLoadRatio, furnace.HeatPartLoadRatio); CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, fanOp, compressorOp, 0.0, - thisFurnace.HeatPartLoadRatio, + furnace.HeatPartLoadRatio, HeatCoilLoad, 0.0, HeatingSensibleOutput, @@ -7089,8 +5972,8 @@ namespace Furnaces { OnOffAirFlowRatio, false); - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && thisFurnace.WatertoAirHPType == WAHPCoilType::Simple && + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && furnace.WatertoAirHPType == WAHPCoilType::Simple && state.dataFurnaces->CoolingLoad)) { HeatingSensibleOutput = 0.0; HeatingLatentOutput = 0.0; @@ -7099,10 +5982,10 @@ namespace Furnaces { // Simulate if scheduled ON and cooling load or if a moisture load exists when using a humidistat // Check of HeatingLatentOutput is used to reduce overshoot during simultaneous heating and cooling // Setback flag is used to avoid continued RH control when Tstat is setback (RH should float down) - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0 && state.dataFurnaces->CoolingLoad) || - (thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && + if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0 && state.dataFurnaces->CoolingLoad) || + (furnace.Humidistat && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && (SystemMoistureLoad < 0.0 || (SystemMoistureLoad >= 0.0 && HeatingLatentOutput > SystemMoistureLoad && - !state.dataZoneEnergyDemand->Setback(thisFurnace.ControlZoneNum))))) { + !state.dataZoneEnergyDemand->Setback(furnace.ControlZoneNum))))) { // For cooling operation, the first step is to set the HX operation flag in case a HX assisted coil is used. // (if a HX assisted coil is not used, this flag is not used. It's only used in the CALL to SimHXAssistedCoolingCoil) @@ -7111,8 +5994,8 @@ namespace Furnaces { // For dehumidification control option Multimode, the system is operated first with the HX off. // If the moisture load is not met, the HX will then be turned on and the system is re-simulated. - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || - thisFurnace.DehumidControlType_Num == DehumidificationControlMode::None) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || + furnace.DehumidControlType_Num == DehumidificationControlMode::None) { HXUnitOn = true; } else { HXUnitOn = false; @@ -7123,17 +6006,17 @@ namespace Furnaces { // Set the inlet mass flow rate based on user specified coil OFF flow rate PartLoadRatio = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; // compressor off + furnace.CompPartLoadRatio = 0.0; // compressor off // SetAverageAirFlow calculates the operating mass flow rate based on PLR and the user specified inputs // for MaxCoolAirMassFlow and MaxNoCoolHeatAirMassFlow. // Air flow rate is set according to max of cooling and heating PLR if heating and latent load exists. - if (fanOp == HVAC::FanOp::Cycling && thisFurnace.HeatPartLoadRatio > 0.0 && thisFurnace.Humidistat && - thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && + if (fanOp == HVAC::FanOp::Cycling && furnace.HeatPartLoadRatio > 0.0 && furnace.Humidistat && + furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && (SystemMoistureLoad < 0.0 || (SystemMoistureLoad >= 0.0 && HeatingLatentOutput > SystemMoistureLoad && - !state.dataZoneEnergyDemand->Setback(thisFurnace.ControlZoneNum)))) { - CoolingHeatingPLRRatio = min(1.0, PartLoadRatio / thisFurnace.HeatPartLoadRatio); - SetAverageAirFlow(state, FurnaceNum, max(PartLoadRatio, thisFurnace.HeatPartLoadRatio), OnOffAirFlowRatio); + !state.dataZoneEnergyDemand->Setback(furnace.ControlZoneNum)))) { + CoolingHeatingPLRRatio = min(1.0, PartLoadRatio / furnace.HeatPartLoadRatio); + SetAverageAirFlow(state, FurnaceNum, max(PartLoadRatio, furnace.HeatPartLoadRatio), OnOffAirFlowRatio); } else { CoolingHeatingPLRRatio = 1.0; @@ -7159,13 +6042,13 @@ namespace Furnaces { // Don't calculate full load output if no load output can meet sensible load if (NoCoolOutput >= CoolCoilLoad && (CoolCoilLoad != 0.0 || state.dataFurnaces->HPDehumidificationLoadFlag)) { // Set full mass flow rate for full load calculation - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; // Set fan part-load fraction equal to 1 while getting full load result state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; OnOffAirFlowRatio = 1.0; PartLoadRatio = 1.0; - thisFurnace.CompPartLoadRatio = 1.0; // compressor ON + furnace.CompPartLoadRatio = 1.0; // compressor ON // Get full load result (coils simulated full ON) CalcFurnaceOutput(state, @@ -7205,7 +6088,7 @@ namespace Furnaces { } else { // Calculate the sensible part load ratio through iteration - CoolErrorToler = thisFurnace.CoolingConvergenceTolerance; // Error tolerance for convergence from input deck + CoolErrorToler = furnace.CoolingConvergenceTolerance; // Error tolerance for convergence from input deck int SolFlag = 0; // # of iterations if positive, -1 means failed to converge, -2 means bounds are incorrect Real64 par8_HXFlag = HXUnitOn ? 1.0 : 0.0; // CoolErrorToler is in fraction of load, MaxIter = 30, SolFalg = # of iterations or error as appropriate @@ -7243,11 +6126,11 @@ namespace Furnaces { HXUnitOn); if (!state.dataGlobal->WarmupFlag) { if (std::abs(CoolCoilLoad - TempCoolOutput) > HVAC::SmallLoad) { - if (thisFurnace.SensibleMaxIterIndex == 0) { + if (furnace.SensibleMaxIterIndex == 0) { ShowWarningMessage(state, format("Cooling coil control failed to converge for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError( state, " Iteration limit exceeded in calculating DX cooling coil sensible part-load ratio."); ShowContinueErrorTimeStamp(state, @@ -7260,20 +6143,20 @@ namespace Furnaces { state, format("{} \"{}\" - Iteration limit exceeded in calculating sensible cooling " "part-load ratio error continues. Sensible load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.SensibleMaxIterIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.SensibleMaxIterIndex, CoolCoilLoad, CoolCoilLoad); } } } else if (SolFlag == -2) { if (!state.dataGlobal->WarmupFlag) { - if (thisFurnace.SensibleRegulaFalsiFailedIndex == 0) { + if (furnace.SensibleRegulaFalsiFailedIndex == 0) { ShowWarningMessage(state, format("Cooling coil control failed for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Cooling sensible part-load ratio determined to be outside the range of 0-1."); ShowContinueErrorTimeStamp(state, format(" Cooling sensible load = {:.2T}", CoolCoilLoad)); } @@ -7281,9 +6164,9 @@ namespace Furnaces { state, format("{} \"{}\" - Cooling sensible part-load ratio out of range error continues. Sensible cooling load " "statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.SensibleRegulaFalsiFailedIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.SensibleRegulaFalsiFailedIndex, CoolCoilLoad, CoolCoilLoad); } @@ -7302,7 +6185,7 @@ namespace Furnaces { fanOp, compressorOp, PartLoadRatio, - thisFurnace.HeatPartLoadRatio, + furnace.HeatPartLoadRatio, 0.0, 0.0, TempCoolOutput, @@ -7315,19 +6198,19 @@ namespace Furnaces { // IF this furnace uses MultiMode control AND there is a moisture load AND the moisture load met by the furnace in // cooling only mode above is sufficient to meet the moisture demand OR there is no sensible load (PLR=0 from above) // then set LatentPartLoadRatio to 0 (no additional dehumidification is required). - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::Multimode && + if (furnace.DehumidControlType_Num == DehumidificationControlMode::Multimode && ((SystemMoistureLoad < 0.0 && TempLatentOutput < SystemMoistureLoad) || PartLoadRatio == 0.0)) { LatentPartLoadRatio = 0.0; // ELSE calculate a new PLR for valid dehumidification control types if a moisture load exists. - } else if (thisFurnace.DehumidControlType_Num != DehumidificationControlMode::None && + } else if (furnace.DehumidControlType_Num != DehumidificationControlMode::None && (SystemMoistureLoad < 0.0 || (SystemMoistureLoad >= 0.0 && TempLatentOutput > SystemMoistureLoad && - !state.dataZoneEnergyDemand->Setback(thisFurnace.ControlZoneNum)))) { + !state.dataZoneEnergyDemand->Setback(furnace.ControlZoneNum)))) { // IF the furnace uses dehumidification control MultiMode, turn on the HX and calculate the latent output with // the HX ON to compare to the moisture load predicted by the humidistat. - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { HXUnitOn = true; - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; // Set fan part-load fraction equal to 1 while getting full load result state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; OnOffAirFlowRatio = 1.0; @@ -7352,12 +6235,12 @@ namespace Furnaces { if (TempLatentOutput > SystemMoistureLoad) { // Set full mass flow rate for full load calculation - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; // Set fan part-load fraction equal to 1 while getting full load result state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; OnOffAirFlowRatio = 1.0; - thisFurnace.CompPartLoadRatio = 1.0; // compressor ON + furnace.CompPartLoadRatio = 1.0; // compressor ON // Get full load result (coils simulated full ON) CalcFurnaceOutput(state, @@ -7377,33 +6260,33 @@ namespace Furnaces { // check bounds on latent output prior to iteration using RegulaFalsi if (TempLatentOutput > SystemMoistureLoad || - (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::Multimode && TempCoolOutput > CoolCoilLoad)) { + (furnace.DehumidControlType_Num == DehumidificationControlMode::Multimode && TempCoolOutput > CoolCoilLoad)) { LatentPartLoadRatio = 1.0; } else if (NoLatentOutput < SystemMoistureLoad || HeatingLatentOutput < SystemMoistureLoad) { LatentPartLoadRatio = 0.0; } else { - CoolErrorToler = thisFurnace.CoolingConvergenceTolerance; // Error tolerance for convergence + CoolErrorToler = furnace.CoolingConvergenceTolerance; // Error tolerance for convergence int SolFlag = 0; // # of iterations if positive, -1 means failed to converge, -2 means bounds are incorrect // Multimode always controls to meet the SENSIBLE load (however, HXUnitOn is now TRUE) Real64 par4_load; - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { par4_load = CoolCoilLoad; } else { par4_load = SystemMoistureLoad; } // Multimode always controls to meet the SENSIBLE load (however, HXUnitOn is now TRUE) Real64 par6_LatentSens; - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { par6_LatentSens = 1.0; } else { par6_LatentSens = 0.0; } Real64 par8_HXUnit = HXUnitOn ? 1.0 : 0.0; Real64 par9_HtgCoilPLR; - if (fanOp == HVAC::FanOp::Cycling && thisFurnace.HeatPartLoadRatio > 0.0 && par6_LatentSens == 0.0) { - par9_HtgCoilPLR = thisFurnace.HeatPartLoadRatio; + if (fanOp == HVAC::FanOp::Cycling && furnace.HeatPartLoadRatio > 0.0 && par6_LatentSens == 0.0) { + par9_HtgCoilPLR = furnace.HeatPartLoadRatio; } else { par9_HtgCoilPLR = 0.0; } @@ -7449,7 +6332,7 @@ namespace Furnaces { // Par(10) = Furnace(FurnaceNum)%HeatPartLoadRatio // fanOp = CycFan and Furnace(FurnaceNum)%HeatPartLoadRatio must be > 0 for Part(10) to be // greater than 0 - CoolingHeatingPLRRatio = min(1.0, TempMaxPLR / thisFurnace.HeatPartLoadRatio); + CoolingHeatingPLRRatio = min(1.0, TempMaxPLR / furnace.HeatPartLoadRatio); } else { CoolingHeatingPLRRatio = 1.0; } @@ -7485,7 +6368,7 @@ namespace Furnaces { // the PLR to be 0, otherwise RegulaFalsi can fail when a heating and moisture load exists and // heating PLR > latent PLR. TempMinPLR2 = max(0.0000000001, TempMinPLR); - CoolingHeatingPLRRatio = min(1.0, TempMinPLR2 / thisFurnace.HeatPartLoadRatio); + CoolingHeatingPLRRatio = min(1.0, TempMinPLR2 / furnace.HeatPartLoadRatio); } else { TempMinPLR2 = TempMinPLR; CoolingHeatingPLRRatio = 1.0; @@ -7538,7 +6421,7 @@ namespace Furnaces { // Par(10) = Furnace(FurnaceNum)%HeatPartLoadRatio // fanOp = CycFan and Furnace(FurnaceNum)%HeatPartLoadRatio must be > 0 for Part(10) to be // greater than 0 - CoolingHeatingPLRRatio = min(1.0, LatentPartLoadRatio / thisFurnace.HeatPartLoadRatio); + CoolingHeatingPLRRatio = min(1.0, LatentPartLoadRatio / furnace.HeatPartLoadRatio); } else { CoolingHeatingPLRRatio = 1.0; } @@ -7560,11 +6443,11 @@ namespace Furnaces { if (std::abs((SystemMoistureLoad - TempLatentOutput) / SystemMoistureLoad) > CoolErrorToler && std::abs(SystemMoistureLoad - TempLatentOutput) > 10.0) { if (!state.dataGlobal->WarmupFlag) { - if (thisFurnace.LatentMaxIterIndex == 0) { + if (furnace.LatentMaxIterIndex == 0) { ShowWarningMessage(state, format("Cooling coil control failed to converge for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Iteration limit exceeded in calculating cooling coil latent part-load ratio."); ShowContinueError( @@ -7582,19 +6465,19 @@ namespace Furnaces { format("{} \"{}\" - Iteration limit exceeded in calculating latent part-load ratio error continues. " "Latent " "load convergence error (percent) statistics follow.", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.LatentMaxIterIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.LatentMaxIterIndex, 100.0 * std::abs((SystemMoistureLoad - TempLatentOutput) / SystemMoistureLoad), 100.0 * std::abs((SystemMoistureLoad - TempLatentOutput) / SystemMoistureLoad)); } } } else if (SolFlag == -2) { - if (thisFurnace.LatentRegulaFalsiFailedIndex2 == 0) { + if (furnace.LatentRegulaFalsiFailedIndex2 == 0) { ShowWarningMessage(state, format("Cooling coil control failed for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, format(" Latent part-load ratio determined to be outside the range of {:.3T} to {:.3T}.", TempMinPLR, @@ -7605,28 +6488,28 @@ namespace Furnaces { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Cooling sensible part-load ratio out of range error " "continues. System moisture load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.LatentRegulaFalsiFailedIndex2, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.LatentRegulaFalsiFailedIndex2, SystemMoistureLoad, SystemMoistureLoad); LatentPartLoadRatio = TempMinPLR; } } else if (SolFlag == -2) { - if (thisFurnace.LatentRegulaFalsiFailedIndex == 0) { + if (furnace.LatentRegulaFalsiFailedIndex == 0) { ShowWarningMessage(state, format("Cooling coil control failed for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Latent part-load ratio determined to be outside the range of 0-1."); ShowContinueErrorTimeStamp(state, "A PLR of 0 will be used and the simulation continues."); } ShowRecurringWarningErrorAtEnd( state, format("{} \"{}\" - Latent part-load ratio out of range or 0-1 error continues. System moisture load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.LatentRegulaFalsiFailedIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.LatentRegulaFalsiFailedIndex, SystemMoistureLoad, SystemMoistureLoad); LatentPartLoadRatio = 0.0; @@ -7657,10 +6540,10 @@ namespace Furnaces { // IF a humidistat is used and there is a moisture load, check if the latent PLR is greater than the (sensible) PLR // IF(LatentPartLoadRatio .GT. PartLoadRatio .and. SystemMoistureLoad .lt. 0.0 .and. Furnace(FurnaceNum)%Humidistat) THEN - if (LatentPartLoadRatio > PartLoadRatio && thisFurnace.Humidistat) { + if (LatentPartLoadRatio > PartLoadRatio && furnace.Humidistat) { // For dehumidification mode CoolReheat, compare the Sensible and Latent PLR values, if latentPLR is greater // than PLR (sensible), then overcooling is required and reheat will be activated using the HumControl flag. - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat) { PartLoadRatio = LatentPartLoadRatio; HumControl = true; } @@ -7668,16 +6551,16 @@ namespace Furnaces { // greater than PLR (sensible), then use the latent PLR to control the unit. // For MultiMode control, the latent PLR is found by enabling the HX and calculating a PLR required to meet the // sensible load. Overcooling is not required, and reheat will not be activated using the HumControl flag. - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::Multimode) { PartLoadRatio = LatentPartLoadRatio; } } - thisFurnace.CoolPartLoadRatio = PartLoadRatio; + furnace.CoolPartLoadRatio = PartLoadRatio; if (compressorOp == HVAC::CompressorOp::Off) { - thisFurnace.CompPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; } else { - thisFurnace.CompPartLoadRatio = PartLoadRatio; + furnace.CompPartLoadRatio = PartLoadRatio; } } else { // ELSE from IF(FullSensibleOutput.LT.NoCoolOutput)THEN above @@ -7692,27 +6575,27 @@ namespace Furnaces { // Additional logic is used here to make sure the coil actually turned on, e.g., if DX coil PLR > 0 then set to 1, // otherwise 0 (to make sure coil is actually ON and not off due to schedule, OAT, or other reason). // The global variable DXCoilPartLoadRatio(DXCoilNum) is not yet used for the WSHP to make the same check. - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { - thisFurnace.CoolPartLoadRatio = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + furnace.CoolPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; } else { - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { // VS coil issue here... - if (state.dataDXCoils->DXCoilPartLoadRatio(thisFurnace.ActualDXCoilIndexForHXAssisted) > 0.0) { - thisFurnace.CoolPartLoadRatio = 1.0; - thisFurnace.CompPartLoadRatio = 1.0; + if (state.dataDXCoils->DXCoilPartLoadRatio(furnace.ActualDXCoilIndexForHXAssisted) > 0.0) { + furnace.CoolPartLoadRatio = 1.0; + furnace.CompPartLoadRatio = 1.0; } else { - thisFurnace.CoolPartLoadRatio = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; + furnace.CoolPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; } } else { - if (state.dataDXCoils->DXCoilPartLoadRatio(thisFurnace.CoolingCoilIndex) > 0.0) { - thisFurnace.CoolPartLoadRatio = 1.0; - thisFurnace.CompPartLoadRatio = 1.0; + if (state.dataDXCoils->DXCoilPartLoadRatio(furnace.CoolCoilNum) > 0.0) { + furnace.CoolPartLoadRatio = 1.0; + furnace.CompPartLoadRatio = 1.0; } else { - thisFurnace.CoolPartLoadRatio = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; + furnace.CoolPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; } } } @@ -7720,32 +6603,32 @@ namespace Furnaces { // Calculate the reheat coil output if (HumControl) { // HumControl = .TRUE. if a Humidistat is installed and dehumidification control type is CoolReheat - if (thisFurnace.ZoneSequenceHeatingNum > 0) { - QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum) - .SequencedOutputRequiredToHeatingSP(thisFurnace.ZoneSequenceHeatingNum) / - thisFurnace.ControlZoneMassFlowFrac); + if (furnace.ZoneSequenceHeatingNum > 0) { + QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum) + .SequencedOutputRequiredToHeatingSP(furnace.ZoneSequenceHeatingNum) / + furnace.ControlZoneMassFlowFrac); } else { - QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum).OutputRequiredToHeatingSP / - thisFurnace.ControlZoneMassFlowFrac); + QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum).OutputRequiredToHeatingSP / + furnace.ControlZoneMassFlowFrac); } // Cooling mode or floating condition and dehumidification is required if (QToHeatSetPt < 0.0) { // Calculate the reheat coil load wrt the heating setpoint temperature. Reheat coil picks up // the entire excess sensible cooling (DX cooling coil and impact of outdoor air). ReheatCoilLoad = max(0.0, (QToHeatSetPt - ActualSensibleOutput)); - thisFurnace.DehumidInducedHeatingDemandRate = ReheatCoilLoad; + furnace.DehumidInducedHeatingDemandRate = ReheatCoilLoad; // Heating mode and dehumidification is required } else { // Calculate the reheat coil load as the sensible capacity of the DX cooling coil only. Let // the heating coil pick up the load due to outdoor air. ReheatCoilLoad = max(0.0, (ActualSensibleOutput - NoCoolOutput) * (-1.0)); // Dehumidification is not required - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && - thisFurnace.WatertoAirHPType == WAHPCoilType::Simple)) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && + furnace.WatertoAirHPType == WAHPCoilType::Simple)) { ReheatCoilLoad = max(QToHeatSetPt, QToHeatSetPt - ActualSensibleOutput); } - thisFurnace.DehumidInducedHeatingDemandRate = max(0.0, ActualSensibleOutput * (-1.0)); + furnace.DehumidInducedHeatingDemandRate = max(0.0, ActualSensibleOutput * (-1.0)); } } else { // No humidistat installed @@ -7764,49 +6647,49 @@ namespace Furnaces { if (HumControl && SystemMoistureLoad < 0.0) { if (fanOp == HVAC::FanOp::Cycling) { // set the flow rate at the maximum of the cooling and heating PLR's - SetAverageAirFlow(state, FurnaceNum, max(thisFurnace.CoolPartLoadRatio, thisFurnace.HeatPartLoadRatio), OnOffAirFlowRatio); + SetAverageAirFlow(state, FurnaceNum, max(furnace.CoolPartLoadRatio, furnace.HeatPartLoadRatio), OnOffAirFlowRatio); } else { // ELSE set the flow rate at the cooling PLR - SetAverageAirFlow(state, FurnaceNum, thisFurnace.CoolPartLoadRatio, OnOffAirFlowRatio); + SetAverageAirFlow(state, FurnaceNum, furnace.CoolPartLoadRatio, OnOffAirFlowRatio); } } else { - SetAverageAirFlow(state, FurnaceNum, max(thisFurnace.CoolPartLoadRatio, thisFurnace.HeatPartLoadRatio), OnOffAirFlowRatio); + SetAverageAirFlow(state, FurnaceNum, max(furnace.CoolPartLoadRatio, furnace.HeatPartLoadRatio), OnOffAirFlowRatio); } - thisFurnace.MdotFurnace = state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate; + furnace.MdotFurnace = state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate; - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || - (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && thisFurnace.WatertoAirHPType == WAHPCoilType::Simple)) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || + (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && furnace.WatertoAirHPType == WAHPCoilType::Simple)) { } else { // Non-HeatPump (non-DX) heating coils do not set PLR, reset to 0 here. This variable was set for non-DX // coils to allow the SetAverageAirFlow CALL above to set the correct air mass flow rate. See this // IF block above in heating section. HeatPLR is not set in the ELSE part of the IF (only HeatCoilLoad is set). - thisFurnace.HeatPartLoadRatio = 0.0; + furnace.HeatPartLoadRatio = 0.0; } //*********HVAC Scheduled OFF************* // No heating or cooling or dehumidification //!!LKL discrepancy with < 0? - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) == 0.0 || + if (ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) == 0.0 || state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate == 0.0) { - thisFurnace.MdotFurnace = 0.0; + furnace.MdotFurnace = 0.0; CoolCoilLoad = 0.0; HeatCoilLoad = 0.0; ReheatCoilLoad = 0.0; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; // System off, so set on/off fan part-load fraction = 1 - thisFurnace.CoolPartLoadRatio = 0.0; - thisFurnace.HeatPartLoadRatio = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; + furnace.CoolPartLoadRatio = 0.0; + furnace.HeatPartLoadRatio = 0.0; + furnace.CompPartLoadRatio = 0.0; // set report variables - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; - thisFurnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; + furnace.HeatingCoilSensDemand = 0.0; } } // End of the FirstHVACIteration control of the mass flow If block // Set the fan inlet node flow rates - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRateMaxAvail = thisFurnace.MdotFurnace; - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRateMaxAvail = furnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; } void CalcWaterToAirHeatPump(EnergyPlusData &state, @@ -7845,7 +6728,7 @@ namespace Furnaces { Real64 HPCoilSensDemand; // Heat pump sensible demand Real64 HPCoilSensCapacity; // Heat pump sensible capacity - Real64 SuppHeatCoilLoad; // Load passed to supplemental heater (W) + Real64 SuppCoilLoad; // Load passed to supplemental heater (W) Real64 CoolErrorToler; // convergence tolerance used in cooling mode Real64 HeatErrorToler; // convergence tolerance used in heating mode int SolFlag; // flag returned from iteration routine to denote problems @@ -7854,14 +6737,14 @@ namespace Furnaces { Real64 &TotalZoneSensLoad = state.dataFurnaces->TotalZoneSensLoad; Real64 &CoolPartLoadRatio = state.dataFurnaces->CoolPartLoadRatio; Real64 &HeatPartLoadRatio = state.dataFurnaces->HeatPartLoadRatio; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Set local variables Real64 Dummy2 = 0.0; // used as dummy heat and reheat coil load Real64 OnOffAirFlowRatio = 1.0; // Ratio of compressor ON air mass flow to AVERAGE air mass flow over time step - int FurnaceInletNode = thisFurnace.FurnaceInletNodeNum; - HVAC::FanOp fanOp = thisFurnace.fanOp; // fan operating mode - thisFurnace.MdotFurnace = thisFurnace.DesignMassFlowRate; + int FurnaceInletNode = furnace.FurnaceInletNode; + HVAC::FanOp fanOp = furnace.fanOp; // fan operating mode + furnace.MdotFurnace = furnace.DesignMassFlowRate; //*********INITIAL CALCULATIONS**************** // set the fan part load fraction @@ -7889,23 +6772,23 @@ namespace Furnaces { // AND air flow rate is greater than zero... // AND the air system has a cooling load and is not set back or in the deadband... // OR the system is controlled by a humidistat and there is a latent load - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0 && + if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0 && state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate > 0.0) && - ((state.dataFurnaces->CoolingLoad) || (thisFurnace.Humidistat && thisFurnace.CoolingCoilLatentDemand < 0.0))) { + ((state.dataFurnaces->CoolingLoad) || (furnace.Humidistat && furnace.CoolingCoilLatentDemand < 0.0))) { // Set the air flow rate to the design flow rate and set the fan operation fraction to 1 (continuous operation) - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.DesignMassFlowRate; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.DesignMassFlowRate; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; // see 'Note' under INITIAL CALCULATIONS // !Set the operation flag to run the fan continuously // fanOp = FanOp::Continuous // Set the input parameters for CalcFurnaceOutput - thisFurnace.HeatingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; // compressor off - thisFurnace.InitHeatPump = true; // initialization call to Calc Furnace + furnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CompPartLoadRatio = 0.0; // compressor off + furnace.InitHeatPump = true; // initialization call to Calc Furnace CoolPartLoadRatio = 0.0; // Get no load result in order to calculate the effect of the fan and the mixed air equipment @@ -7924,8 +6807,8 @@ namespace Furnaces { false); // Set the input parameters for CalcFurnaceOutput - thisFurnace.CoolingCoilSensDemand = 1.0; - thisFurnace.CompPartLoadRatio = 1.0; // compressor ON + furnace.CoolingCoilSensDemand = 1.0; + furnace.CompPartLoadRatio = 1.0; // compressor ON CoolPartLoadRatio = 1.0; // Get full load result in order to estimate the operating part load ratio for continuous fan operation @@ -7962,17 +6845,17 @@ namespace Furnaces { CoolPartLoadRatio = max(MinPLR, min(1.0, std::abs(HPCoilSensDemand) / std::abs(HPCoilSensCapacity))); } - thisFurnace.InitHeatPump = false; + furnace.InitHeatPump = false; // check bounds on sensible output prior to iteration using RegulaFalsi if (ZoneSensLoadMetFanONCompON > TotalZoneSensLoad) { CoolPartLoadRatio = 1.0; HPCoilSensDemand = std::abs(ZoneSensLoadMetFanONCompON - ZoneSensLoadMetFanONCompOFF); - thisFurnace.CoolingCoilSensDemand = HPCoilSensDemand; + furnace.CoolingCoilSensDemand = HPCoilSensDemand; } else if (ZoneSensLoadMetFanONCompOFF < TotalZoneSensLoad) { CoolPartLoadRatio = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; // compressor OFF - thisFurnace.CoolingCoilSensDemand = 0.0; + furnace.CompPartLoadRatio = 0.0; // compressor OFF + furnace.CoolingCoilSensDemand = 0.0; CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -7988,7 +6871,7 @@ namespace Furnaces { false); } else { // Calculate the sensible part load ratio through iteration - CoolErrorToler = thisFurnace.CoolingConvergenceTolerance; + CoolErrorToler = furnace.CoolingConvergenceTolerance; SolFlag = 0; // # of iterations if positive, -1 means failed to converge, -2 means bounds are incorrect // CoolErrorToler is in fraction of load, MaxIter = 600, SolFalg = # of iterations or error as appropriate auto f = [&state, FurnaceNum, FirstHVACIteration, fanOp, compressorOp, TotalZoneSensLoad, ZoneSensLoadMetFanONCompOFF]( @@ -8022,11 +6905,11 @@ namespace Furnaces { OnOffAirFlowRatio, false); if (std::abs(ZoneSensLoadMet - TotalZoneSensLoad) / TotalZoneSensLoad > CoolErrorToler) { - if (thisFurnace.SensibleMaxIterIndex == 0) { + if (furnace.SensibleMaxIterIndex == 0) { ShowWarningMessage(state, format("Cooling coil control failed to converge for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Iteration limit exceeded in calculating DX cooling coil sensible part-load ratio."); ShowContinueErrorTimeStamp(state, format("Sensible load to be met by DX coil = {:.2T} (watts), sensible output of DX coil = " @@ -8038,9 +6921,9 @@ namespace Furnaces { state, format("{} \"{}\" - Iteration limit exceeded in calculating sensible cooling part-load ratio error " "continues. Sensible load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.SensibleMaxIterIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.SensibleMaxIterIndex, TotalZoneSensLoad, TotalZoneSensLoad); } @@ -8061,10 +6944,10 @@ namespace Furnaces { OnOffAirFlowRatio, false); if ((ZoneSensLoadMet - TotalZoneSensLoad) / TotalZoneSensLoad > CoolErrorToler) { - if (thisFurnace.SensibleRegulaFalsiFailedIndex == 0) { + if (furnace.SensibleRegulaFalsiFailedIndex == 0) { ShowWarningMessage( state, - format("Cooling coil control failed for {}:{}", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); + format("Cooling coil control failed for {}:{}", HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name)); ShowContinueError(state, " Cooling sensible part-load ratio determined to be outside the range of 0-1."); ShowContinueError( state, @@ -8076,9 +6959,9 @@ namespace Furnaces { ShowRecurringWarningErrorAtEnd( state, format("{} \"{}\" - Cooling sensible part-load ratio out of range error continues. Sensible cooling load statistics:", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.SensibleRegulaFalsiFailedIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.SensibleRegulaFalsiFailedIndex, TotalZoneSensLoad, TotalZoneSensLoad); } @@ -8086,27 +6969,27 @@ namespace Furnaces { } if (fanOp == HVAC::FanOp::Cycling) { - thisFurnace.MdotFurnace *= CoolPartLoadRatio; + furnace.MdotFurnace *= CoolPartLoadRatio; } //*********HEATING CALCULATIONS**************** // If Furnace runs with a heating load then set HeatCoilLoad on Heating Coil and the Mass Flow - } else if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && + } else if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0) && (state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate > 0.0) && state.dataFurnaces->HeatingLoad) { // Set the air flow rate to the design flow rate and set the fan operation fraction to 1 (continuous operation) - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.DesignMassFlowRate; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.DesignMassFlowRate; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; // see 'Note' under INITIAL CALCULATIONS // !Set the operation flag to run the fan continuously // fanOp = FanOp::Continuous // Set the input parameters for CalcFurnaceOutput - thisFurnace.HeatingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CompPartLoadRatio = 0.0; // compressor off - thisFurnace.InitHeatPump = true; // initialization call to Calc Furnace + furnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CompPartLoadRatio = 0.0; // compressor off + furnace.InitHeatPump = true; // initialization call to Calc Furnace HeatPartLoadRatio = 0.0; // Get no load result in order to calculate the effect of the fan and the mixed air equipment @@ -8125,8 +7008,8 @@ namespace Furnaces { false); // Set the input parameters for CalcFurnaceOutput - thisFurnace.HeatingCoilSensDemand = 1.0; - thisFurnace.CompPartLoadRatio = 1.0; // compressor ON + furnace.HeatingCoilSensDemand = 1.0; + furnace.CompPartLoadRatio = 1.0; // compressor ON HeatPartLoadRatio = 1.0; // Get full load result in order to estimate the operating part load ratio for continuous fan operation @@ -8164,18 +7047,18 @@ namespace Furnaces { HeatPartLoadRatio = max(MinPLR, min(1.0, std::abs(HPCoilSensDemand) / std::abs(HPCoilSensCapacity))); } - thisFurnace.InitHeatPump = false; + furnace.InitHeatPump = false; // check bounds on sensible output prior to iteration using RegulaFalsi if (ZoneSensLoadMetFanONCompON < TotalZoneSensLoad) { HeatPartLoadRatio = 1.0; ZoneSensLoadMet = ZoneSensLoadMetFanONCompON; HPCoilSensDemand = std::abs(ZoneSensLoadMetFanONCompON - ZoneSensLoadMetFanONCompOFF); - thisFurnace.HeatingCoilSensDemand = HPCoilSensDemand; + furnace.HeatingCoilSensDemand = HPCoilSensDemand; } else if (ZoneSensLoadMetFanONCompOFF > TotalZoneSensLoad) { HeatPartLoadRatio = 0.0; ZoneSensLoadMet = ZoneSensLoadMetFanONCompOFF; - thisFurnace.CompPartLoadRatio = 0.0; // compressor ON + furnace.CompPartLoadRatio = 0.0; // compressor ON CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -8191,7 +7074,7 @@ namespace Furnaces { false); } else { // Calculate the sensible part load ratio through iteration - HeatErrorToler = thisFurnace.HeatingConvergenceTolerance; + HeatErrorToler = furnace.HeatingConvergenceTolerance; SolFlag = 0; // # of iterations if positive, -1 means failed to converge, -2 means bounds are incorrect // HeatErrorToler is in fraction of load, MaxIter = 600, SolFalg = # of iterations or error as appropriate auto f = [&state, FurnaceNum, FirstHVACIteration, fanOp, compressorOp, TotalZoneSensLoad, ZoneSensLoadMetFanONCompOFF]( @@ -8225,11 +7108,11 @@ namespace Furnaces { false); if (SolFlag == -1 && !state.dataGlobal->WarmupFlag && !FirstHVACIteration) { if (std::abs(ZoneSensLoadMet - TotalZoneSensLoad) / TotalZoneSensLoad > HeatErrorToler) { - if (thisFurnace.WSHPHeatMaxIterIndex == 0) { + if (furnace.WSHPHeatMaxIterIndex == 0) { ShowWarningMessage(state, format("Heating coil control failed to converge for {}:{}", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueError(state, " Iteration limit exceeded in calculating DX heating coil sensible part-load ratio."); ShowContinueErrorTimeStamp(state, format("Sensible load to be met by DX coil = {:.2T} (watts), sensible output of DX coil = " @@ -8240,9 +7123,9 @@ namespace Furnaces { ShowRecurringWarningErrorAtEnd( state, format("{} \"{}\" - Iteration limit exceeded in calculating sensible heating part-load ratio error continues.", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.WSHPHeatMaxIterIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.WSHPHeatMaxIterIndex, TotalZoneSensLoad, TotalZoneSensLoad); } @@ -8262,10 +7145,10 @@ namespace Furnaces { OnOffAirFlowRatio, false); if ((ZoneSensLoadMet - TotalZoneSensLoad) / TotalZoneSensLoad > HeatErrorToler) { - if (thisFurnace.WSHPHeatRegulaFalsiFailedIndex == 0) { + if (furnace.WSHPHeatRegulaFalsiFailedIndex == 0) { ShowWarningError( state, - format("Heating coil control failed for {}:{}", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); + format("Heating coil control failed for {}:{}", HVAC::unitarySysTypeNames[(int)furnace.type], furnace.Name)); ShowContinueError(state, " Heating sensible part-load ratio determined to be outside the range of 0-1."); ShowContinueError( state, @@ -8276,9 +7159,9 @@ namespace Furnaces { } ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Heating sensible part-load ratio out of range error continues.", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.WSHPHeatRegulaFalsiFailedIndex, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.WSHPHeatRegulaFalsiFailedIndex, TotalZoneSensLoad, TotalZoneSensLoad); } @@ -8287,7 +7170,7 @@ namespace Furnaces { // CALL supplemental heater if required if ((TotalZoneSensLoad - ZoneSensLoadMet) > HVAC::SmallLoad && HeatPartLoadRatio >= 1.0) { - SuppHeatCoilLoad = TotalZoneSensLoad - ZoneSensLoadMet; + SuppCoilLoad = TotalZoneSensLoad - ZoneSensLoadMet; CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -8295,7 +7178,7 @@ namespace Furnaces { compressorOp, CoolPartLoadRatio, HeatPartLoadRatio, - SuppHeatCoilLoad, + SuppCoilLoad, Dummy2, ZoneSensLoadMet, ZoneLatLoadMet, @@ -8304,22 +7187,22 @@ namespace Furnaces { } if (fanOp == HVAC::FanOp::Cycling) { - thisFurnace.MdotFurnace *= HeatPartLoadRatio; + furnace.MdotFurnace *= HeatPartLoadRatio; } //**********HVAC Scheduled ON, but no cooling, dehumidification or heating load********* - } else if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) { - thisFurnace.InitHeatPump = true; // initialization call to Calc Furnace + } else if (ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0) { + furnace.InitHeatPump = true; // initialization call to Calc Furnace HeatPartLoadRatio = 0.0; CoolPartLoadRatio = 0.0; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; //! see 'Note' under INITIAL CALCULATIONS // set report variables - thisFurnace.CompPartLoadRatio = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; - thisFurnace.HeatingCoilSensDemand = 0.0; + furnace.CompPartLoadRatio = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; + furnace.HeatingCoilSensDemand = 0.0; if (fanOp == HVAC::FanOp::Cycling) { - thisFurnace.MdotFurnace = 0.0; + furnace.MdotFurnace = 0.0; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; // see 'Note' under INITIAL CALCULATIONS CalcFurnaceOutput(state, FurnaceNum, @@ -8334,7 +7217,7 @@ namespace Furnaces { ZoneLatLoadMet, OnOffAirFlowRatio, false); - thisFurnace.MdotFurnace = 0.0; + furnace.MdotFurnace = 0.0; } else { // continuous fan, cycling coil CalcFurnaceOutput(state, FurnaceNum, @@ -8352,15 +7235,15 @@ namespace Furnaces { } //*********No heating or cooling or dehumidification********* } else { - thisFurnace.InitHeatPump = true; // initialization call to Calc Furnace - thisFurnace.MdotFurnace = 0.0; + furnace.InitHeatPump = true; // initialization call to Calc Furnace + furnace.MdotFurnace = 0.0; HeatPartLoadRatio = 0.0; CoolPartLoadRatio = 0.0; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; // see 'Note' under INITIAL CALCULATIONS - thisFurnace.CompPartLoadRatio = 0.0; - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.CoolingCoilLatentDemand = 0.0; - thisFurnace.HeatingCoilSensDemand = 0.0; + furnace.CompPartLoadRatio = 0.0; + furnace.CoolingCoilSensDemand = 0.0; + furnace.CoolingCoilLatentDemand = 0.0; + furnace.HeatingCoilSensDemand = 0.0; CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -8374,12 +7257,12 @@ namespace Furnaces { ZoneLatLoadMet, OnOffAirFlowRatio, false); - thisFurnace.MdotFurnace = 0.0; + furnace.MdotFurnace = 0.0; } // Set the fan inlet node flow rates - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRateMaxAvail = thisFurnace.MdotFurnace; - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRateMaxAvail = furnace.MdotFurnace; + state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = furnace.MdotFurnace; } void CalcFurnaceOutput(EnergyPlusData &state, @@ -8413,9 +7296,8 @@ namespace Furnaces { // Simulate each child object in the correct order for each system type. This routine is used in the // RegulaFalsi function CALL. Air mass flow rate is set each iteration based on PLR. - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - auto &inletNode = state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum); - int CoolingCoilType_Num = thisFurnace.CoolingCoilType_Num; + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + auto &inletNode = state.dataLoopNodes->Node(furnace.FurnaceInletNode); Real64 QActual = 0.0; // heating coil load met or delivered state.dataFurnaces->ModifiedHeatCoilLoad = 0.0; @@ -8430,23 +7312,23 @@ namespace Furnaces { if (state.dataFurnaces->CoolHeatPLRRat < 1.0) { if (state.dataFurnaces->CoolHeatPLRRat > 0.0) { inletNode.MassFlowRate = state.dataFurnaces->CompOnMassFlow * CoolPartLoadRatio / state.dataFurnaces->CoolHeatPLRRat; - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { SetAverageAirFlow(state, FurnaceNum, CoolPartLoadRatio / state.dataFurnaces->CoolHeatPLRRat, OnOffAirFlowRatio); } } else { inletNode.MassFlowRate = state.dataFurnaces->CompOnMassFlow * CoolPartLoadRatio; - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { SetAverageAirFlow(state, FurnaceNum, max(HeatPartLoadRatio, CoolPartLoadRatio), OnOffAirFlowRatio); } } } else { inletNode.MassFlowRate = state.dataFurnaces->CompOnMassFlow * max(HeatPartLoadRatio, CoolPartLoadRatio); - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { SetAverageAirFlow(state, FurnaceNum, max(HeatPartLoadRatio, CoolPartLoadRatio), OnOffAirFlowRatio); } } } else { - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { SetAverageAirFlow(state, FurnaceNum, max(HeatPartLoadRatio, CoolPartLoadRatio), OnOffAirFlowRatio); } } @@ -8454,17 +7336,17 @@ namespace Furnaces { inletNode.MassFlowRateMaxAvail = inletNode.MassFlowRate; // Simulate the air-to-air heat pump - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { // Simulate blow-thru fan and non-linear coils twice to update PLF used by the ONOFF Fan - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); - if (CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, BlankString, FirstHVACIteration, compressorOp, CoolPartLoadRatio, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, HXUnitOn, OnOffAirFlowRatio, @@ -8474,39 +7356,39 @@ namespace Furnaces { BlankString, compressorOp, FirstHVACIteration, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, CoolPartLoadRatio, OnOffAirFlowRatio); } DXCoils::SimDXCoil( - state, BlankString, compressorOp, FirstHVACIteration, thisFurnace.HeatingCoilIndex, fanOp, HeatPartLoadRatio, OnOffAirFlowRatio); - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state, BlankString, compressorOp, FirstHVACIteration, furnace.HeatCoilNum, fanOp, HeatPartLoadRatio, OnOffAirFlowRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate cooling and heating coils - if (CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, BlankString, FirstHVACIteration, compressorOp, CoolPartLoadRatio, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, HXUnitOn, OnOffAirFlowRatio, state.dataFurnaces->EconomizerFlag); } else { DXCoils::SimDXCoil( - state, BlankString, compressorOp, FirstHVACIteration, thisFurnace.CoolingCoilIndex, fanOp, CoolPartLoadRatio, OnOffAirFlowRatio); + state, BlankString, compressorOp, FirstHVACIteration, furnace.CoolCoilNum, fanOp, CoolPartLoadRatio, OnOffAirFlowRatio); } DXCoils::SimDXCoil( - state, BlankString, compressorOp, FirstHVACIteration, thisFurnace.HeatingCoilIndex, fanOp, HeatPartLoadRatio, OnOffAirFlowRatio); + state, BlankString, compressorOp, FirstHVACIteration, furnace.HeatCoilNum, fanOp, HeatPartLoadRatio, OnOffAirFlowRatio); // Simulate the draw-thru fan - if (thisFurnace.fanPlace == HVAC::FanPlace::DrawThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::DrawThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate the supplemental heating coil - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { bool SuppHeatingCoilFlag = true; CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } else { @@ -8515,16 +7397,16 @@ namespace Furnaces { CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } // Simulate the parameter estimate water-to-air heat pump - } else if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && thisFurnace.WatertoAirHPType == WAHPCoilType::Simple) { + } else if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && furnace.WatertoAirHPType == WAHPCoilType::Simple) { // Simulate blow-thru fan and non-linear coils twice to update PLF used by the ONOFF Fan - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); // COIL:WATERTOAIRHPSIMPLE:COOLING WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.CoolingCoilSensDemand, - thisFurnace.CoolingCoilLatentDemand, + furnace.CoolCoilNum, + furnace.CoolingCoilSensDemand, + furnace.CoolingCoilLatentDemand, fanOp, compressorOp, CoolPartLoadRatio, @@ -8533,23 +7415,23 @@ namespace Furnaces { // COIL:WATERTOAIRHPSIMPLE:HEATING WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.HeatingCoilSensDemand, + furnace.HeatCoilNum, + furnace.HeatingCoilSensDemand, Dummy, fanOp, compressorOp, HeatPartLoadRatio, FirstHVACIteration); // HeatPartLoadRatio // Simulate the whole thing a second time so that the correct PLF required by the coils is used by the Fan. ******* - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate the cooling and heating coils // COIL:WATERTOAIRHPSIMPLE:COOLING WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.CoolingCoilSensDemand, - thisFurnace.CoolingCoilLatentDemand, + furnace.CoolCoilNum, + furnace.CoolingCoilSensDemand, + furnace.CoolingCoilLatentDemand, fanOp, compressorOp, CoolPartLoadRatio, @@ -8558,19 +7440,19 @@ namespace Furnaces { // COIL:WATERTOAIRHPSIMPLE:HEATING WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.HeatingCoilSensDemand, + furnace.HeatCoilNum, + furnace.HeatingCoilSensDemand, Dummy, fanOp, compressorOp, HeatPartLoadRatio, FirstHVACIteration); // HeatPartLoadRatio // Simulate the draw-thru fan - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate the supplemental heating coil - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { bool SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } else { @@ -8578,65 +7460,65 @@ namespace Furnaces { CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } // Simulate the detailed water-to-air heat pump - } else if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && thisFurnace.WatertoAirHPType == WAHPCoilType::ParEst) { + } else if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir && furnace.WatertoAirHPType == WAHPCoilType::ParEst) { // Simulate the draw-thru fan - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate the cooling and heating coils WaterToAirHeatPump::SimWatertoAirHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.DesignMassFlowRate, + furnace.CoolCoilNum, + furnace.DesignMassFlowRate, fanOp, FirstHVACIteration, - thisFurnace.InitHeatPump, - thisFurnace.CoolingCoilSensDemand, - thisFurnace.CoolingCoilLatentDemand, + furnace.InitHeatPump, + furnace.CoolingCoilSensDemand, + furnace.CoolingCoilLatentDemand, compressorOp, CoolPartLoadRatio); Real64 Dummy = 0.0; WaterToAirHeatPump::SimWatertoAirHP(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.DesignMassFlowRate, + furnace.HeatCoilNum, + furnace.DesignMassFlowRate, fanOp, FirstHVACIteration, - thisFurnace.InitHeatPump, - thisFurnace.HeatingCoilSensDemand, + furnace.InitHeatPump, + furnace.HeatingCoilSensDemand, Dummy, compressorOp, HeatPartLoadRatio); // Simulate the draw-thru fan - if (thisFurnace.fanPlace == HVAC::FanPlace::DrawThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::DrawThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simulate the supplemental heating coil HeatingCoils::SimulateHeatingCoilComponents( - state, BlankString, FirstHVACIteration, HeatCoilLoad, thisFurnace.SuppHeatCoilIndex, _, true, fanOp); + state, BlankString, FirstHVACIteration, HeatCoilLoad, furnace.SuppCoilNum, _, true, fanOp); } else { // ELSE it's not a heat pump // Simulate blow-thru fan - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); // For non-linear coils, simulate coil to update PLF used by the ONOFF Fan - if (thisFurnace.fanType == HVAC::FanType::OnOff) { - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatOnly && thisFurnace.type != HVAC::UnitarySysType::Furnace_HeatOnly) { + if (furnace.fanType == HVAC::FanType::OnOff) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatOnly && furnace.type != HVAC::UnitarySysType::Furnace_HeatOnly) { - if (!thisFurnace.CoolingCoilUpstream) { + if (!furnace.CoolCoilUpstream) { bool SuppHeatingCoilFlag = false; // if false simulates heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } - if (CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, BlankString, FirstHVACIteration, compressorOp, CoolPartLoadRatio, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, HXUnitOn, OnOffAirFlowRatio, @@ -8646,7 +7528,7 @@ namespace Furnaces { BlankString, compressorOp, FirstHVACIteration, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, CoolPartLoadRatio, OnOffAirFlowRatio, @@ -8654,30 +7536,30 @@ namespace Furnaces { } } - if (thisFurnace.CoolingCoilUpstream) { + if (furnace.CoolCoilUpstream) { bool SuppHeatingCoilFlag = false; // if false simulates heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } // Simple OnOff fan } // Blow thru fan // Simulate the cooling and heating coils - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatOnly && thisFurnace.type != HVAC::UnitarySysType::Furnace_HeatOnly) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatOnly && furnace.type != HVAC::UnitarySysType::Furnace_HeatOnly) { - if (!thisFurnace.CoolingCoilUpstream) { + if (!furnace.CoolCoilUpstream) { bool SuppHeatingCoilFlag = false; // if false simulates heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } - if (CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, BlankString, FirstHVACIteration, compressorOp, CoolPartLoadRatio, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, HXUnitOn, OnOffAirFlowRatio, @@ -8687,7 +7569,7 @@ namespace Furnaces { BlankString, compressorOp, FirstHVACIteration, - thisFurnace.CoolingCoilIndex, + furnace.CoolCoilNum, fanOp, CoolPartLoadRatio, OnOffAirFlowRatio, @@ -8695,28 +7577,28 @@ namespace Furnaces { } } - if (thisFurnace.CoolingCoilUpstream) { + if (furnace.CoolCoilUpstream) { bool SuppHeatingCoilFlag = false; // if false simulates heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, fanOp, QActual); } // Simulate the draw-thru fan - if (thisFurnace.fanPlace == HVAC::FanPlace::DrawThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::DrawThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } - if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || thisFurnace.SuppHeatCoilIndex > 0) { + if (furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || furnace.SuppCoilNum > 0) { bool SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } } // IF(Furnace(FurnaceNum)%type == UnitarySys_HeatPump_AirToAir)THEN // Get mass flow rate after components are simulated - auto &outletNode = state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum); + auto &outletNode = state.dataLoopNodes->Node(furnace.FurnaceOutletNode); Real64 AirMassFlow = inletNode.MassFlowRate; // this should be outlet node as in 9897? // check the DesignMaxOutletTemp and reset if necessary (for Coil:Gas:Heating or Coil:Electric:Heating only) - if (outletNode.Temp > thisFurnace.DesignMaxOutletTemp) { + if (outletNode.Temp > furnace.DesignMaxOutletTemp) { Real64 Wout = outletNode.HumRat; - Real64 Tout = thisFurnace.DesignMaxOutletTemp; + Real64 Tout = furnace.DesignMaxOutletTemp; state.dataFurnaces->ModifiedHeatCoilLoad = HeatCoilLoad - (AirMassFlow * Psychrometrics::PsyCpAirFnW(Wout) * (outletNode.Temp - Tout)); outletNode.Temp = Tout; } @@ -8730,20 +7612,20 @@ namespace Furnaces { CalcZoneSensibleLatentOutput(AirMassFlow, outletNode.Temp, outletNode.HumRat, - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).Temp, - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).HumRat, + state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).Temp, + state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).HumRat, SensibleOutput, LatentOutput, TotalOutput); - SensibleLoadMet = SensibleOutput - thisFurnace.SenLoadLoss; - thisFurnace.SensibleLoadMet = SensibleLoadMet; + SensibleLoadMet = SensibleOutput - furnace.SenLoadLoss; + furnace.SensibleLoadMet = SensibleLoadMet; - if (thisFurnace.Humidistat) { - LatentLoadMet = LatentOutput - thisFurnace.LatLoadLoss; + if (furnace.Humidistat) { + LatentLoadMet = LatentOutput - furnace.LatLoadLoss; } else { LatentLoadMet = 0.0; } - thisFurnace.LatentLoadMet = LatentLoadMet; + furnace.LatentLoadMet = LatentLoadMet; } // End of Update subroutines for the Furnace Module @@ -8790,6 +7672,8 @@ namespace Furnaces { // Real64 par9_HXOnFlag = Par(9); // Real64 par10_HeatingCoilPLR = Par(10); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + if (par6_loadFlag == 1.0) { CoolPartLoadRatio = PartLoadRatio; HeatPartLoadRatio = 0.0; @@ -8798,18 +7682,17 @@ namespace Furnaces { CoolPartLoadRatio = 0.0; HeatPartLoadRatio = PartLoadRatio; - int const HeatingCoilType_Num(state.dataFurnaces->Furnace(FurnaceNum).HeatingCoilType_Num); - if (HeatingCoilType_Num == HVAC::Coil_HeatingGasOrOtherFuel || HeatingCoilType_Num == HVAC::Coil_HeatingElectric || - HeatingCoilType_Num == HVAC::Coil_HeatingWater || HeatingCoilType_Num == HVAC::Coil_HeatingSteam) { - HeatCoilLoad = state.dataFurnaces->Furnace(FurnaceNum).DesignHeatingCapacity * PartLoadRatio; + if (furnace.heatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || furnace.heatCoilType == HVAC::CoilType::HeatingElectric || + furnace.heatCoilType == HVAC::CoilType::HeatingWater || furnace.heatCoilType == HVAC::CoilType::HeatingSteam) { + HeatCoilLoad = furnace.DesignHeatingCapacity * PartLoadRatio; } else { HeatCoilLoad = 0.0; } } // OnOffAirFlowRatio = Par(8) - if (state.dataFurnaces->Furnace(FurnaceNum).type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { - state.dataFurnaces->Furnace(FurnaceNum).CompPartLoadRatio = PartLoadRatio; + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_WaterToAir) { + furnace.CompPartLoadRatio = PartLoadRatio; } if (par9_HXOnFlag == 1.0) { @@ -8822,7 +7705,7 @@ namespace Furnaces { // Par(10) = Furnace(FurnaceNum)%HeatPartLoadRatio // FanOp = CycFan and Furnace(FurnaceNum)%HeatPartLoadRatio must be > 0 for Part(10) to be greater than 0 // This variable used when in heating mode and dehumidification (cooling) is required. - CoolingHeatingPLRRatio = min(1.0, CoolPartLoadRatio / state.dataFurnaces->Furnace(FurnaceNum).HeatPartLoadRatio); + CoolingHeatingPLRRatio = min(1.0, CoolPartLoadRatio / furnace.HeatPartLoadRatio); } else { CoolingHeatingPLRRatio = 1.0; } @@ -8903,20 +7786,23 @@ namespace Furnaces { // Real64 par9_HXUnitOne = Par[8]; int CoilIndex; + + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + if (par6_loadTypeFlag == 1.0) { CoolPartLoadRatio = PartLoadRatio; HeatPartLoadRatio = 0.0; HeatCoilLoad = 0.0; - CoilIndex = state.dataFurnaces->Furnace(FurnaceNum).CoolingCoilIndex; + CoilIndex = furnace.CoolCoilNum; } else { CoolPartLoadRatio = 0.0; HeatPartLoadRatio = PartLoadRatio; - CoilIndex = state.dataFurnaces->Furnace(FurnaceNum).HeatingCoilIndex; + CoilIndex = furnace.HeatCoilNum; } // Get child component RuntimeFrac Real64 RuntimeFrac; - switch (state.dataFurnaces->Furnace(FurnaceNum).WatertoAirHPType) { + switch (furnace.WatertoAirHPType) { case WAHPCoilType::Simple: { RuntimeFrac = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(CoilIndex).RunFrac; break; @@ -8935,7 +7821,7 @@ namespace Furnaces { state.dataFurnaces->OnOffFanPartLoadFractionSave = state.dataHVACGlobal->OnOffFanPartLoadFraction; // update fan and compressor run times - state.dataFurnaces->Furnace(FurnaceNum).CompPartLoadRatio = PartLoadRatio; + furnace.CompPartLoadRatio = PartLoadRatio; // Calculate the heating coil demand as (the zone sensible load - load met by fan heat and mixed air) // Note; The load met by fan heat and mixed air is calculated as mdot(zoneinletenthalpy-zoneoutletenthalpy) @@ -8949,13 +7835,13 @@ namespace Furnaces { HPCoilSensDemand = LoadToBeMet - RuntimeFrac * ZoneSensLoadMetFanONCompOFF; // HPCoilSensDemand = LoadToBeMet - PartLoadRatio*ZoneSensLoadMetFanONCompOFF if (par6_loadTypeFlag == 1.0) { - state.dataFurnaces->Furnace(FurnaceNum).HeatingCoilSensDemand = 0.0; - state.dataFurnaces->Furnace(FurnaceNum).CoolingCoilSensDemand = std::abs(HPCoilSensDemand); + furnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = std::abs(HPCoilSensDemand); } else { - state.dataFurnaces->Furnace(FurnaceNum).HeatingCoilSensDemand = HPCoilSensDemand; - state.dataFurnaces->Furnace(FurnaceNum).CoolingCoilSensDemand = 0.0; + furnace.HeatingCoilSensDemand = HPCoilSensDemand; + furnace.CoolingCoilSensDemand = 0.0; } - state.dataFurnaces->Furnace(FurnaceNum).InitHeatPump = false; // initialization call to Calc Furnace + furnace.InitHeatPump = false; // initialization call to Calc Furnace // Calculate the zone loads met and the new part load ratio and for the specified run time Dummy = 0.0; @@ -9009,8 +7895,8 @@ namespace Furnaces { // METHODOLOGY EMPLOYED: // The air flow rate in cooling, heating, and no cooling or heating can be different. // Calculate the air flow rate based on initializations made in InitFurnace. - - int InletNode = state.dataFurnaces->Furnace(FurnaceNum).FurnaceInletNodeNum; + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + int InletNode = furnace.FurnaceInletNode; Real64 AverageUnitMassFlow = (PartLoadRatio * state.dataFurnaces->CompOnMassFlow) + ((1 - PartLoadRatio) * state.dataFurnaces->CompOffMassFlow); if (state.dataFurnaces->CompOffFlowRatio > 0.0) { @@ -9020,8 +7906,8 @@ namespace Furnaces { state.dataFurnaces->FanSpeedRatio = state.dataFurnaces->CompOnFlowRatio; } // IF the furnace is scheduled on or nighttime cycle overrides fan schedule. Uses same logic as fan. - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataFurnaces->Furnace(FurnaceNum).SchedPtr) > 0.0 && - ((ScheduleManager::GetCurrentScheduleValue(state, state.dataFurnaces->Furnace(FurnaceNum).FanAvailSchedPtr) > 0.0 || + if (ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0 && + ((ScheduleManager::GetCurrentScheduleValue(state, furnace.FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff)) { state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow; @@ -9036,7 +7922,7 @@ namespace Furnaces { OnOffAirFlowRatio = 1.0; } - state.dataFurnaces->Furnace(FurnaceNum).MdotFurnace = state.dataFurnaces->CompOnMassFlow; + furnace.MdotFurnace = state.dataFurnaces->CompOnMassFlow; state.dataFurnaces->OnOffAirFlowRatioSave = OnOffAirFlowRatio; } @@ -9060,14 +7946,14 @@ namespace Furnaces { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ratio; Real64 OnOffRatio; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Report the Furnace Fan Part Load Ratio - if (thisFurnace.NumOfSpeedCooling < 1) { - if (thisFurnace.DesignMassFlowRate > 0.0) { - thisFurnace.FanPartLoadRatio = thisFurnace.MdotFurnace / thisFurnace.DesignMassFlowRate; + if (furnace.NumOfSpeedCooling < 1) { + if (furnace.DesignMassFlowRate > 0.0) { + furnace.FanPartLoadRatio = furnace.MdotFurnace / furnace.DesignMassFlowRate; } else { - thisFurnace.FanPartLoadRatio = 0.0; + furnace.FanPartLoadRatio = 0.0; } } @@ -9075,29 +7961,29 @@ namespace Furnaces { if (state.afn->distribution_simulated) { state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOnMassFlowrate = state.dataFurnaces->CompOnMassFlow; state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOffMassFlowrate = state.dataFurnaces->CompOffMassFlow; - state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopFanOperationMode = thisFurnace.fanOp; - state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio = thisFurnace.FanPartLoadRatio; + state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopFanOperationMode = furnace.fanOp; + state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio = furnace.FanPartLoadRatio; OnOffRatio = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio; - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir) { state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio = - max(thisFurnace.FanPartLoadRatio, thisFurnace.HeatPartLoadRatio, thisFurnace.CoolPartLoadRatio); + max(furnace.FanPartLoadRatio, furnace.HeatPartLoadRatio, furnace.CoolPartLoadRatio); state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio = min(1.0, state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio); } - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool) { - if (thisFurnace.HeatPartLoadRatio == 0.0 && thisFurnace.CoolPartLoadRatio == 0.0 && thisFurnace.FanPartLoadRatio > 0.0) { - if (state.dataFurnaces->CompOnMassFlow < max(thisFurnace.MaxCoolAirMassFlow, thisFurnace.MaxHeatAirMassFlow) && + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool) { + if (furnace.HeatPartLoadRatio == 0.0 && furnace.CoolPartLoadRatio == 0.0 && furnace.FanPartLoadRatio > 0.0) { + if (state.dataFurnaces->CompOnMassFlow < max(furnace.MaxCoolAirMassFlow, furnace.MaxHeatAirMassFlow) && state.dataFurnaces->CompOnMassFlow > 0.0) { - ratio = max(thisFurnace.MaxCoolAirMassFlow, thisFurnace.MaxHeatAirMassFlow) / state.dataFurnaces->CompOnMassFlow; + ratio = max(furnace.MaxCoolAirMassFlow, furnace.MaxHeatAirMassFlow) / state.dataFurnaces->CompOnMassFlow; state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio * ratio; } } } } - if (thisFurnace.FirstPass) { + if (furnace.FirstPass) { if (!state.dataGlobal->SysSizingCalc) { - DataSizing::resetHVACSizingGlobals(state, 0, state.dataSize->CurSysNum, thisFurnace.FirstPass); + DataSizing::resetHVACSizingGlobals(state, 0, state.dataSize->CurSysNum, furnace.FirstPass); } } state.dataHVACGlobal->OnOffFanPartLoadFraction = @@ -9129,54 +8015,55 @@ namespace Furnaces { int constexpr SolveMaxIter(50); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + std::string HeatCoilName; Real64 mdot; // heating coil steam or hot water mass flow rate Real64 MinWaterFlow; // coil minimum hot water mass flow rate, kg/s Real64 MaxHotWaterFlow; // coil maximum hot water mass flow rate, kg/s Real64 HotWaterMdot; // actual hot water mass flow rate - int CoilTypeNum(0); // heating coil type number - int HeatingCoilIndex(0); // heating coil index + HVAC::CoilType coilType; // heating coil type number + int HeatCoilNum(0); // heating coil index int CoilControlNode(0); // control node for hot water and steam heating coils int CoilOutletNode(0); // air outlet node of the heating coils PlantLocation plantLoc{}; // plant loop location Real64 QActual = 0.0; // actual heating load - std::string &HeatingCoilName = state.dataFurnaces->HeatingCoilName; // name of heating coil - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); if (SuppHeatingCoilFlag) { - HeatingCoilName = thisFurnace.SuppHeatCoilName; - HeatingCoilIndex = thisFurnace.SuppHeatCoilIndex; - CoilControlNode = thisFurnace.SuppCoilControlNode; - CoilOutletNode = thisFurnace.SuppCoilOutletNode; - CoilTypeNum = thisFurnace.SuppHeatCoilType_Num; - plantLoc = thisFurnace.SuppPlantLoc; - MaxHotWaterFlow = thisFurnace.MaxSuppCoilFluidFlow; + HeatCoilName = furnace.SuppCoilName; + HeatCoilNum = furnace.SuppCoilNum; + CoilControlNode = furnace.SuppCoilControlNode; + CoilOutletNode = furnace.SuppCoilOutletNode; + coilType = furnace.suppHeatCoilType; + plantLoc = furnace.SuppPlantLoc; + MaxHotWaterFlow = furnace.MaxSuppCoilFluidFlow; } else { - HeatingCoilName = thisFurnace.HeatingCoilName; - HeatingCoilIndex = thisFurnace.HeatingCoilIndex; - CoilControlNode = thisFurnace.CoilControlNode; - CoilOutletNode = thisFurnace.CoilOutletNode; - CoilTypeNum = thisFurnace.HeatingCoilType_Num; - plantLoc = thisFurnace.plantLoc; - MaxHotWaterFlow = thisFurnace.MaxHeatCoilFluidFlow; + HeatCoilName = furnace.HeatCoilName; + HeatCoilNum = furnace.HeatCoilNum; + CoilControlNode = furnace.HeatCoilControlNode; + CoilOutletNode = furnace.CoilOutletNode; + coilType = furnace.heatCoilType; + plantLoc = furnace.plantLoc; + MaxHotWaterFlow = furnace.MaxHeatCoilFluidFlow; } - switch (CoilTypeNum) { - case HVAC::Coil_HeatingGasOrOtherFuel: - case HVAC::Coil_HeatingElectric: - case HVAC::Coil_HeatingDesuperheater: { + switch (coilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: + case HVAC::CoilType::HeatingDesuperheater: { HeatingCoils::SimulateHeatingCoilComponents( - state, HeatingCoilName, FirstHVACIteration, QCoilLoad, HeatingCoilIndex, QActual, SuppHeatingCoilFlag, fanOp); + state, HeatCoilName, FirstHVACIteration, QCoilLoad, HeatCoilNum, QActual, SuppHeatingCoilFlag, fanOp); } break; - case HVAC::Coil_HeatingWater: { + case HVAC::CoilType::HeatingWater: { if (QCoilLoad > HVAC::SmallLoad) { PlantUtilities::SetComponentFlowRate(state, MaxHotWaterFlow, CoilControlNode, CoilOutletNode, plantLoc); - WaterCoils::SimulateWaterCoilComponents(state, HeatingCoilName, FirstHVACIteration, HeatingCoilIndex, QActual, fanOp); + WaterCoils::SimulateWaterCoilComponents(state, HeatCoilName, FirstHVACIteration, HeatCoilNum, QActual, fanOp); if (QActual > (QCoilLoad + HVAC::SmallLoad)) { // control water flow to obtain output matching QCoilLoad MinWaterFlow = 0.0; auto f = [&state, FurnaceNum, FirstHVACIteration, QCoilLoad, SuppHeatingCoilFlag](Real64 const HWFlow) { + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); Real64 QCoilRequested = QCoilLoad; // FUNCTION LOCAL VARIABLE DECLARATIONS: @@ -9186,40 +8073,40 @@ namespace Furnaces { if (!SuppHeatingCoilFlag) { PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataFurnaces->Furnace(FurnaceNum).CoilControlNode, - state.dataFurnaces->Furnace(FurnaceNum).CoilOutletNode, - state.dataFurnaces->Furnace(FurnaceNum).plantLoc); + furnace.HeatCoilControlNode, + furnace.CoilOutletNode, + furnace.plantLoc); WaterCoils::SimulateWaterCoilComponents(state, - state.dataFurnaces->Furnace(FurnaceNum).HeatingCoilName, + furnace.HeatCoilName, FirstHVACIteration, - state.dataFurnaces->Furnace(FurnaceNum).HeatingCoilIndex, + furnace.HeatCoilNum, QCoilActual, - state.dataFurnaces->Furnace(FurnaceNum).fanOp); + furnace.fanOp); } else { // supplemental coil PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataFurnaces->Furnace(FurnaceNum).SuppCoilControlNode, - state.dataFurnaces->Furnace(FurnaceNum).SuppCoilOutletNode, - state.dataFurnaces->Furnace(FurnaceNum).SuppPlantLoc); + furnace.SuppCoilControlNode, + furnace.SuppCoilOutletNode, + furnace.SuppPlantLoc); // simulate the hot water supplemental heating coil WaterCoils::SimulateWaterCoilComponents(state, - state.dataFurnaces->Furnace(FurnaceNum).SuppHeatCoilName, + furnace.SuppCoilName, FirstHVACIteration, - state.dataFurnaces->Furnace(FurnaceNum).SuppHeatCoilIndex, + furnace.SuppCoilNum, QCoilActual, - state.dataFurnaces->Furnace(FurnaceNum).fanOp); + furnace.fanOp); } return QCoilRequested != 0.0 ? (QCoilActual - QCoilRequested) / QCoilRequested : 0.0; }; int SolFlag = 0; General::SolveRoot(state, ErrTolerance, SolveMaxIter, SolFlag, HotWaterMdot, f, MinWaterFlow, MaxHotWaterFlow); if (SolFlag == -1) { - if (thisFurnace.HotWaterCoilMaxIterIndex == 0) { + if (furnace.HotWaterCoilMaxIterIndex == 0) { ShowWarningMessage(state, format("CalcNonDXHeatingCoils: Hot water coil control failed for {}=\"{}\"", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating hot water mass flow rate", SolveMaxIter)); } @@ -9227,15 +8114,15 @@ namespace Furnaces { state, format("CalcNonDXHeatingCoils: Hot water coil control failed (iteration limit [{}]) for {}=\"{}", SolveMaxIter, - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.HotWaterCoilMaxIterIndex); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.HotWaterCoilMaxIterIndex); } else if (SolFlag == -2) { - if (thisFurnace.HotWaterCoilMaxIterIndex2 == 0) { + if (furnace.HotWaterCoilMaxIterIndex2 == 0) { ShowWarningMessage(state, format("CalcNonDXHeatingCoils: Hot water coil control failed (maximum flow limits) for {}=\"{}\"", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name)); + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, "...Bad hot water maximum flow rate limits"); ShowContinueError(state, format("...Given minimum water flow rate={:.3R} kg/s", MinWaterFlow)); @@ -9243,9 +8130,9 @@ namespace Furnaces { } ShowRecurringWarningErrorAtEnd(state, format("CalcNonDXHeatingCoils: Hot water coil control failed (flow limits) for {}=\"{}\"", - HVAC::unitarySysTypeNames[(int)thisFurnace.type], - thisFurnace.Name), - thisFurnace.HotWaterCoilMaxIterIndex2, + HVAC::unitarySysTypeNames[(int)furnace.type], + furnace.Name), + furnace.HotWaterCoilMaxIterIndex2, MaxHotWaterFlow, MinWaterFlow, _, @@ -9258,18 +8145,18 @@ namespace Furnaces { PlantUtilities::SetComponentFlowRate(state, mdot, CoilControlNode, CoilOutletNode, plantLoc); } // simulate the hot water heating coil - WaterCoils::SimulateWaterCoilComponents(state, HeatingCoilName, FirstHVACIteration, HeatingCoilIndex, QActual, fanOp); + WaterCoils::SimulateWaterCoilComponents(state, HeatCoilName, FirstHVACIteration, HeatCoilNum, QActual, fanOp); } break; - case HVAC::Coil_HeatingSteam: { + case HVAC::CoilType::HeatingSteam: { if (QCoilLoad > HVAC::SmallLoad) { PlantUtilities::SetComponentFlowRate(state, MaxHotWaterFlow, CoilControlNode, CoilOutletNode, plantLoc); // simulate the steam heating coil - SteamCoils::SimulateSteamCoilComponents(state, HeatingCoilName, FirstHVACIteration, HeatingCoilIndex, QCoilLoad, QActual, fanOp); + SteamCoils::SimulateSteamCoilComponents(state, HeatCoilName, FirstHVACIteration, HeatCoilNum, QCoilLoad, QActual, fanOp); } else { mdot = 0.0; PlantUtilities::SetComponentFlowRate(state, mdot, CoilControlNode, CoilOutletNode, plantLoc); // simulate the steam heating coil - SteamCoils::SimulateSteamCoilComponents(state, HeatingCoilName, FirstHVACIteration, HeatingCoilIndex, QCoilLoad, QActual, fanOp); + SteamCoils::SimulateSteamCoilComponents(state, HeatCoilName, FirstHVACIteration, HeatCoilNum, QCoilLoad, QActual, fanOp); } } break; default: @@ -9328,33 +8215,33 @@ namespace Furnaces { Real64 SystemSensibleLoad = QZnReq; // Positive value means heating required Real64 TotalZoneSensibleLoad = QZnReq; Real64 TotalZoneLatentLoad = QLatReq; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // initialize local variables bool UnitOn = true; - int OutletNode = thisFurnace.FurnaceOutletNodeNum; - int InletNode = thisFurnace.FurnaceInletNodeNum; - Real64 AirMassFlow = thisFurnace.DesignMassFlowRate; - HVAC::FanOp fanOp = thisFurnace.fanOp; // fan operating mode - int ZoneNum = thisFurnace.ControlZoneNum; + int OutletNode = furnace.FurnaceOutletNode; + int InletNode = furnace.FurnaceInletNode; + Real64 AirMassFlow = furnace.DesignMassFlowRate; + HVAC::FanOp fanOp = furnace.fanOp; // fan operating mode + int ZoneNum = furnace.ControlZoneNum; // Set latent load for heating if (state.dataFurnaces->HeatingLoad) { - thisFurnace.HeatCoolMode = Furnaces::ModeOfOperation::HeatingMode; + furnace.HeatCoolMode = Furnaces::ModeOfOperation::HeatingMode; // Set latent load for cooling and no sensible load condition } else if (state.dataFurnaces->CoolingLoad) { - thisFurnace.HeatCoolMode = Furnaces::ModeOfOperation::CoolingMode; + furnace.HeatCoolMode = Furnaces::ModeOfOperation::CoolingMode; } else { - thisFurnace.HeatCoolMode = Furnaces::ModeOfOperation::NoCoolHeat; + furnace.HeatCoolMode = Furnaces::ModeOfOperation::NoCoolHeat; } // set the on/off flags - if (thisFurnace.fanOp == HVAC::FanOp::Cycling) { + if (furnace.fanOp == HVAC::FanOp::Cycling) { // cycling unit only runs if there is a cooling or heating load. if (std::abs(QZnReq) < HVAC::SmallLoad || AirMassFlow < HVAC::SmallMassFlow || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { UnitOn = false; } - } else if (thisFurnace.fanOp == HVAC::FanOp::Continuous) { + } else if (furnace.fanOp == HVAC::FanOp::Continuous) { // continuous unit: fan runs if scheduled on; coil runs only if there is a cooling or heating load if (AirMassFlow < HVAC::SmallMassFlow) { UnitOn = false; @@ -9366,10 +8253,10 @@ namespace Furnaces { Real64 SaveMassFlowRate = state.dataLoopNodes->Node(InletNode).MassFlowRate; // decide current working mode for IHP - if ((FirstHVACIteration) && (thisFurnace.bIsIHP)) - IntegratedHeatPump::DecideWorkMode(state, thisFurnace.CoolingCoilIndex, TotalZoneSensibleLoad, TotalZoneLatentLoad); + if ((FirstHVACIteration) && (furnace.isIHP)) + IntegratedHeatPump::DecideWorkMode(state, furnace.ihpNum, TotalZoneSensibleLoad, TotalZoneLatentLoad); - if (!FirstHVACIteration && thisFurnace.fanOp == HVAC::FanOp::Cycling && + if (!FirstHVACIteration && furnace.fanOp == HVAC::FanOp::Cycling && (QZnReq < (-1.0 * HVAC::SmallLoad) || TotalZoneLatentLoad < (-HVAC::SmallLoad)) && EconoActive) { // for cycling fan, cooling load, check whether furnace can meet load with compressor off compressorOp = HVAC::CompressorOp::Off; @@ -9389,7 +8276,7 @@ namespace Furnaces { TotalZoneSensibleLoad = QZnReq; TotalZoneLatentLoad = QLatReq; - if (SpeedNum == thisFurnace.NumOfSpeedCooling && SpeedRatio == 1.0) { + if (SpeedNum == furnace.NumOfSpeedCooling && SpeedRatio == 1.0) { // compressor on (reset inlet air mass flow rate to starting value) state.dataLoopNodes->Node(InletNode).MassFlowRate = SaveMassFlowRate; compressorOp = HVAC::CompressorOp::On; @@ -9424,7 +8311,7 @@ namespace Furnaces { SupHeaterLoad); } - if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool) { + if (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool) { state.dataFurnaces->SaveCompressorPLR = PartLoadFrac; } else { if (SpeedNum > 1) { @@ -9440,8 +8327,8 @@ namespace Furnaces { TotalZoneSensibleLoad = QZnReq; TotalZoneLatentLoad = QLatReq; // Calculate the reheat coil output - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && - (thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && + if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) > 0.0) && + (furnace.Humidistat && furnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && (QLatReq < 0.0))) { // if a Humidistat is installed and dehumidification control type is CoolReheat CalcVarSpeedHeatPump(state, FurnaceNum, @@ -9456,24 +8343,24 @@ namespace Furnaces { TotalZoneLatentLoad, OnOffAirFlowRatio, ReheatCoilLoad); - if (thisFurnace.ZoneSequenceHeatingNum > 0) { - QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum) - .SequencedOutputRequiredToHeatingSP(thisFurnace.ZoneSequenceHeatingNum) / - thisFurnace.ControlZoneMassFlowFrac); + if (furnace.ZoneSequenceHeatingNum > 0) { + QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum) + .SequencedOutputRequiredToHeatingSP(furnace.ZoneSequenceHeatingNum) / + furnace.ControlZoneMassFlowFrac); } else { - QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum).OutputRequiredToHeatingSP / - thisFurnace.ControlZoneMassFlowFrac); + QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(furnace.ControlZoneNum).OutputRequiredToHeatingSP / + furnace.ControlZoneMassFlowFrac); } // Cooling mode or floating condition and dehumidification is required if (QToHeatSetPt < 0.0) { // Calculate the reheat coil load wrt the heating setpoint temperature. Reheat coil picks up // the entire excess sensible cooling (DX cooling coil and impact of outdoor air). ReheatCoilLoad = max(0.0, (QToHeatSetPt - ActualSensibleOutput)); - thisFurnace.DehumidInducedHeatingDemandRate = ReheatCoilLoad; + furnace.DehumidInducedHeatingDemandRate = ReheatCoilLoad; // Heating mode and dehumidification is required } else { ReheatCoilLoad = max(QToHeatSetPt, QToHeatSetPt - ActualSensibleOutput); - thisFurnace.DehumidInducedHeatingDemandRate = max(0.0, ActualSensibleOutput * (-1.0)); + furnace.DehumidInducedHeatingDemandRate = max(0.0, ActualSensibleOutput * (-1.0)); } SupHeaterLoad = 0.0; @@ -9537,10 +8424,10 @@ namespace Furnaces { // calculate delivered capacity AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; - thisFurnace.MdotFurnace = AirMassFlow; + furnace.MdotFurnace = AirMassFlow; QTotUnitOut = - AirMassFlow * (state.dataLoopNodes->Node(OutletNode).Enthalpy - state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone).Enthalpy); + AirMassFlow * (state.dataLoopNodes->Node(OutletNode).Enthalpy - state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone).Enthalpy); state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AirMassFlow; state.dataLoopNodes->Node(OutletNode).MassFlowRateMaxAvail = AirMassFlow; @@ -9564,34 +8451,34 @@ namespace Furnaces { } // report variables - thisFurnace.DehumidInducedHeatingDemandRate = ReheatCoilLoad; + furnace.DehumidInducedHeatingDemandRate = ReheatCoilLoad; if (QZnReq > HVAC::SmallLoad) { // HEATING LOAD - thisFurnace.CoolingCoilSensDemand = 0.0; - thisFurnace.HeatingCoilSensDemand = QZnReq; + furnace.CoolingCoilSensDemand = 0.0; + furnace.HeatingCoilSensDemand = QZnReq; } else { - thisFurnace.CoolingCoilSensDemand = std::abs(QZnReq); - thisFurnace.HeatingCoilSensDemand = 0.0; + furnace.CoolingCoilSensDemand = std::abs(QZnReq); + furnace.HeatingCoilSensDemand = 0.0; } - thisFurnace.CompPartLoadRatio = state.dataFurnaces->SaveCompressorPLR; - if (thisFurnace.fanOp == HVAC::FanOp::Cycling) { + furnace.CompPartLoadRatio = state.dataFurnaces->SaveCompressorPLR; + if (furnace.fanOp == HVAC::FanOp::Cycling) { if (SupHeaterLoad > 0.0) { - thisFurnace.FanPartLoadRatio = 1.0; + furnace.FanPartLoadRatio = 1.0; } else { if (SpeedNum < 2) { - thisFurnace.FanPartLoadRatio = PartLoadFrac; + furnace.FanPartLoadRatio = PartLoadFrac; } else { - thisFurnace.FanPartLoadRatio = 1.0; + furnace.FanPartLoadRatio = 1.0; } } } else { if (UnitOn) { - thisFurnace.FanPartLoadRatio = 1.0; + furnace.FanPartLoadRatio = 1.0; } else { if (SpeedNum < 2) { - thisFurnace.FanPartLoadRatio = PartLoadFrac; + furnace.FanPartLoadRatio = PartLoadFrac; } else { - thisFurnace.FanPartLoadRatio = 1.0; + furnace.FanPartLoadRatio = 1.0; } } } @@ -9645,8 +8532,8 @@ namespace Furnaces { Real64 noLatOutput = 0.0; Real64 ErrorToler = 0.001; // Error tolerance for convergence from input deck - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) == 0.0) return; + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); + if (ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) == 0.0) return; // Get result when DX coil is off SupHeaterLoad = 0.0; @@ -9664,8 +8551,8 @@ namespace Furnaces { OnOffAirFlowRatio, SupHeaterLoad); - if (thisFurnace.bIsIHP) { - IHPMode = IntegratedHeatPump::GetCurWorkMode(state, thisFurnace.CoolingCoilIndex); + if (furnace.isIHP) { + IHPMode = IntegratedHeatPump::GetCurWorkMode(state, furnace.ihpNum); if ((IntegratedHeatPump::IHPOperationMode::DedicatedWaterHtg == IHPMode) || (IntegratedHeatPump::IHPOperationMode::SCWHMatchWH == IHPMode)) { // cooling capacity is a resultant return; @@ -9687,18 +8574,18 @@ namespace Furnaces { // Get full load result PartLoadFrac = 1.0; SpeedRatio = 1.0; - if (thisFurnace.HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) { - SpeedNum = thisFurnace.NumOfSpeedHeating; - } else if (thisFurnace.HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) { - SpeedNum = thisFurnace.NumOfSpeedCooling; + if (furnace.HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) { + SpeedNum = furnace.NumOfSpeedHeating; + } else if (furnace.HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) { + SpeedNum = furnace.NumOfSpeedCooling; } else if (QLatReq < -HVAC::SmallLoad) { - SpeedNum = thisFurnace.NumOfSpeedCooling; + SpeedNum = furnace.NumOfSpeedCooling; } else { SpeedNum = 1; PartLoadFrac = 0.0; } - if (thisFurnace.bIsIHP) SpeedNum = IntegratedHeatPump::GetMaxSpeedNumIHP(state, thisFurnace.CoolingCoilIndex); + if (furnace.isIHP) SpeedNum = IntegratedHeatPump::GetMaxSpeedNumIHP(state, furnace.ihpNum); CalcVarSpeedHeatPump(state, FurnaceNum, @@ -9718,18 +8605,18 @@ namespace Furnaces { if (QLatReq <= LatOutput || (QZnReq < -HVAC::SmallLoad && QZnReq <= FullOutput) || (QZnReq > HVAC::SmallLoad && QZnReq >= FullOutput)) { PartLoadFrac = 1.0; SpeedRatio = 1.0; - thisFurnace.CompPartLoadRatio = PartLoadFrac; - thisFurnace.CompSpeedRatio = SpeedRatio; - thisFurnace.CompSpeedNum = SpeedNum; + furnace.CompPartLoadRatio = PartLoadFrac; + furnace.CompSpeedRatio = SpeedRatio; + furnace.CompSpeedNum = SpeedNum; return; } } else if (QZnReq < -HVAC::SmallLoad) { if (QZnReq <= FullOutput) { PartLoadFrac = 1.0; SpeedRatio = 1.0; - thisFurnace.CompPartLoadRatio = PartLoadFrac; - thisFurnace.CompSpeedRatio = SpeedRatio; - thisFurnace.CompSpeedNum = SpeedNum; + furnace.CompPartLoadRatio = PartLoadFrac; + furnace.CompSpeedRatio = SpeedRatio; + furnace.CompSpeedNum = SpeedNum; return; } } else { @@ -9769,30 +8656,30 @@ namespace Furnaces { General::SolveRoot(state, ErrorToler, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - if (thisFurnace.ErrCountCyc == 0) { - ++thisFurnace.ErrCountCyc; + if (furnace.ErrCountCyc == 0) { + ++furnace.ErrCountCyc; ShowWarningError( - state, format("Iteration limit exceeded calculating VS WSHP unit cycling ratio, for unit={}", thisFurnace.Name)); + state, format("Iteration limit exceeded calculating VS WSHP unit cycling ratio, for unit={}", furnace.Name)); ShowContinueErrorTimeStamp(state, format("Cycling ratio returned={:.2R}", PartLoadFrac)); } else { ShowRecurringWarningErrorAtEnd( state, - thisFurnace.Name + "\": Iteration limit warning exceeding calculating DX unit cycling ratio continues...", - thisFurnace.ErrIndexCyc, + furnace.Name + "\": Iteration limit warning exceeding calculating DX unit cycling ratio continues...", + furnace.ErrIndexCyc, PartLoadFrac, PartLoadFrac); } } } else if (SolFla == -2) { ShowFatalError( - state, format("VS WSHP unit cycling ratio calculation failed: cycling limits exceeded, for unit={}", thisFurnace.Name)); + state, format("VS WSHP unit cycling ratio calculation failed: cycling limits exceeded, for unit={}", furnace.Name)); } } else { // Check to see which speed to meet the load PartLoadFrac = 1.0; SpeedRatio = 1.0; if (QZnReq < -HVAC::SmallLoad) { // Cooling - for (i = 2; i <= thisFurnace.NumOfSpeedCooling; ++i) { + for (i = 2; i <= furnace.NumOfSpeedCooling; ++i) { CalcVarSpeedHeatPump(state, FurnaceNum, FirstHVACIteration, @@ -9813,7 +8700,7 @@ namespace Furnaces { } } } else { - for (i = 2; i <= thisFurnace.NumOfSpeedHeating; ++i) { + for (i = 2; i <= furnace.NumOfSpeedHeating; ++i) { CalcVarSpeedHeatPump(state, FurnaceNum, FirstHVACIteration, @@ -9841,23 +8728,23 @@ namespace Furnaces { General::SolveRoot(state, ErrorToler, MaxIte, SolFla, SpeedRatio, f, 1.0e-10, 1.0); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - if (thisFurnace.ErrCountVar == 0) { - ++thisFurnace.ErrCountVar; + if (furnace.ErrCountVar == 0) { + ++furnace.ErrCountVar; ShowWarningError( - state, format("Iteration limit exceeded calculating VS WSHP unit speed ratio, for unit={}", thisFurnace.Name)); + state, format("Iteration limit exceeded calculating VS WSHP unit speed ratio, for unit={}", furnace.Name)); ShowContinueErrorTimeStamp(state, format("Speed ratio returned=[{:.2R}], Speed number ={}", SpeedRatio, SpeedNum)); } else { ShowRecurringWarningErrorAtEnd( state, - thisFurnace.Name + "\": Iteration limit warning exceeding calculating DX unit speed ratio continues...", - thisFurnace.ErrIndexVar, + furnace.Name + "\": Iteration limit warning exceeding calculating DX unit speed ratio continues...", + furnace.ErrIndexVar, SpeedRatio, SpeedRatio); } } } else if (SolFla == -2) { ShowFatalError( - state, format("VS WSHP unit compressor speed calculation failed: speed limits exceeded, for unit={}", thisFurnace.Name)); + state, format("VS WSHP unit compressor speed calculation failed: speed limits exceeded, for unit={}", furnace.Name)); } } } else { @@ -9872,7 +8759,7 @@ namespace Furnaces { if (QLatReq < -HVAC::SmallLoad && QLatReq < LatOutput) { PartLoadFrac = 1.0; SpeedRatio = 1.0; - for (i = SpeedNum; i <= thisFurnace.NumOfSpeedCooling; ++i) { + for (i = SpeedNum; i <= furnace.NumOfSpeedCooling; ++i) { CalcVarSpeedHeatPump(state, FurnaceNum, FirstHVACIteration, @@ -9918,23 +8805,23 @@ namespace Furnaces { } if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - if (thisFurnace.ErrCountVar2 == 0) { - ++thisFurnace.ErrCountVar2; + if (furnace.ErrCountVar2 == 0) { + ++furnace.ErrCountVar2; ShowWarningError(state, - format("Iteration limit exceeded calculating VS WSHP unit speed ratio, for unit={}", thisFurnace.Name)); + format("Iteration limit exceeded calculating VS WSHP unit speed ratio, for unit={}", furnace.Name)); ShowContinueErrorTimeStamp(state, format("Speed ratio returned=[{:.2R}], Speed number ={}", SpeedRatio, SpeedNum)); } else { ShowRecurringWarningErrorAtEnd(state, - thisFurnace.Name + + furnace.Name + "\": Iteration limit warning exceeding calculating DX unit speed ratio continues...", - thisFurnace.ErrIndexVar, + furnace.ErrIndexVar, SpeedRatio, SpeedRatio); } } } else if (SolFla == -2) { ShowFatalError(state, - format("VS WSHP unit compressor speed calculation failed: speed limits exceeded, for unit={}", thisFurnace.Name)); + format("VS WSHP unit compressor speed calculation failed: speed limits exceeded, for unit={}", furnace.Name)); } } } @@ -9943,13 +8830,13 @@ namespace Furnaces { // if the heating coil cannot meet the load, trim with supplemental heater // occurs with constant fan mode when compressor is on or off // occurs with cycling fan mode when compressor PLR is equal to 1 - if ((QZnReq > HVAC::SmallLoad && QZnReq > FullOutput) && (thisFurnace.SuppHeatCoilIndex != 0)) { + if ((QZnReq > HVAC::SmallLoad && QZnReq > FullOutput) && (furnace.SuppCoilNum != 0)) { PartLoadFrac = 1.0; SpeedRatio = 1.0; - if (thisFurnace.NumOfSpeedHeating > 0) - SpeedNum = thisFurnace.NumOfSpeedHeating; // maximum heating speed, avoid zero for cooling only mode + if (furnace.NumOfSpeedHeating > 0) + SpeedNum = furnace.NumOfSpeedHeating; // maximum heating speed, avoid zero for cooling only mode - if (state.dataEnvrn->OutDryBulbTemp <= thisFurnace.MaxOATSuppHeat) { + if (state.dataEnvrn->OutDryBulbTemp <= furnace.MaxOATSuppHeat) { SupHeaterLoad = QZnReq - FullOutput; } else { SupHeaterLoad = 0.0; @@ -9970,7 +8857,7 @@ namespace Furnaces { } // check the outlet of the supplemental heater to be lower than the maximum supplemental heater supply air temperature - if (state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).Temp > thisFurnace.DesignMaxOutletTemp && SupHeaterLoad > 0.0) { + if (state.dataLoopNodes->Node(furnace.FurnaceOutletNode).Temp > furnace.DesignMaxOutletTemp && SupHeaterLoad > 0.0) { // If the supply air temperature is to high, turn off the supplemental heater to recalculate the outlet temperature CalcNonDXHeatingCoils(state, FurnaceNum, true, FirstHVACIteration, 0.0, fanOp, QCoilActual); @@ -9978,10 +8865,10 @@ namespace Furnaces { // the supplemental heater, otherwise leave the supplemental heater off. If the supplemental heater is to be turned on, // use the outlet conditions when the supplemental heater was off (CALL above) as the inlet conditions for the calculation // of supplemental heater load to just meet the maximum supply air temperature from the supplemental heater. - if (state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).Temp < thisFurnace.DesignMaxOutletTemp) { - Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).HumRat); - SupHeaterLoad = state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum).MassFlowRate * CpAir * - (thisFurnace.DesignMaxOutletTemp - state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).Temp); + if (state.dataLoopNodes->Node(furnace.FurnaceOutletNode).Temp < furnace.DesignMaxOutletTemp) { + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(furnace.FurnaceOutletNode).HumRat); + SupHeaterLoad = state.dataLoopNodes->Node(furnace.FurnaceInletNode).MassFlowRate * CpAir * + (furnace.DesignMaxOutletTemp - state.dataLoopNodes->Node(furnace.FurnaceOutletNode).Temp); } else { SupHeaterLoad = 0.0; @@ -9989,15 +8876,15 @@ namespace Furnaces { } // prepare module level output - thisFurnace.CompPartLoadRatio = PartLoadFrac; - thisFurnace.CompSpeedRatio = SpeedRatio; - thisFurnace.CompSpeedNum = SpeedNum; - thisFurnace.CoolingCoilLatentDemand = std::abs(QLatReq); + furnace.CompPartLoadRatio = PartLoadFrac; + furnace.CompSpeedRatio = SpeedRatio; + furnace.CompSpeedNum = SpeedNum; + furnace.CoolingCoilLatentDemand = std::abs(QLatReq); - if (thisFurnace.fanOp == HVAC::FanOp::Continuous) { - thisFurnace.FanPartLoadRatio = 1.0; + if (furnace.fanOp == HVAC::FanOp::Continuous) { + furnace.FanPartLoadRatio = 1.0; } else { - thisFurnace.FanPartLoadRatio = PartLoadFrac; + furnace.FanPartLoadRatio = PartLoadFrac; } } @@ -10035,39 +8922,39 @@ namespace Furnaces { // Set inlet air mass flow rate based on PLR and compressor on/off air flow rates SetVSHPAirFlow(state, FurnaceNum, PartLoadFrac, OnOffAirFlowRatio, SpeedNum, SpeedRatio); - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); - if ((SupHeaterLoad > 1.0e-10) && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool) && (thisFurnace.SuppHeatCoilIndex == 0)) { + if ((SupHeaterLoad > 1.0e-10) && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool) && (furnace.SuppCoilNum == 0)) { // ONLY HEATING COIL, NO SUPPLEMENTAL COIL, USED FOR REHEAT DURING DUHMI - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * PartLoadFrac; // REHEAT IN FAN ON TIME + HeatCoilLoad = furnace.DesignHeatingCapacity * PartLoadFrac; // REHEAT IN FAN ON TIME if (HeatCoilLoad > SupHeaterLoad) HeatCoilLoad = SupHeaterLoad; // HEATING COIL RUN TIME < FAN ON TIME - } else if ((QZnReq > HVAC::SmallLoad) && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { - HeatCoilLoad = thisFurnace.DesignHeatingCapacity * PartLoadFrac; + } else if ((QZnReq > HVAC::SmallLoad) && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + HeatCoilLoad = furnace.DesignHeatingCapacity * PartLoadFrac; } else { HeatCoilLoad = 0.0; } - Real64 AirMassFlow = state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum).MassFlowRate; + Real64 AirMassFlow = state.dataLoopNodes->Node(furnace.FurnaceInletNode).MassFlowRate; // if blow through, simulate fan then coils - if (thisFurnace.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + if (furnace.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); - if ((!thisFurnace.CoolingCoilUpstream) && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + if ((!furnace.CoolCoilUpstream) && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { // simulate thisFurnace heating coil bool SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, furnace.fanOp, QCoilActual); } if ((QZnReq < -HVAC::SmallLoad || (QLatReq < -HVAC::SmallLoad)) && - (state.dataEnvrn->OutDryBulbTemp >= thisFurnace.MinOATCompressorCooling)) { // COOLING MODE or dehumidification mode + (state.dataEnvrn->OutDryBulbTemp >= furnace.MinOATCompressorCooling)) { // COOLING MODE or dehumidification mode - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10080,8 +8967,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.CoolCoilNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10094,13 +8981,13 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.CoolingCoilIndex).PartLoadRatio; + state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.CoolCoilNum).PartLoadRatio; } else { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10112,17 +8999,17 @@ namespace Furnaces { OnOffAirFlowRatio); } else { VariableSpeedCoils::SimVariableSpeedCoils( - state, BlankString, thisFurnace.CoolingCoilIndex, thisFurnace.fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRatio); + state, BlankString, furnace.CoolCoilNum, furnace.fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRatio); } } - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatCool) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatCool) { if ((QZnReq > HVAC::SmallLoad) && state.dataFurnaces->HeatingLoad) { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10135,8 +9022,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.HeatCoilNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10149,13 +9036,13 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.HeatingCoilIndex).PartLoadRatio; + state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.HeatCoilNum).PartLoadRatio; } else { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10168,8 +9055,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.HeatCoilNum, + furnace.fanOp, compressorOp, 0.0, 1, @@ -10179,29 +9066,29 @@ namespace Furnaces { OnOffAirFlowRatio); } } - } else if (thisFurnace.CoolingCoilUpstream && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + } else if (furnace.CoolCoilUpstream && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { // simulate thisFurnace heating coil bool SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, furnace.fanOp, QCoilActual); } // Call twice to ensure the fan outlet conditions are updated - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); - if ((!thisFurnace.CoolingCoilUpstream) && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + if ((!furnace.CoolCoilUpstream) && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { // simulate thisFurnace heating coil bool SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, furnace.fanOp, QCoilActual); } if ((QZnReq < -HVAC::SmallLoad || (QLatReq < -HVAC::SmallLoad)) && - (state.dataEnvrn->OutDryBulbTemp >= thisFurnace.MinOATCompressorCooling)) { + (state.dataEnvrn->OutDryBulbTemp >= furnace.MinOATCompressorCooling)) { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10214,8 +9101,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.CoolCoilNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10227,14 +9114,14 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.CoolingCoilIndex).PartLoadRatio; + state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.CoolCoilNum).PartLoadRatio; } else { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10246,17 +9133,17 @@ namespace Furnaces { OnOffAirFlowRatio); } else { VariableSpeedCoils::SimVariableSpeedCoils( - state, BlankString, thisFurnace.CoolingCoilIndex, thisFurnace.fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRatio); + state, BlankString, furnace.CoolCoilNum, furnace.fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRatio); } } - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatCool) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatCool) { if ((QZnReq > HVAC::SmallLoad) && state.dataFurnaces->HeatingLoad) { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10269,8 +9156,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.HeatCoilNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10282,13 +9169,13 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.HeatingCoilIndex).PartLoadRatio; + state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.HeatCoilNum).PartLoadRatio; } else { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10301,8 +9188,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.HeatCoilNum, + furnace.fanOp, compressorOp, 0.0, 1, @@ -10312,33 +9199,33 @@ namespace Furnaces { OnOffAirFlowRatio); } } - } else if (thisFurnace.CoolingCoilUpstream && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + } else if (furnace.CoolCoilUpstream && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { // simulate thisFurnace heating coil bool SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, furnace.fanOp, QCoilActual); } // Simulate supplemental heating coil for blow through fan - if (thisFurnace.SuppHeatCoilIndex > 0) { + if (furnace.SuppCoilNum > 0) { bool SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, SupHeaterLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, SupHeaterLoad, furnace.fanOp, QCoilActual); } } else { // otherwise simulate DX coils then fan then supplemental heater - if ((!thisFurnace.CoolingCoilUpstream) && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + if ((!furnace.CoolCoilUpstream) && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { // simulate thisFurnace heating coil bool SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, furnace.fanOp, QCoilActual); } if ((QZnReq < -HVAC::SmallLoad || (QLatReq < -HVAC::SmallLoad)) && - (state.dataEnvrn->OutDryBulbTemp >= thisFurnace.MinOATCompressorCooling)) { + (state.dataEnvrn->OutDryBulbTemp >= furnace.MinOATCompressorCooling)) { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10351,8 +9238,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.CoolCoilNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10365,13 +9252,13 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.CoolingCoilIndex).PartLoadRatio; + state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.CoolCoilNum).PartLoadRatio; } else { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10383,18 +9270,18 @@ namespace Furnaces { OnOffAirFlowRatio); } else { VariableSpeedCoils::SimVariableSpeedCoils( - state, BlankString, thisFurnace.CoolingCoilIndex, thisFurnace.fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRatio); + state, BlankString, furnace.CoolCoilNum, furnace.fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRatio); } } - if (thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatCool) { - if (QZnReq > HVAC::SmallLoad && (state.dataEnvrn->OutDryBulbTemp >= thisFurnace.MinOATCompressorCooling)) { + if (furnace.type != HVAC::UnitarySysType::Unitary_HeatCool) { + if (QZnReq > HVAC::SmallLoad && (state.dataEnvrn->OutDryBulbTemp >= furnace.MinOATCompressorCooling)) { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10407,8 +9294,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.HeatCoilNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10420,13 +9307,13 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(thisFurnace.HeatingCoilIndex).PartLoadRatio; + state.dataFurnaces->SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.HeatCoilNum).PartLoadRatio; } else { - if (thisFurnace.bIsIHP) { + if (furnace.isIHP) { IntegratedHeatPump::SimIHP(state, BlankString, - thisFurnace.CoolingCoilIndex, - thisFurnace.fanOp, + furnace.ihpNum, + furnace.fanOp, compressorOp, PartLoadFrac, SpeedNum, @@ -10439,8 +9326,8 @@ namespace Furnaces { } else { VariableSpeedCoils::SimVariableSpeedCoils(state, BlankString, - thisFurnace.HeatingCoilIndex, - thisFurnace.fanOp, + furnace.HeatCoilNum, + furnace.fanOp, compressorOp, 0.0, 1, @@ -10450,32 +9337,32 @@ namespace Furnaces { OnOffAirFlowRatio); } } - } else if (thisFurnace.CoolingCoilUpstream && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + } else if (furnace.CoolCoilUpstream && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { // simulate thisFurnace heating coil bool SuppHeatingCoilFlag = false; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, HeatCoilLoad, furnace.fanOp, QCoilActual); } - state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); + state.dataFans->fans(furnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); // Simulate supplemental heating coil for draw through fan - if (thisFurnace.SuppHeatCoilIndex > 0) { + if (furnace.SuppCoilNum > 0) { bool SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil - CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, SupHeaterLoad, thisFurnace.fanOp, QCoilActual); + CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, SupHeaterLoad, furnace.fanOp, QCoilActual); } } // If the fan runs continually do not allow coils to set OnOffFanPartLoadRatio. - if (thisFurnace.fanOp == HVAC::FanOp::Continuous) state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; + if (furnace.fanOp == HVAC::FanOp::Continuous) state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; - auto &outNode = state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum); - auto &zoneNode = state.dataLoopNodes->Node(thisFurnace.NodeNumOfControlledZone); + auto &outNode = state.dataLoopNodes->Node(furnace.FurnaceOutletNode); + auto &zoneNode = state.dataLoopNodes->Node(furnace.NodeNumOfControlledZone); Real64 zoneEnthalpy = Psychrometrics::PsyHFnTdbW(zoneNode.Temp, zoneNode.HumRat); Real64 outletEnthalpy = Psychrometrics::PsyHFnTdbW(outNode.Temp, outNode.HumRat); Real64 totalLoadMet = AirMassFlow * (outletEnthalpy - zoneEnthalpy); SensibleLoadMet = AirMassFlow * Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(outNode.Temp, outNode.HumRat, zoneNode.Temp, zoneNode.HumRat); // sensible {W}; LatentLoadMet = totalLoadMet - SensibleLoadMet; - thisFurnace.LatentLoadMet = LatentLoadMet; + furnace.LatentLoadMet = LatentLoadMet; } //****************************************************************************** @@ -10641,28 +9528,28 @@ namespace Furnaces { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 AverageUnitMassFlow; // average supply air mass flow rate over time step - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); state.dataHVACGlobal->MSHPMassFlowRateLow = 0.0; // Mass flow rate at low speed state.dataHVACGlobal->MSHPMassFlowRateHigh = 0.0; // Mass flow rate at high speed - if (thisFurnace.fanOp == HVAC::FanOp::Continuous) { - state.dataFurnaces->CompOffMassFlow = thisFurnace.IdleMassFlowRate; - state.dataFurnaces->CompOffFlowRatio = thisFurnace.IdleSpeedRatio; + if (furnace.fanOp == HVAC::FanOp::Continuous) { + state.dataFurnaces->CompOffMassFlow = furnace.IdleMassFlowRate; + state.dataFurnaces->CompOffFlowRatio = furnace.IdleSpeedRatio; } else { state.dataFurnaces->CompOffMassFlow = 0.0; state.dataFurnaces->CompOffFlowRatio = 0.0; } - if (state.dataFurnaces->CoolingLoad && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { - if (thisFurnace.NumOfSpeedCooling > 0) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.CoolMassFlowRate(thisFurnace.NumOfSpeedCooling); - state.dataFurnaces->CompOnFlowRatio = thisFurnace.MSCoolingSpeedRatio(thisFurnace.NumOfSpeedCooling); - state.dataHVACGlobal->MSHPMassFlowRateLow = thisFurnace.CoolMassFlowRate(thisFurnace.NumOfSpeedCooling); - state.dataHVACGlobal->MSHPMassFlowRateHigh = thisFurnace.CoolMassFlowRate(thisFurnace.NumOfSpeedCooling); + if (state.dataFurnaces->CoolingLoad && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + if (furnace.NumOfSpeedCooling > 0) { + state.dataFurnaces->CompOnMassFlow = furnace.CoolMassFlowRate(furnace.NumOfSpeedCooling); + state.dataFurnaces->CompOnFlowRatio = furnace.MSCoolingSpeedRatio(furnace.NumOfSpeedCooling); + state.dataHVACGlobal->MSHPMassFlowRateLow = furnace.CoolMassFlowRate(furnace.NumOfSpeedCooling); + state.dataHVACGlobal->MSHPMassFlowRateHigh = furnace.CoolMassFlowRate(furnace.NumOfSpeedCooling); } else { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxCoolAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.CoolingSpeedRatio; + state.dataFurnaces->CompOnMassFlow = furnace.MaxCoolAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.CoolingSpeedRatio; } AverageUnitMassFlow = (PartLoadRatio * state.dataFurnaces->CompOnMassFlow) + ((1 - PartLoadRatio) * state.dataFurnaces->CompOffMassFlow); if (state.dataFurnaces->CompOffFlowRatio > 0.0) { @@ -10671,15 +9558,15 @@ namespace Furnaces { } else { state.dataFurnaces->FanSpeedRatio = state.dataFurnaces->CompOnFlowRatio; } - } else if (state.dataFurnaces->HeatingLoad && (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { - if (thisFurnace.NumOfSpeedHeating > 0) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.HeatMassFlowRate(thisFurnace.NumOfSpeedHeating); - state.dataFurnaces->CompOnFlowRatio = thisFurnace.MSHeatingSpeedRatio(thisFurnace.NumOfSpeedHeating); - state.dataHVACGlobal->MSHPMassFlowRateLow = thisFurnace.HeatMassFlowRate(thisFurnace.NumOfSpeedHeating); - state.dataHVACGlobal->MSHPMassFlowRateHigh = thisFurnace.HeatMassFlowRate(thisFurnace.NumOfSpeedHeating); + } else if (state.dataFurnaces->HeatingLoad && (furnace.type == HVAC::UnitarySysType::Unitary_HeatCool)) { + if (furnace.NumOfSpeedHeating > 0) { + state.dataFurnaces->CompOnMassFlow = furnace.HeatMassFlowRate(furnace.NumOfSpeedHeating); + state.dataFurnaces->CompOnFlowRatio = furnace.MSHeatingSpeedRatio(furnace.NumOfSpeedHeating); + state.dataHVACGlobal->MSHPMassFlowRateLow = furnace.HeatMassFlowRate(furnace.NumOfSpeedHeating); + state.dataHVACGlobal->MSHPMassFlowRateHigh = furnace.HeatMassFlowRate(furnace.NumOfSpeedHeating); } else { - state.dataFurnaces->CompOnMassFlow = thisFurnace.MaxHeatAirMassFlow; - state.dataFurnaces->CompOnFlowRatio = thisFurnace.HeatingSpeedRatio; + state.dataFurnaces->CompOnMassFlow = furnace.MaxHeatAirMassFlow; + state.dataFurnaces->CompOnFlowRatio = furnace.HeatingSpeedRatio; } AverageUnitMassFlow = (PartLoadRatio * state.dataFurnaces->CompOnMassFlow) + ((1 - PartLoadRatio) * state.dataFurnaces->CompOffMassFlow); if (state.dataFurnaces->CompOffFlowRatio > 0.0) { @@ -10688,31 +9575,31 @@ namespace Furnaces { } else { state.dataFurnaces->FanSpeedRatio = state.dataFurnaces->CompOnFlowRatio; } - } else if (thisFurnace.bIsIHP) { - if (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(thisFurnace.ControlZoneNum) && present(SpeedNum)) { + } else if (furnace.isIHP) { + if (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(furnace.ControlZoneNum) && present(SpeedNum)) { // if(present(SpeedNum)) { state.dataFurnaces->CompOnMassFlow = - IntegratedHeatPump::GetAirMassFlowRateIHP(state, thisFurnace.CoolingCoilIndex, SpeedNum, SpeedRatio, false); + IntegratedHeatPump::GetAirMassFlowRateIHP(state, furnace.ihpNum, SpeedNum, SpeedRatio, false); state.dataFurnaces->CompOnFlowRatio = state.dataFurnaces->CompOnMassFlow / IntegratedHeatPump::GetAirMassFlowRateIHP( - state, thisFurnace.CoolingCoilIndex, IntegratedHeatPump::GetMaxSpeedNumIHP(state, thisFurnace.CoolingCoilIndex), 1.0, false); + state, furnace.ihpNum, IntegratedHeatPump::GetMaxSpeedNumIHP(state, furnace.ihpNum), 1.0, false); state.dataHVACGlobal->MSHPMassFlowRateLow = - IntegratedHeatPump::GetAirMassFlowRateIHP(state, thisFurnace.CoolingCoilIndex, SpeedNum, 0.0, false); + IntegratedHeatPump::GetAirMassFlowRateIHP(state, furnace.ihpNum, SpeedNum, 0.0, false); state.dataHVACGlobal->MSHPMassFlowRateHigh = - IntegratedHeatPump::GetAirMassFlowRateIHP(state, thisFurnace.CoolingCoilIndex, SpeedNum, 1.0, false); + IntegratedHeatPump::GetAirMassFlowRateIHP(state, furnace.ihpNum, SpeedNum, 1.0, false); } // Set up fan flow rate during compressor off time - if (thisFurnace.fanOp == HVAC::FanOp::Continuous && present(SpeedNum)) { - if (thisFurnace.AirFlowControl == AirFlowControlConstFan::UseCompressorOnFlow && state.dataFurnaces->CompOnMassFlow > 0.0) { + if (furnace.fanOp == HVAC::FanOp::Continuous && present(SpeedNum)) { + if (furnace.AirFlowControl == AirFlowControlConstFan::UseCompressorOnFlow && state.dataFurnaces->CompOnMassFlow > 0.0) { state.dataFurnaces->CompOffMassFlow = - IntegratedHeatPump::GetAirMassFlowRateIHP(state, thisFurnace.CoolingCoilIndex, SpeedNum, 1.0, false); + IntegratedHeatPump::GetAirMassFlowRateIHP(state, furnace.ihpNum, SpeedNum, 1.0, false); state.dataFurnaces->CompOffFlowRatio = state.dataFurnaces->CompOffMassFlow / IntegratedHeatPump::GetAirMassFlowRateIHP(state, - thisFurnace.CoolingCoilIndex, - IntegratedHeatPump::GetMaxSpeedNumIHP(state, thisFurnace.CoolingCoilIndex), + furnace.ihpNum, + IntegratedHeatPump::GetMaxSpeedNumIHP(state, furnace.ihpNum), 1.0, false); } @@ -10744,56 +9631,56 @@ namespace Furnaces { } if (IntegratedHeatPump::IHPOperationMode::SCWHMatchWH == - state.dataIntegratedHP->IntegratedHeatPumps(thisFurnace.CoolingCoilIndex).CurMode) { + state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).CurMode) { state.dataFurnaces->CompOnMassFlow = - IntegratedHeatPump::GetAirMassFlowRateIHP(state, thisFurnace.CoolingCoilIndex, SpeedNum, SpeedRatio, false); + IntegratedHeatPump::GetAirMassFlowRateIHP(state, furnace.ihpNum, SpeedNum, SpeedRatio, false); AverageUnitMassFlow = state.dataFurnaces->CompOnMassFlow; } } else { - if (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(thisFurnace.ControlZoneNum) && present(SpeedNum)) { - if (thisFurnace.HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) { + if (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(furnace.ControlZoneNum) && present(SpeedNum)) { + if (furnace.HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) { if (SpeedNum == 1) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.HeatMassFlowRate(SpeedNum); - state.dataFurnaces->CompOnFlowRatio = thisFurnace.MSHeatingSpeedRatio(SpeedNum); - state.dataHVACGlobal->MSHPMassFlowRateLow = thisFurnace.HeatMassFlowRate(1); - state.dataHVACGlobal->MSHPMassFlowRateHigh = thisFurnace.HeatMassFlowRate(1); + state.dataFurnaces->CompOnMassFlow = furnace.HeatMassFlowRate(SpeedNum); + state.dataFurnaces->CompOnFlowRatio = furnace.MSHeatingSpeedRatio(SpeedNum); + state.dataHVACGlobal->MSHPMassFlowRateLow = furnace.HeatMassFlowRate(1); + state.dataHVACGlobal->MSHPMassFlowRateHigh = furnace.HeatMassFlowRate(1); } else if (SpeedNum > 1) { state.dataFurnaces->CompOnMassFlow = - SpeedRatio * thisFurnace.HeatMassFlowRate(SpeedNum) + (1.0 - SpeedRatio) * thisFurnace.HeatMassFlowRate(SpeedNum - 1); - state.dataFurnaces->CompOnFlowRatio = SpeedRatio * thisFurnace.MSHeatingSpeedRatio(SpeedNum) + - (1.0 - SpeedRatio) * thisFurnace.MSHeatingSpeedRatio(SpeedNum - 1); - state.dataHVACGlobal->MSHPMassFlowRateLow = thisFurnace.HeatMassFlowRate(SpeedNum - 1); - state.dataHVACGlobal->MSHPMassFlowRateHigh = thisFurnace.HeatMassFlowRate(SpeedNum); + SpeedRatio * furnace.HeatMassFlowRate(SpeedNum) + (1.0 - SpeedRatio) * furnace.HeatMassFlowRate(SpeedNum - 1); + state.dataFurnaces->CompOnFlowRatio = SpeedRatio * furnace.MSHeatingSpeedRatio(SpeedNum) + + (1.0 - SpeedRatio) * furnace.MSHeatingSpeedRatio(SpeedNum - 1); + state.dataHVACGlobal->MSHPMassFlowRateLow = furnace.HeatMassFlowRate(SpeedNum - 1); + state.dataHVACGlobal->MSHPMassFlowRateHigh = furnace.HeatMassFlowRate(SpeedNum); } - } else if (thisFurnace.HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) { + } else if (furnace.HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) { if (SpeedNum == 1) { - state.dataFurnaces->CompOnMassFlow = thisFurnace.CoolMassFlowRate(SpeedNum); - state.dataFurnaces->CompOnFlowRatio = thisFurnace.MSCoolingSpeedRatio(SpeedNum); - state.dataHVACGlobal->MSHPMassFlowRateLow = thisFurnace.CoolMassFlowRate(1); - state.dataHVACGlobal->MSHPMassFlowRateHigh = thisFurnace.CoolMassFlowRate(1); + state.dataFurnaces->CompOnMassFlow = furnace.CoolMassFlowRate(SpeedNum); + state.dataFurnaces->CompOnFlowRatio = furnace.MSCoolingSpeedRatio(SpeedNum); + state.dataHVACGlobal->MSHPMassFlowRateLow = furnace.CoolMassFlowRate(1); + state.dataHVACGlobal->MSHPMassFlowRateHigh = furnace.CoolMassFlowRate(1); } else if (SpeedNum > 1) { state.dataFurnaces->CompOnMassFlow = - SpeedRatio * thisFurnace.CoolMassFlowRate(SpeedNum) + (1.0 - SpeedRatio) * thisFurnace.CoolMassFlowRate(SpeedNum - 1); - state.dataFurnaces->CompOnFlowRatio = SpeedRatio * thisFurnace.MSCoolingSpeedRatio(SpeedNum) + - (1.0 - SpeedRatio) * thisFurnace.MSCoolingSpeedRatio(SpeedNum - 1); - state.dataHVACGlobal->MSHPMassFlowRateLow = thisFurnace.CoolMassFlowRate(SpeedNum - 1); - state.dataHVACGlobal->MSHPMassFlowRateHigh = thisFurnace.CoolMassFlowRate(SpeedNum); + SpeedRatio * furnace.CoolMassFlowRate(SpeedNum) + (1.0 - SpeedRatio) * furnace.CoolMassFlowRate(SpeedNum - 1); + state.dataFurnaces->CompOnFlowRatio = SpeedRatio * furnace.MSCoolingSpeedRatio(SpeedNum) + + (1.0 - SpeedRatio) * furnace.MSCoolingSpeedRatio(SpeedNum - 1); + state.dataHVACGlobal->MSHPMassFlowRateLow = furnace.CoolMassFlowRate(SpeedNum - 1); + state.dataHVACGlobal->MSHPMassFlowRateHigh = furnace.CoolMassFlowRate(SpeedNum); } } } // Set up fan flow rate during compressor off time - if (thisFurnace.fanOp == HVAC::FanOp::Continuous && present(SpeedNum)) { - if (thisFurnace.AirFlowControl == AirFlowControlConstFan::UseCompressorOnFlow && state.dataFurnaces->CompOnMassFlow > 0.0) { + if (furnace.fanOp == HVAC::FanOp::Continuous && present(SpeedNum)) { + if (furnace.AirFlowControl == AirFlowControlConstFan::UseCompressorOnFlow && state.dataFurnaces->CompOnMassFlow > 0.0) { if (SpeedNum == 1) { // LOWEST SPEED USE IDLE FLOW - state.dataFurnaces->CompOffMassFlow = thisFurnace.IdleMassFlowRate; - state.dataFurnaces->CompOffFlowRatio = thisFurnace.IdleSpeedRatio; - } else if (thisFurnace.LastMode == Furnaces::ModeOfOperation::HeatingMode) { - state.dataFurnaces->CompOffMassFlow = thisFurnace.HeatMassFlowRate(SpeedNum); - state.dataFurnaces->CompOffFlowRatio = thisFurnace.MSHeatingSpeedRatio(SpeedNum); + state.dataFurnaces->CompOffMassFlow = furnace.IdleMassFlowRate; + state.dataFurnaces->CompOffFlowRatio = furnace.IdleSpeedRatio; + } else if (furnace.LastMode == Furnaces::ModeOfOperation::HeatingMode) { + state.dataFurnaces->CompOffMassFlow = furnace.HeatMassFlowRate(SpeedNum); + state.dataFurnaces->CompOffFlowRatio = furnace.MSHeatingSpeedRatio(SpeedNum); } else { - state.dataFurnaces->CompOffMassFlow = thisFurnace.CoolMassFlowRate(SpeedNum); - state.dataFurnaces->CompOffFlowRatio = thisFurnace.MSCoolingSpeedRatio(SpeedNum); + state.dataFurnaces->CompOffMassFlow = furnace.CoolMassFlowRate(SpeedNum); + state.dataFurnaces->CompOffFlowRatio = furnace.MSCoolingSpeedRatio(SpeedNum); } } } @@ -10824,13 +9711,13 @@ namespace Furnaces { } } - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) == 0.0) || state.dataHVACGlobal->TurnFansOff || - (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.FanAvailSchedPtr) == 0.0 && !state.dataHVACGlobal->TurnFansOn)) { - state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum).MassFlowRate = 0.0; + if ((ScheduleManager::GetCurrentScheduleValue(state, furnace.SchedPtr) == 0.0) || state.dataHVACGlobal->TurnFansOff || + (ScheduleManager::GetCurrentScheduleValue(state, furnace.FanAvailSchedPtr) == 0.0 && !state.dataHVACGlobal->TurnFansOn)) { + state.dataLoopNodes->Node(furnace.FurnaceInletNode).MassFlowRate = 0.0; OnOffAirFlowRatio = 0.0; } else { - state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum).MassFlowRate = AverageUnitMassFlow; - state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum).MassFlowRateMaxAvail = AverageUnitMassFlow; + state.dataLoopNodes->Node(furnace.FurnaceInletNode).MassFlowRate = AverageUnitMassFlow; + state.dataLoopNodes->Node(furnace.FurnaceInletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; if (AverageUnitMassFlow > 0.0) { OnOffAirFlowRatio = state.dataFurnaces->CompOnMassFlow / AverageUnitMassFlow; } else { @@ -10838,8 +9725,8 @@ namespace Furnaces { } } - state.dataLoopNodes->Node(thisFurnace.FurnaceOutletNodeNum).MassFlowRate = - state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum).MassFlowRate; + state.dataLoopNodes->Node(furnace.FurnaceOutletNode).MassFlowRate = + state.dataLoopNodes->Node(furnace.FurnaceInletNode).MassFlowRate; } void SetMinOATCompressor(EnergyPlusData &state, @@ -10849,52 +9736,36 @@ namespace Furnaces { ) { bool errFlag = false; - auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); + auto &furnace = state.dataFurnaces->Furnaces(FurnaceNum); // Set minimum OAT for heat pump compressor operation in heating mode - if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { - thisFurnace.MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, thisFurnace.CoolingCoilIndex, errFlag); - } else if (thisFurnace.CoolingCoilType_Num == HVAC::CoilDX_CoolingHXAssisted) { - std::string ChildCoolingCoilType = state.dataHVACAssistedCC->HXAssistedCoil(thisFurnace.CoolingCoilIndex).CoolingCoilType; - std::string ChildCoolingCoilName = state.dataHVACAssistedCC->HXAssistedCoil(thisFurnace.CoolingCoilIndex).CoolingCoilName; - - if (Util::SameString(ChildCoolingCoilType, "COIL:COOLING:DX")) { - int childCCIndex_DX = CoilCoolingDX::factory(state, ChildCoolingCoilName); - if (childCCIndex_DX < 0) { - ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisFurnace.Name)); - errFlag = true; - ErrorsFound = true; - } - auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex_DX]; - thisFurnace.MinOATCompressorCooling = newCoil.performance.minOutdoorDrybulb; - } else if (Util::SameString(ChildCoolingCoilType, "Coil:Cooling:DX:VariableSpeed")) { - int childCCIndex_VS = state.dataHVACAssistedCC->HXAssistedCoil(thisFurnace.CoolingCoilIndex).CoolingCoilIndex; - thisFurnace.MinOATCompressorCooling = VariableSpeedCoils::GetVSCoilMinOATCompressor(state, childCCIndex_VS, errFlag); - } else { // Single speed - int childCCIndex_SP = state.dataHVACAssistedCC->HXAssistedCoil(thisFurnace.CoolingCoilIndex).CoolingCoilIndex; - thisFurnace.MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, childCCIndex_SP, errFlag); - } - } else if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - thisFurnace.MinOATCompressorCooling = VariableSpeedCoils::GetVSCoilMinOATCompressor(state, thisFurnace.CoolingCoilIndex, errFlag); + // If this is an HXAssistedCoil then CoolCoilNum is already the index of the embedded coil + if (furnace.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + furnace.MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, furnace.CoolCoilNum); + } else if (furnace.coolCoilType == HVAC::CoilType::DXCooling) { + auto const &dxCoil = state.dataCoilCoolingDX->coilCoolingDXs[furnace.CoolCoilNum]; + furnace.MinOATCompressorCooling = dxCoil.performance.minOutdoorDrybulb; + } else if (furnace.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + furnace.MinOATCompressorCooling = VariableSpeedCoils::GetVSCoilMinOATCompressor(state, furnace.CoolCoilNum); } else { - thisFurnace.MinOATCompressorCooling = -1000.0; + furnace.MinOATCompressorCooling = -1000.0; } if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", cCurrentModuleObject, thisFurnace.Name)); + ShowContinueError(state, format("...occurs in {} = {}", cCurrentModuleObject, furnace.Name)); ErrorsFound = true; } // Set minimum OAT for heat pump compressor operation in heating mode errFlag = false; - if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { - thisFurnace.MinOATCompressorHeating = VariableSpeedCoils::GetVSCoilMinOATCompressor(state, thisFurnace.HeatingCoilIndex, errFlag); - } else if (thisFurnace.HeatingCoilType_Num == HVAC::CoilDX_HeatingEmpirical) { - thisFurnace.MinOATCompressorHeating = DXCoils::GetMinOATCompressor(state, thisFurnace.HeatingCoilIndex, errFlag); + if (furnace.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + furnace.MinOATCompressorHeating = VariableSpeedCoils::GetVSCoilMinOATCompressor(state, furnace.HeatCoilNum); + } else if (furnace.heatCoilType == HVAC::CoilType::DXHeatingEmpirical) { + furnace.MinOATCompressorHeating = DXCoils::GetMinOATCompressor(state, furnace.HeatCoilNum); } else { - thisFurnace.MinOATCompressorHeating = -1000.0; + furnace.MinOATCompressorHeating = -1000.0; } if (errFlag) { - ShowContinueError(state, format("...occurs in {} = {}", cCurrentModuleObject, thisFurnace.Name)); + ShowContinueError(state, format("...occurs in {} = {}", cCurrentModuleObject, furnace.Name)); ErrorsFound = true; } } diff --git a/src/EnergyPlus/Furnaces.hh b/src/EnergyPlus/Furnaces.hh index 22da3bbe784..5178ce5263d 100644 --- a/src/EnergyPlus/Furnaces.hh +++ b/src/EnergyPlus/Furnaces.hh @@ -117,35 +117,50 @@ namespace Furnaces { int ControlZoneNum; // Index to controlled zone int ZoneSequenceCoolingNum; // Index to cooling sequence/priority for this zone int ZoneSequenceHeatingNum; // Index to heating sequence/priority for this zone - int CoolingCoilType_Num; // Numeric Equivalent for Cooling Coil Type - int CoolingCoilIndex; // Index to cooling coil + + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; // Numeric Equivalent for Cooling Coil Type + std::string CoolCoilName; + int CoolCoilNum = 0; // Index to cooling coil + int CoolCoilAirInletNode = 0; // air inlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly + int CoolCoilAirOutletNode = 0; // air outlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly int ActualDXCoilIndexForHXAssisted; // Index to DX cooling coil when HX assisted - bool CoolingCoilUpstream; // Indicates if cooling coil is upstream of heating coil - int HeatingCoilType_Num; // Numeric Equivalent for Heating Coil Type - int HeatingCoilIndex; // Index to heating coil - int ReheatingCoilType_Num; // Numeric Equivalent for Reheat Coil Type - int ReheatingCoilIndex; // Index to reheat coil - std::string HeatingCoilName; // name of heating coil - std::string HeatingCoilType; // type of heating coil - int CoilControlNode; // control node for hot water and steam heating coils - int HWCoilAirInletNode; // air inlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly - int HWCoilAirOutletNode; // air outlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly - int SuppCoilAirInletNode; // air inlet node number of HW coil for HeatCool Reheat Coil - int SuppCoilAirOutletNode; // air outlet node number of HW coil for HeatCool Reheat Coil - int SuppHeatCoilType_Num; // Numeric Equivalent for Supplemental Heat Coil Type - int SuppHeatCoilIndex; // Index to supplemental heater - int SuppCoilControlNode; // control node for steam and hot water heating coil - std::string SuppHeatCoilName; // name of supplemental heating coil - std::string SuppHeatCoilType; // type of supplemental heating coil + bool CoolCoilUpstream = true; // Indicates if cooling coil is upstream of heating coil + + // If the cooling coil is HXAssisted, these correspond to the enclosing HXAssisted coil object + HVAC::CoilType hxCoolCoilType = HVAC::CoilType::Invalid; + std::string hxCoolCoilName; + int hxCoolCoilNum = 0; + + HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; // Numeric Equivalent for Heating Coil Type + std::string HeatCoilName; // name of heating coil + int HeatCoilNum = 0; // Index to heating coil + int HeatCoilControlNode = 0; // control node for hot water and steam heating coils + int HeatCoilAirInletNode = 0; // air inlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly + int HeatCoilAirOutletNode = 0; // air outlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly + int HeatCoilPLFCurveIndex = 0; + + HVAC::CoilType suppHeatCoilType = HVAC::CoilType::Invalid; // Numeric Equivalent for Supplemental Heat Coil Type + std::string SuppCoilName; // name of supplemental heating coil + int SuppCoilNum = 0; // Index to supplemental heater + int SuppCoilControlNode = 0; // control node for steam and hot water heating coil + int SuppCoilAirInletNode = 0; // air inlet node number of HW coil for HeatCool Reheat Coil + int SuppCoilAirOutletNode = 0; // air outlet node number of HW coil for HeatCool Reheat Coil + + bool isIHP = false; + std::string ihpName; // Save IHP name and index + int ihpNum = 0; + HVAC::FanType fanType; // Integer equivalent of fan type (1=OnOff, 2 = ConstVolume) int FanIndex; // Index to fan object - int FurnaceInletNodeNum; // Furnace inlet node number - int FurnaceOutletNodeNum; // Furnace inlet node number + int FurnaceInletNode = 0; // Furnace inlet node number + int FurnaceOutletNode = 0; // Furnace inlet node number HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // operation mode: 1 = cycling fan, cycling coils // 2 = continuous fan, cycling coils Furnaces::ModeOfOperation LastMode; // last mode of operation, coolingmode or heatingmode AirFlowControlConstFan AirFlowControl; // fan control mode, UseCompressorOnFlow or UseCompressorOffFlow HVAC::FanPlace fanPlace; // fan placement; 1=blow through, 2=draw through + int FanInletNode = 0; + int FanOutletNode = 0; int NodeNumOfControlledZone; // Node number of controlled zone air node WAHPCoilType WatertoAirHPType = WAHPCoilType::Invalid; // Type of water to air heat pump model used Real64 CoolingConvergenceTolerance; // Convergence tolerance for cooling, @@ -238,7 +253,7 @@ namespace Furnaces { Array1D CoolMassFlowRate; // Supply air mass flow rate during cooling operation Array1D MSHeatingSpeedRatio; // Fan speed ratio in heating mode Array1D MSCoolingSpeedRatio; // Fan speed ratio in cooling mode - bool bIsIHP; + int CompSpeedNum; Real64 CompSpeedRatio; int ErrIndexCyc; @@ -256,10 +271,8 @@ namespace Furnaces { FurnaceEquipConditions() : FurnaceIndex(0), SchedPtr(0), FanSchedPtr(0), FanAvailSchedPtr(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), - ZoneSequenceHeatingNum(0), CoolingCoilType_Num(0), CoolingCoilIndex(0), ActualDXCoilIndexForHXAssisted(0), CoolingCoilUpstream(true), - HeatingCoilType_Num(0), HeatingCoilIndex(0), ReheatingCoilType_Num(0), ReheatingCoilIndex(0), CoilControlNode(0), HWCoilAirInletNode(0), - HWCoilAirOutletNode(0), SuppCoilAirInletNode(0), SuppCoilAirOutletNode(0), SuppHeatCoilType_Num(0), SuppHeatCoilIndex(0), - SuppCoilControlNode(0), fanType(HVAC::FanType::Invalid), FanIndex(0), FurnaceInletNodeNum(0), FurnaceOutletNodeNum(0), + ZoneSequenceHeatingNum(0), ActualDXCoilIndexForHXAssisted(0), + fanType(HVAC::FanType::Invalid), FanIndex(0), LastMode(Furnaces::ModeOfOperation::Invalid), AirFlowControl(AirFlowControlConstFan::Invalid), fanPlace(HVAC::FanPlace::Invalid), NodeNumOfControlledZone(0), CoolingConvergenceTolerance(0.0), HeatingConvergenceTolerance(0.0), DesignHeatingCapacity(0.0), DesignCoolingCapacity(0.0), CoolingCoilSensDemand(0.0), HeatingCoilSensDemand(0.0), CoolingCoilLatentDemand(0.0), @@ -282,7 +295,7 @@ namespace Furnaces { NumOfSpeedCooling(0), NumOfSpeedHeating(0), IdleSpeedRatio(0.0), IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), FanVolFlow(0.0), CheckFanFlow(true), HeatVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), HeatMassFlowRate(HVAC::MaxSpeedLevels, 0.0), CoolVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), CoolMassFlowRate(HVAC::MaxSpeedLevels, 0.0), - MSHeatingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), MSCoolingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), bIsIHP(false), CompSpeedNum(0), + MSHeatingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), MSCoolingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), CompSpeedNum(0), CompSpeedRatio(0.0), ErrIndexCyc(0), ErrIndexVar(0), iterationCounter(0), iterationMode(0), FirstPass(true) { } @@ -547,17 +560,15 @@ struct FurnacesData : BaseGlobalStruct bool EconomizerFlag = false; // holds air loop economizer status int AirLoopPass = 0; // Number of air loop pass bool HPDehumidificationLoadFlag = false; // true if there is dehumidification load (heat pumps only) - Real64 TempSteamIn = 100.0; // steam coil steam inlet temperature // starting add variables for variable speed water source heat pump Real64 SaveCompressorPLR = 0.0; // holds compressor PLR from active DX coil std::string CurrentModuleObject; // Object type for getting and error messages int Iter = 0; // Iteration counter for CalcNewZoneHeatOnlyFlowRates std::string HeatingCoilName; // name of heating coil - std::string HeatingCoilType; // type of heating coil // Object Data - Array1D Furnace; + Array1D Furnaces; Array1D_bool MyEnvrnFlag; // environment flag Array1D_bool MySecondOneTimeFlag; // additional one time flag @@ -606,13 +617,11 @@ struct FurnacesData : BaseGlobalStruct EconomizerFlag = false; AirLoopPass = 0; HPDehumidificationLoadFlag = false; - TempSteamIn = 100.0; SaveCompressorPLR = 0.0; CurrentModuleObject = ""; Iter = 0; HeatingCoilName.clear(); - HeatingCoilType.clear(); - Furnace.clear(); + Furnaces.clear(); MyEnvrnFlag.clear(); MySecondOneTimeFlag.clear(); diff --git a/src/EnergyPlus/GeneralRoutines.cc b/src/EnergyPlus/GeneralRoutines.cc index ba06dcd8548..3c515c7b19b 100644 --- a/src/EnergyPlus/GeneralRoutines.cc +++ b/src/EnergyPlus/GeneralRoutines.cc @@ -128,7 +128,7 @@ constexpr std::array(AirLoopHVACCompType::Num void ControlCompOutput(EnergyPlusData &state, std::string const &CompName, // the component Name - std::string const &CompType, // Type of component + std::string_view const CompType, // Type of component int &CompNum, // Index of component in component array bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step Real64 const QZnReq, // zone load to be met @@ -555,7 +555,7 @@ void ControlCompOutput(EnergyPlusData &state, ShowContinueError(state, format("... Actuated Node Mass Flow Rate ={:.9R} kg/s", state.dataLoopNodes->Node(ActuatedNode).MassFlowRate)); ShowContinueErrorTimeStamp(state, ""); ShowRecurringWarningErrorAtEnd(state, - "ControlCompOutput: Maximum iterations error for " + CompType + " = " + CompName, + format("ControlCompOutput: Maximum iterations error for {} = {}", CompType, CompName), CompErrIndex, std::abs((LoadMet - QZnReq) * 100.0 / Denom), std::abs((LoadMet - QZnReq) * 100.0 / Denom), @@ -564,7 +564,7 @@ void ControlCompOutput(EnergyPlusData &state, "%"); //} ShowRecurringWarningErrorAtEnd(state, - "ControlCompOutput: Maximum iterations error for " + CompType + " = " + CompName, + format("ControlCompOutput: Maximum iterations error for {} = {}", CompType, CompName), CompErrIndex, std::abs((LoadMet - QZnReq) * 100.0 / Denom), std::abs((LoadMet - QZnReq) * 100.0 / Denom), diff --git a/src/EnergyPlus/GeneralRoutines.hh b/src/EnergyPlus/GeneralRoutines.hh index bf2807f81f1..f10cddf31ac 100644 --- a/src/EnergyPlus/GeneralRoutines.hh +++ b/src/EnergyPlus/GeneralRoutines.hh @@ -123,7 +123,7 @@ struct ZoneEquipControllerProps void ControlCompOutput(EnergyPlusData &state, std::string const &CompName, // the component Name - std::string const &CompType, // Type of component + std::string_view const compType, // Type of component int &CompNum, // Index of component in component array bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step Real64 const QZnReq, // zone load to be met diff --git a/src/EnergyPlus/HVACDXHeatPumpSystem.cc b/src/EnergyPlus/HVACDXHeatPumpSystem.cc index 71e360a9bbe..0e6fa7e1ce1 100644 --- a/src/EnergyPlus/HVACDXHeatPumpSystem.cc +++ b/src/EnergyPlus/HVACDXHeatPumpSystem.cc @@ -180,8 +180,8 @@ namespace HVACDXHeatPumpSystem { // simulate DX Heating System CompName = DXHeatPumpSystem(DXSystemNum).HeatPumpCoilName; - switch (DXHeatPumpSystem(DXSystemNum).HeatPumpCoilType_Num) { - case HVAC::CoilDX_HeatingEmpirical: { // COIL:DX:COOLINGBYPASSFACTOREMPIRICAL + switch (DXHeatPumpSystem(DXSystemNum).heatPumpCoilType) { + case HVAC::CoilType::DXHeatingEmpirical: { // COIL:DX:COOLINGBYPASSFACTOREMPIRICAL SimDXCoil(state, CompName, HVAC::CompressorOp::On, @@ -190,7 +190,7 @@ namespace HVACDXHeatPumpSystem { DXHeatPumpSystem(DXSystemNum).fanOp, DXHeatPumpSystem(DXSystemNum).PartLoadFrac); } break; - case HVAC::Coil_HeatingAirToAirVariableSpeed: { // Coil:Heating:DX:VariableSpeed + case HVAC::CoilType::HeatingAirToAirVariableSpeed: { // Coil:Heating:DX:VariableSpeed SimVariableSpeedCoils(state, CompName, DXHeatPumpSystem(DXSystemNum).HeatPumpCoilIndex, @@ -204,7 +204,7 @@ namespace HVACDXHeatPumpSystem { state.dataHVACDXHeatPumpSys->OnOffAirFlowRatio); } break; default: { - ShowFatalError(state, format("SimDXCoolingSystem: Invalid DX Heating System/Coil={}", DXHeatPumpSystem(DXSystemNum).HeatPumpCoilType)); + ShowFatalError(state, format("SimDXCoolingSystem: Invalid DX Heating System/Coil={}", HVAC::coilTypeNames[(int)DXHeatPumpSystem(DXSystemNum).heatPumpCoilType])); } break; } // set econo lockout flag @@ -262,6 +262,7 @@ namespace HVACDXHeatPumpSystem { int NumNums; int IOStat; static constexpr std::string_view RoutineName("GetDXHeatPumpSystemInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetDXHeatPumpSystemInput"; bool IsNotOK; // Flag to verify name int DXHeatSysNum; std::string CurrentModuleObject; // for ease in getting objects @@ -272,14 +273,14 @@ namespace HVACDXHeatPumpSystem { Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. - auto &DXHeatPumpSystem(state.dataHVACDXHeatPumpSys->DXHeatPumpSystem); + bool ErrorsFound = false; CurrentModuleObject = "CoilSystem:Heating:DX"; // Update Num in state and make local convenience copy int NumDXHeatPumpSystems = state.dataHVACDXHeatPumpSys->NumDXHeatPumpSystems = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - DXHeatPumpSystem.allocate(NumDXHeatPumpSystems); + state.dataHVACDXHeatPumpSys->DXHeatPumpSystem.allocate(NumDXHeatPumpSystems); state.dataHVACDXHeatPumpSys->CheckEquipName.dimension(NumDXHeatPumpSystems, true); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( @@ -307,13 +308,17 @@ namespace HVACDXHeatPumpSystem { lAlphaBlanks, cAlphaFields, cNumericFields); - DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpSystemType = CurrentModuleObject; // push Object Name into data array - DXHeatPumpSystem(DXHeatSysNum).Name = Alphas(1); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + auto &dxhp = state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(DXHeatSysNum); + dxhp.DXHeatPumpSystemType = CurrentModuleObject; // push Object Name into data array + dxhp.Name = Alphas(1); if (lAlphaBlanks(2)) { - DXHeatPumpSystem(DXHeatSysNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + dxhp.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - DXHeatPumpSystem(DXHeatSysNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (DXHeatPumpSystem(DXHeatSysNum).SchedPtr == 0) { + dxhp.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (dxhp.SchedPtr == 0) { ShowSevereError(state, format("{}{}: invalid {} entered ={} for {}={}", RoutineName, @@ -322,102 +327,78 @@ namespace HVACDXHeatPumpSystem { Alphas(2), cAlphaFields(1), Alphas(1))); - state.dataHVACDXHeatPumpSys->ErrorsFound = true; + ErrorsFound = true; } } - if (Util::SameString(Alphas(3), "Coil:Heating:DX:SingleSpeed")) { - - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType = Alphas(3); - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType_Num = HVAC::CoilDX_HeatingEmpirical; - - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName = Alphas(4); - } else if (Util::SameString(Alphas(3), "Coil:Heating:DX:VariableSpeed")) { - - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType = Alphas(3); - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType_Num = HVAC::Coil_HeatingAirToAirVariableSpeed; - - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName = Alphas(4); - - } else { - ShowSevereError(state, format("Invalid entry for {} :{}", cAlphaFields(3), Alphas(3))); - ShowContinueError(state, format("In {}=\"{}\".", CurrentModuleObject, DXHeatPumpSystem(DXHeatSysNum).Name)); - state.dataHVACDXHeatPumpSys->ErrorsFound = true; - } + dxhp.heatPumpCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(3))); + dxhp.HeatPumpCoilName = Alphas(4); + + if (dxhp.heatPumpCoilType == HVAC::CoilType::DXHeatingEmpirical) { + dxhp.HeatPumpCoilIndex = DXCoils::GetDXCoilIndex(state, dxhp.HeatPumpCoilName); + if (dxhp.HeatPumpCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); + ErrorsFound = true; + } else { + dxhp.DXHeatPumpCoilInletNodeNum = GetCoilInletNode(state, dxhp.HeatPumpCoilIndex); + dxhp.DXHeatPumpCoilOutletNodeNum = GetCoilOutletNode(state, dxhp.HeatPumpCoilIndex); + } - if (DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType_Num == HVAC::Coil_HeatingAirToAirVariableSpeed) { - DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilInletNodeNum = - GetCoilInletNodeVariableSpeed(state, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName, - state.dataHVACDXHeatPumpSys->ErrorsFound); - DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilOutletNodeNum = - GetCoilOutletNodeVariableSpeed(state, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName, - state.dataHVACDXHeatPumpSys->ErrorsFound); + } else if (dxhp.heatPumpCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + dxhp.HeatPumpCoilIndex = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, dxhp.HeatPumpCoilName); + if (dxhp.HeatPumpCoilIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); + ErrorsFound = true; + } else { + dxhp.DXHeatPumpCoilInletNodeNum = GetCoilInletNodeVariableSpeed(state, dxhp.HeatPumpCoilIndex); + dxhp.DXHeatPumpCoilOutletNodeNum = GetCoilOutletNodeVariableSpeed(state, dxhp.HeatPumpCoilIndex); + } } else { - DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilInletNodeNum = GetCoilInletNode(state, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName, - state.dataHVACDXHeatPumpSys->ErrorsFound); - - DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilOutletNodeNum = GetCoilOutletNode(state, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName, - state.dataHVACDXHeatPumpSys->ErrorsFound); + ShowSevereInvalidKey(state, eoh, cAlphaFields(3), Alphas(3)); + ErrorsFound = true; // Why is this a state variable? } // Coil air-side outlet node is the control node - DXHeatPumpSystem(DXHeatSysNum).DXSystemControlNodeNum = DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilOutletNodeNum; + dxhp.DXSystemControlNodeNum = dxhp.DXHeatPumpCoilOutletNodeNum; TestCompSet(state, CurrentModuleObject, - DXHeatPumpSystem(DXHeatSysNum).Name, - state.dataLoopNodes->NodeID(DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilInletNodeNum), - state.dataLoopNodes->NodeID(DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilOutletNodeNum), + dxhp.Name, + state.dataLoopNodes->NodeID(dxhp.DXHeatPumpCoilInletNodeNum), + state.dataLoopNodes->NodeID(dxhp.DXHeatPumpCoilOutletNodeNum), "Air Nodes"); - ValidateComponent(state, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName, - IsNotOK, - CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("In {} = \"{}\".", CurrentModuleObject, DXHeatPumpSystem(DXHeatSysNum).Name)); - state.dataHVACDXHeatPumpSys->ErrorsFound = true; - } - SetUpCompSets(state, - DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpSystemType, - DXHeatPumpSystem(DXHeatSysNum).Name, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType, - DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName, - state.dataLoopNodes->NodeID(DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilInletNodeNum), - state.dataLoopNodes->NodeID(DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpCoilOutletNodeNum)); + dxhp.DXHeatPumpSystemType, + dxhp.Name, + HVAC::coilTypeNames[(int)dxhp.heatPumpCoilType], + dxhp.HeatPumpCoilName, + state.dataLoopNodes->NodeID(dxhp.DXHeatPumpCoilInletNodeNum), + state.dataLoopNodes->NodeID(dxhp.DXHeatPumpCoilOutletNodeNum)); // Supply air fan operating mode defaulted to constant fan cycling coil/compressor - DXHeatPumpSystem(DXHeatSysNum).fanOp = HVAC::FanOp::Continuous; + dxhp.fanOp = HVAC::FanOp::Continuous; - if (DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType_Num != HVAC::Coil_HeatingAirToAirVariableSpeed) { - SetCoilSystemHeatingDXFlag(state, DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilType, DXHeatPumpSystem(DXHeatSysNum).HeatPumpCoilName); + if (dxhp.heatPumpCoilType != HVAC::CoilType::HeatingAirToAirVariableSpeed) { + SetCoilSystemHeatingDXFlag(state, std::string(HVAC::coilTypeNames[(int)dxhp.heatPumpCoilType]), dxhp.HeatPumpCoilName); } } // End of the DX System Loop - if (state.dataHVACDXHeatPumpSys->ErrorsFound) { + if (ErrorsFound) { ShowFatalError(state, format("{}Errors found in input. Program terminates.", RoutineName)); } for (DXHeatSysNum = 1; DXHeatSysNum <= NumDXHeatPumpSystems; ++DXHeatSysNum) { // Setup Report variables for the DXHeatingSystem that is not reported in the components themselves + auto &dxhp = state.dataHVACDXHeatPumpSys->DXHeatPumpSystem(DXHeatSysNum); SetupOutputVariable(state, "Coil System Part Load Ratio", Constant::Units::None, - DXHeatPumpSystem(DXHeatSysNum).PartLoadFrac, + dxhp.PartLoadFrac, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - DXHeatPumpSystem(DXHeatSysNum).Name); + dxhp.Name); } Alphas.deallocate(); @@ -640,8 +621,8 @@ namespace HVACDXHeatPumpSystem { { Real64 TempOut1; - switch (DXHeatPumpSystem.HeatPumpCoilType_Num) { - case HVAC::CoilDX_HeatingEmpirical: { // Coil:Heating:DX:SingleSpeed + switch (DXHeatPumpSystem.heatPumpCoilType) { + case HVAC::CoilType::DXHeatingEmpirical: { // Coil:Heating:DX:SingleSpeed // Get no load result PartLoadFrac = 0.0; @@ -760,7 +741,8 @@ namespace HVACDXHeatPumpSystem { PartLoadFrac = 0.0; } } break; - case HVAC::Coil_HeatingAirToAirVariableSpeed: { + + case HVAC::CoilType::HeatingAirToAirVariableSpeed: { // variable-speed air-to-air heating coil, begin ------------------------- // Get no load result PartLoadFrac = 0.0; @@ -1038,7 +1020,7 @@ namespace HVACDXHeatPumpSystem { } break; default: { ShowFatalError(state, - format("ControlDXHeatingSystem: Invalid DXHeatPumpSystem coil type = {}", DXHeatPumpSystem.HeatPumpCoilType)); + format("ControlDXHeatingSystem: Invalid DXHeatPumpSystem coil type = {}", HVAC::coilTypeNames[(int)DXHeatPumpSystem.heatPumpCoilType])); } break; } } diff --git a/src/EnergyPlus/HVACDXHeatPumpSystem.hh b/src/EnergyPlus/HVACDXHeatPumpSystem.hh index 0585462645a..1422d867692 100644 --- a/src/EnergyPlus/HVACDXHeatPumpSystem.hh +++ b/src/EnergyPlus/HVACDXHeatPumpSystem.hh @@ -74,8 +74,7 @@ namespace HVACDXHeatPumpSystem { std::string DXHeatPumpSystemType; // Type of DXHeatingSystem std::string Name; // Name of the DXHeatingSystem int SchedPtr; - std::string HeatPumpCoilType; - int HeatPumpCoilType_Num; + HVAC::CoilType heatPumpCoilType = HVAC::CoilType::Invalid; std::string HeatPumpCoilName; int HeatPumpCoilIndex; int DXHeatPumpCoilInletNodeNum; @@ -103,7 +102,7 @@ namespace HVACDXHeatPumpSystem { // Default Constructor DXHeatPumpSystemStruct() - : SchedPtr(0), HeatPumpCoilType_Num(0), HeatPumpCoilIndex(0), DXHeatPumpCoilInletNodeNum(0), DXHeatPumpCoilOutletNodeNum(0), + : SchedPtr(0), HeatPumpCoilIndex(0), DXHeatPumpCoilInletNodeNum(0), DXHeatPumpCoilOutletNodeNum(0), DXSystemControlNodeNum(0), DesiredOutletTemp(0.0), PartLoadFrac(0.0), SpeedRatio(0.0), CycRatio(0.0), DXCoilSensPLRIter(0), DXCoilSensPLRIterIndex(0), DXCoilSensPLRFail(0), DXCoilSensPLRFailIndex(0), OAUnitSetTemp(0.0), SpeedNum(0), FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0) @@ -183,7 +182,6 @@ struct HVACDXHeatPumpSystemData : BaseGlobalStruct Real64 QZnReq = 0.001; // Zone load (W), input to variable-speed DX coil Real64 QLatReq = 0.0; // Zone latent load, input to variable-speed DX coil Real64 OnOffAirFlowRatio = 1.0; // ratio of compressor on flow to average flow over time step - bool ErrorsFound = false; // If errors detected in input int TotalArgs = 0; // Total number of alpha and numeric arguments (max) for a certain object in the input file bool MySetPointCheckFlag = true; int SpeedNum = 1; // speed number of variable speed DX cooling coil @@ -211,7 +209,6 @@ struct HVACDXHeatPumpSystemData : BaseGlobalStruct this->QZnReq = 0.001; this->QLatReq = 0.0; this->OnOffAirFlowRatio = 1.0; - this->ErrorsFound = false; this->TotalArgs = 0; this->MySetPointCheckFlag = true; this->SpeedNum = 1; diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index 147f344824f..d810b2721c8 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -132,7 +132,7 @@ namespace HVACHXAssistedCoolingCoil { // Find the correct HXAssistedCoolingCoil number if (CompIndex == 0) { - HXAssistedCoilNum = Util::FindItemInList(HXAssistedCoilName, state.dataHVACAssistedCC->HXAssistedCoil); + HXAssistedCoilNum = Util::FindItemInList(HXAssistedCoilName, state.dataHVACAssistedCC->HXAssistedCoils); if (HXAssistedCoilNum == 0) { ShowFatalError(state, format("HX Assisted Coil not found={}", HXAssistedCoilName)); } @@ -147,12 +147,12 @@ namespace HVACHXAssistedCoolingCoil { HXAssistedCoilName)); } if (state.dataHVACAssistedCC->CheckEquipName(HXAssistedCoilNum)) { - if (!HXAssistedCoilName.empty() && HXAssistedCoilName != state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name) { + if (!HXAssistedCoilName.empty() && HXAssistedCoilName != state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).Name) { ShowFatalError(state, format("SimHXAssistedCoolingCoil: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", HXAssistedCoilNum, HXAssistedCoilName, - state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name)); + state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).Name)); } state.dataHVACAssistedCC->CheckEquipName(HXAssistedCoilNum) = false; } @@ -178,7 +178,7 @@ namespace HVACHXAssistedCoolingCoil { AirFlowRatio = 1.0; } if (present(DehumidificationMode) && present(LoadSHR) && - state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).CoolingCoilType_Num == HVAC::CoilDX_Cooling) { + state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).coolCoilType == HVAC::CoilType::DXCooling) { CalcHXAssistedCoolingCoil(state, HXAssistedCoilNum, FirstHVACIteration, @@ -202,8 +202,8 @@ namespace HVACHXAssistedCoolingCoil { // Call ReportHXAssistedCoolingCoil(HXAssistedCoilNum), not required. No reporting variables for this compound component. if (present(QTotOut)) { - int InletNodeNum = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).HXAssistedCoilInletNodeNum; - int OutletNodeNum = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).HXAssistedCoilOutletNodeNum; + int InletNodeNum = state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).HXCoilInNodeNum; + int OutletNodeNum = state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).HXCoilOutNodeNum; Real64 AirMassFlow = state.dataLoopNodes->Node(OutletNodeNum).MassFlowRate; QTotOut = AirMassFlow * (state.dataLoopNodes->Node(InletNodeNum).Enthalpy - state.dataLoopNodes->Node(OutletNodeNum).Enthalpy); } @@ -229,21 +229,15 @@ namespace HVACHXAssistedCoolingCoil { static constexpr std::string_view RoutineName("GetHXAssistedCoolingCoilInput: "); // include trailing blank space static constexpr std::string_view routineName = "GetHXAssistedCoolingCoilInput"; + auto &s_node = state.dataLoopNodes; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int HXAssistedCoilNum; // Index number of the HXAssistedCoolingCoil for which input data is being read from the idf int NumAlphas; // Number of alpha inputs int NumNums; // Number of number inputs int IOStat; // Return status from GetObjectItem call bool ErrorsFound(false); // set TRUE if errors detected in input bool HXErrFlag; // Error flag for HX node numbers mining call bool CoolingCoilErrFlag; // Error flag for cooling coil node numbers mining call - int SupplyAirInletNode; // supply air inlet node number mined from heat exchanger object (ExchCond structure) - int SupplyAirOutletNode; // supply air outlet node number mined from heat exchanger object (ExchCond structure) - int SecondaryAirInletNode; // secondary air inlet node number mined from heat exchanger object (ExchCond structure) - int SecondaryAirOutletNode; // secondary air outlet node number mined from heat exchanger object (ExchCond structure) - int CoolingCoilInletNodeNum; // air outlet node number of cooling coil, used for warning messages - int CoolingCoilWaterInletNodeNum; // water coil water inlet node number used to find controller index - int CoolingCoilOutletNodeNum; // air outlet node number of cooling coil, used for warning messages std::string CurrentModuleObject; // Object type for getting and error messages Array1D_string AlphArray; // Alpha input items for object Array1D_string cAlphaFields; // Alpha field names @@ -259,7 +253,7 @@ namespace HVACHXAssistedCoolingCoil { state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoilSystem:Cooling:Water:HeatExchangerAssisted"); state.dataHVACAssistedCC->TotalNumHXAssistedCoils = NumHXAssistedDXCoils + NumHXAssistedWaterCoils; if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - state.dataHVACAssistedCC->HXAssistedCoil.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils); + state.dataHVACAssistedCC->HXAssistedCoils.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils); state.dataHVACAssistedCC->HXAssistedCoilOutletTemp.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils); state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils); state.dataHVACAssistedCC->CheckEquipName.dimension(state.dataHVACAssistedCC->TotalNumHXAssistedCoils, true); @@ -285,8 +279,8 @@ namespace HVACHXAssistedCoolingCoil { // Get the data for the Coil:DX:CoolingHeatExchangerAssisted objects CurrentModuleObject = "CoilSystem:Cooling:DX:HeatExchangerAssisted"; - for (HXAssistedCoilNum = 1; HXAssistedCoilNum <= NumHXAssistedDXCoils; ++HXAssistedCoilNum) { - auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum); + for (int HXAssistedCoilNum = 1; HXAssistedCoilNum <= NumHXAssistedDXCoils; ++HXAssistedCoilNum) { + auto &hxCoil = state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, HXAssistedCoilNum, @@ -299,270 +293,234 @@ namespace HVACHXAssistedCoolingCoil { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataHVACAssistedCC->UniqueHXAssistedCoilNames, AlphArray(1), CurrentModuleObject, ErrorsFound); - thisHXCoil.Name = AlphArray(1); - thisHXCoil.hxType = static_cast(getEnumValue(HVAC::hxTypeNamesUC, AlphArray(2))); - thisHXCoil.HeatExchangerName = AlphArray(3); - - thisHXCoil.CoolingCoilType = AlphArray(4); - thisHXCoil.CoolingCoilName = AlphArray(5); - - if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX")) { - thisHXCoil.CoolingCoilType_Num = HVAC::CoilDX_Cooling; - thisHXCoil.HXAssistedCoilType = CurrentModuleObject; - thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilDX_CoolingHXAssisted; - - CoolingCoilErrFlag = false; - int coolingCoilIndex_temp = CoilCoolingDX::factory(state, thisHXCoil.CoolingCoilName); - thisHXCoil.CoolingCoilIndex = coolingCoilIndex_temp; - if (coolingCoilIndex_temp < 0) { - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, AlphArray(5))); - CoolingCoilErrFlag = true; - ErrorsFound = true; - } - - thisHXCoil.DXCoilNumOfSpeeds = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex_temp].performance.normalMode.speeds.size(); - if (thisHXCoil.DXCoilNumOfSpeeds < 1) { - CoolingCoilErrFlag = true; - } - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - ErrorsFound = true; - } - } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:SingleSpeed")) { - thisHXCoil.CoolingCoilType_Num = HVAC::CoilDX_CoolingSingleSpeed; - thisHXCoil.HXAssistedCoilType = CurrentModuleObject; - thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilDX_CoolingHXAssisted; - CoolingCoilErrFlag = false; - DXCoils::GetDXCoilIndex( - state, thisHXCoil.CoolingCoilName, thisHXCoil.CoolingCoilIndex, CoolingCoilErrFlag, thisHXCoil.CoolingCoilType); - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); + hxCoil.Name = AlphArray(1); + hxCoil.hxType = static_cast(getEnumValue(HVAC::hxTypeNamesUC, AlphArray(2))); + hxCoil.HeatExchangerName = AlphArray(3); + hxCoil.HeatExchangerNum = HeatRecovery::GetHeatExchangerIndex(state, hxCoil.HeatExchangerName); + if (hxCoil.HeatExchangerNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), hxCoil.HeatExchangerName); + ErrorsFound = true; + } else { + hxCoil.MaxAirFlowRate = HeatRecovery::GetSupplyAirFlowRate(state, hxCoil.HeatExchangerNum); + hxCoil.SupplyAirInNodeNum = HeatRecovery::GetSupplyInletNode(state, hxCoil.HeatExchangerNum); + hxCoil.SupplyAirOutNodeNum = HeatRecovery::GetSupplyOutletNode(state, hxCoil.HeatExchangerNum); + hxCoil.SecAirInNodeNum = HeatRecovery::GetSecondaryInletNode(state, hxCoil.HeatExchangerNum); + hxCoil.SecAirOutNodeNum = HeatRecovery::GetSecondaryOutletNode(state, hxCoil.HeatExchangerNum); + } + + hxCoil.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, AlphArray(4))); + hxCoil.CoolCoilName = AlphArray(5); + + if (hxCoil.coolCoilType == HVAC::CoilType::DXCooling) { + hxCoil.hxCoilType = HVAC::CoilType::DXCoolingHXAssisted; + // What is this factory thing, seriously? + hxCoil.CoolCoilNum = CoilCoolingDX::factory(state, hxCoil.CoolCoilName); + if (hxCoil.CoolCoilNum < 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), hxCoil.CoolCoilName); ErrorsFound = true; + } else { + auto &coilDX = state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum]; + hxCoil.Capacity = coilDX.performance.normalMode.ratedGrossTotalCap; + hxCoil.DXCoilNumOfSpeeds = coilDX.performance.normalMode.speeds.size(); } - } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:VariableSpeed")) { - thisHXCoil.CoolingCoilType_Num = HVAC::Coil_CoolingAirToAirVariableSpeed; - thisHXCoil.HXAssistedCoilType = CurrentModuleObject; - thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilDX_CoolingHXAssisted; - CoolingCoilErrFlag = false; - thisHXCoil.CoolingCoilIndex = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, AlphArray(4), AlphArray(5), CoolingCoilErrFlag); - - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); + + } else if (hxCoil.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + hxCoil.hxCoilType = HVAC::CoilType::DXCoolingHXAssisted; + hxCoil.CoolCoilNum = DXCoils::GetDXCoilIndex(state, hxCoil.CoolCoilName); + if (hxCoil.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), AlphArray(5)); ErrorsFound = true; + } else { + hxCoil.Capacity = DXCoils::GetCoilCapacity(state, hxCoil.CoolCoilNum); + } - thisHXCoil.DXCoilNumOfSpeeds = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); + + } else if (hxCoil.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + hxCoil.hxCoilType = HVAC::CoilType::DXCoolingHXAssisted; + hxCoil.CoolCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, AlphArray(5)); + if (hxCoil.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), AlphArray(5)); ErrorsFound = true; + } else { + hxCoil.Capacity = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, hxCoil.CoolCoilNum); + hxCoil.DXCoilNumOfSpeeds = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, hxCoil.CoolCoilNum); } } else { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); - ShowContinueError(state, format("Invalid {}=\"{}\"", cAlphaFields(4), thisHXCoil.CoolingCoilType)); + ShowSevereInvalidKey(state, eoh, cAlphaFields(4), AlphArray(4)); ErrorsFound = true; } - HXErrFlag = false; - SupplyAirInletNode = HeatRecovery::GetSupplyInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - HXErrFlag = false; - SupplyAirOutletNode = HeatRecovery::GetSupplyOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - - HXErrFlag = false; - SecondaryAirInletNode = HeatRecovery::GetSecondaryInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - - HXErrFlag = false; - SecondaryAirOutletNode = HeatRecovery::GetSecondaryOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - - if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX")) { - CoolingCoilInletNodeNum = state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapInletNodeIndex; - if (SupplyAirOutletNode != CoolingCoilInletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); + if (hxCoil.coolCoilType == HVAC::CoilType::DXCooling) { + hxCoil.CoolCoilInNodeNum = state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum].evapInletNodeIndex; + if (hxCoil.SupplyAirOutNodeNum != hxCoil.CoolCoilInNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); ShowContinueError(state, format("The supply air outlet node name in heat exchanger {}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); ShowContinueError( state, - format("must match the cooling coil inlet node name in {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName)); + format("must match the cooling coil inlet node name in {}=\"{}\"", HVAC::coilTypeNames[(int)hxCoil.coolCoilType], hxCoil.CoolCoilName)); ShowContinueError(state, - format("Heat exchanger supply air outlet node name=\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode))); - ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum))); + format("Heat exchanger supply air outlet node name=\"{}\"", s_node->NodeID(hxCoil.SupplyAirOutNodeNum))); + ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", s_node->NodeID(hxCoil.CoolCoilInNodeNum))); ErrorsFound = true; } - CoolingCoilOutletNodeNum = state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapOutletNodeIndex; - if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); + hxCoil.CoolCoilOutNodeNum = state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum].evapOutletNodeIndex; + if (hxCoil.SecAirInNodeNum != hxCoil.CoolCoilOutNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); ShowContinueError(state, format("The secondary air inlet node name in heat exchanger {}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); ShowContinueError(state, format("must match the cooling coil air outlet node name in {}=\"{}\"", - thisHXCoil.CoolingCoilType, - thisHXCoil.CoolingCoilName)); + HVAC::coilTypeNames[(int)hxCoil.coolCoilType], + hxCoil.CoolCoilName)); ShowContinueError( - state, format("Heat exchanger secondary air inlet node name =\"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode))); + state, format("Heat exchanger secondary air inlet node name =\"{}\".", s_node->NodeID(hxCoil.SecAirInNodeNum))); ShowContinueError(state, - format("Cooling coil air outlet node name =\"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum))); + format("Cooling coil air outlet node name =\"{}\".", s_node->NodeID(hxCoil.CoolCoilOutNodeNum))); ErrorsFound = true; } - } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:SingleSpeed")) { + } else if (hxCoil.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { // Check node names in heat exchanger and coil objects for consistency - CoolingCoilErrFlag = false; - CoolingCoilInletNodeNum = - DXCoils::GetCoilInletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - if (SupplyAirOutletNode != CoolingCoilInletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); + hxCoil.CoolCoilInNodeNum = DXCoils::GetCoilInletNode(state, hxCoil.CoolCoilNum); + if (hxCoil.SupplyAirOutNodeNum != hxCoil.CoolCoilInNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); ShowContinueError(state, format("The supply air outlet node name in heat exchanger = {}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); ShowContinueError( state, - format("must match the cooling coil inlet node name in = {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName)); + format("must match the cooling coil inlet node name in = {}=\"{}\"", HVAC::coilTypeNames[(int)hxCoil.coolCoilType], hxCoil.CoolCoilName)); ShowContinueError(state, - format("Heat exchanger supply air outlet node name=\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode))); - ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum))); + format("Heat exchanger supply air outlet node name=\"{}\"", s_node->NodeID(hxCoil.SupplyAirOutNodeNum))); + ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", s_node->NodeID(hxCoil.CoolCoilInNodeNum))); ErrorsFound = true; } - CoolingCoilErrFlag = false; - CoolingCoilOutletNodeNum = - DXCoils::GetCoilOutletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); + + hxCoil.CoolCoilOutNodeNum = DXCoils::GetCoilOutletNode(state, hxCoil.CoolCoilNum); + if (hxCoil.SecAirInNodeNum != hxCoil.CoolCoilOutNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); ShowContinueError(state, format("The secondary air inlet node name in heat exchanger ={}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); ShowContinueError(state, format("must match the cooling coil air outlet node name in = {}=\"{}\".", - thisHXCoil.CoolingCoilType, - thisHXCoil.CoolingCoilName)); + HVAC::coilTypeNames[(int)hxCoil.coolCoilType], + hxCoil.CoolCoilName)); ShowContinueError( - state, format("Heat exchanger secondary air inlet node name =\"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode))); + state, format("Heat exchanger secondary air inlet node name =\"{}\".", s_node->NodeID(hxCoil.SecAirInNodeNum))); ShowContinueError(state, - format("Cooling coil air outlet node name =\"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum))); + format("Cooling coil air outlet node name =\"{}\".", s_node->NodeID(hxCoil.CoolCoilOutNodeNum))); ErrorsFound = true; } - } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:VariableSpeed")) { + } else if (hxCoil.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // Check node names in heat exchanger and coil objects for consistency - CoolingCoilErrFlag = false; - CoolingCoilInletNodeNum = VariableSpeedCoils::GetCoilInletNodeVariableSpeed( - state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - if (SupplyAirOutletNode != CoolingCoilInletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); + hxCoil.CoolCoilInNodeNum = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, hxCoil.CoolCoilNum); + if (hxCoil.SupplyAirOutNodeNum != hxCoil.CoolCoilInNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); ShowContinueError(state, format("The supply air outlet node name in heat exchanger = {}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); ShowContinueError( state, - format("must match the cooling coil inlet node name in = {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName)); + format("must match the cooling coil inlet node name in = {}=\"{}\"", HVAC::coilTypeNames[(int)hxCoil.coolCoilType], hxCoil.CoolCoilName)); ShowContinueError(state, - format("Heat exchanger supply air outlet node name=\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode))); - ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum))); + format("Heat exchanger supply air outlet node name=\"{}\"", s_node->NodeID(hxCoil.SupplyAirOutNodeNum))); + ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", s_node->NodeID(hxCoil.CoolCoilInNodeNum))); ErrorsFound = true; } - CoolingCoilErrFlag = false; - CoolingCoilOutletNodeNum = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed( - state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - if (CoolingCoilErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); + + hxCoil.CoolCoilOutNodeNum = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(state, hxCoil.CoolCoilNum); + if (hxCoil.CoolCoilOutNodeNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), AlphArray(5)); + ErrorsFound = true; } - if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); + if (hxCoil.SecAirInNodeNum != hxCoil.CoolCoilOutNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); ShowContinueError(state, format("The secondary air inlet node name in heat exchanger ={}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); ShowContinueError(state, format("must match the cooling coil air outlet node name in = {}=\"{}\".", - thisHXCoil.CoolingCoilType, - thisHXCoil.CoolingCoilName)); + HVAC::coilTypeNames[(int)hxCoil.coolCoilType], + hxCoil.CoolCoilName)); ShowContinueError( - state, format("Heat exchanger secondary air inlet node name =\"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode))); + state, format("Heat exchanger secondary air inlet node name =\"{}\".", s_node->NodeID(hxCoil.SecAirInNodeNum))); ShowContinueError(state, - format("Cooling coil air outlet node name =\"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum))); + format("Cooling coil air outlet node name =\"{}\".", s_node->NodeID(hxCoil.CoolCoilOutNodeNum))); ErrorsFound = true; } } BranchNodeConnections::TestCompSet(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - state.dataLoopNodes->NodeID(SupplyAirInletNode), - state.dataLoopNodes->NodeID(SecondaryAirOutletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + s_node->NodeID(hxCoil.SupplyAirInNodeNum), + s_node->NodeID(hxCoil.SecAirOutNodeNum), "Air Nodes"); - thisHXCoil.HXAssistedCoilInletNodeNum = + hxCoil.HXCoilInNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SupplyAirInletNode), + s_node->NodeID(hxCoil.SupplyAirInNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted, - thisHXCoil.Name, + hxCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); // no need to capture CoolingCoilInletNodeNum as the return value, it's not used anywhere - NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SupplyAirOutletNode), + // Actually, it's a good idea to capture it anyway + hxCoil.CoolCoilInNodeNum = + NodeInputManager::GetOnlySingleNode(state, + s_node->NodeID(hxCoil.SupplyAirOutNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted, - state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name, + hxCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Internal, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisHXCoil.HXExhaustAirInletNodeNum = + + hxCoil.HXCoilExhaustAirInNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SecondaryAirInletNode), + s_node->NodeID(hxCoil.SecAirInNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted, - thisHXCoil.Name, + hxCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Internal, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisHXCoil.HXAssistedCoilOutletNodeNum = + hxCoil.HXCoilOutNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SecondaryAirOutletNode), + s_node->NodeID(hxCoil.SecAirOutNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted, - thisHXCoil.Name, + hxCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, @@ -570,29 +528,29 @@ namespace HVACHXAssistedCoolingCoil { // Add cooling coil to component sets array BranchNodeConnections::SetUpCompSets(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - thisHXCoil.CoolingCoilType, - thisHXCoil.CoolingCoilName, - state.dataLoopNodes->NodeID(SupplyAirOutletNode), - state.dataLoopNodes->NodeID(SecondaryAirInletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + HVAC::coilTypeNames[(int)hxCoil.coolCoilType], + hxCoil.CoolCoilName, + s_node->NodeID(hxCoil.SupplyAirOutNodeNum), + s_node->NodeID(hxCoil.SecAirInNodeNum), "Air Nodes"); // Add heat exchanger to component sets array BranchNodeConnections::SetUpCompSets(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName, - state.dataLoopNodes->NodeID(SupplyAirInletNode), - state.dataLoopNodes->NodeID(SupplyAirOutletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName, + s_node->NodeID(hxCoil.SupplyAirInNodeNum), + s_node->NodeID(hxCoil.SupplyAirOutNodeNum), "Process Air Nodes"); BranchNodeConnections::SetUpCompSets(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName, - state.dataLoopNodes->NodeID(SecondaryAirInletNode), - state.dataLoopNodes->NodeID(SecondaryAirOutletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName, + s_node->NodeID(hxCoil.SecAirInNodeNum), + s_node->NodeID(hxCoil.SecAirOutNodeNum), "Secondary Air Nodes"); } // End of the Coil:DX:CoolingHXAssisted Loop @@ -600,10 +558,10 @@ namespace HVACHXAssistedCoolingCoil { // Get the data for the Coil:Water:CoolingHeatExchangerAssisted objects CurrentModuleObject = "CoilSystem:Cooling:Water:HeatExchangerAssisted"; - for (HXAssistedCoilNum = NumHXAssistedDXCoils + 1; HXAssistedCoilNum <= state.dataHVACAssistedCC->TotalNumHXAssistedCoils; + for (int HXAssistedCoilNum = NumHXAssistedDXCoils + 1; HXAssistedCoilNum <= state.dataHVACAssistedCC->TotalNumHXAssistedCoils; ++HXAssistedCoilNum) { int thisWaterHXNum = HXAssistedCoilNum - NumHXAssistedDXCoils; - auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum); + auto &hxCoil = state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -623,147 +581,134 @@ namespace HVACHXAssistedCoolingCoil { GlobalNames::VerifyUniqueInterObjectName( state, state.dataHVACAssistedCC->UniqueHXAssistedCoilNames, AlphArray(1), CurrentModuleObject, ErrorsFound); - thisHXCoil.Name = AlphArray(1); + hxCoil.Name = AlphArray(1); - thisHXCoil.hxType = static_cast(getEnumValue(HVAC::hxTypeNamesUC, AlphArray(2))); - if (thisHXCoil.hxType == HVAC::HXType::Desiccant_Balanced) { + hxCoil.hxType = static_cast(getEnumValue(HVAC::hxTypeNamesUC, AlphArray(2))); + if (hxCoil.hxType == HVAC::HXType::Desiccant_Balanced) { ShowSevereInvalidKey(state, eoh, cAlphaFields(2), AlphArray(2)); ErrorsFound = true; } - thisHXCoil.HeatExchangerName = AlphArray(3); - thisHXCoil.CoolingCoilType = AlphArray(4); - thisHXCoil.CoolingCoilName = AlphArray(5); - - HXErrFlag = false; - SupplyAirInletNode = HeatRecovery::GetSupplyInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } - - HXErrFlag = false; - SupplyAirOutletNode = HeatRecovery::GetSupplyOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}", CurrentModuleObject, thisHXCoil.Name)); - } - - HXErrFlag = false; - SecondaryAirInletNode = HeatRecovery::GetSecondaryInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); - } + hxCoil.HeatExchangerName = AlphArray(3); + hxCoil.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, AlphArray(4))); + hxCoil.CoolCoilName = AlphArray(5); - HXErrFlag = false; - SecondaryAirOutletNode = HeatRecovery::GetSecondaryOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag); - if (HXErrFlag) { - ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name)); + hxCoil.HeatExchangerNum = HeatRecovery::GetHeatExchangerIndex(state, hxCoil.HeatExchangerName); + if (hxCoil.HeatExchangerNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), hxCoil.HeatExchangerName); + ErrorsFound = true; + } else { + hxCoil.SupplyAirInNodeNum = HeatRecovery::GetSupplyInletNode(state, hxCoil.HeatExchangerNum); + hxCoil.SupplyAirOutNodeNum = HeatRecovery::GetSupplyOutletNode(state, hxCoil.HeatExchangerNum); + hxCoil.SecAirInNodeNum = HeatRecovery::GetSecondaryInletNode(state, hxCoil.HeatExchangerNum); + hxCoil.SecAirOutNodeNum = HeatRecovery::GetSecondaryOutletNode(state, hxCoil.HeatExchangerNum); } - if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water") || - Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water:DetailedGeometry")) { - if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water:DetailedGeometry")) { - thisHXCoil.CoolingCoilType_Num = HVAC::Coil_CoolingWaterDetailed; - } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water")) { - thisHXCoil.CoolingCoilType_Num = HVAC::Coil_CoolingWater; - } + if (hxCoil.coolCoilType == HVAC::CoilType::CoolingWater || + hxCoil.coolCoilType == HVAC::CoilType::CoolingWaterDetailed) { - thisHXCoil.HXAssistedCoilType = CurrentModuleObject; - thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilWater_CoolingHXAssisted; + hxCoil.hxCoilType = HVAC::CoilType::WaterCoolingHXAssisted; - // Check node names in heat exchanger and coil objects for consistency - CoolingCoilErrFlag = false; - CoolingCoilInletNodeNum = - WaterCoils::GetCoilInletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - CoolingCoilWaterInletNodeNum = - WaterCoils::GetCoilWaterInletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - HVACControllers::GetControllerNameAndIndex( - state, CoolingCoilWaterInletNodeNum, thisHXCoil.ControllerName, thisHXCoil.ControllerIndex, CoolingCoilErrFlag); - if (CoolingCoilErrFlag) ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, thisHXCoil.Name)); - if (SupplyAirOutletNode != CoolingCoilInletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); - ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); - ShowContinueError(state, - format("The supply air outlet node name in heat exchanger = {}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); - ShowContinueError( - state, - format("must match the cooling coil inlet node name in = {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName)); - ShowContinueError(state, - format("Heat exchanger supply air outlet node name =\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode))); - ShowContinueError(state, - format("Cooling coil air inlet node name = \"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum))); - ErrorsFound = true; - } - CoolingCoilErrFlag = false; - CoolingCoilOutletNodeNum = - WaterCoils::GetCoilOutletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag); - if (CoolingCoilErrFlag) ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, thisHXCoil.Name)); - if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); - ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); - ShowContinueError(state, - format("The secondary air inlet node name in heat exchanger = {}=\"{}\"", - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName)); - ShowContinueError(state, - format("must match the cooling coil air outlet node name in = {}=\"{}\".", - thisHXCoil.CoolingCoilType, - thisHXCoil.CoolingCoilName)); - ShowContinueError( - state, format("Heat exchanger secondary air inlet node name = \"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode))); - ShowContinueError(state, - format("Cooling coil air outlet node name = \"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum))); + hxCoil.CoolCoilNum = WaterCoils::GetWaterCoilIndex(state, hxCoil.CoolCoilName); + if (hxCoil.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), hxCoil.CoolCoilName); ErrorsFound = true; + } else { + hxCoil.Capacity = WaterCoils::GetWaterCoilCapacity(state, hxCoil.CoolCoilNum); + hxCoil.MaxWaterFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, hxCoil.CoolCoilNum); + + // Check node names in heat exchanger and coil objects for consistency + hxCoil.CoolCoilInNodeNum = WaterCoils::GetCoilInletNode(state, hxCoil.CoolCoilNum); + hxCoil.CoolCoilWaterInNodeNum = WaterCoils::GetCoilWaterInletNode(state, hxCoil.CoolCoilNum); + + HVACControllers::GetControllerNameAndIndex( + state, hxCoil.CoolCoilWaterInNodeNum, hxCoil.ControllerName, hxCoil.ControllerIndex, CoolingCoilErrFlag); + if (CoolingCoilErrFlag) ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, hxCoil.Name)); + + if (hxCoil.SupplyAirOutNodeNum != hxCoil.CoolCoilInNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); + ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); + ShowContinueError(state, + format("The supply air outlet node name in heat exchanger = {}=\"{}\"", + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); + ShowContinueError( + state, + format("must match the cooling coil inlet node name in = {}=\"{}\"", + HVAC::coilTypeNames[(int)hxCoil.coolCoilType], hxCoil.CoolCoilName)); + ShowContinueError(state, + format("Heat exchanger supply air outlet node name =\"{}\"", s_node->NodeID(hxCoil.SupplyAirOutNodeNum))); + ShowContinueError(state, + format("Cooling coil air inlet node name = \"{}\"", s_node->NodeID(hxCoil.CoolCoilInNodeNum))); + ErrorsFound = true; + } + CoolingCoilErrFlag = false; + + hxCoil.CoolCoilOutNodeNum = WaterCoils::GetCoilOutletNode(state, hxCoil.CoolCoilNum); + if (hxCoil.SecAirInNodeNum != hxCoil.CoolCoilOutNodeNum) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, hxCoil.Name)); + ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); + ShowContinueError(state, + format("The secondary air inlet node name in heat exchanger = {}=\"{}\"", + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName)); + ShowContinueError(state, + format("must match the cooling coil air outlet node name in = {}=\"{}\".", + HVAC::coilTypeNames[(int)hxCoil.coolCoilType], + hxCoil.CoolCoilName)); + ShowContinueError( + state, format("Heat exchanger secondary air inlet node name = \"{}\".", s_node->NodeID(hxCoil.SecAirInNodeNum))); + ShowContinueError(state, + format("Cooling coil air outlet node name = \"{}\".", s_node->NodeID(hxCoil.CoolCoilOutNodeNum))); + ErrorsFound = true; + } } - } else { - ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); - ShowContinueError(state, format("Invalid {}=\"{}\"", cAlphaFields(4), thisHXCoil.CoolingCoilType)); + ShowSevereInvalidKey(state, eoh, cAlphaFields(4), AlphArray(4)); ErrorsFound = true; } BranchNodeConnections::TestCompSet(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - state.dataLoopNodes->NodeID(SupplyAirInletNode), - state.dataLoopNodes->NodeID(SecondaryAirOutletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + s_node->NodeID(hxCoil.SupplyAirInNodeNum), + s_node->NodeID(hxCoil.SecAirOutNodeNum), "Air Nodes"); - thisHXCoil.HXAssistedCoilInletNodeNum = + hxCoil.HXCoilInNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SupplyAirInletNode), + s_node->NodeID(hxCoil.SupplyAirInNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted, - thisHXCoil.Name, + hxCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); // no need to capture CoolingCoilInletNodeNum as the return value, it's not used anywhere NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SupplyAirOutletNode), + s_node->NodeID(hxCoil.SupplyAirOutNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted, - state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name, + state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Internal, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisHXCoil.HXExhaustAirInletNodeNum = + hxCoil.HXCoilExhaustAirInNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SecondaryAirInletNode), + s_node->NodeID(hxCoil.SecAirInNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted, - thisHXCoil.Name, + hxCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Internal, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisHXCoil.HXAssistedCoilOutletNodeNum = + hxCoil.HXCoilOutNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataLoopNodes->NodeID(SecondaryAirOutletNode), + s_node->NodeID(hxCoil.SecAirOutNodeNum), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted, - thisHXCoil.Name, + hxCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, @@ -771,29 +716,29 @@ namespace HVACHXAssistedCoolingCoil { // Add cooling coil to component sets array BranchNodeConnections::SetUpCompSets(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - thisHXCoil.CoolingCoilType, - thisHXCoil.CoolingCoilName, - state.dataLoopNodes->NodeID(SupplyAirOutletNode), - state.dataLoopNodes->NodeID(SecondaryAirInletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + HVAC::coilTypeNames[(int)hxCoil.coolCoilType], + hxCoil.CoolCoilName, + s_node->NodeID(hxCoil.SupplyAirOutNodeNum), + s_node->NodeID(hxCoil.SecAirInNodeNum), "Air Nodes"); // Add heat exchanger to component sets array BranchNodeConnections::SetUpCompSets(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName, - state.dataLoopNodes->NodeID(SupplyAirInletNode), - state.dataLoopNodes->NodeID(SupplyAirOutletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName, + s_node->NodeID(hxCoil.SupplyAirInNodeNum), + s_node->NodeID(hxCoil.SupplyAirOutNodeNum), "Process Air Nodes"); BranchNodeConnections::SetUpCompSets(state, - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, - HVAC::hxTypeNames[(int)thisHXCoil.hxType], - thisHXCoil.HeatExchangerName, - state.dataLoopNodes->NodeID(SecondaryAirInletNode), - state.dataLoopNodes->NodeID(SecondaryAirOutletNode), + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, + HVAC::hxTypeNames[(int)hxCoil.hxType], + hxCoil.HeatExchangerName, + s_node->NodeID(hxCoil.SecAirInNodeNum), + s_node->NodeID(hxCoil.SecAirOutNodeNum), "Secondary Air Nodes"); } // End of the Coil:Water:CoolingHXAssisted Loop @@ -830,20 +775,22 @@ namespace HVACHXAssistedCoolingCoil { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. + auto &s_node = state.dataLoopNodes; + // Do these initializations every time - auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum); - thisHXCoil.MassFlowRate = state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).MassFlowRate; + auto &hxCoil = state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum); + hxCoil.MassFlowRate = s_node->Node(hxCoil.HXCoilInNodeNum).MassFlowRate; - if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling) { + if (hxCoil.coolCoilType == HVAC::CoilType::DXCooling) { // - // state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex] + // state.dataCoilCooingDX->coilCoolingDXs[hxCoil.CoolCoilIndex] // .outletAirDryBulbTemp = 0.0; - // state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].outletAirHumRat = + // state.dataCoilCooingDX->coilCoolingDXs[hxCoil.CoolCoilIndex].outletAirHumRat = // 0.0; - } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { - state.dataDXCoils->DXCoilFullLoadOutAirTemp(thisHXCoil.CoolingCoilIndex) = 0.0; - state.dataDXCoils->DXCoilFullLoadOutAirHumRat(thisHXCoil.CoolingCoilIndex) = 0.0; - } else if (thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (hxCoil.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + state.dataDXCoils->DXCoilFullLoadOutAirTemp(hxCoil.CoolCoilNum) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(hxCoil.CoolCoilNum) = 0.0; + } else if (hxCoil.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // } } @@ -877,22 +824,25 @@ namespace HVACHXAssistedCoolingCoil { // SUBROUTINE PARAMETER DEFINITIONS: int constexpr MaxIter(50); // Maximum number of iterations - int CompanionCoilIndexNum; // Index to DX coil + int CompanionCoilNum; // Index to DX coil - auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum); - Real64 AirMassFlow = thisHXCoil.MassFlowRate; + auto &s_node = state.dataLoopNodes; + + auto &hxCoil = state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum); + Real64 AirMassFlow = hxCoil.MassFlowRate; Real64 Error = 1.0; // Initialize error (CoilOutputTemp last iteration minus current CoilOutputTemp) Real64 ErrorLast = Error; // initialize variable used to test loop termination int Iter = 0; // Initialize iteration counter to zero // Set mass flow rate at inlet of exhaust side of heat exchanger to supply side air mass flow rate entering this compound object - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).MassFlowRate = AirMassFlow; + s_node->Node(hxCoil.HXCoilExhaustAirInNodeNum).MassFlowRate = AirMassFlow; - if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling || thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || - thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - CompanionCoilIndexNum = thisHXCoil.CoolingCoilIndex; + if (hxCoil.coolCoilType == HVAC::CoilType::DXCooling || + hxCoil.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + hxCoil.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + CompanionCoilNum = hxCoil.CoolCoilNum; } else { - CompanionCoilIndexNum = 0; + CompanionCoilNum = 0; } // First call to RegulaFalsi uses PLR=0. Nodes are typically setup at full output on this call. @@ -900,44 +850,38 @@ namespace HVACHXAssistedCoolingCoil { // Reset node data to minimize iteration. This initialization reduces the number of iterations by 50%. // CAUTION: Do not use Node(x) = Node(y) here, this can overwrite the coil outlet node setpoint. if (PartLoadRatio == 0.0) { - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp = - state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).Temp; - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).HumRat = - state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).HumRat; - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Enthalpy = - state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).Enthalpy; - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).MassFlowRate = - state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).MassFlowRate; + s_node->Node(hxCoil.HXCoilExhaustAirInNodeNum).Temp = s_node->Node(hxCoil.HXCoilInNodeNum).Temp; + s_node->Node(hxCoil.HXCoilExhaustAirInNodeNum).HumRat = s_node->Node(hxCoil.HXCoilInNodeNum).HumRat; + s_node->Node(hxCoil.HXCoilExhaustAirInNodeNum).Enthalpy = s_node->Node(hxCoil.HXCoilInNodeNum).Enthalpy; + s_node->Node(hxCoil.HXCoilExhaustAirInNodeNum).MassFlowRate = s_node->Node(hxCoil.HXCoilInNodeNum).MassFlowRate; } // Force at least 2 iterations to pass outlet node information while ((std::abs(Error) > 0.0005 && Iter <= MaxIter) || Iter < 2) { HeatRecovery::SimHeatRecovery(state, - thisHXCoil.HeatExchangerName, + hxCoil.HeatExchangerName, FirstHVACIteration, - thisHXCoil.HeatExchangerIndex, + hxCoil.HeatExchangerNum, fanOp, PartLoadRatio, HXUnitOn, - CompanionCoilIndexNum, + CompanionCoilNum, _, EconomizerFlag, _, - thisHXCoil.CoolingCoilType_Num); - - if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling) { + hxCoil.coolCoilType); - int coolingCoilIndex = thisHXCoil.CoolingCoilIndex; + if (hxCoil.coolCoilType == HVAC::CoilType::DXCooling) { - int mSingleMode = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex].getNumModes(); + int mSingleMode = state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum].getNumModes(); bool singleMode = (mSingleMode == 1); - Real64 mCoolingSpeedNum = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex] + Real64 mCoolingSpeedNum = state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum] .performance.normalMode.speeds.size(); // used the same for the original variable speed coil HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; - if (state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } else if (DehumidificationMode == HVAC::CoilMode::Enhanced) { coilMode = HVAC::CoilMode::Enhanced; @@ -960,116 +904,79 @@ namespace HVACHXAssistedCoolingCoil { CoilPLR = PartLoadRatio * ((compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0); } - state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].simulate(state, - coilMode, // partially implemented for HXAssistedCoil - CoilPLR, // PartLoadRatio, - mCoolingSpeedNum, - mCoolingSpeedRatio, - fanOp, - singleMode); // - - } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { + state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum].simulate(state, + coilMode, // partially implemented for HXAssistedCoil + CoilPLR, // PartLoadRatio, + mCoolingSpeedNum, + mCoolingSpeedRatio, + fanOp, + singleMode); // + + } else if (hxCoil.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { DXCoils::SimDXCoil(state, - thisHXCoil.CoolingCoilName, + hxCoil.CoolCoilName, compressorOp, FirstHVACIteration, - thisHXCoil.CoolingCoilIndex, + hxCoil.CoolCoilNum, fanOp, PartLoadRatio, OnOffAirFlow); - } else if (thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (hxCoil.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { Real64 QZnReq(-1.0); // Zone load (W), input to variable-speed DX coil Real64 QLatReq(0.0); // Zone latent load, input to variable-speed DX coil Real64 OnOffAirFlowRatio(1.0); // ratio of compressor on flow to average flow over time step HVAC::CompressorOp compressorOn = compressorOp; if (PartLoadRatio == 0.0) compressorOn = HVAC::CompressorOp::Off; VariableSpeedCoils::SimVariableSpeedCoils(state, - thisHXCoil.CoolingCoilName, - thisHXCoil.CoolingCoilIndex, + hxCoil.CoolCoilName, + hxCoil.CoolCoilNum, fanOp, compressorOn, PartLoadRatio, - thisHXCoil.DXCoilNumOfSpeeds, + hxCoil.DXCoilNumOfSpeeds, QZnReq, QLatReq, OnOffAirFlowRatio); // call vs coil model at top speed. } else { - WaterCoils::SimulateWaterCoilComponents(state, thisHXCoil.CoolingCoilName, FirstHVACIteration, thisHXCoil.CoolingCoilIndex); + WaterCoils::SimulateWaterCoilComponents(state, hxCoil.CoolCoilName, FirstHVACIteration, hxCoil.CoolCoilNum); } - Error = state.dataHVACAssistedCC->CoilOutputTempLast - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp; + Error = state.dataHVACAssistedCC->CoilOutputTempLast - s_node->Node(hxCoil.HXCoilExhaustAirInNodeNum).Temp; if (Iter > 40) { // check for oscillation (one of these being negative and one positive) before hitting max iteration limit if (Error + ErrorLast < 0.000001) Error = 0.0; // result bounced back and forth with same positive and negative result, no possible solution without this check } ErrorLast = Error; - state.dataHVACAssistedCC->CoilOutputTempLast = state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp; + state.dataHVACAssistedCC->CoilOutputTempLast = s_node->Node(hxCoil.HXCoilExhaustAirInNodeNum).Temp; ++Iter; } // Write excessive iteration warning messages if (Iter > MaxIter) { - if (thisHXCoil.MaxIterCounter < 1) { - ++thisHXCoil.MaxIterCounter; + if (hxCoil.MaxIterCounter < 1) { + ++hxCoil.MaxIterCounter; ShowWarningError(state, format("{} \"{}\" -- Exceeded max iterations ({}) while calculating operating conditions.", - thisHXCoil.HXAssistedCoilType, - thisHXCoil.Name, + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name, MaxIter)); ShowContinueErrorTimeStamp(state, ""); } else { ShowRecurringWarningErrorAtEnd(state, - thisHXCoil.HXAssistedCoilType + " \"" + thisHXCoil.Name + - "\" -- Exceeded max iterations error continues...", - thisHXCoil.MaxIterIndex); + format("{}=\"{}\" -- Exceeded max iterations error continues...", + HVAC::coilTypeNames[(int)hxCoil.hxCoilType], + hxCoil.Name), + hxCoil.MaxIterIndex); } } - state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(HXAssistedCoilNum) = - state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilOutletNodeNum).Temp; - state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat(HXAssistedCoilNum) = - state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilOutletNodeNum).HumRat; + state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(HXAssistedCoilNum) = s_node->Node(hxCoil.HXCoilOutNodeNum).Temp; + state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat(HXAssistedCoilNum) = s_node->Node(hxCoil.HXCoilOutNodeNum).HumRat; } // End of Reporting subroutines for the HXAssistedCoil Module // ***************************************************************************** - void GetHXDXCoilIndex( - EnergyPlusData &state, std::string const &HXDXCoilName, int &HXDXCoilIndex, bool &ErrorsFound, std::string_view const CurrentModuleObject) - { - - // SUBROUTINE INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN August 2007 - - // PURPOSE OF THIS SUBROUTINE: - // This subroutine sets an index for a given HX Assisted Cooling Coil -- issues error message if that - // HX is not a legal HX Assisted Cooling Coil. - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - HXDXCoilIndex = Util::FindItem(HXDXCoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } else { - HXDXCoilIndex = 0; - } - - if (HXDXCoilIndex == 0) { - if (!CurrentModuleObject.empty()) { - ShowSevereError(state, fmt::format("{}, GetHXDXCoilIndex: HX Assisted Cooling Coil not found={}", CurrentModuleObject, HXDXCoilName)); - } else { - ShowSevereError(state, format("GetHXDXCoilIndex: HX Assisted Cooling Coil not found={}", HXDXCoilName)); - } - ErrorsFound = true; - } - } - void CheckHXAssistedCoolingCoilSchedule(EnergyPlusData &state, [[maybe_unused]] std::string const &CompType, // unused1208 std::string_view CompName, @@ -1099,7 +1006,7 @@ namespace HVACHXAssistedCoolingCoil { // Find the correct Coil number if (CompIndex == 0) { if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - HXAssistedCoilNum = Util::FindItem(CompName, state.dataHVACAssistedCC->HXAssistedCoil); + HXAssistedCoilNum = Util::FindItem(CompName, state.dataHVACAssistedCC->HXAssistedCoils); } else { HXAssistedCoilNum = 0; } @@ -1118,646 +1025,117 @@ namespace HVACHXAssistedCoolingCoil { state.dataHVACAssistedCC->TotalNumHXAssistedCoils, CompName)); } - if (CompName != state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name) { + if (CompName != state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).Name) { ShowFatalError( state, format("CheckHXAssistedCoolingCoilSchedule: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", HXAssistedCoilNum, CompName, - state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name)); + state.dataHVACAssistedCC->HXAssistedCoils(HXAssistedCoilNum).Name)); } Value = 1.0; // not scheduled? } } - Real64 GetCoilCapacity(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) - { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN February 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the coil capacity for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned - // as negative. - - // Return value - Real64 CoilCapacity(0.0); // returned capacity of matched coil - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - bool errFlag = false; - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted")) { - if (WhichCoil != 0) { - // coil does not have capacity in input so mine information from DX cooling coil - - if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_Cooling) { - int coolingCoilDXIndex = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilIndex; - CoilCapacity = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilDXIndex].performance.normalMode.ratedGrossTotalCap; - } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { - CoilCapacity = DXCoils::GetCoilCapacity(state, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName, - errFlag); - } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { - CoilCapacity = - VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName, - errFlag); - } - if (errFlag) { - ShowRecurringWarningErrorAtEnd( - state, "Requested DX Coil from CoilSystem:Cooling:DX:HeatExchangerAssisted not found", state.dataHVACAssistedCC->ErrCount); - } - } - } else if (Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) { - if (WhichCoil != 0) { - // coil does not have capacity in input so mine information from DX cooling coil - CoilCapacity = WaterCoils::GetWaterCoilCapacity(state, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName, - errFlag); - if (errFlag) { - ShowRecurringWarningErrorAtEnd( - state, "Requested DX Coil from CoilSystem:Cooling:DX:HeatExchangerAssisted not found", state.dataHVACAssistedCC->ErrCount); - } - } - } else { - WhichCoil = 0; - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("GetCoilCapacity: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ShowContinueError(state, "... Coil Capacity returned as -1000."); - ErrorsFound = true; - CoilCapacity = -1000.0; - } - - if (errFlag) ErrorsFound = true; - - return CoilCapacity; - } - - int GetCoilGroupTypeNum(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - bool const PrintWarning // prints warning message if true - ) - { - - // FUNCTION INFORMATION: - // AUTHOR R. Raustad - FSEC - // DATE WRITTEN August 2008 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the HX coil type and returns it (CoilDX_CoolingHXAssisted, CoilWater_CoolingHXAssisted) - // If incorrect coil type or name is given, ErrorsFound is returned as true. - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int WhichCoil; - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } else { - WhichCoil = 0; - } - - if (WhichCoil != 0) { - // coil does not have capacity in input so mine information from DX cooling coil - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilType_Num; - } else { - if (PrintWarning) { - ShowSevereError(state, format("GetCoilGroupTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - } - ErrorsFound = true; - return 0; - } - } - - int GetCoilObjectTypeNum(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - bool const PrintWarning // prints warning message if true + Real64 GetHXCoilCapacity(EnergyPlusData &state, + std::string_view const coilType, + std::string const &coilName, + bool &ErrorsFound ) { - - // FUNCTION INFORMATION: - // AUTHOR R. Raustad - FSEC - // DATE WRITTEN April 2009 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the coil object type for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned - // as negative. - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil != 0) { - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num; - } else { - if (PrintWarning) { - ShowSevereError(state, format("GetCoilObjectTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - } - ErrorsFound = true; - return 0; - } + int coilNum = GetHXCoilIndex(state, coilType, coilName, ErrorsFound); + return (coilNum == 0) ? -1000.0 : state.dataHVACAssistedCC->HXAssistedCoils(coilNum).Capacity; } - int GetCoilInletNode(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + int GetHXCoilInletNode(EnergyPlusData &state, + std::string_view coilType, + std::string const &coilName, + bool &ErrorsFound ) { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN February 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the inlet node number. If - // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned - // as zero. - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil != 0) { - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilInletNodeNum; - } else { - ShowSevereError(state, format("GetCoilInletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return 0; - } + int coilNum = GetHXCoilIndex(state, coilType, coilName, ErrorsFound); + return (coilNum == 0) ? 0 : state.dataHVACAssistedCC->HXAssistedCoils(coilNum).HXCoilInNodeNum; } - int GetCoilWaterInletNode(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + int GetHXCoilWaterInletNode(EnergyPlusData &state, + std::string_view const coilType, // must match coil types in this module + std::string const &coilName, // must match coil names for the coil type + bool &ErrorsFound // set to true if problem ) { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN April 2011 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the inlet node number. If - // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned - // as zero. - - // Return value - int NodeNumber; // returned node number of matched coil - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil != 0) { - if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingWater) { - NodeNumber = WaterCoils::GetCoilWaterInletNode(state, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName, - ErrorsFound); - } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingWaterDetailed) { - NodeNumber = WaterCoils::GetCoilWaterInletNode(state, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType, - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName, - ErrorsFound); - } else { // even though validated in Get, still check. - ShowSevereError(state, - format("GetCoilWaterInletNode: Invalid Cooling Coil for HX Assisted Coil, Type=\"{}\" Name=\"{}\"", - state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType, - CoilName)); - ErrorsFound = true; - NodeNumber = 0; // Autodesk:Return Added line to set return value - } - } else { - ShowSevereError(state, format("GetCoilInletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - NodeNumber = 0; - } - - return NodeNumber; + int coilNum = GetHXCoilIndex(state, coilType, coilName, ErrorsFound); + return (coilNum == 0) ? 0 : state.dataHVACAssistedCC->HXAssistedCoils(coilNum).CoolCoilWaterInNodeNum; } - int GetCoilOutletNode(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + int GetHXCoilOutletNode(EnergyPlusData &state, + std::string_view CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound // set to true if problem ) { - - // FUNCTION INFORMATION: - // AUTHOR R. Raustad - // DATE WRITTEN August 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the outlet node number. If - // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned - // as zero. - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil != 0) { - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilOutletNodeNum; - } else { - ShowSevereError(state, format("GetCoilOutletNode: Could not find Coil, Type=\"{}\" Name=\"{}", CoilType, CoilName)); - ErrorsFound = true; - return 0; - } + int coilNum = GetHXCoilIndex(state, CoilType, CoilName, ErrorsFound); + return (coilNum == 0) ? 0 : state.dataHVACAssistedCC->HXAssistedCoils(coilNum).HXCoilOutNodeNum; } - std::string GetHXDXCoilType(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + int GetHXCoilIndex(EnergyPlusData &state, + std::string_view const coilType, + std::string const &coilName, + bool &ErrorsFound ) { - - // FUNCTION INFORMATION: - // AUTHOR R. Raustad, FSEC - // DATE WRITTEN September 2015 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the cooling coil type. If - // incorrect coil type or name is given, ErrorsFound is returned as true and the name - // is returned as blank - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input + if (state.dataHVACAssistedCC->GetCoilsInputFlag) { GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine + state.dataHVACAssistedCC->GetCoilsInputFlag = false; } - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } + int coilNum = (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) ? + Util::FindItem(coilName, state.dataHVACAssistedCC->HXAssistedCoils) : 0; - if (WhichCoil != 0) { - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType; - } else { - ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); + if (coilNum == 0) { + ShowSevereError(state, format("GetHXCoilIndex: Could not find Coil, Type=\"{}\" Name=\"{}", coilType, coilName)); ErrorsFound = true; - return ""; - } - } - - std::string GetHXDXCoilName(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) - { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN February 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the cooling coil name. If - // incorrect coil type or name is given, ErrorsFound is returned as true and the name - // is returned as blank - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine } - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil != 0) { - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName; - } else { - ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return ""; - } + return coilNum; } - - int GetActualDXCoilIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + + HVAC::CoilType GetHXCoilCoolCoilType(EnergyPlusData &state, + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN February 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the cooling coil name. If - // incorrect coil type or name is given, ErrorsFound is returned as true and the name - // is returned as blank - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil != 0) { - // this should be the index to the DX cooling coil object, not the HXAssisted object - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilIndex; - } else { - ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return 0; - } + assert(coilNum > 0 && coilNum < state.dataHVACAssistedCC->HXAssistedCoils.size()); + return state.dataHVACAssistedCC->HXAssistedCoils(coilNum).coolCoilType; } - std::string GetHXCoilType(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + std::string GetHXCoilCoolCoilName(EnergyPlusData &state, + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Fred Buhl - // DATE WRITTEN June 2009 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the cooling coil type. If - // incorrect coil type or name is given, ErrorsFound is returned as true and the cooling - // coil type is returned as blank. - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil != 0) { - return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType; - } else { - ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return ""; - } + assert(coilNum > 0 && coilNum < state.dataHVACAssistedCC->HXAssistedCoils.size()); + return state.dataHVACAssistedCC->HXAssistedCoils(coilNum).CoolCoilName; } - void GetHXCoilTypeAndName(EnergyPlusData &state, - HVAC::CoilType coilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - HVAC::CoilType &hxCoilType, // returned type of cooling coil - std::string &hxCoilName // returned name of cooling coil - ) + int GetHXCoilCoolCoilIndex(EnergyPlusData &state, + int const coilNum) { - - // SUBROUTINE INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN Oct 2011 - - // PURPOSE OF THIS SUBROUTINE: - // Need to get child coil type and name. - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - int WhichCoil = 0; - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - hxCoilType = HVAC::CoilType::Invalid; - hxCoilName = ""; - return; - } - - auto &coil = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil); - if (coil.coilType != coilType) { - ShowSevereError(state, format("Coil \"{}\" has unexpected type {}.", CoilName, HVAC::coilTypeNames[(int)coil.coilType])); - ErrorsFound = true; - hxCoilType = HVAC::CoilType::Invalid; - hxCoilName = ""; - return; - } - - hxCoilType = coil.CoolingCoilType; - hxCoilName = coil.CoolingCoilName; + assert(coilNum > 0 && coilNum < state.dataHVACAssistedCC->HXAssistedCoils.size()); + return state.dataHVACAssistedCC->HXAssistedCoils(coilNum).CoolCoilNum; } - - Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + + Real64 GetHXCoilMaxWaterFlowRate(EnergyPlusData &state, + int const coilNum ) { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN November 2006 - // MODIFIED R. Raustad, April 2009 - added water coil ELSE IF - - // PURPOSE OF THIS FUNCTION: - // This function looks up the max water flow rate for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned - // as negative. - - // Return value - Real64 MaxWaterFlowRate; // returned max water flow rate of matched coil - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - - int WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - - if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted")) { - if (WhichCoil != 0) { - // coil does not specify MaxWaterFlowRate - MaxWaterFlowRate = 0.0; - ShowRecurringWarningErrorAtEnd(state, - "Requested Max Water Flow Rate from CoilSystem:Cooling:DX:HeatExchangerAssisted N/A", - state.dataHVACAssistedCC->ErrCount2); - } - } else if (Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) { - if (WhichCoil != 0) { - MaxWaterFlowRate = - WaterCoils::GetCoilMaxWaterFlowRate(state, CoilType, GetHXDXCoilName(state, CoilType, CoilName, ErrorsFound), ErrorsFound); - } - } else { - WhichCoil = 0; - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("GetCoilMaxWaterFlowRate: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - MaxWaterFlowRate = -1000.0; - } - } else { - ShowSevereError(state, format("GetCoilMaxWaterFlowRate: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - MaxWaterFlowRate = -1000.0; - } - - return MaxWaterFlowRate; + assert(coilNum > 0 && coilNum < state.dataHVACAssistedCC->HXAssistedCoils.size()); + return state.dataHVACAssistedCC->HXAssistedCoils(coilNum).MaxWaterFlowRate; } - Real64 GetHXCoilAirFlowRate(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + Real64 GetHXCoilMaxAirFlowRate(EnergyPlusData &state, + int const coilNum ) { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN September 2013 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the max air flow rate for the given HX and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned - // as negative. - - // Return value - Real64 MaxAirFlowRate; // returned max air flow rate of matched HX - - // Obtains and allocates HXAssistedCoolingCoil related parameters from input file - if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data - // Get the HXAssistedCoolingCoil input - GetHXAssistedCoolingCoilInput(state); - state.dataHVACAssistedCC->GetCoilsInputFlag = - false; // Set logic flag to disallow getting the input data on future calls to this subroutine - } - - if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - - int WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil); - - if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted") || - Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) { - if (WhichCoil != 0) { - MaxAirFlowRate = - HeatRecovery::GetSupplyAirFlowRate(state, state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HeatExchangerName, ErrorsFound); - } - } else { - WhichCoil = 0; - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("GetHXCoilAirFlowRate: Could not find HX, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - MaxAirFlowRate = -1000.0; - } - } else { - ShowSevereError(state, format("GetHXCoilAirFlowRate: Could not find HX, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - MaxAirFlowRate = -1000.0; - } - - return MaxAirFlowRate; + assert(coilNum > 0 && coilNum < state.dataHVACAssistedCC->HXAssistedCoils.size()); + return state.dataHVACAssistedCC->HXAssistedCoils(coilNum).MaxAirFlowRate; } bool VerifyHeatExchangerParent(EnergyPlusData &state, @@ -1783,11 +1161,11 @@ namespace HVACHXAssistedCoolingCoil { int WhichCoil = 0; if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { - WhichCoil = Util::FindItem(HXName, state.dataHVACAssistedCC->HXAssistedCoil, &HXAssistedCoilParameters::HeatExchangerName); + WhichCoil = Util::FindItem(HXName, state.dataHVACAssistedCC->HXAssistedCoils, &HXAssistedCoilParameters::HeatExchangerName); } if (WhichCoil != 0) { - if (Util::SameString(HVAC::hxTypeNames[(int)state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).hxType], HXType)) { + if (Util::SameString(HVAC::hxTypeNames[(int)state.dataHVACAssistedCC->HXAssistedCoils(WhichCoil).hxType], HXType)) { return true; } } diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh index a5f78c6ebd4..4f7cfc89b6c 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh @@ -67,37 +67,46 @@ namespace HVACHXAssistedCoolingCoil { struct HXAssistedCoilParameters { // Members - std::string HXAssistedCoilType; // Type of HXAssistedCoolingCoil - int HXAssistedCoilType_Num; // Numeric equivalent for hx assisted coil std::string Name; // Name of the HXAssistedCoolingCoil - std::string CoolingCoilType; // Cooling coil type must be DetailedFlatCooling - // or Coil:DX:CoolingBypassFactorEmpirical - int CoolingCoilType_Num; // Numeric Equivalent for cooling coil - std::string CoolingCoilName; // Cooling coil name - int CoolingCoilIndex; + HVAC::CoilType hxCoilType = HVAC::CoilType::Invalid; // coilType of the parent object + int HXCoilInNodeNum = 0; // Inlet node to HXAssistedCoolingCoil compound object + int HXCoilOutNodeNum = 0; // Outlet node to HXAssistedCoolingCoil compound object + + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; // Must be DetailedFlatCooling Coil:DX:CoolingBypassFactorEmpirical + std::string CoolCoilName; // Cooling coil name + int CoolCoilNum = 0; + + int CoolCoilCondenserNodeNum = 0; + int CoolCoilWaterInNodeNum = 0; + int CoolCoilInNodeNum = 0; + int CoolCoilOutNodeNum = 0; + int DXCoilNumOfSpeeds; // number of speed levels for variable speed DX coil // Heat Exchanger type must be HeatExchanger:AirToAir:FlatPlate, // HeatExchanger:AirToAir:SensibleAndLatent or // HeatExchanger:Desiccant:BalancedFlow + + Real64 Capacity = 0.0; + HVAC::HXType hxType = HVAC::HXType::Invalid; // Numeric Equivalent for heat exchanger std::string HeatExchangerName; // Heat Exchanger name - int HeatExchangerIndex; // Heat Exchanger index - int HXAssistedCoilInletNodeNum; // Inlet node to HXAssistedCoolingCoil compound object - int HXAssistedCoilOutletNodeNum; // Outlet node to HXAssistedCoolingCoil compound object - int HXExhaustAirInletNodeNum; // Inlet node number for air-to-air heat exchanger - Real64 MassFlowRate; // Mass flow rate through HXAssistedCoolingCoil compound object - int MaxIterCounter; // used in warning messages - int MaxIterIndex; // used in warning messages - int ControllerIndex; // index to water coil controller - std::string ControllerName; // name of water coil controller - - // Default Constructor - HXAssistedCoilParameters() - : HXAssistedCoilType_Num(0), CoolingCoilType_Num(0), CoolingCoilIndex(0), DXCoilNumOfSpeeds(0), HeatExchangerIndex(0), - HXAssistedCoilInletNodeNum(0), HXAssistedCoilOutletNodeNum(0), HXExhaustAirInletNodeNum(0), MassFlowRate(0.0), MaxIterCounter(0), - MaxIterIndex(0), ControllerIndex(0) - { - } + int HeatExchangerNum = 0; // Heat Exchanger index + + int SupplyAirInNodeNum = 0; + int SupplyAirOutNodeNum = 0; + int SecAirInNodeNum = 0; + int SecAirOutNodeNum = 0; + + int HXCoilExhaustAirInNodeNum = 0; // Inlet node number for air-to-air heat exchanger + + Real64 MassFlowRate = 0.0; // Mass flow rate through HXAssistedCoolingCoil compound object + int MaxIterCounter = 0; // used in warning messages + int MaxIterIndex = 0; // used in warning messages + int ControllerIndex = 0; // index to water coil controller + std::string ControllerName = 0; // name of water coil controller + + Real64 MaxWaterFlowRate = 0.0; + Real64 MaxAirFlowRate = 0.0; }; void @@ -134,100 +143,70 @@ namespace HVACHXAssistedCoolingCoil { [[maybe_unused]] ObjexxFCL::Optional LoadSHR = _ // Optional coil SHR pass over ); - void GetHXDXCoilIndex(EnergyPlusData &state, - std::string const &HXDXCoilName, - int &HXDXCoilIndex, - bool &ErrorsFound, - std::string_view const CurrentModuleObject = {}); + int GetHXCoilIndex(EnergyPlusData &state, + std::string_view const coilType, + std::string const &coilName, + bool &ErrorsFound); + + Real64 GetHXCoilCapacity(EnergyPlusData &state, + std::string_view const coilType, + std::string const &coilName, + bool &ErrorsFound); - void CheckHXAssistedCoolingCoilSchedule(EnergyPlusData &state, - std::string const &CompType, // unused1208 - std::string_view CompName, - Real64 &Value, - int &CompIndex); + HVAC::CoilType GetHXCoilCoolCoilType(EnergyPlusData &state, + std::string_view const coilType, + std::string const &coilName, + bool &ErrorsFound); - Real64 GetCoilCapacity(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + std::string GetHXCoilCoolCoilName(EnergyPlusData &state, + std::string_view const coilType, + std::string const &coilName, + bool &ErrorsFound); - int GetCoilGroupTypeNum(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - bool const PrintWarning = true // prints warning message if true - ); + int GetHXCoilCoolCoilIndex(EnergyPlusData &state, + std::string_view const coilType, + std::string const &coilName, + bool &ErrorsFound); + + int GetHXCoilInletNode(EnergyPlusData &state, std::string_view const coilType, std::string const &coilName, bool &ErrorsFound); - int GetCoilObjectTypeNum(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - bool const PrintWarning = true // prints warning message if true - ); + int GetHXCoilOutletNode(EnergyPlusData &state, std::string_view const coilType, std::string const &coilName, bool &ErrorsFound); - int GetCoilInletNode(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + int GetHXCoilCondenserInletNode(EnergyPlusData &state, std::string_view const coilType, std::string const &coilName, bool &ErrorsFound); + + Real64 GetHXCoilMaxWaterFlowRate(EnergyPlusData &state, std::string_view const coilType, std::string const &coilName, bool &ErrorsFound); - int GetCoilWaterInletNode(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + Real64 GetHXCoilAirFlowRate(EnergyPlusData &state, std::string_view const coilType, std::string const &coilName, bool &ErrorsFound); - int GetCoilOutletNode(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + void CheckHXAssistedCoolingCoilSchedule(EnergyPlusData &state, + std::string_view const compType, // unused1208 + std::string const &compName, + Real64 &Value, + int &CompIndex); - std::string GetHXDXCoilType(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + // New API + int GetHXCoilIndex(EnergyPlusData &state, std::string const &coilName); - std::string GetHXDXCoilName(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + HVAC::CoilType GetHXCoilCoolCoilType(EnergyPlusData &state, int const coilNum); - int GetActualDXCoilIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + std::string GetHXCoilCoolCoilName(EnergyPlusData &state, int const coilNum); - std::string GetHXCoilType(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + int GetHXCoilCoolCoilIndex(EnergyPlusData &state, int const coilNum); - void GetHXCoilTypeAndName(EnergyPlusData &state, - HVAC::CoilType coilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - HVAC::CoilType &hxCoilType, // returned type of cooling coil - std::string &hxCoilName // returned name of cooling coil - ); + Real64 GetHXCoilCapacity(EnergyPlusData &state, int const coilNum); - Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + int GetHXCoilInletNode(EnergyPlusData &state, int const coilNum); + + int GetHXCoilOutletNode(EnergyPlusData &state, int const coilNum); - Real64 GetHXCoilAirFlowRate(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ); + int GetHXCoilCondenserInletNode(EnergyPlusData &state, int coilNum); + + int GetHXCoilWaterInletNode(EnergyPlusData &state, int const coilNum); + + int GetHXCoilWaterOutletNode(EnergyPlusData &state, int const coilNum); + Real64 GetHXCoilMaxWaterFlowRate(EnergyPlusData &state, int coilNum); + bool VerifyHeatExchangerParent(EnergyPlusData &state, std::string const &HXType, // must match coil types in this module std::string const &HXName // must match coil names for the coil type @@ -242,7 +221,7 @@ struct HVACHXAssistedCoolingCoilData : BaseGlobalStruct Array1D HXAssistedCoilOutletHumRat; // Outlet humidity ratio from this compound object bool GetCoilsInputFlag = true; // Flag to allow input data to be retrieved from idf on first call to this subroutine Array1D_bool CheckEquipName; - Array1D HXAssistedCoil; + Array1D HXAssistedCoils; std::unordered_map UniqueHXAssistedCoilNames; Real64 CoilOutputTempLast; // Exiting cooling coil temperature from last iteration int ErrCount = 0; @@ -259,7 +238,7 @@ struct HVACHXAssistedCoolingCoilData : BaseGlobalStruct this->HXAssistedCoilOutletHumRat.clear(); this->GetCoilsInputFlag = true; this->CheckEquipName.clear(); - this->HXAssistedCoil.clear(); + this->HXAssistedCoils.clear(); this->UniqueHXAssistedCoilNames.clear(); this->ErrCount = 0; this->ErrCount2 = 0; diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index f65ce5b40b5..a26a5d9e13b 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -1717,7 +1717,7 @@ void SimHVAC(EnergyPlusData &state) state.dataHVACGlobal->DoSetPointTest = false; } - if (state.dataCoilCooingDX->stillNeedToReportStandardRatings) { + if (state.dataCoilCoolingDX->stillNeedToReportStandardRatings) { if (!state.dataGlobal->WarmupFlag) { CoilCoolingDX::reportAllStandardRatings(state); } diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc index 48859945f33..d8011e59684 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc @@ -217,8 +217,6 @@ namespace HVACMultiSpeedHeatPump { Real64 PartLoadFrac; // compressor part load fraction Real64 SpeedRatio; // compressor speed ratio bool UnitOn; // TRUE if unit is on - int OutletNode; // MSHP air outlet node - int InletNode; // MSHP air inlet node Real64 AirMassFlow; // air mass flow rate [kg/s] HVAC::FanOp fanOp; // operating mode (fan cycling or continuous; DX coil always cycles) int ZoneNum; // Controlled zone number @@ -228,32 +226,32 @@ namespace HVACMultiSpeedHeatPump { Real64 SaveMassFlowRate; // saved inlet air mass flow rate [kg/s] // zero the fan, DX coils, and supplemental electric heater electricity consumption - state.dataHVACGlobal->DXElecHeatingPower = 0.0; + + // Why are these state variables? + state.dataHVACGlobal->DXElecHeatingPower = 0.0; state.dataHVACGlobal->DXElecCoolingPower = 0.0; state.dataHVACMultiSpdHP->SaveCompressorPLR = 0.0; state.dataHVACGlobal->ElecHeatingCoilPower = 0.0; state.dataHVACGlobal->SuppHeatingCoilPower = 0.0; state.dataHVACGlobal->DefrostElecPower = 0.0; - auto &multiSpeedHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); // initialize local variables UnitOn = true; - OutletNode = multiSpeedHeatPump.AirOutletNodeNum; - InletNode = multiSpeedHeatPump.AirInletNodeNum; - AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; - fanOp = multiSpeedHeatPump.fanOp; - ZoneNum = multiSpeedHeatPump.ControlZoneNum; + AirMassFlow = state.dataLoopNodes->Node(mshp.AirInletNode).MassFlowRate; + fanOp = mshp.fanOp; + ZoneNum = mshp.ControlZoneNum; compressorOp = HVAC::CompressorOp::On; // set the on/off flags - if (multiSpeedHeatPump.fanOp == HVAC::FanOp::Cycling) { + if (mshp.fanOp == HVAC::FanOp::Cycling) { // cycling unit only runs if there is a cooling or heating load. if (std::abs(QZnReq) < HVAC::SmallLoad || AirMassFlow < HVAC::SmallMassFlow || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { UnitOn = false; } - } else if (multiSpeedHeatPump.fanOp == HVAC::FanOp::Continuous) { + } else if (mshp.fanOp == HVAC::FanOp::Continuous) { // continuous unit: fan runs if scheduled on; coil runs only if there is a cooling or heating load if (AirMassFlow < HVAC::SmallMassFlow) { UnitOn = false; @@ -262,11 +260,11 @@ namespace HVACMultiSpeedHeatPump { state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; - SaveMassFlowRate = state.dataLoopNodes->Node(InletNode).MassFlowRate; - if (multiSpeedHeatPump.EMSOverrideCoilSpeedNumOn) { - Real64 SpeedVal = multiSpeedHeatPump.EMSOverrideCoilSpeedNumValue; + SaveMassFlowRate = state.dataLoopNodes->Node(mshp.AirInletNode).MassFlowRate; + if (mshp.EMSOverrideCoilSpeedNumOn) { + Real64 SpeedVal = mshp.EMSOverrideCoilSpeedNumValue; - if (!FirstHVACIteration && multiSpeedHeatPump.fanOp == HVAC::FanOp::Cycling && QZnReq < 0.0 && + if (!FirstHVACIteration && mshp.fanOp == HVAC::FanOp::Cycling && QZnReq < 0.0 && state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive) { compressorOp = HVAC::CompressorOp::Off; ControlMSHPOutputEMS(state, @@ -281,8 +279,8 @@ namespace HVACMultiSpeedHeatPump { PartLoadFrac, OnOffAirFlowRatio, SupHeaterLoad); - if (ceil(SpeedVal) == multiSpeedHeatPump.NumOfSpeedCooling && SpeedRatio == 1.0) { - state.dataLoopNodes->Node(InletNode).MassFlowRate = SaveMassFlowRate; + if (ceil(SpeedVal) == mshp.NumOfSpeedCooling && SpeedRatio == 1.0) { + state.dataLoopNodes->Node(mshp.AirInletNode).MassFlowRate = SaveMassFlowRate; compressorOp = HVAC::CompressorOp::On; ControlMSHPOutputEMS(state, MSHeatPumpNum, @@ -312,7 +310,7 @@ namespace HVACMultiSpeedHeatPump { SupHeaterLoad); } } else { - if (!FirstHVACIteration && multiSpeedHeatPump.fanOp == HVAC::FanOp::Cycling && QZnReq < 0.0 && + if (!FirstHVACIteration && mshp.fanOp == HVAC::FanOp::Cycling && QZnReq < 0.0 && state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoActive) { // for cycling fan, cooling load, check whether furnace can meet load with compressor off compressorOp = HVAC::CompressorOp::Off; @@ -328,9 +326,9 @@ namespace HVACMultiSpeedHeatPump { PartLoadFrac, OnOffAirFlowRatio, SupHeaterLoad); - if (SpeedNum == multiSpeedHeatPump.NumOfSpeedCooling && SpeedRatio == 1.0) { + if (SpeedNum == mshp.NumOfSpeedCooling && SpeedRatio == 1.0) { // compressor on (reset inlet air mass flow rate to starting value) - state.dataLoopNodes->Node(InletNode).MassFlowRate = SaveMassFlowRate; + state.dataLoopNodes->Node(mshp.AirInletNode).MassFlowRate = SaveMassFlowRate; compressorOp = HVAC::CompressorOp::On; ControlMSHPOutput(state, MSHeatPumpNum, @@ -362,14 +360,14 @@ namespace HVACMultiSpeedHeatPump { } } - if (multiSpeedHeatPump.HeatCoilType != MultiSpeedHeatingCoil) { + if (mshp.heatCoilType != HVAC::CoilType::DXMultiSpeedHeating) { state.dataHVACMultiSpdHP->SaveCompressorPLR = PartLoadFrac; } else { if (SpeedNum > 1) { state.dataHVACMultiSpdHP->SaveCompressorPLR = 1.0; } - if (PartLoadFrac == 1.0 && state.dataHVACMultiSpdHP->SaveCompressorPLR < 1.0 && (!multiSpeedHeatPump.Staged)) { + if (PartLoadFrac == 1.0 && state.dataHVACMultiSpdHP->SaveCompressorPLR < 1.0 && (!mshp.Staged)) { PartLoadFrac = state.dataHVACMultiSpdHP->SaveCompressorPLR; } } @@ -387,59 +385,59 @@ namespace HVACMultiSpeedHeatPump { SupHeaterLoad); // calculate delivered capacity - AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; + AirMassFlow = state.dataLoopNodes->Node(mshp.AirInletNode).MassFlowRate; - QTotUnitOut = AirMassFlow * (state.dataLoopNodes->Node(OutletNode).Enthalpy - - state.dataLoopNodes->Node(multiSpeedHeatPump.NodeNumOfControlledZone).Enthalpy); + QTotUnitOut = AirMassFlow * (state.dataLoopNodes->Node(mshp.AirOutletNode).Enthalpy - + state.dataLoopNodes->Node(mshp.NodeNumOfControlledZone).Enthalpy); // report variables - multiSpeedHeatPump.CompPartLoadRatio = state.dataHVACMultiSpdHP->SaveCompressorPLR; - if (multiSpeedHeatPump.fanOp == HVAC::FanOp::Cycling) { + mshp.CompPartLoadRatio = state.dataHVACMultiSpdHP->SaveCompressorPLR; + if (mshp.fanOp == HVAC::FanOp::Cycling) { if (SupHeaterLoad > 0.0) { - multiSpeedHeatPump.FanPartLoadRatio = 1.0; + mshp.FanPartLoadRatio = 1.0; } else { if (SpeedNum < 2) { - multiSpeedHeatPump.FanPartLoadRatio = PartLoadFrac; + mshp.FanPartLoadRatio = PartLoadFrac; } else { - multiSpeedHeatPump.FanPartLoadRatio = 1.0; + mshp.FanPartLoadRatio = 1.0; } } } else { if (UnitOn) { - multiSpeedHeatPump.FanPartLoadRatio = 1.0; + mshp.FanPartLoadRatio = 1.0; } else { if (SpeedNum < 2) { - multiSpeedHeatPump.FanPartLoadRatio = PartLoadFrac; + mshp.FanPartLoadRatio = PartLoadFrac; } else { - multiSpeedHeatPump.FanPartLoadRatio = 1.0; + mshp.FanPartLoadRatio = 1.0; } } } - if (multiSpeedHeatPump.HeatCoolMode == ModeOfOperation::HeatingMode) { - multiSpeedHeatPump.TotHeatEnergyRate = std::abs(max(0.0, QTotUnitOut)); - multiSpeedHeatPump.SensHeatEnergyRate = std::abs(max(0.0, QSensUnitOut)); - multiSpeedHeatPump.LatHeatEnergyRate = std::abs(max(0.0, (QTotUnitOut - QSensUnitOut))); - multiSpeedHeatPump.TotCoolEnergyRate = 0.0; - multiSpeedHeatPump.SensCoolEnergyRate = 0.0; - multiSpeedHeatPump.LatCoolEnergyRate = 0.0; + if (mshp.HeatCoolMode == ModeOfOperation::HeatingMode) { + mshp.TotHeatEnergyRate = std::abs(max(0.0, QTotUnitOut)); + mshp.SensHeatEnergyRate = std::abs(max(0.0, QSensUnitOut)); + mshp.LatHeatEnergyRate = std::abs(max(0.0, (QTotUnitOut - QSensUnitOut))); + mshp.TotCoolEnergyRate = 0.0; + mshp.SensCoolEnergyRate = 0.0; + mshp.LatCoolEnergyRate = 0.0; } - if (multiSpeedHeatPump.HeatCoolMode == ModeOfOperation::CoolingMode) { - multiSpeedHeatPump.TotCoolEnergyRate = std::abs(min(0.0, QTotUnitOut)); - multiSpeedHeatPump.SensCoolEnergyRate = std::abs(min(0.0, QSensUnitOut)); - multiSpeedHeatPump.LatCoolEnergyRate = std::abs(min(0.0, (QTotUnitOut - QSensUnitOut))); - multiSpeedHeatPump.TotHeatEnergyRate = 0.0; - multiSpeedHeatPump.SensHeatEnergyRate = 0.0; - multiSpeedHeatPump.LatHeatEnergyRate = 0.0; + if (mshp.HeatCoolMode == ModeOfOperation::CoolingMode) { + mshp.TotCoolEnergyRate = std::abs(min(0.0, QTotUnitOut)); + mshp.SensCoolEnergyRate = std::abs(min(0.0, QSensUnitOut)); + mshp.LatCoolEnergyRate = std::abs(min(0.0, (QTotUnitOut - QSensUnitOut))); + mshp.TotHeatEnergyRate = 0.0; + mshp.SensHeatEnergyRate = 0.0; + mshp.LatHeatEnergyRate = 0.0; } - multiSpeedHeatPump.AuxElecPower = multiSpeedHeatPump.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR + - multiSpeedHeatPump.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR); + mshp.AuxElecPower = mshp.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR + + mshp.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR); Real64 locFanElecPower = 0.0; - locFanElecPower = state.dataFans->fans(multiSpeedHeatPump.FanNum)->totalPower; - multiSpeedHeatPump.ElecPower = locFanElecPower + state.dataHVACGlobal->DXElecCoolingPower + state.dataHVACGlobal->DXElecHeatingPower + + locFanElecPower = state.dataFans->fans(mshp.FanNum)->totalPower; + mshp.ElecPower = locFanElecPower + state.dataHVACGlobal->DXElecCoolingPower + state.dataHVACGlobal->DXElecHeatingPower + state.dataHVACGlobal->ElecHeatingCoilPower + state.dataHVACGlobal->SuppHeatingCoilPower + - state.dataHVACGlobal->DefrostElecPower + multiSpeedHeatPump.AuxElecPower; + state.dataHVACGlobal->DefrostElecPower + mshp.AuxElecPower; } //****************************************************************************** @@ -484,9 +482,9 @@ namespace HVACMultiSpeedHeatPump { bool errFlag; Real64 SteamDensity; // density of steam at 100C - auto &MSHeatPump(state.dataHVACMultiSpdHP->MSHeatPump); + auto &s_node = state.dataLoopNodes; - if (MSHeatPump.allocated()) return; + if (state.dataHVACMultiSpdHP->MSHeatPump.allocated()) return; state.dataHVACMultiSpdHP->CurrentModuleObject = "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed"; // Object type for getting and error messages @@ -512,20 +510,14 @@ namespace HVACMultiSpeedHeatPump { } // ALLOCATE ARRAYS - MSHeatPump.allocate(state.dataHVACMultiSpdHP->NumMSHeatPumps); + state.dataHVACMultiSpdHP->MSHeatPump.allocate(state.dataHVACMultiSpdHP->NumMSHeatPumps); state.dataHVACMultiSpdHP->MSHeatPumpReport.allocate(state.dataHVACMultiSpdHP->NumMSHeatPumps); state.dataHVACMultiSpdHP->CheckEquipName.dimension(state.dataHVACMultiSpdHP->NumMSHeatPumps, true); // Load arrays with reformulated electric EIR chiller data for (int MSHPNum = 1; MSHPNum <= state.dataHVACMultiSpdHP->NumMSHeatPumps; ++MSHPNum) { - auto &thisMSHP = MSHeatPump(MSHPNum); - int HeatingCoilInletNode = 0; - int HeatingCoilOutletNode = 0; - int CoolingCoilInletNode = 0; - int CoolingCoilOutletNode = 0; - int SuppHeatCoilInletNode = 0; - int SuppHeatCoilOutletNode = 0; - + auto &thisMSHP = state.dataHVACMultiSpdHP->MSHeatPump(MSHPNum); + state.dataInputProcessing->inputProcessor->getObjectItem(state, state.dataHVACMultiSpdHP->CurrentModuleObject, MSHPNum, @@ -556,9 +548,7 @@ namespace HVACMultiSpeedHeatPump { } } - thisMSHP.AirInletNodeName = Alphas(3); - thisMSHP.AirOutletNodeName = Alphas(4); - thisMSHP.AirInletNodeNum = GetOnlySingleNode(state, + thisMSHP.AirInletNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed, @@ -568,7 +558,7 @@ namespace HVACMultiSpeedHeatPump { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisMSHP.AirOutletNodeNum = GetOnlySingleNode(state, + thisMSHP.AirOutletNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed, @@ -699,520 +689,195 @@ namespace HVACMultiSpeedHeatPump { } } - if (Util::SameString(Alphas(10), "Coil:Heating:DX:MultiSpeed")) { - thisMSHP.HeatCoilType = MultiSpeedHeatingCoil; - thisMSHP.HeatCoilNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Coil:Heating:DX:MultiSpeed", Alphas(11)); - thisMSHP.DXHeatCoilName = Alphas(11); - if (thisMSHP.HeatCoilNum <= 0) { - ShowSevereError(state, format("Configuration error in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("{} \"{}\" not found.", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("{} must be Coil:Heating:DX:MultiSpeed ", cAlphaFields(10))); - ShowFatalError(state, - format("{}Errors found in getting {} input. Preceding condition(s) causes termination.", - RoutineName, - state.dataHVACMultiSpdHP->CurrentModuleObject)); - ErrorsFound = true; - } - LocalError = false; - DXCoils::GetDXCoilIndex(state, thisMSHP.DXHeatCoilName, thisMSHP.DXHeatCoilIndex, LocalError, "Coil:Heating:DX:MultiSpeed"); - if (LocalError) { - ShowSevereError(state, format("The index of {} is not found \"{}\"", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - HeatingCoilInletNode = DXCoils::GetCoilInletNode(state, Alphas(10), Alphas(11), LocalError); - if (LocalError) { - ShowSevereError(state, format("The inlet node number of {} is not found \"{}\"", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - HeatingCoilOutletNode = DXCoils::GetCoilOutletNode(state, Alphas(10), Alphas(11), LocalError); - if (LocalError) { - ShowSevereError(state, format("The outlet node number of {} is not found \"{}\"", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); + thisMSHP.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(10))); + thisMSHP.HeatCoilName = Alphas(11); + + if (thisMSHP.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { + thisMSHP.HeatCoilNum = DXCoils::GetDXCoilIndex(state, thisMSHP.HeatCoilName); + if (thisMSHP.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), thisMSHP.HeatCoilName); ErrorsFound = true; - LocalError = false; - } - thisMSHP.MinOATCompressorHeating = DXCoils::GetMinOATCompressor(state, thisMSHP.DXHeatCoilIndex, LocalError); - if (LocalError) { - ShowContinueError(state, - format("...for heating coil. Occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - LocalError = false; - } - BranchNodeConnections::SetUpCompSets(state, - state.dataHVACMultiSpdHP->CurrentModuleObject, - thisMSHP.Name, - "Coil:Heating:DX:MultiSpeed", - thisMSHP.DXHeatCoilName, - "UNDEFINED", - "UNDEFINED"); - } else if (Util::SameString(Alphas(10), "Coil:Heating:Electric:MultiStage") || - Util::SameString(Alphas(10), "Coil:Heating:Gas:MultiStage")) { - - if (Util::SameString(Alphas(10), "Coil:Heating:Electric:MultiStage")) { - thisMSHP.HeatCoilType = HVAC::Coil_HeatingElectric_MultiStage; - thisMSHP.HeatCoilNum = - state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Coil:Heating:Electric:MultiStage", Alphas(11)); - if (thisMSHP.HeatCoilNum <= 0) { - ShowSevereError(state, format("Configuration error in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("{} \"{}\" not found.", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("{} must be Coil:Heating:Electric:MultiStage ", cAlphaFields(10))); - ShowFatalError(state, - format("{}Errors found in getting {} input. Preceding condition(s) causes termination.", - RoutineName, - state.dataHVACMultiSpdHP->CurrentModuleObject)); - ErrorsFound = true; - } } else { - thisMSHP.HeatCoilType = HVAC::Coil_HeatingGas_MultiStage; - thisMSHP.HeatCoilNum = - state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Coil:Heating:Gas:MultiStage", Alphas(11)); - if (thisMSHP.HeatCoilNum <= 0) { - ShowSevereError(state, format("Configuration error in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("{} \"{}\" not found.", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("{} must be Coil:Heating:Gas:MultiStage ", cAlphaFields(10))); - ShowFatalError(state, - format("{}Errors found in getting {} input. Preceding condition(s) causes termination.", - RoutineName, - state.dataHVACMultiSpdHP->CurrentModuleObject)); - ErrorsFound = true; - } - } - thisMSHP.HeatCoilName = Alphas(11); - LocalError = false; - if (Util::SameString(Alphas(10), "Coil:Heating:Electric:MultiStage")) { - HeatingCoils::GetCoilIndex(state, thisMSHP.HeatCoilName, thisMSHP.HeatCoilIndex, LocalError); - } else { - HeatingCoils::GetCoilIndex(state, thisMSHP.HeatCoilName, thisMSHP.HeatCoilIndex, LocalError); - } - if (LocalError) { - ShowSevereError(state, format("The index of {} is not found \"{}\"", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - HeatingCoilInletNode = HeatingCoils::GetCoilInletNode(state, Alphas(10), Alphas(11), LocalError); - if (LocalError) { - ShowSevereError(state, format("The inlet node number of {} is not found \"{}\"", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - HeatingCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, Alphas(10), Alphas(11), LocalError); - if (LocalError) { - ShowSevereError(state, format("The outlet node number of {} is not found \"{}\"", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - if (Util::SameString(Alphas(10), "Coil:Heating:Electric:MultiStage")) { + thisMSHP.HeatCoilAirInletNode = DXCoils::GetCoilInletNode(state, thisMSHP.HeatCoilNum); + thisMSHP.HeatCoilAirOutletNode = DXCoils::GetCoilOutletNode(state, thisMSHP.HeatCoilNum); + + thisMSHP.MinOATCompressorHeating = DXCoils::GetMinOATCompressor(state, thisMSHP.HeatCoilNum); BranchNodeConnections::SetUpCompSets(state, state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, - "Coil:Heating:Electric:MultiStage", + "Coil:Heating:DX:MultiSpeed", thisMSHP.HeatCoilName, "UNDEFINED", "UNDEFINED"); + } + + } else if (thisMSHP.heatCoilType == HVAC::CoilType::HeatingElectricMultiStage || + thisMSHP.heatCoilType == HVAC::CoilType::HeatingGasMultiStage) { + + thisMSHP.HeatCoilNum = HeatingCoils::GetCoilIndex(state, thisMSHP.HeatCoilName); + if (thisMSHP.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), thisMSHP.HeatCoilName); + ErrorsFound = true; } else { + thisMSHP.HeatCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, thisMSHP.HeatCoilNum); + thisMSHP.HeatCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, thisMSHP.HeatCoilNum); + BranchNodeConnections::SetUpCompSets(state, state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, - "Coil:Heating:Gas:MultiStage", + HVAC::coilTypeNames[(int)thisMSHP.heatCoilType], thisMSHP.HeatCoilName, "UNDEFINED", "UNDEFINED"); } - } else if (Util::SameString(Alphas(10), "Coil:Heating:Water")) { - thisMSHP.HeatCoilType = HVAC::Coil_HeatingWater; - ValidateComponent(state, Alphas(10), Alphas(11), IsNotOK, state.dataHVACMultiSpdHP->CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); + + } else if (thisMSHP.heatCoilType == HVAC::CoilType::HeatingWater) { + // Get the Heating Coil water Inlet or control Node number + thisMSHP.HeatCoilNum = WaterCoils::GetWaterCoilIndex(state, thisMSHP.HeatCoilName); + if (thisMSHP.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), thisMSHP.HeatCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - thisMSHP.HeatCoilName = Alphas(11); - // Get the Heating Coil water Inlet or control Node number - errFlag = false; - thisMSHP.CoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", thisMSHP.HeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil hot water max volume flow rate - errFlag = false; - thisMSHP.MaxCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisMSHP.HeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the supplemental Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", thisMSHP.HeatCoilName, errFlag); - thisMSHP.CoilAirInletNode = HeatingCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } + } else { + thisMSHP.HeatCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, thisMSHP.HeatCoilNum); + thisMSHP.HeatCoilMaxFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, thisMSHP.HeatCoilNum); + thisMSHP.HeatCoilAirInletNode = WaterCoils::GetCoilInletNode(state, thisMSHP.HeatCoilNum); + thisMSHP.HeatCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, thisMSHP.HeatCoilNum); - // Get the supplemental Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", thisMSHP.HeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } BranchNodeConnections::SetUpCompSets(state, state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, - "Coil:Heating:Water", + HVAC::coilTypeNames[(int)thisMSHP.heatCoilType], thisMSHP.HeatCoilName, - state.dataLoopNodes->NodeID(HeatingCoilInletNode), - state.dataLoopNodes->NodeID(HeatingCoilOutletNode)); - } - } else if (Util::SameString(Alphas(10), "Coil:Heating:Steam")) { - thisMSHP.HeatCoilType = HVAC::Coil_HeatingSteam; - ValidateComponent(state, Alphas(10), Alphas(11), IsNotOK, state.dataHVACMultiSpdHP->CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); + s_node->NodeID(thisMSHP.HeatCoilAirInletNode), + s_node->NodeID(thisMSHP.HeatCoilAirOutletNode)); + } + + } else if (thisMSHP.heatCoilType == HVAC::CoilType::HeatingSteam) { + thisMSHP.HeatCoilNum = SteamCoils::GetSteamCoilIndex(state, thisMSHP.HeatCoilName); + if (thisMSHP.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), thisMSHP.HeatCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - thisMSHP.HeatCoilName = Alphas(11); - errFlag = false; - thisMSHP.HeatCoilNum = SteamCoils::GetSteamCoilIndex(state, Alphas(10), thisMSHP.HeatCoilName, errFlag); - if (thisMSHP.HeatCoilNum == 0) { - ShowSevereError( - state, - format("{} illegal {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, cAlphaFields(10), thisMSHP.HeatCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the supplemental Heating Coil steam inlet node number - errFlag = false; - thisMSHP.CoilControlNode = SteamCoils::GetCoilAirOutletNode(state, "Coil:Heating:Steam", thisMSHP.HeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the supplemental Heating Coil steam max volume flow rate - thisMSHP.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisMSHP.HeatCoilNum, errFlag); - if (thisMSHP.MaxCoilFluidFlow > 0.0) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, routineName); - thisMSHP.MaxCoilFluidFlow *= SteamDensity; + } else { + thisMSHP.HeatCoilControlNode = SteamCoils::GetCoilAirOutletNode(state, thisMSHP.HeatCoilNum); + thisMSHP.HeatCoilMaxFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisMSHP.HeatCoilNum); + if (thisMSHP.HeatCoilMaxFluidFlow > 0.0) { + thisMSHP.HeatCoilMaxFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, routineName); } // Get the supplemental Heating Coil Inlet Node - errFlag = false; - HeatingCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisMSHP.HeatCoilNum, thisMSHP.HeatCoilName, errFlag); - thisMSHP.CoilAirInletNode = HeatingCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the supplemental Heating Coil Outlet Node - errFlag = false; - HeatingCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisMSHP.HeatCoilNum, thisMSHP.HeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - + thisMSHP.HeatCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, thisMSHP.HeatCoilNum); + thisMSHP.HeatCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisMSHP.HeatCoilNum); BranchNodeConnections::SetUpCompSets(state, state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, - "Coil:Heating:Steam", + HVAC::coilTypeNames[(int)thisMSHP.heatCoilType], thisMSHP.HeatCoilName, - state.dataLoopNodes->NodeID(HeatingCoilInletNode), - state.dataLoopNodes->NodeID(HeatingCoilOutletNode)); + s_node->NodeID(thisMSHP.HeatCoilAirInletNode), + s_node->NodeID(thisMSHP.HeatCoilAirOutletNode)); } } else { - ShowSevereError(state, - format("The allowed {} are Coil:Heating:DX:MultiSpeed, Coil:Heating:Electric:MultiStage, and " - "Coil:Heating:Gas:MultiStage in {} \"{}\"", - cAlphaFields(10), - state.dataHVACMultiSpdHP->CurrentModuleObject, - Alphas(1))); - ShowContinueError(state, format("The entered {} = \"{}\".", cAlphaFields(10), Alphas(10))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(10), Alphas(10)); ErrorsFound = true; } // thisMSHP.MinOATCompressor = Numbers(1); // deprecated, now uses coil MinOAT inputs - if (Util::SameString(Alphas(12), "Coil:Cooling:DX:MultiSpeed")) { - thisMSHP.CoolCoilType = MultiSpeedCoolingCoil; - thisMSHP.DXCoolCoilName = Alphas(13); - if (state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Coil:Cooling:DX:MultiSpeed", Alphas(13)) <= 0) { - ShowSevereError(state, format("Configuration error in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("{} \"{}\" not found.", cAlphaFields(13), Alphas(13))); - ShowContinueError(state, format("{} must be Coil:Cooling:DX:MultiSpeed ", cAlphaFields(12))); - ShowFatalError(state, - format("{}Errors found in getting {} input. Preceding condition(s) causes termination.", - RoutineName, - state.dataHVACMultiSpdHP->CurrentModuleObject)); - ErrorsFound = true; - } - LocalError = false; - DXCoils::GetDXCoilIndex(state, thisMSHP.DXCoolCoilName, thisMSHP.DXCoolCoilIndex, LocalError, "Coil:Cooling:DX:MultiSpeed"); - if (LocalError) { - ShowSevereError(state, format("The index of {} is not found \"{}\"", cAlphaFields(13), Alphas(13))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - CoolingCoilInletNode = DXCoils::GetCoilInletNode(state, Alphas(12), Alphas(13), LocalError); - if (LocalError) { - ShowSevereError(state, format("The inlet node number of {} is not found \"{}\"", cAlphaFields(13), Alphas(13))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - CoolingCoilOutletNode = DXCoils::GetCoilOutletNode(state, Alphas(12), Alphas(13), LocalError); - if (LocalError) { - ShowSevereError(state, format("The outlet node number of {} is not found \"{}\"", cAlphaFields(13), Alphas(13))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); + thisMSHP.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(12))); + thisMSHP.CoolCoilName = Alphas(13); + + if (thisMSHP.coolCoilType == HVAC::CoilType::DXMultiSpeedCooling) { + + thisMSHP.CoolCoilNum = DXCoils::GetDXCoilIndex(state, thisMSHP.CoolCoilName); + if (thisMSHP.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), thisMSHP.CoolCoilName); ErrorsFound = true; - LocalError = false; - } - thisMSHP.MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, thisMSHP.DXCoolCoilIndex, LocalError); - if (LocalError) { - ShowContinueError(state, - format("...for cooling coil. Occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - LocalError = false; + } else { + thisMSHP.CoolCoilAirInletNode = DXCoils::GetCoilInletNode(state, thisMSHP.CoolCoilNum); + thisMSHP.CoolCoilAirOutletNode = DXCoils::GetCoilOutletNode(state, thisMSHP.CoolCoilNum); + thisMSHP.MinOATCompressorCooling = DXCoils::GetMinOATCompressor(state, thisMSHP.CoolCoilNum); + + BranchNodeConnections::SetUpCompSets(state, + state.dataHVACMultiSpdHP->CurrentModuleObject, + thisMSHP.Name, + HVAC::coilTypeNames[(int)thisMSHP.coolCoilType], + thisMSHP.CoolCoilName, + "UNDEFINED", + "UNDEFINED"); } } else { - ShowSevereError(state, - format("The allowed {} is Coil:Cooling:DX:MultiSpeed in {} \"{}\"", - cAlphaFields(12), - state.dataHVACMultiSpdHP->CurrentModuleObject, - Alphas(1))); - ShowContinueError(state, format("The entered {} = \"{}\".", cAlphaFields(12), Alphas(12))); + ShowSevereInvalidKey(state, eoh, cAlphaFields(12), Alphas(12)); ErrorsFound = true; } - BranchNodeConnections::SetUpCompSets(state, - state.dataHVACMultiSpdHP->CurrentModuleObject, - thisMSHP.Name, - "Coil:Cooling:DX:MultiSpeed", - thisMSHP.DXCoolCoilName, - "UNDEFINED", - "UNDEFINED"); // Get supplemental heating coil data + thisMSHP.suppHeatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(14))); thisMSHP.SuppHeatCoilName = Alphas(15); - if (Util::SameString(Alphas(14), "Coil:Heating:Fuel")) { - thisMSHP.SuppHeatCoilType = SuppHeatingCoilGas; - errFlag = false; - thisMSHP.SuppHeatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, "Coil:Heating:Fuel", Alphas(15), errFlag); - if (thisMSHP.SuppHeatCoilNum <= 0 || errFlag) { - ShowContinueError(state, format("Configuration error in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("{} of type Coil:Heating:Fuel \"{}\" not found.", cAlphaFields(15), Alphas(15))); + + if (thisMSHP.suppHeatCoilType == HVAC::CoilType::HeatingElectric || + thisMSHP.suppHeatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel) { + + thisMSHP.SuppHeatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, thisMSHP.SuppHeatCoilName); + if (thisMSHP.SuppHeatCoilNum) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), thisMSHP.SuppHeatCoilName); ErrorsFound = true; + } else { + thisMSHP.SuppHeatCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, thisMSHP.SuppHeatCoilNum); + thisMSHP.SuppHeatCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, thisMSHP.SuppHeatCoilNum); + thisMSHP.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, thisMSHP.SuppHeatCoilNum); + BranchNodeConnections::SetUpCompSets(state, + state.dataHVACMultiSpdHP->CurrentModuleObject, + thisMSHP.Name, + HVAC::coilTypeNames[(int)thisMSHP.suppHeatCoilType], + thisMSHP.SuppHeatCoilName, + "UNDEFINED", + "UNDEFINED"); } - - // Get the Supplemental Heating Coil Node Numbers - LocalError = false; - SuppHeatCoilInletNode = HeatingCoils::GetCoilInletNode(state, Alphas(14), Alphas(15), LocalError); - if (LocalError) { - ShowSevereError(state, format("The inlet node number of {} is not found \"{}\"", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - SuppHeatCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, Alphas(14), Alphas(15), LocalError); - if (LocalError) { - ShowSevereError(state, format("The outlet node number of {} is not found \"{}\"", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - - // Get supplemental heating coil capacity to see if it is autosize - thisMSHP.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, Alphas(14), Alphas(15), LocalError); - if (LocalError) { - ShowSevereError(state, format("The capacity {} is not found \"{}\"", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - BranchNodeConnections::SetUpCompSets(state, - state.dataHVACMultiSpdHP->CurrentModuleObject, - thisMSHP.Name, - "Coil:Heating:Fuel", - thisMSHP.SuppHeatCoilName, - "UNDEFINED", - "UNDEFINED"); - } - if (Util::SameString(Alphas(14), "Coil:Heating:Electric")) { - thisMSHP.SuppHeatCoilType = SuppHeatingCoilElec; - errFlag = false; - thisMSHP.SuppHeatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, "Coil:Heating:Electric", Alphas(15), errFlag); - if (thisMSHP.SuppHeatCoilNum <= 0 || errFlag) { - ShowContinueError(state, format("Configuration error in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("{} of type Coil:Heating:Electric \"{}\" not found.", cAlphaFields(15), Alphas(15))); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Node Numbers - LocalError = false; - SuppHeatCoilInletNode = HeatingCoils::GetCoilInletNode(state, Alphas(14), Alphas(15), LocalError); - if (LocalError) { - ShowSevereError(state, format("The inlet node number of {} is not found \"{}\"", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - SuppHeatCoilOutletNode = HeatingCoils::GetCoilOutletNode(state, Alphas(14), Alphas(15), LocalError); - if (LocalError) { - ShowSevereError(state, format("The outlet node number of {} is not found \"{}\"", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - - // Get supplemental heating coil capacity to see if it is autosize - thisMSHP.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, Alphas(14), Alphas(15), LocalError); - if (LocalError) { - ShowSevereError(state, format("The capacity {} is not found \"{}\"", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, format("...occurs in {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - LocalError = false; - } - - BranchNodeConnections::SetUpCompSets(state, - state.dataHVACMultiSpdHP->CurrentModuleObject, - thisMSHP.Name, - "Coil:Heating:Electric", - thisMSHP.SuppHeatCoilName, - "UNDEFINED", - "UNDEFINED"); - } - - if (Util::SameString(Alphas(14), "Coil:Heating:Water")) { - thisMSHP.SuppHeatCoilType = HVAC::Coil_HeatingWater; - ValidateComponent(state, Alphas(14), thisMSHP.SuppHeatCoilName, IsNotOK, state.dataHVACMultiSpdHP->CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1))); + + } else if (thisMSHP.suppHeatCoilType == HVAC::CoilType::HeatingWater) { + thisMSHP.SuppHeatCoilNum = WaterCoils::GetWaterCoilIndex(state, thisMSHP.SuppHeatCoilName); + if (thisMSHP.SuppHeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), thisMSHP.SuppHeatCoilName); ErrorsFound = true; - } else { // mine data from heating coil object - - // Get the Heating Coil water Inlet or control Node number - errFlag = false; - thisMSHP.SuppCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", thisMSHP.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the ReHeat Coil hot water max volume flow rate - errFlag = false; - thisMSHP.MaxSuppCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisMSHP.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Inlet Node - errFlag = false; - SuppHeatCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", thisMSHP.SuppHeatCoilName, errFlag); - thisMSHP.SuppCoilAirInletNode = SuppHeatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Outlet Node - errFlag = false; - SuppHeatCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", thisMSHP.SuppHeatCoilName, errFlag); - thisMSHP.SuppCoilAirOutletNode = SuppHeatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } + } else { + thisMSHP.SuppHeatCoilControlNode = WaterCoils::GetCoilWaterInletNode(state, thisMSHP.SuppHeatCoilNum); + thisMSHP.SuppHeatCoilMaxFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, thisMSHP.SuppHeatCoilNum); + thisMSHP.SuppHeatCoilAirInletNode = WaterCoils::GetCoilInletNode(state, thisMSHP.SuppHeatCoilNum); + thisMSHP.SuppHeatCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, thisMSHP.SuppHeatCoilNum); BranchNodeConnections::SetUpCompSets(state, state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, "Coil:Heating:Water", thisMSHP.SuppHeatCoilName, - state.dataLoopNodes->NodeID(SuppHeatCoilInletNode), - state.dataLoopNodes->NodeID(SuppHeatCoilOutletNode)); + s_node->NodeID(thisMSHP.SuppHeatCoilAirInletNode), + s_node->NodeID(thisMSHP.SuppHeatCoilAirOutletNode)); } - } - if (Util::SameString(Alphas(14), "Coil:Heating:Steam")) { - thisMSHP.SuppHeatCoilType = HVAC::Coil_HeatingSteam; - ValidateComponent(state, Alphas(14), thisMSHP.SuppHeatCoilName, IsNotOK, state.dataHVACMultiSpdHP->CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } else { // mine data from heating coil object - errFlag = false; - thisMSHP.SuppHeatCoilNum = SteamCoils::GetSteamCoilIndex(state, Alphas(14), thisMSHP.SuppHeatCoilName, errFlag); - if (thisMSHP.SuppHeatCoilNum == 0) { - ShowSevereError( - state, - format("{} illegal {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, cAlphaFields(14), thisMSHP.SuppHeatCoilName)); - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil steam inlet node number - errFlag = false; - thisMSHP.SuppCoilControlNode = SteamCoils::GetCoilAirOutletNode(state, "Coil:Heating:Steam", thisMSHP.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil steam max volume flow rate - thisMSHP.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisMSHP.SuppHeatCoilNum, errFlag); - if (thisMSHP.MaxSuppCoilFluidFlow > 0.0) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, routineName); - thisMSHP.MaxSuppCoilFluidFlow *= SteamDensity; - } - - // Get the Supplemental Heating Coil Inlet Node - errFlag = false; - SuppHeatCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisMSHP.SuppHeatCoilNum, thisMSHP.SuppHeatCoilName, errFlag); - thisMSHP.SuppCoilAirInletNode = SuppHeatCoilInletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; - } - - // Get the Supplemental Heating Coil Outlet Node - errFlag = false; - SuppHeatCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisMSHP.SuppHeatCoilNum, thisMSHP.SuppHeatCoilName, errFlag); - thisMSHP.SuppCoilAirOutletNode = SuppHeatCoilOutletNode; - if (errFlag) { - ShowContinueError(state, format("Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ErrorsFound = true; + } else if (thisMSHP.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { + thisMSHP.SuppHeatCoilNum = SteamCoils::GetSteamCoilIndex(state, thisMSHP.SuppHeatCoilName); + if (thisMSHP.SuppHeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), thisMSHP.SuppHeatCoilName); + ErrorsFound = true; + } else { + // This is the control node? Everywhere else the control node is a fluid node. + thisMSHP.SuppHeatCoilControlNode = SteamCoils::GetCoilAirOutletNode(state, thisMSHP.SuppHeatCoilNum); + thisMSHP.SuppHeatCoilMaxFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisMSHP.SuppHeatCoilNum); + if (thisMSHP.SuppHeatCoilMaxFluidFlow > 0.0) { + thisMSHP.SuppHeatCoilMaxFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, routineName); } + thisMSHP.SuppHeatCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, thisMSHP.SuppHeatCoilNum); + thisMSHP.SuppHeatCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisMSHP.SuppHeatCoilNum); BranchNodeConnections::SetUpCompSets(state, state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, - "Coil:Heating:Steam", + HVAC::coilTypeNames[(int)thisMSHP.suppHeatCoilType], thisMSHP.SuppHeatCoilName, - state.dataLoopNodes->NodeID(SuppHeatCoilInletNode), - state.dataLoopNodes->NodeID(SuppHeatCoilOutletNode)); + s_node->NodeID(thisMSHP.SuppHeatCoilAirInletNode), + s_node->NodeID(thisMSHP.SuppHeatCoilAirOutletNode)); } - } - - if (thisMSHP.SuppHeatCoilType == 0) { - ShowSevereError(state, - format("{}, \"{}\", {} is not allowed = {}", - state.dataHVACMultiSpdHP->CurrentModuleObject, - thisMSHP.Name, - cAlphaFields(14), - Alphas(14))); - ShowContinueError(state, "Valid choices are Coil:Heating:Fuel,Coil:Heating:Electric,Coil:Heating:Steam,or Coil:Heating:Water"); + + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(14), Alphas(14)); ErrorsFound = true; } @@ -1226,7 +891,7 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchDXHeatCoilSuppHiT, thisMSHP.DXHeatCoilName, thisMSHP.SuppMaxOATemp); + state, state.dataOutRptPredefined->pdchDXHeatCoilSuppHiT, thisMSHP.HeatCoilName, thisMSHP.SuppMaxOATemp); thisMSHP.AuxOnCyclePower = Numbers(4); thisMSHP.AuxOffCyclePower = Numbers(5); @@ -1252,7 +917,7 @@ namespace HVACMultiSpeedHeatPump { if (thisMSHP.DesignHeatRecFlowRate > 0.0) { thisMSHP.HeatRecActive = true; thisMSHP.DesignHeatRecMassFlowRate = Psychrometrics::RhoH2O(Constant::HWInitConvTemp) * thisMSHP.DesignHeatRecFlowRate; - thisMSHP.HeatRecInletNodeNum = GetOnlySingleNode(state, + thisMSHP.HeatRecFluidInletNode = GetOnlySingleNode(state, Alphas(16), ErrorsFound, DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed, @@ -1261,12 +926,12 @@ namespace HVACMultiSpeedHeatPump { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Tertiary, DataLoopNode::ObjectIsNotParent); - if (thisMSHP.HeatRecInletNodeNum == 0) { + if (thisMSHP.HeatRecFluidInletNode == 0) { ShowSevereError( state, format("{}, \"{}\", Missing {}.", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, cAlphaFields(16))); ErrorsFound = true; } - thisMSHP.HeatRecOutletNodeNum = GetOnlySingleNode(state, + thisMSHP.HeatRecFluidOutletNode = GetOnlySingleNode(state, Alphas(17), ErrorsFound, DataLoopNode::ConnectionObjectType::AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed, @@ -1275,22 +940,22 @@ namespace HVACMultiSpeedHeatPump { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Tertiary, DataLoopNode::ObjectIsNotParent); - if (thisMSHP.HeatRecOutletNodeNum == 0) { + if (thisMSHP.HeatRecFluidOutletNode == 0) { ShowSevereError( state, format("{}, \"{}\", Missing {}.", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, cAlphaFields(17))); ErrorsFound = true; } BranchNodeConnections::TestCompSet( state, state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1), Alphas(16), Alphas(17), "MSHP Heat Recovery Nodes"); - DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisMSHP.DXCoolCoilIndex); - if (thisMSHP.DXHeatCoilIndex > 0) { - DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisMSHP.DXHeatCoilIndex); + DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisMSHP.CoolCoilNum); + if (thisMSHP.HeatCoilNum > 0) { + DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisMSHP.HeatCoilNum); } } else { thisMSHP.HeatRecActive = false; thisMSHP.DesignHeatRecMassFlowRate = 0.0; - thisMSHP.HeatRecInletNodeNum = 0; - thisMSHP.HeatRecOutletNodeNum = 0; + thisMSHP.HeatRecFluidInletNode = 0; + thisMSHP.HeatRecFluidOutletNode = 0; if (!lAlphaBlanks(16) || !lAlphaBlanks(17)) { ShowWarningError(state, format("Since {} = 0.0, heat recovery is inactive for {} = {}", @@ -1339,7 +1004,7 @@ namespace HVACMultiSpeedHeatPump { thisMSHP.NumOfSpeedHeating = Numbers(9); if (thisMSHP.NumOfSpeedHeating < 2 || thisMSHP.NumOfSpeedHeating > 4) { - if (thisMSHP.HeatCoilType == MultiSpeedHeatingCoil) { + if (thisMSHP.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { ShowSevereError(state, format("{}, The maximum {} is 4, and the minimum number is 2", state.dataHVACMultiSpdHP->CurrentModuleObject, @@ -1366,7 +1031,7 @@ namespace HVACMultiSpeedHeatPump { thisMSHP.HeatingSpeedRatio = 1.0; for (i = 1; i <= thisMSHP.NumOfSpeedHeating; ++i) { thisMSHP.HeatVolumeFlowRate(i) = Numbers(10 + i); - if (thisMSHP.HeatCoilType == MultiSpeedHeatingCoil) { + if (thisMSHP.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { if (thisMSHP.HeatVolumeFlowRate(i) <= 0.0 && thisMSHP.HeatVolumeFlowRate(i) != DataSizing::AutoSize) { ShowSevereError(state, format("{}, \"{}\", {} must be greater than zero.", @@ -1402,7 +1067,7 @@ namespace HVACMultiSpeedHeatPump { if (state.dataGlobal->DoCoilDirectSolutions) { int MaxNumber = std::max(thisMSHP.NumOfSpeedCooling, thisMSHP.NumOfSpeedHeating); thisMSHP.FullOutput.allocate(MaxNumber); - DXCoils::DisableLatentDegradation(state, thisMSHP.DXCoolCoilIndex); + DXCoils::DisableLatentDegradation(state, thisMSHP.CoolCoilNum); } // Generate a dynamic array for cooling if (thisMSHP.NumOfSpeedCooling > 0) { @@ -1445,110 +1110,112 @@ namespace HVACMultiSpeedHeatPump { // Check node integrity if (thisMSHP.fanPlace == HVAC::FanPlace::BlowThru) { - if (thisMSHP.FanInletNode != thisMSHP.AirInletNodeNum) { + if (thisMSHP.FanInletNode != thisMSHP.AirInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError( state, format("When a blow through fan is specified, the fan inlet node name must be the same as the {}", cAlphaFields(3))); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(thisMSHP.FanInletNode))); - ShowContinueError(state, format("...{} = {}", cAlphaFields(3), state.dataLoopNodes->NodeID(thisMSHP.AirInletNodeNum))); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(thisMSHP.FanInletNode))); + ShowContinueError(state, format("...{} = {}", cAlphaFields(3), s_node->NodeID(thisMSHP.AirInletNode))); ErrorsFound = true; } - if (thisMSHP.FanOutletNode != CoolingCoilInletNode) { + if (thisMSHP.FanOutletNode != thisMSHP.CoolCoilAirInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError( state, "When a blow through fan is specified, the fan outlet node name must be the same as the cooling coil inlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(thisMSHP.FanOutletNode))); - ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(thisMSHP.FanOutletNode))); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(thisMSHP.CoolCoilAirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { + if (thisMSHP.CoolCoilAirOutletNode != thisMSHP.HeatCoilAirInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(thisMSHP.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(thisMSHP.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != SuppHeatCoilInletNode) { + if (thisMSHP.HeatCoilAirOutletNode != thisMSHP.SuppHeatCoilAirInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError(state, "When a blow through fan is specified, the heating coil outlet node name must be the same as the reheat coil " "inlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("...Reheat coil inlet node name = {}", state.dataLoopNodes->NodeID(SuppHeatCoilInletNode))); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(thisMSHP.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Reheat coil inlet node name = {}", s_node->NodeID(thisMSHP.SuppHeatCoilAirInletNode))); ErrorsFound = true; } - if (SuppHeatCoilOutletNode != thisMSHP.AirOutletNodeNum) { + if (thisMSHP.SuppHeatCoilAirOutletNode != thisMSHP.AirOutletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError(state, format("The supplemental heating coil outlet node name must be the same as the {}", cAlphaFields(4))); ShowContinueError( - state, format("...Supplemental heating coil outlet node name = {}", state.dataLoopNodes->NodeID(SuppHeatCoilOutletNode))); - ShowContinueError(state, format("...{} = {}", cAlphaFields(4), state.dataLoopNodes->NodeID(thisMSHP.AirOutletNodeNum))); + state, format("...Supplemental heating coil outlet node name = {}", s_node->NodeID(thisMSHP.SuppHeatCoilAirOutletNode))); + ShowContinueError(state, format("...{} = {}", cAlphaFields(4), s_node->NodeID(thisMSHP.AirOutletNode))); ErrorsFound = true; } } else { - if (CoolingCoilInletNode != thisMSHP.AirInletNodeNum) { + if (thisMSHP.CoolCoilAirInletNode != thisMSHP.AirInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError( state, format("When a draw through fan is specified, the cooling coil inlet node name must be the same as the {}", cAlphaFields(3))); - ShowContinueError(state, format("...Cooling coil inlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilInletNode))); - ShowContinueError(state, format("...{} = {}", cAlphaFields(3), state.dataLoopNodes->NodeID(thisMSHP.AirInletNodeNum))); + ShowContinueError(state, format("...Cooling coil inlet node name = {}", s_node->NodeID(thisMSHP.CoolCoilAirInletNode))); + ShowContinueError(state, format("...{} = {}", cAlphaFields(3), s_node->NodeID(thisMSHP.AirInletNode))); ErrorsFound = true; } - if (CoolingCoilOutletNode != HeatingCoilInletNode) { + if (thisMSHP.CoolCoilAirOutletNode != thisMSHP.HeatCoilAirInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError(state, "The cooling coil outlet node name must be the same as the heating coil inlet node name."); - ShowContinueError(state, format("...Cooling coil outlet node name = {}", state.dataLoopNodes->NodeID(CoolingCoilOutletNode))); - ShowContinueError(state, format("...Heating coil inlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilInletNode))); + ShowContinueError(state, format("...Cooling coil outlet node name = {}", s_node->NodeID(thisMSHP.CoolCoilAirOutletNode))); + ShowContinueError(state, format("...Heating coil inlet node name = {}", s_node->NodeID(thisMSHP.HeatCoilAirInletNode))); ErrorsFound = true; } - if (HeatingCoilOutletNode != thisMSHP.FanInletNode) { + if (thisMSHP.HeatCoilAirOutletNode != thisMSHP.FanInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError( state, "When a draw through fan is specified, the heating coil outlet node name must be the same as the fan inlet node name."); - ShowContinueError(state, format("...Heating coil outlet node name = {}", state.dataLoopNodes->NodeID(HeatingCoilOutletNode))); - ShowContinueError(state, format("...Fan inlet node name = {}", state.dataLoopNodes->NodeID(thisMSHP.FanInletNode))); + ShowContinueError(state, format("...Heating coil outlet node name = {}", s_node->NodeID(thisMSHP.HeatCoilAirOutletNode))); + ShowContinueError(state, format("...Fan inlet node name = {}", s_node->NodeID(thisMSHP.FanInletNode))); ErrorsFound = true; } - if (thisMSHP.FanOutletNode != SuppHeatCoilInletNode) { + if (thisMSHP.FanOutletNode != thisMSHP.SuppHeatCoilAirInletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError( state, "When a draw through fan is specified, the fan outlet node name must be the same as the reheat coil inlet node name."); - ShowContinueError(state, format("...Fan outlet node name = {}", state.dataLoopNodes->NodeID(thisMSHP.FanOutletNode))); - ShowContinueError(state, format("...Reheat coil inlet node name = {}", state.dataLoopNodes->NodeID(SuppHeatCoilInletNode))); + ShowContinueError(state, format("...Fan outlet node name = {}", s_node->NodeID(thisMSHP.FanOutletNode))); + ShowContinueError(state, format("...Reheat coil inlet node name = {}", s_node->NodeID(thisMSHP.SuppHeatCoilAirInletNode))); ErrorsFound = true; } - if (SuppHeatCoilOutletNode != thisMSHP.AirOutletNodeNum) { + if (thisMSHP.SuppHeatCoilAirOutletNode != thisMSHP.AirOutletNode) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError(state, format("The reheat coil outlet node name must be the same as the {}", cAlphaFields(4))); - ShowContinueError(state, format("...Reheat coil outlet node name = {}", state.dataLoopNodes->NodeID(SuppHeatCoilOutletNode))); - ShowContinueError(state, format("...{} = {}", cAlphaFields(4), state.dataLoopNodes->NodeID(thisMSHP.AirOutletNodeNum))); + ShowContinueError(state, format("...Reheat coil outlet node name = {}", s_node->NodeID(thisMSHP.SuppHeatCoilAirOutletNode))); + ShowContinueError(state, format("...{} = {}", cAlphaFields(4), s_node->NodeID(thisMSHP.AirOutletNode))); ErrorsFound = true; } } // Ensure the numbers of speeds defined in the parent object are equal to the numbers defined in coil objects - if (thisMSHP.HeatCoilType == MultiSpeedHeatingCoil) { - i = DXCoils::GetDXCoilNumberOfSpeeds(state, Alphas(10), Alphas(11), ErrorsFound); - if (thisMSHP.NumOfSpeedHeating != i) { + if (thisMSHP.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { + int numSpeeds = DXCoils::GetDXCoilNumberOfSpeeds(state, thisMSHP.HeatCoilNum); + if (thisMSHP.NumOfSpeedHeating != numSpeeds) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError( state, format("The {} is not equal to the number defined in {} = {}", cNumericFields(9), cAlphaFields(11), Alphas(11))); ErrorsFound = true; } - } else if (thisMSHP.HeatCoilType == HVAC::Coil_HeatingElectric_MultiStage || thisMSHP.HeatCoilType == HVAC::Coil_HeatingGas_MultiStage) { - i = HeatingCoils::GetHeatingCoilNumberOfStages(state, Alphas(10), Alphas(11), ErrorsFound); - if (thisMSHP.NumOfSpeedHeating != i) { + } else if (thisMSHP.heatCoilType == HVAC::CoilType::HeatingElectricMultiStage || + thisMSHP.heatCoilType == HVAC::CoilType::HeatingGasMultiStage) { + int numSpeeds = HeatingCoils::GetHeatingCoilNumberOfStages(state, Alphas(10), Alphas(11), ErrorsFound); + if (thisMSHP.NumOfSpeedHeating != numSpeeds) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError( state, format("The {} is not equal to the number defined in {} = {}", cNumericFields(9), cAlphaFields(11), Alphas(11))); ErrorsFound = true; } } - i = DXCoils::GetDXCoilNumberOfSpeeds(state, Alphas(12), Alphas(13), ErrorsFound); - if (thisMSHP.NumOfSpeedCooling != i) { + + int numSpeeds = DXCoils::GetDXCoilNumberOfSpeeds(state, thisMSHP.CoolCoilNum); + if (thisMSHP.NumOfSpeedCooling != numSpeeds) { ShowSevereError(state, format("For {} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); ShowContinueError(state, format("The {} is not equal to the number defined in {} = {}", cNumericFields(10), cAlphaFields(13), Alphas(13))); @@ -1784,28 +1451,23 @@ namespace HVACMultiSpeedHeatPump { bool ErrorsFound(false); // flag returned from mining call Real64 mdot(0.0); // local temporary for mass flow rate (kg/s) - Real64 SteamDensity(0.0); // density of steam at 100C, used for steam heating coils Real64 CoilMaxVolFlowRate(0.0); // coil fluid maximum volume flow rate Real64 QActual(0.0); // coil actual capacity - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump; - - int InNode = MSHeatPump(MSHeatPumpNum).AirInletNodeNum; - int OutNode = MSHeatPump(MSHeatPumpNum).AirOutletNodeNum; - int NumOfSpeedCooling = MSHeatPump(MSHeatPumpNum).NumOfSpeedCooling; - int NumOfSpeedHeating = MSHeatPump(MSHeatPumpNum).NumOfSpeedHeating; + auto &s_node = state.dataLoopNodes; + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); ++state.dataHVACMultiSpdHP->AirLoopPass; if (state.dataHVACMultiSpdHP->AirLoopPass > 2) state.dataHVACMultiSpdHP->AirLoopPass = 1; - if (MSHeatPump(MSHeatPumpNum).MyPlantScantFlag && allocated(state.dataPlnt->PlantLoop)) { + if (mshp.MyPlantScantFlag && allocated(state.dataPlnt->PlantLoop)) { bool errFlag; - if (MSHeatPump(MSHeatPumpNum).HeatRecActive) { + if (mshp.HeatRecActive) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - MSHeatPump(MSHeatPumpNum).Name, + mshp.Name, DataPlant::PlantEquipmentType::MultiSpeedHeatPumpRecovery, - MSHeatPump(MSHeatPumpNum).HRPlantLoc, + mshp.HRPlantLoc, errFlag, _, _, @@ -1816,16 +1478,17 @@ namespace HVACMultiSpeedHeatPump { ShowFatalError(state, "InitMSHeatPump: Program terminated for previous conditions."); } - MSHeatPump(MSHeatPumpNum).MyPlantScantFlag = false; + mshp.MyPlantScantFlag = false; } else { - MSHeatPump(MSHeatPumpNum).MyPlantScantFlag = false; + mshp.MyPlantScantFlag = false; } - if (MSHeatPump(MSHeatPumpNum).HeatCoilType == HVAC::Coil_HeatingWater) { + + if (mshp.heatCoilType == HVAC::CoilType::HeatingWater) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - MSHeatPump(MSHeatPumpNum).HeatCoilName, + mshp.HeatCoilName, DataPlant::PlantEquipmentType::CoilWaterSimpleHeating, - MSHeatPump(MSHeatPumpNum).plantLoc, + mshp.HeatCoilPlantLoc, errFlag, _, _, @@ -1835,26 +1498,23 @@ namespace HVACMultiSpeedHeatPump { if (errFlag) { ShowFatalError(state, "InitMSHeatPump: Program terminated for previous conditions."); } - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).HeatCoilName, ErrorsFound); - - if (MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow > 0.0) { - rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum) - .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).HeatCoilName, ErrorsFound) * rho; + mshp.HeatCoilMaxFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, mshp.HeatCoilNum); + + if (mshp.HeatCoilMaxFluidFlow > 0.0) { + mshp.HeatCoilMaxFluidFlow *= + state.dataPlnt->PlantLoop(mshp.HeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } + // fill outlet node for coil - MSHeatPump(MSHeatPumpNum).CoilOutletNode = - DataPlant::CompData::getPlantComponent(state, MSHeatPump(MSHeatPumpNum).plantLoc).NodeNumOut; - MSHeatPump(MSHeatPumpNum).MyPlantScantFlag = false; + mshp.HeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, mshp.HeatCoilPlantLoc).NodeNumOut; + mshp.MyPlantScantFlag = false; - } else if (MSHeatPump(MSHeatPumpNum).HeatCoilType == HVAC::Coil_HeatingSteam) { + } else if (mshp.heatCoilType == HVAC::CoilType::HeatingSteam) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - MSHeatPump(MSHeatPumpNum).HeatCoilName, + mshp.HeatCoilName, DataPlant::PlantEquipmentType::CoilSteamAirHeating, - MSHeatPump(MSHeatPumpNum).plantLoc, + mshp.HeatCoilPlantLoc, errFlag, _, _, @@ -1864,24 +1524,22 @@ namespace HVACMultiSpeedHeatPump { if (errFlag) { ShowFatalError(state, "InitMSHeatPump: Program terminated for previous conditions."); } - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).HeatCoilNum, ErrorsFound); - if (MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow > 0.0) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow *= SteamDensity; + mshp.HeatCoilMaxFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, mshp.HeatCoilNum); + if (mshp.HeatCoilMaxFluidFlow > 0.0) { + mshp.HeatCoilMaxFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } // fill outlet node for coil - MSHeatPump(MSHeatPumpNum).CoilOutletNode = - DataPlant::CompData::getPlantComponent(state, MSHeatPump(MSHeatPumpNum).plantLoc).NodeNumOut; - MSHeatPump(MSHeatPumpNum).MyPlantScantFlag = false; + mshp.HeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, mshp.HeatCoilPlantLoc).NodeNumOut; + mshp.MyPlantScantFlag = false; } - if (MSHeatPump(MSHeatPumpNum).SuppHeatCoilType == HVAC::Coil_HeatingWater) { + + if (mshp.suppHeatCoilType == HVAC::CoilType::HeatingWater) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, + mshp.SuppHeatCoilName, DataPlant::PlantEquipmentType::CoilWaterSimpleHeating, - MSHeatPump(MSHeatPumpNum).SuppPlantLoc, + mshp.SuppHeatCoilPlantLoc, errFlag, _, _, @@ -1891,27 +1549,23 @@ namespace HVACMultiSpeedHeatPump { if (errFlag) { ShowFatalError(state, "InitMSHeatPump: Program terminated for previous conditions."); } - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, ErrorsFound); - - if (MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow > 0.0) { - rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum) - .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, ErrorsFound) * - rho; + mshp.SuppHeatCoilMaxFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, mshp.SuppHeatCoilNum); + + if (mshp.SuppHeatCoilMaxFluidFlow > 0.0) { + mshp.SuppHeatCoilMaxFluidFlow *= + state.dataPlnt->PlantLoop(mshp.SuppHeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } + // fill outlet node for coil - MSHeatPump(MSHeatPumpNum).SuppCoilOutletNode = - DataPlant::CompData::getPlantComponent(state, MSHeatPump(MSHeatPumpNum).SuppPlantLoc).NodeNumOut; - MSHeatPump(MSHeatPumpNum).MyPlantScantFlag = false; + mshp.SuppHeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, mshp.SuppHeatCoilPlantLoc).NodeNumOut; + mshp.MyPlantScantFlag = false; - } else if (MSHeatPump(MSHeatPumpNum).SuppHeatCoilType == HVAC::Coil_HeatingSteam) { + } else if (mshp.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, + mshp.SuppHeatCoilName, DataPlant::PlantEquipmentType::CoilSteamAirHeating, - MSHeatPump(MSHeatPumpNum).SuppPlantLoc, + mshp.SuppHeatCoilPlantLoc, errFlag, _, _, @@ -1921,54 +1575,52 @@ namespace HVACMultiSpeedHeatPump { if (errFlag) { ShowFatalError(state, "InitMSHeatPump: Program terminated for previous conditions."); } - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum, ErrorsFound); - if (MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow > 0.0) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow *= SteamDensity; + + mshp.SuppHeatCoilMaxFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, mshp.SuppHeatCoilNum); + if (mshp.SuppHeatCoilMaxFluidFlow > 0.0) { + mshp.SuppHeatCoilMaxFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } // fill outlet node for coil - MSHeatPump(MSHeatPumpNum).SuppCoilOutletNode = - DataPlant::CompData::getPlantComponent(state, MSHeatPump(MSHeatPumpNum).SuppPlantLoc).NodeNumOut; - MSHeatPump(MSHeatPumpNum).MyPlantScantFlag = false; + mshp.SuppHeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, mshp.SuppHeatCoilPlantLoc).NodeNumOut; + mshp.MyPlantScantFlag = false; } - } else if (MSHeatPump(MSHeatPumpNum).MyPlantScantFlag && !state.dataGlobal->AnyPlantInModel) { - MSHeatPump(MSHeatPumpNum).MyPlantScantFlag = false; + } else if (mshp.MyPlantScantFlag && !state.dataGlobal->AnyPlantInModel) { + mshp.MyPlantScantFlag = false; } - if (!state.dataGlobal->SysSizingCalc && MSHeatPump(MSHeatPumpNum).MySizeFlag) { - MSHeatPump(MSHeatPumpNum).FanVolFlow = state.dataFans->fans(MSHeatPump(MSHeatPumpNum).FanNum)->maxAirFlowRate; + if (!state.dataGlobal->SysSizingCalc && mshp.MySizeFlag) { + mshp.FanVolFlow = state.dataFans->fans(mshp.FanNum)->maxAirFlowRate; SizeMSHeatPump(state, MSHeatPumpNum); - MSHeatPump(MSHeatPumpNum).FlowFraction = 1.0; - MSHeatPump(MSHeatPumpNum).MySizeFlag = false; + mshp.FlowFraction = 1.0; + mshp.MySizeFlag = false; // Pass the fan cycling schedule index up to the air loop. Set the air loop unitary system flag. - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = MSHeatPump(MSHeatPumpNum).FanSchedPtr; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = mshp.FanSchedPtr; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySys = true; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating = false; // affects child coil sizing by allowing coil to size itself instead of parent telling coil what size to use - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = MSHeatPump(MSHeatPumpNum).fanOp; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = mshp.fanOp; } - if (allocated(state.dataZoneEquip->ZoneEquipConfig) && MSHeatPump(MSHeatPumpNum).MyCheckFlag) { - int zoneNum = MSHeatPump(MSHeatPumpNum).ControlZoneNum; - int zoneInlet = MSHeatPump(MSHeatPumpNum).ZoneInletNode; + if (allocated(state.dataZoneEquip->ZoneEquipConfig) && mshp.MyCheckFlag) { + int zoneNum = mshp.ControlZoneNum; + int zoneInlet = mshp.ZoneInletNode; // setup furnace zone equipment sequence information based on finding matching air terminal if (state.dataZoneEquip->ZoneEquipConfig(zoneNum).EquipListIndex > 0) { int coolingPriority = 0; int heatingPriority = 0; state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(zoneNum).EquipListIndex) .getPrioritiesForInletNode(state, zoneInlet, coolingPriority, heatingPriority); - MSHeatPump(MSHeatPumpNum).ZoneSequenceCoolingNum = coolingPriority; - MSHeatPump(MSHeatPumpNum).ZoneSequenceHeatingNum = heatingPriority; + mshp.ZoneSequenceCoolingNum = coolingPriority; + mshp.ZoneSequenceHeatingNum = heatingPriority; } - MSHeatPump(MSHeatPumpNum).MyCheckFlag = false; - if (MSHeatPump(MSHeatPumpNum).ZoneSequenceCoolingNum == 0 || MSHeatPump(MSHeatPumpNum).ZoneSequenceHeatingNum == 0) { + mshp.MyCheckFlag = false; + if (mshp.ZoneSequenceCoolingNum == 0 || mshp.ZoneSequenceHeatingNum == 0) { ShowSevereError(state, format("AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed, \"{}\": Airloop air terminal in the zone equipment list for " "zone = {} not found or is not allowed Zone Equipment Cooling or Heating Sequence = 0.", - MSHeatPump(MSHeatPumpNum).Name, - MSHeatPump(MSHeatPumpNum).ControlZoneName)); + mshp.Name, + mshp.ControlZoneName)); ShowFatalError(state, "Subroutine InitMSHeatPump: Errors found in getting AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed input. Preceding " "condition(s) causes termination."); @@ -1978,7 +1630,7 @@ namespace HVACMultiSpeedHeatPump { // Find the number of zones (zone Inlet Nodes) attached to an air loop from the air loop number NumAirLoopZones = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled + state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; - if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && MSHeatPump(MSHeatPumpNum).MyFlowFracFlag) { + if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && mshp.MyFlowFracFlag) { state.dataHVACMultiSpdHP->FlowFracFlagReady = true; for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) { // zone inlet nodes for cooling @@ -2001,269 +1653,266 @@ namespace HVACMultiSpeedHeatPump { SumOfMassFlowRateMax = 0.0; // initialize the sum of the maximum flows for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) { int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex); - SumOfMassFlowRateMax += state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax; - if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZoneInSysIndex) == MSHeatPump(MSHeatPumpNum).ControlZoneNum) { - CntrlZoneTerminalUnitMassFlowRateMax = state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax; + SumOfMassFlowRateMax += s_node->Node(ZoneInletNodeNum).MassFlowRateMax; + if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZoneInSysIndex) == mshp.ControlZoneNum) { + CntrlZoneTerminalUnitMassFlowRateMax = s_node->Node(ZoneInletNodeNum).MassFlowRateMax; } } - if (SumOfMassFlowRateMax != 0.0 && MSHeatPump(MSHeatPumpNum).MyFlowFracFlag) { + if (SumOfMassFlowRateMax != 0.0 && mshp.MyFlowFracFlag) { if (CntrlZoneTerminalUnitMassFlowRateMax >= HVAC::SmallAirVolFlow) { - MSHeatPump(MSHeatPumpNum).FlowFraction = CntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax; + mshp.FlowFraction = CntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax; } else { - ShowSevereError(state, format("{} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump(MSHeatPumpNum).Name)); + ShowSevereError(state, format("{} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); ShowContinueError(state, " The Fraction of Supply Air Flow That Goes Through the Controlling Zone is set to 1."); } BaseSizer::reportSizerOutput(state, state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump(MSHeatPumpNum).Name, + mshp.Name, "Fraction of Supply Air Flow That Goes Through the Controlling Zone", - MSHeatPump(MSHeatPumpNum).FlowFraction); - MSHeatPump(MSHeatPumpNum).MyFlowFracFlag = false; + mshp.FlowFraction); + mshp.MyFlowFracFlag = false; } } // Do the Begin Environment initializations - if (state.dataGlobal->BeginEnvrnFlag && MSHeatPump(MSHeatPumpNum).MyEnvrnFlag) { + if (state.dataGlobal->BeginEnvrnFlag && mshp.MyEnvrnFlag) { RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the input volume flow rates - for (i = 1; i <= NumOfSpeedCooling; ++i) { - MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(i) = RhoAir * MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(i); + for (i = 1; i <= mshp.NumOfSpeedCooling; ++i) { + mshp.CoolMassFlowRate(i) = RhoAir * mshp.CoolVolumeFlowRate(i); } - for (i = 1; i <= NumOfSpeedHeating; ++i) { - MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(i) = RhoAir * MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(i); + for (i = 1; i <= mshp.NumOfSpeedHeating; ++i) { + mshp.HeatMassFlowRate(i) = RhoAir * mshp.HeatVolumeFlowRate(i); } - MSHeatPump(MSHeatPumpNum).IdleMassFlowRate = RhoAir * MSHeatPump(MSHeatPumpNum).IdleVolumeAirRate; + mshp.IdleMassFlowRate = RhoAir * mshp.IdleVolumeAirRate; // set the node max and min mass flow rates - state.dataLoopNodes->Node(InNode).MassFlowRateMax = - max(MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(NumOfSpeedCooling), MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(NumOfSpeedHeating)); - state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = - max(MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(NumOfSpeedCooling), MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(NumOfSpeedHeating)); - state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0; - state.dataLoopNodes->Node(OutNode) = state.dataLoopNodes->Node(InNode); - MSHeatPump(MSHeatPumpNum).LoadLoss = 0.0; - - if ((MSHeatPump(MSHeatPumpNum).HeatRecActive) && (!MSHeatPump(MSHeatPumpNum).MyPlantScantFlag)) { - - rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).HRPlantLoc.loopNum) + s_node->Node(mshp.AirInletNode).MassFlowRateMax = + max(mshp.CoolMassFlowRate(mshp.NumOfSpeedCooling), mshp.HeatMassFlowRate(mshp.NumOfSpeedHeating)); + s_node->Node(mshp.AirInletNode).MassFlowRateMaxAvail = + max(mshp.CoolMassFlowRate(mshp.NumOfSpeedCooling), mshp.HeatMassFlowRate(mshp.NumOfSpeedHeating)); + s_node->Node(mshp.AirInletNode).MassFlowRateMin = 0.0; + s_node->Node(mshp.AirInletNode).MassFlowRateMinAvail = 0.0; + s_node->Node(mshp.AirOutletNode) = s_node->Node(mshp.AirInletNode); + mshp.LoadLoss = 0.0; + + if ((mshp.HeatRecActive) && (!mshp.MyPlantScantFlag)) { + + rho = state.dataPlnt->PlantLoop(mshp.HRPlantLoc.loopNum) .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - MSHeatPump(MSHeatPumpNum).DesignHeatRecMassFlowRate = MSHeatPump(MSHeatPumpNum).DesignHeatRecFlowRate * rho; + mshp.DesignHeatRecMassFlowRate = mshp.DesignHeatRecFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, - MSHeatPump(MSHeatPumpNum).DesignHeatRecMassFlowRate, - MSHeatPump(MSHeatPumpNum).HeatRecInletNodeNum, - MSHeatPump(MSHeatPumpNum).HeatRecOutletNodeNum); + mshp.DesignHeatRecMassFlowRate, + mshp.HeatRecFluidInletNode, + mshp.HeatRecFluidOutletNode); } - if (MSHeatPump(MSHeatPumpNum).CoilControlNode > 0) { - if (MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow == DataSizing::AutoSize) { - if (MSHeatPump(MSHeatPumpNum).HeatCoilType == HVAC::Coil_HeatingWater) { - WaterCoils::SimulateWaterCoilComponents( - state, MSHeatPump(MSHeatPumpNum).HeatCoilName, FirstHVACIteration, MSHeatPump(MSHeatPumpNum).HeatCoilNum); + + if (mshp.HeatCoilControlNode > 0) { + if (mshp.HeatCoilMaxFluidFlow == DataSizing::AutoSize) { + if (mshp.heatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SimulateWaterCoilComponents(state, mshp.HeatCoilName, FirstHVACIteration, mshp.HeatCoilNum); - CoilMaxVolFlowRate = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).HeatCoilName, ErrorsFound); + mshp.HeatCoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, mshp.HeatCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum) - .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = CoilMaxVolFlowRate * rho; + mshp.HeatCoilMaxFluidFlow = mshp.HeatCoilMaxVolFlowRate * + state.dataPlnt->PlantLoop(mshp.HeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } PlantUtilities::InitComponentNodes(state, 0.0, - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow, - MSHeatPump(MSHeatPumpNum).CoilControlNode, - MSHeatPump(MSHeatPumpNum).CoilOutletNode); - } - if (MSHeatPump(MSHeatPumpNum).HeatCoilType == HVAC::Coil_HeatingSteam) { + mshp.HeatCoilMaxFluidFlow, + mshp.HeatCoilControlNode, + mshp.HeatCoilFluidOutletNode); + + } else if (mshp.heatCoilType == HVAC::CoilType::HeatingSteam) { SteamCoils::SimulateSteamCoilComponents(state, - MSHeatPump(MSHeatPumpNum).HeatCoilName, + mshp.HeatCoilName, FirstHVACIteration, - MSHeatPump(MSHeatPumpNum).HeatCoilNum, + mshp.HeatCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).HeatCoilNum, ErrorsFound); - if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; + mshp.HeatCoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, mshp.HeatCoilNum); + + if (mshp.HeatCoilMaxVolFlowRate != DataSizing::AutoSize) { + mshp.HeatCoilMaxFluidFlow = mshp.HeatCoilMaxVolFlowRate * + Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } PlantUtilities::InitComponentNodes(state, 0.0, - MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow, - MSHeatPump(MSHeatPumpNum).CoilControlNode, - MSHeatPump(MSHeatPumpNum).CoilOutletNode); + mshp.HeatCoilMaxFluidFlow, + mshp.HeatCoilControlNode, + mshp.HeatCoilFluidOutletNode); } } } - if (MSHeatPump(MSHeatPumpNum).SuppCoilControlNode > 0) { - if (MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow == DataSizing::AutoSize) { - if (MSHeatPump(MSHeatPumpNum).SuppHeatCoilType == HVAC::Coil_HeatingWater) { - WaterCoils::SimulateWaterCoilComponents( - state, MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, FirstHVACIteration, MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum); + + if (mshp.SuppHeatCoilControlNode > 0) { + if (mshp.SuppHeatCoilMaxFluidFlow == DataSizing::AutoSize) { + if (mshp.suppHeatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SimulateWaterCoilComponents(state, mshp.SuppHeatCoilName, FirstHVACIteration, mshp.SuppHeatCoilNum); - CoilMaxVolFlowRate = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, ErrorsFound); - if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum) - .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho; + mshp.SuppHeatCoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, mshp.SuppHeatCoilNum); + if (mshp.SuppHeatCoilMaxVolFlowRate != DataSizing::AutoSize) { + mshp.SuppHeatCoilMaxFluidFlow = mshp.SuppHeatCoilMaxVolFlowRate * + state.dataPlnt->PlantLoop(mshp.SuppHeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } PlantUtilities::InitComponentNodes(state, 0.0, - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow, - MSHeatPump(MSHeatPumpNum).SuppCoilControlNode, - MSHeatPump(MSHeatPumpNum).SuppCoilOutletNode); - } - if (MSHeatPump(MSHeatPumpNum).SuppHeatCoilType == HVAC::Coil_HeatingSteam) { + mshp.SuppHeatCoilMaxFluidFlow, + mshp.SuppHeatCoilControlNode, + mshp.SuppHeatCoilFluidOutletNode); + + } else if (mshp.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { SteamCoils::SimulateSteamCoilComponents(state, - MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, + mshp.SuppHeatCoilName, FirstHVACIteration, - MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum, + mshp.SuppHeatCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum, ErrorsFound); - - if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; + mshp.SuppHeatCoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, mshp.SuppHeatCoilNum); + if (mshp.SuppHeatCoilMaxVolFlowRate != DataSizing::AutoSize) { + mshp.SuppHeatCoilMaxFluidFlow = mshp.SuppHeatCoilMaxVolFlowRate * + Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); + } PlantUtilities::InitComponentNodes(state, 0.0, - MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow, - MSHeatPump(MSHeatPumpNum).SuppCoilControlNode, - MSHeatPump(MSHeatPumpNum).SuppCoilOutletNode); + mshp.SuppHeatCoilMaxFluidFlow, + mshp.SuppHeatCoilControlNode, + mshp.SuppHeatCoilFluidOutletNode); } } } - MSHeatPump(MSHeatPumpNum).MyEnvrnFlag = false; + mshp.MyEnvrnFlag = false; } // end one time inits if (!state.dataGlobal->BeginEnvrnFlag) { - MSHeatPump(MSHeatPumpNum).MyEnvrnFlag = true; + mshp.MyEnvrnFlag = true; } // IF MSHP system was not autosized and the fan is autosized, check that fan volumetric flow rate is greater than MSHP flow rates - if (!state.dataGlobal->DoingSizing && MSHeatPump(MSHeatPumpNum).CheckFanFlow) { + if (!state.dataGlobal->DoingSizing && mshp.CheckFanFlow) { state.dataHVACMultiSpdHP->CurrentModuleObject = "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed"; - MSHeatPump(MSHeatPumpNum).FanVolFlow = state.dataFans->fans(MSHeatPump(MSHeatPumpNum).FanNum)->maxAirFlowRate; - if (MSHeatPump(MSHeatPumpNum).FanVolFlow != DataSizing::AutoSize) { + mshp.FanVolFlow = state.dataFans->fans(mshp.FanNum)->maxAirFlowRate; + if (mshp.FanVolFlow != DataSizing::AutoSize) { // Check fan versus system supply air flow rates - if (MSHeatPump(MSHeatPumpNum).FanVolFlow < MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(NumOfSpeedCooling)) { + if (mshp.FanVolFlow < mshp.CoolVolumeFlowRate(mshp.NumOfSpeedCooling)) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the MSHP system air flow rate when cooling is " "required ({:.7T}).", state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump(MSHeatPumpNum).FanVolFlow, - MSHeatPump(MSHeatPumpNum).FanName, - MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(NumOfSpeedCooling))); + mshp.FanVolFlow, + mshp.FanName, + mshp.CoolVolumeFlowRate(mshp.NumOfSpeedCooling))); ShowContinueError( state, " The MSHP system flow rate when cooling is required is reset to the fan flow rate and the simulation continues."); ShowContinueError(state, - format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump(MSHeatPumpNum).Name)); - MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(NumOfSpeedCooling) = MSHeatPump(MSHeatPumpNum).FanVolFlow; + format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); + mshp.CoolVolumeFlowRate(mshp.NumOfSpeedCooling) = mshp.FanVolFlow; // Check flow rates in other speeds and ensure flow rates are not above the max flow rate - for (i = NumOfSpeedCooling - 1; i >= 1; --i) { - if (MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(i) > MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(i + 1)) { + for (i = mshp.NumOfSpeedCooling - 1; i >= 1; --i) { + if (mshp.CoolVolumeFlowRate(i) > mshp.CoolVolumeFlowRate(i + 1)) { ShowContinueError(state, format(" The MSHP system flow rate when cooling is required is reset to the flow rate at higher speed " "and the simulation continues at Speed{}.", i)); ShowContinueError( - state, format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump(MSHeatPumpNum).Name)); - MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(i) = MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(i + 1); + state, format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); + mshp.CoolVolumeFlowRate(i) = mshp.CoolVolumeFlowRate(i + 1); } } } - if (MSHeatPump(MSHeatPumpNum).FanVolFlow < MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(NumOfSpeedHeating)) { + if (mshp.FanVolFlow < mshp.HeatVolumeFlowRate(mshp.NumOfSpeedHeating)) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the MSHP system air flow rate when heating is " "required ({:.7T}).", state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump(MSHeatPumpNum).FanVolFlow, - MSHeatPump(MSHeatPumpNum).FanName, - MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(NumOfSpeedHeating))); + mshp.FanVolFlow, + mshp.FanName, + mshp.HeatVolumeFlowRate(mshp.NumOfSpeedHeating))); ShowContinueError( state, " The MSHP system flow rate when heating is required is reset to the fan flow rate and the simulation continues."); ShowContinueError(state, - format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump(MSHeatPumpNum).Name)); - MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(NumOfSpeedHeating) = MSHeatPump(MSHeatPumpNum).FanVolFlow; - for (i = NumOfSpeedHeating - 1; i >= 1; --i) { - if (MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(i) > MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(i + 1)) { + format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); + mshp.HeatVolumeFlowRate(mshp.NumOfSpeedHeating) = mshp.FanVolFlow; + for (i = mshp.NumOfSpeedHeating - 1; i >= 1; --i) { + if (mshp.HeatVolumeFlowRate(i) > mshp.HeatVolumeFlowRate(i + 1)) { ShowContinueError(state, format(" The MSHP system flow rate when heating is required is reset to the flow rate at higher speed " "and the simulation continues at Speed{}.", i)); ShowContinueError( state, - format(" Occurs in {} system = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump(MSHeatPumpNum).Name)); - MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(i) = MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(i + 1); + format(" Occurs in {} system = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); + mshp.HeatVolumeFlowRate(i) = mshp.HeatVolumeFlowRate(i + 1); } } } - if (MSHeatPump(MSHeatPumpNum).FanVolFlow < MSHeatPump(MSHeatPumpNum).IdleVolumeAirRate && - MSHeatPump(MSHeatPumpNum).IdleVolumeAirRate != 0.0) { + if (mshp.FanVolFlow < mshp.IdleVolumeAirRate && + mshp.IdleVolumeAirRate != 0.0) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the MSHP system air flow rate when no heating " "or cooling is needed ({:.7T}).", state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump(MSHeatPumpNum).FanVolFlow, - MSHeatPump(MSHeatPumpNum).FanName, - MSHeatPump(MSHeatPumpNum).IdleVolumeAirRate)); + mshp.FanVolFlow, + mshp.FanName, + mshp.IdleVolumeAirRate)); ShowContinueError(state, " The MSHP system flow rate when no heating or cooling is needed is reset to the fan flow rate and the " "simulation continues."); ShowContinueError(state, - format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump(MSHeatPumpNum).Name)); - MSHeatPump(MSHeatPumpNum).IdleVolumeAirRate = MSHeatPump(MSHeatPumpNum).FanVolFlow; + format(" Occurs in {} = {}", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); + mshp.IdleVolumeAirRate = mshp.FanVolFlow; } RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the reset volume flow rates - for (i = 1; i <= NumOfSpeedCooling; ++i) { - MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(i) = RhoAir * MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(i); - if (MSHeatPump(MSHeatPumpNum).FanVolFlow > 0.0) { - MSHeatPump(MSHeatPumpNum).CoolingSpeedRatio(i) = - MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(i) / MSHeatPump(MSHeatPumpNum).FanVolFlow; + for (i = 1; i <= mshp.NumOfSpeedCooling; ++i) { + mshp.CoolMassFlowRate(i) = RhoAir * mshp.CoolVolumeFlowRate(i); + if (mshp.FanVolFlow > 0.0) { + mshp.CoolingSpeedRatio(i) = + mshp.CoolVolumeFlowRate(i) / mshp.FanVolFlow; } } - for (i = 1; i <= NumOfSpeedHeating; ++i) { - MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(i) = RhoAir * MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(i); - if (MSHeatPump(MSHeatPumpNum).FanVolFlow > 0.0) { - MSHeatPump(MSHeatPumpNum).HeatingSpeedRatio(i) = - MSHeatPump(MSHeatPumpNum).HeatVolumeFlowRate(i) / MSHeatPump(MSHeatPumpNum).FanVolFlow; + for (i = 1; i <= mshp.NumOfSpeedHeating; ++i) { + mshp.HeatMassFlowRate(i) = RhoAir * mshp.HeatVolumeFlowRate(i); + if (mshp.FanVolFlow > 0.0) { + mshp.HeatingSpeedRatio(i) = + mshp.HeatVolumeFlowRate(i) / mshp.FanVolFlow; } } - MSHeatPump(MSHeatPumpNum).IdleMassFlowRate = RhoAir * MSHeatPump(MSHeatPumpNum).IdleVolumeAirRate; - if (MSHeatPump(MSHeatPumpNum).FanVolFlow > 0.0) { - MSHeatPump(MSHeatPumpNum).IdleSpeedRatio = MSHeatPump(MSHeatPumpNum).IdleVolumeAirRate / MSHeatPump(MSHeatPumpNum).FanVolFlow; + mshp.IdleMassFlowRate = RhoAir * mshp.IdleVolumeAirRate; + if (mshp.FanVolFlow > 0.0) { + mshp.IdleSpeedRatio = mshp.IdleVolumeAirRate / mshp.FanVolFlow; } // set the node max and min mass flow rates based on reset volume flow rates - state.dataLoopNodes->Node(InNode).MassFlowRateMax = - max(MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(NumOfSpeedCooling), MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(NumOfSpeedHeating)); - state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = - max(MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(NumOfSpeedCooling), MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(NumOfSpeedHeating)); - state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0; - state.dataLoopNodes->Node(OutNode) = state.dataLoopNodes->Node(InNode); - MSHeatPump(MSHeatPumpNum).CheckFanFlow = false; + s_node->Node(mshp.AirInletNode).MassFlowRateMax = + max(mshp.CoolMassFlowRate(mshp.NumOfSpeedCooling), mshp.HeatMassFlowRate(mshp.NumOfSpeedHeating)); + s_node->Node(mshp.AirInletNode).MassFlowRateMaxAvail = + max(mshp.CoolMassFlowRate(mshp.NumOfSpeedCooling), mshp.HeatMassFlowRate(mshp.NumOfSpeedHeating)); + s_node->Node(mshp.AirInletNode).MassFlowRateMin = 0.0; + s_node->Node(mshp.AirInletNode).MassFlowRateMinAvail = 0.0; + s_node->Node(mshp.AirOutletNode) = s_node->Node(mshp.AirInletNode); + mshp.CheckFanFlow = false; } } - if (MSHeatPump(MSHeatPumpNum).FanSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).FanSchedPtr) == 0.0) { - MSHeatPump(MSHeatPumpNum).fanOp = HVAC::FanOp::Cycling; + if (mshp.FanSchedPtr > 0) { + if (ScheduleManager::GetCurrentScheduleValue(state, mshp.FanSchedPtr) == 0.0) { + mshp.fanOp = HVAC::FanOp::Cycling; } else { - MSHeatPump(MSHeatPumpNum).fanOp = HVAC::FanOp::Continuous; + mshp.fanOp = HVAC::FanOp::Continuous; } } // Calculate air distribution losses if (!FirstHVACIteration && state.dataHVACMultiSpdHP->AirLoopPass == 1) { - int ZoneInNode = MSHeatPump(MSHeatPumpNum).ZoneInletNode; - DeltaMassRate = state.dataLoopNodes->Node(OutNode).MassFlowRate - - state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / MSHeatPump(MSHeatPumpNum).FlowFraction; + int ZoneInNode = mshp.ZoneInletNode; + DeltaMassRate = s_node->Node(mshp.AirOutletNode).MassFlowRate - + s_node->Node(ZoneInNode).MassFlowRate / mshp.FlowFraction; if (DeltaMassRate < 0.0) DeltaMassRate = 0.0; Real64 MassFlowRate(0.0); // parent mass flow rate Real64 LatentOutput(0.0); // latent output rate @@ -2271,37 +1920,37 @@ namespace HVACMultiSpeedHeatPump { Real64 SensibleOutputDelta(0.0); // delta sensible output rate Real64 LatentOutputDelta(0.0); // delta latent output rate Real64 TotalOutputDelta(0.0); // delta total output rate - MassFlowRate = state.dataLoopNodes->Node(ZoneInNode).MassFlowRate / MSHeatPump(MSHeatPumpNum).FlowFraction; - Real64 MinHumRat = state.dataLoopNodes->Node(ZoneInNode).HumRat; - if (state.dataLoopNodes->Node(OutNode).Temp < state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).NodeNumOfControlledZone).Temp) - MinHumRat = state.dataLoopNodes->Node(OutNode).HumRat; + MassFlowRate = s_node->Node(ZoneInNode).MassFlowRate / mshp.FlowFraction; + Real64 MinHumRat = s_node->Node(ZoneInNode).HumRat; + if (s_node->Node(mshp.AirOutletNode).Temp < s_node->Node(mshp.NodeNumOfControlledZone).Temp) + MinHumRat = s_node->Node(mshp.AirOutletNode).HumRat; CalcZoneSensibleLatentOutput(MassFlowRate, - state.dataLoopNodes->Node(OutNode).Temp, + s_node->Node(mshp.AirOutletNode).Temp, MinHumRat, - state.dataLoopNodes->Node(ZoneInNode).Temp, + s_node->Node(ZoneInNode).Temp, MinHumRat, - MSHeatPump(MSHeatPumpNum).LoadLoss, + mshp.LoadLoss, LatentOutput, TotalOutput); CalcZoneSensibleLatentOutput(DeltaMassRate, - state.dataLoopNodes->Node(OutNode).Temp, + s_node->Node(mshp.AirOutletNode).Temp, MinHumRat, - state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).NodeNumOfControlledZone).Temp, + s_node->Node(mshp.NodeNumOfControlledZone).Temp, MinHumRat, SensibleOutputDelta, LatentOutputDelta, TotalOutputDelta); - MSHeatPump(MSHeatPumpNum).LoadLoss = MSHeatPump(MSHeatPumpNum).LoadLoss + SensibleOutputDelta; - if (std::abs(MSHeatPump(MSHeatPumpNum).LoadLoss) < 1.0e-6) MSHeatPump(MSHeatPumpNum).LoadLoss = 0.0; + mshp.LoadLoss = mshp.LoadLoss + SensibleOutputDelta; + if (std::abs(mshp.LoadLoss) < 1.0e-6) mshp.LoadLoss = 0.0; } // Returns load only for zones requesting cooling (heating). If in deadband, Qzoneload = 0. - ZoneNum = MSHeatPump(MSHeatPumpNum).ControlZoneNum; - if ((MSHeatPump(MSHeatPumpNum).ZoneSequenceCoolingNum > 0) && (MSHeatPump(MSHeatPumpNum).ZoneSequenceHeatingNum > 0)) { - ZoneLoadToCoolSPSequenced = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(MSHeatPump(MSHeatPumpNum).ControlZoneNum) - .SequencedOutputRequiredToCoolingSP(MSHeatPump(MSHeatPumpNum).ZoneSequenceCoolingNum); - ZoneLoadToHeatSPSequenced = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(MSHeatPump(MSHeatPumpNum).ControlZoneNum) - .SequencedOutputRequiredToHeatingSP(MSHeatPump(MSHeatPumpNum).ZoneSequenceHeatingNum); + ZoneNum = mshp.ControlZoneNum; + if ((mshp.ZoneSequenceCoolingNum > 0) && (mshp.ZoneSequenceHeatingNum > 0)) { + ZoneLoadToCoolSPSequenced = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(mshp.ControlZoneNum) + .SequencedOutputRequiredToCoolingSP(mshp.ZoneSequenceCoolingNum); + ZoneLoadToHeatSPSequenced = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(mshp.ControlZoneNum) + .SequencedOutputRequiredToHeatingSP(mshp.ZoneSequenceHeatingNum); if (ZoneLoadToHeatSPSequenced > HVAC::SmallLoad && ZoneLoadToCoolSPSequenced > HVAC::SmallLoad) { QZnReq = ZoneLoadToHeatSPSequenced; } else if (ZoneLoadToHeatSPSequenced < (-1.0 * HVAC::SmallLoad) && ZoneLoadToCoolSPSequenced < (-1.0 * HVAC::SmallLoad)) { @@ -2311,60 +1960,60 @@ namespace HVACMultiSpeedHeatPump { } else { QZnReq = 0.0; // Autodesk:Init Case added to prevent use of uninitialized value (occurred in MultiSpeedACFurnace example) } - QZnReq /= MSHeatPump(MSHeatPumpNum).FlowFraction; + QZnReq /= mshp.FlowFraction; } else { - QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired / MSHeatPump(MSHeatPumpNum).FlowFraction; + QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired / mshp.FlowFraction; } if (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) QZnReq = 0.0; if (QZnReq > HVAC::SmallLoad) { - MSHeatPump(MSHeatPumpNum).HeatCoolMode = ModeOfOperation::HeatingMode; + mshp.HeatCoolMode = ModeOfOperation::HeatingMode; } else if (QZnReq < (-1.0 * HVAC::SmallLoad)) { - MSHeatPump(MSHeatPumpNum).HeatCoolMode = ModeOfOperation::CoolingMode; + mshp.HeatCoolMode = ModeOfOperation::CoolingMode; } else { - MSHeatPump(MSHeatPumpNum).HeatCoolMode = ModeOfOperation::Invalid; + mshp.HeatCoolMode = ModeOfOperation::Invalid; } // Determine the staged status if (allocated(state.dataZoneCtrls->StageZoneLogic)) { if (state.dataZoneCtrls->StageZoneLogic(ZoneNum)) { - MSHeatPump(MSHeatPumpNum).Staged = true; - MSHeatPump(MSHeatPumpNum).StageNum = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).StageNum; + mshp.Staged = true; + mshp.StageNum = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).StageNum; } else { - if (MSHeatPump(MSHeatPumpNum).MyStagedFlag) { + if (mshp.MyStagedFlag) { ShowWarningError(state, "ZoneControl:Thermostat:StagedDualSetpoint is found, but is not applied to this " "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed object = "); - ShowContinueError(state, format("{}. Please make correction. Simulation continues...", MSHeatPump(MSHeatPumpNum).Name)); - MSHeatPump(MSHeatPumpNum).MyStagedFlag = false; + ShowContinueError(state, format("{}. Please make correction. Simulation continues...", mshp.Name)); + mshp.MyStagedFlag = false; } } } // Set the inlet node mass flow rate - if (MSHeatPump(MSHeatPumpNum).fanOp == HVAC::FanOp::Continuous) { + if (mshp.fanOp == HVAC::FanOp::Continuous) { // constant fan mode if (QZnReq > HVAC::SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { - state.dataHVACMultiSpdHP->CompOnMassFlow = MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(1); - state.dataHVACMultiSpdHP->CompOnFlowRatio = MSHeatPump(MSHeatPumpNum).HeatingSpeedRatio(1); - MSHeatPump(MSHeatPumpNum).LastMode = ModeOfOperation::HeatingMode; + state.dataHVACMultiSpdHP->CompOnMassFlow = mshp.HeatMassFlowRate(1); + state.dataHVACMultiSpdHP->CompOnFlowRatio = mshp.HeatingSpeedRatio(1); + mshp.LastMode = ModeOfOperation::HeatingMode; } else if (QZnReq < (-1.0 * HVAC::SmallLoad) && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { - state.dataHVACMultiSpdHP->CompOnMassFlow = MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(1); - state.dataHVACMultiSpdHP->CompOnFlowRatio = MSHeatPump(MSHeatPumpNum).CoolingSpeedRatio(1); - MSHeatPump(MSHeatPumpNum).LastMode = ModeOfOperation::CoolingMode; + state.dataHVACMultiSpdHP->CompOnMassFlow = mshp.CoolMassFlowRate(1); + state.dataHVACMultiSpdHP->CompOnFlowRatio = mshp.CoolingSpeedRatio(1); + mshp.LastMode = ModeOfOperation::CoolingMode; } else { - state.dataHVACMultiSpdHP->CompOnMassFlow = MSHeatPump(MSHeatPumpNum).IdleMassFlowRate; - state.dataHVACMultiSpdHP->CompOnFlowRatio = MSHeatPump(MSHeatPumpNum).IdleSpeedRatio; + state.dataHVACMultiSpdHP->CompOnMassFlow = mshp.IdleMassFlowRate; + state.dataHVACMultiSpdHP->CompOnFlowRatio = mshp.IdleSpeedRatio; } - state.dataHVACMultiSpdHP->CompOffMassFlow = MSHeatPump(MSHeatPumpNum).IdleMassFlowRate; - state.dataHVACMultiSpdHP->CompOffFlowRatio = MSHeatPump(MSHeatPumpNum).IdleSpeedRatio; + state.dataHVACMultiSpdHP->CompOffMassFlow = mshp.IdleMassFlowRate; + state.dataHVACMultiSpdHP->CompOffFlowRatio = mshp.IdleSpeedRatio; } else { // cycling fan mode if (QZnReq > HVAC::SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { - state.dataHVACMultiSpdHP->CompOnMassFlow = MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(1); - state.dataHVACMultiSpdHP->CompOnFlowRatio = MSHeatPump(MSHeatPumpNum).HeatingSpeedRatio(1); + state.dataHVACMultiSpdHP->CompOnMassFlow = mshp.HeatMassFlowRate(1); + state.dataHVACMultiSpdHP->CompOnFlowRatio = mshp.HeatingSpeedRatio(1); } else if (QZnReq < (-1.0 * HVAC::SmallLoad) && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { - state.dataHVACMultiSpdHP->CompOnMassFlow = MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(1); - state.dataHVACMultiSpdHP->CompOnFlowRatio = MSHeatPump(MSHeatPumpNum).CoolingSpeedRatio(1); + state.dataHVACMultiSpdHP->CompOnMassFlow = mshp.CoolMassFlowRate(1); + state.dataHVACMultiSpdHP->CompOnFlowRatio = mshp.CoolingSpeedRatio(1); } else { state.dataHVACMultiSpdHP->CompOnMassFlow = 0.0; state.dataHVACMultiSpdHP->CompOnFlowRatio = 0.0; @@ -2374,14 +2023,14 @@ namespace HVACMultiSpeedHeatPump { } // Set the inlet node mass flow rate - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) > 0.0 && + if (ScheduleManager::GetCurrentScheduleValue(state, mshp.AvaiSchedPtr) > 0.0 && state.dataHVACMultiSpdHP->CompOnMassFlow != 0.0) { OnOffAirFlowRatio = 1.0; if (FirstHVACIteration) { - state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).AirInletNodeNum).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; + s_node->Node(mshp.AirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; PartLoadFrac = 0.0; } else { - if (MSHeatPump(MSHeatPumpNum).HeatCoolMode != ModeOfOperation::Invalid) { + if (mshp.HeatCoolMode != ModeOfOperation::Invalid) { PartLoadFrac = 1.0; } else { PartLoadFrac = 0.0; @@ -2389,72 +2038,58 @@ namespace HVACMultiSpeedHeatPump { } } else { PartLoadFrac = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(OutNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(OutNode).MassFlowRateMaxAvail = 0.0; + s_node->Node(mshp.AirInletNode).MassFlowRate = 0.0; + s_node->Node(mshp.AirOutletNode).MassFlowRate = 0.0; + s_node->Node(mshp.AirOutletNode).MassFlowRateMaxAvail = 0.0; OnOffAirFlowRatio = 1.0; } // Check availability of DX coils - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) > 0.0) { + if (ScheduleManager::GetCurrentScheduleValue(state, mshp.AvaiSchedPtr) > 0.0) { int CoilAvailSchPtr; // DX coil availability schedule pointer - if (MSHeatPump(MSHeatPumpNum).HeatCoolMode == ModeOfOperation::CoolingMode) { - CoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr( // TODO: Why isn't this stored on the struct? - state, - "Coil:Cooling:DX:MultiSpeed", - MSHeatPump(MSHeatPumpNum).DXCoolCoilName, - ErrorsFound, - MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex); - if (ErrorsFound) { - ShowFatalError(state, "InitMSHeatPump, The previous error causes termination."); - } + if (mshp.HeatCoolMode == ModeOfOperation::CoolingMode) { + CoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr(state, mshp.CoolCoilNum); if (ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr) == 0.0) { - if (MSHeatPump(MSHeatPumpNum).CoolCountAvail == 0) { - ++MSHeatPump(MSHeatPumpNum).CoolCountAvail; + if (mshp.CoolCountAvail == 0) { + ++mshp.CoolCountAvail; ShowWarningError( state, format("{} is ready to perform cooling, but its DX cooling coil = {} is not available at Available Schedule = {}.", - MSHeatPump(MSHeatPumpNum).Name, - MSHeatPump(MSHeatPumpNum).DXCoolCoilName, + mshp.Name, + mshp.CoolCoilName, ScheduleManager::GetScheduleName(state, CoilAvailSchPtr))); ShowContinueErrorTimeStamp( state, format("Availability schedule returned={:.1R}", ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr))); } else { - ++MSHeatPump(MSHeatPumpNum).CoolCountAvail; + ++mshp.CoolCountAvail; ShowRecurringWarningErrorAtEnd(state, - MSHeatPump(MSHeatPumpNum).Name + ": Cooling coil is still not available ...", - MSHeatPump(MSHeatPumpNum).CoolIndexAvail, + mshp.Name + ": Cooling coil is still not available ...", + mshp.CoolIndexAvail, ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr), ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr)); } } } - if (MSHeatPump(MSHeatPumpNum).HeatCoolMode == ModeOfOperation::HeatingMode && - MSHeatPump(MSHeatPumpNum).HeatCoilType == MultiSpeedHeatingCoil) { - CoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr(state, - "Coil:Heating:DX:MultiSpeed", - MSHeatPump(MSHeatPumpNum).DXHeatCoilName, - ErrorsFound, - MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); - if (ErrorsFound) { - ShowFatalError(state, "InitMSHeatPump, The previous error causes termination."); - } + + if (mshp.HeatCoolMode == ModeOfOperation::HeatingMode && + mshp.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { + CoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr(state, mshp.HeatCoilNum); if (ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr) == 0.0) { - if (MSHeatPump(MSHeatPumpNum).HeatCountAvail == 0) { - ++MSHeatPump(MSHeatPumpNum).HeatCountAvail; + if (mshp.HeatCountAvail == 0) { + ++mshp.HeatCountAvail; ShowWarningError( state, format("{} is ready to perform heating, but its DX heating coil = {} is not available at Available Schedule = {}.", - MSHeatPump(MSHeatPumpNum).Name, - MSHeatPump(MSHeatPumpNum).DXCoolCoilName, + mshp.Name, + mshp.CoolCoilName, ScheduleManager::GetScheduleName(state, CoilAvailSchPtr))); ShowContinueErrorTimeStamp( state, format("Availability schedule returned={:.1R}", ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr))); } else { - ++MSHeatPump(MSHeatPumpNum).HeatCountAvail; + ++mshp.HeatCountAvail; ShowRecurringWarningErrorAtEnd(state, - MSHeatPump(MSHeatPumpNum).Name + ": Heating coil is still not available ...", - MSHeatPump(MSHeatPumpNum).HeatIndexAvail, + mshp.Name + ": Heating coil is still not available ...", + mshp.HeatIndexAvail, ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr), ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr)); } @@ -2478,42 +2113,40 @@ namespace HVACMultiSpeedHeatPump { OnOffAirFlowRatio, state.dataHVACMultiSpdHP->SupHeaterLoad); - auto &e = MSHeatPump(MSHeatPumpNum); - { - e.TotHeatEnergyRate = 0.0; - e.SensHeatEnergyRate = 0.0; - e.LatHeatEnergyRate = 0.0; - e.TotCoolEnergyRate = 0.0; - e.SensCoolEnergyRate = 0.0; - e.LatCoolEnergyRate = 0.0; - } + mshp.TotHeatEnergyRate = 0.0; + mshp.SensHeatEnergyRate = 0.0; + mshp.LatHeatEnergyRate = 0.0; + mshp.TotCoolEnergyRate = 0.0; + mshp.SensCoolEnergyRate = 0.0; + mshp.LatCoolEnergyRate = 0.0; + // If unit is scheduled OFF, setpoint is equal to inlet node temperature. //!!LKL Discrepancy with < 0 - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) == 0.0) { - state.dataLoopNodes->Node(OutNode).Temp = state.dataLoopNodes->Node(InNode).Temp; + if (ScheduleManager::GetCurrentScheduleValue(state, mshp.AvaiSchedPtr) == 0.0) { + s_node->Node(mshp.AirOutletNode).Temp = s_node->Node(mshp.AirInletNode).Temp; return; } - if ((MSHeatPump(MSHeatPumpNum).HeatCoolMode == ModeOfOperation::Invalid && MSHeatPump(MSHeatPumpNum).fanOp == HVAC::FanOp::Cycling) || + if ((mshp.HeatCoolMode == ModeOfOperation::Invalid && mshp.fanOp == HVAC::FanOp::Cycling) || state.dataHVACMultiSpdHP->CompOnMassFlow == 0.0) { QZnReq = 0.0; PartLoadFrac = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(OutNode).MassFlowRateMaxAvail = 0.0; + s_node->Node(mshp.AirInletNode).MassFlowRate = 0.0; + s_node->Node(mshp.AirOutletNode).MassFlowRateMaxAvail = 0.0; } - MSHeatPump(MSHeatPumpNum).LoadMet = 0.0; + mshp.LoadMet = 0.0; SetAverageAirFlow(state, MSHeatPumpNum, PartLoadFrac, OnOffAirFlowRatio); // Init maximum available Heat Recovery flow rate - if ((MSHeatPump(MSHeatPumpNum).HeatRecActive) && (!MSHeatPump(MSHeatPumpNum).MyPlantScantFlag)) { + if ((mshp.HeatRecActive) && (!mshp.MyPlantScantFlag)) { if (PartLoadFrac > 0.0) { if (FirstHVACIteration) { - MdotHR = MSHeatPump(MSHeatPumpNum).DesignHeatRecMassFlowRate; + MdotHR = mshp.DesignHeatRecMassFlowRate; } else { - if (MSHeatPump(MSHeatPumpNum).HeatRecoveryMassFlowRate > 0.0) { - MdotHR = MSHeatPump(MSHeatPumpNum).HeatRecoveryMassFlowRate; + if (mshp.HeatRecoveryMassFlowRate > 0.0) { + MdotHR = mshp.HeatRecoveryMassFlowRate; } else { - MdotHR = MSHeatPump(MSHeatPumpNum).DesignHeatRecMassFlowRate; + MdotHR = mshp.DesignHeatRecMassFlowRate; } } } else { @@ -2522,83 +2155,80 @@ namespace HVACMultiSpeedHeatPump { PlantUtilities::SetComponentFlowRate(state, MdotHR, - MSHeatPump(MSHeatPumpNum).HeatRecInletNodeNum, - MSHeatPump(MSHeatPumpNum).HeatRecOutletNodeNum, - MSHeatPump(MSHeatPumpNum).HRPlantLoc); + mshp.HeatRecFluidInletNode, + mshp.HeatRecFluidOutletNode, + mshp.HRPlantLoc); } // get operating capacity of water and steam coil if (FirstHVACIteration) { - if (MSHeatPump(MSHeatPumpNum).HeatCoilType == HVAC::Coil_HeatingWater) { + if (mshp.heatCoilType == HVAC::CoilType::HeatingWater) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).CoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; - mdot = MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow; + s_node->Node(mshp.HeatCoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; + mdot = mshp.HeatCoilMaxFluidFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - MSHeatPump(MSHeatPumpNum).CoilControlNode, - MSHeatPump(MSHeatPumpNum).CoilOutletNode, - MSHeatPump(MSHeatPumpNum).plantLoc); + mshp.HeatCoilControlNode, + mshp.HeatCoilFluidOutletNode, + mshp.HeatCoilPlantLoc); // simulate water coil to find operating capacity - WaterCoils::SimulateWaterCoilComponents( - state, MSHeatPump(MSHeatPumpNum).HeatCoilName, FirstHVACIteration, MSHeatPump(MSHeatPumpNum).HeatCoilNum, QActual); - } // from IF(MSHeatPump(MSHeatPumpNum)%HeatCoilType == Coil_HeatingWater) THEN + WaterCoils::SimulateWaterCoilComponents(state, mshp.HeatCoilName, FirstHVACIteration, mshp.HeatCoilNum, QActual); - if (MSHeatPump(MSHeatPumpNum).HeatCoilType == HVAC::Coil_HeatingSteam) { + } else if (mshp.heatCoilType == HVAC::CoilType::HeatingSteam) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).CoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; - mdot = MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow; + s_node->Node(mshp.HeatCoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; + mdot = mshp.HeatCoilMaxFluidFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - MSHeatPump(MSHeatPumpNum).CoilControlNode, - MSHeatPump(MSHeatPumpNum).CoilOutletNode, - MSHeatPump(MSHeatPumpNum).plantLoc); + mshp.HeatCoilControlNode, + mshp.HeatCoilFluidOutletNode, + mshp.HeatCoilPlantLoc); // simulate steam coil to find operating capacity SteamCoils::SimulateSteamCoilComponents(state, - MSHeatPump(MSHeatPumpNum).HeatCoilName, + mshp.HeatCoilName, FirstHVACIteration, - MSHeatPump(MSHeatPumpNum).HeatCoilNum, + mshp.HeatCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - } // from IF(MSHeatPump(MSHeatPumpNum)%HeatCoilType == Coil_HeatingSteam) THEN - if (MSHeatPump(MSHeatPumpNum).SuppHeatCoilType == HVAC::Coil_HeatingWater) { + } + + if (mshp.suppHeatCoilType == HVAC::CoilType::HeatingWater) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).SuppCoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; - mdot = MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow; + s_node->Node(mshp.SuppHeatCoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; + mdot = mshp.SuppHeatCoilMaxFluidFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - MSHeatPump(MSHeatPumpNum).SuppCoilControlNode, - MSHeatPump(MSHeatPumpNum).SuppCoilOutletNode, - MSHeatPump(MSHeatPumpNum).SuppPlantLoc); + mshp.SuppHeatCoilControlNode, + mshp.SuppHeatCoilFluidOutletNode, + mshp.SuppHeatCoilPlantLoc); // simulate water coil to find operating capacity WaterCoils::SimulateWaterCoilComponents( - state, MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, FirstHVACIteration, MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum, QActual); - MSHeatPump(MSHeatPumpNum).DesignSuppHeatingCapacity = QActual; - - } // from IF(MSHeatPump(MSHeatPumpNum)%SuppHeatCoilType == Coil_HeatingWater) THEN + state, mshp.SuppHeatCoilName, FirstHVACIteration, mshp.SuppHeatCoilNum, QActual); + mshp.DesignSuppHeatingCapacity = QActual; - if (MSHeatPump(MSHeatPumpNum).SuppHeatCoilType == HVAC::Coil_HeatingSteam) { + } else if (mshp.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).SuppCoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; - mdot = MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow; + s_node->Node(mshp.SuppHeatCoilAirInletNode).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; + mdot = mshp.SuppHeatCoilMaxFluidFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - MSHeatPump(MSHeatPumpNum).SuppCoilControlNode, - MSHeatPump(MSHeatPumpNum).SuppCoilOutletNode, - MSHeatPump(MSHeatPumpNum).SuppPlantLoc); + mshp.SuppHeatCoilControlNode, + mshp.SuppHeatCoilFluidOutletNode, + mshp.SuppHeatCoilPlantLoc); // simulate steam coil to find operating capacity SteamCoils::SimulateSteamCoilComponents(state, - MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, + mshp.SuppHeatCoilName, FirstHVACIteration, - MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum, + mshp.SuppHeatCoilNum, 1.0, QActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - MSHeatPump(MSHeatPumpNum).DesignSuppHeatingCapacity = - SteamCoils::GetCoilCapacity(state, "Coil:Heating:Steam", MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, ErrorsFound); + mshp.DesignSuppHeatingCapacity = + SteamCoils::GetCoilCapacity(state, "Coil:Heating:Steam", mshp.SuppHeatCoilName, ErrorsFound); } // from IF(MSHeatPump(MSHeatPumpNum)%SuppHeatCoilType == Coil_HeatingSteam) THEN } // from IF( FirstHVACIteration ) THEN @@ -2615,31 +2245,23 @@ namespace HVACMultiSpeedHeatPump { // PURPOSE OF THIS SUBROUTINE: // This subroutine is for sizing multispeed heat pump airflow rates and flow fraction. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumOfSpeedCooling; // Number of speeds for cooling - int NumOfSpeedHeating; // Number of speeds for heating - int i; // Index to speed - - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); if (state.dataSize->CurSysNum > 0 && state.dataSize->CurOASysNum == 0) { - state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanNum = MSHeatPump.FanNum; - state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanType = MSHeatPump.fanType; - state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanPlace = MSHeatPump.fanPlace; + state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanNum = mshp.FanNum; + state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanType = mshp.fanType; + state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanPlace = mshp.fanPlace; } - NumOfSpeedCooling = MSHeatPump.NumOfSpeedCooling; - NumOfSpeedHeating = MSHeatPump.NumOfSpeedHeating; + for (int i = mshp.NumOfSpeedCooling; i >= 1; --i) { - for (i = NumOfSpeedCooling; i >= 1; --i) { - - if (MSHeatPump.CoolVolumeFlowRate(i) == DataSizing::AutoSize) { + if (mshp.CoolVolumeFlowRate(i) == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - if (i == NumOfSpeedCooling) { - CheckSysSizing(state, state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump.Name); - MSHeatPump.CoolVolumeFlowRate(i) = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; - if (MSHeatPump.FanVolFlow < MSHeatPump.CoolVolumeFlowRate(i) && MSHeatPump.FanVolFlow != DataSizing::AutoSize) { - MSHeatPump.CoolVolumeFlowRate(i) = MSHeatPump.FanVolFlow; - ShowWarningError(state, format("{} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump.Name)); + if (i == mshp.NumOfSpeedCooling) { + CheckSysSizing(state, state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name); + mshp.CoolVolumeFlowRate(i) = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; + if (mshp.FanVolFlow < mshp.CoolVolumeFlowRate(i) && mshp.FanVolFlow != DataSizing::AutoSize) { + mshp.CoolVolumeFlowRate(i) = mshp.FanVolFlow; + ShowWarningError(state, format("{} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); ShowContinueError(state, "The supply air flow rate at high speed is less than the autosized value for the supply air flow rate " "in cooling mode. Consider autosizing the fan for this simulation."); @@ -2648,35 +2270,35 @@ namespace HVACMultiSpeedHeatPump { "The air flow rate at high speed in cooling mode is reset to the supply air flow rate and the simulation continues."); } } else { - MSHeatPump.CoolVolumeFlowRate(i) = MSHeatPump.CoolVolumeFlowRate(NumOfSpeedCooling) * i / NumOfSpeedCooling; + mshp.CoolVolumeFlowRate(i) = mshp.CoolVolumeFlowRate(mshp.NumOfSpeedCooling) * i / mshp.NumOfSpeedCooling; } - if (MSHeatPump.CoolVolumeFlowRate(i) < HVAC::SmallAirVolFlow) { - MSHeatPump.CoolVolumeFlowRate = 0.0; + if (mshp.CoolVolumeFlowRate(i) < HVAC::SmallAirVolFlow) { + mshp.CoolVolumeFlowRate = 0.0; } // Ensure the flow rate at lower speed has to be less or equal to the flow rate at higher speed - if (i != NumOfSpeedCooling) { - if (MSHeatPump.CoolVolumeFlowRate(i) > MSHeatPump.CoolVolumeFlowRate(i + 1)) { - MSHeatPump.CoolVolumeFlowRate(i) = MSHeatPump.CoolVolumeFlowRate(i + 1); + if (i != mshp.NumOfSpeedCooling) { + if (mshp.CoolVolumeFlowRate(i) > mshp.CoolVolumeFlowRate(i + 1)) { + mshp.CoolVolumeFlowRate(i) = mshp.CoolVolumeFlowRate(i + 1); } } BaseSizer::reportSizerOutput(state, state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump.Name, + mshp.Name, format("Speed {} Supply Air Flow Rate During Cooling Operation [m3/s]", i), - MSHeatPump.CoolVolumeFlowRate(i)); + mshp.CoolVolumeFlowRate(i)); } } } - for (i = NumOfSpeedHeating; i >= 1; --i) { - if (MSHeatPump.HeatVolumeFlowRate(i) == DataSizing::AutoSize) { + for (int i = mshp.NumOfSpeedHeating; i >= 1; --i) { + if (mshp.HeatVolumeFlowRate(i) == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - if (i == NumOfSpeedHeating) { - CheckSysSizing(state, state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump.Name); - MSHeatPump.HeatVolumeFlowRate(i) = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; - if (MSHeatPump.FanVolFlow < MSHeatPump.HeatVolumeFlowRate(i) && MSHeatPump.FanVolFlow != DataSizing::AutoSize) { - MSHeatPump.HeatVolumeFlowRate(i) = MSHeatPump.FanVolFlow; - ShowWarningError(state, format("{} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump.Name)); + if (i == mshp.NumOfSpeedHeating) { + CheckSysSizing(state, state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name); + mshp.HeatVolumeFlowRate(i) = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; + if (mshp.FanVolFlow < mshp.HeatVolumeFlowRate(i) && mshp.FanVolFlow != DataSizing::AutoSize) { + mshp.HeatVolumeFlowRate(i) = mshp.FanVolFlow; + ShowWarningError(state, format("{} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); ShowContinueError(state, "The supply air flow rate at high speed is less than the autosized value for the maximum air flow rate " "in heating mode. Consider autosizing the fan for this simulation."); @@ -2685,33 +2307,33 @@ namespace HVACMultiSpeedHeatPump { "simulation continues."); } } else { - MSHeatPump.HeatVolumeFlowRate(i) = MSHeatPump.HeatVolumeFlowRate(NumOfSpeedHeating) * i / NumOfSpeedHeating; + mshp.HeatVolumeFlowRate(i) = mshp.HeatVolumeFlowRate(mshp.NumOfSpeedHeating) * i / mshp.NumOfSpeedHeating; } - if (MSHeatPump.HeatVolumeFlowRate(i) < HVAC::SmallAirVolFlow) { - MSHeatPump.HeatVolumeFlowRate(i) = 0.0; + if (mshp.HeatVolumeFlowRate(i) < HVAC::SmallAirVolFlow) { + mshp.HeatVolumeFlowRate(i) = 0.0; } // Ensure the flow rate at lower speed has to be less or equal to the flow rate at higher speed - if (i != NumOfSpeedHeating) { - if (MSHeatPump.HeatVolumeFlowRate(i) > MSHeatPump.HeatVolumeFlowRate(i + 1)) { - MSHeatPump.HeatVolumeFlowRate(i) = MSHeatPump.HeatVolumeFlowRate(i + 1); + if (i != mshp.NumOfSpeedHeating) { + if (mshp.HeatVolumeFlowRate(i) > mshp.HeatVolumeFlowRate(i + 1)) { + mshp.HeatVolumeFlowRate(i) = mshp.HeatVolumeFlowRate(i + 1); } } BaseSizer::reportSizerOutput(state, state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump.Name, + mshp.Name, format("Speed{}Supply Air Flow Rate During Heating Operation [m3/s]", i), - MSHeatPump.HeatVolumeFlowRate(i)); + mshp.HeatVolumeFlowRate(i)); } } } - if (MSHeatPump.IdleVolumeAirRate == DataSizing::AutoSize) { + if (mshp.IdleVolumeAirRate == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - CheckSysSizing(state, state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump.Name); - MSHeatPump.IdleVolumeAirRate = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; - if (MSHeatPump.FanVolFlow < MSHeatPump.IdleVolumeAirRate && MSHeatPump.FanVolFlow != DataSizing::AutoSize) { - MSHeatPump.IdleVolumeAirRate = MSHeatPump.FanVolFlow; - ShowWarningError(state, format("{} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, MSHeatPump.Name)); + CheckSysSizing(state, state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name); + mshp.IdleVolumeAirRate = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow; + if (mshp.FanVolFlow < mshp.IdleVolumeAirRate && mshp.FanVolFlow != DataSizing::AutoSize) { + mshp.IdleVolumeAirRate = mshp.FanVolFlow; + ShowWarningError(state, format("{} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, mshp.Name)); ShowContinueError(state, "The supply air flow rate is less than the autosized value for the maximum air flow rate when no heating or " "cooling is needed. Consider autosizing the fan for this simulation."); @@ -2719,55 +2341,48 @@ namespace HVACMultiSpeedHeatPump { "The maximum air flow rate when no heating or cooling is needed is reset to the supply air flow rate and the " "simulation continues."); } - if (MSHeatPump.IdleVolumeAirRate < HVAC::SmallAirVolFlow) { - MSHeatPump.IdleVolumeAirRate = 0.0; + if (mshp.IdleVolumeAirRate < HVAC::SmallAirVolFlow) { + mshp.IdleVolumeAirRate = 0.0; } BaseSizer::reportSizerOutput(state, state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump.Name, + mshp.Name, "Supply Air Flow Rate When No Cooling or Heating is Needed [m3/s]", - MSHeatPump.IdleVolumeAirRate); + mshp.IdleVolumeAirRate); } } - if (MSHeatPump.SuppMaxAirTemp == DataSizing::AutoSize) { + if (mshp.SuppMaxAirTemp == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - if (MSHeatPump.SuppHeatCoilType == 1) { // Gas - CheckZoneSizing(state, "Coil:Heating:Fuel", MSHeatPump.Name); - } else { - CheckZoneSizing(state, "Coil:Heating:Electric", MSHeatPump.Name); - } - MSHeatPump.SuppMaxAirTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatSupTemp; + CheckZoneSizing(state, HVAC::coilTypeNames[(int)mshp.suppHeatCoilType], mshp.Name); + + mshp.SuppMaxAirTemp = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatSupTemp; BaseSizer::reportSizerOutput(state, state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump.Name, + mshp.Name, "Maximum Supply Air Temperature from Supplemental Heater [C]", - MSHeatPump.SuppMaxAirTemp); + mshp.SuppMaxAirTemp); } } - if (MSHeatPump.DesignSuppHeatingCapacity == DataSizing::AutoSize) { + if (mshp.DesignSuppHeatingCapacity == DataSizing::AutoSize) { if (state.dataSize->CurSysNum > 0) { - if (MSHeatPump.SuppHeatCoilType == 1) { // Gas - CheckSysSizing(state, "Coil:Heating:Fuel", MSHeatPump.Name); - } else { - CheckSysSizing(state, "Coil:Heating:Electric", MSHeatPump.Name); - } - MSHeatPump.DesignSuppHeatingCapacity = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatCap; + CheckSysSizing(state, HVAC::coilTypeNames[(int)mshp.suppHeatCoilType], mshp.Name); + mshp.DesignSuppHeatingCapacity = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).HeatCap; } else { - MSHeatPump.DesignSuppHeatingCapacity = 0.0; + mshp.DesignSuppHeatingCapacity = 0.0; } BaseSizer::reportSizerOutput(state, state.dataHVACMultiSpdHP->CurrentModuleObject, - MSHeatPump.Name, + mshp.Name, "Supplemental Heating Coil Nominal Capacity [W]", - MSHeatPump.DesignSuppHeatingCapacity); + mshp.DesignSuppHeatingCapacity); } - state.dataSize->SuppHeatCap = MSHeatPump.DesignSuppHeatingCapacity; + state.dataSize->SuppHeatCap = mshp.DesignSuppHeatingCapacity; - if (MSHeatPump.HeatRecActive) { - PlantUtilities::RegisterPlantCompDesignFlow(state, MSHeatPump.HeatRecInletNodeNum, MSHeatPump.DesignHeatRecFlowRate); + if (mshp.HeatRecActive) { + PlantUtilities::RegisterPlantCompDesignFlow(state, mshp.HeatRecFluidInletNode, mshp.DesignHeatRecFlowRate); } } @@ -2791,31 +2406,31 @@ namespace HVACMultiSpeedHeatPump { OnOffAirFlowRatio = 0.0; SupHeaterLoad = 0.0; - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); // Get EMS output SpeedNum = ceil(SpeedVal); bool useMaxedSpeed = false; std::string useMaxedSpeedCoilName; - if (MSHeatPump.HeatCoolMode == ModeOfOperation::HeatingMode) { - if (SpeedNum > MSHeatPump.NumOfSpeedHeating) { - SpeedNum = MSHeatPump.NumOfSpeedHeating; + if (mshp.HeatCoolMode == ModeOfOperation::HeatingMode) { + if (SpeedNum > mshp.NumOfSpeedHeating) { + SpeedNum = mshp.NumOfSpeedHeating; useMaxedSpeed = true; - useMaxedSpeedCoilName = MSHeatPump.DXHeatCoilName; + useMaxedSpeedCoilName = mshp.HeatCoilName; } - } else if (MSHeatPump.HeatCoolMode == ModeOfOperation::CoolingMode) { - if (SpeedNum > MSHeatPump.NumOfSpeedCooling) { - SpeedNum = MSHeatPump.NumOfSpeedCooling; + } else if (mshp.HeatCoolMode == ModeOfOperation::CoolingMode) { + if (SpeedNum > mshp.NumOfSpeedCooling) { + SpeedNum = mshp.NumOfSpeedCooling; useMaxedSpeed = true; - useMaxedSpeedCoilName = MSHeatPump.DXCoolCoilName; + useMaxedSpeedCoilName = mshp.CoolCoilName; } } if (useMaxedSpeed) { - MSHeatPump.CoilSpeedErrIndex++; + mshp.CoilSpeedErrIndex++; ShowRecurringWarningErrorAtEnd(state, "Wrong coil speed EMS override value, for unit=\"" + useMaxedSpeedCoilName + "\". Exceeding maximum coil speed level. Speed level is set to the maximum coil speed level allowed.", - MSHeatPump.CoilSpeedErrIndex, + mshp.CoilSpeedErrIndex, SpeedVal, SpeedVal, _, @@ -2898,11 +2513,12 @@ namespace HVACMultiSpeedHeatPump { // if the DX heating coil cannot meet the load, trim with supplemental heater // occurs with constant fan mode when compressor is on or off // occurs with cycling fan mode when compressor PLR is equal to 1 - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &s_node = state.dataLoopNodes; + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); if ((QZnReq > HVAC::SmallLoad && QZnReq > EMSOutput)) { Real64 TempOutput; - if (state.dataEnvrn->OutDryBulbTemp <= MSHeatPump.SuppMaxAirTemp) { + if (state.dataEnvrn->OutDryBulbTemp <= mshp.SuppMaxAirTemp) { SupHeaterLoad = QZnReq - EMSOutput; } else { SupHeaterLoad = 0.0; @@ -2921,7 +2537,7 @@ namespace HVACMultiSpeedHeatPump { } // check the outlet of the supplemental heater to be lower than the maximum supplemental heater supply air temperature - if (state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).Temp > MSHeatPump.SuppMaxAirTemp && SupHeaterLoad > 0.0) { + if (s_node->Node(mshp.AirOutletNode).Temp > mshp.SuppMaxAirTemp && SupHeaterLoad > 0.0) { // If the supply air temperature is to high, turn off the supplemental heater to recalculate the outlet temperature SupHeaterLoad = 0.0; @@ -2932,10 +2548,10 @@ namespace HVACMultiSpeedHeatPump { // the supplemental heater, otherwise leave the supplemental heater off. If the supplemental heater is to be turned on, // use the outlet conditions when the supplemental heater was off (CALL above) as the inlet conditions for the calculation // of supplemental heater load to just meet the maximum supply air temperature from the supplemental heater. - if (state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).Temp < MSHeatPump.SuppMaxAirTemp) { - Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).HumRat); - SupHeaterLoad = state.dataLoopNodes->Node(MSHeatPump.AirInletNodeNum).MassFlowRate * CpAir * - (MSHeatPump.SuppMaxAirTemp - state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).Temp); + if (s_node->Node(mshp.AirOutletNode).Temp < mshp.SuppMaxAirTemp) { + Real64 CpAir = Psychrometrics::PsyCpAirFnW(s_node->Node(mshp.AirOutletNode).HumRat); + SupHeaterLoad = s_node->Node(mshp.AirInletNode).MassFlowRate * CpAir * + (mshp.SuppMaxAirTemp - s_node->Node(mshp.AirOutletNode).Temp); } else { SupHeaterLoad = 0.0; @@ -2991,10 +2607,12 @@ namespace HVACMultiSpeedHeatPump { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &s_node = state.dataLoopNodes; + + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); //!!LKL Discrepancy with < 0 - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump.AvaiSchedPtr) == 0.0) return; + if (ScheduleManager::GetCurrentScheduleValue(state, mshp.AvaiSchedPtr) == 0.0) return; // Get result when DX coil is off CalcMSHeatPump(state, @@ -3019,17 +2637,17 @@ namespace HVACMultiSpeedHeatPump { // Get full load result PartLoadFrac = 1.0; SpeedRatio = 1.0; - if (MSHeatPump.HeatCoolMode == ModeOfOperation::HeatingMode) { - SpeedNum = MSHeatPump.NumOfSpeedHeating; - if (MSHeatPump.Staged && std::abs(MSHeatPump.StageNum) < SpeedNum) { - SpeedNum = std::abs(MSHeatPump.StageNum); + if (mshp.HeatCoolMode == ModeOfOperation::HeatingMode) { + SpeedNum = mshp.NumOfSpeedHeating; + if (mshp.Staged && std::abs(mshp.StageNum) < SpeedNum) { + SpeedNum = std::abs(mshp.StageNum); if (SpeedNum == 1) SpeedRatio = 0.0; } } - if (MSHeatPump.HeatCoolMode == ModeOfOperation::CoolingMode) { - SpeedNum = MSHeatPump.NumOfSpeedCooling; - if (MSHeatPump.Staged && std::abs(MSHeatPump.StageNum) < SpeedNum) { - SpeedNum = std::abs(MSHeatPump.StageNum); + if (mshp.HeatCoolMode == ModeOfOperation::CoolingMode) { + SpeedNum = mshp.NumOfSpeedCooling; + if (mshp.Staged && std::abs(mshp.StageNum) < SpeedNum) { + SpeedNum = std::abs(mshp.StageNum); if (SpeedNum == 1) SpeedRatio = 0.0; } } @@ -3059,7 +2677,7 @@ namespace HVACMultiSpeedHeatPump { if (QZnReq <= FullOutput) { PartLoadFrac = 1.0; SpeedRatio = 1.0; - if (MSHeatPump.Staged && SpeedNum == 1) SpeedRatio = 0.0; + if (mshp.Staged && SpeedNum == 1) SpeedRatio = 0.0; state.dataHVACMultiSpdHP->MSHeatPumpReport(MSHeatPumpNum).CycRatio = PartLoadFrac; state.dataHVACMultiSpdHP->MSHeatPumpReport(MSHeatPumpNum).SpeedRatio = SpeedRatio; state.dataHVACMultiSpdHP->MSHeatPumpReport(MSHeatPumpNum).SpeedNum = SpeedNum; @@ -3083,16 +2701,16 @@ namespace HVACMultiSpeedHeatPump { } // Direct solution - if (state.dataGlobal->DoCoilDirectSolutions && !MSHeatPump.Staged) { + if (state.dataGlobal->DoCoilDirectSolutions && !mshp.Staged) { Real64 TempOutput0 = 0.0; - MSHeatPump.FullOutput = 0.0; + mshp.FullOutput = 0.0; // heating if (QZnReq > HVAC::SmallLoad && QZnReq < FullOutput) { CalcMSHeatPump( state, MSHeatPumpNum, FirstHVACIteration, compressorOp, 1, 0.0, 0.0, TempOutput0, QZnReq, OnOffAirFlowRatio, SupHeaterLoad); - for (int k = 1; k <= MSHeatPump.NumOfSpeedHeating; ++k) { + for (int k = 1; k <= mshp.NumOfSpeedHeating; ++k) { if (k == 1) { CalcMSHeatPump(state, MSHeatPumpNum, @@ -3101,13 +2719,13 @@ namespace HVACMultiSpeedHeatPump { k, 0.0, 1.0, - MSHeatPump.FullOutput(k), + mshp.FullOutput(k), QZnReq, OnOffAirFlowRatio, SupHeaterLoad); - if (QZnReq <= MSHeatPump.FullOutput(k)) { + if (QZnReq <= mshp.FullOutput(k)) { SpeedNum = k; - PartLoadFrac = (QZnReq - TempOutput0) / (MSHeatPump.FullOutput(k) - TempOutput0); + PartLoadFrac = (QZnReq - TempOutput0) / (mshp.FullOutput(k) - TempOutput0); CalcMSHeatPump(state, MSHeatPumpNum, FirstHVACIteration, @@ -3129,14 +2747,14 @@ namespace HVACMultiSpeedHeatPump { k, 1.0, 1.0, - MSHeatPump.FullOutput(k), + mshp.FullOutput(k), QZnReq, OnOffAirFlowRatio, SupHeaterLoad); - if (QZnReq <= MSHeatPump.FullOutput(k)) { + if (QZnReq <= mshp.FullOutput(k)) { SpeedNum = k; PartLoadFrac = 1.0; - SpeedRatio = (QZnReq - MSHeatPump.FullOutput(k - 1)) / (MSHeatPump.FullOutput(k) - MSHeatPump.FullOutput(k - 1)); + SpeedRatio = (QZnReq - mshp.FullOutput(k - 1)) / (mshp.FullOutput(k) - mshp.FullOutput(k - 1)); CalcMSHeatPump(state, MSHeatPumpNum, FirstHVACIteration, @@ -3158,7 +2776,7 @@ namespace HVACMultiSpeedHeatPump { if (QZnReq < (-1.0 * HVAC::SmallLoad) && QZnReq > FullOutput) { CalcMSHeatPump( state, MSHeatPumpNum, FirstHVACIteration, compressorOp, 1, 0.0, 0.0, TempOutput0, QZnReq, OnOffAirFlowRatio, SupHeaterLoad); - for (int k = 1; k <= MSHeatPump.NumOfSpeedCooling; ++k) { + for (int k = 1; k <= mshp.NumOfSpeedCooling; ++k) { if (k == 1) { CalcMSHeatPump(state, MSHeatPumpNum, @@ -3167,13 +2785,13 @@ namespace HVACMultiSpeedHeatPump { k, 0.0, 1.0, - MSHeatPump.FullOutput(k), + mshp.FullOutput(k), QZnReq, OnOffAirFlowRatio, SupHeaterLoad); - if (QZnReq >= MSHeatPump.FullOutput(k)) { + if (QZnReq >= mshp.FullOutput(k)) { SpeedNum = k; - PartLoadFrac = (QZnReq - TempOutput0) / (MSHeatPump.FullOutput(k) - TempOutput0); + PartLoadFrac = (QZnReq - TempOutput0) / (mshp.FullOutput(k) - TempOutput0); CalcMSHeatPump(state, MSHeatPumpNum, FirstHVACIteration, @@ -3195,14 +2813,14 @@ namespace HVACMultiSpeedHeatPump { k, 1.0, 1.0, - MSHeatPump.FullOutput(k), + mshp.FullOutput(k), QZnReq, OnOffAirFlowRatio, SupHeaterLoad); - if (QZnReq >= MSHeatPump.FullOutput(k)) { + if (QZnReq >= mshp.FullOutput(k)) { SpeedNum = k; PartLoadFrac = 1.0; - SpeedRatio = (QZnReq - MSHeatPump.FullOutput(k - 1)) / (MSHeatPump.FullOutput(k) - MSHeatPump.FullOutput(k - 1)); + SpeedRatio = (QZnReq - mshp.FullOutput(k - 1)) / (mshp.FullOutput(k) - mshp.FullOutput(k - 1)); CalcMSHeatPump(state, MSHeatPumpNum, FirstHVACIteration, @@ -3222,7 +2840,7 @@ namespace HVACMultiSpeedHeatPump { } else { // Calculate the part load fraction if (((QZnReq > HVAC::SmallLoad && QZnReq < FullOutput) || (QZnReq < (-1.0 * HVAC::SmallLoad) && QZnReq > FullOutput)) && - (!MSHeatPump.Staged)) { + (!mshp.Staged)) { // Check whether the low speed coil can meet the load or not CalcMSHeatPump( state, MSHeatPumpNum, FirstHVACIteration, compressorOp, 1, 0.0, 1.0, LowOutput, QZnReq, OnOffAirFlowRatio, SupHeaterLoad); @@ -3255,14 +2873,14 @@ namespace HVACMultiSpeedHeatPump { if (state.dataHVACMultiSpdHP->ErrCountCyc == 0) { ++state.dataHVACMultiSpdHP->ErrCountCyc; // TODO: Why is the error count shared among all heat pump units? ShowWarningError(state, - format("Iteration limit exceeded calculating DX unit cycling ratio, for unit={}", MSHeatPump.Name)); + format("Iteration limit exceeded calculating DX unit cycling ratio, for unit={}", mshp.Name)); ShowContinueErrorTimeStamp(state, format("Cycling ratio returned={:.2R}", PartLoadFrac)); } else { ++state.dataHVACMultiSpdHP->ErrCountCyc; ShowRecurringWarningErrorAtEnd( state, - MSHeatPump.Name + "\": Iteration limit warning exceeding calculating DX unit cycling ratio continues...", - MSHeatPump.ErrIndexCyc, + mshp.Name + "\": Iteration limit warning exceeding calculating DX unit cycling ratio continues...", + mshp.ErrIndexCyc, PartLoadFrac, PartLoadFrac); } @@ -3270,14 +2888,14 @@ namespace HVACMultiSpeedHeatPump { } else if (SolFla == -2) { ShowFatalError( state, - format("DX unit cycling ratio calculation failed: cycling limits exceeded, for unit={}", MSHeatPump.DXCoolCoilName)); + format("DX unit cycling ratio calculation failed: cycling limits exceeded, for unit={}", mshp.CoolCoilName)); } } else { // Check to see which speed to meet the load PartLoadFrac = 1.0; SpeedRatio = 1.0; if (QZnReq < (-1.0 * HVAC::SmallLoad)) { // Cooling - for (i = 2; i <= MSHeatPump.NumOfSpeedCooling; ++i) { + for (i = 2; i <= mshp.NumOfSpeedCooling; ++i) { CalcMSHeatPump(state, MSHeatPumpNum, FirstHVACIteration, @@ -3295,7 +2913,7 @@ namespace HVACMultiSpeedHeatPump { } } } else { - for (i = 2; i <= MSHeatPump.NumOfSpeedHeating; ++i) { + for (i = 2; i <= mshp.NumOfSpeedHeating; ++i) { CalcMSHeatPump(state, MSHeatPumpNum, FirstHVACIteration, @@ -3339,14 +2957,14 @@ namespace HVACMultiSpeedHeatPump { if (state.dataHVACMultiSpdHP->ErrCountVar == 0) { ++state.dataHVACMultiSpdHP->ErrCountVar; ShowWarningError(state, - format("Iteration limit exceeded calculating DX unit speed ratio, for unit={}", MSHeatPump.Name)); + format("Iteration limit exceeded calculating DX unit speed ratio, for unit={}", mshp.Name)); ShowContinueErrorTimeStamp(state, format("Speed ratio returned=[{:.2R}], Speed number ={}", SpeedRatio, SpeedNum)); } else { ++state.dataHVACMultiSpdHP->ErrCountVar; ShowRecurringWarningErrorAtEnd( state, - MSHeatPump.Name + "\": Iteration limit warning exceeding calculating DX unit speed ratio continues...", - MSHeatPump.ErrIndexVar, + mshp.Name + "\": Iteration limit warning exceeding calculating DX unit speed ratio continues...", + mshp.ErrIndexVar, SpeedRatio, SpeedRatio); } @@ -3354,13 +2972,13 @@ namespace HVACMultiSpeedHeatPump { } else if (SolFla == -2) { ShowFatalError( state, - format("DX unit compressor speed calculation failed: speed limits exceeded, for unit={}", MSHeatPump.DXCoolCoilName)); + format("DX unit compressor speed calculation failed: speed limits exceeded, for unit={}", mshp.CoolCoilName)); } } } else { // Staged thermostat performance - if (MSHeatPump.StageNum != 0) { - SpeedNum = std::abs(MSHeatPump.StageNum); + if (mshp.StageNum != 0) { + SpeedNum = std::abs(mshp.StageNum); if (SpeedNum == 1) { CalcMSHeatPump( state, MSHeatPumpNum, FirstHVACIteration, compressorOp, 1, 0.0, 1.0, LowOutput, QZnReq, OnOffAirFlowRatio, SupHeaterLoad); @@ -3393,14 +3011,14 @@ namespace HVACMultiSpeedHeatPump { ++state.dataHVACMultiSpdHP->ErrCountCyc; ShowWarningError( state, - format("Iteration limit exceeded calculating DX unit cycling ratio, for unit={}", MSHeatPump.Name)); + format("Iteration limit exceeded calculating DX unit cycling ratio, for unit={}", mshp.Name)); ShowContinueErrorTimeStamp(state, format("Cycling ratio returned={:.2R}", PartLoadFrac)); } else { ++state.dataHVACMultiSpdHP->ErrCountCyc; ShowRecurringWarningErrorAtEnd( state, - MSHeatPump.Name + "\": Iteration limit warning exceeding calculating DX unit cycling ratio continues...", - MSHeatPump.ErrIndexCyc, + mshp.Name + "\": Iteration limit warning exceeding calculating DX unit cycling ratio continues...", + mshp.ErrIndexCyc, PartLoadFrac, PartLoadFrac); } @@ -3408,17 +3026,17 @@ namespace HVACMultiSpeedHeatPump { } else if (SolFla == -2) { ShowFatalError(state, format("DX unit cycling ratio calculation failed: cycling limits exceeded, for unit={}", - MSHeatPump.DXCoolCoilName)); + mshp.CoolCoilName)); } } else { FullOutput = LowOutput; PartLoadFrac = 1.0; } } else { - if (MSHeatPump.StageNum < 0) { - SpeedNum = min(MSHeatPump.NumOfSpeedCooling, std::abs(MSHeatPump.StageNum)); + if (mshp.StageNum < 0) { + SpeedNum = min(mshp.NumOfSpeedCooling, std::abs(mshp.StageNum)); } else { - SpeedNum = min(MSHeatPump.NumOfSpeedHeating, std::abs(MSHeatPump.StageNum)); + SpeedNum = min(mshp.NumOfSpeedHeating, std::abs(mshp.StageNum)); } CalcMSHeatPump(state, MSHeatPumpNum, @@ -3472,16 +3090,16 @@ namespace HVACMultiSpeedHeatPump { ++state.dataHVACMultiSpdHP->ErrCountVar; ShowWarningError( state, - format("Iteration limit exceeded calculating DX unit speed ratio, for unit={}", MSHeatPump.Name)); + format("Iteration limit exceeded calculating DX unit speed ratio, for unit={}", mshp.Name)); ShowContinueErrorTimeStamp( state, format("Speed ratio returned=[{:.2R}], Speed number ={}", SpeedRatio, SpeedNum)); } else { ++state.dataHVACMultiSpdHP->ErrCountVar; ShowRecurringWarningErrorAtEnd( state, - MSHeatPump.Name + + mshp.Name + "\": Iteration limit warning exceeding calculating DX unit speed ratio continues...", - MSHeatPump.ErrIndexVar, + mshp.ErrIndexVar, SpeedRatio, SpeedRatio); } @@ -3489,7 +3107,7 @@ namespace HVACMultiSpeedHeatPump { } else if (SolFla == -2) { ShowFatalError(state, format("DX unit compressor speed calculation failed: speed limits exceeded, for unit={}", - MSHeatPump.DXCoolCoilName)); + mshp.CoolCoilName)); } } else { SpeedRatio = 1.0; @@ -3508,8 +3126,8 @@ namespace HVACMultiSpeedHeatPump { if ((QZnReq > HVAC::SmallLoad && QZnReq > FullOutput)) { PartLoadFrac = 1.0; SpeedRatio = 1.0; - if (MSHeatPump.Staged && SpeedNum == 1) SpeedRatio = 0.0; - if (OutsideDryBulbTemp <= MSHeatPump.SuppMaxAirTemp) { + if (mshp.Staged && SpeedNum == 1) SpeedRatio = 0.0; + if (OutsideDryBulbTemp <= mshp.SuppMaxAirTemp) { SupHeaterLoad = QZnReq - FullOutput; } else { SupHeaterLoad = 0.0; @@ -3528,7 +3146,7 @@ namespace HVACMultiSpeedHeatPump { } // check the outlet of the supplemental heater to be lower than the maximum supplemental heater supply air temperature - if (state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).Temp > MSHeatPump.SuppMaxAirTemp && SupHeaterLoad > 0.0) { + if (s_node->Node(mshp.AirOutletNode).Temp > mshp.SuppMaxAirTemp && SupHeaterLoad > 0.0) { // If the supply air temperature is to high, turn off the supplemental heater to recalculate the outlet temperature SupHeaterLoad = 0.0; @@ -3538,10 +3156,10 @@ namespace HVACMultiSpeedHeatPump { // the supplemental heater, otherwise leave the supplemental heater off. If the supplemental heater is to be turned on, // use the outlet conditions when the supplemental heater was off (CALL above) as the inlet conditions for the calculation // of supplemental heater load to just meet the maximum supply air temperature from the supplemental heater. - if (state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).Temp < MSHeatPump.SuppMaxAirTemp) { - CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).HumRat); - SupHeaterLoad = state.dataLoopNodes->Node(MSHeatPump.AirInletNodeNum).MassFlowRate * CpAir * - (MSHeatPump.SuppMaxAirTemp - state.dataLoopNodes->Node(MSHeatPump.AirOutletNodeNum).Temp); + if (s_node->Node(mshp.AirOutletNode).Temp < mshp.SuppMaxAirTemp) { + CpAir = Psychrometrics::PsyCpAirFnW(s_node->Node(mshp.AirOutletNode).HumRat); + SupHeaterLoad = s_node->Node(mshp.AirInletNode).MassFlowRate * CpAir * + (mshp.SuppMaxAirTemp - s_node->Node(mshp.AirOutletNode).Temp); } else { SupHeaterLoad = 0.0; @@ -3576,8 +3194,6 @@ namespace HVACMultiSpeedHeatPump { // This routine will calculates MSHP performance based on given system load // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int OutletNode; // MSHP air outlet node - int InletNode; // MSHP air inlet node Real64 OutsideDryBulbTemp; // Outdoor dry bulb temperature [C] Real64 AirMassFlow; // Air mass flow rate [kg/s] Real64 SavePartloadRatio; @@ -3586,21 +3202,20 @@ namespace HVACMultiSpeedHeatPump { Real64 MinWaterFlow; // minimum water flow rate Real64 ErrorToler; // supplemental heating coil convergence tolerance - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &s_node = state.dataLoopNodes; + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); - OutletNode = MSHeatPump.AirOutletNodeNum; - InletNode = MSHeatPump.AirInletNodeNum; - if (MSHeatPump.DXHeatCoilIndex > 0) { - if (state.dataDXCoils->DXCoil(MSHeatPump.DXHeatCoilIndex).IsSecondaryDXCoilInZone) { + if (mshp.HeatCoilNum > 0) { + if (state.dataDXCoils->DXCoil(mshp.HeatCoilNum).IsSecondaryDXCoilInZone) { OutsideDryBulbTemp = - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(MSHeatPump.DXHeatCoilIndex).SecZonePtr).ZT; + state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(mshp.HeatCoilNum).SecZonePtr).ZT; } else { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; } - } else if (MSHeatPump.DXCoolCoilIndex > 0) { - if (state.dataDXCoils->DXCoil(MSHeatPump.DXCoolCoilIndex).IsSecondaryDXCoilInZone) { + } else if (mshp.CoolCoilNum > 0) { + if (state.dataDXCoils->DXCoil(mshp.CoolCoilNum).IsSecondaryDXCoilInZone) { OutsideDryBulbTemp = - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(MSHeatPump.DXCoolCoilIndex).SecZonePtr).ZT; + state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(mshp.CoolCoilNum).SecZonePtr).ZT; } else { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; } @@ -3615,202 +3230,207 @@ namespace HVACMultiSpeedHeatPump { // Set inlet air mass flow rate based on PLR and compressor on/off air flow rates SetAverageAirFlow(state, MSHeatPumpNum, PartLoadFrac, OnOffAirFlowRatio, SpeedNum, SpeedRatio); - AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; + AirMassFlow = s_node->Node(mshp.AirInletNode).MassFlowRate; // if blow through, simulate fan then coils - if (MSHeatPump.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(MSHeatPump.FanNum)->simulate(state, FirstHVACIteration, state.dataHVACMultiSpdHP->FanSpeedRatio); + if (mshp.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(mshp.FanNum)->simulate(state, FirstHVACIteration, state.dataHVACMultiSpdHP->FanSpeedRatio); if (QZnReq < (-1.0 * HVAC::SmallLoad)) { - if (OutsideDryBulbTemp > MSHeatPump.MinOATCompressorCooling) { + if (OutsideDryBulbTemp > mshp.MinOATCompressorCooling) { DXCoils::SimDXCoilMultiSpeed(state, - MSHeatPump.DXCoolCoilName, + mshp.CoolCoilName, SpeedRatio, PartLoadFrac, - MSHeatPump.DXCoolCoilIndex, + mshp.CoolCoilNum, SpeedNum, - MSHeatPump.fanOp, + mshp.fanOp, compressorOp); SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXCoolCoilName, 0.0, 0.0, MSHeatPump.DXCoolCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.CoolCoilName, 0.0, 0.0, mshp.CoolCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump.DXCoolCoilIndex); + state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(mshp.CoolCoilNum); } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXCoolCoilName, 0.0, 0.0, MSHeatPump.DXCoolCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.CoolCoilName, 0.0, 0.0, mshp.CoolCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - if (MSHeatPump.HeatCoilType == MultiSpeedHeatingCoil) { + + if (mshp.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { if (QZnReq > HVAC::SmallLoad) { - if (OutsideDryBulbTemp > MSHeatPump.MinOATCompressorHeating) { + if (OutsideDryBulbTemp > mshp.MinOATCompressorHeating) { DXCoils::SimDXCoilMultiSpeed(state, - MSHeatPump.DXHeatCoilName, + mshp.HeatCoilName, SpeedRatio, PartLoadFrac, - MSHeatPump.DXHeatCoilIndex, + mshp.HeatCoilNum, SpeedNum, - MSHeatPump.fanOp, + mshp.fanOp, compressorOp); SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXHeatCoilName, 0.0, 0.0, MSHeatPump.DXHeatCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.HeatCoilName, 0.0, 0.0, mshp.HeatCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump.DXHeatCoilIndex); + state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(mshp.HeatCoilNum); } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXHeatCoilName, 0.0, 0.0, MSHeatPump.DXHeatCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.HeatCoilName, 0.0, 0.0, mshp.HeatCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - } else if (MSHeatPump.HeatCoilType == HVAC::Coil_HeatingElectric_MultiStage || - MSHeatPump.HeatCoilType == HVAC::Coil_HeatingGas_MultiStage) { + + } else if (mshp.heatCoilType == HVAC::CoilType::HeatingElectricMultiStage || + mshp.heatCoilType == HVAC::CoilType::HeatingGasMultiStage) { if (QZnReq > HVAC::SmallLoad) { HeatingCoils::SimulateHeatingCoilComponents( - state, MSHeatPump.HeatCoilName, FirstHVACIteration, _, 0, _, _, MSHeatPump.fanOp, PartLoadFrac, SpeedNum, SpeedRatio); + state, mshp.HeatCoilName, FirstHVACIteration, _, 0, _, _, mshp.fanOp, PartLoadFrac, SpeedNum, SpeedRatio); } else { HeatingCoils::SimulateHeatingCoilComponents( - state, MSHeatPump.HeatCoilName, FirstHVACIteration, _, 0, _, _, MSHeatPump.fanOp, 0.0, SpeedNum, 0.0); + state, mshp.HeatCoilName, FirstHVACIteration, _, 0, _, _, mshp.fanOp, 0.0, SpeedNum, 0.0); } } else { - CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, QZnReq, MSHeatPump.fanOp, QCoilActual, PartLoadFrac); + CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, QZnReq, mshp.fanOp, QCoilActual, PartLoadFrac); } // Call twice to ensure the fan outlet conditions are updated - state.dataFans->fans(MSHeatPump.FanNum)->simulate(state, FirstHVACIteration, state.dataHVACMultiSpdHP->FanSpeedRatio); + state.dataFans->fans(mshp.FanNum)->simulate(state, FirstHVACIteration, state.dataHVACMultiSpdHP->FanSpeedRatio); if (QZnReq < (-1.0 * HVAC::SmallLoad)) { - if (OutsideDryBulbTemp > MSHeatPump.MinOATCompressorCooling) { + if (OutsideDryBulbTemp > mshp.MinOATCompressorCooling) { DXCoils::SimDXCoilMultiSpeed(state, - MSHeatPump.DXCoolCoilName, + mshp.CoolCoilName, SpeedRatio, PartLoadFrac, - MSHeatPump.DXCoolCoilIndex, + mshp.CoolCoilNum, SpeedNum, - MSHeatPump.fanOp, + mshp.fanOp, compressorOp); SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXCoolCoilName, 0.0, 0.0, MSHeatPump.DXCoolCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.CoolCoilName, 0.0, 0.0, mshp.CoolCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump.DXCoolCoilIndex); + state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(mshp.CoolCoilNum); } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXCoolCoilName, 0.0, 0.0, MSHeatPump.DXCoolCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.CoolCoilName, 0.0, 0.0, mshp.CoolCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - if (MSHeatPump.HeatCoilType == MultiSpeedHeatingCoil) { + + if (mshp.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { if (QZnReq > HVAC::SmallLoad) { - if (OutsideDryBulbTemp > MSHeatPump.MinOATCompressorHeating) { + if (OutsideDryBulbTemp > mshp.MinOATCompressorHeating) { DXCoils::SimDXCoilMultiSpeed(state, - MSHeatPump.DXHeatCoilName, + mshp.HeatCoilName, SpeedRatio, PartLoadFrac, - MSHeatPump.DXHeatCoilIndex, + mshp.HeatCoilNum, SpeedNum, - MSHeatPump.fanOp, + mshp.fanOp, compressorOp); SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXHeatCoilName, 0.0, 0.0, MSHeatPump.DXHeatCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.HeatCoilName, 0.0, 0.0, mshp.HeatCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump.DXHeatCoilIndex); + state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(mshp.HeatCoilNum); } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXHeatCoilName, 0.0, 0.0, MSHeatPump.DXHeatCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.HeatCoilName, 0.0, 0.0, mshp.HeatCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - } else if (MSHeatPump.HeatCoilType == HVAC::Coil_HeatingElectric_MultiStage || - MSHeatPump.HeatCoilType == HVAC::Coil_HeatingGas_MultiStage) { + + } else if (mshp.heatCoilType == HVAC::CoilType::HeatingElectricMultiStage || + mshp.heatCoilType == HVAC::CoilType::HeatingGasMultiStage) { if (QZnReq > HVAC::SmallLoad) { HeatingCoils::SimulateHeatingCoilComponents( - state, MSHeatPump.HeatCoilName, FirstHVACIteration, _, 0, _, _, MSHeatPump.fanOp, PartLoadFrac, SpeedNum, SpeedRatio); + state, mshp.HeatCoilName, FirstHVACIteration, _, 0, _, _, mshp.fanOp, PartLoadFrac, SpeedNum, SpeedRatio); } else { HeatingCoils::SimulateHeatingCoilComponents( - state, MSHeatPump.HeatCoilName, FirstHVACIteration, _, 0, _, _, MSHeatPump.fanOp, 0.0, SpeedNum, 0.0); + state, mshp.HeatCoilName, FirstHVACIteration, _, 0, _, _, mshp.fanOp, 0.0, SpeedNum, 0.0); } } else { - CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, QZnReq, MSHeatPump.fanOp, QCoilActual, PartLoadFrac); + CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, QZnReq, mshp.fanOp, QCoilActual, PartLoadFrac); } // Simulate supplemental heating coil for blow through fan - if (MSHeatPump.SuppHeatCoilNum > 0) { - CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, SupHeaterLoad, MSHeatPump.fanOp, QCoilActual); + + if (mshp.SuppHeatCoilNum > 0) { + CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, SupHeaterLoad, mshp.fanOp, QCoilActual); } } else { // otherwise simulate DX coils then fan then supplemental heater if (QZnReq < (-1.0 * HVAC::SmallLoad)) { - if (OutsideDryBulbTemp > MSHeatPump.MinOATCompressorCooling) { + if (OutsideDryBulbTemp > mshp.MinOATCompressorCooling) { DXCoils::SimDXCoilMultiSpeed(state, - MSHeatPump.DXCoolCoilName, + mshp.CoolCoilName, SpeedRatio, PartLoadFrac, - MSHeatPump.DXCoolCoilIndex, + mshp.CoolCoilNum, SpeedNum, - MSHeatPump.fanOp, + mshp.fanOp, compressorOp); SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXCoolCoilName, 0.0, 0.0, MSHeatPump.DXCoolCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.CoolCoilName, 0.0, 0.0, mshp.CoolCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump.DXCoolCoilIndex); + state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(mshp.CoolCoilNum); } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXCoolCoilName, 0.0, 0.0, MSHeatPump.DXCoolCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.CoolCoilName, 0.0, 0.0, mshp.CoolCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - if (MSHeatPump.HeatCoilType == MultiSpeedHeatingCoil) { + if (mshp.heatCoilType == HVAC::CoilType::DXMultiSpeedHeating) { if (QZnReq > HVAC::SmallLoad) { - if (OutsideDryBulbTemp > MSHeatPump.MinOATCompressorHeating) { + if (OutsideDryBulbTemp > mshp.MinOATCompressorHeating) { DXCoils::SimDXCoilMultiSpeed(state, - MSHeatPump.DXHeatCoilName, + mshp.HeatCoilName, SpeedRatio, PartLoadFrac, - MSHeatPump.DXHeatCoilIndex, + mshp.HeatCoilNum, SpeedNum, - MSHeatPump.fanOp, + mshp.fanOp, compressorOp); SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXHeatCoilName, 0.0, 0.0, MSHeatPump.DXHeatCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.HeatCoilName, 0.0, 0.0, mshp.HeatCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump.DXHeatCoilIndex); + state.dataHVACMultiSpdHP->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(mshp.HeatCoilNum); } else { DXCoils::SimDXCoilMultiSpeed( - state, MSHeatPump.DXHeatCoilName, 0.0, 0.0, MSHeatPump.DXHeatCoilIndex, SpeedNum, MSHeatPump.fanOp, compressorOp); + state, mshp.HeatCoilName, 0.0, 0.0, mshp.HeatCoilNum, SpeedNum, mshp.fanOp, compressorOp); } - } else if (MSHeatPump.HeatCoilType == HVAC::Coil_HeatingElectric_MultiStage || - MSHeatPump.HeatCoilType == HVAC::Coil_HeatingGas_MultiStage) { + } else if (mshp.heatCoilType == HVAC::CoilType::HeatingElectricMultiStage || + mshp.heatCoilType == HVAC::CoilType::HeatingGasMultiStage) { if (QZnReq > HVAC::SmallLoad) { HeatingCoils::SimulateHeatingCoilComponents( - state, MSHeatPump.HeatCoilName, FirstHVACIteration, _, 0, _, _, MSHeatPump.fanOp, PartLoadFrac, SpeedNum, SpeedRatio); + state, mshp.HeatCoilName, FirstHVACIteration, _, 0, _, _, mshp.fanOp, PartLoadFrac, SpeedNum, SpeedRatio); } else { HeatingCoils::SimulateHeatingCoilComponents( - state, MSHeatPump.HeatCoilName, FirstHVACIteration, _, 0, _, _, MSHeatPump.fanOp, 0.0, SpeedNum, 0.0); + state, mshp.HeatCoilName, FirstHVACIteration, _, 0, _, _, mshp.fanOp, 0.0, SpeedNum, 0.0); } } else { - CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, QZnReq, MSHeatPump.fanOp, QCoilActual, PartLoadFrac); + CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, QZnReq, mshp.fanOp, QCoilActual, PartLoadFrac); } - state.dataFans->fans(MSHeatPump.FanNum)->simulate(state, FirstHVACIteration, state.dataHVACMultiSpdHP->FanSpeedRatio); + state.dataFans->fans(mshp.FanNum)->simulate(state, FirstHVACIteration, state.dataHVACMultiSpdHP->FanSpeedRatio); // Simulate supplemental heating coil for draw through fan - if (MSHeatPump.SuppHeatCoilNum > 0) { - CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, SupHeaterLoad, MSHeatPump.fanOp, QCoilActual); + if (mshp.SuppHeatCoilNum > 0) { + CalcNonDXHeatingCoils(state, MSHeatPumpNum, FirstHVACIteration, SupHeaterLoad, mshp.fanOp, QCoilActual); } } // calculate sensible load met Real64 SensibleOutput(0.0); // sensible output rate // calculate sensible load met using delta enthalpy at a constant (minimum) humidity ratio) - Real64 MinHumRat = state.dataLoopNodes->Node(MSHeatPump.NodeNumOfControlledZone).HumRat; - if (state.dataLoopNodes->Node(OutletNode).Temp < state.dataLoopNodes->Node(MSHeatPump.NodeNumOfControlledZone).Temp) - MinHumRat = state.dataLoopNodes->Node(OutletNode).HumRat; - SensibleOutput = AirMassFlow * Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(state.dataLoopNodes->Node(OutletNode).Temp, + Real64 MinHumRat = s_node->Node(mshp.NodeNumOfControlledZone).HumRat; + if (s_node->Node(mshp.AirOutletNode).Temp < s_node->Node(mshp.NodeNumOfControlledZone).Temp) + MinHumRat = s_node->Node(mshp.AirOutletNode).HumRat; + SensibleOutput = AirMassFlow * Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(s_node->Node(mshp.AirOutletNode).Temp, MinHumRat, - state.dataLoopNodes->Node(MSHeatPump.NodeNumOfControlledZone).Temp, + s_node->Node(mshp.NodeNumOfControlledZone).Temp, MinHumRat); - LoadMet = SensibleOutput - MSHeatPump.LoadLoss; + LoadMet = SensibleOutput - mshp.LoadLoss; - MSHeatPump.LoadMet = LoadMet; + mshp.LoadMet = LoadMet; } void UpdateMSHeatPump(EnergyPlusData &state, int const MSHeatPumpNum) // Engine driven heat pump number @@ -3822,22 +3442,20 @@ namespace HVACMultiSpeedHeatPump { // PURPOSE OF THIS SUBROUTINE: // This routine will update MSHP performance and calculate heat recovery rate and crankcase heater power + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + // Calculate heat recovery - if (state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatRecActive) { + if (mshp.HeatRecActive) { MSHPHeatRecovery(state, MSHeatPumpNum); } if (state.afn->distribution_simulated) { - state.dataAirLoop->AirLoopAFNInfo(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AirLoopNumber).LoopSystemOnMassFlowrate = - state.dataHVACMultiSpdHP->CompOnMassFlow; - state.dataAirLoop->AirLoopAFNInfo(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AirLoopNumber).LoopSystemOffMassFlowrate = - state.dataHVACMultiSpdHP->CompOffMassFlow; - state.dataAirLoop->AirLoopAFNInfo(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AirLoopNumber).LoopFanOperationMode = - state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).fanOp; - state.dataAirLoop->AirLoopAFNInfo(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AirLoopNumber).LoopOnOffFanPartLoadRatio = - state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).FanPartLoadRatio; - state.dataAirLoop->AirLoopAFNInfo(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AirLoopNumber).LoopCompCycRatio = - state.dataHVACMultiSpdHP->MSHeatPumpReport(MSHeatPumpNum).CycRatio; + auto &airLoopAFN = state.dataAirLoop->AirLoopAFNInfo(mshp.AirLoopNumber); + airLoopAFN.LoopSystemOnMassFlowrate = state.dataHVACMultiSpdHP->CompOnMassFlow; + airLoopAFN.LoopSystemOffMassFlowrate = state.dataHVACMultiSpdHP->CompOffMassFlow; + airLoopAFN.LoopFanOperationMode = mshp.fanOp; + airLoopAFN.LoopOnOffFanPartLoadRatio = mshp.FanPartLoadRatio; + airLoopAFN.LoopCompCycRatio = state.dataHVACMultiSpdHP->MSHeatPumpReport(MSHeatPumpNum).CycRatio; } } @@ -3854,34 +3472,34 @@ namespace HVACMultiSpeedHeatPump { Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); auto &MSHeatPumpReport = state.dataHVACMultiSpdHP->MSHeatPumpReport(MSHeatPumpNum); - MSHeatPumpReport.ElecPowerConsumption = MSHeatPump.ElecPower * TimeStepSysSec; // + & - MSHeatPumpReport.HeatRecoveryEnergy = MSHeatPump.HeatRecoveryRate * TimeStepSysSec; + MSHeatPumpReport.ElecPowerConsumption = mshp.ElecPower * TimeStepSysSec; // + & + MSHeatPumpReport.HeatRecoveryEnergy = mshp.HeatRecoveryRate * TimeStepSysSec; MSHeatPumpReport.AuxElecHeatConsumption = 0.0; MSHeatPumpReport.AuxElecCoolConsumption = 0.0; - MSHeatPump.AuxElecPower = MSHeatPump.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR + - MSHeatPump.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR); - if (MSHeatPump.HeatCoolMode == ModeOfOperation::CoolingMode) { - MSHeatPumpReport.AuxElecCoolConsumption = MSHeatPump.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR * TimeStepSysSec; + mshp.AuxElecPower = mshp.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR + + mshp.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR); + if (mshp.HeatCoolMode == ModeOfOperation::CoolingMode) { + MSHeatPumpReport.AuxElecCoolConsumption = mshp.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR * TimeStepSysSec; } - if (MSHeatPump.HeatCoolMode == ModeOfOperation::HeatingMode) { - MSHeatPumpReport.AuxElecHeatConsumption = MSHeatPump.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR * TimeStepSysSec; + if (mshp.HeatCoolMode == ModeOfOperation::HeatingMode) { + MSHeatPumpReport.AuxElecHeatConsumption = mshp.AuxOnCyclePower * state.dataHVACMultiSpdHP->SaveCompressorPLR * TimeStepSysSec; } - if (MSHeatPump.LastMode == ModeOfOperation::HeatingMode) { + if (mshp.LastMode == ModeOfOperation::HeatingMode) { MSHeatPumpReport.AuxElecHeatConsumption += - MSHeatPump.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR) * TimeStepSysSec; + mshp.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR) * TimeStepSysSec; } else { MSHeatPumpReport.AuxElecCoolConsumption += - MSHeatPump.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR) * TimeStepSysSec; + mshp.AuxOffCyclePower * (1.0 - state.dataHVACMultiSpdHP->SaveCompressorPLR) * TimeStepSysSec; } - if (MSHeatPump.FirstPass) { + if (mshp.FirstPass) { if (!state.dataGlobal->SysSizingCalc) { - DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, state.dataSize->CurSysNum, MSHeatPump.FirstPass); + DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, state.dataSize->CurSysNum, mshp.FirstPass); } } @@ -3904,16 +3522,15 @@ namespace HVACMultiSpeedHeatPump { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 HeatRecOutletTemp; // Heat reclaim outlet temp [C] + auto &s_node = state.dataLoopNodes; auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); - // Begin routine - int HeatRecInNode = mshp.HeatRecInletNodeNum; - int HeatRecOutNode = mshp.HeatRecOutletNodeNum; - + // Begin routine // LOL + // Inlet node to the heat recovery heat exchanger - Real64 HeatRecInletTemp = state.dataLoopNodes->Node(HeatRecInNode).Temp; + Real64 HeatRecInletTemp = s_node->Node(mshp.HeatRecFluidInletNode).Temp; // Set heat recovery mass flow rates - Real64 HeatRecMassFlowRate = state.dataLoopNodes->Node(HeatRecInNode).MassFlowRate; + Real64 HeatRecMassFlowRate = s_node->Node(mshp.HeatRecFluidInletNode).MassFlowRate; Real64 QHeatRec = state.dataHVACGlobal->MSHPWasteHeat; @@ -3931,9 +3548,9 @@ namespace HVACMultiSpeedHeatPump { QHeatRec = 0.0; } - PlantUtilities::SafeCopyPlantNode(state, HeatRecInNode, HeatRecOutNode); + PlantUtilities::SafeCopyPlantNode(state, mshp.HeatRecFluidInletNode, mshp.HeatRecFluidOutletNode); // changed outputs - state.dataLoopNodes->Node(HeatRecOutNode).Temp = HeatRecOutletTemp; + s_node->Node(mshp.HeatRecFluidOutletNode).Temp = HeatRecOutletTemp; mshp.HeatRecoveryRate = QHeatRec; mshp.HeatRecoveryInletTemp = HeatRecInletTemp; @@ -3960,65 +3577,63 @@ namespace HVACMultiSpeedHeatPump { // Set the average air mass flow rates using the part load fraction of the heat pump for this time step // Set OnOffAirFlowRatio to be used by DX coils - // Using/Aliasing + auto &s_node = state.dataLoopNodes; + + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + // Why? Why are these global variables? auto &MSHPMassFlowRateHigh = state.dataHVACGlobal->MSHPMassFlowRateHigh; auto &MSHPMassFlowRateLow = state.dataHVACGlobal->MSHPMassFlowRateLow; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int InletNode; // inlet node number for PTHPNum Real64 AverageUnitMassFlow; // average supply air mass flow rate over time step MSHPMassFlowRateLow = 0.0; // Mass flow rate at low speed MSHPMassFlowRateHigh = 0.0; // Mass flow rate at high speed - if (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).ControlZoneNum) && + if (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(mshp.ControlZoneNum) && present(SpeedNum)) { - if (state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatCoolMode == ModeOfOperation::HeatingMode) { + if (mshp.HeatCoolMode == ModeOfOperation::HeatingMode) { if (SpeedNum == 1) { - state.dataHVACMultiSpdHP->CompOnMassFlow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(SpeedNum); - state.dataHVACMultiSpdHP->CompOnFlowRatio = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatingSpeedRatio(SpeedNum); - MSHPMassFlowRateLow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(1); - MSHPMassFlowRateHigh = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(1); + state.dataHVACMultiSpdHP->CompOnMassFlow = mshp.HeatMassFlowRate(SpeedNum); + state.dataHVACMultiSpdHP->CompOnFlowRatio = mshp.HeatingSpeedRatio(SpeedNum); + MSHPMassFlowRateLow = mshp.HeatMassFlowRate(1); + MSHPMassFlowRateHigh = mshp.HeatMassFlowRate(1); } else if (SpeedNum > 1) { state.dataHVACMultiSpdHP->CompOnMassFlow = - SpeedRatio * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(SpeedNum - 1); + SpeedRatio * mshp.HeatMassFlowRate(SpeedNum) + (1.0 - SpeedRatio) * mshp.HeatMassFlowRate(SpeedNum - 1); state.dataHVACMultiSpdHP->CompOnFlowRatio = - SpeedRatio * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatingSpeedRatio(SpeedNum) + - (1.0 - SpeedRatio) * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatingSpeedRatio(SpeedNum - 1); - MSHPMassFlowRateLow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(SpeedNum - 1); - MSHPMassFlowRateHigh = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(SpeedNum); + SpeedRatio * mshp.HeatingSpeedRatio(SpeedNum) + (1.0 - SpeedRatio) * mshp.HeatingSpeedRatio(SpeedNum - 1); + MSHPMassFlowRateLow = mshp.HeatMassFlowRate(SpeedNum - 1); + MSHPMassFlowRateHigh = mshp.HeatMassFlowRate(SpeedNum); } - } else if (state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatCoolMode == ModeOfOperation::CoolingMode) { + + } else if (mshp.HeatCoolMode == ModeOfOperation::CoolingMode) { if (SpeedNum == 1) { - state.dataHVACMultiSpdHP->CompOnMassFlow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(SpeedNum); - state.dataHVACMultiSpdHP->CompOnFlowRatio = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolingSpeedRatio(SpeedNum); - MSHPMassFlowRateLow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(1); - MSHPMassFlowRateHigh = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(1); + state.dataHVACMultiSpdHP->CompOnMassFlow = mshp.CoolMassFlowRate(SpeedNum); + state.dataHVACMultiSpdHP->CompOnFlowRatio = mshp.CoolingSpeedRatio(SpeedNum); + MSHPMassFlowRateLow = mshp.CoolMassFlowRate(1); + MSHPMassFlowRateHigh = mshp.CoolMassFlowRate(1); } else if (SpeedNum > 1) { state.dataHVACMultiSpdHP->CompOnMassFlow = - SpeedRatio * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(SpeedNum - 1); + SpeedRatio * mshp.CoolMassFlowRate(SpeedNum) + (1.0 - SpeedRatio) * mshp.CoolMassFlowRate(SpeedNum - 1); state.dataHVACMultiSpdHP->CompOnFlowRatio = - SpeedRatio * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolingSpeedRatio(SpeedNum) + - (1.0 - SpeedRatio) * state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolingSpeedRatio(SpeedNum - 1); - MSHPMassFlowRateLow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(SpeedNum - 1); - MSHPMassFlowRateHigh = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(SpeedNum); + SpeedRatio * mshp.CoolingSpeedRatio(SpeedNum) + (1.0 - SpeedRatio) * mshp.CoolingSpeedRatio(SpeedNum - 1); + MSHPMassFlowRateLow = mshp.CoolMassFlowRate(SpeedNum - 1); + MSHPMassFlowRateHigh = mshp.CoolMassFlowRate(SpeedNum); } } } - InletNode = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AirInletNodeNum; - + // Set up fan flow rate during compressor off time - if (state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).fanOp == HVAC::FanOp::Continuous && present(SpeedNum)) { - if (state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AirFlowControl == AirflowControl::UseCompressorOnFlow && + if (mshp.fanOp == HVAC::FanOp::Continuous && present(SpeedNum)) { + if (mshp.AirFlowControl == AirflowControl::UseCompressorOnFlow && state.dataHVACMultiSpdHP->CompOnMassFlow > 0.0) { - if (state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).LastMode == ModeOfOperation::HeatingMode) { - state.dataHVACMultiSpdHP->CompOffMassFlow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatMassFlowRate(SpeedNum); - state.dataHVACMultiSpdHP->CompOffFlowRatio = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatingSpeedRatio(SpeedNum); + if (mshp.LastMode == ModeOfOperation::HeatingMode) { + state.dataHVACMultiSpdHP->CompOffMassFlow = mshp.HeatMassFlowRate(SpeedNum); + state.dataHVACMultiSpdHP->CompOffFlowRatio = mshp.HeatingSpeedRatio(SpeedNum); } else { - state.dataHVACMultiSpdHP->CompOffMassFlow = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolMassFlowRate(SpeedNum); - state.dataHVACMultiSpdHP->CompOffFlowRatio = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).CoolingSpeedRatio(SpeedNum); + state.dataHVACMultiSpdHP->CompOffMassFlow = mshp.CoolMassFlowRate(SpeedNum); + state.dataHVACMultiSpdHP->CompOffFlowRatio = mshp.CoolingSpeedRatio(SpeedNum); } } } @@ -4049,12 +3664,12 @@ namespace HVACMultiSpeedHeatPump { } //!!LKL Discrepancy with > 0 - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) == 0.0) { - state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; + if (ScheduleManager::GetCurrentScheduleValue(state, mshp.AvaiSchedPtr) == 0.0) { + s_node->Node(mshp.AirInletNode).MassFlowRate = 0.0; OnOffAirFlowRatio = 0.0; } else { - state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow; - state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; + s_node->Node(mshp.AirInletNode).MassFlowRate = AverageUnitMassFlow; + s_node->Node(mshp.AirInletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; if (AverageUnitMassFlow > 0.0) { OnOffAirFlowRatio = state.dataHVACMultiSpdHP->CompOnMassFlow / AverageUnitMassFlow; } else { @@ -4090,72 +3705,87 @@ namespace HVACMultiSpeedHeatPump { Real64 constexpr ErrTolerance(0.001); // convergence limit for hotwater coil int constexpr SolveMaxIter(50); - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 QCoilActual; // actual heating load met - Real64 mdot; // heating coil steam or hot water mass flow rate - Real64 MinWaterFlow; // coil minimum hot water mass flow rate, kg/s - Real64 MaxHotWaterFlow; // coil maximum hot water mass flow rate, kg/s - Real64 HotWaterMdot; // actual hot water mass flow rate - - int HeatCoilType; - int HeatCoilNum; - Real64 MaxCoilFluidFlow; - Real64 SteamCoilHeatingLoad; - int CoilControlNode; - int CoilOutletNode; - PlantLocation plantLoc{}; - - QCoilActual = 0.0; + Real64 QCoilActual = 0.0; // actual heating load met - auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); if (present(PartLoadFrac)) { - HeatCoilType = MSHeatPump.HeatCoilType; - state.dataHVACMultiSpdHP->HeatCoilName = MSHeatPump.HeatCoilName; - HeatCoilNum = MSHeatPump.HeatCoilNum; - MaxCoilFluidFlow = MSHeatPump.MaxCoilFluidFlow; - CoilControlNode = MSHeatPump.CoilControlNode; - CoilOutletNode = MSHeatPump.CoilOutletNode; - plantLoc = MSHeatPump.plantLoc; - } else { - HeatCoilType = MSHeatPump.SuppHeatCoilType; - state.dataHVACMultiSpdHP->HeatCoilName = MSHeatPump.SuppHeatCoilName; - HeatCoilNum = MSHeatPump.SuppHeatCoilNum; - MaxCoilFluidFlow = MSHeatPump.MaxSuppCoilFluidFlow; - CoilControlNode = MSHeatPump.SuppCoilControlNode; - CoilOutletNode = MSHeatPump.SuppCoilOutletNode; - plantLoc = MSHeatPump.SuppPlantLoc; - } - - MSHeatPump.HotWaterPlantLoc = plantLoc; - MSHeatPump.HotWaterCoilControlNode = CoilControlNode; - MSHeatPump.HotWaterCoilOutletNode = CoilOutletNode; - MSHeatPump.HotWaterCoilName = state.dataHVACMultiSpdHP->HeatCoilName; - MSHeatPump.HotWaterCoilNum = HeatCoilNum; - - if (HeatingLoad > HVAC::SmallLoad) { - - switch (HeatCoilType) { - case SuppHeatingCoilGas: - case SuppHeatingCoilElec: { - HeatingCoils::SimulateHeatingCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatingLoad, HeatCoilNum, QCoilActual, true, fanOp); - } break; - case HVAC::Coil_HeatingWater: { - if (present(PartLoadFrac)) { - MaxHotWaterFlow = MaxCoilFluidFlow * PartLoadFrac; - PlantUtilities::SetComponentFlowRate(state, MaxHotWaterFlow, CoilControlNode, CoilOutletNode, plantLoc); - WaterCoils::SimulateWaterCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatCoilNum, QCoilActual, fanOp); - } else { - MaxHotWaterFlow = MaxCoilFluidFlow; - PlantUtilities::SetComponentFlowRate(state, MaxHotWaterFlow, CoilControlNode, CoilOutletNode, plantLoc); + + if (HeatingLoad > HVAC::SmallLoad) { + + switch (mshp.heatCoilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: { + HeatingCoils::SimulateHeatingCoilComponents( + state, mshp.HeatCoilName, FirstHVACIteration, HeatingLoad, mshp.HeatCoilNum, QCoilActual, true, fanOp); + } break; + + case HVAC::CoilType::HeatingWater: { + Real64 MaxHotWaterFlow = mshp.HeatCoilMaxFluidFlow * PartLoadFrac; + PlantUtilities::SetComponentFlowRate(state, MaxHotWaterFlow, mshp.HeatCoilControlNode, mshp.HeatCoilFluidOutletNode, mshp.HeatCoilPlantLoc); + WaterCoils::SimulateWaterCoilComponents(state, mshp.HeatCoilName, FirstHVACIteration, mshp.HeatCoilNum, QCoilActual, fanOp); + } break; + + case HVAC::CoilType::HeatingSteam: { + Real64 mdot = mshp.HeatCoilMaxFluidFlow * PartLoadFrac; + Real64 CoilHeatingLoad = HeatingLoad * PartLoadFrac; + PlantUtilities::SetComponentFlowRate(state, mdot, mshp.HeatCoilControlNode, mshp.HeatCoilFluidOutletNode, mshp.HeatCoilPlantLoc); + // simulate steam supplemental heating coil + SteamCoils::SimulateSteamCoilComponents( + state, mshp.HeatCoilName, FirstHVACIteration, mshp.HeatCoilNum, CoilHeatingLoad, QCoilActual, fanOp); + } break; + default: + break; + } + + } else { // end of IF (HeatingLoad > SmallLoad) THEN + + switch (mshp.heatCoilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: { + HeatingCoils::SimulateHeatingCoilComponents( + state, mshp.HeatCoilName, FirstHVACIteration, HeatingLoad, mshp.HeatCoilNum, QCoilActual, true, fanOp); + } break; + + case HVAC::CoilType::HeatingWater: { + Real64 mdot = 0.0; + PlantUtilities::SetComponentFlowRate(state, mdot, mshp.HeatCoilControlNode, mshp.HeatCoilFluidOutletNode, mshp.HeatCoilPlantLoc); + WaterCoils::SimulateWaterCoilComponents(state, mshp.HeatCoilName, FirstHVACIteration, mshp.HeatCoilNum, QCoilActual, fanOp); + } break; + + case HVAC::CoilType::HeatingSteam: { + Real64 mdot = 0.0; + PlantUtilities::SetComponentFlowRate(state, mdot, mshp.HeatCoilControlNode, mshp.HeatCoilFluidOutletNode, mshp.HeatCoilPlantLoc); + // simulate the steam supplemental heating coil + SteamCoils::SimulateSteamCoilComponents( + state, mshp.HeatCoilName, FirstHVACIteration, mshp.HeatCoilNum, HeatingLoad, QCoilActual, fanOp); + } break; + default: + break; + } + } + + } else { // !present(PartLoad) + if (HeatingLoad > HVAC::SmallLoad) { + + switch (mshp.suppHeatCoilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: { + HeatingCoils::SimulateHeatingCoilComponents( + state, mshp.SuppHeatCoilName, FirstHVACIteration, HeatingLoad, mshp.SuppHeatCoilNum, QCoilActual, true, fanOp); + } break; + + case HVAC::CoilType::HeatingWater: { + Real64 MaxHotWaterFlow = mshp.SuppHeatCoilMaxFluidFlow; + PlantUtilities::SetComponentFlowRate( + state, MaxHotWaterFlow, mshp.SuppHeatCoilControlNode, mshp.SuppHeatCoilFluidOutletNode, mshp.SuppHeatCoilPlantLoc); WaterCoils::SimulateWaterCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatCoilNum, QCoilActual, fanOp); + state, mshp.SuppHeatCoilName, FirstHVACIteration, mshp.SuppHeatCoilNum, QCoilActual, fanOp); + if (QCoilActual > (HeatingLoad + HVAC::SmallLoad)) { // control water flow to obtain output matching HeatingLoad int SolFlag = 0; - MinWaterFlow = 0.0; + Real64 MinWaterFlow = 0.0; auto f = [&state, MSHeatPumpNum, FirstHVACIteration, HeatingLoad](Real64 const HWFlow) { // Calculates residual function (QCoilActual - SupHeatCoilLoad) / SupHeatCoilLoad // coil actual output depends on the hot water flow rate which is varied to minimize the residual. @@ -4164,103 +3794,106 @@ namespace HVACMultiSpeedHeatPump { Real64 mdot = HWFlow; auto &hp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); PlantUtilities::SetComponentFlowRate( - state, mdot, hp.HotWaterCoilControlNode, hp.HotWaterCoilOutletNode, hp.HotWaterPlantLoc); + state, mdot, hp.SuppHeatCoilControlNode, hp.SuppHeatCoilFluidOutletNode, hp.SuppHeatCoilPlantLoc); // simulate the hot water supplemental heating coil WaterCoils::SimulateWaterCoilComponents( - state, hp.HotWaterCoilName, FirstHVACIteration, hp.HotWaterCoilNum, calcHeatingCoilLoad, hp.fanOp); + state, hp.SuppHeatCoilName, FirstHVACIteration, hp.SuppHeatCoilNum, calcHeatingCoilLoad, hp.fanOp); if (targetHeatingCoilLoad != 0.0) { return (calcHeatingCoilLoad - targetHeatingCoilLoad) / targetHeatingCoilLoad; } else { // Autodesk:Return Condition added to assure return value is set return 0.0; } }; + + Real64 HotWaterMdot; General::SolveRoot(state, ErrTolerance, SolveMaxIter, SolFlag, HotWaterMdot, f, MinWaterFlow, MaxHotWaterFlow); if (SolFlag == -1) { - if (MSHeatPump.HotWaterCoilMaxIterIndex == 0) { + if (mshp.HotWaterCoilMaxIterIndex == 0) { ShowWarningMessage(state, format("CalcNonDXHeatingCoils: Hot water coil control failed for {}=\"{}\"", CurrentModuleObject, - MSHeatPump.Name)); + mshp.Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating hot water mass flow rate", SolveMaxIter)); - } + } ShowRecurringWarningErrorAtEnd( - state, - format("CalcNonDXHeatingCoils: Hot water coil control failed (iteration limit [{}]) for {}=\"{}", - SolveMaxIter, - CurrentModuleObject, - MSHeatPump.Name), - MSHeatPump.HotWaterCoilMaxIterIndex); + state, + format("CalcNonDXHeatingCoils: Hot water coil control failed (iteration limit [{}]) for {}=\"{}", + SolveMaxIter, + CurrentModuleObject, + mshp.Name), + mshp.HotWaterCoilMaxIterIndex); } else if (SolFlag == -2) { - if (MSHeatPump.HotWaterCoilMaxIterIndex2 == 0) { - ShowWarningMessage(state, - format("CalcNonDXHeatingCoils: Hot water coil control failed (maximum flow limits) for {}=\"{}\"", - CurrentModuleObject, - MSHeatPump.Name)); - ShowContinueErrorTimeStamp(state, ""); - ShowContinueError(state, "...Bad hot water maximum flow rate limits"); - ShowContinueError(state, format("...Given minimum water flow rate={:.3R} kg/s", MinWaterFlow)); - ShowContinueError(state, format("...Given maximum water flow rate={:.3R} kg/s", MaxHotWaterFlow)); + if (mshp.HotWaterCoilMaxIterIndex2 == 0) { + ShowWarningMessage(state, + format("CalcNonDXHeatingCoils: Hot water coil control failed (maximum flow limits) for {}=\"{}\"", + CurrentModuleObject, + mshp.Name)); + ShowContinueErrorTimeStamp(state, ""); + ShowContinueError(state, "...Bad hot water maximum flow rate limits"); + ShowContinueError(state, format("...Given minimum water flow rate={:.3R} kg/s", MinWaterFlow)); + ShowContinueError(state, format("...Given maximum water flow rate={:.3R} kg/s", MaxHotWaterFlow)); } ShowRecurringWarningErrorAtEnd(state, "CalcNonDXHeatingCoils: Hot water coil control failed (flow limits) for " + - std::string{CurrentModuleObject} + "=\"" + MSHeatPump.Name + "\"", - MSHeatPump.HotWaterCoilMaxIterIndex2, + std::string{CurrentModuleObject} + "=\"" + mshp.Name + "\"", + mshp.HotWaterCoilMaxIterIndex2, MaxHotWaterFlow, MinWaterFlow, _, "[kg/s]", "[kg/s]"); - } + } // simulate hot water supplemental heating coil WaterCoils::SimulateWaterCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatCoilNum, QCoilActual, fanOp); + state, mshp.SuppHeatCoilName, FirstHVACIteration, mshp.SuppHeatCoilNum, QCoilActual, fanOp); } + } break; + + case HVAC::CoilType::HeatingSteam: { + Real64 mdot = mshp.SuppHeatCoilMaxFluidFlow; + Real64 SteamCoilHeatingLoad = HeatingLoad; + PlantUtilities::SetComponentFlowRate( + state, mdot, mshp.SuppHeatCoilControlNode, mshp.SuppHeatCoilFluidOutletNode, mshp.SuppHeatCoilPlantLoc); + // simulate steam supplemental heating coil + SteamCoils::SimulateSteamCoilComponents( + state, mshp.SuppHeatCoilName, FirstHVACIteration, mshp.SuppHeatCoilNum, SteamCoilHeatingLoad, QCoilActual, fanOp); + } break; + default: + break; + } + + } else { // end of IF (HeatingLoad > SmallLoad) THEN + + switch (mshp.suppHeatCoilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: { + HeatingCoils::SimulateHeatingCoilComponents( + state, mshp.SuppHeatCoilName, FirstHVACIteration, HeatingLoad, mshp.SuppHeatCoilNum, QCoilActual, true, fanOp); + } break; + + case HVAC::CoilType::HeatingWater: { + Real64 mdot = 0.0; + PlantUtilities::SetComponentFlowRate( + state, mdot, mshp.SuppHeatCoilControlNode, mshp.SuppHeatCoilFluidOutletNode, mshp.SuppHeatCoilPlantLoc); + WaterCoils::SimulateWaterCoilComponents(state, mshp.SuppHeatCoilName, FirstHVACIteration, mshp.HeatCoilNum, QCoilActual, fanOp); + } break; + + case HVAC::CoilType::HeatingSteam: { + Real64 mdot = 0.0; + PlantUtilities::SetComponentFlowRate( + state, mdot, mshp.SuppHeatCoilControlNode, mshp.SuppHeatCoilFluidOutletNode, mshp.SuppHeatCoilPlantLoc); + // simulate the steam supplemental heating coil + SteamCoils::SimulateSteamCoilComponents( + state, mshp.SuppHeatCoilName, FirstHVACIteration, mshp.SuppHeatCoilNum, HeatingLoad, QCoilActual, fanOp); + } break; + default: + break; } - } break; - case HVAC::Coil_HeatingSteam: { - if (present(PartLoadFrac)) { - mdot = MSHeatPump.MaxCoilFluidFlow * PartLoadFrac; - SteamCoilHeatingLoad = HeatingLoad * PartLoadFrac; - } else { - mdot = MSHeatPump.MaxCoilFluidFlow; - SteamCoilHeatingLoad = HeatingLoad; - } - PlantUtilities::SetComponentFlowRate(state, mdot, CoilControlNode, CoilOutletNode, plantLoc); - // simulate steam supplemental heating coil - SteamCoils::SimulateSteamCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatCoilNum, SteamCoilHeatingLoad, QCoilActual, fanOp); - } break; - default: - break; - } - - } else { // end of IF (HeatingLoad > SmallLoad) THEN - - switch (HeatCoilType) { - case SuppHeatingCoilGas: - case SuppHeatingCoilElec: { - HeatingCoils::SimulateHeatingCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatingLoad, HeatCoilNum, QCoilActual, true, fanOp); - } break; - case HVAC::Coil_HeatingWater: { - mdot = 0.0; - PlantUtilities::SetComponentFlowRate(state, mdot, CoilControlNode, CoilOutletNode, plantLoc); - WaterCoils::SimulateWaterCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatCoilNum, QCoilActual, fanOp); - } break; - case HVAC::Coil_HeatingSteam: { - mdot = 0.0; - PlantUtilities::SetComponentFlowRate(state, mdot, CoilControlNode, CoilOutletNode, plantLoc); - // simulate the steam supplemental heating coil - SteamCoils::SimulateSteamCoilComponents( - state, state.dataHVACMultiSpdHP->HeatCoilName, FirstHVACIteration, HeatCoilNum, HeatingLoad, QCoilActual, fanOp); - } break; - default: - break; } } + HeatCoilLoadmet = QCoilActual; } diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.hh b/src/EnergyPlus/HVACMultiSpeedHeatPump.hh index 43fe2dba144..ab7ba2ab1e4 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.hh +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.hh @@ -64,15 +64,6 @@ struct EnergyPlusData; namespace HVACMultiSpeedHeatPump { - // Heating coil types - int constexpr MultiSpeedHeatingCoil(1); // COIL:DX:MultiSpeed:Heating - // Cooling coil types - int constexpr MultiSpeedCoolingCoil(2); // COIL:DX:MultiSpeed:Cooling - // Supplymental heating coil types - int constexpr SuppHeatingCoilGas(1); // Supplymental heating coil type: COIL:GAS:HEATING - int constexpr SuppHeatingCoilElec(2); // Supplymental heating coil type: COIL:ELECTRIC:HEATING - int constexpr SuppHeatingCoilRec(3); // Supplymental heating coil type: COIL:ENGINEHEATRECOVERY:HEATING - // Mode of operation enum class ModeOfOperation { @@ -100,38 +91,58 @@ namespace HVACMultiSpeedHeatPump { std::string Name; // Name of the engine driven heat pump std::string AvaiSchedule; // Availability Schedule name int AvaiSchedPtr; // Pointer to the correct schedule - int AirInletNodeNum; // Node number of the heat pump air inlet - int AirOutletNodeNum; // Node number of the heat pump air inlet - std::string AirInletNodeName; // Node name of the heat pump air inlet - std::string AirOutletNodeName; // Node name of the heat pump air outlet + int AirInletNode = 0; // Node number of the heat pump air inlet + int AirOutletNode = 0; // Node number of the heat pump air inlet int ControlZoneNum; // Controlling zone or thermostat location int ZoneSequenceCoolingNum; // Index to cooling sequence/priority for this zone int ZoneSequenceHeatingNum; // Index to heating sequence/priority for this zone std::string ControlZoneName; // Controlled zone name - int NodeNumOfControlledZone; // Controlled zone node number + int NodeNumOfControlledZone = 0; // Controlled zone node number Real64 FlowFraction; // Fraction of the total volume flow that goes through the controlling zone std::string FanName; // Name of supply air fan HVAC::FanType fanType; // Supply fan type int FanNum; // Supply fan number HVAC::FanPlace fanPlace; // Supply air fan placement: 1 Blow through; 2 Draw through - int FanInletNode; // Fan Inlet node - int FanOutletNode; // Fan Outlet node + int FanInletNode = 0; // Fan Inlet node + int FanOutletNode = 0; // Fan Outlet node Real64 FanVolFlow; // Supply fan volumetric flow rate std::string FanSchedule; // Supply air fan operating mode schedule name int FanSchedPtr; // Pointer to the Supply air fan operating mode schedule HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation; 1=cycling fan, cycling compressor; 2=continuous fan, cycling compresor - std::string DXHeatCoilName; // COIL:DX:MultiSpeed:Heating name - int HeatCoilType; // Heating coil type: 1 COIL:DX:MultiSpeed:Heating only - int HeatCoilNum; // Heating coil number - int DXHeatCoilIndex; // DX heating coil index number - std::string HeatCoilName; // Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating name - int HeatCoilIndex; // heating coil index number (Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating) - std::string DXCoolCoilName; // COIL:DX:MultiSpeed:Cooling name - int CoolCoilType; // Cooling coil type: 1 COIL:DX:MultiSpeed:Cooling only - int DXCoolCoilIndex; // DX cooling coil index number + + std::string HeatCoilName; // COIL:DX:MultiSpeed:Heating name + HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; + int HeatCoilNum = 0; // heating coil index (Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating) + PlantLocation HeatCoilPlantLoc = {}; // plant loop component location for hot water and steam heating coil + + int HeatCoilAirInletNode = 0; + int HeatCoilAirOutletNode = 0; + int HeatCoilFluidOutletNode = 0; + int HeatCoilControlNode = 0; // control node for simple water and steam heating coil + + Real64 HeatCoilMaxVolFlowRate = 0.0; + Real64 HeatCoilMaxFluidFlow = 0.0; + + std::string CoolCoilName; // COIL:DX:MultiSpeed:Cooling name + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; // Cooling coil type: 1 COIL:DX:MultiSpeed:Cooling only + int CoolCoilNum = 0; // DX cooling coil index number + + int CoolCoilAirInletNode = 0; + int CoolCoilAirOutletNode = 0; + std::string SuppHeatCoilName; // Supplymental heating coil name - int SuppHeatCoilType; // Supplymental heating coil type: 1 Gas; 2 Electric; 3 Recovery - int SuppHeatCoilNum; // Supplymental heating coil number + HVAC::CoilType suppHeatCoilType = HVAC::CoilType::Invalid; // Supplemental heating coil types: 1 Gas; 2 Electric; 3 Recovery + int SuppHeatCoilNum = 0; // Supplemental heating coil number + PlantLocation SuppHeatCoilPlantLoc = {}; // plant loop component location for hot water and steam supplemental heating coil + + int SuppHeatCoilAirInletNode = 0; // air inlet node number of supplemental heating coil + int SuppHeatCoilAirOutletNode = 0; // air outlet node number of supplemental heating coil + int SuppHeatCoilControlNode = 0; // control node for simple water and steam heating coil + int SuppHeatCoilFluidOutletNode = 0; // outlet node for hot water and steam supplemental heating coil + + Real64 SuppHeatCoilMaxVolFlowRate = 0.0; + Real64 SuppHeatCoilMaxFluidFlow = 0.0; + Real64 DesignSuppHeatingCapacity; // Supplemental heating coil design capacity Real64 SuppMaxAirTemp; // Maximum supply air temperature from supplemental heater Real64 SuppMaxOATemp; // Maximum outdoor dry-bulb temperature for supplemental heater operation @@ -140,8 +151,8 @@ namespace HVACMultiSpeedHeatPump { Real64 DesignHeatRecFlowRate; // Design water volume flow rate through heat recovery loop [m3/s] bool HeatRecActive; // True when entered Heat Rec Vol Flow Rate > 0 std::string HeatRecName; // heat recovery water inlet name - int HeatRecInletNodeNum; // Node number on heat recovery water inlet - int HeatRecOutletNodeNum; // Node number on heat recovery water outlet + int HeatRecFluidInletNode = 0; // Node number on heat recovery water inlet + int HeatRecFluidOutletNode = 0; // Node number on heat recovery water outlet Real64 MaxHeatRecOutletTemp; // Maximum outlet water temperature for heat recovery Real64 DesignHeatRecMassFlowRate; // Design water mass flow rate through heat recovery loop [kg/s] PlantLocation HRPlantLoc; // plant loop component for heat recovery @@ -162,7 +173,7 @@ namespace HVACMultiSpeedHeatPump { ModeOfOperation HeatCoolMode; // System operating mode (0 = floating, 1 = cooling, 2 = heating) int AirLoopNumber; // Air loop served by the engine driven heat pump system int NumControlledZones; // Number of controlled zones for this system - int ZoneInletNode; // Zone inlet node number in the controlled zone + int ZoneInletNode = 0; // Zone inlet node number in the controlled zone Real64 CompPartLoadRatio; // Compressor part load ratio Real64 FanPartLoadRatio; // Fan part load ratio Real64 TotCoolEnergyRate; // Total cooling enertgy rate @@ -181,24 +192,8 @@ namespace HVACMultiSpeedHeatPump { int ErrIndexCyc; // Error index at low speed int ErrIndexVar; // Error index at high speed Real64 LoadLoss; // Air distribution system loss - int SuppCoilAirInletNode; // air inlet node number of supplemental heating coil - int SuppCoilAirOutletNode; // air outlet node number of supplemental heating coil - int SuppHeatCoilType_Num; // Numeric Equivalent for Supplemental Heat Coil Type - int SuppHeatCoilIndex; // Index to supplemental heater - int SuppCoilControlNode; // control node for simple water and steam heating coil - Real64 MaxSuppCoilFluidFlow; // water or steam mass flow rate for supplemental heating coil [kg/s] - int SuppCoilOutletNode; // outlet node for hot water and steam supplemental heating coil - int CoilAirInletNode; // air inlet node number of supplemental heating coil - int CoilControlNode; // control node for simple water and steam heating coil - Real64 MaxCoilFluidFlow; // water or steam mass flow rate for supplemental heating coil [kg/s] - int CoilOutletNode; // outlet node for hot water and steam supplemental heating coil - int HotWaterCoilControlNode; - int HotWaterCoilOutletNode; - std::string HotWaterCoilName; - int HotWaterCoilNum; - PlantLocation plantLoc; // plant loop component location for hot water and steam heating coil - PlantLocation SuppPlantLoc; // plant loop component location for hot water and steam supplemental heating coil - PlantLocation HotWaterPlantLoc; // plant loop component location for hot water and steam heating coil + Real64 MaxSuppHeatCoilFluidFlow; // water or steam mass flow rate for supplemental heating coil [kg/s] + int HotWaterCoilMaxIterIndex; // Index to recurring warning message int HotWaterCoilMaxIterIndex2; // Index to recurring warning message int StageNum; // Stage number specified by staged thermostat @@ -223,21 +218,19 @@ namespace HVACMultiSpeedHeatPump { // Default Constructor MSHeatPumpData() - : AvaiSchedPtr(0), AirInletNodeNum(0), AirOutletNodeNum(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), ZoneSequenceHeatingNum(0), - NodeNumOfControlledZone(0), FlowFraction(0.0), fanType(HVAC::FanType::Invalid), FanNum(0), fanPlace(HVAC::FanPlace::Invalid), - FanInletNode(0), FanOutletNode(0), FanVolFlow(0.0), FanSchedPtr(0), HeatCoilType(0), HeatCoilNum(0), DXHeatCoilIndex(0), - HeatCoilIndex(0), CoolCoilType(0), DXCoolCoilIndex(0), SuppHeatCoilType(0), SuppHeatCoilNum(0), DesignSuppHeatingCapacity(0.0), + : AvaiSchedPtr(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), ZoneSequenceHeatingNum(0), + FlowFraction(0.0), fanType(HVAC::FanType::Invalid), FanNum(0), fanPlace(HVAC::FanPlace::Invalid), + FanVolFlow(0.0), FanSchedPtr(0), + DesignSuppHeatingCapacity(0.0), SuppMaxAirTemp(0.0), SuppMaxOATemp(0.0), AuxOnCyclePower(0.0), AuxOffCyclePower(0.0), DesignHeatRecFlowRate(0.0), HeatRecActive(false), - HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0), MaxHeatRecOutletTemp(0.0), DesignHeatRecMassFlowRate(0.0), HRPlantLoc{}, + MaxHeatRecOutletTemp(0.0), DesignHeatRecMassFlowRate(0.0), HRPlantLoc{}, AuxElecPower(0.0), IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), IdleSpeedRatio(0.0), NumOfSpeedCooling(0), NumOfSpeedHeating(0), CheckFanFlow(true), LastMode(ModeOfOperation::Invalid), HeatCoolMode(ModeOfOperation::Invalid), AirLoopNumber(0), NumControlledZones(0), - ZoneInletNode(0), CompPartLoadRatio(0.0), FanPartLoadRatio(0.0), TotCoolEnergyRate(0.0), TotHeatEnergyRate(0.0), + CompPartLoadRatio(0.0), FanPartLoadRatio(0.0), TotCoolEnergyRate(0.0), TotHeatEnergyRate(0.0), SensCoolEnergyRate(0.0), SensHeatEnergyRate(0.0), LatCoolEnergyRate(0.0), LatHeatEnergyRate(0.0), ElecPower(0.0), LoadMet(0.0), HeatRecoveryRate(0.0), HeatRecoveryInletTemp(0.0), HeatRecoveryOutletTemp(0.0), HeatRecoveryMassFlowRate(0.0), - AirFlowControl(AirflowControl::Invalid), ErrIndexCyc(0), ErrIndexVar(0), LoadLoss(0.0), SuppCoilAirInletNode(0), - SuppCoilAirOutletNode(0), SuppHeatCoilType_Num(0), SuppHeatCoilIndex(0), SuppCoilControlNode(0), MaxSuppCoilFluidFlow(0.0), - SuppCoilOutletNode(0), CoilAirInletNode(0), CoilControlNode(0), MaxCoilFluidFlow(0.0), CoilOutletNode(0), - HotWaterCoilControlNode(0), plantLoc{}, SuppPlantLoc{}, HotWaterPlantLoc{}, HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0), + AirFlowControl(AirflowControl::Invalid), ErrIndexCyc(0), ErrIndexVar(0), LoadLoss(0.0), + HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0), StageNum(0), Staged(false), CoolCountAvail(0), CoolIndexAvail(0), HeatCountAvail(0), HeatIndexAvail(0), FirstPass(true), MinOATCompressorCooling(0.0), MinOATCompressorHeating(0.0), MyEnvrnFlag(true), MySizeFlag(true), MyCheckFlag(true), MyFlowFracFlag(true), MyPlantScantFlag(true), MyStagedFlag(true), EMSOverrideCoilSpeedNumOn(false), EMSOverrideCoilSpeedNumValue(0.0), @@ -392,9 +385,9 @@ struct HVACMultiSpeedHeatPumpData : BaseGlobalStruct int NumMSHeatPumps = 0; // Number of multi speed heat pumps int AirLoopPass = 0; // Number of air loop pass - Real64 TempSteamIn = 100.0; // steam coil steam inlet temperature - std::string CurrentModuleObject; // Object type for getting and error messages + + // What is the point of all of these shared state variables? Real64 CompOnMassFlow = 0.0; // System air mass flow rate w/ compressor ON Real64 CompOffMassFlow = 0.0; // System air mass flow rate w/ compressor OFF Real64 CompOnFlowRatio = 0.0; // fan flow ratio when coil on @@ -416,8 +409,6 @@ struct HVACMultiSpeedHeatPumpData : BaseGlobalStruct int ErrCountCyc = 0; // Counter used to minimize the occurrence of output warnings int ErrCountVar = 0; // Counter used to minimize the occurrence of output warnings - std::string HeatCoilName; // TODO: What's the best plan here? - void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -426,7 +417,6 @@ struct HVACMultiSpeedHeatPumpData : BaseGlobalStruct { this->NumMSHeatPumps = 0; this->AirLoopPass = 0; - this->TempSteamIn = 100.0; this->CurrentModuleObject = ""; this->CompOnMassFlow = 0.0; this->CompOffMassFlow = 0.0; @@ -443,7 +433,6 @@ struct HVACMultiSpeedHeatPumpData : BaseGlobalStruct this->FlowFracFlagReady = true; this->ErrCountCyc = 0; this->ErrCountVar = 0; - this->HeatCoilName = ""; } }; diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index e51866fa480..f1d25f66515 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -263,7 +263,7 @@ void GetStandAloneERV(EnergyPlusData &state) state, Alphas(3), CurrentModuleObject, cAlphaFields(3), state.dataHVACStandAloneERV->HeatExchangerUniqueNames, ErrorsFound); standAloneERV.HeatExchangerName = Alphas(3); bool errFlag = false; - standAloneERV.hxType = HeatRecovery::GetHeatExchangerObjectTypeNum(state, standAloneERV.HeatExchangerName, errFlag); + standAloneERV.hxType = HeatRecovery::GetHeatExchangerType(state, standAloneERV.HeatExchangerName, errFlag); if (errFlag) { ShowContinueError(state, format("... occurs in {} \"{}\"", CurrentModuleObject, standAloneERV.Name)); ErrorsFound = true; diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 3fed480323c..a6f86523dba 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -152,7 +152,7 @@ namespace HVACUnitaryBypassVAV { // Find the correct changeover-bypass VAV unit if (CompIndex == 0) { - CBVAVNum = Util::FindItemInList(CompName, state.dataHVACUnitaryBypassVAV->CBVAV); + CBVAVNum = Util::FindItemInList(CompName, state.dataHVACUnitaryBypassVAV->CBVAVs); if (CBVAVNum == 0) { ShowFatalError(state, format("SimUnitaryBypassVAV: Unit not found={}", CompName)); } @@ -167,12 +167,12 @@ namespace HVACUnitaryBypassVAV { CompName)); } if (state.dataHVACUnitaryBypassVAV->CheckEquipName(CBVAVNum)) { - if (CompName != state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum).Name) { + if (CompName != state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum).Name) { ShowFatalError(state, format("SimUnitaryBypassVAV: Invalid CompIndex passed={}, Unit name={}, stored Unit Name for that index={}", CBVAVNum, CompName, - state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum).Name)); + state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum).Name)); } state.dataHVACUnitaryBypassVAV->CheckEquipName(CBVAVNum) = false; } @@ -212,7 +212,7 @@ namespace HVACUnitaryBypassVAV { QSensUnitOut = 0.0; // probably don't need this initialization - auto &changeOverByPassVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &changeOverByPassVAV = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); // zero the fan and DX coils electricity consumption state.dataHVACGlobal->DXElecCoolingPower = 0.0; @@ -284,13 +284,13 @@ namespace HVACUnitaryBypassVAV { Real64 HeatingPower = 0.0; // DX Htg coil Plus CrankCase electric power use or electric heating coil [W] Real64 locDefrostPower = 0.0; - if (changeOverByPassVAV.HeatCoilType == HVAC::CoilType::DXHeatingEmpirical) { + if (changeOverByPassVAV.heatCoilType == HVAC::CoilType::DXHeatingEmpirical) { HeatingPower = state.dataHVACGlobal->DXElecHeatingPower; locDefrostPower = state.dataHVACGlobal->DefrostElecPower; - } else if (changeOverByPassVAV.HeatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + } else if (changeOverByPassVAV.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { HeatingPower = state.dataHVACGlobal->DXElecHeatingPower; locDefrostPower = state.dataHVACGlobal->DefrostElecPower; - } else if (changeOverByPassVAV.HeatCoilType == HVAC::CoilType::HeatingElectric) { + } else if (changeOverByPassVAV.heatCoilType == HVAC::CoilType::HeatingElectric) { HeatingPower = state.dataHVACGlobal->ElecHeatingCoilPower; } else { HeatingPower = 0.0; @@ -317,7 +317,6 @@ namespace HVACUnitaryBypassVAV { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view routineName = "GetCBVAV"; - static constexpr std::string_view getUnitaryHeatCoolVAVChangeoverBypass("GetUnitaryHeatCool:VAVChangeoverBypass"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call @@ -340,12 +339,14 @@ namespace HVACUnitaryBypassVAV { // find the number of each type of CBVAV unit std::string CurrentModuleObject = "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass"; + auto &s_node = state.dataLoopNodes; + // Update Num in state and make local convenience copy int NumCBVAV = state.dataHVACUnitaryBypassVAV->NumCBVAV = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); // allocate the data structures - state.dataHVACUnitaryBypassVAV->CBVAV.resize(NumCBVAV); + state.dataHVACUnitaryBypassVAV->CBVAVs.resize(NumCBVAV); state.dataHVACUnitaryBypassVAV->CheckEquipName.dimension(NumCBVAV, true); // loop over CBVAV units; get and load the input data @@ -363,83 +364,83 @@ namespace HVACUnitaryBypassVAV { cAlphaFields, cNumericFields); - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); - thisCBVAV.Name = Alphas(1); + cbvav.Name = Alphas(1); - ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisCBVAV.Name}; + ErrorObjectHeader eoh{routineName, CurrentModuleObject, cbvav.Name}; - thisCBVAV.UnitType = CurrentModuleObject; - thisCBVAV.Sched = Alphas(2); + cbvav.UnitType = CurrentModuleObject; + cbvav.Sched = Alphas(2); if (lAlphaBlanks(2)) { - thisCBVAV.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + cbvav.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - thisCBVAV.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer (index number) - if (thisCBVAV.SchedPtr == 0) { + cbvav.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer (index number) + if (cbvav.SchedPtr == 0) { ShowSevereError(state, format("{} {} not found = {}", CurrentModuleObject, cAlphaFields(2), Alphas(2))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } } - thisCBVAV.MaxCoolAirVolFlow = Numbers(1); - if (thisCBVAV.MaxCoolAirVolFlow <= 0.0 && thisCBVAV.MaxCoolAirVolFlow != DataSizing::AutoSize) { + cbvav.MaxCoolAirVolFlow = Numbers(1); + if (cbvav.MaxCoolAirVolFlow <= 0.0 && cbvav.MaxCoolAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} illegal {} = {:.7T}", CurrentModuleObject, cNumericFields(1), Numbers(1))); ShowContinueError(state, format("{} must be greater than zero.", cNumericFields(1))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } - thisCBVAV.MaxHeatAirVolFlow = Numbers(2); - if (thisCBVAV.MaxHeatAirVolFlow <= 0.0 && thisCBVAV.MaxHeatAirVolFlow != DataSizing::AutoSize) { + cbvav.MaxHeatAirVolFlow = Numbers(2); + if (cbvav.MaxHeatAirVolFlow <= 0.0 && cbvav.MaxHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} illegal {} = {:.7T}", CurrentModuleObject, cNumericFields(2), Numbers(2))); ShowContinueError(state, format("{} must be greater than zero.", cNumericFields(2))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } - thisCBVAV.MaxNoCoolHeatAirVolFlow = Numbers(3); - if (thisCBVAV.MaxNoCoolHeatAirVolFlow < 0.0 && thisCBVAV.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) { + cbvav.MaxNoCoolHeatAirVolFlow = Numbers(3); + if (cbvav.MaxNoCoolHeatAirVolFlow < 0.0 && cbvav.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} illegal {} = {:.7T}", CurrentModuleObject, cNumericFields(3), Numbers(3))); ShowContinueError(state, format("{} must be greater than or equal to zero.", cNumericFields(3))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } - thisCBVAV.CoolOutAirVolFlow = Numbers(4); - if (thisCBVAV.CoolOutAirVolFlow < 0.0 && thisCBVAV.CoolOutAirVolFlow != DataSizing::AutoSize) { + cbvav.CoolOutAirVolFlow = Numbers(4); + if (cbvav.CoolOutAirVolFlow < 0.0 && cbvav.CoolOutAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} illegal {} = {:.7T}", CurrentModuleObject, cNumericFields(4), Numbers(4))); ShowContinueError(state, format("{} must be greater than or equal to zero.", cNumericFields(4))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } - thisCBVAV.HeatOutAirVolFlow = Numbers(5); - if (thisCBVAV.HeatOutAirVolFlow < 0.0 && thisCBVAV.HeatOutAirVolFlow != DataSizing::AutoSize) { + cbvav.HeatOutAirVolFlow = Numbers(5); + if (cbvav.HeatOutAirVolFlow < 0.0 && cbvav.HeatOutAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} illegal {} = {:.7T}", CurrentModuleObject, cNumericFields(5), Numbers(5))); ShowContinueError(state, format("{} must be greater than or equal to zero.", cNumericFields(5))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } - thisCBVAV.NoCoolHeatOutAirVolFlow = Numbers(6); - if (thisCBVAV.NoCoolHeatOutAirVolFlow < 0.0 && thisCBVAV.NoCoolHeatOutAirVolFlow != DataSizing::AutoSize) { + cbvav.NoCoolHeatOutAirVolFlow = Numbers(6); + if (cbvav.NoCoolHeatOutAirVolFlow < 0.0 && cbvav.NoCoolHeatOutAirVolFlow != DataSizing::AutoSize) { ShowSevereError(state, format("{} illegal {} = {:.7T}", CurrentModuleObject, cNumericFields(6), Numbers(6))); ShowContinueError(state, format("{} must be greater than or equal to zero.", cNumericFields(6))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } - thisCBVAV.OutAirSchPtr = ScheduleManager::GetScheduleIndex(state, Alphas(3)); // convert schedule name to pointer (index number) - if (thisCBVAV.OutAirSchPtr != 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisCBVAV.OutAirSchPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + cbvav.OutAirSchPtr = ScheduleManager::GetScheduleIndex(state, Alphas(3)); // convert schedule name to pointer (index number) + if (cbvav.OutAirSchPtr != 0) { + if (!ScheduleManager::CheckScheduleValueMinMax(state, cbvav.OutAirSchPtr, ">=", 0.0, "<=", 1.0)) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("The schedule values in {} must be 0 to 1.", cAlphaFields(3))); ErrorsFound = true; } } - thisCBVAV.AirInNode = + cbvav.AirInNode = NodeInputManager::GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -453,7 +454,7 @@ namespace HVACUnitaryBypassVAV { std::string MixerInletNodeName = Alphas(5); std::string SplitterOutletNodeName = Alphas(6); - thisCBVAV.AirOutNode = + cbvav.AirOutNode = NodeInputManager::GetOnlySingleNode(state, Alphas(7), ErrorsFound, @@ -464,7 +465,7 @@ namespace HVACUnitaryBypassVAV { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisCBVAV.SplitterOutletAirNode = + cbvav.SplitterOutletAirNode = NodeInputManager::GetOnlySingleNode(state, SplitterOutletNodeName, ErrorsFound, @@ -476,7 +477,7 @@ namespace HVACUnitaryBypassVAV { DataLoopNode::ObjectIsParent); if (NumAlphas > 19 && !lAlphaBlanks(20)) { - thisCBVAV.PlenumMixerInletAirNode = + cbvav.PlenumMixerInletAirNode = NodeInputManager::GetOnlySingleNode(state, Alphas(20), ErrorsFound, @@ -486,7 +487,7 @@ namespace HVACUnitaryBypassVAV { DataLoopNode::ConnectionType::Internal, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisCBVAV.PlenumMixerInletAirNode = + cbvav.PlenumMixerInletAirNode = NodeInputManager::GetOnlySingleNode(state, Alphas(20), ErrorsFound, @@ -498,16 +499,16 @@ namespace HVACUnitaryBypassVAV { DataLoopNode::ObjectIsParent); } - thisCBVAV.plenumIndex = ZonePlenum::getReturnPlenumIndexFromInletNode(state, thisCBVAV.PlenumMixerInletAirNode); - thisCBVAV.mixerIndex = MixerComponent::getZoneMixerIndexFromInletNode(state, thisCBVAV.PlenumMixerInletAirNode); - if (thisCBVAV.plenumIndex > 0 && thisCBVAV.mixerIndex > 0) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + cbvav.plenumIndex = ZonePlenum::getReturnPlenumIndexFromInletNode(state, cbvav.PlenumMixerInletAirNode); + cbvav.mixerIndex = MixerComponent::getZoneMixerIndexFromInletNode(state, cbvav.PlenumMixerInletAirNode); + if (cbvav.plenumIndex > 0 && cbvav.mixerIndex > 0) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal connection for {} = \"{}\".", cAlphaFields(20), Alphas(20))); ShowContinueError( state, format("{} cannot be connected to both an AirloopHVAC:ReturnPlenum and an AirloopHVAC:ZoneMixer.", cAlphaFields(20))); ErrorsFound = true; - } else if (thisCBVAV.plenumIndex == 0 && thisCBVAV.mixerIndex == 0 && thisCBVAV.PlenumMixerInletAirNode > 0) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + } else if (cbvav.plenumIndex == 0 && cbvav.mixerIndex == 0 && cbvav.PlenumMixerInletAirNode > 0) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal connection for {} = \"{}\".", cAlphaFields(20), Alphas(20))); ShowContinueError( state, @@ -515,7 +516,7 @@ namespace HVACUnitaryBypassVAV { ErrorsFound = true; } - thisCBVAV.MixerInletAirNode = + cbvav.MixerInletAirNode = NodeInputManager::GetOnlySingleNode(state, MixerInletNodeName, ErrorsFound, @@ -526,7 +527,7 @@ namespace HVACUnitaryBypassVAV { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisCBVAV.MixerInletAirNode = + cbvav.MixerInletAirNode = NodeInputManager::GetOnlySingleNode(state, MixerInletNodeName, ErrorsFound, @@ -537,7 +538,7 @@ namespace HVACUnitaryBypassVAV { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisCBVAV.SplitterOutletAirNode = + cbvav.SplitterOutletAirNode = NodeInputManager::GetOnlySingleNode(state, SplitterOutletNodeName, ErrorsFound, @@ -548,233 +549,186 @@ namespace HVACUnitaryBypassVAV { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsParent); - thisCBVAV.OAMixType = Alphas(8); - thisCBVAV.OAMixName = Alphas(9); + cbvav.OAMixType = Alphas(8); + cbvav.OAMixName = Alphas(9); bool errFlag = false; - ValidateComponent(state, thisCBVAV.OAMixType, thisCBVAV.OAMixName, errFlag, CurrentModuleObject); + ValidateComponent(state, cbvav.OAMixType, cbvav.OAMixName, errFlag, CurrentModuleObject); if (errFlag) { - ShowContinueError(state, format("specified in {} = \"{}\".", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("specified in {} = \"{}\".", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } else { // Get OA Mixer node numbers - OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, thisCBVAV.OAMixName, errFlag); + OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, cbvav.OAMixName, errFlag); if (errFlag) { - ShowContinueError(state, format("that was specified in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("that was specified in {} = {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, "..OutdoorAir:Mixer is required. Enter an OutdoorAir:Mixer object with this name."); ErrorsFound = true; } else { - thisCBVAV.MixerOutsideAirNode = OANodeNums(1); - thisCBVAV.MixerReliefAirNode = OANodeNums(2); - // thisCBVAV%MixerInletAirNode = OANodeNums(3) - thisCBVAV.MixerMixedAirNode = OANodeNums(4); + cbvav.MixerOutsideAirNode = OANodeNums(1); + cbvav.MixerReliefAirNode = OANodeNums(2); + // cbvav%MixerInletAirNode = OANodeNums(3) + cbvav.MixerMixedAirNode = OANodeNums(4); } } - if (thisCBVAV.MixerInletAirNode != OANodeNums(3)) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + if (cbvav.MixerInletAirNode != OANodeNums(3)) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal {} = {}.", cAlphaFields(5), MixerInletNodeName)); ShowContinueError( state, format("{} must be the same as the return air stream node specified in the OutdoorAir:Mixer object.", cAlphaFields(5))); ErrorsFound = true; } - if (thisCBVAV.MixerInletAirNode == thisCBVAV.AirInNode) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + if (cbvav.MixerInletAirNode == cbvav.AirInNode) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal {} = {}.", cAlphaFields(5), MixerInletNodeName)); ShowContinueError(state, format("{} must be different than the {}.", cAlphaFields(5), cAlphaFields(4))); ErrorsFound = true; } - if (thisCBVAV.SplitterOutletAirNode == thisCBVAV.AirOutNode) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + if (cbvav.SplitterOutletAirNode == cbvav.AirOutNode) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal {} = {}.", cAlphaFields(6), SplitterOutletNodeName)); ShowContinueError(state, format("{} must be different than the {}.", cAlphaFields(6), cAlphaFields(7))); ErrorsFound = true; } // required field must be Key=Fan:ConstantVolume, Fan:OnOff or Fan:SystemModel and read in as upper case - thisCBVAV.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(10))); - assert(thisCBVAV.fanType != HVAC::FanType::Invalid); + cbvav.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(10))); + assert(cbvav.fanType != HVAC::FanType::Invalid); - thisCBVAV.FanName = Alphas(11); + cbvav.FanName = Alphas(11); int fanOutletNode(0); // check that the fan exists - if ((thisCBVAV.FanIndex = Fans::GetFanIndex(state, thisCBVAV.FanName)) == 0) { - ShowSevereItemNotFound(state, eoh, cAlphaFields(11), thisCBVAV.FanName); + if ((cbvav.FanIndex = Fans::GetFanIndex(state, cbvav.FanName)) == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), cbvav.FanName); ErrorsFound = true; - thisCBVAV.FanVolFlow = 9999.0; + cbvav.FanVolFlow = 9999.0; } else { - auto *fan = state.dataFans->fans(thisCBVAV.FanIndex); - thisCBVAV.FanInletNodeNum = fan->inletNodeNum; + auto *fan = state.dataFans->fans(cbvav.FanIndex); + cbvav.FanInletNodeNum = fan->inletNodeNum; fanOutletNode = fan->outletNodeNum; - thisCBVAV.FanVolFlow = fan->maxAirFlowRate; + cbvav.FanVolFlow = fan->maxAirFlowRate; } // required field must be Key=BlowThrough or DrawThrough and read in as BLOWTHROUGH or DRAWTHROUGH - thisCBVAV.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(12))); + cbvav.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(12))); - if (thisCBVAV.fanPlace == HVAC::FanPlace::DrawThru) { - if (thisCBVAV.SplitterOutletAirNode != fanOutletNode) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + if (cbvav.fanPlace == HVAC::FanPlace::DrawThru) { + if (cbvav.SplitterOutletAirNode != fanOutletNode) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal {} = {}.", cAlphaFields(6), SplitterOutletNodeName)); ShowContinueError(state, format("{} must be the same as the fan outlet node specified in {} = {}: {} when draw through {} is selected.", cAlphaFields(6), cAlphaFields(10), Alphas(10), - thisCBVAV.FanName, + cbvav.FanName, cAlphaFields(11))); ErrorsFound = true; } } - if (thisCBVAV.FanVolFlow != DataSizing::AutoSize) { - if (thisCBVAV.FanVolFlow < thisCBVAV.MaxCoolAirVolFlow && thisCBVAV.MaxCoolAirVolFlow != DataSizing::AutoSize) { + if (cbvav.FanVolFlow != DataSizing::AutoSize) { + if (cbvav.FanVolFlow < cbvav.MaxCoolAirVolFlow && cbvav.MaxCoolAirVolFlow != DataSizing::AutoSize) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in {} = {} is less than the ", CurrentModuleObject, - thisCBVAV.FanVolFlow, + cbvav.FanVolFlow, cAlphaFields(11), - thisCBVAV.FanName) + + cbvav.FanName) + cNumericFields(1)); ShowContinueError(state, format(" {} is reset to the fan flow rate and the simulation continues.", cNumericFields(1))); - ShowContinueError(state, format(" Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - thisCBVAV.MaxCoolAirVolFlow = thisCBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); + cbvav.MaxCoolAirVolFlow = cbvav.FanVolFlow; } - if (thisCBVAV.FanVolFlow < thisCBVAV.MaxHeatAirVolFlow && thisCBVAV.MaxHeatAirVolFlow != DataSizing::AutoSize) { + if (cbvav.FanVolFlow < cbvav.MaxHeatAirVolFlow && cbvav.MaxHeatAirVolFlow != DataSizing::AutoSize) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in {} = {} is less than the ", CurrentModuleObject, - thisCBVAV.FanVolFlow, + cbvav.FanVolFlow, cAlphaFields(11), - thisCBVAV.FanName) + + cbvav.FanName) + cNumericFields(2)); ShowContinueError(state, format(" {} is reset to the fan flow rate and the simulation continues.", cNumericFields(2))); - ShowContinueError(state, format(" Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - thisCBVAV.MaxHeatAirVolFlow = thisCBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); + cbvav.MaxHeatAirVolFlow = cbvav.FanVolFlow; } } // only check that OA flow in cooling is >= SA flow in cooling when they are not autosized - if (thisCBVAV.CoolOutAirVolFlow > thisCBVAV.MaxCoolAirVolFlow && thisCBVAV.CoolOutAirVolFlow != DataSizing::AutoSize && - thisCBVAV.MaxCoolAirVolFlow != DataSizing::AutoSize) { + if (cbvav.CoolOutAirVolFlow > cbvav.MaxCoolAirVolFlow && cbvav.CoolOutAirVolFlow != DataSizing::AutoSize && + cbvav.MaxCoolAirVolFlow != DataSizing::AutoSize) { ShowWarningError(state, format("{}: {} cannot be greater than {}", CurrentModuleObject, cNumericFields(4), cNumericFields(1))); ShowContinueError(state, format(" {} is reset to the fan flow rate and the simulation continues.", cNumericFields(4))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - thisCBVAV.CoolOutAirVolFlow = thisCBVAV.FanVolFlow; + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); + cbvav.CoolOutAirVolFlow = cbvav.FanVolFlow; } // only check that SA flow in heating is >= OA flow in heating when they are not autosized - if (thisCBVAV.HeatOutAirVolFlow > thisCBVAV.MaxHeatAirVolFlow && thisCBVAV.HeatOutAirVolFlow != DataSizing::AutoSize && - thisCBVAV.MaxHeatAirVolFlow != DataSizing::AutoSize) { + if (cbvav.HeatOutAirVolFlow > cbvav.MaxHeatAirVolFlow && cbvav.HeatOutAirVolFlow != DataSizing::AutoSize && + cbvav.MaxHeatAirVolFlow != DataSizing::AutoSize) { ShowWarningError(state, format("{}: {} cannot be greater than {}", CurrentModuleObject, cNumericFields(5), cNumericFields(2))); ShowContinueError(state, format(" {} is reset to the fan flow rate and the simulation continues.", cNumericFields(5))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - thisCBVAV.HeatOutAirVolFlow = thisCBVAV.FanVolFlow; + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); + cbvav.HeatOutAirVolFlow = cbvav.FanVolFlow; } - std::string thisCoolCoilType = Alphas(14); - thisCBVAV.CoolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, thisCoolCoilType)); - thisCBVAV.DXCoolCoilName = Alphas(15); + cbvav.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(14))); + cbvav.CoolCoilName = Alphas(15); - if (thisCBVAV.CoolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { - DXCoilErrFlag = false; - DXCoils::GetDXCoilIndex(state, thisCBVAV.DXCoolCoilName, thisCBVAV.DXCoolCoilIndexNum, DXCoilErrFlag, thisCoolCoilType); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + cbvav.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + cbvav.CoolCoilNum = DXCoils::GetDXCoilIndex(state, cbvav.CoolCoilName); + if (cbvav.CoolCoilNum = 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), cbvav.CoolCoilName); ErrorsFound = true; } else { - thisCBVAV.DXCoilInletNode = state.dataDXCoils->DXCoil(thisCBVAV.DXCoolCoilIndexNum).AirInNode; - thisCBVAV.DXCoilOutletNode = state.dataDXCoils->DXCoil(thisCBVAV.DXCoolCoilIndexNum).AirOutNode; - thisCBVAV.CondenserNodeNum = state.dataDXCoils->DXCoil(thisCBVAV.DXCoolCoilIndexNum).CondenserInletNodeNum(1); - } - } else if (thisCBVAV.CoolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { - DXCoilErrFlag = false; - thisCBVAV.DXCoolCoilIndexNum = - VariableSpeedCoils::GetCoilIndexVariableSpeed(state, thisCoolCoilType, thisCBVAV.DXCoolCoilName, DXCoilErrFlag); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + auto const &dxCoil = state.dataDXCoils->DXCoil(cbvav.CoolCoilNum); + cbvav.CoolCoilAirInletNode = dxCoil.AirInNode; + cbvav.CoolCoilAirOutletNode = dxCoil.AirOutNode; + cbvav.CondenserNodeNum = dxCoil.CondenserInletNodeNum(1); + } + + } else if (cbvav.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + cbvav.CoolCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, cbvav.CoolCoilName); + if (cbvav.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), cbvav.CoolCoilName); ErrorsFound = true; } else { - thisCBVAV.DXCoilInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXCoolCoilIndexNum).AirInletNodeNum; - thisCBVAV.DXCoilOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXCoolCoilIndexNum).AirOutletNodeNum; - thisCBVAV.CondenserNodeNum = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXCoolCoilIndexNum).CondenserInletNodeNum; - } - } else if (thisCBVAV.CoolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { - DXCoilErrFlag = false; - int ActualCoolCoilType = - HVACHXAssistedCoolingCoil::GetCoilObjectTypeNum(state, thisCoolCoilType, thisCBVAV.DXCoolCoilName, DXErrorsFound); - if (DXErrorsFound) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); - ShowContinueError(state, format("CoilSystem:Cooling:DX:HeatExchangerAssisted \"{}\" not found.", thisCBVAV.DXCoolCoilName)); + auto const &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(cbvav.CoolCoilNum); + cbvav.CoolCoilAirInletNode = vsCoil.AirInletNodeNum; + cbvav.CoolCoilAirOutletNode = vsCoil.AirOutletNodeNum; + cbvav.CondenserNodeNum = vsCoil.CondenserInletNodeNum; + } + + } else if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { + // For an HXAssisted coil, these variables get bumped + // over to hxCoolCoil so that CoolCoil variables can + // refer to the actual child DX coil + cbvav.hxCoolCoilType = cbvav.coolCoilType; + cbvav.hxCoolCoilName = cbvav.CoolCoilName; + cbvav.hxCoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, cbvav.hxCoolCoilName); + if (cbvav.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), cbvav.CoolCoilName); ErrorsFound = true; } else { - if (ActualCoolCoilType == HVAC::CoilDX_CoolingSingleSpeed) { - DXCoils::GetDXCoilIndex( - state, - HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, thisCoolCoilType, thisCBVAV.DXCoolCoilName, DXCoilErrFlag), - thisCBVAV.DXCoolCoilIndexNum, - DXCoilErrFlag, - "Coil:Cooling:DX:SingleSpeed"); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); - ErrorsFound = true; - } else { - // the "coil" nodes are actually the parent nodes of the wrapped HX - thisCBVAV.DXCoilInletNode = - HVACHXAssistedCoolingCoil::GetCoilInletNode(state, thisCoolCoilType, thisCBVAV.DXCoolCoilName, DXErrorsFound); - thisCBVAV.DXCoilOutletNode = - HVACHXAssistedCoolingCoil::GetCoilOutletNode(state, thisCoolCoilType, thisCBVAV.DXCoolCoilName, DXErrorsFound); - // the DX coil holds the condenser inlet node number - thisCBVAV.CondenserNodeNum = state.dataDXCoils->DXCoil(thisCBVAV.DXCoolCoilIndexNum).CondenserInletNodeNum(1); - } - } else if (ActualCoolCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - thisCBVAV.DXCoolCoilIndexNum = VariableSpeedCoils::GetCoilIndexVariableSpeed( - state, - "Coil:Cooling:DX:VariableSpeed", - HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, thisCoolCoilType, thisCBVAV.DXCoolCoilName, DXCoilErrFlag), - DXCoilErrFlag); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); - ErrorsFound = true; - } else { - thisCBVAV.DXCoilInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXCoolCoilIndexNum).AirInletNodeNum; - thisCBVAV.DXCoilOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXCoolCoilIndexNum).AirOutletNodeNum; - thisCBVAV.CondenserNodeNum = - state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXCoolCoilIndexNum).CondenserInletNodeNum; - } - } else if (ActualCoolCoilType == HVAC::CoilDX_Cooling) { - thisCBVAV.DXCoolCoilIndexNum = CoilCoolingDX::factory(state, thisCBVAV.DXCoolCoilName); - if (thisCBVAV.DXCoolCoilIndexNum == -1) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); - ErrorsFound = true; - } else { - auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[thisCBVAV.DXCoolCoilIndexNum]; - thisCBVAV.DXCoilInletNode = newCoil.evapInletNodeIndex; - thisCBVAV.DXCoilOutletNode = newCoil.evapOutletNodeIndex; - thisCBVAV.CondenserNodeNum = newCoil.condInletNodeIndex; - } - } - } - } else if (thisCBVAV.CoolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { - DXCoilErrFlag = false; - DXCoils::GetDXCoilIndex(state, thisCBVAV.DXCoolCoilName, thisCBVAV.DXCoolCoilIndexNum, DXCoilErrFlag, thisCoolCoilType); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); - ErrorsFound = true; - } else { - thisCBVAV.DXCoilInletNode = state.dataDXCoils->DXCoil(thisCBVAV.DXCoolCoilIndexNum).AirInNode; - thisCBVAV.DXCoilOutletNode = state.dataDXCoils->DXCoil(thisCBVAV.DXCoolCoilIndexNum).AirOutNode; - thisCBVAV.CondenserNodeNum = state.dataDXCoils->DXCoil(thisCBVAV.DXCoolCoilIndexNum).CondenserInletNodeNum(1); + // The HXAssisted coil has already mined all of these from the child coil + cbvav.coolCoilType = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilType(state, cbvav.hxCoolCoilNum); + cbvav.CoolCoilName = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilName(state, cbvav.hxCoolCoilNum); + cbvav.CoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilIndex(state, cbvav.hxCoolCoilNum); + cbvav.CoolCoilAirInletNode = HVACHXAssistedCoolingCoil::GetHXCoilInletNode(state, cbvav.hxCoolCoilNum); + cbvav.CoolCoilAirOutletNode = HVACHXAssistedCoolingCoil::GetHXCoilOutletNode(state, cbvav.hxCoolCoilNum); + cbvav.CondenserNodeNum = HVACHXAssistedCoolingCoil::GetHXCoilCondenserInletNode(state, cbvav.hxCoolCoilNum); } } - thisCBVAV.FanOpModeSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(13)); // convert schedule name to pointer (index number) - if (thisCBVAV.FanOpModeSchedPtr != 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisCBVAV.FanOpModeSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + cbvav.FanOpModeSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(13)); // convert schedule name to pointer (index number) + if (cbvav.FanOpModeSchedPtr != 0) { + if (!ScheduleManager::CheckScheduleValueMinMax(state, cbvav.FanOpModeSchedPtr, ">=", 0.0, "<=", 1.0)) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("The schedule values in {} must be 0 to 1.", cAlphaFields(13))); ShowContinueError(state, "A value of 0 represents cycling fan mode, any other value up to 1 represents constant fan mode."); ErrorsFound = true; @@ -782,306 +736,309 @@ namespace HVACUnitaryBypassVAV { // Check supply air fan operating mode for cycling fan, if NOT cycling fan set AirFlowControl if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisCBVAV.FanOpModeSchedPtr, ">=", 0.0, "<=", 0.0)) { // Autodesk:Note Range is 0 to 0? + state, cbvav.FanOpModeSchedPtr, ">=", 0.0, "<=", 0.0)) { // Autodesk:Note Range is 0 to 0? // set air flow control mode, // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off // UseCompressorOffFlow = operate at value specified by user (no input for this object type, UseCompONFlow) // AirFlowControl only valid if fan opmode = HVAC::FanOp::Continuous - if (thisCBVAV.MaxNoCoolHeatAirVolFlow == 0.0) { - thisCBVAV.AirFlowControl = AirFlowCtrlMode::UseCompressorOnFlow; + if (cbvav.MaxNoCoolHeatAirVolFlow == 0.0) { + cbvav.AirFlowControl = AirFlowCtrlMode::UseCompressorOnFlow; } else { - thisCBVAV.AirFlowControl = AirFlowCtrlMode::UseCompressorOffFlow; + cbvav.AirFlowControl = AirFlowCtrlMode::UseCompressorOffFlow; } } } else { if (!lAlphaBlanks(13)) { - ShowWarningError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + ShowWarningError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("{} = {} not found. Supply air fan operating mode set to constant operation and simulation continues.", cAlphaFields(13), Alphas(13))); } - thisCBVAV.fanOp = HVAC::FanOp::Continuous; - if (thisCBVAV.MaxNoCoolHeatAirVolFlow == 0.0) { - thisCBVAV.AirFlowControl = AirFlowCtrlMode::UseCompressorOnFlow; + cbvav.fanOp = HVAC::FanOp::Continuous; + if (cbvav.MaxNoCoolHeatAirVolFlow == 0.0) { + cbvav.AirFlowControl = AirFlowCtrlMode::UseCompressorOnFlow; } else { - thisCBVAV.AirFlowControl = AirFlowCtrlMode::UseCompressorOffFlow; + cbvav.AirFlowControl = AirFlowCtrlMode::UseCompressorOffFlow; } } // Check FanVolFlow, must be >= CBVAV flow - if (thisCBVAV.FanVolFlow != DataSizing::AutoSize) { - if (thisCBVAV.FanVolFlow < thisCBVAV.MaxNoCoolHeatAirVolFlow && thisCBVAV.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize && - thisCBVAV.MaxNoCoolHeatAirVolFlow != 0.0) { + if (cbvav.FanVolFlow != DataSizing::AutoSize) { + if (cbvav.FanVolFlow < cbvav.MaxNoCoolHeatAirVolFlow && cbvav.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize && + cbvav.MaxNoCoolHeatAirVolFlow != 0.0) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in {} = {} is less than ", CurrentModuleObject, - thisCBVAV.FanVolFlow, + cbvav.FanVolFlow, cAlphaFields(11), - thisCBVAV.FanName) + + cbvav.FanName) + cNumericFields(3)); ShowContinueError(state, format(" {} is reset to the fan flow rate and the simulation continues.", cNumericFields(3))); - ShowContinueError(state, format(" Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - thisCBVAV.MaxNoCoolHeatAirVolFlow = thisCBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); + cbvav.MaxNoCoolHeatAirVolFlow = cbvav.FanVolFlow; } } // only check that OA flow when compressor is OFF is >= SA flow when compressor is OFF when both are not autosized and // that MaxNoCoolHeatAirVolFlow is /= 0 (trigger to use compressor ON flow, see AirFlowControl variable initialization above) - if (thisCBVAV.NoCoolHeatOutAirVolFlow > thisCBVAV.MaxNoCoolHeatAirVolFlow && thisCBVAV.NoCoolHeatOutAirVolFlow != DataSizing::AutoSize && - thisCBVAV.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize && thisCBVAV.MaxNoCoolHeatAirVolFlow != 0.0) { + if (cbvav.NoCoolHeatOutAirVolFlow > cbvav.MaxNoCoolHeatAirVolFlow && cbvav.NoCoolHeatOutAirVolFlow != DataSizing::AutoSize && + cbvav.MaxNoCoolHeatAirVolFlow != DataSizing::AutoSize && cbvav.MaxNoCoolHeatAirVolFlow != 0.0) { ShowWarningError(state, format("{}: {} cannot be greater than {}", CurrentModuleObject, cNumericFields(6), cNumericFields(3))); ShowContinueError(state, format(" {} is reset to the fan flow rate and the simulation continues.", cNumericFields(6))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - thisCBVAV.NoCoolHeatOutAirVolFlow = thisCBVAV.FanVolFlow; + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); + cbvav.NoCoolHeatOutAirVolFlow = cbvav.FanVolFlow; } std::string thisHeatCoilType = Alphas(16); - thisCBVAV.HeatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, thisHeatCoilType)); - thisCBVAV.HeatCoilName = Alphas(17); + cbvav.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, thisHeatCoilType)); + cbvav.HeatCoilName = Alphas(17); DXCoilErrFlag = false; - if (thisCBVAV.HeatCoilType == HVAC::CoilType::DXHeatingEmpirical) { - DXCoils::GetDXCoilIndex(state, - thisCBVAV.HeatCoilName, - thisCBVAV.DXHeatCoilIndexNum, - DXCoilErrFlag, - HVAC::coilTypeNamesUC[static_cast(thisCBVAV.HeatCoilType)]); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + if (cbvav.heatCoilType == HVAC::CoilType::DXHeatingEmpirical) { + cbvav.HeatCoilNum = DXCoils::GetDXCoilIndex(state, cbvav.HeatCoilName); + if (cbvav.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), cbvav.HeatCoilName); ErrorsFound = true; } else { - thisCBVAV.MinOATCompressor = state.dataDXCoils->DXCoil(thisCBVAV.DXHeatCoilIndexNum).MinOATCompressor; - thisCBVAV.HeatingCoilInletNode = state.dataDXCoils->DXCoil(thisCBVAV.DXHeatCoilIndexNum).AirInNode; - thisCBVAV.HeatingCoilOutletNode = state.dataDXCoils->DXCoil(thisCBVAV.DXHeatCoilIndexNum).AirOutNode; - } - } else if (thisCBVAV.HeatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { - thisCBVAV.DXHeatCoilIndexNum = VariableSpeedCoils::GetCoilIndexVariableSpeed( - state, HVAC::cAllCoilTypes(static_cast(thisCBVAV.HeatCoilType) + 1), thisCBVAV.HeatCoilName, DXCoilErrFlag); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + auto const &dxCoil = state.dataDXCoils->DXCoil(cbvav.HeatCoilNum); + cbvav.MinOATCompressor = dxCoil.MinOATCompressor; + cbvav.HeatCoilAirInletNode = dxCoil.AirInNode; + cbvav.HeatCoilAirOutletNode = dxCoil.AirOutNode; + } + + } else if (cbvav.heatCoilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + cbvav.HeatCoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, cbvav.HeatCoilName); + if (cbvav.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), cbvav.HeatCoilName); ErrorsFound = true; } else { - thisCBVAV.MinOATCompressor = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXHeatCoilIndexNum).MinOATCompressor; - thisCBVAV.HeatingCoilInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXHeatCoilIndexNum).AirInletNodeNum; - thisCBVAV.HeatingCoilOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.DXHeatCoilIndexNum).AirOutletNodeNum; - } - } else if (thisCBVAV.HeatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || thisCBVAV.HeatCoilType == HVAC::CoilType::HeatingElectric) { - HeatingCoils::GetCoilIndex(state, thisCBVAV.HeatCoilName, thisCBVAV.DXHeatCoilIndexNum, DXCoilErrFlag); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(cbvav.HeatCoilNum); + cbvav.MinOATCompressor = vsCoil.MinOATCompressor; + cbvav.HeatCoilAirInletNode = vsCoil.AirInletNodeNum; + cbvav.HeatCoilAirOutletNode = vsCoil.AirOutletNodeNum; + } + + } else if (cbvav.heatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + cbvav.heatCoilType == HVAC::CoilType::HeatingElectric) { + cbvav.HeatCoilNum = HeatingCoils::GetCoilIndex(state, cbvav.HeatCoilName); + if (cbvav.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), cbvav.HeatCoilName); ErrorsFound = true; } else { - thisCBVAV.MinOATCompressor = -999.9; - thisCBVAV.HeatingCoilInletNode = state.dataHeatingCoils->HeatingCoil(thisCBVAV.DXHeatCoilIndexNum).AirInletNodeNum; - thisCBVAV.HeatingCoilOutletNode = state.dataHeatingCoils->HeatingCoil(thisCBVAV.DXHeatCoilIndexNum).AirOutletNodeNum; - } - } else if (thisCBVAV.HeatCoilType == HVAC::CoilType::HeatingWater) { - thisCBVAV.DXHeatCoilIndexNum = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", thisCBVAV.HeatCoilName, DXCoilErrFlag); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + auto &heatCoil = state.dataHeatingCoils->HeatingCoil(cbvav.HeatCoilNum); + cbvav.MinOATCompressor = -999.9; + cbvav.HeatCoilAirInletNode = heatCoil.AirInletNodeNum; + cbvav.HeatCoilAirOutletNode = heatCoil.AirOutletNodeNum; + } + + } else if (cbvav.heatCoilType == HVAC::CoilType::HeatingWater) { + cbvav.HeatCoilNum = WaterCoils::GetWaterCoilIndex(state, cbvav.HeatCoilName); + if (cbvav.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), cbvav.HeatCoilName); ErrorsFound = true; } else { - thisCBVAV.CoilControlNode = state.dataWaterCoils->WaterCoil(thisCBVAV.DXHeatCoilIndexNum).WaterInletNodeNum; - thisCBVAV.MaxHeatCoilFluidFlow = state.dataWaterCoils->WaterCoil(thisCBVAV.DXHeatCoilIndexNum).MaxWaterVolFlowRate; - thisCBVAV.HeatingCoilInletNode = state.dataWaterCoils->WaterCoil(thisCBVAV.DXHeatCoilIndexNum).AirInletNodeNum; - thisCBVAV.HeatingCoilOutletNode = state.dataWaterCoils->WaterCoil(thisCBVAV.DXHeatCoilIndexNum).AirOutletNodeNum; - } - } else if (thisCBVAV.HeatCoilType == HVAC::CoilType::HeatingSteam) { - thisCBVAV.HeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", thisCBVAV.HeatCoilName, DXCoilErrFlag); - if (DXCoilErrFlag) { - ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + auto const &waterCoil = state.dataWaterCoils->WaterCoil(cbvav.HeatCoilNum); + cbvav.HeatCoilControlNode = waterCoil.WaterInletNodeNum; + cbvav.MaxHeatCoilFluidFlow = waterCoil.MaxWaterVolFlowRate; + cbvav.HeatCoilAirInletNode = waterCoil.AirInletNodeNum; + cbvav.HeatCoilAirOutletNode = waterCoil.AirOutletNodeNum; + } + + } else if (cbvav.heatCoilType == HVAC::CoilType::HeatingSteam) { + cbvav.HeatCoilNum = SteamCoils::GetSteamCoilIndex(state, cbvav.HeatCoilName); + if (cbvav.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), cbvav.HeatCoilName); ErrorsFound = true; } else { - thisCBVAV.HeatingCoilInletNode = state.dataSteamCoils->SteamCoil(thisCBVAV.HeatCoilIndex).AirInletNodeNum; - thisCBVAV.HeatingCoilOutletNode = state.dataSteamCoils->SteamCoil(thisCBVAV.HeatCoilIndex).AirOutletNodeNum; - thisCBVAV.CoilControlNode = state.dataSteamCoils->SteamCoil(thisCBVAV.HeatCoilIndex).SteamInletNodeNum; - thisCBVAV.MaxHeatCoilFluidFlow = state.dataSteamCoils->SteamCoil(thisCBVAV.HeatCoilIndex).MaxSteamVolFlowRate; - Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity( - state, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, getUnitaryHeatCoolVAVChangeoverBypass); - if (thisCBVAV.MaxHeatCoilFluidFlow > 0.0) { - thisCBVAV.MaxHeatCoilFluidFlow = thisCBVAV.MaxHeatCoilFluidFlow * SteamDensity; + auto const &steamCoil = state.dataSteamCoils->SteamCoil(cbvav.HeatCoilNum); + cbvav.HeatCoilAirInletNode = steamCoil.AirInletNodeNum; + cbvav.HeatCoilAirOutletNode = steamCoil.AirOutletNodeNum; + cbvav.HeatCoilControlNode = steamCoil.SteamInletNodeNum; + cbvav.MaxHeatCoilFluidFlow = steamCoil.MaxSteamVolFlowRate; + if (cbvav.MaxHeatCoilFluidFlow > 0.0) { + cbvav.MaxHeatCoilFluidFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, routineName); } } } - if (thisCBVAV.DXCoilOutletNode != thisCBVAV.HeatingCoilInletNode) { + if (cbvav.CoolCoilAirOutletNode != cbvav.HeatCoilAirInletNode) { ShowSevereError(state, format("{} illegal coil placement. Cooling coil must be upstream of heating coil.", CurrentModuleObject)); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ErrorsFound = true; } - if (thisCBVAV.fanPlace == HVAC::FanPlace::BlowThru) { - if (thisCBVAV.SplitterOutletAirNode != thisCBVAV.HeatingCoilOutletNode) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + if (cbvav.fanPlace == HVAC::FanPlace::BlowThru) { + if (cbvav.SplitterOutletAirNode != cbvav.HeatCoilAirOutletNode) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal {} = {}.", cAlphaFields(6), SplitterOutletNodeName)); ShowContinueError( state, format( "{} must be the same as the outlet node specified in the heating coil object = {}: {} when blow through {} is selected.", cAlphaFields(6), - HVAC::coilTypeNamesUC[static_cast(thisCBVAV.HeatCoilType)], - thisCBVAV.HeatCoilName, + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName, cAlphaFields(12))); ErrorsFound = true; } - if (thisCBVAV.MixerMixedAirNode != thisCBVAV.FanInletNodeNum) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + if (cbvav.MixerMixedAirNode != cbvav.FanInletNodeNum) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal {}. The fan inlet node name must be the same as the mixed air node specified in the {} = {} " "when blow through {} is selected.", cAlphaFields(11), cAlphaFields(9), - thisCBVAV.OAMixName, + cbvav.OAMixName, cAlphaFields(12))); ErrorsFound = true; } } - if (thisCBVAV.fanPlace == HVAC::FanPlace::DrawThru) { - if (thisCBVAV.MixerMixedAirNode != thisCBVAV.DXCoilInletNode) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); + if (cbvav.fanPlace == HVAC::FanPlace::DrawThru) { + if (cbvav.MixerMixedAirNode != cbvav.CoolCoilAirInletNode) { + ShowSevereError(state, format("{}: {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Illegal cooling coil placement. The cooling coil inlet node name must be the same as the mixed air " "node specified in the {} = {} when draw through {} is selected.", cAlphaFields(9), - thisCBVAV.OAMixName, + cbvav.OAMixName, cAlphaFields(12))); ErrorsFound = true; } } if (Util::SameString(Alphas(18), "CoolingPriority")) { - thisCBVAV.PriorityControl = PriorityCtrlMode::CoolingPriority; + cbvav.PriorityControl = PriorityCtrlMode::CoolingPriority; } else if (Util::SameString(Alphas(18), "HeatingPriority")) { - thisCBVAV.PriorityControl = PriorityCtrlMode::HeatingPriority; + cbvav.PriorityControl = PriorityCtrlMode::HeatingPriority; } else if (Util::SameString(Alphas(18), "ZonePriority")) { - thisCBVAV.PriorityControl = PriorityCtrlMode::ZonePriority; + cbvav.PriorityControl = PriorityCtrlMode::ZonePriority; } else if (Util::SameString(Alphas(18), "LoadPriority")) { - thisCBVAV.PriorityControl = PriorityCtrlMode::LoadPriority; + cbvav.PriorityControl = PriorityCtrlMode::LoadPriority; } else { ShowSevereError(state, format("{} illegal {} = {}", CurrentModuleObject, cAlphaFields(18), Alphas(18))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, "Valid choices are CoolingPriority, HeatingPriority, ZonePriority or LoadPriority."); ErrorsFound = true; } if (Numbers(7) > 0.0) { - thisCBVAV.MinLATCooling = Numbers(7); + cbvav.MinLATCooling = Numbers(7); } else { - thisCBVAV.MinLATCooling = 10.0; + cbvav.MinLATCooling = 10.0; } if (Numbers(8) > 0.0) { - thisCBVAV.MaxLATHeating = Numbers(8); + cbvav.MaxLATHeating = Numbers(8); } else { - thisCBVAV.MaxLATHeating = 50.0; + cbvav.MaxLATHeating = 50.0; } - if (thisCBVAV.MinLATCooling > thisCBVAV.MaxLATHeating) { + if (cbvav.MinLATCooling > cbvav.MaxLATHeating) { ShowWarningError(state, format("{}: illegal leaving air temperature specified.", CurrentModuleObject)); ShowContinueError(state, format("Resetting {} equal to {} and the simulation continues.", cNumericFields(7), cNumericFields(8))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - thisCBVAV.MinLATCooling = thisCBVAV.MaxLATHeating; + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); + cbvav.MinLATCooling = cbvav.MaxLATHeating; } // Dehumidification control mode if (Util::SameString(Alphas(19), "None")) { - thisCBVAV.DehumidControlType = DehumidControl::None; + cbvav.DehumidControlType = DehumidControl::None; } else if (Util::SameString(Alphas(19), "")) { - thisCBVAV.DehumidControlType = DehumidControl::None; + cbvav.DehumidControlType = DehumidControl::None; } else if (Util::SameString(Alphas(19), "Multimode")) { - if (thisCBVAV.CoolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { - thisCBVAV.DehumidControlType = DehumidControl::Multimode; + if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + cbvav.DehumidControlType = DehumidControl::Multimode; } else { ShowWarningError(state, format("Invalid {} = {}", cAlphaFields(19), Alphas(19))); - ShowContinueError(state, format("In {} \"{}\".", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("In {} \"{}\".", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Valid only with {} = Coil:Cooling:DX:TwoStageWithHumidityControlMode.", cAlphaFields(14))); ShowContinueError(state, format("Setting {} to \"None\" and the simulation continues.", cAlphaFields(19))); - thisCBVAV.DehumidControlType = DehumidControl::None; + cbvav.DehumidControlType = DehumidControl::None; } } else if (Util::SameString(Alphas(19), "CoolReheat")) { - if (thisCBVAV.CoolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { - thisCBVAV.DehumidControlType = DehumidControl::CoolReheat; + if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + cbvav.DehumidControlType = DehumidControl::CoolReheat; } else { ShowWarningError(state, format("Invalid {} = {}", cAlphaFields(19), Alphas(19))); - ShowContinueError(state, format("In {} \"{}\".", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("In {} \"{}\".", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Valid only with {} = Coil:Cooling:DX:TwoStageWithHumidityControlMode.", cAlphaFields(14))); ShowContinueError(state, format("Setting {} to \"None\" and the simulation continues.", cAlphaFields(19))); - thisCBVAV.DehumidControlType = DehumidControl::None; + cbvav.DehumidControlType = DehumidControl::None; } } else { ShowSevereError(state, format("Invalid {} ={}", cAlphaFields(19), Alphas(19))); - ShowContinueError(state, format("In {} \"{}\".", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("In {} \"{}\".", CurrentModuleObject, cbvav.Name)); } if (NumNumbers > 8) { - thisCBVAV.minModeChangeTime = Numbers(9); + cbvav.minModeChangeTime = Numbers(9); } // Initialize last mode of compressor operation - thisCBVAV.LastMode = HeatingMode; + cbvav.LastMode = HeatingMode; - if (thisCBVAV.fanType == HVAC::FanType::OnOff || thisCBVAV.fanType == HVAC::FanType::Constant) { - HVAC::FanType fanType2 = state.dataFans->fans(thisCBVAV.FanIndex)->type; - if (thisCBVAV.fanType != fanType2) { + if (cbvav.fanType == HVAC::FanType::OnOff || cbvav.fanType == HVAC::FanType::Constant) { + HVAC::FanType fanType2 = state.dataFans->fans(cbvav.FanIndex)->type; + if (cbvav.fanType != fanType2) { ShowWarningError( state, format("{} has {} = {} which is inconsistent with the fan object.", CurrentModuleObject, cAlphaFields(10), Alphas(10))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, - format(" The fan object ({}) is actually a valid fan type and the simulation continues.", thisCBVAV.FanName)); + format(" The fan object ({}) is actually a valid fan type and the simulation continues.", cbvav.FanName)); ShowContinueError(state, " Node connections errors may result due to the inconsistent fan type."); } } // Add fan to component sets array - if (thisCBVAV.fanPlace == HVAC::FanPlace::BlowThru) { - CompSetFanInlet = state.dataLoopNodes->NodeID(thisCBVAV.MixerMixedAirNode); - CompSetFanOutlet = state.dataLoopNodes->NodeID(thisCBVAV.DXCoilInletNode); + if (cbvav.fanPlace == HVAC::FanPlace::BlowThru) { + CompSetFanInlet = s_node->NodeID(cbvav.MixerMixedAirNode); + CompSetFanOutlet = s_node->NodeID(cbvav.CoolCoilAirInletNode); } else { - CompSetFanInlet = state.dataLoopNodes->NodeID(thisCBVAV.HeatingCoilOutletNode); + CompSetFanInlet = s_node->NodeID(cbvav.HeatCoilAirOutletNode); CompSetFanOutlet = SplitterOutletNodeName; } - std::string CompSetCoolInlet = state.dataLoopNodes->NodeID(thisCBVAV.DXCoilInletNode); - std::string CompSetCoolOutlet = state.dataLoopNodes->NodeID(thisCBVAV.DXCoilOutletNode); + std::string CompSetCoolInlet = s_node->NodeID(cbvav.CoolCoilAirInletNode); + std::string CompSetCoolOutlet = s_node->NodeID(cbvav.CoolCoilAirOutletNode); // Add fan to component sets array BranchNodeConnections::SetUpCompSets( - state, thisCBVAV.UnitType, thisCBVAV.Name, Alphas(10), thisCBVAV.FanName, CompSetFanInlet, CompSetFanOutlet); + state, cbvav.UnitType, cbvav.Name, Alphas(10), cbvav.FanName, CompSetFanInlet, CompSetFanOutlet); // Add cooling coil to component sets array BranchNodeConnections::SetUpCompSets(state, - thisCBVAV.UnitType, - thisCBVAV.Name, - HVAC::coilTypeNamesUC[static_cast(thisCBVAV.CoolCoilType)], - thisCBVAV.DXCoolCoilName, + cbvav.UnitType, + cbvav.Name, + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName, CompSetCoolInlet, CompSetCoolOutlet); // Add heating coil to component sets array BranchNodeConnections::SetUpCompSets(state, - thisCBVAV.UnitType, - thisCBVAV.Name, - HVAC::coilTypeNamesUC[static_cast(thisCBVAV.HeatCoilType)], - thisCBVAV.HeatCoilName, - state.dataLoopNodes->NodeID(thisCBVAV.HeatingCoilInletNode), - state.dataLoopNodes->NodeID(thisCBVAV.HeatingCoilOutletNode)); + cbvav.UnitType, + cbvav.Name, + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName, + s_node->NodeID(cbvav.HeatCoilAirInletNode), + s_node->NodeID(cbvav.HeatCoilAirOutletNode)); // Set up component set for OA mixer - use OA node and Mixed air node BranchNodeConnections::SetUpCompSets(state, - thisCBVAV.UnitType, - thisCBVAV.Name, - thisCBVAV.OAMixType, - thisCBVAV.OAMixName, - state.dataLoopNodes->NodeID(thisCBVAV.MixerOutsideAirNode), - state.dataLoopNodes->NodeID(thisCBVAV.MixerMixedAirNode)); + cbvav.UnitType, + cbvav.Name, + cbvav.OAMixType, + cbvav.OAMixName, + s_node->NodeID(cbvav.MixerOutsideAirNode), + s_node->NodeID(cbvav.MixerMixedAirNode)); BranchNodeConnections::TestCompSet(state, - thisCBVAV.UnitType, - thisCBVAV.Name, - state.dataLoopNodes->NodeID(thisCBVAV.AirInNode), - state.dataLoopNodes->NodeID(thisCBVAV.AirOutNode), + cbvav.UnitType, + cbvav.Name, + s_node->NodeID(cbvav.AirInNode), + s_node->NodeID(cbvav.AirOutNode), "Air Nodes"); // Find air loop associated with CBVAV system @@ -1090,66 +1047,66 @@ namespace HVACUnitaryBypassVAV { for (int CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { if (!Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name, - thisCBVAV.Name) || + cbvav.Name) || !Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf, - thisCBVAV.UnitType)) + cbvav.UnitType)) continue; - thisCBVAV.AirLoopNumber = AirLoopNum; + cbvav.AirLoopNumber = AirLoopNum; // Should EXIT here or do other checking? break; } } } - if (thisCBVAV.AirLoopNumber > 0) { - thisCBVAV.NumControlledZones = state.dataAirLoop->AirToZoneNodeInfo(thisCBVAV.AirLoopNumber).NumZonesCooled; - thisCBVAV.ControlledZoneNum.allocate(thisCBVAV.NumControlledZones); - thisCBVAV.ControlledZoneNodeNum.allocate(thisCBVAV.NumControlledZones); - thisCBVAV.CBVAVBoxOutletNode.allocate(thisCBVAV.NumControlledZones); - thisCBVAV.ZoneSequenceCoolingNum.allocate(thisCBVAV.NumControlledZones); - thisCBVAV.ZoneSequenceHeatingNum.allocate(thisCBVAV.NumControlledZones); + if (cbvav.AirLoopNumber > 0) { + cbvav.NumControlledZones = state.dataAirLoop->AirToZoneNodeInfo(cbvav.AirLoopNumber).NumZonesCooled; + cbvav.ControlledZoneNum.allocate(cbvav.NumControlledZones); + cbvav.ControlledZoneNodeNum.allocate(cbvav.NumControlledZones); + cbvav.CBVAVBoxOutletNode.allocate(cbvav.NumControlledZones); + cbvav.ZoneSequenceCoolingNum.allocate(cbvav.NumControlledZones); + cbvav.ZoneSequenceHeatingNum.allocate(cbvav.NumControlledZones); - thisCBVAV.ControlledZoneNum = 0; - for (int AirLoopZoneNum = 1; AirLoopZoneNum <= state.dataAirLoop->AirToZoneNodeInfo(thisCBVAV.AirLoopNumber).NumZonesCooled; + cbvav.ControlledZoneNum = 0; + for (int AirLoopZoneNum = 1; AirLoopZoneNum <= state.dataAirLoop->AirToZoneNodeInfo(cbvav.AirLoopNumber).NumZonesCooled; ++AirLoopZoneNum) { - thisCBVAV.ControlledZoneNum(AirLoopZoneNum) = - state.dataAirLoop->AirToZoneNodeInfo(thisCBVAV.AirLoopNumber).CoolCtrlZoneNums(AirLoopZoneNum); - if (thisCBVAV.ControlledZoneNum(AirLoopZoneNum) > 0) { - thisCBVAV.ControlledZoneNodeNum(AirLoopZoneNum) = - state.dataZoneEquip->ZoneEquipConfig(thisCBVAV.ControlledZoneNum(AirLoopZoneNum)).ZoneNode; - thisCBVAV.CBVAVBoxOutletNode(AirLoopZoneNum) = - state.dataAirLoop->AirToZoneNodeInfo(thisCBVAV.AirLoopNumber).CoolZoneInletNodes(AirLoopZoneNum); + cbvav.ControlledZoneNum(AirLoopZoneNum) = + state.dataAirLoop->AirToZoneNodeInfo(cbvav.AirLoopNumber).CoolCtrlZoneNums(AirLoopZoneNum); + if (cbvav.ControlledZoneNum(AirLoopZoneNum) > 0) { + cbvav.ControlledZoneNodeNum(AirLoopZoneNum) = + state.dataZoneEquip->ZoneEquipConfig(cbvav.ControlledZoneNum(AirLoopZoneNum)).ZoneNode; + cbvav.CBVAVBoxOutletNode(AirLoopZoneNum) = + state.dataAirLoop->AirToZoneNodeInfo(cbvav.AirLoopNumber).CoolZoneInletNodes(AirLoopZoneNum); // check for thermostat in controlled zone bool FoundTstatZone = false; for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != thisCBVAV.ControlledZoneNum(AirLoopZoneNum)) + if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != cbvav.ControlledZoneNum(AirLoopZoneNum)) continue; FoundTstatZone = true; } if (!FoundTstatZone) { - ShowWarningError(state, format("{} \"{}\"", CurrentModuleObject, thisCBVAV.Name)); + ShowWarningError(state, format("{} \"{}\"", CurrentModuleObject, cbvav.Name)); ShowContinueError(state, format("Thermostat not found in zone = {} and the simulation continues.", - state.dataZoneEquip->ZoneEquipConfig(thisCBVAV.ControlledZoneNum(AirLoopZoneNum)).ZoneName)); + state.dataZoneEquip->ZoneEquipConfig(cbvav.ControlledZoneNum(AirLoopZoneNum)).ZoneName)); ShowContinueError(state, "This zone will not be controlled to a temperature setpoint."); } - int zoneNum = thisCBVAV.ControlledZoneNum(AirLoopZoneNum); - int zoneInlet = thisCBVAV.CBVAVBoxOutletNode(AirLoopZoneNum); + int zoneNum = cbvav.ControlledZoneNum(AirLoopZoneNum); + int zoneInlet = cbvav.CBVAVBoxOutletNode(AirLoopZoneNum); // setup zone equipment sequence information based on finding matching air terminal if (state.dataZoneEquip->ZoneEquipConfig(zoneNum).EquipListIndex > 0) { int coolingPriority = 0; int heatingPriority = 0; state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(zoneNum).EquipListIndex) .getPrioritiesForInletNode(state, zoneInlet, coolingPriority, heatingPriority); - thisCBVAV.ZoneSequenceCoolingNum(AirLoopZoneNum) = coolingPriority; - thisCBVAV.ZoneSequenceHeatingNum(AirLoopZoneNum) = heatingPriority; + cbvav.ZoneSequenceCoolingNum(AirLoopZoneNum) = coolingPriority; + cbvav.ZoneSequenceHeatingNum(AirLoopZoneNum) = heatingPriority; } - if (thisCBVAV.ZoneSequenceCoolingNum(AirLoopZoneNum) == 0 || thisCBVAV.ZoneSequenceHeatingNum(AirLoopZoneNum) == 0) { + if (cbvav.ZoneSequenceCoolingNum(AirLoopZoneNum) == 0 || cbvav.ZoneSequenceHeatingNum(AirLoopZoneNum) == 0) { ShowSevereError( state, format("AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass, \"{}\": Airloop air terminal in the zone equipment list for " "zone = {} not found or is not allowed Zone Equipment Cooling or Heating Sequence = 0.", - thisCBVAV.Name, + cbvav.Name, state.dataZoneEquip->ZoneEquipConfig(zoneNum).ZoneName)); ErrorsFound = true; } @@ -1169,140 +1126,140 @@ namespace HVACUnitaryBypassVAV { for (int CBVAVNum = 1; CBVAVNum <= NumCBVAV; ++CBVAVNum) { // Setup Report variables - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); SetupOutputVariable(state, "Unitary System Total Heating Rate", Constant::Units::W, - thisCBVAV.TotHeatEnergyRate, + cbvav.TotHeatEnergyRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Total Heating Energy", Constant::Units::J, - thisCBVAV.TotHeatEnergy, + cbvav.TotHeatEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Total Cooling Rate", Constant::Units::W, - thisCBVAV.TotCoolEnergyRate, + cbvav.TotCoolEnergyRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Total Cooling Energy", Constant::Units::J, - thisCBVAV.TotCoolEnergy, + cbvav.TotCoolEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Sensible Heating Rate", Constant::Units::W, - thisCBVAV.SensHeatEnergyRate, + cbvav.SensHeatEnergyRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Sensible Heating Energy", Constant::Units::J, - thisCBVAV.SensHeatEnergy, + cbvav.SensHeatEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Sensible Cooling Rate", Constant::Units::W, - thisCBVAV.SensCoolEnergyRate, + cbvav.SensCoolEnergyRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Sensible Cooling Energy", Constant::Units::J, - thisCBVAV.SensCoolEnergy, + cbvav.SensCoolEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Latent Heating Rate", Constant::Units::W, - thisCBVAV.LatHeatEnergyRate, + cbvav.LatHeatEnergyRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Latent Heating Energy", Constant::Units::J, - thisCBVAV.LatHeatEnergy, + cbvav.LatHeatEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Latent Cooling Rate", Constant::Units::W, - thisCBVAV.LatCoolEnergyRate, + cbvav.LatCoolEnergyRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Latent Cooling Energy", Constant::Units::J, - thisCBVAV.LatCoolEnergy, + cbvav.LatCoolEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Electricity Rate", Constant::Units::W, - thisCBVAV.ElecPower, + cbvav.ElecPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Electricity Energy", Constant::Units::J, - thisCBVAV.ElecConsumption, + cbvav.ElecConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Fan Part Load Ratio", Constant::Units::None, - thisCBVAV.FanPartLoadRatio, + cbvav.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Compressor Part Load Ratio", Constant::Units::None, - thisCBVAV.CompPartLoadRatio, + cbvav.CompPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Bypass Air Mass Flow Rate", Constant::Units::kg_s, - thisCBVAV.BypassMassFlowRate, + cbvav.BypassMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Air Outlet Setpoint Temperature", Constant::Units::C, - thisCBVAV.OutletTempSetPoint, + cbvav.OutletTempSetPoint, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); SetupOutputVariable(state, "Unitary System Operating Mode Index", Constant::Units::None, - thisCBVAV.HeatCoolMode, + cbvav.HeatCoolMode, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisCBVAV.Name); + cbvav.Name); } } @@ -1340,12 +1297,11 @@ namespace HVACUnitaryBypassVAV { bool ErrorFlag; // local error flag returned from data mining Real64 mdot; // heating coil fluid mass flow rate, kg/s - auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); int NumCBVAV = state.dataHVACUnitaryBypassVAV->NumCBVAV; - int InNode = cBVAV.AirInNode; - int OutNode = cBVAV.AirOutNode; - // Do the one time initializations if (state.dataHVACUnitaryBypassVAV->MyOneTimeFlag) { @@ -1364,52 +1320,53 @@ namespace HVACUnitaryBypassVAV { } if (state.dataHVACUnitaryBypassVAV->MyPlantScanFlag(CBVAVNum) && allocated(state.dataPlnt->PlantLoop)) { - if ((cBVAV.HeatCoilType == HVAC::CoilType::HeatingWater) || (cBVAV.HeatCoilType == HVAC::CoilType::HeatingSteam)) { + if ((cbvav.heatCoilType == HVAC::CoilType::HeatingWater) || + (cbvav.heatCoilType == HVAC::CoilType::HeatingSteam)) { bool ErrorsFound = false; // Set to true if errors in input, fatal at end of routine - if (cBVAV.HeatCoilType == HVAC::CoilType::HeatingWater) { + if (cbvav.heatCoilType == HVAC::CoilType::HeatingWater) { ErrorFlag = false; PlantUtilities::ScanPlantLoopsForObject( - state, cBVAV.HeatCoilName, DataPlant::PlantEquipmentType::CoilWaterSimpleHeating, cBVAV.plantLoc, ErrorFlag, _, _, _, _, _); + state, cbvav.HeatCoilName, DataPlant::PlantEquipmentType::CoilWaterSimpleHeating, cbvav.HeatCoilPlantLoc, ErrorFlag, _, _, _, _, _); if (ErrorFlag) { ShowFatalError(state, "InitCBVAV: Program terminated for previous conditions."); } - cBVAV.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", cBVAV.HeatCoilName, ErrorsFound); + cbvav.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", cbvav.HeatCoilName, ErrorsFound); - if (cBVAV.MaxHeatCoilFluidFlow > 0.0) { + if (cbvav.MaxHeatCoilFluidFlow > 0.0) { Real64 FluidDensity = - state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - cBVAV.MaxHeatCoilFluidFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", cBVAV.HeatCoilName, ErrorsFound) * FluidDensity; + state.dataPlnt->PlantLoop(cbvav.HeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + cbvav.MaxHeatCoilFluidFlow = + WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", cbvav.HeatCoilName, ErrorsFound) * FluidDensity; } - } else if (cBVAV.HeatCoilType == HVAC::CoilType::HeatingSteam) { + } else if (cbvav.heatCoilType == HVAC::CoilType::HeatingSteam) { ErrorFlag = false; PlantUtilities::ScanPlantLoopsForObject( - state, cBVAV.HeatCoilName, DataPlant::PlantEquipmentType::CoilSteamAirHeating, cBVAV.plantLoc, ErrorFlag, _, _, _, _, _); + state, cbvav.HeatCoilName, DataPlant::PlantEquipmentType::CoilSteamAirHeating, cbvav.HeatCoilPlantLoc, ErrorFlag, _, _, _, _, _); if (ErrorFlag) { ShowFatalError(state, "InitCBVAV: Program terminated for previous conditions."); } - cBVAV.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, cBVAV.HeatCoilIndex, ErrorsFound); + cbvav.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, cbvav.HeatCoilNum); - if (cBVAV.MaxHeatCoilFluidFlow > 0.0) { + if (cbvav.MaxHeatCoilFluidFlow > 0.0) { // Why is TempSteamIn a state variable of the entire module? Real64 FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, RoutineName); - cBVAV.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, cBVAV.HeatCoilIndex, ErrorsFound) * FluidDensity; + cbvav.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, cbvav.HeatCoilNum) * FluidDensity; } } if (ErrorsFound) { - ShowContinueError(state, format("Occurs in {} = {}", "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass", cBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass", cbvav.Name)); } // fill outlet node for heating coil - cBVAV.CoilOutletNode = DataPlant::CompData::getPlantComponent(state, cBVAV.plantLoc).NodeNumOut; + cbvav.HeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, cbvav.HeatCoilPlantLoc).NodeNumOut; state.dataHVACUnitaryBypassVAV->MyPlantScanFlag(CBVAVNum) = false; } else { // CBVAV is not connected to plant @@ -1422,13 +1379,13 @@ namespace HVACUnitaryBypassVAV { if (!state.dataGlobal->SysSizingCalc && state.dataHVACUnitaryBypassVAV->MySizeFlag(CBVAVNum)) { SizeCBVAV(state, CBVAVNum); // Pass the fan cycling schedule index up to the air loop. Set the air loop unitary system flag. - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = cBVAV.FanOpModeSchedPtr; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = cbvav.FanOpModeSchedPtr; // Set UnitarySys flag to FALSE and let the heating coil autosize independently of the cooling coil state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySys = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = cBVAV.fanOp; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = cbvav.fanOp; // check for set point manager on outlet node of CBVAV - cBVAV.OutNodeSPMIndex = SetPointManager::GetSetPointManagerIndexByNode(state, - OutNode, + cbvav.OutNodeSPMIndex = SetPointManager::GetSetPointManagerIndexByNode(state, + cbvav.AirOutNode, HVAC::CtrlVarType::Temp, SetPointManager::SPMType::MixedAir, true); // isRefNode @@ -1437,69 +1394,62 @@ namespace HVACUnitaryBypassVAV { // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataHVACUnitaryBypassVAV->MyEnvrnFlag(CBVAVNum)) { - int MixerOutsideAirNode = cBVAV.MixerOutsideAirNode; Real64 RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the input volume flow rates - cBVAV.MaxCoolAirMassFlow = RhoAir * cBVAV.MaxCoolAirVolFlow; - cBVAV.CoolOutAirMassFlow = RhoAir * cBVAV.CoolOutAirVolFlow; - cBVAV.MaxHeatAirMassFlow = RhoAir * cBVAV.MaxHeatAirVolFlow; - cBVAV.HeatOutAirMassFlow = RhoAir * cBVAV.HeatOutAirVolFlow; - cBVAV.MaxNoCoolHeatAirMassFlow = RhoAir * cBVAV.MaxNoCoolHeatAirVolFlow; - cBVAV.NoCoolHeatOutAirMassFlow = RhoAir * cBVAV.NoCoolHeatOutAirVolFlow; + cbvav.MaxCoolAirMassFlow = RhoAir * cbvav.MaxCoolAirVolFlow; + cbvav.CoolOutAirMassFlow = RhoAir * cbvav.CoolOutAirVolFlow; + cbvav.MaxHeatAirMassFlow = RhoAir * cbvav.MaxHeatAirVolFlow; + cbvav.HeatOutAirMassFlow = RhoAir * cbvav.HeatOutAirVolFlow; + cbvav.MaxNoCoolHeatAirMassFlow = RhoAir * cbvav.MaxNoCoolHeatAirVolFlow; + cbvav.NoCoolHeatOutAirMassFlow = RhoAir * cbvav.NoCoolHeatOutAirVolFlow; // set the node max and min mass flow rates - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMax = max(cBVAV.CoolOutAirMassFlow, cBVAV.HeatOutAirMassFlow); - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMaxAvail = max(cBVAV.CoolOutAirMassFlow, cBVAV.HeatOutAirMassFlow); - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMin = 0.0; - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMinAvail = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMax = max(cBVAV.MaxCoolAirMassFlow, cBVAV.MaxHeatAirMassFlow); - state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = max(cBVAV.MaxCoolAirMassFlow, cBVAV.MaxHeatAirMassFlow); - state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0; - state.dataLoopNodes->Node(OutNode).Temp = state.dataLoopNodes->Node(InNode).Temp; - state.dataLoopNodes->Node(OutNode).HumRat = state.dataLoopNodes->Node(InNode).HumRat; - state.dataLoopNodes->Node(OutNode).Enthalpy = state.dataLoopNodes->Node(InNode).Enthalpy; - state.dataLoopNodes->Node(cBVAV.MixerReliefAirNode) = state.dataLoopNodes->Node(MixerOutsideAirNode); + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMax = max(cbvav.CoolOutAirMassFlow, cbvav.HeatOutAirMassFlow); + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMaxAvail = max(cbvav.CoolOutAirMassFlow, cbvav.HeatOutAirMassFlow); + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMin = 0.0; + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMinAvail = 0.0; + s_node->Node(cbvav.AirInNode).MassFlowRateMax = max(cbvav.MaxCoolAirMassFlow, cbvav.MaxHeatAirMassFlow); + s_node->Node(cbvav.AirInNode).MassFlowRateMaxAvail = max(cbvav.MaxCoolAirMassFlow, cbvav.MaxHeatAirMassFlow); + s_node->Node(cbvav.AirInNode).MassFlowRateMin = 0.0; + s_node->Node(cbvav.AirInNode).MassFlowRateMinAvail = 0.0; + s_node->Node(cbvav.AirOutNode).Temp = s_node->Node(cbvav.AirInNode).Temp; + s_node->Node(cbvav.AirOutNode).HumRat = s_node->Node(cbvav.AirInNode).HumRat; + s_node->Node(cbvav.AirOutNode).Enthalpy = s_node->Node(cbvav.AirInNode).Enthalpy; + s_node->Node(cbvav.MixerReliefAirNode) = s_node->Node(cbvav.MixerOutsideAirNode); state.dataHVACUnitaryBypassVAV->MyEnvrnFlag(CBVAVNum) = false; - cBVAV.LastMode = HeatingMode; - cBVAV.changeOverTimer = -1.0; + cbvav.LastMode = HeatingMode; + cbvav.changeOverTimer = -1.0; // set fluid-side hardware limits - if (cBVAV.CoilControlNode > 0) { + if (cbvav.HeatCoilControlNode > 0) { // If water coil max water flow rate is autosized, simulate once in order to mine max water flow rate - if (cBVAV.MaxHeatCoilFluidFlow == DataSizing::AutoSize) { - if (cBVAV.HeatCoilType == HVAC::CoilType::HeatingWater) { - WaterCoils::SimulateWaterCoilComponents(state, cBVAV.HeatCoilName, FirstHVACIteration, cBVAV.HeatCoilIndex); - ErrorFlag = false; - Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", cBVAV.HeatCoilName, ErrorFlag); - if (ErrorFlag) { - ShowContinueError(state, format("Occurs in {} = {}", "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass", cBVAV.Name)); - } + if (cbvav.MaxHeatCoilFluidFlow == DataSizing::AutoSize) { + if (cbvav.heatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SimulateWaterCoilComponents(state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum); + Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, cbvav.HeatCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { Real64 FluidDensity = - state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - cBVAV.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; + state.dataPlnt->PlantLoop(cbvav.HeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + cbvav.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; } - } - if (cBVAV.HeatCoilType == HVAC::CoilType::HeatingSteam) { + + } else if (cbvav.heatCoilType == HVAC::CoilType::HeatingSteam) { SteamCoils::SimulateSteamCoilComponents(state, - cBVAV.HeatCoilName, + cbvav.HeatCoilName, FirstHVACIteration, - cBVAV.HeatCoilIndex, + cbvav.HeatCoilNum, 1.0, QCoilActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil ErrorFlag = false; - Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, cBVAV.HeatCoilIndex, ErrorFlag); + Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, cbvav.HeatCoilNum); if (ErrorFlag) { - ShowContinueError(state, format("Occurs in {} = {}", "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass", cBVAV.Name)); + ShowContinueError(state, format("Occurs in {} = {}", "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass", cbvav.Name)); } if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 FluidDensity = - Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, RoutineName); - cBVAV.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; + cbvav.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } } } // end of IF(cBVAV%MaxHeatCoilFluidFlow .EQ. DataSizing::AutoSize)THEN - PlantUtilities::InitComponentNodes(state, 0.0, cBVAV.MaxHeatCoilFluidFlow, cBVAV.CoilControlNode, cBVAV.CoilOutletNode); + PlantUtilities::InitComponentNodes(state, 0.0, cbvav.MaxHeatCoilFluidFlow, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode); } // end of IF(cBVAV%CoilControlNode .GT. 0)THEN } // end one time inits @@ -1509,187 +1459,187 @@ namespace HVACUnitaryBypassVAV { } // IF CBVAV system was not autosized and the fan is autosized, check that fan volumetric flow rate is greater than CBVAV flow rates - if (cBVAV.CheckFanFlow) { + if (cbvav.CheckFanFlow) { - if (!state.dataGlobal->DoingSizing && cBVAV.FanVolFlow != DataSizing::AutoSize) { + if (!state.dataGlobal->DoingSizing && cbvav.FanVolFlow != DataSizing::AutoSize) { std::string CurrentModuleObject = "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass"; // Check fan versus system supply air flow rates - if (cBVAV.FanVolFlow < cBVAV.MaxCoolAirVolFlow) { + if (cbvav.FanVolFlow < cbvav.MaxCoolAirVolFlow) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the maximum CBVAV system air flow rate when " "cooling is required ({:.7T}).", CurrentModuleObject, - cBVAV.FanVolFlow, - cBVAV.FanName, - cBVAV.MaxCoolAirVolFlow)); + cbvav.FanVolFlow, + cbvav.FanName, + cbvav.MaxCoolAirVolFlow)); ShowContinueError( state, " The CBVAV system flow rate when cooling is required is reset to the fan flow rate and the simulation continues."); - ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cBVAV.Name)); - cBVAV.MaxCoolAirVolFlow = cBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cbvav.Name)); + cbvav.MaxCoolAirVolFlow = cbvav.FanVolFlow; } - if (cBVAV.FanVolFlow < cBVAV.MaxHeatAirVolFlow) { + if (cbvav.FanVolFlow < cbvav.MaxHeatAirVolFlow) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the maximum CBVAV system air flow rate when " "heating is required ({:.7T}).", CurrentModuleObject, - cBVAV.FanVolFlow, - cBVAV.FanName, - cBVAV.MaxHeatAirVolFlow)); + cbvav.FanVolFlow, + cbvav.FanName, + cbvav.MaxHeatAirVolFlow)); ShowContinueError( state, " The CBVAV system flow rate when heating is required is reset to the fan flow rate and the simulation continues."); - ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cBVAV.Name)); - cBVAV.MaxHeatAirVolFlow = cBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cbvav.Name)); + cbvav.MaxHeatAirVolFlow = cbvav.FanVolFlow; } - if (cBVAV.FanVolFlow < cBVAV.MaxNoCoolHeatAirVolFlow && cBVAV.MaxNoCoolHeatAirVolFlow != 0.0) { + if (cbvav.FanVolFlow < cbvav.MaxNoCoolHeatAirVolFlow && cbvav.MaxNoCoolHeatAirVolFlow != 0.0) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the maximum CBVAV system air flow rate when " "no heating or cooling is needed ({:.7T}).", CurrentModuleObject, - cBVAV.FanVolFlow, - cBVAV.FanName, - cBVAV.MaxNoCoolHeatAirVolFlow)); + cbvav.FanVolFlow, + cbvav.FanName, + cbvav.MaxNoCoolHeatAirVolFlow)); ShowContinueError(state, " The CBVAV system flow rate when no heating or cooling is needed is reset to the fan flow rate and the " "simulation continues."); - ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cBVAV.Name)); - cBVAV.MaxNoCoolHeatAirVolFlow = cBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cbvav.Name)); + cbvav.MaxNoCoolHeatAirVolFlow = cbvav.FanVolFlow; } // Check fan versus outdoor air flow rates - if (cBVAV.FanVolFlow < cBVAV.CoolOutAirVolFlow) { + if (cbvav.FanVolFlow < cbvav.CoolOutAirVolFlow) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the maximum CBVAV outdoor air flow rate when " "cooling is required ({:.7T}).", CurrentModuleObject, - cBVAV.FanVolFlow, - cBVAV.FanName, - cBVAV.CoolOutAirVolFlow)); + cbvav.FanVolFlow, + cbvav.FanName, + cbvav.CoolOutAirVolFlow)); ShowContinueError( state, " The CBVAV outdoor flow rate when cooling is required is reset to the fan flow rate and the simulation continues."); - ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cBVAV.Name)); - cBVAV.CoolOutAirVolFlow = cBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cbvav.Name)); + cbvav.CoolOutAirVolFlow = cbvav.FanVolFlow; } - if (cBVAV.FanVolFlow < cBVAV.HeatOutAirVolFlow) { + if (cbvav.FanVolFlow < cbvav.HeatOutAirVolFlow) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the maximum CBVAV outdoor air flow rate when " "heating is required ({:.7T}).", CurrentModuleObject, - cBVAV.FanVolFlow, - cBVAV.FanName, - cBVAV.HeatOutAirVolFlow)); + cbvav.FanVolFlow, + cbvav.FanName, + cbvav.HeatOutAirVolFlow)); ShowContinueError( state, " The CBVAV outdoor flow rate when heating is required is reset to the fan flow rate and the simulation continues."); - ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cBVAV.Name)); - cBVAV.HeatOutAirVolFlow = cBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cbvav.Name)); + cbvav.HeatOutAirVolFlow = cbvav.FanVolFlow; } - if (cBVAV.FanVolFlow < cBVAV.NoCoolHeatOutAirVolFlow) { + if (cbvav.FanVolFlow < cbvav.NoCoolHeatOutAirVolFlow) { ShowWarningError(state, format("{} - air flow rate = {:.7T} in fan object {} is less than the maximum CBVAV outdoor air flow rate when " "no heating or cooling is needed ({:.7T}).", CurrentModuleObject, - cBVAV.FanVolFlow, - cBVAV.FanName, - cBVAV.NoCoolHeatOutAirVolFlow)); + cbvav.FanVolFlow, + cbvav.FanName, + cbvav.NoCoolHeatOutAirVolFlow)); ShowContinueError(state, " The CBVAV outdoor flow rate when no heating or cooling is needed is reset to the fan flow rate and the " "simulation continues."); - ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cBVAV.Name)); - cBVAV.NoCoolHeatOutAirVolFlow = cBVAV.FanVolFlow; + ShowContinueError(state, format(" Occurs in Changeover-bypass VAV system = {}", cbvav.Name)); + cbvav.NoCoolHeatOutAirVolFlow = cbvav.FanVolFlow; } - int MixerOutsideAirNode = cBVAV.MixerOutsideAirNode; + Real64 RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the reset volume flow rates - cBVAV.MaxCoolAirMassFlow = RhoAir * cBVAV.MaxCoolAirVolFlow; - cBVAV.CoolOutAirMassFlow = RhoAir * cBVAV.CoolOutAirVolFlow; - cBVAV.MaxHeatAirMassFlow = RhoAir * cBVAV.MaxHeatAirVolFlow; - cBVAV.HeatOutAirMassFlow = RhoAir * cBVAV.HeatOutAirVolFlow; - cBVAV.MaxNoCoolHeatAirMassFlow = RhoAir * cBVAV.MaxNoCoolHeatAirVolFlow; - cBVAV.NoCoolHeatOutAirMassFlow = RhoAir * cBVAV.NoCoolHeatOutAirVolFlow; + cbvav.MaxCoolAirMassFlow = RhoAir * cbvav.MaxCoolAirVolFlow; + cbvav.CoolOutAirMassFlow = RhoAir * cbvav.CoolOutAirVolFlow; + cbvav.MaxHeatAirMassFlow = RhoAir * cbvav.MaxHeatAirVolFlow; + cbvav.HeatOutAirMassFlow = RhoAir * cbvav.HeatOutAirVolFlow; + cbvav.MaxNoCoolHeatAirMassFlow = RhoAir * cbvav.MaxNoCoolHeatAirVolFlow; + cbvav.NoCoolHeatOutAirMassFlow = RhoAir * cbvav.NoCoolHeatOutAirVolFlow; // set the node max and min mass flow rates based on reset volume flow rates - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMax = max(cBVAV.CoolOutAirMassFlow, cBVAV.HeatOutAirMassFlow); - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMaxAvail = max(cBVAV.CoolOutAirMassFlow, cBVAV.HeatOutAirMassFlow); - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMin = 0.0; - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRateMinAvail = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMax = max(cBVAV.MaxCoolAirMassFlow, cBVAV.MaxHeatAirMassFlow); - state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = max(cBVAV.MaxCoolAirMassFlow, cBVAV.MaxHeatAirMassFlow); - state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0; - state.dataLoopNodes->Node(OutNode).Temp = state.dataLoopNodes->Node(InNode).Temp; - state.dataLoopNodes->Node(OutNode).HumRat = state.dataLoopNodes->Node(InNode).HumRat; - state.dataLoopNodes->Node(OutNode).Enthalpy = state.dataLoopNodes->Node(InNode).Enthalpy; - state.dataLoopNodes->Node(cBVAV.MixerReliefAirNode) = state.dataLoopNodes->Node(MixerOutsideAirNode); - cBVAV.CheckFanFlow = false; - if (cBVAV.FanVolFlow > 0.0) { - cBVAV.HeatingSpeedRatio = cBVAV.MaxHeatAirVolFlow / cBVAV.FanVolFlow; - cBVAV.CoolingSpeedRatio = cBVAV.MaxCoolAirVolFlow / cBVAV.FanVolFlow; - cBVAV.NoHeatCoolSpeedRatio = cBVAV.MaxNoCoolHeatAirVolFlow / cBVAV.FanVolFlow; + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMax = max(cbvav.CoolOutAirMassFlow, cbvav.HeatOutAirMassFlow); + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMaxAvail = max(cbvav.CoolOutAirMassFlow, cbvav.HeatOutAirMassFlow); + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMin = 0.0; + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRateMinAvail = 0.0; + s_node->Node(cbvav.AirInNode).MassFlowRateMax = max(cbvav.MaxCoolAirMassFlow, cbvav.MaxHeatAirMassFlow); + s_node->Node(cbvav.AirInNode).MassFlowRateMaxAvail = max(cbvav.MaxCoolAirMassFlow, cbvav.MaxHeatAirMassFlow); + s_node->Node(cbvav.AirInNode).MassFlowRateMin = 0.0; + s_node->Node(cbvav.AirInNode).MassFlowRateMinAvail = 0.0; + s_node->Node(cbvav.AirOutNode).Temp = s_node->Node(cbvav.AirInNode).Temp; + s_node->Node(cbvav.AirOutNode).HumRat = s_node->Node(cbvav.AirInNode).HumRat; + s_node->Node(cbvav.AirOutNode).Enthalpy = s_node->Node(cbvav.AirInNode).Enthalpy; + s_node->Node(cbvav.MixerReliefAirNode) = s_node->Node(cbvav.MixerOutsideAirNode); + cbvav.CheckFanFlow = false; + if (cbvav.FanVolFlow > 0.0) { + cbvav.HeatingSpeedRatio = cbvav.MaxHeatAirVolFlow / cbvav.FanVolFlow; + cbvav.CoolingSpeedRatio = cbvav.MaxCoolAirVolFlow / cbvav.FanVolFlow; + cbvav.NoHeatCoolSpeedRatio = cbvav.MaxNoCoolHeatAirVolFlow / cbvav.FanVolFlow; } } } - if (cBVAV.FanOpModeSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.FanOpModeSchedPtr) == 0.0) { - cBVAV.fanOp = HVAC::FanOp::Cycling; + if (cbvav.FanOpModeSchedPtr > 0) { + if (ScheduleManager::GetCurrentScheduleValue(state, cbvav.FanOpModeSchedPtr) == 0.0) { + cbvav.fanOp = HVAC::FanOp::Cycling; } else { - cBVAV.fanOp = HVAC::FanOp::Continuous; + cbvav.fanOp = HVAC::FanOp::Continuous; } } // Returns load only for zones requesting cooling (heating). If in deadband, Qzoneload = 0. - if (FirstHVACIteration) cBVAV.modeChanged = false; + if (FirstHVACIteration) cbvav.modeChanged = false; GetZoneLoads(state, CBVAVNum); - if (cBVAV.OutAirSchPtr > 0) { - OutsideAirMultiplier = ScheduleManager::GetCurrentScheduleValue(state, cBVAV.OutAirSchPtr); + if (cbvav.OutAirSchPtr > 0) { + OutsideAirMultiplier = ScheduleManager::GetCurrentScheduleValue(state, cbvav.OutAirSchPtr); } else { OutsideAirMultiplier = 1.0; } // Set the inlet node mass flow rate - if (cBVAV.fanOp == HVAC::FanOp::Continuous) { + if (cbvav.fanOp == HVAC::FanOp::Continuous) { // constant fan mode - if (cBVAV.HeatCoolMode == HeatingMode) { - state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cBVAV.MaxHeatAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cBVAV.HeatingSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cBVAV.HeatOutAirMassFlow * OutsideAirMultiplier; - } else if (cBVAV.HeatCoolMode == CoolingMode) { - state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cBVAV.MaxCoolAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cBVAV.CoolingSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cBVAV.CoolOutAirMassFlow * OutsideAirMultiplier; + if (cbvav.HeatCoolMode == HeatingMode) { + state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cbvav.MaxHeatAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cbvav.HeatingSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cbvav.HeatOutAirMassFlow * OutsideAirMultiplier; + } else if (cbvav.HeatCoolMode == CoolingMode) { + state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cbvav.MaxCoolAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cbvav.CoolingSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cbvav.CoolOutAirMassFlow * OutsideAirMultiplier; } else { - state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cBVAV.MaxNoCoolHeatAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cBVAV.NoHeatCoolSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cBVAV.NoCoolHeatOutAirMassFlow * OutsideAirMultiplier; + state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cbvav.MaxNoCoolHeatAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cbvav.NoHeatCoolSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cbvav.NoCoolHeatOutAirMassFlow * OutsideAirMultiplier; } - if (cBVAV.AirFlowControl == AirFlowCtrlMode::UseCompressorOnFlow) { - if (cBVAV.LastMode == HeatingMode) { - state.dataHVACUnitaryBypassVAV->CompOffMassFlow = cBVAV.MaxHeatAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOffFlowRatio = cBVAV.HeatingSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOffMassFlow = cBVAV.HeatOutAirMassFlow * OutsideAirMultiplier; + if (cbvav.AirFlowControl == AirFlowCtrlMode::UseCompressorOnFlow) { + if (cbvav.LastMode == HeatingMode) { + state.dataHVACUnitaryBypassVAV->CompOffMassFlow = cbvav.MaxHeatAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOffFlowRatio = cbvav.HeatingSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOffMassFlow = cbvav.HeatOutAirMassFlow * OutsideAirMultiplier; } else { - state.dataHVACUnitaryBypassVAV->CompOffMassFlow = cBVAV.MaxCoolAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOffFlowRatio = cBVAV.CoolingSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOffMassFlow = cBVAV.CoolOutAirMassFlow * OutsideAirMultiplier; + state.dataHVACUnitaryBypassVAV->CompOffMassFlow = cbvav.MaxCoolAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOffFlowRatio = cbvav.CoolingSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOffMassFlow = cbvav.CoolOutAirMassFlow * OutsideAirMultiplier; } } else { - state.dataHVACUnitaryBypassVAV->CompOffMassFlow = cBVAV.MaxNoCoolHeatAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOffFlowRatio = cBVAV.NoHeatCoolSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOffMassFlow = cBVAV.NoCoolHeatOutAirMassFlow * OutsideAirMultiplier; + state.dataHVACUnitaryBypassVAV->CompOffMassFlow = cbvav.MaxNoCoolHeatAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOffFlowRatio = cbvav.NoHeatCoolSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOffMassFlow = cbvav.NoCoolHeatOutAirMassFlow * OutsideAirMultiplier; } } else { // cycling fan mode - if (cBVAV.HeatCoolMode == HeatingMode) { - state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cBVAV.MaxHeatAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cBVAV.HeatingSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cBVAV.HeatOutAirMassFlow * OutsideAirMultiplier; - } else if (cBVAV.HeatCoolMode == CoolingMode) { - state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cBVAV.MaxCoolAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cBVAV.CoolingSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cBVAV.CoolOutAirMassFlow * OutsideAirMultiplier; + if (cbvav.HeatCoolMode == HeatingMode) { + state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cbvav.MaxHeatAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cbvav.HeatingSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cbvav.HeatOutAirMassFlow * OutsideAirMultiplier; + } else if (cbvav.HeatCoolMode == CoolingMode) { + state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cbvav.MaxCoolAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cbvav.CoolingSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cbvav.CoolOutAirMassFlow * OutsideAirMultiplier; } else { - state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cBVAV.MaxCoolAirMassFlow; - state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cBVAV.CoolingSpeedRatio; - state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cBVAV.CoolOutAirMassFlow * OutsideAirMultiplier; + state.dataHVACUnitaryBypassVAV->CompOnMassFlow = cbvav.MaxCoolAirMassFlow; + state.dataHVACUnitaryBypassVAV->CompOnFlowRatio = cbvav.CoolingSpeedRatio; + state.dataHVACUnitaryBypassVAV->OACompOnMassFlow = cbvav.CoolOutAirMassFlow * OutsideAirMultiplier; } state.dataHVACUnitaryBypassVAV->CompOffMassFlow = 0.0; state.dataHVACUnitaryBypassVAV->CompOffFlowRatio = 0.0; @@ -1697,74 +1647,74 @@ namespace HVACUnitaryBypassVAV { } // Check for correct control node at outlet of unit - if (cBVAV.HumRatMaxCheck) { - if (cBVAV.DehumidControlType != DehumidControl::None) { - if (state.dataLoopNodes->Node(OutNode).HumRatMax == DataLoopNode::SensedNodeFlagValue) { + if (cbvav.HumRatMaxCheck) { + if (cbvav.DehumidControlType != DehumidControl::None) { + if (s_node->Node(cbvav.AirOutNode).HumRatMax == DataLoopNode::SensedNodeFlagValue) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { - ShowWarningError(state, format("Unitary System:VAV:ChangeOverBypass = {}", cBVAV.Name)); + ShowWarningError(state, format("Unitary System:VAV:ChangeOverBypass = {}", cbvav.Name)); ShowContinueError(state, "Use SetpointManager:SingleZone:Humidity:Maximum to place a humidity setpoint at the air outlet node of " "the unitary system."); ShowContinueError(state, "Setting Dehumidification Control Type to None and simulation continues."); - cBVAV.DehumidControlType = DehumidControl::None; + cbvav.DehumidControlType = DehumidControl::None; } else { // need call to EMS to check node bool EMSSetPointCheck = false; - EMSManager::CheckIfNodeSetPointManagedByEMS(state, OutNode, HVAC::CtrlVarType::MaxHumRat, EMSSetPointCheck); - state.dataLoopNodes->NodeSetpointCheck(OutNode).needsSetpointChecking = false; + EMSManager::CheckIfNodeSetPointManagedByEMS(state, cbvav.AirOutNode, HVAC::CtrlVarType::MaxHumRat, EMSSetPointCheck); + s_node->NodeSetpointCheck(cbvav.AirOutNode).needsSetpointChecking = false; if (EMSSetPointCheck) { // There is no plugin anyways, so we now we have a bad condition. - ShowWarningError(state, format("Unitary System:VAV:ChangeOverBypass = {}", cBVAV.Name)); + ShowWarningError(state, format("Unitary System:VAV:ChangeOverBypass = {}", cbvav.Name)); ShowContinueError(state, "Use SetpointManager:SingleZone:Humidity:Maximum to place a humidity setpoint at the air outlet node " "of the unitary system."); ShowContinueError( state, "Or use an EMS Actuator to place a maximum humidity setpoint at the air outlet node of the unitary system."); ShowContinueError(state, "Setting Dehumidification Control Type to None and simulation continues."); - cBVAV.DehumidControlType = DehumidControl::None; + cbvav.DehumidControlType = DehumidControl::None; } } } - cBVAV.HumRatMaxCheck = false; + cbvav.HumRatMaxCheck = false; } else { - cBVAV.HumRatMaxCheck = false; + cbvav.HumRatMaxCheck = false; } } // Set the inlet node mass flow rate - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) > 0.0 && state.dataHVACUnitaryBypassVAV->CompOnMassFlow != 0.0) { + if (ScheduleManager::GetCurrentScheduleValue(state, cbvav.SchedPtr) > 0.0 && state.dataHVACUnitaryBypassVAV->CompOnMassFlow != 0.0) { OnOffAirFlowRatio = 1.0; if (FirstHVACIteration) { - state.dataLoopNodes->Node(cBVAV.AirInNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; - state.dataLoopNodes->Node(cBVAV.MixerOutsideAirNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->OACompOnMassFlow; - state.dataLoopNodes->Node(cBVAV.MixerReliefAirNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->OACompOnMassFlow; + s_node->Node(cbvav.AirInNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; + s_node->Node(cbvav.MixerInletAirNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->OACompOnMassFlow; + s_node->Node(cbvav.MixerReliefAirNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->OACompOnMassFlow; state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction = 0.0; state.dataHVACUnitaryBypassVAV->PartLoadFrac = 0.0; } else { - if (cBVAV.HeatCoolMode != 0) { + if (cbvav.HeatCoolMode != 0) { state.dataHVACUnitaryBypassVAV->PartLoadFrac = 1.0; } else { state.dataHVACUnitaryBypassVAV->PartLoadFrac = 0.0; } - if (cBVAV.fanOp == HVAC::FanOp::Cycling) { + if (cbvav.fanOp == HVAC::FanOp::Cycling) { state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction = 0.0; } else { - if (cBVAV.PlenumMixerInletAirNode == 0) { + if (cbvav.PlenumMixerInletAirNode == 0) { state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction = max( - 0.0, 1.0 - (state.dataLoopNodes->Node(cBVAV.AirInNode).MassFlowRate / state.dataHVACUnitaryBypassVAV->CompOnMassFlow)); + 0.0, 1.0 - (s_node->Node(cbvav.AirInNode).MassFlowRate / state.dataHVACUnitaryBypassVAV->CompOnMassFlow)); } } } } else { state.dataHVACUnitaryBypassVAV->PartLoadFrac = 0.0; - state.dataLoopNodes->Node(cBVAV.AirInNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(cBVAV.AirOutNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(cBVAV.AirOutNode).MassFlowRateMaxAvail = 0.0; + s_node->Node(cbvav.AirInNode).MassFlowRate = 0.0; + s_node->Node(cbvav.AirOutNode).MassFlowRate = 0.0; + s_node->Node(cbvav.AirOutNode).MassFlowRateMaxAvail = 0.0; - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(cBVAV.MixerOutsideAirNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(cBVAV.MixerReliefAirNode).MassFlowRate = 0.0; + s_node->Node(cbvav.MixerInletAirNode).MassFlowRate = 0.0; + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRate = 0.0; + s_node->Node(cbvav.MixerReliefAirNode).MassFlowRate = 0.0; OnOffAirFlowRatio = 1.0; state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction = 0.0; @@ -1773,63 +1723,61 @@ namespace HVACUnitaryBypassVAV { CalcCBVAV(state, CBVAVNum, FirstHVACIteration, state.dataHVACUnitaryBypassVAV->PartLoadFrac, QSensUnitOut, OnOffAirFlowRatio, HXUnitOn); // If unit is scheduled OFF, setpoint is equal to inlet node temperature. - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) == 0.0) { - cBVAV.OutletTempSetPoint = state.dataLoopNodes->Node(InNode).Temp; + if (ScheduleManager::GetCurrentScheduleValue(state, cbvav.SchedPtr) == 0.0) { + cbvav.OutletTempSetPoint = s_node->Node(cbvav.AirInNode).Temp; return; } SetAverageAirFlow(state, CBVAVNum, OnOffAirFlowRatio); - if (FirstHVACIteration) cBVAV.OutletTempSetPoint = CalcSetPointTempTarget(state, CBVAVNum); + if (FirstHVACIteration) cbvav.OutletTempSetPoint = CalcSetPointTempTarget(state, CBVAVNum); // The setpoint is used to control the DX coils at their respective outlet nodes (not the unit outlet), correct // for fan heat for draw thru units only (fan heat is included at the outlet of each coil when blowthru is used) - cBVAV.CoilTempSetPoint = cBVAV.OutletTempSetPoint; - if (cBVAV.fanPlace == HVAC::FanPlace::DrawThru) { - cBVAV.CoilTempSetPoint -= (state.dataLoopNodes->Node(cBVAV.AirOutNode).Temp - state.dataLoopNodes->Node(cBVAV.FanInletNodeNum).Temp); + cbvav.CoilTempSetPoint = cbvav.OutletTempSetPoint; + if (cbvav.fanPlace == HVAC::FanPlace::DrawThru) { + cbvav.CoilTempSetPoint -= (s_node->Node(cbvav.AirOutNode).Temp - s_node->Node(cbvav.FanInletNodeNum).Temp); } if (FirstHVACIteration) { - if (cBVAV.HeatCoilType == HVAC::CoilType::HeatingWater) { - WaterCoils::SimulateWaterCoilComponents(state, cBVAV.HeatCoilName, FirstHVACIteration, cBVAV.HeatCoilIndex); + if (cbvav.heatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SimulateWaterCoilComponents(state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum); // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; - mdot = cBVAV.MaxHeatCoilFluidFlow; - PlantUtilities::SetComponentFlowRate(state, mdot, cBVAV.CoilControlNode, cBVAV.CoilOutletNode, cBVAV.plantLoc); + s_node->Node(cbvav.HeatCoilAirInletNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; + mdot = cbvav.MaxHeatCoilFluidFlow; + PlantUtilities::SetComponentFlowRate(state, mdot, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode, cbvav.HeatCoilPlantLoc); // simulate water coil to find operating capacity - WaterCoils::SimulateWaterCoilComponents(state, cBVAV.HeatCoilName, FirstHVACIteration, cBVAV.HeatCoilIndex, QCoilActual); - cBVAV.DesignSuppHeatingCapacity = QCoilActual; + WaterCoils::SimulateWaterCoilComponents(state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum, QCoilActual); + cbvav.DesignSuppHeatingCapacity = QCoilActual; - } // from IF(MSHeatPump(MSHeatPumpNum)%SuppHeatCoilType == HVAC::Coil_HeatingWater) THEN - - if (cBVAV.HeatCoilType == HVAC::CoilType::HeatingSteam) { + } else if (cbvav.heatCoilType == HVAC::CoilType::HeatingSteam) { // set air-side and steam-side mass flow rates - state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; - mdot = cBVAV.MaxHeatCoilFluidFlow; - PlantUtilities::SetComponentFlowRate(state, mdot, cBVAV.CoilControlNode, cBVAV.CoilOutletNode, cBVAV.plantLoc); + s_node->Node(cbvav.HeatCoilAirInletNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; + mdot = cbvav.MaxHeatCoilFluidFlow; + PlantUtilities::SetComponentFlowRate(state, mdot, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode, cbvav.HeatCoilPlantLoc); // simulate steam coil to find operating capacity SteamCoils::SimulateSteamCoilComponents(state, - cBVAV.HeatCoilName, + cbvav.HeatCoilName, FirstHVACIteration, - cBVAV.HeatCoilIndex, + cbvav.HeatCoilNum, 1.0, QCoilActual); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - cBVAV.DesignSuppHeatingCapacity = QCoilActual; + cbvav.DesignSuppHeatingCapacity = QCoilActual; } // from IF(cBVAV%HeatCoilType == HVAC::Coil_HeatingSteam) THEN } // from IF( FirstHVACIteration ) THEN - if ((cBVAV.HeatCoolMode == 0 && cBVAV.fanOp == HVAC::FanOp::Cycling) || state.dataHVACUnitaryBypassVAV->CompOnMassFlow == 0.0) { + if ((cbvav.HeatCoolMode == 0 && cbvav.fanOp == HVAC::FanOp::Cycling) || state.dataHVACUnitaryBypassVAV->CompOnMassFlow == 0.0) { state.dataHVACUnitaryBypassVAV->PartLoadFrac = 0.0; - state.dataLoopNodes->Node(cBVAV.AirInNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(cBVAV.AirOutNode).MassFlowRateMaxAvail = 0.0; - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(cBVAV.MixerOutsideAirNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(cBVAV.MixerReliefAirNode).MassFlowRate = 0.0; + s_node->Node(cbvav.AirInNode).MassFlowRate = 0.0; + s_node->Node(cbvav.AirOutNode).MassFlowRateMaxAvail = 0.0; + s_node->Node(cbvav.MixerInletAirNode).MassFlowRate = 0.0; + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRate = 0.0; + s_node->Node(cbvav.MixerReliefAirNode).MassFlowRate = 0.0; } } @@ -1849,67 +1797,67 @@ namespace HVACUnitaryBypassVAV { int curSysNum = state.dataSize->CurSysNum; int curOASysNum = state.dataSize->CurOASysNum; - auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); if (curSysNum > 0 && curOASysNum == 0) { - state.dataAirSystemsData->PrimaryAirSystems(curSysNum).supFanNum = cBVAV.FanIndex; - state.dataAirSystemsData->PrimaryAirSystems(curSysNum).supFanType = cBVAV.fanType; - state.dataAirSystemsData->PrimaryAirSystems(curSysNum).supFanPlace = cBVAV.fanPlace; + state.dataAirSystemsData->PrimaryAirSystems(curSysNum).supFanNum = cbvav.FanIndex; + state.dataAirSystemsData->PrimaryAirSystems(curSysNum).supFanType = cbvav.fanType; + state.dataAirSystemsData->PrimaryAirSystems(curSysNum).supFanPlace = cbvav.fanPlace; } - if (cBVAV.MaxCoolAirVolFlow == DataSizing::AutoSize) { + if (cbvav.MaxCoolAirVolFlow == DataSizing::AutoSize) { if (curSysNum > 0) { - CheckSysSizing(state, cBVAV.UnitType, cBVAV.Name); - cBVAV.MaxCoolAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesMainVolFlow; - if (cBVAV.FanVolFlow < cBVAV.MaxCoolAirVolFlow && cBVAV.FanVolFlow != DataSizing::AutoSize) { - cBVAV.MaxCoolAirVolFlow = cBVAV.FanVolFlow; - ShowWarningError(state, format("{} \"{}\"", cBVAV.UnitType, cBVAV.Name)); + CheckSysSizing(state, cbvav.UnitType, cbvav.Name); + cbvav.MaxCoolAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesMainVolFlow; + if (cbvav.FanVolFlow < cbvav.MaxCoolAirVolFlow && cbvav.FanVolFlow != DataSizing::AutoSize) { + cbvav.MaxCoolAirVolFlow = cbvav.FanVolFlow; + ShowWarningError(state, format("{} \"{}\"", cbvav.UnitType, cbvav.Name)); ShowContinueError(state, "The CBVAV system supply air fan air flow rate is less than the autosized value for the maximum air flow rate " "in cooling mode. Consider autosizing the fan for this simulation."); ShowContinueError( state, "The maximum air flow rate in cooling mode is reset to the supply air fan flow rate and the simulation continues."); } - if (cBVAV.MaxCoolAirVolFlow < HVAC::SmallAirVolFlow) { - cBVAV.MaxCoolAirVolFlow = 0.0; + if (cbvav.MaxCoolAirVolFlow < HVAC::SmallAirVolFlow) { + cbvav.MaxCoolAirVolFlow = 0.0; } - BaseSizer::reportSizerOutput(state, cBVAV.UnitType, cBVAV.Name, "maximum cooling air flow rate [m3/s]", cBVAV.MaxCoolAirVolFlow); + BaseSizer::reportSizerOutput(state, cbvav.UnitType, cbvav.Name, "maximum cooling air flow rate [m3/s]", cbvav.MaxCoolAirVolFlow); } } - if (cBVAV.MaxHeatAirVolFlow == DataSizing::AutoSize) { + if (cbvav.MaxHeatAirVolFlow == DataSizing::AutoSize) { if (curSysNum > 0) { - CheckSysSizing(state, cBVAV.UnitType, cBVAV.Name); - cBVAV.MaxHeatAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesMainVolFlow; - if (cBVAV.FanVolFlow < cBVAV.MaxHeatAirVolFlow && cBVAV.FanVolFlow != DataSizing::AutoSize) { - cBVAV.MaxHeatAirVolFlow = cBVAV.FanVolFlow; - ShowWarningError(state, format("{} \"{}\"", cBVAV.UnitType, cBVAV.Name)); + CheckSysSizing(state, cbvav.UnitType, cbvav.Name); + cbvav.MaxHeatAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesMainVolFlow; + if (cbvav.FanVolFlow < cbvav.MaxHeatAirVolFlow && cbvav.FanVolFlow != DataSizing::AutoSize) { + cbvav.MaxHeatAirVolFlow = cbvav.FanVolFlow; + ShowWarningError(state, format("{} \"{}\"", cbvav.UnitType, cbvav.Name)); ShowContinueError(state, "The CBVAV system supply air fan air flow rate is less than the autosized value for the maximum air flow rate " "in heating mode. Consider autosizing the fan for this simulation."); ShowContinueError( state, "The maximum air flow rate in heating mode is reset to the supply air fan flow rate and the simulation continues."); } - if (cBVAV.MaxHeatAirVolFlow < HVAC::SmallAirVolFlow) { - cBVAV.MaxHeatAirVolFlow = 0.0; + if (cbvav.MaxHeatAirVolFlow < HVAC::SmallAirVolFlow) { + cbvav.MaxHeatAirVolFlow = 0.0; } - BaseSizer::reportSizerOutput(state, cBVAV.UnitType, cBVAV.Name, "maximum heating air flow rate [m3/s]", cBVAV.MaxHeatAirVolFlow); + BaseSizer::reportSizerOutput(state, cbvav.UnitType, cbvav.Name, "maximum heating air flow rate [m3/s]", cbvav.MaxHeatAirVolFlow); } } - if (cBVAV.MaxNoCoolHeatAirVolFlow == DataSizing::AutoSize) { + if (cbvav.MaxNoCoolHeatAirVolFlow == DataSizing::AutoSize) { if (curSysNum > 0) { - CheckSysSizing(state, cBVAV.UnitType, cBVAV.Name); - cBVAV.MaxNoCoolHeatAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesMainVolFlow; - if (cBVAV.FanVolFlow < cBVAV.MaxNoCoolHeatAirVolFlow && cBVAV.FanVolFlow != DataSizing::AutoSize) { - cBVAV.MaxNoCoolHeatAirVolFlow = cBVAV.FanVolFlow; - ShowWarningError(state, format("{} \"{}\"", cBVAV.UnitType, cBVAV.Name)); + CheckSysSizing(state, cbvav.UnitType, cbvav.Name); + cbvav.MaxNoCoolHeatAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesMainVolFlow; + if (cbvav.FanVolFlow < cbvav.MaxNoCoolHeatAirVolFlow && cbvav.FanVolFlow != DataSizing::AutoSize) { + cbvav.MaxNoCoolHeatAirVolFlow = cbvav.FanVolFlow; + ShowWarningError(state, format("{} \"{}\"", cbvav.UnitType, cbvav.Name)); ShowContinueError(state, "The CBVAV system supply air fan air flow rate is less than the autosized value for the maximum air flow rate " "when no heating or cooling is needed. Consider autosizing the fan for this simulation."); @@ -1917,68 +1865,68 @@ namespace HVACUnitaryBypassVAV { "The maximum air flow rate when no heating or cooling is needed is reset to the supply air fan flow rate and " "the simulation continues."); } - if (cBVAV.MaxNoCoolHeatAirVolFlow < HVAC::SmallAirVolFlow) { - cBVAV.MaxNoCoolHeatAirVolFlow = 0.0; + if (cbvav.MaxNoCoolHeatAirVolFlow < HVAC::SmallAirVolFlow) { + cbvav.MaxNoCoolHeatAirVolFlow = 0.0; } BaseSizer::reportSizerOutput( - state, cBVAV.UnitType, cBVAV.Name, "maximum air flow rate when compressor/coil is off [m3/s]", cBVAV.MaxNoCoolHeatAirVolFlow); + state, cbvav.UnitType, cbvav.Name, "maximum air flow rate when compressor/coil is off [m3/s]", cbvav.MaxNoCoolHeatAirVolFlow); } } - if (cBVAV.CoolOutAirVolFlow == DataSizing::AutoSize) { + if (cbvav.CoolOutAirVolFlow == DataSizing::AutoSize) { if (curSysNum > 0) { - CheckSysSizing(state, cBVAV.UnitType, cBVAV.Name); - cBVAV.CoolOutAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesOutAirVolFlow; - if (cBVAV.FanVolFlow < cBVAV.CoolOutAirVolFlow && cBVAV.FanVolFlow != DataSizing::AutoSize) { - cBVAV.CoolOutAirVolFlow = cBVAV.FanVolFlow; - ShowWarningError(state, format("{} \"{}\"", cBVAV.UnitType, cBVAV.Name)); + CheckSysSizing(state, cbvav.UnitType, cbvav.Name); + cbvav.CoolOutAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesOutAirVolFlow; + if (cbvav.FanVolFlow < cbvav.CoolOutAirVolFlow && cbvav.FanVolFlow != DataSizing::AutoSize) { + cbvav.CoolOutAirVolFlow = cbvav.FanVolFlow; + ShowWarningError(state, format("{} \"{}\"", cbvav.UnitType, cbvav.Name)); ShowContinueError(state, "The CBVAV system supply air fan air flow rate is less than the autosized value for the outdoor air flow rate " "in cooling mode. Consider autosizing the fan for this simulation."); ShowContinueError( state, "The outdoor air flow rate in cooling mode is reset to the supply air fan flow rate and the simulation continues."); } - if (cBVAV.CoolOutAirVolFlow < HVAC::SmallAirVolFlow) { - cBVAV.CoolOutAirVolFlow = 0.0; + if (cbvav.CoolOutAirVolFlow < HVAC::SmallAirVolFlow) { + cbvav.CoolOutAirVolFlow = 0.0; } BaseSizer::reportSizerOutput( - state, cBVAV.UnitType, cBVAV.Name, "maximum outside air flow rate in cooling [m3/s]", cBVAV.CoolOutAirVolFlow); + state, cbvav.UnitType, cbvav.Name, "maximum outside air flow rate in cooling [m3/s]", cbvav.CoolOutAirVolFlow); } } - if (cBVAV.HeatOutAirVolFlow == DataSizing::AutoSize) { + if (cbvav.HeatOutAirVolFlow == DataSizing::AutoSize) { if (curSysNum > 0) { - CheckSysSizing(state, cBVAV.UnitType, cBVAV.Name); - cBVAV.HeatOutAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesOutAirVolFlow; - if (cBVAV.FanVolFlow < cBVAV.HeatOutAirVolFlow && cBVAV.FanVolFlow != DataSizing::AutoSize) { - cBVAV.HeatOutAirVolFlow = cBVAV.FanVolFlow; + CheckSysSizing(state, cbvav.UnitType, cbvav.Name); + cbvav.HeatOutAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesOutAirVolFlow; + if (cbvav.FanVolFlow < cbvav.HeatOutAirVolFlow && cbvav.FanVolFlow != DataSizing::AutoSize) { + cbvav.HeatOutAirVolFlow = cbvav.FanVolFlow; ShowContinueError(state, "The CBVAV system supply air fan air flow rate is less than the autosized value for the outdoor air flow rate " "in heating mode. Consider autosizing the fan for this simulation."); ShowContinueError( state, "The outdoor air flow rate in heating mode is reset to the supply air fan flow rate and the simulation continues."); } - if (cBVAV.HeatOutAirVolFlow < HVAC::SmallAirVolFlow) { - cBVAV.HeatOutAirVolFlow = 0.0; + if (cbvav.HeatOutAirVolFlow < HVAC::SmallAirVolFlow) { + cbvav.HeatOutAirVolFlow = 0.0; } BaseSizer::reportSizerOutput( - state, cBVAV.UnitType, cBVAV.Name, "maximum outdoor air flow rate in heating [m3/s]", cBVAV.CoolOutAirVolFlow); + state, cbvav.UnitType, cbvav.Name, "maximum outdoor air flow rate in heating [m3/s]", cbvav.CoolOutAirVolFlow); } } - if (cBVAV.NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) { + if (cbvav.NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) { if (curSysNum > 0) { - CheckSysSizing(state, cBVAV.UnitType, cBVAV.Name); - cBVAV.NoCoolHeatOutAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesOutAirVolFlow; - if (cBVAV.FanVolFlow < cBVAV.NoCoolHeatOutAirVolFlow && cBVAV.FanVolFlow != DataSizing::AutoSize) { - cBVAV.NoCoolHeatOutAirVolFlow = cBVAV.FanVolFlow; + CheckSysSizing(state, cbvav.UnitType, cbvav.Name); + cbvav.NoCoolHeatOutAirVolFlow = state.dataSize->FinalSysSizing(curSysNum).DesOutAirVolFlow; + if (cbvav.FanVolFlow < cbvav.NoCoolHeatOutAirVolFlow && cbvav.FanVolFlow != DataSizing::AutoSize) { + cbvav.NoCoolHeatOutAirVolFlow = cbvav.FanVolFlow; ShowContinueError(state, "The CBVAV system supply air fan air flow rate is less than the autosized value for the outdoor air flow rate " "when no heating or cooling is needed. Consider autosizing the fan for this simulation."); @@ -1986,11 +1934,11 @@ namespace HVACUnitaryBypassVAV { "The outdoor air flow rate when no heating or cooling is needed is reset to the supply air fan flow rate and " "the simulation continues."); } - if (cBVAV.NoCoolHeatOutAirVolFlow < HVAC::SmallAirVolFlow) { - cBVAV.NoCoolHeatOutAirVolFlow = 0.0; + if (cbvav.NoCoolHeatOutAirVolFlow < HVAC::SmallAirVolFlow) { + cbvav.NoCoolHeatOutAirVolFlow = 0.0; } BaseSizer::reportSizerOutput( - state, cBVAV.UnitType, cBVAV.Name, "maximum outdoor air flow rate when compressor is off [m3/s]", cBVAV.NoCoolHeatOutAirVolFlow); + state, cbvav.UnitType, cbvav.Name, "maximum outdoor air flow rate when compressor is off [m3/s]", cbvav.NoCoolHeatOutAirVolFlow); } } } @@ -2018,15 +1966,16 @@ namespace HVACUnitaryBypassVAV { Real64 FullOutput = 0; // Unit full output when compressor is operating [W] PartLoadFrac = 0.0; - auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) == 0.0) return; + if (ScheduleManager::GetCurrentScheduleValue(state, cbvav.SchedPtr) == 0.0) return; // Get operating result PartLoadFrac = 1.0; CalcCBVAV(state, CBVAVNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); - if ((state.dataLoopNodes->Node(cBVAV.AirOutNode).Temp - cBVAV.OutletTempSetPoint) > HVAC::SmallTempDiff && cBVAV.HeatCoolMode > 0 && + if ((s_node->Node(cbvav.AirOutNode).Temp - cbvav.OutletTempSetPoint) > HVAC::SmallTempDiff && cbvav.HeatCoolMode > 0 && PartLoadFrac < 1.0) { CalcCBVAV(state, CBVAVNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); } @@ -2066,13 +2015,14 @@ namespace HVACUnitaryBypassVAV { Real64 OutdoorDryBulbTemp; // Dry-bulb temperature at outdoor condenser Real64 OutdoorBaroPress; // Barometric pressure at outdoor condenser - auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); - int OutletNode = cBVAV.AirOutNode; - int InletNode = cBVAV.AirInNode; - if (cBVAV.CondenserNodeNum > 0) { - OutdoorDryBulbTemp = state.dataLoopNodes->Node(cBVAV.CondenserNodeNum).Temp; - OutdoorBaroPress = state.dataLoopNodes->Node(cBVAV.CondenserNodeNum).Press; + int OutletNode = cbvav.AirOutNode; + int InletNode = cbvav.AirInNode; + if (cbvav.CondenserNodeNum > 0) { + OutdoorDryBulbTemp = s_node->Node(cbvav.CondenserNodeNum).Temp; + OutdoorBaroPress = s_node->Node(cbvav.CondenserNodeNum).Press; } else { OutdoorDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; OutdoorBaroPress = state.dataEnvrn->OutBaroPress; @@ -2081,205 +2031,207 @@ namespace HVACUnitaryBypassVAV { state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = 0.0; // Bypass excess system air through bypass duct and calculate new mixed air conditions at OA mixer inlet node - if (cBVAV.plenumIndex > 0 || cBVAV.mixerIndex > 0) { - Real64 saveMixerInletAirNodeFlow = state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate; - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode) = state.dataLoopNodes->Node(InletNode); - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate = saveMixerInletAirNodeFlow; + if (cbvav.plenumIndex > 0 || cbvav.mixerIndex > 0) { + Real64 saveMixerInletAirNodeFlow = s_node->Node(cbvav.MixerInletAirNode).MassFlowRate; + s_node->Node(cbvav.MixerInletAirNode) = s_node->Node(InletNode); + s_node->Node(cbvav.MixerInletAirNode).MassFlowRate = saveMixerInletAirNodeFlow; } else { - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).Temp = - (1.0 - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction) * state.dataLoopNodes->Node(InletNode).Temp + - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * state.dataLoopNodes->Node(OutletNode).Temp; - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).HumRat = - (1.0 - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction) * state.dataLoopNodes->Node(InletNode).HumRat + - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * state.dataLoopNodes->Node(OutletNode).HumRat; - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).Enthalpy = Psychrometrics::PsyHFnTdbW( - state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).Temp, state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).HumRat); + s_node->Node(cbvav.MixerInletAirNode).Temp = + (1.0 - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction) * s_node->Node(InletNode).Temp + + state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * s_node->Node(OutletNode).Temp; + s_node->Node(cbvav.MixerInletAirNode).HumRat = + (1.0 - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction) * s_node->Node(InletNode).HumRat + + state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * s_node->Node(OutletNode).HumRat; + s_node->Node(cbvav.MixerInletAirNode).Enthalpy = Psychrometrics::PsyHFnTdbW( + s_node->Node(cbvav.MixerInletAirNode).Temp, s_node->Node(cbvav.MixerInletAirNode).HumRat); } - MixedAir::SimOAMixer(state, cBVAV.OAMixName, cBVAV.OAMixIndex); + MixedAir::SimOAMixer(state, cbvav.OAMixName, cbvav.OAMixIndex); - if (cBVAV.fanPlace == HVAC::FanPlace::BlowThru) { - state.dataFans->fans(cBVAV.FanIndex) + if (cbvav.fanPlace == HVAC::FanPlace::BlowThru) { + state.dataFans->fans(cbvav.FanIndex) ->simulate(state, FirstHVACIteration, state.dataHVACUnitaryBypassVAV->FanSpeedRatio, _, 1.0 / OnOffAirFlowRatio); } // Simulate cooling coil if zone load is negative (cooling load) - if (cBVAV.HeatCoolMode == CoolingMode) { - if (OutdoorDryBulbTemp >= cBVAV.MinOATCompressor) { - switch (cBVAV.CoolCoilType) { - case HVAC::CoilType::DXCoolingHXAssisted: { + if (cbvav.HeatCoolMode == CoolingMode) { + if (OutdoorDryBulbTemp >= cbvav.MinOATCompressor) { + if (cbvav.hxCoolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, - cBVAV.DXCoolCoilName, + cbvav.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::On, PartLoadFrac, - cBVAV.CoolCoilCompIndex, + cbvav.hxCoolCoilNum, HVAC::FanOp::Continuous, HXUnitOn); - if (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp <= cBVAV.CoilTempSetPoint) { + if (s_node->Node(cbvav.CoolCoilAirInletNode).Temp <= cbvav.CoilTempSetPoint) { // If coil inlet temp is already below the setpoint, simulated with coil off PartLoadFrac = 0.0; HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, - cBVAV.DXCoolCoilName, + cbvav.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::Off, PartLoadFrac, - cBVAV.CoolCoilCompIndex, + cbvav.hxCoolCoilNum, HVAC::FanOp::Continuous, HXUnitOn); - } else if (state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp < cBVAV.CoilTempSetPoint) { + + } else if (s_node->Node(cbvav.CoolCoilAirOutletNode).Temp < cbvav.CoilTempSetPoint) { auto f = [&state, CBVAVNum, FirstHVACIteration, HXUnitOn](Real64 const PartLoadFrac) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, - thisCBVAV.DXCoolCoilName, + cbvav.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::On, PartLoadFrac, - thisCBVAV.CoolCoilCompIndex, + cbvav.hxCoolCoilNum, HVAC::FanOp::Continuous, HXUnitOn); - Real64 OutletAirTemp = state.dataLoopNodes->Node(thisCBVAV.DXCoilOutletNode).Temp; - return thisCBVAV.CoilTempSetPoint - OutletAirTemp; + Real64 OutletAirTemp = s_node->Node(cbvav.CoolCoilAirOutletNode).Temp; + return cbvav.CoilTempSetPoint - OutletAirTemp; }; General::SolveRoot(state, HVAC::SmallTempDiff, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0); HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, - cBVAV.DXCoolCoilName, + cbvav.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::On, PartLoadFrac, - cBVAV.CoolCoilCompIndex, + cbvav.hxCoolCoilNum, HVAC::FanOp::Continuous, HXUnitOn); if (SolFla == -1 && !state.dataGlobal->WarmupFlag) { - if (cBVAV.HXDXIterationExceeded < 1) { - ++cBVAV.HXDXIterationExceeded; + if (cbvav.HXDXIterationExceeded < 1) { + ++cbvav.HXDXIterationExceeded; ShowWarningError(state, format("Iteration limit exceeded calculating HX assisted DX unit part-load ratio, for unit = {}", - cBVAV.DXCoolCoilName)); + cbvav.hxCoolCoilName)); ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd( state, - cBVAV.Name + ", Iteration limit exceeded for HX assisted DX unit part-load ratio error continues.", - cBVAV.HXDXIterationExceededIndex, + cbvav.Name + ", Iteration limit exceeded for HX assisted DX unit part-load ratio error continues.", + cbvav.HXDXIterationExceededIndex, PartLoadFrac, PartLoadFrac); } } else if (SolFla == -2 && !state.dataGlobal->WarmupFlag) { PartLoadFrac = max(0.0, min(1.0, - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - cBVAV.CoilTempSetPoint) / - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp))); - if (cBVAV.HXDXIterationFailed < 1) { - ++cBVAV.HXDXIterationFailed; + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - cbvav.CoilTempSetPoint) / + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - + s_node->Node(cbvav.CoolCoilAirOutletNode).Temp))); + if (cbvav.HXDXIterationFailed < 1) { + ++cbvav.HXDXIterationFailed; ShowSevereError( state, format("HX assisted DX unit part-load ratio calculation failed: part-load ratio limits exceeded, for unit = {}", - cBVAV.DXCoolCoilName)); + cbvav.hxCoolCoilName)); ShowContinueErrorTimeStamp( state, format("An estimated part-load ratio of {:.3R}will be used and the simulation continues. Occurrence info:", PartLoadFrac)); } else { ShowRecurringWarningErrorAtEnd(state, - cBVAV.Name + + cbvav.Name + ", Part-load ratio calculation failed for HX assisted DX unit error continues.", - cBVAV.HXDXIterationFailedIndex, + cbvav.HXDXIterationFailedIndex, PartLoadFrac, PartLoadFrac); } } } - } break; - case HVAC::CoilType::DXCoolingSingleSpeed: { + + } else if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { DXCoils::SimDXCoil(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, PartLoadFrac, OnOffAirFlowRatio); - if (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp <= cBVAV.CoilTempSetPoint) { + if (s_node->Node(cbvav.CoolCoilAirInletNode).Temp <= cbvav.CoilTempSetPoint) { // If coil inlet temp is already below the setpoint, simulated with coil off PartLoadFrac = 0.0; DXCoils::SimDXCoil(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, PartLoadFrac, OnOffAirFlowRatio); - } else if (state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp < cBVAV.CoilTempSetPoint) { + } else if (s_node->Node(cbvav.CoolCoilAirOutletNode).Temp < cbvav.CoilTempSetPoint) { auto f = [&state, CBVAVNum, OnOffAirFlowRatio](Real64 const PartLoadFrac) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); DXCoils::CalcDoe2DXCoil(state, - thisCBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::CompressorOp::On, false, PartLoadFrac, HVAC::FanOp::Continuous, _, OnOffAirFlowRatio); - Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(thisCBVAV.CoolCoilCompIndex); - return thisCBVAV.CoilTempSetPoint - OutletAirTemp; + Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(cbvav.CoolCoilNum); + return cbvav.CoilTempSetPoint - OutletAirTemp; }; General::SolveRoot(state, HVAC::SmallTempDiff, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0); DXCoils::SimDXCoil(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, PartLoadFrac, OnOffAirFlowRatio); if (SolFla == -1 && !state.dataGlobal->WarmupFlag) { - if (cBVAV.DXIterationExceeded < 1) { - ++cBVAV.DXIterationExceeded; + if (cbvav.DXIterationExceeded < 1) { + ++cbvav.DXIterationExceeded; ShowWarningError( state, - format("Iteration limit exceeded calculating DX unit part-load ratio, for unit = {}", cBVAV.DXCoolCoilName)); + format("Iteration limit exceeded calculating DX unit part-load ratio, for unit = {}", cbvav.CoolCoilName)); ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd( state, - cBVAV.Name + ", Iteration limit exceeded for DX unit part-load ratio calculation error continues.", - cBVAV.DXIterationExceededIndex, + cbvav.Name + ", Iteration limit exceeded for DX unit part-load ratio calculation error continues.", + cbvav.DXIterationExceededIndex, PartLoadFrac, PartLoadFrac); } } else if (SolFla == -2 && !state.dataGlobal->WarmupFlag) { PartLoadFrac = max(0.0, min(1.0, - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - cBVAV.CoilTempSetPoint) / - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp))); - if (cBVAV.DXIterationFailed < 1) { - ++cBVAV.DXIterationFailed; + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - cbvav.CoilTempSetPoint) / + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - + s_node->Node(cbvav.CoolCoilAirOutletNode).Temp))); + if (cbvav.DXIterationFailed < 1) { + ++cbvav.DXIterationFailed; ShowSevereError(state, format("DX unit part-load ratio calculation failed: part-load ratio limits exceeded, for unit = {}", - cBVAV.DXCoolCoilName)); + cbvav.CoolCoilName)); ShowContinueErrorTimeStamp( state, format("An estimated part-load ratio of {:.3R}will be used and the simulation continues. Occurrence info:", PartLoadFrac)); } else { ShowRecurringWarningErrorAtEnd(state, - cBVAV.Name + ", Part-load ratio calculation failed for DX unit error continues.", - cBVAV.DXIterationFailedIndex, + cbvav.Name + ", Part-load ratio calculation failed for DX unit error continues.", + cbvav.DXIterationFailedIndex, PartLoadFrac, PartLoadFrac); } } } - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cBVAV.DXCoolCoilIndexNum); - } break; - case HVAC::CoilType::CoolingAirToAirVariableSpeed: { + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cbvav.CoolCoilNum); + + } else if (cbvav.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { Real64 QZnReq(0.0); // Zone load (W), input to variable-speed DX coil Real64 QLatReq(0.0); // Zone latent load, input to variable-speed DX coil Real64 LocalOnOffAirFlowRatio(1.0); // ratio of compressor on flow to average flow over time step @@ -2287,12 +2239,12 @@ namespace HVACUnitaryBypassVAV { Real64 SpeedRatio(0.0); int SpeedNum(1); bool errorFlag(false); - int maxNumSpeeds = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, cBVAV.DXCoolCoilName, errorFlag); - Real64 DesOutTemp = cBVAV.CoilTempSetPoint; + int maxNumSpeeds = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, cbvav.CoolCoilNum); + Real64 DesOutTemp = cbvav.CoilTempSetPoint; // Get no load result VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.DXCoolCoilName, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::Off, LocalPartLoadFrac, @@ -2301,11 +2253,11 @@ namespace HVACUnitaryBypassVAV { QZnReq, QLatReq); - Real64 NoOutput = state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat)); + Real64 NoOutput = s_node->Node(cbvav.CoolCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirOutletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirInletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat)); // Get full load result LocalPartLoadFrac = 1.0; @@ -2313,8 +2265,8 @@ namespace HVACUnitaryBypassVAV { SpeedRatio = 1.0; QZnReq = 0.001; // to indicate the coil is running VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.DXCoolCoilName, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -2323,15 +2275,15 @@ namespace HVACUnitaryBypassVAV { QZnReq, QLatReq); - Real64 FullOutput = state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat)); - Real64 ReqOutput = state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(DesOutTemp, state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat)); + Real64 FullOutput = s_node->Node(cbvav.CoolCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirOutletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirInletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat)); + Real64 ReqOutput = s_node->Node(cbvav.CoolCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(DesOutTemp, s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirInletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat)); Real64 loadAccuracy(0.001); // Watts, power Real64 tempAccuracy(0.001); // delta C, temperature @@ -2343,8 +2295,8 @@ namespace HVACUnitaryBypassVAV { QZnReq = 0.0; // Get no load result VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.DXCoolCoilName, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::Off, LocalPartLoadFrac, @@ -2364,7 +2316,7 @@ namespace HVACUnitaryBypassVAV { // OutletTempDXCoil is the full capacity outlet temperature at LocalPartLoadFrac = 1 from the CALL above. If this // temp is greater than the desired outlet temp, then run the compressor at LocalPartLoadFrac = 1, otherwise find // the operating PLR. - Real64 OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(cBVAV.CoolCoilCompIndex).OutletAirDBTemp; + Real64 OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(cbvav.CoolCoilNum).OutletAirDBTemp; if (OutletTempDXCoil > DesOutTemp) { LocalPartLoadFrac = 1.0; SpeedNum = maxNumSpeeds; @@ -2376,8 +2328,8 @@ namespace HVACUnitaryBypassVAV { SpeedRatio = 1.0; QZnReq = 0.001; // to indicate the coil is running VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.DXCoolCoilName, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -2387,16 +2339,16 @@ namespace HVACUnitaryBypassVAV { QLatReq, LocalOnOffAirFlowRatio); - Real64 TempSpeedOut = state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat)); + Real64 TempSpeedOut = s_node->Node(cbvav.CoolCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirOutletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirInletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat)); Real64 TempSpeedReqst = - state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(DesOutTemp, state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat)); + s_node->Node(cbvav.CoolCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(DesOutTemp, s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirInletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat)); if ((TempSpeedOut - TempSpeedReqst) > tempAccuracy) { // Check to see which speed to meet the load @@ -2405,8 +2357,8 @@ namespace HVACUnitaryBypassVAV { for (int I = 2; I <= maxNumSpeeds; ++I) { SpeedNum = I; VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.DXCoolCoilName, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -2416,16 +2368,16 @@ namespace HVACUnitaryBypassVAV { QLatReq, LocalOnOffAirFlowRatio); - TempSpeedOut = state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat)); + TempSpeedOut = s_node->Node(cbvav.CoolCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirOutletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirInletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat)); TempSpeedReqst = - state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(DesOutTemp, state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat)); + s_node->Node(cbvav.CoolCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(DesOutTemp, s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.CoolCoilAirInletNode).Temp, + s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat)); if ((TempSpeedOut - TempSpeedReqst) < tempAccuracy) { SpeedNum = I; @@ -2434,18 +2386,18 @@ namespace HVACUnitaryBypassVAV { } // now find the speed ratio for the found speednum auto f = [&state, CBVAVNum, SpeedNum, DesOutTemp](Real64 const SpeedRatio) { - auto const &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 OutletAirTemp; // outlet air temperature [C] Real64 QZnReqCycling = 0.001; Real64 QLatReqCycling = 0.0; Real64 OnOffAirFlowRatioCycling = 1.0; Real64 partLoadRatio = 1.0; - int CoilIndex = thisCBVAV.CoolCoilCompIndex; HVAC::FanOp fanOp = HVAC::FanOp::Continuous; VariableSpeedCoils::SimVariableSpeedCoils(state, - "", - CoilIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, fanOp, HVAC::CompressorOp::On, partLoadRatio, @@ -2455,21 +2407,21 @@ namespace HVACUnitaryBypassVAV { QLatReqCycling, OnOffAirFlowRatioCycling); - OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirDBTemp; + OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(cbvav.CoolCoilNum).OutletAirDBTemp; return DesOutTemp - OutletAirTemp; }; General::SolveRoot(state, tempAccuracy, MaxIte, SolFla, SpeedRatio, f, 1.0e-10, 1.0); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXIterationExceeded < 4) { - ++cBVAV.DXIterationExceeded; + if (cbvav.DXIterationExceeded < 4) { + ++cbvav.DXIterationExceeded; ShowWarningError(state, format("{} - Iteration limit exceeded calculating VS DX coil speed ratio for coil named " "{}, in Unitary system named{}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.DXCoolCoilName, - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName, + cbvav.Name)); ShowContinueError(state, format("Calculated speed ratio = {:.4R}", SpeedRatio)); ShowContinueErrorTimeStamp( state, "The calculated speed ratio will be used and the simulation continues. Occurrence info:"); @@ -2477,22 +2429,22 @@ namespace HVACUnitaryBypassVAV { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Iteration limit exceeded calculating speed ratio error " "continues. Speed Ratio statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.DXCoolCoilName), - cBVAV.DXIterationExceededIndex, + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName), + cbvav.DXIterationExceededIndex, LocalPartLoadFrac, LocalPartLoadFrac); } } else if (SolFla == -2) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXIterationFailed < 4) { - ++cBVAV.DXIterationFailed; + if (cbvav.DXIterationFailed < 4) { + ++cbvav.DXIterationFailed; ShowWarningError(state, format("{} - DX unit speed ratio calculation failed: solver limits exceeded, for coil " "named {}, in Unitary system named{}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.DXCoolCoilName, - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName, + cbvav.Name)); ShowContinueError(state, format("Estimated speed ratio = {:.3R}", TempSpeedReqst / TempSpeedOut)); ShowContinueErrorTimeStamp( state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:"); @@ -2501,9 +2453,9 @@ namespace HVACUnitaryBypassVAV { state, format( "{} \"{}\" - DX unit speed ratio calculation failed error continues. speed ratio statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.DXCoolCoilName), - cBVAV.DXIterationFailedIndex, + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName), + cbvav.DXIterationFailedIndex, SpeedRatio, SpeedRatio); } @@ -2512,15 +2464,16 @@ namespace HVACUnitaryBypassVAV { } else { // cycling compressor at lowest speed number, find part load fraction auto f = [&state, CBVAVNum, DesOutTemp](Real64 const PartLoadRatio) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); int speedNum = 1; Real64 speedRatio = 0.0; Real64 QZnReqCycling = 0.001; Real64 QLatReqCycling = 0.0; Real64 OnOffAirFlowRatioCycling = 1.0; VariableSpeedCoils::SimVariableSpeedCoils(state, - "", - thisCBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, PartLoadRatio, @@ -2530,20 +2483,20 @@ namespace HVACUnitaryBypassVAV { QLatReqCycling, OnOffAirFlowRatioCycling); - Real64 OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(thisCBVAV.CoolCoilCompIndex).OutletAirDBTemp; + Real64 OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(cbvav.CoolCoilNum).OutletAirDBTemp; return DesOutTemp - OutletAirTemp; }; General::SolveRoot(state, tempAccuracy, MaxIte, SolFla, LocalPartLoadFrac, f, 1.0e-10, 1.0); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXCyclingIterationExceeded < 4) { - ++cBVAV.DXCyclingIterationExceeded; + if (cbvav.DXCyclingIterationExceeded < 4) { + ++cbvav.DXCyclingIterationExceeded; ShowWarningError(state, format("{} - Iteration limit exceeded calculating VS DX unit low speed cycling ratio, " "for coil named {}, in Unitary system named{}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.DXCoolCoilName, - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName, + cbvav.Name)); ShowContinueError(state, format("Estimated cycling ratio = {:.3R}", (TempSpeedReqst / TempSpeedOut))); ShowContinueError(state, format("Calculated cycling ratio = {:.3R}", LocalPartLoadFrac)); ShowContinueErrorTimeStamp( @@ -2553,22 +2506,22 @@ namespace HVACUnitaryBypassVAV { state, format(" {} \"{}\" - Iteration limit exceeded calculating low speed cycling ratio " "error continues. Sensible PLR statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.DXCoolCoilName), - cBVAV.DXCyclingIterationExceededIndex, + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName), + cbvav.DXCyclingIterationExceededIndex, LocalPartLoadFrac, LocalPartLoadFrac); } } else if (SolFla == -2) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXCyclingIterationFailed < 4) { - ++cBVAV.DXCyclingIterationFailed; + if (cbvav.DXCyclingIterationFailed < 4) { + ++cbvav.DXCyclingIterationFailed; ShowWarningError( state, format("{} - DX unit low speed cycling ratio calculation failed: limits exceeded, for unit = {}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.Name)); ShowContinueError(state, format("Estimated low speed cycling ratio = {:.3R}", TempSpeedReqst / TempSpeedOut)); ShowContinueErrorTimeStamp(state, @@ -2578,9 +2531,9 @@ namespace HVACUnitaryBypassVAV { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - DX unit low speed cycling ratio calculation failed error " "continues. cycling ratio statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)], - cBVAV.DXCoolCoilName), - cBVAV.DXCyclingIterationFailedIndex, + HVAC::coilTypeNames[(int)cbvav.coolCoilType], + cbvav.CoolCoilName), + cbvav.DXCyclingIterationFailedIndex, LocalPartLoadFrac, LocalPartLoadFrac); } @@ -2595,10 +2548,10 @@ namespace HVACUnitaryBypassVAV { } else if (LocalPartLoadFrac < 0.0) { LocalPartLoadFrac = 0.0; } - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, cBVAV.CoolCoilCompIndex); + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, cbvav.CoolCoilNum); // variable-speed air-to-air cooling coil, end ------------------------- - } break; - case HVAC::CoilType::DXCoolingTwoStageWHumControl: { + + } else if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { // Coil:Cooling:DX:TwoStageWithHumidityControlMode // formerly (v3 and beyond) Coil:DX:MultiMode:CoolingEmpirical @@ -2610,75 +2563,75 @@ namespace HVACUnitaryBypassVAV { // Get full load result HVAC::CoilMode DehumidMode = HVAC::CoilMode::Normal; // Dehumidification mode (0=normal, 1=enhanced) - cBVAV.DehumidificationMode = DehumidMode; + cbvav.DehumidificationMode = DehumidMode; DXCoils::SimDXCoilMultiMode(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, PartLoadFrac, DehumidMode, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - if (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp <= cBVAV.CoilTempSetPoint) { + if (s_node->Node(cbvav.CoolCoilAirInletNode).Temp <= cbvav.CoilTempSetPoint) { PartLoadFrac = 0.0; DXCoils::SimDXCoilMultiMode(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, PartLoadFrac, DehumidMode, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - } else if (state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp > cBVAV.CoilTempSetPoint) { + } else if (s_node->Node(cbvav.CoolCoilAirOutletNode).Temp > cbvav.CoilTempSetPoint) { PartLoadFrac = 1.0; } else { auto f = [&state, CBVAVNum, DehumidMode](Real64 const PartLoadRatio) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); DXCoils::SimDXCoilMultiMode(state, - "", + cbvav.CoolCoilName, HVAC::CompressorOp::On, false, PartLoadRatio, DehumidMode, - thisCBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - return thisCBVAV.CoilTempSetPoint - state.dataDXCoils->DXCoilOutletTemp(thisCBVAV.CoolCoilCompIndex); + return cbvav.CoilTempSetPoint - state.dataDXCoils->DXCoilOutletTemp(cbvav.CoolCoilNum); }; General::SolveRoot(state, HVAC::SmallTempDiff, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0); if (SolFla == -1) { - if (cBVAV.MMDXIterationExceeded < 1) { - ++cBVAV.MMDXIterationExceeded; + if (cbvav.MMDXIterationExceeded < 1) { + ++cbvav.MMDXIterationExceeded; ShowWarningError(state, - format("Iteration limit exceeded calculating DX unit part-load ratio, for unit={}", cBVAV.Name)); + format("Iteration limit exceeded calculating DX unit part-load ratio, for unit={}", cbvav.Name)); ShowContinueErrorTimeStamp(state, format("Part-load ratio returned = {:.2R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd(state, - cBVAV.Name + + cbvav.Name + ", Iteration limit exceeded calculating DX unit part-load ratio error continues.", - cBVAV.MMDXIterationExceededIndex, + cbvav.MMDXIterationExceededIndex, PartLoadFrac, PartLoadFrac); } } else if (SolFla == -2) { PartLoadFrac = max(0.0, min(1.0, - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - cBVAV.CoilTempSetPoint) / - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp))); - if (cBVAV.MMDXIterationFailed < 1) { - ++cBVAV.MMDXIterationFailed; + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - cbvav.CoilTempSetPoint) / + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - + s_node->Node(cbvav.CoolCoilAirOutletNode).Temp))); + if (cbvav.MMDXIterationFailed < 1) { + ++cbvav.MMDXIterationFailed; ShowSevereError( state, - format("DX unit part-load ratio calculation failed: part-load ratio limits exceeded, for unit={}", cBVAV.Name)); + format("DX unit part-load ratio calculation failed: part-load ratio limits exceeded, for unit={}", cbvav.Name)); ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd(state, - cBVAV.Name + ", Part-load ratio calculation failed for DX unit error continues.", - cBVAV.MMDXIterationFailedIndex, + cbvav.Name + ", Part-load ratio calculation failed for DX unit error continues.", + cbvav.MMDXIterationFailedIndex, PartLoadFrac, PartLoadFrac); } @@ -2688,80 +2641,80 @@ namespace HVACUnitaryBypassVAV { // If humidity setpoint is not satisfied and humidity control type is Multimode, // then turn on enhanced dehumidification mode 1 - if ((state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat > state.dataLoopNodes->Node(OutletNode).HumRatMax) && - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).HumRat > state.dataLoopNodes->Node(OutletNode).HumRatMax) && - (cBVAV.DehumidControlType == DehumidControl::Multimode) && state.dataLoopNodes->Node(OutletNode).HumRatMax > 0.0) { + if ((s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat > s_node->Node(cbvav.AirOutNode).HumRatMax) && + (s_node->Node(cbvav.CoolCoilAirInletNode).HumRat > s_node->Node(cbvav.AirOutNode).HumRatMax) && + (cbvav.DehumidControlType == DehumidControl::Multimode) && s_node->Node(cbvav.AirOutNode).HumRatMax > 0.0) { // Determine required part load for enhanced dehumidification mode 1 // Get full load result PartLoadFrac = 1.0; DehumidMode = HVAC::CoilMode::Enhanced; - cBVAV.DehumidificationMode = DehumidMode; + cbvav.DehumidificationMode = DehumidMode; DXCoils::SimDXCoilMultiMode(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, PartLoadFrac, DehumidMode, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - if (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp <= cBVAV.CoilTempSetPoint) { + if (s_node->Node(cbvav.CoolCoilAirInletNode).Temp <= cbvav.CoilTempSetPoint) { PartLoadFrac = 0.0; - } else if (state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp > cBVAV.CoilTempSetPoint) { + } else if (s_node->Node(cbvav.CoolCoilAirOutletNode).Temp > cbvav.CoilTempSetPoint) { PartLoadFrac = 1.0; } else { auto f = [&state, CBVAVNum, DehumidMode](Real64 const PartLoadRatio) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); DXCoils::SimDXCoilMultiMode(state, - "", + cbvav.CoolCoilName, HVAC::CompressorOp::On, false, PartLoadRatio, DehumidMode, - thisCBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - return thisCBVAV.CoilTempSetPoint - state.dataDXCoils->DXCoilOutletTemp(thisCBVAV.CoolCoilCompIndex); + return cbvav.CoilTempSetPoint - state.dataDXCoils->DXCoilOutletTemp(cbvav.CoolCoilNum); }; General::SolveRoot(state, HVAC::SmallTempDiff, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0); if (SolFla == -1) { - if (cBVAV.DMDXIterationExceeded < 1) { - ++cBVAV.DMDXIterationExceeded; + if (cbvav.DMDXIterationExceeded < 1) { + ++cbvav.DMDXIterationExceeded; ShowWarningError( state, format("Iteration limit exceeded calculating DX unit dehumidifying part-load ratio, for unit = {}", - cBVAV.Name)); + cbvav.Name)); ShowContinueErrorTimeStamp(state, format("Part-load ratio returned={:.2R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd( state, - cBVAV.Name + ", Iteration limit exceeded calculating DX unit dehumidifying part-load ratio error continues.", - cBVAV.DMDXIterationExceededIndex, + cbvav.Name + ", Iteration limit exceeded calculating DX unit dehumidifying part-load ratio error continues.", + cbvav.DMDXIterationExceededIndex, PartLoadFrac, PartLoadFrac); } } else if (SolFla == -2) { PartLoadFrac = max(0.0, min(1.0, - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - cBVAV.CoilTempSetPoint) / - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp))); - if (cBVAV.DMDXIterationFailed < 1) { - ++cBVAV.DMDXIterationFailed; + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - cbvav.CoilTempSetPoint) / + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - + s_node->Node(cbvav.CoolCoilAirOutletNode).Temp))); + if (cbvav.DMDXIterationFailed < 1) { + ++cbvav.DMDXIterationFailed; ShowSevereError(state, format("DX unit dehumidifying part-load ratio calculation failed: part-load ratio limits " "exceeded, for unit = {}", - cBVAV.Name)); + cbvav.Name)); ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd( state, - cBVAV.Name + ", Dehumidifying part-load ratio calculation failed for DX unit error continues.", - cBVAV.DMDXIterationFailedIndex, + cbvav.Name + ", Dehumidifying part-load ratio calculation failed for DX unit error continues.", + cbvav.DMDXIterationFailedIndex, PartLoadFrac, PartLoadFrac); } @@ -2772,91 +2725,91 @@ namespace HVACUnitaryBypassVAV { // If humidity setpoint is not satisfied and humidity control type is CoolReheat, // then run to meet latent load - if ((state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).HumRat > state.dataLoopNodes->Node(OutletNode).HumRatMax) && - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).HumRat > state.dataLoopNodes->Node(OutletNode).HumRatMax) && - (cBVAV.DehumidControlType == DehumidControl::CoolReheat) && state.dataLoopNodes->Node(OutletNode).HumRatMax > 0.0) { + if ((s_node->Node(cbvav.CoolCoilAirOutletNode).HumRat > s_node->Node(cbvav.AirOutNode).HumRatMax) && + (s_node->Node(cbvav.CoolCoilAirInletNode).HumRat > s_node->Node(cbvav.AirOutNode).HumRatMax) && + (cbvav.DehumidControlType == DehumidControl::CoolReheat) && s_node->Node(cbvav.AirOutNode).HumRatMax > 0.0) { // Determine revised desired outlet temperature - use approach temperature control strategy // based on CONTROLLER:SIMPLE TEMPANDHUMRAT control type. // Calculate the approach temperature (difference between SA dry-bulb temp and SA dew point temp) - ApproachTemp = state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp - - Psychrometrics::PsyTdpFnWPb(state, state.dataLoopNodes->Node(OutletNode).HumRat, OutdoorBaroPress); + ApproachTemp = s_node->Node(cbvav.CoolCoilAirOutletNode).Temp - + Psychrometrics::PsyTdpFnWPb(state, s_node->Node(cbvav.AirOutNode).HumRat, OutdoorBaroPress); // Calculate the dew point temperature at the SA humidity ratio setpoint - DesiredDewPoint = Psychrometrics::PsyTdpFnWPb(state, state.dataLoopNodes->Node(OutletNode).HumRatMax, OutdoorBaroPress); + DesiredDewPoint = Psychrometrics::PsyTdpFnWPb(state, s_node->Node(cbvav.AirOutNode).HumRatMax, OutdoorBaroPress); // Adjust the calculated dew point temperature by the approach temp - cBVAV.CoilTempSetPoint = min(cBVAV.CoilTempSetPoint, (DesiredDewPoint + ApproachTemp)); + cbvav.CoilTempSetPoint = min(cbvav.CoilTempSetPoint, (DesiredDewPoint + ApproachTemp)); // Determine required part load for cool reheat at adjusted DesiredOutletTemp // Get full load result PartLoadFrac = 1.0; DehumidMode = HVAC::CoilMode::Normal; - cBVAV.DehumidificationMode = DehumidMode; + cbvav.DehumidificationMode = DehumidMode; DXCoils::SimDXCoilMultiMode(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, PartLoadFrac, DehumidMode, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - if (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp <= cBVAV.CoilTempSetPoint) { + if (s_node->Node(cbvav.CoolCoilAirInletNode).Temp <= cbvav.CoilTempSetPoint) { PartLoadFrac = 0.0; - } else if (state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp > cBVAV.CoilTempSetPoint) { + } else if (s_node->Node(cbvav.CoolCoilAirOutletNode).Temp > cbvav.CoilTempSetPoint) { PartLoadFrac = 1.0; } else { auto f = [&state, CBVAVNum, DehumidMode](Real64 const PartLoadRatio) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); DXCoils::SimDXCoilMultiMode(state, - "", + cbvav.CoolCoilName, HVAC::CompressorOp::On, false, PartLoadRatio, DehumidMode, - thisCBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - return thisCBVAV.CoilTempSetPoint - state.dataDXCoils->DXCoilOutletTemp(thisCBVAV.CoolCoilCompIndex); + return cbvav.CoilTempSetPoint - state.dataDXCoils->DXCoilOutletTemp(cbvav.CoolCoilNum); }; General::SolveRoot(state, HVAC::SmallTempDiff, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0); if (SolFla == -1) { - if (cBVAV.CRDXIterationExceeded < 1) { - ++cBVAV.CRDXIterationExceeded; + if (cbvav.CRDXIterationExceeded < 1) { + ++cbvav.CRDXIterationExceeded; ShowWarningError(state, format("Iteration limit exceeded calculating DX unit cool reheat part-load ratio, for unit = {}", - cBVAV.Name)); + cbvav.Name)); ShowContinueErrorTimeStamp(state, format("Part-load ratio returned = {:.2R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd( state, - cBVAV.Name + ", Iteration limit exceeded calculating cool reheat part-load ratio DX unit error continues.", - cBVAV.CRDXIterationExceededIndex, + cbvav.Name + ", Iteration limit exceeded calculating cool reheat part-load ratio DX unit error continues.", + cbvav.CRDXIterationExceededIndex, PartLoadFrac, PartLoadFrac); } } else if (SolFla == -2) { PartLoadFrac = max(0.0, min(1.0, - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - cBVAV.CoilTempSetPoint) / - (state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp - - state.dataLoopNodes->Node(cBVAV.DXCoilOutletNode).Temp))); - if (cBVAV.CRDXIterationFailed < 1) { - ++cBVAV.CRDXIterationFailed; + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - cbvav.CoilTempSetPoint) / + (s_node->Node(cbvav.CoolCoilAirInletNode).Temp - + s_node->Node(cbvav.CoolCoilAirOutletNode).Temp))); + if (cbvav.CRDXIterationFailed < 1) { + ++cbvav.CRDXIterationFailed; ShowSevereError( state, format( "DX unit cool reheat part-load ratio calculation failed: part-load ratio limits exceeded, for unit = {}", - cBVAV.Name)); + cbvav.Name)); ShowContinueError(state, format("Estimated part-load ratio = {:.3R}", PartLoadFrac)); ShowContinueErrorTimeStamp( state, "The estimated part-load ratio will be used and the simulation continues. Occurrence info:"); } else { ShowRecurringWarningErrorAtEnd( state, - cBVAV.Name + ", Dehumidifying part-load ratio calculation failed for DX unit error continues.", - cBVAV.DMDXIterationFailedIndex, + cbvav.Name + ", Dehumidifying part-load ratio calculation failed for DX unit error continues.", + cbvav.DMDXIterationFailedIndex, PartLoadFrac, PartLoadFrac); } @@ -2869,46 +2822,48 @@ namespace HVACUnitaryBypassVAV { } else if (PartLoadFrac < 0.0) { PartLoadFrac = 0.0; } - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cBVAV.DXCoolCoilIndexNum); - } break; - default: { - ShowFatalError( - state, format("SimCBVAV System: Invalid DX Cooling Coil={}", HVAC::coilTypeNamesUC[static_cast(cBVAV.CoolCoilType)])); - } break; + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cbvav.CoolCoilNum); + + } else { + ShowFatalError(state, format("SimCBVAV System: Invalid DX Cooling Coil={}", HVAC::coilTypeNames[(int)cbvav.coolCoilType])); } + } else { // IF(OutdoorDryBulbTemp .GE. cBVAV%MinOATCompressor)THEN // Simulate DX cooling coil with compressor off - if (cBVAV.CoolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { + if (cbvav.hxCoolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, - cBVAV.DXCoolCoilName, + cbvav.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::Off, 0.0, - cBVAV.CoolCoilCompIndex, + cbvav.hxCoolCoilNum, HVAC::FanOp::Continuous, HXUnitOn); - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cBVAV.DXCoolCoilIndexNum); - } else if (cBVAV.CoolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cbvav.CoolCoilNum); + + } else if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { DXCoils::SimDXCoil(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, 0.0, OnOffAirFlowRatio); - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cBVAV.DXCoolCoilIndexNum); - } else if (cBVAV.CoolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cbvav.CoolCoilNum); + + } else if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { DXCoils::SimDXCoilMultiMode(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, 0.0, HVAC::CoilMode::Normal, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cBVAV.DXCoolCoilIndexNum); - } else if (cBVAV.CoolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cbvav.CoolCoilNum); + + } else if (cbvav.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // Real64 PartLoadFrac(0.0); Real64 LocalPartLoadFrac = 0.0; Real64 QZnReq = 0.0; // Zone load (W), input to variable-speed DX coil @@ -2917,8 +2872,8 @@ namespace HVACUnitaryBypassVAV { int SpeedNum = 1; // Get no load result VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.DXCoolCoilName, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::Off, LocalPartLoadFrac, @@ -2926,31 +2881,33 @@ namespace HVACUnitaryBypassVAV { SpeedRatio, QZnReq, QLatReq); - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, cBVAV.CoolCoilCompIndex); + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, cbvav.CoolCoilNum); } } // Simulate cooling coil with compressor off if zone requires heating } else { // HeatCoolMode == HeatingMode and no cooling is required, set PLR to 0 - if (cBVAV.CoolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { + if (cbvav.hxCoolCoilType == HVAC::CoilType::DXCoolingHXAssisted) { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, - cBVAV.DXCoolCoilName, + cbvav.hxCoolCoilName, FirstHVACIteration, HVAC::CompressorOp::Off, 0.0, - cBVAV.CoolCoilCompIndex, + cbvav.hxCoolCoilNum, HVAC::FanOp::Continuous, HXUnitOn); - } else if (cBVAV.CoolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { + + } else if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingSingleSpeed) { DXCoils::SimDXCoil(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, 0.0, OnOffAirFlowRatio); - } else if (cBVAV.CoolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + + } else if (cbvav.coolCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { Real64 QZnReq = 0.0; // Zone load (W), input to variable-speed DX coil Real64 QLatReq = 0.0; // Zone latent load, input to variable-speed DX coil Real64 LocalPartLoadFrac = 0.0; @@ -2958,8 +2915,8 @@ namespace HVACUnitaryBypassVAV { int SpeedNum = 1; // run model with no load VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.DXCoolCoilName, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilName, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::Off, LocalPartLoadFrac, @@ -2968,64 +2925,64 @@ namespace HVACUnitaryBypassVAV { QZnReq, QLatReq); - } else if (cBVAV.CoolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + } else if (cbvav.coolCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { DXCoils::SimDXCoilMultiMode(state, - cBVAV.DXCoolCoilName, + cbvav.CoolCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, 0.0, HVAC::CoilMode::Normal, - cBVAV.CoolCoilCompIndex, + cbvav.CoolCoilNum, HVAC::FanOp::Continuous); } } // Simulate the heating coil based on coil type - switch (cBVAV.HeatCoilType) { + switch (cbvav.heatCoilType) { case HVAC::CoilType::DXHeatingEmpirical: { // Simulate DX heating coil if zone load is positive (heating load) - if (cBVAV.HeatCoolMode == HeatingMode) { - if (OutdoorDryBulbTemp > cBVAV.MinOATCompressor) { + if (cbvav.HeatCoolMode == HeatingMode) { + if (OutdoorDryBulbTemp > cbvav.MinOATCompressor) { // simulate the DX heating coil // vs coil issue DXCoils::SimDXCoil(state, - cBVAV.HeatCoilName, + cbvav.HeatCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - cBVAV.HeatCoilIndex, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, PartLoadFrac, OnOffAirFlowRatio); - if (state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).Temp > cBVAV.CoilTempSetPoint && - state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).Temp < cBVAV.CoilTempSetPoint) { + if (s_node->Node(cbvav.HeatCoilAirOutletNode).Temp > cbvav.CoilTempSetPoint && + s_node->Node(cbvav.HeatCoilAirInletNode).Temp < cbvav.CoilTempSetPoint) { // iterate to find PLR at CoilTempSetPoint auto f = [&state, CBVAVNum, OnOffAirFlowRatio](Real64 const PartLoadFrac) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); - DXCoils::CalcDXHeatingCoil(state, thisCBVAV.HeatCoilIndex, PartLoadFrac, HVAC::FanOp::Continuous, OnOffAirFlowRatio); - Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(thisCBVAV.HeatCoilIndex); - Real64 par2 = min(thisCBVAV.CoilTempSetPoint, thisCBVAV.MaxLATHeating); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); + DXCoils::CalcDXHeatingCoil(state, cbvav.HeatCoilNum, PartLoadFrac, HVAC::FanOp::Continuous, OnOffAirFlowRatio); + Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(cbvav.HeatCoilNum); + Real64 par2 = min(cbvav.CoilTempSetPoint, cbvav.MaxLATHeating); return par2 - OutletAirTemp; }; General::SolveRoot(state, HVAC::SmallTempDiff, MaxIte, SolFla, PartLoadFrac, f, 0.0, 1.0); DXCoils::SimDXCoil(state, - cBVAV.HeatCoilName, + cbvav.HeatCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - cBVAV.HeatCoilIndex, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, PartLoadFrac, OnOffAirFlowRatio); if (SolFla == -1 && !state.dataGlobal->WarmupFlag) { ShowWarningError( - state, format("Iteration limit exceeded calculating DX unit part-load ratio, for unit = {}", cBVAV.HeatCoilName)); + state, format("Iteration limit exceeded calculating DX unit part-load ratio, for unit = {}", cbvav.HeatCoilName)); ShowContinueError(state, format("Calculated part-load ratio = {:.3R}", PartLoadFrac)); ShowContinueErrorTimeStamp(state, "The calculated part-load ratio will be used and the simulation continues. Occurrence info:"); } else if (SolFla == -2 && !state.dataGlobal->WarmupFlag) { ShowSevereError(state, format("DX unit part-load ratio calculation failed: part-load ratio limits exceeded, for unit = {}", - cBVAV.HeatCoilName)); + cbvav.HeatCoilName)); ShowContinueErrorTimeStamp( state, format("A part-load ratio of {:.3R}will be used and the simulation continues. Occurrence info:", PartLoadFrac)); @@ -3035,22 +2992,22 @@ namespace HVACUnitaryBypassVAV { } else { // OAT .LT. MinOATCompressor // simulate DX heating coil with compressor off DXCoils::SimDXCoil(state, - cBVAV.HeatCoilName, + cbvav.HeatCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, - cBVAV.HeatCoilIndex, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, 0.0, OnOffAirFlowRatio); } - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cBVAV.DXHeatCoilIndexNum); + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(cbvav.HeatCoilNum); } else { // HeatCoolMode = CoolingMode // simulate DX heating coil with compressor off when cooling load is required DXCoils::SimDXCoil(state, - cBVAV.HeatCoilName, + cbvav.HeatCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, - cBVAV.HeatCoilIndex, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, 0.0, OnOffAirFlowRatio); @@ -3064,12 +3021,12 @@ namespace HVACUnitaryBypassVAV { Real64 SpeedRatio = 0.0; int SpeedNum = 1; bool errorFlag = false; - int maxNumSpeeds = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, cBVAV.HeatCoilName, errorFlag); - Real64 DesOutTemp = cBVAV.CoilTempSetPoint; + int maxNumSpeeds = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, cbvav.HeatCoilName, errorFlag); + Real64 DesOutTemp = cbvav.CoilTempSetPoint; // Get no load result VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::Off, LocalPartLoadFrac, @@ -3078,12 +3035,12 @@ namespace HVACUnitaryBypassVAV { QZnReq, QLatReq); - Real64 NoOutput = state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).Temp, - state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).HumRat)); - Real64 TempNoOutput = state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).Temp; + Real64 NoOutput = s_node->Node(cbvav.HeatCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.HeatCoilAirOutletNode).Temp, + s_node->Node(cbvav.HeatCoilAirInletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.HeatCoilAirInletNode).Temp, + s_node->Node(cbvav.HeatCoilAirOutletNode).HumRat)); + Real64 TempNoOutput = s_node->Node(cbvav.HeatCoilAirOutletNode).Temp; // Real64 NoLoadHumRatOut = VariableSpeedCoils::VarSpeedCoil( CBVAV( CBVAVNum ).CoolCoilCompIndex ).OutletAirHumRat; // Get full load result @@ -3092,8 +3049,8 @@ namespace HVACUnitaryBypassVAV { SpeedRatio = 1.0; QZnReq = 0.001; // to indicate the coil is running VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -3103,15 +3060,15 @@ namespace HVACUnitaryBypassVAV { QLatReq); // Real64 FullLoadHumRatOut = VariableSpeedCoils::VarSpeedCoil( CBVAV( CBVAVNum ).CoolCoilCompIndex ).OutletAirHumRat; - Real64 FullOutput = state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).Temp, - state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).HumRat)); - Real64 ReqOutput = state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(DesOutTemp, state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).Temp, - state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).HumRat)); + Real64 FullOutput = s_node->Node(cbvav.HeatCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.HeatCoilAirOutletNode).Temp, + s_node->Node(cbvav.HeatCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.HeatCoilAirInletNode).Temp, + s_node->Node(cbvav.HeatCoilAirOutletNode).HumRat)); + Real64 ReqOutput = s_node->Node(cbvav.HeatCoilAirInletNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(DesOutTemp, s_node->Node(cbvav.HeatCoilAirOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(cbvav.HeatCoilAirInletNode).Temp, + s_node->Node(cbvav.HeatCoilAirOutletNode).HumRat)); Real64 loadAccuracy = 0.001; // Watts, power Real64 tempAccuracy = 0.001; // delta C, temperature @@ -3123,8 +3080,8 @@ namespace HVACUnitaryBypassVAV { QZnReq = 0.0; // call again with coil off VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::Off, LocalPartLoadFrac, @@ -3140,14 +3097,14 @@ namespace HVACUnitaryBypassVAV { } else { // Else find how the coil is modulating (speed level and speed ratio or part load between off and speed 1) to meet the load // OutletTempDXCoil is the full capacity outlet temperature at LocalPartLoadFrac = 1 from the CALL above. If this temp is // greater than the desired outlet temp, then run the compressor at LocalPartLoadFrac = 1, otherwise find the operating PLR. - Real64 OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(cBVAV.DXHeatCoilIndexNum).OutletAirDBTemp; + Real64 OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(cbvav.HeatCoilNum).OutletAirDBTemp; if (OutletTempDXCoil < DesOutTemp) { LocalPartLoadFrac = 1.0; SpeedNum = maxNumSpeeds; SpeedRatio = 1.0; VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -3163,8 +3120,8 @@ namespace HVACUnitaryBypassVAV { SpeedRatio = 1.0; QZnReq = 0.001; // to indicate the coil is running VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -3174,7 +3131,7 @@ namespace HVACUnitaryBypassVAV { QLatReq, LocalOnOffAirFlowRatio); - Real64 TempSpeedOut = state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).Temp; + Real64 TempSpeedOut = s_node->Node(cbvav.HeatCoilAirOutletNode).Temp; Real64 TempSpeedOutSpeed1 = TempSpeedOut; if ((TempSpeedOut - DesOutTemp) < tempAccuracy) { @@ -3184,8 +3141,8 @@ namespace HVACUnitaryBypassVAV { for (int I = 2; I <= maxNumSpeeds; ++I) { SpeedNum = I; VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -3195,7 +3152,7 @@ namespace HVACUnitaryBypassVAV { QLatReq, LocalOnOffAirFlowRatio); - TempSpeedOut = state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).Temp; + TempSpeedOut = s_node->Node(cbvav.HeatCoilAirOutletNode).Temp; if ((TempSpeedOut - DesOutTemp) > tempAccuracy) { SpeedNum = I; @@ -3203,22 +3160,22 @@ namespace HVACUnitaryBypassVAV { } } // now find the speed ratio for the found speednum - int const vsCoilIndex = cBVAV.DXHeatCoilIndexNum; - auto f = [&state, vsCoilIndex, DesOutTemp, SpeedNum](Real64 const x) { - return HVACDXHeatPumpSystem::VSCoilSpeedResidual(state, x, vsCoilIndex, DesOutTemp, SpeedNum, HVAC::FanOp::Continuous); + int const vsCoilNum = cbvav.HeatCoilNum; + auto f = [&state, vsCoilNum, DesOutTemp, SpeedNum](Real64 const x) { + return HVACDXHeatPumpSystem::VSCoilSpeedResidual(state, x, vsCoilNum, DesOutTemp, SpeedNum, HVAC::FanOp::Continuous); }; General::SolveRoot(state, tempAccuracy, MaxIte, SolFla, SpeedRatio, f, 1.0e-10, 1.0); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXHeatIterationExceeded < 4) { - ++cBVAV.DXHeatIterationExceeded; + if (cbvav.DXHeatIterationExceeded < 4) { + ++cbvav.DXHeatIterationExceeded; ShowWarningError(state, format("{} - Iteration limit exceeded calculating VS DX coil speed ratio for coil named {}, in " "Unitary system named{}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.HeatCoilName, - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName, + cbvav.Name)); ShowContinueError(state, format("Calculated speed ratio = {:.4R}", SpeedRatio)); ShowContinueErrorTimeStamp( state, "The calculated speed ratio will be used and the simulation continues. Occurrence info:"); @@ -3226,40 +3183,40 @@ namespace HVACUnitaryBypassVAV { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Iteration limit exceeded calculating speed ratio error continues. " "Speed Ratio statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.HeatCoilName), - cBVAV.DXHeatIterationExceededIndex, + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName), + cbvav.DXHeatIterationExceededIndex, LocalPartLoadFrac, LocalPartLoadFrac); } } else if (SolFla == -2) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXHeatIterationFailed < 4) { - ++cBVAV.DXHeatIterationFailed; + if (cbvav.DXHeatIterationFailed < 4) { + ++cbvav.DXHeatIterationFailed; ShowWarningError(state, format("{} - DX unit speed ratio calculation failed: solver limits exceeded, for coil named {}, " "in Unitary system named{}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.HeatCoilName, - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName, + cbvav.Name)); ShowContinueErrorTimeStamp(state, " Speed ratio will be set to 0.5, and the simulation continues. Occurrence info:"); } ShowRecurringWarningErrorAtEnd( state, format("{} \"{}\" - DX unit speed ratio calculation failed error continues. speed ratio statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.HeatCoilName), - cBVAV.DXHeatIterationFailedIndex, + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName), + cbvav.DXHeatIterationFailedIndex, SpeedRatio, SpeedRatio); } SpeedRatio = 0.5; } VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -3270,21 +3227,21 @@ namespace HVACUnitaryBypassVAV { LocalOnOffAirFlowRatio); } else { // cycling compressor at lowest speed number, find part load fraction - int VSCoilIndex = cBVAV.DXHeatCoilIndexNum; - auto f = [&state, VSCoilIndex, DesOutTemp](Real64 const x) { - return HVACDXHeatPumpSystem::VSCoilCyclingResidual(state, x, VSCoilIndex, DesOutTemp, HVAC::FanOp::Continuous); + int VSCoilNum = cbvav.HeatCoilNum; + auto f = [&state, VSCoilNum, DesOutTemp](Real64 const x) { + return HVACDXHeatPumpSystem::VSCoilCyclingResidual(state, x, VSCoilNum, DesOutTemp, HVAC::FanOp::Continuous); }; General::SolveRoot(state, tempAccuracy, MaxIte, SolFla, LocalPartLoadFrac, f, 1.0e-10, 1.0); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXHeatCyclingIterationExceeded < 4) { - ++cBVAV.DXHeatCyclingIterationExceeded; + if (cbvav.DXHeatCyclingIterationExceeded < 4) { + ++cbvav.DXHeatCyclingIterationExceeded; ShowWarningError(state, format("{} - Iteration limit exceeded calculating VS DX unit low speed cycling ratio, for coil " "named {}, in Unitary system named{}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.HeatCoilName, - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName, + cbvav.Name)); ShowContinueError(state, format("Estimated cycling ratio = {:.3R}", (DesOutTemp / TempSpeedOut))); ShowContinueError(state, format("Calculated cycling ratio = {:.3R}", LocalPartLoadFrac)); ShowContinueErrorTimeStamp( @@ -3293,21 +3250,21 @@ namespace HVACUnitaryBypassVAV { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Iteration limit exceeded calculating low speed cycling ratio " "error continues. Sensible PLR statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.HeatCoilName), - cBVAV.DXHeatCyclingIterationExceededIndex, + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName), + cbvav.DXHeatCyclingIterationExceededIndex, LocalPartLoadFrac, LocalPartLoadFrac); } } else if (SolFla == -2) { if (!state.dataGlobal->WarmupFlag) { - if (cBVAV.DXHeatCyclingIterationFailed < 4) { - ++cBVAV.DXHeatCyclingIterationFailed; + if (cbvav.DXHeatCyclingIterationFailed < 4) { + ++cbvav.DXHeatCyclingIterationFailed; ShowWarningError(state, format("{} - DX unit low speed cycling ratio calculation failed: limits exceeded, for unit = {}", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.Name)); + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.Name)); ShowContinueError(state, format("Estimated low speed cycling ratio = {:.3R}", (DesOutTemp - TempNoOutput) / (TempSpeedOutSpeed1 - TempNoOutput))); @@ -3317,17 +3274,17 @@ namespace HVACUnitaryBypassVAV { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - DX unit low speed cycling ratio calculation failed error " "continues. cycling ratio statistics follow.", - HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)], - cBVAV.HeatCoilName), - cBVAV.DXHeatCyclingIterationFailedIndex, + HVAC::coilTypeNames[(int)cbvav.heatCoilType], + cbvav.HeatCoilName), + cbvav.DXHeatCyclingIterationFailedIndex, LocalPartLoadFrac, LocalPartLoadFrac); } LocalPartLoadFrac = (DesOutTemp - TempNoOutput) / (TempSpeedOutSpeed1 - TempNoOutput); } VariableSpeedCoils::SimVariableSpeedCoils(state, - cBVAV.HeatCoilName, - cBVAV.DXHeatCoilIndexNum, + cbvav.HeatCoilName, + cbvav.HeatCoilNum, HVAC::FanOp::Continuous, HVAC::CompressorOp::On, LocalPartLoadFrac, @@ -3345,62 +3302,62 @@ namespace HVACUnitaryBypassVAV { } else if (LocalPartLoadFrac < 0.0) { LocalPartLoadFrac = 0.0; } - state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, cBVAV.DXHeatCoilIndexNum); + state.dataHVACUnitaryBypassVAV->SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, cbvav.HeatCoilNum); } break; case HVAC::CoilType::HeatingGasOrOtherFuel: case HVAC::CoilType::HeatingElectric: case HVAC::CoilType::HeatingWater: case HVAC::CoilType::HeatingSteam: { // not a DX heating coil - if (cBVAV.HeatCoolMode == HeatingMode) { - CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).HumRat); - QHeater = state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).MassFlowRate * CpAir * - (cBVAV.CoilTempSetPoint - state.dataLoopNodes->Node(cBVAV.HeatingCoilInletNode).Temp); + if (cbvav.HeatCoolMode == HeatingMode) { + CpAir = Psychrometrics::PsyCpAirFnW(s_node->Node(cbvav.HeatCoilAirInletNode).HumRat); + QHeater = s_node->Node(cbvav.HeatCoilAirInletNode).MassFlowRate * CpAir * + (cbvav.CoilTempSetPoint - s_node->Node(cbvav.HeatCoilAirInletNode).Temp); } else { QHeater = 0.0; } // Added None DX heating coils calling point - state.dataLoopNodes->Node(cBVAV.HeatingCoilOutletNode).TempSetPoint = cBVAV.CoilTempSetPoint; - CalcNonDXHeatingCoils(state, CBVAVNum, FirstHVACIteration, QHeater, cBVAV.fanOp, QHeaterActual); + s_node->Node(cbvav.HeatCoilAirOutletNode).TempSetPoint = cbvav.CoilTempSetPoint; + CalcNonDXHeatingCoils(state, CBVAVNum, FirstHVACIteration, QHeater, cbvav.fanOp, QHeaterActual); } break; default: { - ShowFatalError(state, format("SimCBVAV System: Invalid Heating Coil={}", HVAC::coilTypeNamesUC[static_cast(cBVAV.HeatCoilType)])); + ShowFatalError(state, format("SimCBVAV System: Invalid Heating Coil={}", HVAC::coilTypeNames[(int)cbvav.heatCoilType])); } break; } - if (cBVAV.fanPlace == HVAC::FanPlace::DrawThru) { - state.dataFans->fans(cBVAV.FanIndex) + if (cbvav.fanPlace == HVAC::FanPlace::DrawThru) { + state.dataFans->fans(cbvav.FanIndex) ->simulate(state, FirstHVACIteration, state.dataHVACUnitaryBypassVAV->FanSpeedRatio, _, 1.0 / OnOffAirFlowRatio, _); } - int splitterOutNode = cBVAV.SplitterOutletAirNode; - state.dataLoopNodes->Node(splitterOutNode).MassFlowRateSetPoint = state.dataLoopNodes->Node(OutletNode).MassFlowRateSetPoint; - state.dataLoopNodes->Node(OutletNode) = state.dataLoopNodes->Node(splitterOutNode); - state.dataLoopNodes->Node(OutletNode).TempSetPoint = cBVAV.OutletTempSetPoint; - state.dataLoopNodes->Node(OutletNode).MassFlowRate = - (1.0 - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction) * state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate; + int splitterOutNode = cbvav.SplitterOutletAirNode; + s_node->Node(splitterOutNode).MassFlowRateSetPoint = s_node->Node(OutletNode).MassFlowRateSetPoint; + s_node->Node(OutletNode) = s_node->Node(splitterOutNode); + s_node->Node(OutletNode).TempSetPoint = cbvav.OutletTempSetPoint; + s_node->Node(OutletNode).MassFlowRate = + (1.0 - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction) * s_node->Node(cbvav.MixerInletAirNode).MassFlowRate; // report variable - cBVAV.BypassMassFlowRate = - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate; + cbvav.BypassMassFlowRate = + state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * s_node->Node(cbvav.MixerInletAirNode).MassFlowRate; // initialize bypass duct connected to mixer or plenum with flow rate and conditions - if (cBVAV.plenumIndex > 0 || cBVAV.mixerIndex > 0) { - int plenumOrMixerInletNode = cBVAV.PlenumMixerInletAirNode; - state.dataLoopNodes->Node(plenumOrMixerInletNode) = state.dataLoopNodes->Node(splitterOutNode); - state.dataLoopNodes->Node(plenumOrMixerInletNode).MassFlowRate = - state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * state.dataLoopNodes->Node(cBVAV.MixerInletAirNode).MassFlowRate; - state.dataLoopNodes->Node(plenumOrMixerInletNode).MassFlowRateMaxAvail = state.dataLoopNodes->Node(plenumOrMixerInletNode).MassFlowRate; - state.dataAirLoop->AirLoopFlow(cBVAV.AirLoopNumber).BypassMassFlow = state.dataLoopNodes->Node(plenumOrMixerInletNode).MassFlowRate; + if (cbvav.plenumIndex > 0 || cbvav.mixerIndex > 0) { + int plenumOrMixerInletNode = cbvav.PlenumMixerInletAirNode; + s_node->Node(plenumOrMixerInletNode) = s_node->Node(splitterOutNode); + s_node->Node(plenumOrMixerInletNode).MassFlowRate = + state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction * s_node->Node(cbvav.MixerInletAirNode).MassFlowRate; + s_node->Node(plenumOrMixerInletNode).MassFlowRateMaxAvail = s_node->Node(plenumOrMixerInletNode).MassFlowRate; + state.dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).BypassMassFlow = s_node->Node(plenumOrMixerInletNode).MassFlowRate; } // calculate sensible load met using delta enthalpy at a constant (minimum) humidity ratio) - MinHumRat = min(state.dataLoopNodes->Node(InletNode).HumRat, state.dataLoopNodes->Node(OutletNode).HumRat); + MinHumRat = min(s_node->Node(InletNode).HumRat, s_node->Node(OutletNode).HumRat); LoadMet = - state.dataLoopNodes->Node(OutletNode).MassFlowRate * (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, MinHumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, MinHumRat)); + s_node->Node(OutletNode).MassFlowRate * (Psychrometrics::PsyHFnTdbW(s_node->Node(OutletNode).Temp, MinHumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(InletNode).Temp, MinHumRat)); // calculate OA fraction used for zone OA volume flow rate calc - state.dataAirLoop->AirLoopFlow(cBVAV.AirLoopNumber).OAFrac = 0.0; - if (state.dataLoopNodes->Node(cBVAV.AirOutNode).MassFlowRate > 0.0) { - state.dataAirLoop->AirLoopFlow(cBVAV.AirLoopNumber).OAFrac = - state.dataLoopNodes->Node(cBVAV.MixerOutsideAirNode).MassFlowRate / state.dataLoopNodes->Node(cBVAV.AirOutNode).MassFlowRate; + state.dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).OAFrac = 0.0; + if (s_node->Node(cbvav.AirOutNode).MassFlowRate > 0.0) { + state.dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).OAFrac = + s_node->Node(cbvav.MixerOutsideAirNode).MassFlowRate / s_node->Node(cbvav.AirOutNode).MassFlowRate; } } @@ -3421,33 +3378,33 @@ namespace HVACUnitaryBypassVAV { Real64 ZoneLoad = 0.0; // Total load in controlled zone [W] int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day - auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); int dayOfSim = state.dataGlobal->DayOfSim; // DayOfSim increments during Warmup when it actually simulates the same day if (state.dataGlobal->WarmupFlag) { // when warmupday increments then reset timer - if (lastDayOfSim != dayOfSim) cBVAV.changeOverTimer = -1.0; // reset to default (thisTime always > -1) + if (lastDayOfSim != dayOfSim) cbvav.changeOverTimer = -1.0; // reset to default (thisTime always > -1) lastDayOfSim = dayOfSim; dayOfSim = 1; // reset so that thisTime is <= 24 during warmup } Real64 thisTime = (dayOfSim - 1) * 24 + state.dataGlobal->HourOfDay - 1 + (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed; - if (thisTime <= cBVAV.changeOverTimer) { - cBVAV.modeChanged = true; + if (thisTime <= cbvav.changeOverTimer) { + cbvav.modeChanged = true; return; } Real64 QZoneReqCool = 0.0; // Total cooling load in all controlled zones [W] Real64 QZoneReqHeat = 0.0; // Total heating load in all controlled zones [W] - cBVAV.NumZonesCooled = 0; - cBVAV.NumZonesHeated = 0; - cBVAV.HeatCoolMode = 0; - - for (int ZoneNum = 1; ZoneNum <= cBVAV.NumControlledZones; ++ZoneNum) { - int actualZoneNum = cBVAV.ControlledZoneNum(ZoneNum); - int coolSeqNum = cBVAV.ZoneSequenceCoolingNum(ZoneNum); - int heatSeqNum = cBVAV.ZoneSequenceHeatingNum(ZoneNum); + cbvav.NumZonesCooled = 0; + cbvav.NumZonesHeated = 0; + cbvav.HeatCoolMode = 0; + + for (int ZoneNum = 1; ZoneNum <= cbvav.NumControlledZones; ++ZoneNum) { + int actualZoneNum = cbvav.ControlledZoneNum(ZoneNum); + int coolSeqNum = cbvav.ZoneSequenceCoolingNum(ZoneNum); + int heatSeqNum = cbvav.ZoneSequenceHeatingNum(ZoneNum); if (coolSeqNum > 0 && heatSeqNum > 0) { Real64 ZoneLoadToCoolSPSequenced = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(actualZoneNum).SequencedOutputRequiredToCoolingSP(coolSeqNum); @@ -3467,74 +3424,74 @@ namespace HVACUnitaryBypassVAV { if (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(actualZoneNum)) { if (ZoneLoad > HVAC::SmallLoad) { QZoneReqHeat += ZoneLoad; - ++cBVAV.NumZonesHeated; + ++cbvav.NumZonesHeated; } else if (ZoneLoad < -HVAC::SmallLoad) { QZoneReqCool += ZoneLoad; - ++cBVAV.NumZonesCooled; + ++cbvav.NumZonesCooled; } } } - switch (cBVAV.PriorityControl) { + switch (cbvav.PriorityControl) { case PriorityCtrlMode::CoolingPriority: { if (QZoneReqCool < 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } else if (QZoneReqHeat > 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } } break; case PriorityCtrlMode::HeatingPriority: { if (QZoneReqHeat > 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } else if (QZoneReqCool < 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } } break; case PriorityCtrlMode::ZonePriority: { - if (cBVAV.NumZonesHeated > cBVAV.NumZonesCooled) { + if (cbvav.NumZonesHeated > cbvav.NumZonesCooled) { if (QZoneReqHeat > 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } else if (QZoneReqCool < 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } - } else if (cBVAV.NumZonesCooled > cBVAV.NumZonesHeated) { + } else if (cbvav.NumZonesCooled > cbvav.NumZonesHeated) { if (QZoneReqCool < 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } else if (QZoneReqHeat > 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } } else { if (std::abs(QZoneReqCool) > std::abs(QZoneReqHeat) && QZoneReqCool != 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } else if (std::abs(QZoneReqCool) < std::abs(QZoneReqHeat) && QZoneReqHeat != 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } else if (std::abs(QZoneReqCool) == std::abs(QZoneReqHeat) && QZoneReqCool != 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } } } break; case PriorityCtrlMode::LoadPriority: { if (std::abs(QZoneReqCool) > std::abs(QZoneReqHeat) && QZoneReqCool != 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } else if (std::abs(QZoneReqCool) < std::abs(QZoneReqHeat) && QZoneReqHeat != 0.0) { - cBVAV.HeatCoolMode = HeatingMode; - } else if (cBVAV.NumZonesHeated > cBVAV.NumZonesCooled) { + cbvav.HeatCoolMode = HeatingMode; + } else if (cbvav.NumZonesHeated > cbvav.NumZonesCooled) { if (QZoneReqHeat > 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } else if (QZoneReqCool < 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } - } else if (cBVAV.NumZonesHeated < cBVAV.NumZonesCooled) { + } else if (cbvav.NumZonesHeated < cbvav.NumZonesCooled) { if (QZoneReqCool < 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } else if (QZoneReqHeat > 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } } else { if (QZoneReqCool < 0.0) { - cBVAV.HeatCoolMode = CoolingMode; + cbvav.HeatCoolMode = CoolingMode; } else if (QZoneReqHeat > 0.0) { - cBVAV.HeatCoolMode = HeatingMode; + cbvav.HeatCoolMode = HeatingMode; } } break; @@ -3543,10 +3500,10 @@ namespace HVACUnitaryBypassVAV { } } - if (cBVAV.LastMode != cBVAV.HeatCoolMode) { - cBVAV.changeOverTimer = thisTime + cBVAV.minModeChangeTime; - cBVAV.LastMode = cBVAV.HeatCoolMode; - cBVAV.modeChanged = true; + if (cbvav.LastMode != cbvav.HeatCoolMode) { + cbvav.changeOverTimer = thisTime + cbvav.minModeChangeTime; + cbvav.LastMode = cbvav.HeatCoolMode; + cbvav.modeChanged = true; } } @@ -3575,28 +3532,29 @@ namespace HVACUnitaryBypassVAV { Real64 SupplyAirTempToHeatSetPt; // Supply air temperature required to reach the heating setpoint [C] Real64 SupplyAirTempToCoolSetPt; // Supply air temperature required to reach the cooling setpoint [C] - auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNumber); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNumber); - Real64 DXCoolCoilInletTemp = state.dataLoopNodes->Node(cBVAV.DXCoilInletNode).Temp; - Real64 OutAirTemp = state.dataLoopNodes->Node(cBVAV.AirOutNode).Temp; - Real64 OutAirHumRat = state.dataLoopNodes->Node(cBVAV.AirOutNode).HumRat; + Real64 DXCoolCoilInletTemp = s_node->Node(cbvav.CoolCoilAirInletNode).Temp; + Real64 OutAirTemp = s_node->Node(cbvav.AirOutNode).Temp; + Real64 OutAirHumRat = s_node->Node(cbvav.AirOutNode).HumRat; - if (cBVAV.HeatCoolMode == CoolingMode) { // Cooling required + if (cbvav.HeatCoolMode == CoolingMode) { // Cooling required CalcSetPointTempTarget = 99999.0; - } else if (cBVAV.HeatCoolMode == HeatingMode) { // Heating required + } else if (cbvav.HeatCoolMode == HeatingMode) { // Heating required CalcSetPointTempTarget = -99999.0; } Real64 TSupplyToHeatSetPtMax = -99999.0; // Maximum of the supply air temperatures required to reach the heating setpoint [C] Real64 TSupplyToCoolSetPtMin = 99999.0; // Minimum of the supply air temperatures required to reach the cooling setpoint [C] - for (int ZoneNum = 1; ZoneNum <= cBVAV.NumControlledZones; ++ZoneNum) { - int ZoneNodeNum = cBVAV.ControlledZoneNodeNum(ZoneNum); - int BoxOutletNodeNum = cBVAV.CBVAVBoxOutletNode(ZoneNum); - if ((cBVAV.ZoneSequenceCoolingNum(ZoneNum) > 0) && (cBVAV.ZoneSequenceHeatingNum(ZoneNum) > 0)) { - QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)) - .SequencedOutputRequiredToCoolingSP(cBVAV.ZoneSequenceCoolingNum(ZoneNum)); - QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)) - .SequencedOutputRequiredToHeatingSP(cBVAV.ZoneSequenceHeatingNum(ZoneNum)); + for (int ZoneNum = 1; ZoneNum <= cbvav.NumControlledZones; ++ZoneNum) { + int ZoneNodeNum = cbvav.ControlledZoneNodeNum(ZoneNum); + int BoxOutletNodeNum = cbvav.CBVAVBoxOutletNode(ZoneNum); + if ((cbvav.ZoneSequenceCoolingNum(ZoneNum) > 0) && (cbvav.ZoneSequenceHeatingNum(ZoneNum) > 0)) { + QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)) + .SequencedOutputRequiredToCoolingSP(cbvav.ZoneSequenceCoolingNum(ZoneNum)); + QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)) + .SequencedOutputRequiredToHeatingSP(cbvav.ZoneSequenceHeatingNum(ZoneNum)); if (QToHeatSetPt > 0.0 && QToCoolSetPt > 0.0) { ZoneLoad = QToHeatSetPt; } else if (QToHeatSetPt < 0.0 && QToCoolSetPt < 0.0) { @@ -3605,44 +3563,44 @@ namespace HVACUnitaryBypassVAV { ZoneLoad = 0.0; } } else { - ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)).RemainingOutputRequired; - QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)).OutputRequiredToCoolingSP; - QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)).OutputRequiredToHeatingSP; + ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)).RemainingOutputRequired; + QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)).OutputRequiredToCoolingSP; + QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)).OutputRequiredToHeatingSP; } Real64 CpSupplyAir = Psychrometrics::PsyCpAirFnW(OutAirHumRat); // Find the supply air temperature that will force the box to full flow if (BoxOutletNodeNum > 0) { - if (state.dataLoopNodes->Node(BoxOutletNodeNum).MassFlowRateMax == 0.0) { - SupplyAirTemp = state.dataLoopNodes->Node(ZoneNodeNum).Temp; + if (s_node->Node(BoxOutletNodeNum).MassFlowRateMax == 0.0) { + SupplyAirTemp = s_node->Node(ZoneNodeNum).Temp; } else { // The target supply air temperature is based on current zone temp and load and max box flow rate - SupplyAirTemp = state.dataLoopNodes->Node(ZoneNodeNum).Temp + - ZoneLoad / (CpSupplyAir * state.dataLoopNodes->Node(BoxOutletNodeNum).MassFlowRateMax); + SupplyAirTemp = s_node->Node(ZoneNodeNum).Temp + + ZoneLoad / (CpSupplyAir * s_node->Node(BoxOutletNodeNum).MassFlowRateMax); } } else { - SupplyAirTemp = state.dataLoopNodes->Node(ZoneNodeNum).Temp; + SupplyAirTemp = s_node->Node(ZoneNodeNum).Temp; } // Save the MIN (cooling) or MAX (heating) temperature for coil control // One box will always operate at maximum damper position minimizing overall system energy use - if (cBVAV.HeatCoolMode == CoolingMode) { + if (cbvav.HeatCoolMode == CoolingMode) { CalcSetPointTempTarget = min(SupplyAirTemp, CalcSetPointTempTarget); - } else if (cBVAV.HeatCoolMode == HeatingMode) { + } else if (cbvav.HeatCoolMode == HeatingMode) { CalcSetPointTempTarget = max(SupplyAirTemp, CalcSetPointTempTarget); } else { // Should use CpAirAtCoolSetPoint or CpAirAtHeatSetPoint here? // If so, use ZoneThermostatSetPointLo(ZoneNum) and ZoneThermostatSetPointHi(ZoneNum) // along with the zone humidity ratio - if (state.dataLoopNodes->Node(BoxOutletNodeNum).MassFlowRateMax == 0.0) { - SupplyAirTempToHeatSetPt = state.dataLoopNodes->Node(ZoneNodeNum).Temp; - SupplyAirTempToCoolSetPt = state.dataLoopNodes->Node(ZoneNodeNum).Temp; + if (s_node->Node(BoxOutletNodeNum).MassFlowRateMax == 0.0) { + SupplyAirTempToHeatSetPt = s_node->Node(ZoneNodeNum).Temp; + SupplyAirTempToCoolSetPt = s_node->Node(ZoneNodeNum).Temp; } else { - SupplyAirTempToHeatSetPt = state.dataLoopNodes->Node(ZoneNodeNum).Temp + - QToHeatSetPt / (CpSupplyAir * state.dataLoopNodes->Node(BoxOutletNodeNum).MassFlowRateMax); - SupplyAirTempToCoolSetPt = state.dataLoopNodes->Node(ZoneNodeNum).Temp + - QToCoolSetPt / (CpSupplyAir * state.dataLoopNodes->Node(BoxOutletNodeNum).MassFlowRateMax); + SupplyAirTempToHeatSetPt = s_node->Node(ZoneNodeNum).Temp + + QToHeatSetPt / (CpSupplyAir * s_node->Node(BoxOutletNodeNum).MassFlowRateMax); + SupplyAirTempToCoolSetPt = s_node->Node(ZoneNodeNum).Temp + + QToCoolSetPt / (CpSupplyAir * s_node->Node(BoxOutletNodeNum).MassFlowRateMax); } TSupplyToHeatSetPtMax = max(SupplyAirTempToHeatSetPt, TSupplyToHeatSetPtMax); TSupplyToCoolSetPtMin = min(SupplyAirTempToCoolSetPt, TSupplyToCoolSetPtMin); @@ -3650,8 +3608,8 @@ namespace HVACUnitaryBypassVAV { } // Account for floating condition where cooling/heating is required to avoid overshooting setpoint - if (cBVAV.HeatCoolMode == 0) { - if (cBVAV.fanOp == HVAC::FanOp::Continuous) { + if (cbvav.HeatCoolMode == 0) { + if (cbvav.fanOp == HVAC::FanOp::Continuous) { if (OutAirTemp > TSupplyToCoolSetPtMin) { CalcSetPointTempTarget = TSupplyToCoolSetPtMin; } else if (OutAirTemp < TSupplyToHeatSetPtMax) { @@ -3660,19 +3618,19 @@ namespace HVACUnitaryBypassVAV { CalcSetPointTempTarget = OutAirTemp; } } else { // Reset setpoint to inlet air temp if unit is OFF and in cycling fan mode - CalcSetPointTempTarget = state.dataLoopNodes->Node(cBVAV.AirInNode).Temp; + CalcSetPointTempTarget = s_node->Node(cbvav.AirInNode).Temp; } // Reset cooling/heating mode to OFF if mixed air inlet temperature is below/above setpoint temperature. // HeatCoolMode = 0 for OFF, 1 for cooling, 2 for heating - } else if (cBVAV.HeatCoolMode == CoolingMode) { + } else if (cbvav.HeatCoolMode == CoolingMode) { if (DXCoolCoilInletTemp < CalcSetPointTempTarget) CalcSetPointTempTarget = DXCoolCoilInletTemp; - } else if (cBVAV.HeatCoolMode == HeatingMode) { + } else if (cbvav.HeatCoolMode == HeatingMode) { if (DXCoolCoilInletTemp > CalcSetPointTempTarget) CalcSetPointTempTarget = DXCoolCoilInletTemp; } // Limit outlet node temperature to MAX/MIN specified in input - if (CalcSetPointTempTarget < cBVAV.MinLATCooling) CalcSetPointTempTarget = cBVAV.MinLATCooling; - if (CalcSetPointTempTarget > cBVAV.MaxLATHeating) CalcSetPointTempTarget = cBVAV.MaxLATHeating; + if (CalcSetPointTempTarget < cbvav.MinLATCooling) CalcSetPointTempTarget = cbvav.MinLATCooling; + if (CalcSetPointTempTarget > cbvav.MaxLATHeating) CalcSetPointTempTarget = cbvav.MaxLATHeating; return CalcSetPointTempTarget; } @@ -3695,26 +3653,27 @@ namespace HVACUnitaryBypassVAV { Real64 ZoneMassFlow; // Zone mass flow rate required to meet zone load [kg/s] Real64 ZoneLoad; // Zone load calculated by ZoneTempPredictor [W] - auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &s_node = state.dataLoopNodes; + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); - int InletNode = cBVAV.AirInNode; // Inlet node number for CBVAVNum - int OutletNode = cBVAV.AirOutNode; // Outlet node number for CBVAVNum - int MixerMixedAirNode = cBVAV.MixerMixedAirNode; // Mixed air node number in OA mixer - int MixerOutsideAirNode = cBVAV.MixerOutsideAirNode; // Outside air node number in OA mixer - int MixerReliefAirNode = cBVAV.MixerReliefAirNode; // Relief air node number in OA mixer - int MixerInletAirNode = cBVAV.MixerInletAirNode; // Inlet air node number in OA mixer + int InletNode = cbvav.AirInNode; // Inlet node number for CBVAVNum + int OutletNode = cbvav.AirOutNode; // Outlet node number for CBVAVNum + int MixerMixedAirNode = cbvav.MixerMixedAirNode; // Mixed air node number in OA mixer + int MixerOutsideAirNode = cbvav.MixerOutsideAirNode; // Outside air node number in OA mixer + int MixerReliefAirNode = cbvav.MixerReliefAirNode; // Relief air node number in OA mixer + int MixerInletAirNode = cbvav.MixerInletAirNode; // Inlet air node number in OA mixer Real64 SystemMassFlow = 0.0; // System mass flow rate required for all zones [kg/s] - Real64 CpSupplyAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(OutletNode).HumRat); // Specific heat of outlet air [J/kg-K] + Real64 CpSupplyAir = Psychrometrics::PsyCpAirFnW(s_node->Node(OutletNode).HumRat); // Specific heat of outlet air [J/kg-K] // Determine zone air flow - for (int ZoneNum = 1; ZoneNum <= cBVAV.NumControlledZones; ++ZoneNum) { - int ZoneNodeNum = cBVAV.ControlledZoneNodeNum(ZoneNum); - int BoxOutletNodeNum = cBVAV.CBVAVBoxOutletNode(ZoneNum); // Zone supply air inlet node number - if ((cBVAV.ZoneSequenceCoolingNum(ZoneNum) > 0) && (cBVAV.ZoneSequenceHeatingNum(ZoneNum) > 0)) { - Real64 QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)) - .SequencedOutputRequiredToCoolingSP(cBVAV.ZoneSequenceCoolingNum(ZoneNum)); - Real64 QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)) - .SequencedOutputRequiredToHeatingSP(cBVAV.ZoneSequenceHeatingNum(ZoneNum)); + for (int ZoneNum = 1; ZoneNum <= cbvav.NumControlledZones; ++ZoneNum) { + int ZoneNodeNum = cbvav.ControlledZoneNodeNum(ZoneNum); + int BoxOutletNodeNum = cbvav.CBVAVBoxOutletNode(ZoneNum); // Zone supply air inlet node number + if ((cbvav.ZoneSequenceCoolingNum(ZoneNum) > 0) && (cbvav.ZoneSequenceHeatingNum(ZoneNum) > 0)) { + Real64 QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)) + .SequencedOutputRequiredToCoolingSP(cbvav.ZoneSequenceCoolingNum(ZoneNum)); + Real64 QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)) + .SequencedOutputRequiredToHeatingSP(cbvav.ZoneSequenceHeatingNum(ZoneNum)); if (QToHeatSetPt > 0.0 && QToCoolSetPt > 0.0) { ZoneLoad = QToHeatSetPt; } else if (QToHeatSetPt < 0.0 && QToCoolSetPt < 0.0) { @@ -3723,10 +3682,10 @@ namespace HVACUnitaryBypassVAV { ZoneLoad = 0.0; } } else { - ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cBVAV.ControlledZoneNum(ZoneNum)).RemainingOutputRequired; + ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(cbvav.ControlledZoneNum(ZoneNum)).RemainingOutputRequired; } - Real64 CpZoneAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNodeNum).HumRat); - Real64 DeltaCpTemp = CpSupplyAir * state.dataLoopNodes->Node(OutletNode).Temp - CpZoneAir * state.dataLoopNodes->Node(ZoneNodeNum).Temp; + Real64 CpZoneAir = Psychrometrics::PsyCpAirFnW(s_node->Node(ZoneNodeNum).HumRat); + Real64 DeltaCpTemp = CpSupplyAir * s_node->Node(OutletNode).Temp - CpZoneAir * s_node->Node(ZoneNodeNum).Temp; // Need to check DeltaCpTemp and ensure that it is not zero if (DeltaCpTemp != 0.0) { // .AND. .NOT. CurDeadBandOrSetback(ZoneNum))THEN @@ -3735,32 +3694,32 @@ namespace HVACUnitaryBypassVAV { // reset to 0 so we don't add in the last zone's mass flow rate ZoneMassFlow = 0.0; } - SystemMassFlow += max(state.dataLoopNodes->Node(BoxOutletNodeNum).MassFlowRateMin, - min(ZoneMassFlow, state.dataLoopNodes->Node(BoxOutletNodeNum).MassFlowRateMax)); + SystemMassFlow += max(s_node->Node(BoxOutletNodeNum).MassFlowRateMin, + min(ZoneMassFlow, s_node->Node(BoxOutletNodeNum).MassFlowRateMax)); } Real64 AverageUnitMassFlow = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; Real64 AverageOAMassFlow = state.dataHVACUnitaryBypassVAV->OACompOnMassFlow; state.dataHVACUnitaryBypassVAV->FanSpeedRatio = state.dataHVACUnitaryBypassVAV->CompOnFlowRatio; - state.dataLoopNodes->Node(MixerInletAirNode) = state.dataLoopNodes->Node(InletNode); + s_node->Node(MixerInletAirNode) = s_node->Node(InletNode); - state.dataLoopNodes->Node(MixerMixedAirNode).MassFlowRateMin = 0.0; + s_node->Node(MixerMixedAirNode).MassFlowRateMin = 0.0; - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) == 0.0 || AverageUnitMassFlow == 0.0) { - state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(MixerReliefAirNode).MassFlowRate = 0.0; + if (ScheduleManager::GetCurrentScheduleValue(state, cbvav.SchedPtr) == 0.0 || AverageUnitMassFlow == 0.0) { + s_node->Node(InletNode).MassFlowRate = 0.0; + s_node->Node(MixerOutsideAirNode).MassFlowRate = 0.0; + s_node->Node(MixerReliefAirNode).MassFlowRate = 0.0; OnOffAirFlowRatio = 0.0; state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction = 0.0; } else { - state.dataLoopNodes->Node(MixerInletAirNode).MassFlowRate = AverageUnitMassFlow; - state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRate = AverageOAMassFlow; - state.dataLoopNodes->Node(MixerReliefAirNode).MassFlowRate = AverageOAMassFlow; + s_node->Node(MixerInletAirNode).MassFlowRate = AverageUnitMassFlow; + s_node->Node(MixerOutsideAirNode).MassFlowRate = AverageOAMassFlow; + s_node->Node(MixerReliefAirNode).MassFlowRate = AverageOAMassFlow; OnOffAirFlowRatio = 1.0; Real64 boxOutletNodeFlow = 0.0; - for (int i = 1; i <= cBVAV.NumControlledZones; ++i) { - boxOutletNodeFlow += state.dataLoopNodes->Node(cBVAV.CBVAVBoxOutletNode(i)).MassFlowRate; + for (int i = 1; i <= cbvav.NumControlledZones; ++i) { + boxOutletNodeFlow += s_node->Node(cbvav.CBVAVBoxOutletNode(i)).MassFlowRate; } state.dataHVACUnitaryBypassVAV->BypassDuctFlowFraction = max(0.0, 1.0 - (boxOutletNodeFlow / AverageUnitMassFlow)); } @@ -3776,21 +3735,21 @@ namespace HVACUnitaryBypassVAV { // PURPOSE OF THIS SUBROUTINE: // Fills some of the report variables for the changeover-bypass VAV system - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); Real64 ReportingConstant = state.dataHVACGlobal->TimeStepSysSec; - thisCBVAV.TotCoolEnergy = thisCBVAV.TotCoolEnergyRate * ReportingConstant; - thisCBVAV.TotHeatEnergy = thisCBVAV.TotHeatEnergyRate * ReportingConstant; - thisCBVAV.SensCoolEnergy = thisCBVAV.SensCoolEnergyRate * ReportingConstant; - thisCBVAV.SensHeatEnergy = thisCBVAV.SensHeatEnergyRate * ReportingConstant; - thisCBVAV.LatCoolEnergy = thisCBVAV.LatCoolEnergyRate * ReportingConstant; - thisCBVAV.LatHeatEnergy = thisCBVAV.LatHeatEnergyRate * ReportingConstant; - thisCBVAV.ElecConsumption = thisCBVAV.ElecPower * ReportingConstant; + cbvav.TotCoolEnergy = cbvav.TotCoolEnergyRate * ReportingConstant; + cbvav.TotHeatEnergy = cbvav.TotHeatEnergyRate * ReportingConstant; + cbvav.SensCoolEnergy = cbvav.SensCoolEnergyRate * ReportingConstant; + cbvav.SensHeatEnergy = cbvav.SensHeatEnergyRate * ReportingConstant; + cbvav.LatCoolEnergy = cbvav.LatCoolEnergyRate * ReportingConstant; + cbvav.LatHeatEnergy = cbvav.LatHeatEnergyRate * ReportingConstant; + cbvav.ElecConsumption = cbvav.ElecPower * ReportingConstant; - if (thisCBVAV.FirstPass) { + if (cbvav.FirstPass) { if (!state.dataGlobal->SysSizingCalc) { - DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, state.dataSize->CurSysNum, thisCBVAV.FirstPass); + DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, state.dataSize->CurSysNum, cbvav.FirstPass); } } @@ -3830,33 +3789,33 @@ namespace HVACUnitaryBypassVAV { Real64 QCoilActual = 0.0; // actual heating load met - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); if (HeatCoilLoad > HVAC::SmallLoad) { - switch (thisCBVAV.HeatCoilType) { + switch (cbvav.heatCoilType) { case HVAC::CoilType::HeatingGasOrOtherFuel: case HVAC::CoilType::HeatingElectric: { HeatingCoils::SimulateHeatingCoilComponents( - state, thisCBVAV.HeatCoilName, FirstHVACIteration, HeatCoilLoad, thisCBVAV.HeatCoilIndex, QCoilActual, false, fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, HeatCoilLoad, cbvav.HeatCoilNum, QCoilActual, false, fanOp); } break; case HVAC::CoilType::HeatingWater: { // simulate the heating coil at maximum hot water flow rate - MaxHotWaterFlow = thisCBVAV.MaxHeatCoilFluidFlow; - PlantUtilities::SetComponentFlowRate(state, MaxHotWaterFlow, thisCBVAV.CoilControlNode, thisCBVAV.CoilOutletNode, thisCBVAV.plantLoc); + MaxHotWaterFlow = cbvav.MaxHeatCoilFluidFlow; + PlantUtilities::SetComponentFlowRate(state, MaxHotWaterFlow, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode, cbvav.HeatCoilPlantLoc); WaterCoils::SimulateWaterCoilComponents( - state, thisCBVAV.HeatCoilName, FirstHVACIteration, thisCBVAV.HeatCoilIndex, QCoilActual, fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum, QCoilActual, fanOp); if (QCoilActual > (HeatCoilLoad + HVAC::SmallLoad)) { // control water flow to obtain output matching HeatCoilLoad int SolFlag = 0; MinWaterFlow = 0.0; auto f = [&state, CBVAVNum, FirstHVACIteration, HeatCoilLoad](Real64 const HWFlow) { - auto &thiscBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto &cbvav = state.dataHVACUnitaryBypassVAV->CBVAVs(CBVAVNum); Real64 QCoilActual = HeatCoilLoad; Real64 mdot = HWFlow; - PlantUtilities::SetComponentFlowRate(state, mdot, thiscBVAV.CoilControlNode, thiscBVAV.CoilOutletNode, thiscBVAV.plantLoc); + PlantUtilities::SetComponentFlowRate(state, mdot, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode, cbvav.HeatCoilPlantLoc); // simulate the hot water supplemental heating coil WaterCoils::SimulateWaterCoilComponents( - state, thiscBVAV.HeatCoilName, FirstHVACIteration, thiscBVAV.HeatCoilIndex, QCoilActual, thiscBVAV.fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum, QCoilActual, cbvav.fanOp); if (HeatCoilLoad != 0.0) { return (QCoilActual - HeatCoilLoad) / HeatCoilLoad; } else { // Autodesk:Return Condition added to assure return value is set @@ -3865,10 +3824,10 @@ namespace HVACUnitaryBypassVAV { }; General::SolveRoot(state, ErrTolerance, SolveMaxIter, SolFlag, HotWaterMdot, f, MinWaterFlow, MaxHotWaterFlow); if (SolFlag == -1) { - if (thisCBVAV.HotWaterCoilMaxIterIndex == 0) { + if (cbvav.HotWaterCoilMaxIterIndex == 0) { ShowWarningMessage( state, - format("CalcNonDXHeatingCoils: Hot water coil control failed for {}=\"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); + format("CalcNonDXHeatingCoils: Hot water coil control failed for {}=\"{}\"", cbvav.UnitType, cbvav.Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating hot water mass flow rate", SolveMaxIter)); } @@ -3876,15 +3835,15 @@ namespace HVACUnitaryBypassVAV { state, format("CalcNonDXHeatingCoils: Hot water coil control failed (iteration limit [{}]) for {}=\"{}", SolveMaxIter, - thisCBVAV.UnitType, - thisCBVAV.Name), - thisCBVAV.HotWaterCoilMaxIterIndex); + cbvav.UnitType, + cbvav.Name), + cbvav.HotWaterCoilMaxIterIndex); } else if (SolFlag == -2) { - if (thisCBVAV.HotWaterCoilMaxIterIndex2 == 0) { + if (cbvav.HotWaterCoilMaxIterIndex2 == 0) { ShowWarningMessage(state, format("CalcNonDXHeatingCoils: Hot water coil control failed (maximum flow limits) for {}=\"{}\"", - thisCBVAV.UnitType, - thisCBVAV.Name)); + cbvav.UnitType, + cbvav.Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, "...Bad hot water maximum flow rate limits"); ShowContinueError(state, format("...Given minimum water flow rate={:.3R} kg/s", MinWaterFlow)); @@ -3892,8 +3851,8 @@ namespace HVACUnitaryBypassVAV { } ShowRecurringWarningErrorAtEnd(state, "CalcNonDXHeatingCoils: Hot water coil control failed (flow limits) for " + - thisCBVAV.UnitType + "=\"" + thisCBVAV.Name + "\"", - thisCBVAV.HotWaterCoilMaxIterIndex2, + cbvav.UnitType + "=\"" + cbvav.Name + "\"", + cbvav.HotWaterCoilMaxIterIndex2, MaxHotWaterFlow, MinWaterFlow, _, @@ -3904,41 +3863,41 @@ namespace HVACUnitaryBypassVAV { QCoilActual = HeatCoilLoad; // simulate the hot water heating coil WaterCoils::SimulateWaterCoilComponents( - state, thisCBVAV.HeatCoilName, FirstHVACIteration, thisCBVAV.HeatCoilIndex, QCoilActual, fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum, QCoilActual, fanOp); } } break; case HVAC::CoilType::HeatingSteam: { - mdot = thisCBVAV.MaxHeatCoilFluidFlow; - PlantUtilities::SetComponentFlowRate(state, mdot, thisCBVAV.CoilControlNode, thisCBVAV.CoilOutletNode, thisCBVAV.plantLoc); + mdot = cbvav.MaxHeatCoilFluidFlow; + PlantUtilities::SetComponentFlowRate(state, mdot, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode, cbvav.HeatCoilPlantLoc); // simulate the steam heating coil SteamCoils::SimulateSteamCoilComponents( - state, thisCBVAV.HeatCoilName, FirstHVACIteration, thisCBVAV.HeatCoilIndex, HeatCoilLoad, QCoilActual, fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum, HeatCoilLoad, QCoilActual, fanOp); } break; default: break; } } else { - switch (thisCBVAV.HeatCoilType) { + switch (cbvav.heatCoilType) { case HVAC::CoilType::HeatingGasOrOtherFuel: case HVAC::CoilType::HeatingElectric: { HeatingCoils::SimulateHeatingCoilComponents( - state, thisCBVAV.HeatCoilName, FirstHVACIteration, HeatCoilLoad, thisCBVAV.HeatCoilIndex, QCoilActual, false, fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, HeatCoilLoad, cbvav.HeatCoilNum, QCoilActual, false, fanOp); } break; case HVAC::CoilType::HeatingWater: { mdot = 0.0; - PlantUtilities::SetComponentFlowRate(state, mdot, thisCBVAV.CoilControlNode, thisCBVAV.CoilOutletNode, thisCBVAV.plantLoc); + PlantUtilities::SetComponentFlowRate(state, mdot, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode, cbvav.HeatCoilPlantLoc); QCoilActual = HeatCoilLoad; // simulate the hot water heating coil WaterCoils::SimulateWaterCoilComponents( - state, thisCBVAV.HeatCoilName, FirstHVACIteration, thisCBVAV.HeatCoilIndex, QCoilActual, fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum, QCoilActual, fanOp); } break; case HVAC::CoilType::HeatingSteam: { mdot = 0.0; - PlantUtilities::SetComponentFlowRate(state, mdot, thisCBVAV.CoilControlNode, thisCBVAV.CoilOutletNode, thisCBVAV.plantLoc); + PlantUtilities::SetComponentFlowRate(state, mdot, cbvav.HeatCoilControlNode, cbvav.HeatCoilFluidOutletNode, cbvav.HeatCoilPlantLoc); // simulate the steam heating coil SteamCoils::SimulateSteamCoilComponents( - state, thisCBVAV.HeatCoilName, FirstHVACIteration, thisCBVAV.HeatCoilIndex, HeatCoilLoad, QCoilActual, fanOp); + state, cbvav.HeatCoilName, FirstHVACIteration, cbvav.HeatCoilNum, HeatCoilLoad, QCoilActual, fanOp); } break; default: break; diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.hh b/src/EnergyPlus/HVACUnitaryBypassVAV.hh index d85ee8939f7..baf7c2e3aaa 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.hh +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.hh @@ -145,18 +145,28 @@ namespace HVACUnitaryBypassVAV { Real64 CoolingSpeedRatio = 1.0; // Fan speed ratio in cooling mode Real64 NoHeatCoolSpeedRatio = 1.0; // Fan speed ratio when no cooling or heating bool CheckFanFlow = true; // Check fan volumetric flow versus system flow in init routine. - std::string DXCoolCoilName; // Name of DX cooling coil - HVAC::CoilType CoolCoilType = HVAC::CoilType::Invalid; - int CoolCoilCompIndex = 0; // cooling coil component index number - int DXCoolCoilIndexNum = 0; // actual DX cooling coil index number - int DXHeatCoilIndexNum = 0; // actual DX heating coil index number - std::string HeatCoilName; // Name of heating coil - HVAC::CoilType HeatCoilType = HVAC::CoilType::Invalid; - int HeatCoilIndex = 0; // DX heating coil index number HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation - int CoilControlNode = 0; // heating coil hot water or steam inlet node - int CoilOutletNode = 0; // outlet node for hot water and steam coil - PlantLocation plantLoc; // plant loop component location object for water heating coil + + std::string CoolCoilName; // Name of DX cooling coil + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; + int CoolCoilNum = 0; // cooling coil component index number + int CoolCoilAirInletNode = 0; // Inlet node number of DX cooling coil + int CoolCoilAirOutletNode = 0; // Outlet node number of DX cooling coil + + // For HXAssisted coils, these are the for the "parent" object while the variables above are for the child object + std::string hxCoolCoilName; + HVAC::CoilType hxCoolCoilType = HVAC::CoilType::Invalid; + int hxCoolCoilNum = 0; + + std::string HeatCoilName; // Name of heating coil + HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; + int HeatCoilNum = 0; // DX heating coil index number + int HeatCoilAirInletNode = 0; + int HeatCoilAirOutletNode = 0; + PlantLocation HeatCoilPlantLoc = {}; // plant loop component location object for water heating coil + int HeatCoilControlNode = 0; // heating coil hot water or steam inlet node + int HeatCoilFluidOutletNode = 0; // outlet node for hot water and steam coil + int HotWaterCoilMaxIterIndex = 0; // Index to recurring warning message int HotWaterCoilMaxIterIndex2 = 0; // Index to recurring warning message Real64 MaxHeatCoilFluidFlow = 0.0; // water or steam mass flow rate for heating coil [kg/s] @@ -197,10 +207,6 @@ namespace HVACUnitaryBypassVAV { int NumZonesHeated = 0; // Number of zones requesting heating int PLRMaxIter = 0; // Counter for recurring warning message int PLRMaxIterIndex = 0; // Index to recurring warning message - int DXCoilInletNode = 0; // Inlet node number of DX cooling coil - int DXCoilOutletNode = 0; // Outlet node number of DX cooling coil - int HeatingCoilInletNode = 0; // Inlet node of heating coil - int HeatingCoilOutletNode = 0; // Outlet node of heating coil int FanInletNodeNum = 0; // fan inlet node number Real64 OutletTempSetPoint = 0.0; // Oulet node temperature setpoint [C] Real64 CoilTempSetPoint = 0.0; // Coil oulet node temperature setpoint (inc. fan heat) [C] @@ -334,7 +340,7 @@ struct HVACUnitaryBypassVAVData : BaseGlobalStruct Real64 TempSteamIn = 100.0; // steam coil steam inlet temperature Array1D_bool CheckEquipName; - EPVector CBVAV; + EPVector CBVAVs; bool GetInputFlag = true; // Flag set to make sure you get input once bool MyOneTimeFlag = true; // Initialization flag @@ -349,7 +355,7 @@ struct HVACUnitaryBypassVAVData : BaseGlobalStruct void clear_state() override { - this->CBVAV.deallocate(); + this->CBVAVs.deallocate(); this->NumCBVAV = 0; this->CompOnMassFlow = 0.0; this->OACompOnMassFlow = 0.0; diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 801529964a9..6ff7f080425 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -152,12 +152,7 @@ void SimulateVRF(EnergyPlusData &state, // Once all terminal units have been simulated, simulate VRF condenser int VRFTUNum; // current VRF system terminal unit index - int VRFCondenser; // index to VRF AC system object - AirConditioner:VariableRefrigerantFlow - int TUListNum; // index to VRF AC system terminal unit list - int IndexToTUInTUList; // index to pointer in VRF AC system terminal unit list Real64 OnOffAirFlowRatio; // ratio of compressor ON airflow to average airflow over timestep - int DXCoolingCoilIndex; // index to this terminal units DX cooling coil - int DXHeatingCoilIndex; // index to this terminal units DX heating coil Real64 QZnReq; // Obtains and Allocates VRF system related parameters from input file @@ -196,38 +191,33 @@ void SimulateVRF(EnergyPlusData &state, } // the VRF condenser index - VRFCondenser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + auto &vrfTu = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + int vrfCondenserNum = vrfTu.VRFSysNum; + auto &vrfCondenser = state.dataHVACVarRefFlow->VRF(vrfCondenserNum); - if ((state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserType == DataHeatBalance::RefrigCondenserType::Water) && - (state.dataHVACVarRefFlow->VRF(VRFCondenser).checkPlantCondTypeOneTime)) { + if ((vrfCondenser.CondenserType == DataHeatBalance::RefrigCondenserType::Water) && + (vrfCondenser.checkPlantCondTypeOneTime)) { // scan for loop connection data bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - state.dataHVACVarRefFlow->VRF(VRFCondenser).Name, - state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFType, - state.dataHVACVarRefFlow->VRF(VRFCondenser).SourcePlantLoc, + vrfCondenser.Name, + vrfCondenser.VRFType, + vrfCondenser.SourcePlantLoc, errFlag, _, _, _, - state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserNodeNum, + vrfCondenser.CondenserNodeNum, _); if (errFlag) { ShowSevereError(state, "GetVRFInput: Error scanning for plant loop data"); } - state.dataHVACVarRefFlow->VRF(VRFCondenser).checkPlantCondTypeOneTime = false; + vrfCondenser.checkPlantCondTypeOneTime = false; } - // the terminal unit list object index - TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; // the entry number in the terminal unit list (which item in the terminal unit list, e.g. second in list) - IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; - // index to cooling coil (coil is optional but at least one must be present) - DXCoolingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex; - // index to heating coil (coil is optional but at least one must be present) - DXHeatingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex; QZnReq = 0.0; // Initialize terminal unit @@ -237,45 +227,44 @@ void SimulateVRF(EnergyPlusData &state, SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); // mark this terminal unit as simulated - state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).IsSimulated(IndexToTUInTUList) = true; + auto &tuList = state.dataHVACVarRefFlow->TerminalUnitList(vrfTu.TUListIndex); + tuList.IsSimulated(vrfTu.IndexToTUInTUList) = true; // keep track of individual coil loads - if (DXCoolingCoilIndex > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) = - state.dataDXCoils->DXCoilTotalCooling(DXCoolingCoilIndex); + if (vrfTu.CoolCoilNum > 0) { + tuList.TotalCoolLoad(vrfTu.IndexToTUInTUList) = state.dataDXCoils->DXCoilTotalCooling(vrfTu.CoolCoilNum); } else { - state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) = 0.0; + tuList.TotalCoolLoad(vrfTu.IndexToTUInTUList) = 0.0; } - if (DXHeatingCoilIndex > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) = - state.dataDXCoils->DXCoilTotalHeating(DXHeatingCoilIndex); + if (vrfTu.HeatCoilNum > 0) { + tuList.TotalHeatLoad(vrfTu.IndexToTUInTUList) = state.dataDXCoils->DXCoilTotalHeating(vrfTu.HeatCoilNum); } else { - state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) = 0.0; + tuList.TotalHeatLoad(vrfTu.IndexToTUInTUList) = 0.0; } // Report the current VRF terminal unit ReportVRFTerminalUnit(state, VRFTUNum); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate > 0.0) CoolingActive = true; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate > 0.0) HeatingActive = true; + if (vrfTu.TotalCoolingRate > 0.0) CoolingActive = true; + if (vrfTu.TotalHeatingRate > 0.0) HeatingActive = true; // make sure all TU in a list are able to get simulated, otherwise condenser is never simulated ** // either fatal on GetInput, or keep track of unused TU's and set their respective flag to TRUE ** // after all VRF terminal units have been simulated, call the VRF condenser model - if (all(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).IsSimulated)) { + if (all(tuList.IsSimulated)) { - if (state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { + if (vrfCondenser.VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state, FirstHVACIteration); + vrfCondenser.CalcVRFCondenser_FluidTCtrl(state, FirstHVACIteration); } else { // Algorithm Type: VRF model based on system curve - CalcVRFCondenser(state, VRFCondenser); + CalcVRFCondenser(state, vrfCondenserNum); } - ReportVRFCondenser(state, VRFCondenser); + ReportVRFCondenser(state, vrfCondenserNum); - if (state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserType == DataHeatBalance::RefrigCondenserType::Water) - UpdateVRFCondenser(state, VRFCondenser); + if (vrfCondenser.CondenserType == DataHeatBalance::RefrigCondenserType::Water) + UpdateVRFCondenser(state, vrfCondenserNum); } } @@ -456,7 +445,6 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } - if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp } else if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) { @@ -544,21 +532,19 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) // loop through TU's and calculate average inlet conditions for active coils for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) { int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - int CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; - int HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; - TUParasiticPower += - state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticCoolElecPower + state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticHeatElecPower; - TUFanPower += state.dataHVACVarRefFlow->VRFTU(TUIndex).FanPower; + auto &vrfTu = state.dataHVACVarRefFlow->VRFTU(TUIndex); + TUParasiticPower += vrfTu.ParasiticCoolElecPower + vrfTu.ParasiticHeatElecPower; + TUFanPower += vrfTu.FanPower; if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) { - SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(CoolCoilIndex) * + SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(vrfTu.CoolCoilNum) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TUCoolingLoad; ++NumTUInCoolingMode; } if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) { - SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(HeatCoilIndex) * + SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(vrfTu.HeatCoilNum) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad; - SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(HeatCoilIndex) * + SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(vrfTu.HeatCoilNum) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad; ++NumTUInHeatingMode; } @@ -1376,17 +1362,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) using DXCoils::GetDXCoilIndex; using DataSizing::AutoSize; - using DXCoils::GetCoilCondenserInletNode; - using DXCoils::GetCoilTypeNum; - using DXCoils::GetDXCoilAvailSchPtr; - using DXCoils::GetDXCoilCapFTCurveIndex; - using DXCoils::GetDXCoilName; - using DXCoils::RatedInletAirTempHeat; - using DXCoils::RatedInletWetBulbTemp; - using DXCoils::RatedOutdoorAirTemp; - using DXCoils::RatedOutdoorAirTempHeat; - using DXCoils::RatedOutdoorWetBulbTempHeat; - using DXCoils::SetDXCoolingCoilData; using MixedAir::GetOAMixerNodeNumbers; using NodeInputManager::GetOnlySingleNode; using OutAirNodeManager::CheckOutAirNodeNumber; @@ -1639,8 +1614,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfSys.CoolCapFT, cAlphaFieldNames(3), cAlphaArgs(3), - RatedInletWetBulbTemp, - RatedOutdoorAirTemp); + DXCoils::RatedInletWetBulbTemp, + DXCoils::RatedOutdoorAirTemp); } } @@ -1811,8 +1786,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfSys.HeatCapFT, cAlphaFieldNames(13), cAlphaArgs(13), - RatedInletAirTempHeat, - RatedOutdoorWetBulbTempHeat); + DXCoils::RatedInletAirTempHeat, + DXCoils::RatedOutdoorWetBulbTempHeat); } else if (Util::SameString(cAlphaArgs(19), "DRYBULBTEMPERATURE")) { checkCurveIsNormalizedToOne(state, std::string{RoutineName} + cCurrentModuleObject, @@ -1820,8 +1795,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfSys.HeatCapFT, cAlphaFieldNames(13), cAlphaArgs(13), - RatedInletAirTempHeat, - RatedOutdoorAirTempHeat); + DXCoils::RatedInletAirTempHeat, + DXCoils::RatedOutdoorAirTempHeat); } } } @@ -3254,11 +3229,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) cCurrentModuleObject = "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow"; for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) { - // initialize local node number variables - int CCoilInletNodeNum = 0; - int CCoilOutletNodeNum = 0; - int HCoilInletNodeNum = 0; - int HCoilOutletNodeNum = 0; OANodeNums = 0; state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -3280,92 +3250,92 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames = cNumericFieldNames; Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &thisVrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); - thisVrfTU.Name = cAlphaArgs(1); + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + vrfTU.Name = cAlphaArgs(1); for (int NumList = 1; NumList <= state.dataHVACVarRefFlow->NumVRFTULists; ++NumList) { - int ZoneTerminalUnitListNum = Util::FindItemInList(thisVrfTU.Name, + int ZoneTerminalUnitListNum = Util::FindItemInList(vrfTU.Name, state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUName, state.dataHVACVarRefFlow->TerminalUnitList(NumList).NumTUInList); if (ZoneTerminalUnitListNum > 0) { - thisVrfTU.IndexToTUInTUList = ZoneTerminalUnitListNum; + vrfTU.IndexToTUInTUList = ZoneTerminalUnitListNum; state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUPtr(ZoneTerminalUnitListNum) = VRFTUNum; - thisVrfTU.TUListIndex = NumList; + vrfTU.TUListIndex = NumList; break; } } - if (thisVrfTU.TUListIndex == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); + if (vrfTU.TUListIndex == 0) { + ShowSevereError(state, cCurrentModuleObject + " = " + vrfTU.Name); ShowContinueError(state, "Terminal unit not found on any ZoneTerminalUnitList."); ErrorsFound = true; } for (int NumCond = 1; NumCond <= state.dataHVACVarRefFlow->NumVRFCond; ++NumCond) { - if (state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr != thisVrfTU.TUListIndex) continue; - thisVrfTU.VRFSysNum = NumCond; + if (state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr != vrfTU.TUListIndex) continue; + vrfTU.VRFSysNum = NumCond; break; } - thisVrfTU.type = TUType::ConstantVolume; + vrfTU.type = TUType::ConstantVolume; if (lAlphaFieldBlanks(2)) { - thisVrfTU.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + vrfTU.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - thisVrfTU.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (thisVrfTU.SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + thisVrfTU.Name + "\" invalid data"); + vrfTU.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); + if (vrfTU.SchedPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + "=\"" + vrfTU.Name + "\" invalid data"); ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } } - thisVrfTU.VRFTUInletNodeNum = GetOnlySingleNode(state, + vrfTU.VRFTUInletNodeNum = GetOnlySingleNode(state, cAlphaArgs(3), ErrorsFound, DataLoopNode::ConnectionObjectType::ZoneHVACTerminalUnitVariableRefrigerantFlow, - thisVrfTU.Name, + vrfTU.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, ObjectIsParent); - thisVrfTU.VRFTUOutletNodeNum = GetOnlySingleNode(state, + vrfTU.VRFTUOutletNodeNum = GetOnlySingleNode(state, cAlphaArgs(4), ErrorsFound, DataLoopNode::ConnectionObjectType::ZoneHVACTerminalUnitVariableRefrigerantFlow, - thisVrfTU.Name, + vrfTU.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, ObjectIsParent); - thisVrfTU.MaxCoolAirVolFlow = rNumericArgs(1); - thisVrfTU.MaxNoCoolAirVolFlow = rNumericArgs(2); - thisVrfTU.MaxHeatAirVolFlow = rNumericArgs(3); - thisVrfTU.MaxNoHeatAirVolFlow = rNumericArgs(4); - thisVrfTU.CoolOutAirVolFlow = rNumericArgs(5); - thisVrfTU.HeatOutAirVolFlow = rNumericArgs(6); - thisVrfTU.NoCoolHeatOutAirVolFlow = rNumericArgs(7); + vrfTU.MaxCoolAirVolFlow = rNumericArgs(1); + vrfTU.MaxNoCoolAirVolFlow = rNumericArgs(2); + vrfTU.MaxHeatAirVolFlow = rNumericArgs(3); + vrfTU.MaxNoHeatAirVolFlow = rNumericArgs(4); + vrfTU.CoolOutAirVolFlow = rNumericArgs(5); + vrfTU.HeatOutAirVolFlow = rNumericArgs(6); + vrfTU.NoCoolHeatOutAirVolFlow = rNumericArgs(7); - thisVrfTU.FanOpModeSchedPtr = GetScheduleIndex(state, cAlphaArgs(5)); + vrfTU.FanOpModeSchedPtr = GetScheduleIndex(state, cAlphaArgs(5)); // default to constant fan operating mode - if (thisVrfTU.FanOpModeSchedPtr == 0) { + if (vrfTU.FanOpModeSchedPtr == 0) { if (!lAlphaFieldBlanks(5)) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); + ShowSevereError(state, cCurrentModuleObject + " = " + vrfTU.Name); ShowContinueError(state, "..." + cAlphaFieldNames(5) + " = " + cAlphaArgs(5) + " not found."); ShowContinueError(state, "...Defaulting to constant fan operating mode and simulation continues."); } - thisVrfTU.fanOp = HVAC::FanOp::Continuous; + vrfTU.fanOp = HVAC::FanOp::Continuous; } - thisVrfTU.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, cAlphaArgs(6))); - assert(thisVrfTU.fanPlace != HVAC::FanPlace::Invalid); + vrfTU.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, cAlphaArgs(6))); + assert(vrfTU.fanPlace != HVAC::FanPlace::Invalid); if (!lAlphaFieldBlanks(7) && !lAlphaFieldBlanks(8)) { // Get fan data std::string FanName = cAlphaArgs(8); - thisVrfTU.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, cAlphaArgs(7))); + vrfTU.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, cAlphaArgs(7))); - if (thisVrfTU.fanType != HVAC::FanType::OnOff && thisVrfTU.fanType != HVAC::FanType::Constant && - thisVrfTU.fanType != HVAC::FanType::VAV && thisVrfTU.fanType != HVAC::FanType::SystemModel) { + if (vrfTU.fanType != HVAC::FanType::OnOff && vrfTU.fanType != HVAC::FanType::Constant && + vrfTU.fanType != HVAC::FanType::VAV && vrfTU.fanType != HVAC::FanType::SystemModel) { ShowSevereInvalidKey(state, eoh, cAlphaFieldNames(7), @@ -3374,22 +3344,22 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) ErrorsFound = true; } - if ((thisVrfTU.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { + if ((vrfTU.FanIndex = Fans::GetFanIndex(state, FanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(8), FanName); ErrorsFound = true; - } else if (thisVrfTU.fanType != state.dataFans->fans(thisVrfTU.FanIndex)->type) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); + } else if (vrfTU.fanType != state.dataFans->fans(vrfTU.FanIndex)->type) { + ShowSevereError(state, cCurrentModuleObject + " = " + vrfTU.Name); ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7)); - ShowContinueError(state, format("Actual type of fan {} = {}", FanName, HVAC::fanTypeNames[(int)thisVrfTU.fanType])); + ShowContinueError(state, format("Actual type of fan {} = {}", FanName, HVAC::fanTypeNames[(int)vrfTU.fanType])); ErrorsFound = true; } - if (thisVrfTU.VRFSysNum > 0) { + if (vrfTU.VRFSysNum > 0) { // VRFTU Supply Air Fan Object Type must be Fan:VariableVolume if VRF Algorithm Type is AlgorithmTypeFluidTCtrl - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl && - !(thisVrfTU.fanType == HVAC::FanType::VAV || thisVrfTU.fanType == HVAC::FanType::SystemModel)) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); + if (state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl && + !(vrfTU.fanType == HVAC::FanType::VAV || vrfTU.fanType == HVAC::FanType::SystemModel)) { + ShowSevereError(state, cCurrentModuleObject + " = " + vrfTU.Name); ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7)); ShowContinueError( state, "Fan Object Type must be Fan:VariableVolume if VRF AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl"); @@ -3397,10 +3367,10 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) ErrorsFound = true; } // VRFTU Supply Air Fan Object Type must be Fan:OnOff or Fan:ConstantVolume if VRF Algorithm Type is AlgorithmTypeSysCurve - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::SysCurve && - !(thisVrfTU.fanType == HVAC::FanType::OnOff || thisVrfTU.fanType == HVAC::FanType::Constant || - thisVrfTU.fanType == HVAC::FanType::SystemModel)) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); + if (state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::SysCurve && + !(vrfTU.fanType == HVAC::FanType::OnOff || vrfTU.fanType == HVAC::FanType::Constant || + vrfTU.fanType == HVAC::FanType::SystemModel)) { + ShowSevereError(state, cCurrentModuleObject + " = " + vrfTU.Name); ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7)); ShowContinueError(state, "Fan Object Type must be Fan:SystemModel, Fan:OnOff, or Fan:ConstantVolume if VRF " @@ -3410,21 +3380,21 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } } - auto *fan = state.dataFans->fans(thisVrfTU.FanIndex); + auto *fan = state.dataFans->fans(vrfTU.FanIndex); - thisVrfTU.fanInletNode = fan->inletNodeNum; - thisVrfTU.fanOutletNode = fan->outletNodeNum; + vrfTU.fanInletNode = fan->inletNodeNum; + vrfTU.fanOutletNode = fan->outletNodeNum; Real64 FanVolFlowRate = fan->maxAirFlowRate; - thisVrfTU.ActualFanVolFlowRate = FanVolFlowRate; + vrfTU.ActualFanVolFlowRate = FanVolFlowRate; int FanInletNodeNum = fan->inletNodeNum; int FanOutletNodeNum = fan->outletNodeNum; - thisVrfTU.FanAvailSchedPtr = fan->availSchedNum; + vrfTU.FanAvailSchedPtr = fan->availSchedNum; // Check fan's schedule for cycling fan operation if constant volume fan is used - if (thisVrfTU.FanOpModeSchedPtr > 0 && thisVrfTU.fanType == HVAC::FanType::Constant) { - if (!CheckScheduleValueMinMax(state, thisVrfTU.FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); + if (vrfTU.FanOpModeSchedPtr > 0 && vrfTU.fanType == HVAC::FanType::Constant) { + if (!CheckScheduleValueMinMax(state, vrfTU.FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) { + ShowSevereError(state, cCurrentModuleObject + " = " + vrfTU.Name); ShowContinueError(state, format("For fan type = {}", HVAC::fanTypeNames[(int)HVAC::FanType::Constant])); ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(5), cAlphaArgs(5))); @@ -3436,23 +3406,23 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Add TU to component sets array SetUpCompSets(state, cCurrentModuleObject, - thisVrfTU.Name, - HVAC::fanTypeNames[(int)thisVrfTU.fanType], + vrfTU.Name, + HVAC::fanTypeNames[(int)vrfTU.fanType], FanName, state.dataLoopNodes->NodeID(FanInletNodeNum), state.dataLoopNodes->NodeID(FanOutletNodeNum)); } else { - thisVrfTU.fanPlace = HVAC::FanPlace::Invalid; // reset fan placement when fan is not used so as not to call the fan + vrfTU.fanPlace = HVAC::FanPlace::Invalid; // reset fan placement when fan is not used so as not to call the fan } // Get OA mixer data std::string OAMixerType = cAlphaArgs(9); if (!lAlphaFieldBlanks(10)) { - thisVrfTU.OAMixerName = cAlphaArgs(10); + vrfTU.OAMixerName = cAlphaArgs(10); errFlag = false; - OANodeNums = GetOAMixerNodeNumbers(state, thisVrfTU.OAMixerName, errFlag); + OANodeNums = GetOAMixerNodeNumbers(state, vrfTU.OAMixerName, errFlag); // OANodeNums(1) = OAMixer(OAMixerNum)%InletNode // OANodeNums(2) = OAMixer(OAMixerNum)%RelNode @@ -3460,685 +3430,274 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // OANodeNums(4) = OAMixer(OAMixerNum)%MixNode if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + vrfTU.Name); ErrorsFound = true; } else { - thisVrfTU.OAMixerUsed = true; + vrfTU.OAMixerUsed = true; } - thisVrfTU.VRFTUOAMixerOANodeNum = OANodeNums(1); - thisVrfTU.VRFTUOAMixerRelNodeNum = OANodeNums(2); - thisVrfTU.VRFTUOAMixerRetNodeNum = OANodeNums(3); - thisVrfTU.VRFTUOAMixerMixedNodeNum = OANodeNums(4); + vrfTU.VRFTUOAMixerOANodeNum = OANodeNums(1); + vrfTU.VRFTUOAMixerRelNodeNum = OANodeNums(2); + vrfTU.VRFTUOAMixerRetNodeNum = OANodeNums(3); + vrfTU.VRFTUOAMixerMixedNodeNum = OANodeNums(4); } // Get DX cooling coil data - std::string DXCoolingCoilType = cAlphaArgs(11); - errFlag = false; - thisVrfTU.DXCoolCoilType_Num = GetCoilTypeNum(state, DXCoolingCoilType, cAlphaArgs(12), errFlag, false); - if (thisVrfTU.DXCoolCoilType_Num == 0) { - thisVrfTU.CoolingCoilPresent = false; - if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilPresent(thisVrfTU.IndexToTUInTUList) = false; - } - } else { - if (thisVrfTU.VRFSysNum > 0) { - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { - // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control + + vrfTU.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, cAlphaArgs(11))); + vrfTU.CoolCoilName = cAlphaArgs(12); + + if (vrfTU.coolCoilType == HVAC::CoilType::Invalid) { + vrfTU.CoolingCoilPresent = false; + if (vrfTU.TUListIndex > 0 && vrfTU.IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).CoolingCoilPresent(vrfTU.IndexToTUInTUList) = false; + } + } else if (vrfTU.VRFSysNum > 0) { + auto &vrfCondenser = state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum); + if (vrfCondenser.VRFAlgorithmType == AlgorithmType::FluidTCtrl) { + // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling))) { - errFlag = false; - if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); + if (vrfTU.coolCoilType == HVAC::CoilType::VRFFluidTCtrlCooling) { + vrfTU.CoolCoilNum = DXCoils::GetDXCoilIndex(state, vrfTU.CoolCoilName); + if (vrfTU.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(12), vrfTU.CoolCoilName); + ErrorsFound = true; + } else { + if (vrfTU.TUListIndex > 0 && vrfTU.IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).CoolingCoilAvailSchPtr(vrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSchPtr(state, vrfTU.CoolCoilNum); } - GetDXCoilIndex( - state, cAlphaArgs(12), thisVrfTU.CoolCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling)); - CCoilInletNodeNum = - DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling), cAlphaArgs(12), errFlag); - CCoilOutletNodeNum = - DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling), cAlphaArgs(12), errFlag); - thisVrfTU.coolCoilAirInNode = CCoilInletNodeNum; - thisVrfTU.coolCoilAirOutNode = CCoilOutletNodeNum; - - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - - if (thisVrfTU.VRFSysNum > 0) { - SetDXCoolingCoilData( - state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType); - SetDXCoolingCoilData(state, - thisVrfTU.CoolCoilIndex, - ErrorsFound, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum); - SetDXCoolingCoilData(state, - thisVrfTU.CoolCoilIndex, - ErrorsFound, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater); - SetDXCoolingCoilData(state, - thisVrfTU.CoolCoilIndex, - ErrorsFound, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATCooling); - SetDXCoolingCoilData(state, - thisVrfTU.CoolCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCooling); - - state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).VRFIUPtr = VRFTUNum; - state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).VRFOUPtr = thisVrfTU.VRFSysNum; - state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).SupplyFanIndex = thisVrfTU.FanIndex; - - if (thisVrfTU.FanIndex > 0) { - state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).RatedAirVolFlowRate(1) = - state.dataFans->fans(thisVrfTU.FanIndex)->maxAirFlowRate; - } else { - state.dataDXCoils->DXCoil(thisVrfTU.CoolCoilIndex).RatedAirVolFlowRate(1) = AutoSize; - } + vrfTU.coolCoilAirInNode = DXCoils::GetCoilInletNode(state, vrfTU.CoolCoilNum); + vrfTU.coolCoilAirOutNode = DXCoils::GetCoilOutletNode(state, vrfTU.CoolCoilNum); + + DXCoils::SetDXCoilCondenserType(state, vrfTU.CoolCoilNum, vrfCondenser.CondenserType); + DXCoils::SetDXCoilCondenserInletNode(state, vrfTU.CoolCoilNum, vrfCondenser.CondenserNodeNum); + DXCoils::SetDXCoilMaxOATCrankcaseHeater(state, vrfTU.CoolCoilNum, vrfCondenser.MaxOATCCHeater); + DXCoils::SetDXCoilMinOATCooling(state, vrfTU.CoolCoilNum, vrfCondenser.MinOATCooling); + DXCoils::SetDXCoilMaxOATCooling(state, vrfTU.CoolCoilNum, vrfCondenser.MaxOATCooling); + + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).VRFIUPtr = VRFTUNum; + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).VRFOUPtr = vrfTU.VRFSysNum; + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).SupplyFanIndex = vrfTU.FanIndex; + + if (vrfTU.FanIndex > 0) { + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).RatedAirVolFlowRate(1) = + state.dataFans->fans(vrfTU.FanIndex)->maxAirFlowRate; } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError( - state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num) + " \"" + cAlphaArgs(12) + "\""); - ShowContinueError(state, "... terminal unit not connected to condenser."); - ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); - ShowContinueError(state, - "... also check that the terminal unit list name is specified in an " - "AirConditioner:VariableRefrigerantFlow object."); - ErrorsFound = true; + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).RatedAirVolFlowRate(1) = AutoSize; } - } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError(state, "... illegal " + cAlphaFieldNames(12) + " = " + cAlphaArgs(12)); - ErrorsFound = true; } - - } else { - // Algorithm Type: VRF model based on system curve - - if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling))) { - if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); + } + } else { // Algorithm Type: VRF model based on system curve + + if (vrfTU.coolCoilType == HVAC::CoilType::VRFCooling) { + vrfTU.CoolCoilNum = DXCoils::GetDXCoilIndex(state, vrfTU.CoolCoilName); + if (vrfTU.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(12), vrfTU.CoolCoilName); + ErrorsFound = true; + } else { + if (vrfTU.TUListIndex > 0 && vrfTU.IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).CoolingCoilAvailSchPtr(vrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSchPtr(state, vrfTU.CoolCoilNum); } else { - thisVrfTU.CoolingCoilPresent = false; + vrfTU.CoolingCoilPresent = false; } - errFlag = false; - GetDXCoilIndex(state, cAlphaArgs(12), thisVrfTU.CoolCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling)); - CCoilInletNodeNum = DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling), cAlphaArgs(12), errFlag); - CCoilOutletNodeNum = DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling), cAlphaArgs(12), errFlag); - thisVrfTU.coolCoilAirInNode = CCoilInletNodeNum; - thisVrfTU.coolCoilAirOutNode = CCoilOutletNodeNum; - - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - - SetDXCoolingCoilData( - state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType); - SetDXCoolingCoilData( - state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum); - SetDXCoolingCoilData( - state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater); - SetDXCoolingCoilData(state, - thisVrfTU.CoolCoilIndex, - ErrorsFound, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATCooling); - SetDXCoolingCoilData(state, - thisVrfTU.CoolCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCooling); - } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError(state, "... illegal " + cAlphaFieldNames(12) + " = " + cAlphaArgs(12)); - ErrorsFound = true; + vrfTU.coolCoilAirInNode = DXCoils::GetCoilInletNode(state, vrfTU.CoolCoilNum); + vrfTU.coolCoilAirOutNode = DXCoils::GetCoilOutletNode(state, vrfTU.CoolCoilNum); + + DXCoils::SetDXCoilCondenserType(state, vrfTU.CoolCoilNum, vrfCondenser.CondenserType); + DXCoils::SetDXCoilCondenserInletNode(state, vrfTU.CoolCoilNum, vrfCondenser.CondenserNodeNum); + DXCoils::SetDXCoilMaxOATCrankcaseHeater(state, vrfTU.CoolCoilNum, vrfCondenser.MaxOATCCHeater); + DXCoils::SetDXCoilMinOATCooling(state, vrfTU.CoolCoilNum, vrfCondenser.MinOATCooling); + DXCoils::SetDXCoilMaxOATCooling(state, vrfTU.CoolCoilNum, vrfCondenser.MinOATCooling); } } - } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError(state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num) + " \"" + cAlphaArgs(12) + "\""); - ShowContinueError(state, "... terminal unit not connected to condenser."); - ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); - ShowContinueError( - state, "... also check that the terminal unit list name is specified in an AirConditioner:VariableRefrigerantFlow object."); - ErrorsFound = true; } + } else { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); + ShowContinueError(state, format("... when checking {} \"{}\"", HVAC::coilTypeNames[(int)vrfTU.coolCoilType], vrfTU.CoolCoilName)); + ShowContinueError(state, "... terminal unit not connected to condenser."); + ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); + ShowContinueError(state, "... also check that the terminal unit list name is specified in an AirConditioner:VariableRefrigerantFlow object."); + ErrorsFound = true; } - // Get DX heating coil data - std::string DXHeatingCoilType = cAlphaArgs(13); - // Get the heating to cooling sizing ratio input before writing to DX heating coil data if (!lNumericFieldBlanks(10)) { - thisVrfTU.HeatingCapacitySizeRatio = rNumericArgs(10); + vrfTU.HeatingCapacitySizeRatio = rNumericArgs(10); } errFlag = false; - thisVrfTU.DXHeatCoilType_Num = GetCoilTypeNum(state, DXHeatingCoilType, cAlphaArgs(14), errFlag, false); - if (thisVrfTU.DXHeatCoilType_Num == 0) { - thisVrfTU.HeatingCoilPresent = false; - if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilPresent(thisVrfTU.IndexToTUInTUList) = false; - } - } else { - if (thisVrfTU.VRFSysNum > 0) { - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { - // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control + vrfTU.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, cAlphaArgs(13))); + vrfTU.HeatCoilName = cAlphaArgs(14); + + if (vrfTU.heatCoilType == HVAC::CoilType::Invalid) { + vrfTU.HeatingCoilPresent = false; + if (vrfTU.TUListIndex > 0 && vrfTU.IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).HeatingCoilPresent(vrfTU.IndexToTUInTUList) = false; + } + + } else if (vrfTU.VRFSysNum == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); + ShowContinueError(state, format("... when checking {} \"{}\"", HVAC::coilTypeNames[(int)vrfTU.heatCoilType], vrfTU.HeatCoilName)); + ShowContinueError(state, "... terminal unit not connected to condenser."); + ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); + ShowContinueError(state, + "... also check that the terminal unit list name is specified in an " + "AirConditioner:VariableRefrigerantFlow object."); + ErrorsFound = true; + + } else { // vrfTU.VRFSysNum != 0 + auto &vrfCondenser = state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum); + if (vrfCondenser.VRFAlgorithmType == AlgorithmType::FluidTCtrl) { + // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control + + if (vrfTU.heatCoilType == HVAC::CoilType::VRFFluidTCtrlHeating) { + vrfTU.HeatCoilNum = DXCoils::GetDXCoilIndex(state, vrfTU.HeatCoilName); + if (vrfTU.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(14), vrfTU.HeatCoilName); + ErrorsFound = true; - if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating))) { - errFlag = false; - if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); + } else { // vrfTU.HeatCoilNum != 0 + if (vrfTU.TUListIndex > 0 && vrfTU.IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).HeatingCoilAvailSchPtr(vrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSchPtr(state, vrfTU.HeatCoilNum); } - GetDXCoilIndex( - state, cAlphaArgs(14), thisVrfTU.HeatCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating)); - HCoilInletNodeNum = - DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating), cAlphaArgs(14), errFlag); - HCoilOutletNodeNum = - DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating), cAlphaArgs(14), errFlag); - thisVrfTU.heatCoilAirInNode = HCoilInletNodeNum; - thisVrfTU.heatCoilAirOutNode = HCoilOutletNodeNum; - - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - - if (thisVrfTU.VRFSysNum > 0) { - SetDXCoolingCoilData( - state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATHeating); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATHeating); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType); - // Set defrost controls in child object to trip child object defrost calculations - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostStrategy); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostControl); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostEIRPtr); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostFraction); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATDefrost); - // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil - // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing. - // Defrost capacity is used for nothing more than setting defrost power/consumption report - // variables which are not reported. The coil's defrost algorithm IS used to derate the coil - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - 1.0); // DefrostCapacity=1.0 - - state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).VRFIUPtr = VRFTUNum; - state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).VRFOUPtr = thisVrfTU.VRFSysNum; - state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).SupplyFanIndex = thisVrfTU.FanIndex; - - if (thisVrfTU.FanIndex > 0) { - state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).RatedAirVolFlowRate(1) = - state.dataFans->fans(thisVrfTU.FanIndex)->maxAirFlowRate; - } else { - state.dataDXCoils->DXCoil(thisVrfTU.HeatCoilIndex).RatedAirVolFlowRate(1) = AutoSize; - } + vrfTU.heatCoilAirInNode = DXCoils::GetCoilInletNode(state, vrfTU.HeatCoilNum); + vrfTU.heatCoilAirOutNode = DXCoils::GetCoilOutletNode(state, vrfTU.HeatCoilNum); + + DXCoils::SetDXCoilCondenserType(state, vrfTU.HeatCoilNum, vrfCondenser.CondenserType); + DXCoils::SetDXCoilCondenserInletNode(state, vrfTU.HeatCoilNum, vrfCondenser.CondenserNodeNum); + DXCoils::SetDXCoilMaxOATCrankcaseHeater(state, vrfTU.HeatCoilNum, vrfCondenser.MaxOATCCHeater); + DXCoils::SetDXCoilMinOATHeating(state, vrfTU.HeatCoilNum, vrfCondenser.MinOATHeating); + DXCoils::SetDXCoilMaxOATHeating(state, vrfTU.HeatCoilNum, vrfCondenser.MaxOATHeating); + DXCoils::SetDXCoilHeatingPerformanceOATType(state, vrfTU.HeatCoilNum, vrfCondenser.HeatingPerformanceOATType); + // Set defrost controls in child object to trip child object defrost calculations + DXCoils::SetDXCoilDefrostStrategy(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostStrategy); + DXCoils::SetDXCoilDefrostControl(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostControl); + DXCoils::SetDXCoilDefrostEIR(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostEIRPtr); + DXCoils::SetDXCoilDefrostFraction(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostFraction); + DXCoils::SetDXCoilMaxOATDefrost(state, vrfTU.HeatCoilNum, vrfCondenser.MaxOATDefrost); - // Terminal unit heating to cooling sizing ratio has precedence over VRF system sizing ratio - if (thisVrfTU.HeatingCapacitySizeRatio > 1.0) { - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - thisVrfTU.HeatingCapacitySizeRatio); - } else if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio > 1.0) { - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio); - } + // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil + // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing. + // Defrost capacity is used for nothing more than setting defrost power/consumption report + // variables which are not reported. The coil's defrost algorithm IS used to derate the coil + DXCoils::SetDXCoilDefrostCapacity(state, vrfTU.HeatCoilNum, 1.0); // DefrostCapacity=1.0 + + auto &dxCoil = state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum); + dxCoil.VRFIUPtr = VRFTUNum; + dxCoil.VRFOUPtr = vrfTU.VRFSysNum; + dxCoil.SupplyFanIndex = vrfTU.FanIndex; // This is available via the API + + if (vrfTU.FanIndex > 0) { + dxCoil.RatedAirVolFlowRate(1) = state.dataFans->fans(vrfTU.FanIndex)->maxAirFlowRate; } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError( - state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num) + " \"" + cAlphaArgs(14) + "\""); - ShowContinueError(state, "... terminal unit not connected to condenser."); - ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); - ShowContinueError(state, - "... also check that the terminal unit list name is specified in an " - "AirConditioner:VariableRefrigerantFlow object."); - ErrorsFound = true; + dxCoil.RatedAirVolFlowRate(1) = AutoSize; + } + + // Terminal unit heating to cooling sizing ratio has precedence over VRF system sizing ratio + if (vrfTU.HeatingCapacitySizeRatio > 1.0) { + DXCoils::SetDXCoilHeatSizeRatio(state, vrfTU.HeatCoilNum, vrfTU.HeatingCapacitySizeRatio); + } else if (vrfCondenser.HeatingCapacitySizeRatio > 1.0) { + DXCoils::SetDXCoilHeatSizeRatio(state, vrfTU.HeatCoilNum, vrfCondenser.HeatingCapacitySizeRatio); } - } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError(state, "... illegal " + cAlphaFieldNames(14) + " = " + cAlphaArgs(14)); - ErrorsFound = true; } + } + + } else { // Algorithm Type: VRF model based on system curve + + if (vrfTU.heatCoilType == HVAC::CoilType::VRFHeating) { + vrfTU.HeatCoilNum = DXCoils::GetDXCoilIndex(state, vrfTU.HeatCoilName); + if (vrfTU.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(14), vrfTU.HeatCoilName); + ErrorsFound = true; - } else { - // Algorithm Type: VRF model based on system curve - if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating))) { - if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); + } else { // vrfTU.HeatCoilNum != 0 + if (vrfTU.TUListIndex > 0 && vrfTU.IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).HeatingCoilAvailSchPtr(vrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSchPtr(state, vrfTU.HeatCoilNum); } else { - thisVrfTU.HeatingCoilPresent = false; + vrfTU.HeatingCoilPresent = false; } - errFlag = false; - GetDXCoilIndex(state, cAlphaArgs(14), thisVrfTU.HeatCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating)); - HCoilInletNodeNum = DXCoils::GetCoilInletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating), cAlphaArgs(14), errFlag); - HCoilOutletNodeNum = DXCoils::GetCoilOutletNode(state, HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating), cAlphaArgs(14), errFlag); - thisVrfTU.heatCoilAirInNode = HCoilInletNodeNum; - thisVrfTU.heatCoilAirOutNode = HCoilOutletNodeNum; - - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - - SetDXCoolingCoilData( - state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserType); - SetDXCoolingCoilData( - state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CondenserNodeNum); - SetDXCoolingCoilData( - state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATCCHeater); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MinOATHeating); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType); + + vrfTU.heatCoilAirInNode = DXCoils::GetCoilInletNode(state, vrfTU.HeatCoilNum); + vrfTU.heatCoilAirOutNode = DXCoils::GetCoilOutletNode(state, vrfTU.HeatCoilNum); + + DXCoils::SetDXCoilCondenserType(state, vrfTU.HeatCoilNum, vrfCondenser.CondenserType); + DXCoils::SetDXCoilCondenserInletNode(state, vrfTU.HeatCoilNum, vrfCondenser.CondenserNodeNum); + DXCoils::SetDXCoilMaxOATCrankcaseHeater(state, vrfTU.HeatCoilNum, vrfCondenser.MaxOATCCHeater); + DXCoils::SetDXCoilMinOATHeating(state, vrfTU.HeatCoilNum, vrfCondenser.MinOATHeating); + DXCoils::SetDXCoilHeatingPerformanceOATType(state, vrfTU.HeatCoilNum, vrfCondenser.HeatingPerformanceOATType); // Set defrost controls in child object to trip child object defrost calculations - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostStrategy); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostControl); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostEIRPtr); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).DefrostFraction); - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).MaxOATDefrost); + DXCoils::SetDXCoilDefrostStrategy(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostStrategy); + DXCoils::SetDXCoilDefrostControl(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostControl); + DXCoils::SetDXCoilDefrostEIR(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostEIRPtr); + DXCoils::SetDXCoilDefrostFraction(state, vrfTU.HeatCoilNum, vrfCondenser.DefrostFraction); + DXCoils::SetDXCoilMaxOATDefrost(state, vrfTU.HeatCoilNum, vrfCondenser.MaxOATDefrost); // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing. // Defrost capacity is used for nothing more than setting defrost power/consumption report // variables which are not reported. The coil's defrost algorithm IS used to derate the coil - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - 1.0); // DefrostCapacity=1.0 + DXCoils::SetDXCoilDefrostCapacity(state, vrfTU.HeatCoilNum, 1.0); // DefrostCapacity=1.0 // Terminal unit heating to cooling sizing ratio has precedence over VRF system sizing ratio - if (thisVrfTU.HeatingCapacitySizeRatio > 1.0) { - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - thisVrfTU.HeatingCapacitySizeRatio); - } else if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio > 1.0) { - SetDXCoolingCoilData(state, - thisVrfTU.HeatCoilIndex, - ErrorsFound, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - _, - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio); + if (vrfTU.HeatingCapacitySizeRatio > 1.0) { + DXCoils::SetDXCoilHeatSizeRatio(state, vrfTU.HeatCoilNum, vrfTU.HeatingCapacitySizeRatio); + } else if (vrfCondenser.HeatingCapacitySizeRatio > 1.0) { + DXCoils::SetDXCoilHeatSizeRatio(state, vrfTU.HeatCoilNum, vrfCondenser.HeatingCapacitySizeRatio); } // Check VRF DX heating coil heating capacity as a function of temperature performance curve. Only report here for // biquadratic curve type. - if (thisVrfTU.VRFSysNum > 0 && thisVrfTU.HeatCoilIndex > 0 && - state.dataCurveManager->PerfCurve(GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound))->numDims == 2) { - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType == HVAC::OATType::WetBulb) { + int heatCoilCapFTCurveNum = DXCoils::GetDXCoilCapFTCurveIndex(state, vrfTU.HeatCoilNum); + if (state.dataCurveManager->PerfCurve(heatCoilCapFTCurveNum)->numDims == 2) { + if (vrfCondenser.HeatingPerformanceOATType == HVAC::OATType::WetBulb) { checkCurveIsNormalizedToOne( state, - "GetDXCoils: " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), - DXCoils::GetDXCoilName( - state, thisVrfTU.HeatCoilIndex, ErrorsFound, HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num)), - GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound), + format("GetDXCoils: {}", HVAC::coilTypeNames[(int)vrfTU.heatCoilType]), + vrfTU.HeatCoilName, + heatCoilCapFTCurveNum, "Heating Capacity Ratio Modifier Function of Temperature Curve Name", - Curve::GetCurveName(state, GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound)), - RatedInletAirTempHeat, - RatedOutdoorWetBulbTempHeat); - } else if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingPerformanceOATType == HVAC::OATType::DryBulb) { + state.dataCurveManager->PerfCurve(heatCoilCapFTCurveNum)->Name, + DXCoils::RatedInletAirTempHeat, + DXCoils::RatedOutdoorWetBulbTempHeat); + } else if (vrfCondenser.HeatingPerformanceOATType == HVAC::OATType::DryBulb) { checkCurveIsNormalizedToOne( state, - "GetDXCoils: " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), - DXCoils::GetDXCoilName( - state, thisVrfTU.HeatCoilIndex, ErrorsFound, HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num)), - GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound), + format("GetDXCoils: {}", HVAC::coilTypeNames[(int)vrfTU.heatCoilType]), + vrfTU.HeatCoilName, + heatCoilCapFTCurveNum, "Heating Capacity Ratio Modifier Function of Temperature Curve Name", - Curve::GetCurveName(state, GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound)), - RatedInletAirTempHeat, - RatedOutdoorAirTempHeat); + state.dataCurveManager->PerfCurve(heatCoilCapFTCurveNum)->Name, + DXCoils::RatedInletAirTempHeat, + DXCoils::RatedOutdoorAirTempHeat); } } - - } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError(state, "... illegal " + cAlphaFieldNames(14) + " = " + cAlphaArgs(14)); - ErrorsFound = true; } } - } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); - ShowContinueError(state, "... when checking " + HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num) + " \"" + cAlphaArgs(14) + "\""); - ShowContinueError(state, "... terminal unit not connected to condenser."); - ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); - ShowContinueError( - state, "... also check that the terminal unit list name is specified in an AirConditioner:VariableRefrigerantFlow object."); - ErrorsFound = true; } } - if (!thisVrfTU.CoolingCoilPresent && thisVrfTU.DXCoolCoilType_Num == 0 && !thisVrfTU.HeatingCoilPresent && - thisVrfTU.DXHeatCoilType_Num == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); + if (!vrfTU.CoolingCoilPresent && vrfTU.coolCoilType == HVAC::CoilType::Invalid && + !vrfTU.HeatingCoilPresent && vrfTU.heatCoilType == HVAC::CoilType::Invalid) { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); ShowContinueError(state, "... no valid coils entered for this terminal unit. Simulation will not proceed."); ErrorsFound = true; } if (!lAlphaFieldBlanks(15)) { - thisVrfTU.AvailManagerListName = cAlphaArgs(15); + vrfTU.AvailManagerListName = cAlphaArgs(15); } - thisVrfTU.ParasiticElec = rNumericArgs(8); - thisVrfTU.ParasiticOffElec = rNumericArgs(9); + vrfTU.ParasiticElec = rNumericArgs(8); + vrfTU.ParasiticOffElec = rNumericArgs(9); - thisVrfTU.HVACSizingIndex = 0; + vrfTU.HVACSizingIndex = 0; if (!lAlphaFieldBlanks(16)) { - thisVrfTU.HVACSizingIndex = Util::FindItemInList(cAlphaArgs(16), state.dataSize->ZoneHVACSizing); - if (thisVrfTU.HVACSizingIndex == 0) { + vrfTU.HVACSizingIndex = Util::FindItemInList(cAlphaArgs(16), state.dataSize->ZoneHVACSizing); + if (vrfTU.HVACSizingIndex == 0) { ShowSevereError(state, cAlphaFieldNames(16) + " = " + cAlphaArgs(16) + " not found."); - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + vrfTU.Name); ErrorsFound = true; } } @@ -4146,167 +3705,65 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // supplemental heating coil if (!lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) { - thisVrfTU.SuppHeatCoilType = cAlphaArgs(17); - thisVrfTU.SuppHeatCoilName = cAlphaArgs(18); + vrfTU.suppHeatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, cAlphaArgs(17))); + vrfTU.SuppHeatCoilName = cAlphaArgs(18); - errFlag = false; - if (Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Water")) { - thisVrfTU.SuppHeatCoilType_Num = HVAC::Coil_HeatingWater; - } else if (Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Steam")) { - thisVrfTU.SuppHeatCoilType_Num = HVAC::Coil_HeatingSteam; - } else if (Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Fuel") || - Util::SameString(thisVrfTU.SuppHeatCoilType, "Coil:Heating:Electric")) { - thisVrfTU.SuppHeatCoilType_Num = - HeatingCoils::GetHeatingCoilTypeNum(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag); - } - - thisVrfTU.SuppHeatingCoilPresent = true; - - if (thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingGasOrOtherFuel || thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingElectric) { - errFlag = false; - thisVrfTU.SuppHeatCoilType_Num = - HeatingCoils::GetHeatingCoilTypeNum(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); + vrfTU.SuppHeatingCoilPresent = true; + + if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingElectric) { + // mine data from supplemental heating coil + // Get the supplemental heating coil index + vrfTU.SuppHeatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, vrfTU.SuppHeatCoilName); + if (vrfTU.SuppHeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(18), vrfTU.SuppHeatCoilName); ErrorsFound = true; } else { - ValidateComponent(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK, cCurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } else { // mine data from supplemental heating coil - // Get the supplemental heating coil index - thisVrfTU.SuppHeatCoilIndex = - HeatingCoils::GetHeatingCoilIndex(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK); - if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the design supplemental heating capacity - errFlag = false; - thisVrfTU.DesignSuppHeatingCapacity = - HeatingCoils::GetCoilCapacity(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating Coil air inlet node - errFlag = false; - thisVrfTU.SuppHeatCoilAirInletNode = - HeatingCoils::GetCoilInletNode(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating Coil air outlet node - errFlag = false; - thisVrfTU.SuppHeatCoilAirOutletNode = - HeatingCoils::GetCoilOutletNode(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - } // IF (IsNotOK) THEN + vrfTU.DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, vrfTU.SuppHeatCoilNum); + vrfTU.SuppHeatCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, vrfTU.SuppHeatCoilNum); + vrfTU.SuppHeatCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, vrfTU.SuppHeatCoilNum); } - } else if (thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { + } else if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingWater) { - ValidateComponent(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK, cCurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } else { // mine data from heating coil object - - // Get the supplemental heating coil water Inlet or control node number - errFlag = false; - thisVrfTU.SuppHeatCoilFluidInletNode = - WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating coil hot water max volume flow rate - errFlag = false; - thisVrfTU.SuppHeatCoilFluidMaxFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating Coil air inlet node - errFlag = false; - thisVrfTU.SuppHeatCoilAirInletNode = - WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating coil air outlet node - errFlag = false; - thisVrfTU.SuppHeatCoilAirOutletNode = - WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - } + vrfTU.SuppHeatCoilNum = WaterCoils::GetWaterCoilIndex(state, vrfTU.SuppHeatCoilName); + if (vrfTU.SuppHeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(18), vrfTU.SuppHeatCoilName); + ErrorsFound = true; + } else { + vrfTU.SuppHeatCoilFluidInletNode = WaterCoils::GetCoilWaterInletNode(state, vrfTU.SuppHeatCoilNum); + vrfTU.SuppHeatCoilFluidMaxFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, vrfTU.SuppHeatCoilNum); + vrfTU.SuppHeatCoilAirInletNode = WaterCoils::GetCoilInletNode(state, vrfTU.SuppHeatCoilNum); + vrfTU.SuppHeatCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, vrfTU.SuppHeatCoilNum); + } - } else if (thisVrfTU.SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { + } else if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { - ValidateComponent(state, thisVrfTU.SuppHeatCoilType, thisVrfTU.SuppHeatCoilName, IsNotOK, cCurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); + vrfTU.SuppHeatCoilNum = SteamCoils::GetSteamCoilIndex(state, vrfTU.SuppHeatCoilName); + if (vrfTU.SuppHeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(18), vrfTU.SuppHeatCoilName); ErrorsFound = true; - } else { // mine data from supplemental heating coil object - errFlag = false; - thisVrfTU.SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", thisVrfTU.SuppHeatCoilName, errFlag); - if (thisVrfTU.SuppHeatCoilIndex == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating Coil steam inlet node number - errFlag = false; - thisVrfTU.SuppHeatCoilFluidInletNode = - SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating coil steam max volume flow rate - thisVrfTU.SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisVrfTU.SuppHeatCoilIndex, errFlag); - if (thisVrfTU.SuppHeatCoilFluidMaxFlow > 0.0) { - Real64 TempSteamIn = 100.0; - Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); - thisVrfTU.SuppHeatCoilFluidMaxFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, thisVrfTU.SuppHeatCoilIndex, errFlag) * SteamDensity; - } - // Get the supplemental heating coil air inlet node - errFlag = false; - thisVrfTU.SuppHeatCoilAirInletNode = - SteamCoils::GetCoilAirInletNode(state, thisVrfTU.SuppHeatCoilIndex, thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; - } - // Get the supplemental heating coil air outlet node - errFlag = false; - thisVrfTU.SuppHeatCoilAirOutletNode = - SteamCoils::GetCoilAirOutletNode(state, thisVrfTU.SuppHeatCoilIndex, thisVrfTU.SuppHeatCoilName, errFlag); - if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisVrfTU.Name); - ErrorsFound = true; + } else { + vrfTU.SuppHeatCoilFluidInletNode = SteamCoils::GetCoilSteamInletNode(state, vrfTU.SuppHeatCoilNum); + vrfTU.SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, vrfTU.SuppHeatCoilNum); + if (vrfTU.SuppHeatCoilFluidMaxFlow > 0.0) { + vrfTU.SuppHeatCoilFluidMaxFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } + + vrfTU.SuppHeatCoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, vrfTU.SuppHeatCoilNum); + vrfTU.SuppHeatCoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, vrfTU.SuppHeatCoilNum); } } + } else { // if (!lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) { if (!lAlphaFieldBlanks(17) && lAlphaFieldBlanks(18)) { - ShowWarningError(state, cCurrentModuleObject + " = " + thisVrfTU.Name + "\""); + ShowWarningError(state, cCurrentModuleObject + " = " + vrfTU.Name + "\""); ShowContinueError(state, "...Supplemental heating coil type = " + cAlphaArgs(17)); ShowContinueError(state, "...But missing the associated supplemental heating coil name. "); ShowContinueError(state, "...The supplemental heating coil will not be simulated. "); } if (lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) { - ShowWarningError(state, cCurrentModuleObject + " = " + thisVrfTU.Name + "\""); + ShowWarningError(state, cCurrentModuleObject + " = " + vrfTU.Name + "\""); ShowContinueError(state, "...Supplemental heating coil name = " + cAlphaArgs(18)); ShowContinueError(state, "...But missing the associated supplemental heating coil type. "); ShowContinueError(state, "...The supplemental heating coil will not be simulated. "); @@ -4314,21 +3771,19 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } if (!lAlphaFieldBlanks(19)) { - thisVrfTU.ZoneNum = Util::FindItemInList(cAlphaArgs(19), state.dataHeatBal->Zone); - if (thisVrfTU.ZoneNum == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + cAlphaArgs(1)); - ShowContinueError(state, "Illegal " + cAlphaFieldNames(19) + " = " + cAlphaArgs(19)); + vrfTU.ZoneNum = Util::FindItemInList(cAlphaArgs(19), state.dataHeatBal->Zone); + if (vrfTU.ZoneNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(19), cAlphaArgs(19)); ErrorsFound = true; } } - auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); if (!lAlphaFieldBlanks(20) && !lAlphaFieldBlanks(21)) { vrfTU.DesignSpecMultispeedHPType = cAlphaArgs(20); vrfTU.DesignSpecMultispeedHPName = cAlphaArgs(21); vrfTU.DesignSpecMSHPIndex = UnitarySystems::getDesignSpecMSHPIndex(state, cAlphaArgs(21)); auto const &designSpecFan = state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex]; - if (vrfTU.DXCoolCoilType_Num == HVAC::CoilVRF_Cooling) { + if (vrfTU.coolCoilType == HVAC::CoilType::VRFCooling) { int NumSpeeds = designSpecFan.numOfSpeedCooling; vrfTU.NumOfSpeedCooling = NumSpeeds; vrfTU.CoolVolumeFlowRate.resize(NumSpeeds + 1); @@ -4346,7 +3801,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } } } - if (vrfTU.DXHeatCoilType_Num == HVAC::CoilVRF_Heating) { + if (vrfTU.heatCoilType == HVAC::CoilType::VRFHeating) { int NumSpeeds = designSpecFan.numOfSpeedHeating; vrfTU.NumOfSpeedHeating = NumSpeeds; vrfTU.HeatVolumeFlowRate.resize(NumSpeeds + 1); @@ -4371,7 +3826,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) if (fanSystem->speedControl == Fans::SpeedControl::Discrete) { if (fanSystem->numSpeeds > 1) { - if (vrfTU.DXCoolCoilType_Num == HVAC::CoilVRF_Cooling) { + if (vrfTU.coolCoilType == HVAC::CoilType::VRFCooling) { vrfTU.NumOfSpeedCooling = fanSystem->numSpeeds; vrfTU.CoolVolumeFlowRate.resize(fanSystem->numSpeeds + 1); vrfTU.CoolMassFlowRate.resize(fanSystem->numSpeeds + 1); @@ -4381,7 +3836,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } } } - if (vrfTU.DXHeatCoilType_Num == HVAC::CoilVRF_Heating) { + if (vrfTU.heatCoilType == HVAC::CoilType::VRFHeating) { vrfTU.NumOfSpeedHeating = fanSystem->numSpeeds; vrfTU.HeatVolumeFlowRate.resize(fanSystem->numSpeeds + 1); vrfTU.HeatMassFlowRate.resize(fanSystem->numSpeeds + 1); @@ -4392,7 +3847,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } } ShowWarningError(state, - cCurrentModuleObject + " = " + thisVrfTU.Name + " with Fan:SystemModel is used in " + cAlphaArgs(8) + "\""); + cCurrentModuleObject + " = " + vrfTU.Name + " with Fan:SystemModel is used in " + cAlphaArgs(8) + "\""); ShowContinueError(state, format("...The number of speed = {:.0R}.", double(fanSystem->numSpeeds))); ShowContinueError(state, "...Multiple speed fan will be applied to this unit. The speed number is determined by load."); } @@ -4401,52 +3856,51 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } // set supplemental heating coil operation temperature limits - if (thisVrfTU.SuppHeatingCoilPresent) { + if (vrfTU.SuppHeatingCoilPresent) { // Set maximum supply air temperature for supplemental heating coil if (NumNums < 11) { - thisVrfTU.MaxSATFromSuppHeatCoil = DataSizing::AutoSize; + vrfTU.MaxSATFromSuppHeatCoil = DataSizing::AutoSize; } else { - thisVrfTU.MaxSATFromSuppHeatCoil = rNumericArgs(11); + vrfTU.MaxSATFromSuppHeatCoil = rNumericArgs(11); } // set maximum outdoor dry-bulb temperature for supplemental heating coil operation if (NumNums < 12) { - thisVrfTU.MaxOATSuppHeatingCoil = 21.0; + vrfTU.MaxOATSuppHeatingCoil = 21.0; } else { - thisVrfTU.MaxOATSuppHeatingCoil = rNumericArgs(12); + vrfTU.MaxOATSuppHeatingCoil = rNumericArgs(12); } } // Add cooling coil to component sets array - if (thisVrfTU.CoolingCoilPresent) { + if (vrfTU.CoolingCoilPresent) { SetUpCompSets(state, cCurrentModuleObject, - thisVrfTU.Name, - HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num), + vrfTU.Name, + HVAC::coilTypeNames[(int)vrfTU.coolCoilType], cAlphaArgs(12), - state.dataLoopNodes->NodeID(CCoilInletNodeNum), - state.dataLoopNodes->NodeID(CCoilOutletNodeNum)); + state.dataLoopNodes->NodeID(vrfTU.coolCoilAirInNode), + state.dataLoopNodes->NodeID(vrfTU.coolCoilAirOutNode)); // set heating coil present flag - SetDXCoolingCoilData( - state, thisVrfTU.CoolCoilIndex, ErrorsFound, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, thisVrfTU.HeatingCoilPresent); + DXCoils::SetDXCoilHeatingCoilPresent(state, vrfTU.CoolCoilNum, vrfTU.HeatingCoilPresent); // check that curve types are present in VRF Condenser if cooling coil is present in terminal unit (can be blank) // all curves are checked for correct type if a curve name is entered in the VRF condenser object. Check that the // curve is present if the corresponding coil is entered in the terminal unit. - if (thisVrfTU.VRFSysNum > 0) { - - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType != AlgorithmType::FluidTCtrl) { + if (vrfTU.VRFSysNum > 0) { + auto &vrfCondenser = state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum); + if (vrfCondenser.VRFAlgorithmType != AlgorithmType::FluidTCtrl) { - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CoolingCapacity <= 0 && - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).CoolingCapacity != AutoSize) { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); + if (vrfCondenser.CoolingCapacity <= 0 && + vrfCondenser.CoolingCapacity != AutoSize) { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); ShowContinueError(state, "...This terminal unit contains a cooling coil and rated cooling capacity is also required in the " "associated condenser object."); ShowContinueError(state, "...Rated Cooling Capacity must also be specified for condenser = " + - std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" + - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\"."); + std::string(cVRFTypes(vrfCondenser.VRFSystemTypeNum)) + " \"" + + vrfCondenser.Name + "\"."); ErrorsFound = true; } } @@ -4454,136 +3908,135 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } // Add heating coil to component sets array - if (thisVrfTU.HeatingCoilPresent) { + if (vrfTU.HeatingCoilPresent) { SetUpCompSets(state, cCurrentModuleObject, - thisVrfTU.Name, - HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), + vrfTU.Name, + HVAC::coilTypeNames[(int)vrfTU.heatCoilType], cAlphaArgs(14), - state.dataLoopNodes->NodeID(HCoilInletNodeNum), - state.dataLoopNodes->NodeID(HCoilOutletNodeNum)); + state.dataLoopNodes->NodeID(vrfTU.heatCoilAirInNode), + state.dataLoopNodes->NodeID(vrfTU.heatCoilAirOutNode)); // set cooling coil present flag - SetDXCoolingCoilData( - state, thisVrfTU.HeatCoilIndex, ErrorsFound, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, thisVrfTU.CoolingCoilPresent); + DXCoils::SetDXCoilCoolingCoilPresent(state, vrfTU.HeatCoilNum, vrfTU.CoolingCoilPresent); - if (thisVrfTU.VRFSysNum > 0) { + if (vrfTU.VRFSysNum > 0) { + auto &vrfCondenser = state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum); + if (vrfCondenser.VRFAlgorithmType != AlgorithmType::FluidTCtrl) { - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFAlgorithmType != AlgorithmType::FluidTCtrl) { - - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacity <= 0 && - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacity != AutoSize) { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); + if (vrfCondenser.HeatingCapacity <= 0 && + vrfCondenser.HeatingCapacity != AutoSize) { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and rated heating capacity is also required in the " "associated condenser object."); ShowContinueError(state, "...Rated Heating Capacity must also be specified for condenser = " + - std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" + - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\"."); + std::string(cVRFTypes(vrfCondenser.VRFSystemTypeNum)) + " \"" + + vrfCondenser.Name + "\"."); ErrorsFound = true; } - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatCapFT == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); + if (vrfCondenser.HeatCapFT == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and heating performance curves are also required in the " "associated condenser object."); ShowContinueError( state, "...Heating Capacity Ratio Modifier Function of Low Temperature Curve must also be specified for condenser = " + - std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" + - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\"."); + std::string(cVRFTypes(vrfCondenser.VRFSystemTypeNum)) + " \"" + + vrfCondenser.Name + "\"."); ErrorsFound = true; } - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatEIRFT == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); + if (vrfCondenser.HeatEIRFT == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and heating performance curves are also required in the " "associated condenser object."); ShowContinueError( state, "...Heating Energy Input Ratio Modifier Function of Low Temperature Curve must also be specified for condenser = " + - std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" + - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\"."); + std::string(cVRFTypes(vrfCondenser.VRFSystemTypeNum)) + " \"" + + vrfCondenser.Name + "\"."); ErrorsFound = true; } - if (state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatEIRFPLR1 == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + thisVrfTU.Name + "\""); + if (vrfCondenser.HeatEIRFPLR1 == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + vrfTU.Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and heating performance curves are also required in the " "associated condenser object."); ShowContinueError(state, "...Heating Energy Input Ratio Modifier Function of Low Part-Load Ratio Curve must also be specified " "for condenser = " + - std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).VRFSystemTypeNum)) + " \"" + - state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).Name + "\"."); + std::string(cVRFTypes(vrfCondenser.VRFSystemTypeNum)) + " \"" + + vrfCondenser.Name + "\"."); } } } } // Add supplemental heating coil to component sets array - if (thisVrfTU.SuppHeatingCoilPresent) { + if (vrfTU.SuppHeatingCoilPresent) { SetUpCompSets(state, cCurrentModuleObject, - thisVrfTU.Name, - HVAC::cAllCoilTypes(thisVrfTU.SuppHeatCoilType_Num), - thisVrfTU.SuppHeatCoilName, - state.dataLoopNodes->NodeID(thisVrfTU.SuppHeatCoilAirInletNode), - state.dataLoopNodes->NodeID(thisVrfTU.SuppHeatCoilAirOutletNode)); + vrfTU.Name, + HVAC::coilTypeNames[(int)vrfTU.suppHeatCoilType], + vrfTU.SuppHeatCoilName, + state.dataLoopNodes->NodeID(vrfTU.SuppHeatCoilAirInletNode), + state.dataLoopNodes->NodeID(vrfTU.SuppHeatCoilAirOutletNode)); } // Set up component set for OA mixer - use OA node and Mixed air node - if (thisVrfTU.OAMixerUsed) + if (vrfTU.OAMixerUsed) SetUpCompSets(state, cCurrentModuleObject, - thisVrfTU.Name, + vrfTU.Name, "UNDEFINED", - thisVrfTU.OAMixerName, + vrfTU.OAMixerName, state.dataLoopNodes->NodeID(OANodeNums(1)), state.dataLoopNodes->NodeID(OANodeNums(4))); // Get AirTerminal mixer data GetATMixer(state, - thisVrfTU.Name, - thisVrfTU.ATMixerName, - thisVrfTU.ATMixerIndex, - thisVrfTU.ATMixerType, - thisVrfTU.ATMixerPriNode, - thisVrfTU.ATMixerSecNode, - thisVrfTU.ATMixerOutNode, - thisVrfTU.VRFTUOutletNodeNum); - if (thisVrfTU.ATMixerType == HVAC::MixerType::InletSide || thisVrfTU.ATMixerType == HVAC::MixerType::SupplySide) { - thisVrfTU.ATMixerExists = true; + vrfTU.Name, + vrfTU.ATMixerName, + vrfTU.ATMixerIndex, + vrfTU.ATMixerType, + vrfTU.ATMixerPriNode, + vrfTU.ATMixerSecNode, + vrfTU.ATMixerOutNode, + vrfTU.VRFTUOutletNodeNum); + if (vrfTU.ATMixerType == HVAC::MixerType::InletSide || vrfTU.ATMixerType == HVAC::MixerType::SupplySide) { + vrfTU.ATMixerExists = true; } // check that the VRF TU have local outside air and DOA - if (thisVrfTU.ATMixerExists && OANodeNums(4) > 0) { + if (vrfTU.ATMixerExists && OANodeNums(4) > 0) { ShowSevereError( - state, cCurrentModuleObject + " = \"" + thisVrfTU.Name + "\". VRF terminal unit has local as well as central outdoor air specified"); + state, cCurrentModuleObject + " = \"" + vrfTU.Name + "\". VRF terminal unit has local as well as central outdoor air specified"); ErrorsFound = true; } // for ZoneHVAC check that TU inlet node is a zone exhaust node otherwise ZoneAirNode and ZoneNum = 0 - if (!thisVrfTU.ATMixerExists || thisVrfTU.ATMixerType == HVAC::MixerType::SupplySide) { + if (!vrfTU.ATMixerExists || vrfTU.ATMixerType == HVAC::MixerType::SupplySide) { for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) { - if (thisVrfTU.VRFTUInletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { - thisVrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; - thisVrfTU.ZoneNum = CtrlZone; + if (vrfTU.VRFTUInletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { + vrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; + vrfTU.ZoneNum = CtrlZone; break; } } } - } else if (thisVrfTU.ATMixerType == HVAC::MixerType::InletSide) { + } else if (vrfTU.ATMixerType == HVAC::MixerType::InletSide) { for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) { - if (thisVrfTU.VRFTUOutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { - thisVrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; - thisVrfTU.ZoneNum = CtrlZone; + if (vrfTU.VRFTUOutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { + vrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; + vrfTU.ZoneNum = CtrlZone; break; } } @@ -4649,167 +4102,167 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Set up output variables for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) { - auto &thisVrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); - if (thisVrfTU.CoolingCoilPresent) { + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + if (vrfTU.CoolingCoilPresent) { SetupOutputVariable(state, "Zone VRF Air Terminal Cooling Electricity Rate", Constant::Units::W, - thisVrfTU.ParasiticCoolElecPower, + vrfTU.ParasiticCoolElecPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Cooling Electricity Energy", Constant::Units::J, - thisVrfTU.ParasiticElecCoolConsumption, + vrfTU.ParasiticElecCoolConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name, + vrfTU.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); SetupOutputVariable(state, "Zone VRF Air Terminal Total Cooling Rate", Constant::Units::W, - thisVrfTU.TotalCoolingRate, + vrfTU.TotalCoolingRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Cooling Rate", Constant::Units::W, - thisVrfTU.SensibleCoolingRate, + vrfTU.SensibleCoolingRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Cooling Rate", Constant::Units::W, - thisVrfTU.LatentCoolingRate, + vrfTU.LatentCoolingRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Total Cooling Energy", Constant::Units::J, - thisVrfTU.TotalCoolingEnergy, + vrfTU.TotalCoolingEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Cooling Energy", Constant::Units::J, - thisVrfTU.SensibleCoolingEnergy, + vrfTU.SensibleCoolingEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Cooling Energy", Constant::Units::J, - thisVrfTU.LatentCoolingEnergy, + vrfTU.LatentCoolingEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name); + vrfTU.Name); } - if (thisVrfTU.HeatingCoilPresent) { + if (vrfTU.HeatingCoilPresent) { SetupOutputVariable(state, "Zone VRF Air Terminal Heating Electricity Rate", Constant::Units::W, - thisVrfTU.ParasiticHeatElecPower, + vrfTU.ParasiticHeatElecPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Heating Electricity Energy", Constant::Units::J, - thisVrfTU.ParasiticElecHeatConsumption, + vrfTU.ParasiticElecHeatConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name, + vrfTU.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); SetupOutputVariable(state, "Zone VRF Air Terminal Total Heating Rate", Constant::Units::W, - thisVrfTU.TotalHeatingRate, + vrfTU.TotalHeatingRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Heating Rate", Constant::Units::W, - thisVrfTU.SensibleHeatingRate, + vrfTU.SensibleHeatingRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Heating Rate", Constant::Units::W, - thisVrfTU.LatentHeatingRate, + vrfTU.LatentHeatingRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Total Heating Energy", Constant::Units::J, - thisVrfTU.TotalHeatingEnergy, + vrfTU.TotalHeatingEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Heating Energy", Constant::Units::J, - thisVrfTU.SensibleHeatingEnergy, + vrfTU.SensibleHeatingEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Heating Energy", Constant::Units::J, - thisVrfTU.LatentHeatingEnergy, + vrfTU.LatentHeatingEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - thisVrfTU.Name); + vrfTU.Name); } SetupOutputVariable(state, "Zone VRF Air Terminal Fan Availability Status", Constant::Units::None, - (int &)thisVrfTU.availStatus, + (int &)vrfTU.availStatus, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "Variable Refrigerant Flow Terminal Unit", - thisVrfTU.Name, + vrfTU.Name, "Part Load Ratio", "[fraction]", - thisVrfTU.EMSOverridePartLoadFrac, - thisVrfTU.EMSValueForPartLoadFrac); + vrfTU.EMSOverridePartLoadFrac, + vrfTU.EMSValueForPartLoadFrac); } - if (thisVrfTU.NumOfSpeedCooling > 1 || thisVrfTU.NumOfSpeedHeating > 1) { + if (vrfTU.NumOfSpeedCooling > 1 || vrfTU.NumOfSpeedHeating > 1) { SetupOutputVariable(state, "Zone VRF Air Terminal Multispeed Fan Cycling Ratio", Constant::Units::None, - thisVrfTU.CycRatio, + vrfTU.CycRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Multispeed Fan Speed Ratio", Constant::Units::None, - thisVrfTU.SpeedRatio, + vrfTU.SpeedRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); SetupOutputVariable(state, "Zone VRF Air Terminal Multispeed Fan Speed Level", Constant::Units::None, - thisVrfTU.SpeedNum, + vrfTU.SpeedNum, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - thisVrfTU.Name); + vrfTU.Name); } } @@ -5573,13 +5026,14 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } // IF (MyOneTimeFlag) THEN + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); // identify VRF condenser connected to this TU - VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + VRFCond = vrfTU.VRFSysNum; TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; - InNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum; - OutNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum; - OutsideAirNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; - IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; + InNode = vrfTU.VRFTUInletNodeNum; + OutNode = vrfTU.VRFTUOutletNodeNum; + OutsideAirNode = vrfTU.VRFTUOAMixerOANodeNum; + IndexToTUInTUList = vrfTU.IndexToTUInTUList; SuppHeatCoilCapacity = 0.0; SuppHeatCoilLoad = 0.0; @@ -5602,21 +5056,21 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool if (allocated(state.dataAvail->ZoneComp)) { auto &availMgr = state.dataAvail->ZoneComp(DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal).ZoneCompAvailMgrs(VRFTUNum); if (state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum)) { // initialize the name of each availability manager list and zone number - availMgr.AvailManagerListName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailManagerListName; + availMgr.AvailManagerListName = vrfTU.AvailManagerListName; availMgr.ZoneNum = ZoneNum; state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum) = false; } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).availStatus = availMgr.availStatus; + vrfTU.availStatus = availMgr.availStatus; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && allocated(state.dataPlnt->PlantLoop)) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { + if (vrfTU.MySuppCoilPlantScanFlag && allocated(state.dataPlnt->PlantLoop)) { + if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingWater) { // hot water supplemental heating coil errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, PlantEquipmentType::CoilWaterSimpleHeating, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc, + vrfTU.SuppHeatCoilPlantLoc, errFlag, _, _, @@ -5624,37 +5078,30 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool _, _); - WaterCoils::SetCoilDesFlow(state, - HVAC::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num), - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow, - errFlag); + WaterCoils::SetCoilDesFlow(state, vrfTU.SuppHeatCoilNum, vrfTU.MaxHeatAirVolFlow); if (errFlag) { ShowFatalError(state, format("{}: Program terminated for previous conditions.", RoutineName)); } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = WaterCoils::GetCoilMaxWaterFlowRate( - state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); + vrfTU.SuppHeatCoilFluidMaxFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, vrfTU.SuppHeatCoilNum); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { - rho = state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum) + if (vrfTU.SuppHeatCoilFluidMaxFlow > 0.0) { + rho = state.dataPlnt->PlantLoop(vrfTU.SuppHeatCoilPlantLoc.loopNum) .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * rho; + vrfTU.SuppHeatCoilFluidMaxFlow *= rho; } // fill fluid outlet node for hot water coil SuppHeatCoilFluidOutletNode - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode = - DataPlant::CompData::getPlantComponent(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc).NodeNumOut; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + vrfTU.SuppHeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, vrfTU.SuppHeatCoilPlantLoc).NodeNumOut; + vrfTU.MySuppCoilPlantScanFlag = false; - } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { + } else if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { // steam supplemental heating coil errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, PlantEquipmentType::CoilSteamAirHeating, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc, + vrfTU.SuppHeatCoilPlantLoc, errFlag, _, _, @@ -5664,25 +5111,20 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool if (errFlag) { ShowFatalError(state, format("{}: Program terminated for previous conditions.", RoutineName)); } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { - Real64 TempSteamIn = 100.0; - Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * SteamDensity; + vrfTU.SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, vrfTU.SuppHeatCoilNum); + if (vrfTU.SuppHeatCoilFluidMaxFlow > 0.0) { + vrfTU.SuppHeatCoilFluidMaxFlow *= Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } // fill fluid outlet node for steam coil SuppHeatCoilFluidOutletNode - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode = - DataPlant::CompData::getPlantComponent(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc).NodeNumOut; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + vrfTU.SuppHeatCoilFluidOutletNode = DataPlant::CompData::getPlantComponent(state, vrfTU.SuppHeatCoilPlantLoc).NodeNumOut; + vrfTU.MySuppCoilPlantScanFlag = false; } else { // VRF terminal unit not connected to plant - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + vrfTU.MySuppCoilPlantScanFlag = false; } - } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && !state.dataGlobal->AnyPlantInModel) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + } else if (vrfTU.MySuppCoilPlantScanFlag && !state.dataGlobal->AnyPlantInModel) { + vrfTU.MySuppCoilPlantScanFlag = false; } // one-time check to see if VRF TU's are on ZoneHVAC:EquipmentList or AirloopHVAC or issue warning @@ -5698,40 +5140,35 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool AirLoopFound = false; // reset for next TU ctrlZoneNum = 0; // reset for next TU TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTULoop); - std::string const thisObjectName = state.dataHVACVarRefFlow->VRFTU(TUIndex).Name; - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone) goto EquipList_exit; // already found previously + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); + if (vrfTU.isInZone) goto EquipList_exit; // already found previously for (ELLoop = 1; ELLoop <= state.dataGlobal->NumOfZones; ++ELLoop) { // NumOfZoneEquipLists if (state.dataZoneEquip->ZoneEquipList(ELLoop).Name == "") continue; // dimensioned by NumOfZones. Only valid ones have names. for (ListLoop = 1; ListLoop <= state.dataZoneEquip->ZoneEquipList(ELLoop).NumOfEquipTypes; ++ListLoop) { if (!Util::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipTypeName(ListLoop), - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type])) + tuTypeNames[(int)vrfTU.type])) continue; - if (!Util::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipName(ListLoop), - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)) + if (!Util::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipName(ListLoop), vrfTU.Name)) continue; - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum = ELLoop; - state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone = true; - if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZonePtr == ELLoop) { - state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex; + vrfTU.ZoneNum = ELLoop; + vrfTU.isInZone = true; + if (state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).MasterZonePtr == ELLoop) { + state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).MasterZoneTUIndex = TUIndex; } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode == 0) { + if (vrfTU.ZoneAirNode == 0) { bool ZoneNodeNotFound = true; for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; + if (vrfTU.VRFTUInletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { + vrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } } for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; + if (vrfTU.VRFTUOutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { + vrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } @@ -5742,74 +5179,68 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool ShowSevereError(state, format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow \"{}\" Zone terminal unit air inlet node name " "must be the same as a zone inlet or exhaust node name.", - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + vrfTU.Name)); ShowContinueError(state, "... Zone inlet and exhaust node name is specified in ZoneHVAC:EquipmentConnections object."); ShowContinueError(state, format("... Zone terminal unit inlet node name = {}", - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum))); + state.dataLoopNodes->NodeID(vrfTU.VRFTUInletNodeNum))); ShowContinueError(state, format("... Zone terminal unit outlet node name = {}", - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum))); + state.dataLoopNodes->NodeID(vrfTU.VRFTUOutletNodeNum))); } } goto EquipList_exit; } } // check if the TU is connected to an air loop - if (!state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop) { + if (!vrfTU.isInAirLoop) { for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { for (int BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) { for (int CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { if (Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name, - thisObjectName) && + vrfTU.Name) && Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf, cCurrentModuleObject)) { - state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum = AirLoopNum; + vrfTU.airLoopNum = AirLoopNum; AirLoopFound = true; - state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop = true; + vrfTU.isInAirLoop = true; BranchNodeConnections::TestCompSet( state, cCurrentModuleObject, - thisObjectName, - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum), - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum), + vrfTU.Name, + state.dataLoopNodes->NodeID(vrfTU.VRFTUInletNodeNum), + state.dataLoopNodes->NodeID(vrfTU.VRFTUOutletNodeNum), "Air Nodes"); - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum > 0) { - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = - state.dataZoneEquip->ZoneEquipConfig(state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum).ZoneNode; - int ControlledZoneNum = state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum; + if (vrfTU.ZoneNum > 0) { + vrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(vrfTU.ZoneNum).ZoneNode; for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) + if (state.dataZoneCtrls->TempControlledZone(TstatZoneNum).ActualZoneNum != vrfTU.ZoneNum) continue; - state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = - TUIndex; + state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).MasterZoneTUIndex = TUIndex; AirNodeFound = true; - ctrlZoneNum = ControlledZoneNum; + ctrlZoneNum = vrfTU.ZoneNum; goto EquipList_exit; } for (int TstatZoneNum = 1; TstatZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++TstatZoneNum) { - if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) + if (state.dataZoneCtrls->ComfortControlledZone(TstatZoneNum).ActualZoneNum != vrfTU.ZoneNum) continue; - state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = - TUIndex; + state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).MasterZoneTUIndex = TUIndex; AirNodeFound = true; - ctrlZoneNum = ControlledZoneNum; + ctrlZoneNum = vrfTU.ZoneNum; goto EquipList_exit; } - if (!AirNodeFound && state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum > 0) { - ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName)); + if (!AirNodeFound && vrfTU.ZoneNum > 0) { + ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, vrfTU.Name)); ShowContinueError(state, "Did not find Air node (Zone with Thermostat or Thermal Comfort Thermostat)."); // ShowContinueError(state, format("specified Controlling Zone or Thermostat Location name = {}{}", //, // loc_controlZoneName)); errorsFound = true; } } else if (AirLoopFound) { // control zone name not entered in TU object input - state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; + vrfTU.isSetPointControlled = true; } } if (AirLoopFound) break; @@ -5821,26 +5252,25 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } // check if the TU is connected to an outside air system - if (!AirLoopFound && !state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys) { + if (!AirLoopFound && !vrfTU.isInOASys) { for (int OASysNum = 1; OASysNum <= state.dataAirLoop->NumOASystems; ++OASysNum) { for (int OACompNum = 1; OACompNum <= state.dataAirLoop->OutsideAirSys(OASysNum).NumComponents; ++OACompNum) { - if (!Util::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(OACompNum), - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name) || + if (!Util::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(OACompNum), vrfTU.Name) || !Util::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentType(OACompNum), cCurrentModuleObject)) continue; - state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum = 0; // need air loop number here? - state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys = true; + vrfTU.airLoopNum = 0; // need air loop number here? + vrfTU.isInOASys = true; AirLoopFound = true; - state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; + vrfTU.isSetPointControlled = true; // user may have inadvertently entered a zone name in the OA system TU object - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum = 0; - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = 0; + vrfTU.ZoneNum = 0; + vrfTU.ZoneAirNode = 0; BranchNodeConnections::TestCompSet( state, cCurrentModuleObject, - thisObjectName, - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum), - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum), + vrfTU.Name, + state.dataLoopNodes->NodeID(vrfTU.VRFTUInletNodeNum), + state.dataLoopNodes->NodeID(vrfTU.VRFTUOutletNodeNum), "Air Nodes"); goto EquipList_exit; } @@ -5852,8 +5282,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool DataZoneEquipment::ZoneEquipType sysType_Num = DataZoneEquipment::ZoneEquipType::Invalid; std::string sysName = ""; for (int inletNode = 1; inletNode <= state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).NumInletNodes; inletNode++) { - if (state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).InletNodeAirLoopNum(inletNode) != - state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) + if (state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).InletNodeAirLoopNum(inletNode) != vrfTU.airLoopNum) continue; inletNodeADUNum = state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).InletNodeADUNum(inletNode); if (inletNodeADUNum > 0 && inletNodeADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size()) { @@ -5873,41 +5302,41 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex) .EquipName(EquipNum) != sysName) continue; - state.dataHVACVarRefFlow->VRFTU(TUIndex).zoneSequenceCoolingNum = + vrfTU.zoneSequenceCoolingNum = state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex) .CoolingPriority(EquipNum); - state.dataHVACVarRefFlow->VRFTU(TUIndex).zoneSequenceHeatingNum = + vrfTU.zoneSequenceHeatingNum = state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex) .HeatingPriority(EquipNum); break; } } } else { - ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, thisObjectName)); + ShowSevereError(state, format("Input errors for {}:{}", cCurrentModuleObject, vrfTU.Name)); ShowContinueError(state, "Did not find ZoneHVAC:EquipmentList connected to this VRF terminal unit."); errorsFound = true; } } // Find the number of zones (zone Inlet nodes) attached to an air loop from the air loop number - if (AirLoopFound || state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop) { + if (AirLoopFound || vrfTU.isInAirLoop) { int NumAirLoopZones = 0; bool initLoadBasedControlFlowFracFlagReady = false; Real64 initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax = 0.0; - if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum > 0) - NumAirLoopZones = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesCooled + - state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesHeated; + if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && vrfTU.airLoopNum > 0) + NumAirLoopZones = state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum).NumZonesCooled + + state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum).NumZonesHeated; if (allocated(state.dataAirLoop->AirToZoneNodeInfo)) { initLoadBasedControlFlowFracFlagReady = true; for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) { // zone inlet nodes for cooling - if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesCooled > 0) { - if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) + if (state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum).NumZonesCooled > 0) { + if (state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum) .TermUnitCoolInletNodes(ZoneInSysIndex) == -999) { // the data structure for the zones inlet nodes has not been filled initLoadBasedControlFlowFracFlagReady = false; } else { - int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) + int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum) .TermUnitCoolInletNodes(ZoneInSysIndex); if (state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax == -999.0) { // the node mass flow rate has not been set @@ -5916,13 +5345,13 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } } // zone inlet nodes for heating - if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesHeated > 0) { - if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) + if (state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum).NumZonesHeated > 0) { + if (state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum) .TermUnitHeatInletNodes(ZoneInSysIndex) == -999) { // the data structure for the zones inlet nodes has not been filled initLoadBasedControlFlowFracFlagReady = false; } else { - int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) + int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum) .TermUnitHeatInletNodes(ZoneInSysIndex); if (state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax == -999.0) { // the node mass flow rate has not been set @@ -5935,44 +5364,42 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && initLoadBasedControlFlowFracFlagReady) { Real64 SumOfMassFlowRateMax = 0.0; // initialize the sum of the maximum flows for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) { - int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) + int ZoneInletNodeNum = state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum) .TermUnitCoolInletNodes(ZoneInSysIndex); SumOfMassFlowRateMax += state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax; - if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) - .CoolCtrlZoneNums(ZoneInSysIndex) == state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) { + if (state.dataAirLoop->AirToZoneNodeInfo(vrfTU.airLoopNum) + .CoolCtrlZoneNums(ZoneInSysIndex) == vrfTU.ZoneNum) { initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax = state.dataLoopNodes->Node(ZoneInletNodeNum).MassFlowRateMax; } } if (SumOfMassFlowRateMax != 0.0 && state.dataAirLoop->AirLoopInputsFilled) { if (initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax >= HVAC::SmallAirVolFlow) { - state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac = + vrfTU.controlZoneMassFlowFrac = initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type], - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Fraction of Supply Air Flow That Goes Through the Controlling Zone", - state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac); - state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = false; // redundant + vrfTU.controlZoneMassFlowFrac); + vrfTU.isSetPointControlled = false; // redundant } else { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop && state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum == 0 && - state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode == 0) { + if (vrfTU.isInAirLoop && vrfTU.ZoneNum == 0 && vrfTU.ZoneAirNode == 0) { // TU must be set point controlled and use constant fan mode (or coil out T won't change with PLR/air flow) - state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr > 0) { - if (ScheduleManager::GetScheduleMinValue(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr) == - 0.0) { + vrfTU.isSetPointControlled = true; + if (vrfTU.FanOpModeSchedPtr > 0) { + if (ScheduleManager::GetScheduleMinValue(state, vrfTU.FanOpModeSchedPtr) == 0.0) { ShowSevereError(state, format("{} = {}", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type], - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, "When using set point control, fan operating mode must be continuous (fan " "operating mode schedule values > 0)."); ShowContinueError( state, format("Error found in Supply Air Fan Operating Mode Schedule Name = {}", - state.dataScheduleMgr->Schedule(state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr) + state.dataScheduleMgr->Schedule(vrfTU.FanOpModeSchedPtr) .Name)); ShowContinueError(state, "...schedule values must be (>0., <=1.)"); ErrorsFound = true; @@ -5981,51 +5408,51 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } else { ShowSevereError(state, format("{} = {}", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type], - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, " The Fraction of Supply Air Flow That Goes Through the Controlling Zone is set to 1."); - state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac = 1.0; + vrfTU.controlZoneMassFlowFrac = 1.0; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type], - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Fraction of Supply Air Flow That Goes Through the Controlling Zone", - state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac); + vrfTU.controlZoneMassFlowFrac); } } - } else if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum == 0) { + } else if (vrfTU.ZoneNum == 0) { // TU must be set point controlled and use constant fan mode (or coil outlet T won't change with PLR/air flow rate) // TU inlet air flow rate is also determined by OA system, not TU - state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; + vrfTU.isSetPointControlled = true; } } } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone && state.dataAirLoop->AirLoopInputsFilled) { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanPlace == HVAC::FanPlace::Invalid) { + if (vrfTU.isInZone && state.dataAirLoop->AirLoopInputsFilled) { + if (vrfTU.fanPlace == HVAC::FanPlace::Invalid) { ShowSevereError(state, - format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = {}", state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = {}", vrfTU.Name)); ShowContinueError(state, "Illegal Supply Air Fan Placement."); ErrorsFound = true; } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanIndex == 0) { + if (vrfTU.FanIndex == 0) { ShowSevereError(state, - format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = {}", state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = {}", vrfTU.Name)); ShowContinueError(state, "VRF Terminal Unit fan is required when used as zone equipment."); ErrorsFound = true; } } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled && state.dataAirLoop->AirLoopInputsFilled) { + if (vrfTU.isSetPointControlled && state.dataAirLoop->AirLoopInputsFilled) { bool missingSetPoint = false; - Real64 TUOutNodeSP = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint; - Real64 coolCoilOutNodeSP = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint; - Real64 heatCoilOutNodeSP = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint; + Real64 TUOutNodeSP = state.dataLoopNodes->Node(vrfTU.VRFTUOutletNodeNum).TempSetPoint; + Real64 coolCoilOutNodeSP = state.dataLoopNodes->Node(vrfTU.coolCoilAirOutNode).TempSetPoint; + Real64 heatCoilOutNodeSP = state.dataLoopNodes->Node(vrfTU.heatCoilAirOutNode).TempSetPoint; // SP can be at outlet of TU or at outlet of coils // if supp heat coil is present, a SP must be at the outlet of the TU - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).SuppHeatingCoilPresent) { + if (vrfTU.SuppHeatingCoilPresent) { if (TUOutNodeSP == DataLoopNode::SensedNodeFlagValue) missingSetPoint = true; } else { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanPlace == HVAC::FanPlace::DrawThru) { + if (vrfTU.fanPlace == HVAC::FanPlace::DrawThru) { // then SP must be at TU outlet if (TUOutNodeSP == DataLoopNode::SensedNodeFlagValue) missingSetPoint = true; // or at coil outlet nodes @@ -6042,36 +5469,36 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { ShowSevereError(state, format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow: Missing temperature setpoint for {}", - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + vrfTU.Name)); ShowContinueError(state, "...use a Setpoint Manager to establish a setpoint at the TU or coil(s) outlet node."); ErrorsFound = true; } else if (state.dataGlobal->AnyEnergyManagementSystemInModel) { bool SPNotFound = false; EMSManager::CheckIfNodeSetPointManagedByEMS( - state, state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum, HVAC::CtrlVarType::Temp, SetPointErrorFlag); + state, vrfTU.VRFTUOutletNodeNum, HVAC::CtrlVarType::Temp, SetPointErrorFlag); SPNotFound = SPNotFound || SetPointErrorFlag; EMSManager::CheckIfNodeSetPointManagedByEMS( - state, state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode, HVAC::CtrlVarType::Temp, SetPointErrorFlag); + state, vrfTU.coolCoilAirOutNode, HVAC::CtrlVarType::Temp, SetPointErrorFlag); SPNotFound = SPNotFound || SetPointErrorFlag; EMSManager::CheckIfNodeSetPointManagedByEMS( - state, state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode, HVAC::CtrlVarType::Temp, SetPointErrorFlag); + state, vrfTU.heatCoilAirOutNode, HVAC::CtrlVarType::Temp, SetPointErrorFlag); SPNotFound = SPNotFound || SetPointErrorFlag; // We disable the check at end (if API), because one of the nodes is enough, so there's an almost certainty // that it will throw as you're unlikely going to actuate all three nodes // It's not ideal, but it's better to let slide a bad condition rather than throw false positives... - state.dataLoopNodes->NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum) + state.dataLoopNodes->NodeSetpointCheck(vrfTU.VRFTUOutletNodeNum) .needsSetpointChecking = false; - state.dataLoopNodes->NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode) + state.dataLoopNodes->NodeSetpointCheck(vrfTU.coolCoilAirOutNode) .needsSetpointChecking = false; - state.dataLoopNodes->NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode) + state.dataLoopNodes->NodeSetpointCheck(vrfTU.heatCoilAirOutNode) .needsSetpointChecking = false; if (SPNotFound && state.dataAirLoop->AirLoopInputsFilled) { ShowSevereError( state, format("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow: Missing temperature setpoint for unitary system = {}", - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + vrfTU.Name)); ShowContinueError(state, "...use a Setpoint Manager to establish a setpoint at the TU or coil(s) outlet node."); ShowContinueError(state, "...or use an EMS actuator to establish a temperature setpoint at the coil control node."); ErrorsFound = true; @@ -6080,77 +5507,76 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop || state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys || - state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone) + if (vrfTU.isInAirLoop || vrfTU.isInOASys || + vrfTU.isInZone) continue; if (!state.dataAirLoop->AirLoopInputsFilled) continue; ShowSevereError(state, format("InitVRF: VRF Terminal Unit = [{},{}] is not on any ZoneHVAC:EquipmentList, AirloopHVAC or " "AirLoopHVAC:OutdoorAirSystem:EquipmentList. It will not be simulated.", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type], - state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, "...The VRF AC System associated with this terminal unit may also not be simulated."); } } // TU inlet node must be the same as a zone exhaust node and the OA Mixer return node // check that TU inlet node is a zone exhaust node. - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && - (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists || - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::SupplySide)) { + if (vrfTU.isInZone && + (!vrfTU.ATMixerExists || + vrfTU.ATMixerType == HVAC::MixerType::SupplySide)) { bool ZoneNodeNotFound = true; for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum == + if (vrfTU.VRFTUInletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; + vrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } } if (!ZoneNodeNotFound) break; } - if (ZoneNodeNotFound && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) { + if (ZoneNodeNotFound && !vrfTU.isInAirLoop) { ShowSevereError(state, format("{} \"{}\" Zone terminal unit air inlet node name must be the same as a zone exhaust node name.", cCurrentModuleObject, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + vrfTU.Name)); ShowContinueError(state, "... Zone exhaust node name is specified in ZoneHVAC:EquipmentConnections object."); ShowContinueError(state, format("... Zone terminal unit inlet node name = {}", - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum))); + state.dataLoopNodes->NodeID(vrfTU.VRFTUInletNodeNum))); ErrorsFound = true; } } // check OA Mixer return node - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, errFlag); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum != OANodeNums(3)) { + if (vrfTU.isInZone && !vrfTU.ATMixerExists && + vrfTU.OAMixerUsed) { + Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, vrfTU.OAMixerName, errFlag); + if (vrfTU.VRFTUInletNodeNum != OANodeNums(3)) { ShowSevereError( state, format("{} \"{}\" Zone terminal unit air inlet node name must be the same as the OutdoorAir:Mixer return air node name.", cCurrentModuleObject, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + vrfTU.Name)); ShowContinueError(state, format("... Zone terminal unit air inlet node name = {}", - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum))); + state.dataLoopNodes->NodeID(vrfTU.VRFTUInletNodeNum))); ShowContinueError(state, format("... OutdoorAir:Mixer return air node name = {}", state.dataLoopNodes->NodeID(OANodeNums(3)))); ErrorsFound = true; } } // check that TU outlet node is a zone inlet node. - if ((state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && - (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists || - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::InletSide))) { + if ((vrfTU.isInZone && + (!vrfTU.ATMixerExists || + vrfTU.ATMixerType == HVAC::MixerType::InletSide))) { bool ZoneNodeNotFound = true; for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; + if (vrfTU.VRFTUOutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { + vrfTU.ZoneAirNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } @@ -6161,39 +5587,39 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool ShowSevereError(state, format("{} \"{}\" Zone terminal unit air outlet node name must be the same as a zone inlet node name.", cCurrentModuleObject, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + vrfTU.Name)); ShowContinueError(state, "... Zone inlet node name is specified in ZoneHVAC:EquipmentConnections object."); ShowContinueError(state, format("... Zone terminal unit outlet node name = {}", - state.dataLoopNodes->NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum))); + state.dataLoopNodes->NodeID(vrfTU.VRFTUOutletNodeNum))); ErrorsFound = true; } } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) { + if (vrfTU.isInZone && vrfTU.ATMixerExists) { // check that OA flow in cooling must be set to zero when connected to DOAS - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow != 0) { - ShowWarningError(state, format("{} = {}", cCurrentModuleObject, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + if (vrfTU.CoolOutAirVolFlow != 0) { + ShowWarningError(state, format("{} = {}", cCurrentModuleObject, vrfTU.Name)); ShowContinueError(state, format(".. Cooling Outdoor Air Flow Rate must be zero when {}", cCurrentModuleObject)); ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer"); ShowContinueError(state, ".. Cooling Outdoor Air Flow Rate is set to 0 and simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = 0; + vrfTU.CoolOutAirVolFlow = 0; } // check that OA flow in heating must be set to zero when connected to DOAS - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow != 0) { - ShowWarningError(state, format("{} = {}", cCurrentModuleObject, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + if (vrfTU.HeatOutAirVolFlow != 0) { + ShowWarningError(state, format("{} = {}", cCurrentModuleObject, vrfTU.Name)); ShowContinueError(state, format(".. Heating Outdoor Air Flow Rate must be zero when {}", cCurrentModuleObject)); ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer"); ShowContinueError(state, ".. Heating Outdoor Air Flow Rate is set to 0 and simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = 0; + vrfTU.HeatOutAirVolFlow = 0; } // check that OA flow in no cooling and no heating must be set to zero when connected to DOAS - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow != 0) { - ShowWarningError(state, format("{} = {}", cCurrentModuleObject, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + if (vrfTU.NoCoolHeatOutAirVolFlow != 0) { + ShowWarningError(state, format("{} = {}", cCurrentModuleObject, vrfTU.Name)); ShowContinueError(state, format(".. No Load Outdoor Air Flow Rate must be zero when {}", cCurrentModuleObject)); ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer"); ShowContinueError(state, ".. No Load Outdoor Air Flow Rate is set to 0 and simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0; + vrfTU.NoCoolHeatOutAirVolFlow = 0; } } } // IF(ZoneEquipmentListNotChecked)THEN @@ -6214,32 +5640,31 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the input volume flow rates - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow = - RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; + vrfTU.MaxCoolAirMassFlow = RhoAir * vrfTU.MaxCoolAirVolFlow; + vrfTU.CoolOutAirMassFlow = RhoAir * vrfTU.CoolOutAirVolFlow; + vrfTU.MaxHeatAirMassFlow = RhoAir * vrfTU.MaxHeatAirVolFlow; + vrfTU.HeatOutAirMassFlow = RhoAir * vrfTU.HeatOutAirVolFlow; + vrfTU.MaxNoCoolAirMassFlow = RhoAir * vrfTU.MaxNoCoolAirVolFlow; + vrfTU.MaxNoHeatAirMassFlow = RhoAir * vrfTU.MaxNoHeatAirVolFlow; + vrfTU.NoCoolHeatOutAirMassFlow = RhoAir * vrfTU.NoCoolHeatOutAirVolFlow; // set the node max and min mass flow rates // outside air mixer is optional, check that node num > 0 if (OutsideAirNode > 0) { state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMax = - max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow); + max(vrfTU.CoolOutAirMassFlow, vrfTU.HeatOutAirMassFlow); state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMin = 0.0; state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMinAvail = 0.0; } state.dataLoopNodes->Node(OutNode).MassFlowRateMax = - max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow); + max(vrfTU.MaxCoolAirMassFlow, vrfTU.MaxHeatAirMassFlow); state.dataLoopNodes->Node(OutNode).MassFlowRateMin = 0.0; state.dataLoopNodes->Node(OutNode).MassFlowRateMinAvail = 0.0; state.dataLoopNodes->Node(InNode).MassFlowRateMax = - max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow); + max(vrfTU.MaxCoolAirMassFlow, vrfTU.MaxHeatAirMassFlow); state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum > 0) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum).MassFlowRateMinAvail = 0.0; + if (vrfTU.VRFTUOAMixerRelNodeNum > 0) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRelNodeNum).MassFlowRateMinAvail = 0.0; } state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum) = false; @@ -6262,59 +5687,55 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataHVACVarRefFlow->MyVRFCondFlag(VRFCond) = false; // END IF - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { + if (vrfTU.SuppHeatCoilFluidInletNode > 0) { + if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingWater) { + if (vrfTU.SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { WaterCoils::SimulateWaterCoilComponents(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex); + vrfTU.SuppHeatCoilNum); // design hot water volume flow rate - Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate( - state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); + Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, vrfTU.SuppHeatCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum) + rho = state.dataPlnt->PlantLoop(vrfTU.SuppHeatCoilPlantLoc.loopNum) .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * rho; + vrfTU.SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * rho; } } - } - - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { + + } else if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { + if (vrfTU.SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { SteamCoils::SimulateSteamCoilComponents(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, + vrfTU.SuppHeatCoilNum, 1.0); // design steam volume flow rate - Real64 CoilMaxVolFlowRate = - SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); + Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, vrfTU.SuppHeatCoilNum); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 TempSteamIn = 100.0; - Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * SteamDensity; + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); + vrfTU.SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * SteamDensity; } } } // init water/steam coils min and max flow rates InitComponentNodes(state, 0.0, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode); + vrfTU.SuppHeatCoilFluidMaxFlow, + vrfTU.SuppHeatCoilFluidInletNode, + vrfTU.SuppHeatCoilFluidOutletNode); } // the first time an air loop VRF TU is simulated set isSimulated = true so that the TU initialization // will occur with the first TU simulated this time step. Zone VRF TUs are called during sizing which, if air // loop TUs are included, alters when all TUs appear to have been simulated. Also, BeginEnvrnFlag is true multiple // times during the simulation, reset each time to avoid a different order during sizing and simulation - if (state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags) { + if (state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).reset_isSimulatedFlags) { // if no TUs are in the air loop or outdoor air system they will all be simulated during ManageZoneEquipment // and there is no need to adjust the order of simulation (i.e., when isSimulated are all true for a given system) - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) { - state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).IsSimulated = true; - state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = false; + if (vrfTU.isInAirLoop || vrfTU.isInOASys) { + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).IsSimulated = true; + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).reset_isSimulatedFlags = false; } } @@ -6324,7 +5745,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool if (!state.dataGlobal->BeginEnvrnFlag) { state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum) = true; state.dataHVACVarRefFlow->MyVRFCondFlag(VRFCond) = true; - state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = true; + state.dataHVACVarRefFlow->TerminalUnitList(vrfTU.TUListIndex).reset_isSimulatedFlags = true; } // If all VRF Terminal Units on this VRF AC System have been simulated, reset the IsSimulated flag @@ -6348,211 +5769,211 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // get operating capacity of water and steam coil if (FirstHVACIteration) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { + if (vrfTU.SuppHeatCoilFluidInletNode > 0) { + if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingWater) { // set hot water full flow rate for sizing - Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow; + Real64 mdot = vrfTU.SuppHeatCoilFluidMaxFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc); + vrfTU.SuppHeatCoilFluidInletNode, + vrfTU.SuppHeatCoilFluidOutletNode, + vrfTU.SuppHeatCoilPlantLoc); // simulate water coil to find operating capacity WaterCoils::SimulateWaterCoilComponents(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, + vrfTU.SuppHeatCoilNum, SuppHeatCoilCapacity); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity; - } // from iF VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { + vrfTU.DesignSuppHeatingCapacity = SuppHeatCoilCapacity; + + } else if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingSteam) { // set hot water full flow rate for sizing - Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow; + Real64 mdot = vrfTU.SuppHeatCoilFluidMaxFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc); + vrfTU.SuppHeatCoilFluidInletNode, + vrfTU.SuppHeatCoilFluidOutletNode, + vrfTU.SuppHeatCoilPlantLoc); // simulate steam coil to find operating capacity SteamCoils::SimulateSteamCoilComponents(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, + vrfTU.SuppHeatCoilNum, 1.0, ErrorsFound); // QCoilReq, simulate any load > 0 to get max capacity of steam coil SuppHeatCoilCapacity = - SteamCoils::GetCoilCapacity(state, "Coil:Heating:Steam", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); + SteamCoils::GetCoilCapacity(state, "Coil:Heating:Steam", vrfTU.SuppHeatCoilName, ErrorsFound); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity; + vrfTU.DesignSuppHeatingCapacity = SuppHeatCoilCapacity; } // from if VRFTU( VRFTUNum ).SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam } } // initialize water/steam coil inlet flow rate to zero - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { + if (vrfTU.SuppHeatCoilFluidInletNode > 0) { Real64 mdot = 0.0; PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc); + vrfTU.SuppHeatCoilFluidInletNode, + vrfTU.SuppHeatCoilFluidOutletNode, + vrfTU.SuppHeatCoilPlantLoc); } // one-time checks of flow rate vs fan flow rate if (state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum)) { if (!state.dataGlobal->ZoneSizingCalc && !state.dataGlobal->SysSizingCalc) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace != HVAC::FanPlace::Invalid) { // was > 0 (is 0 invalid?) - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate != AutoSize) { + if (vrfTU.fanPlace != HVAC::FanPlace::Invalid) { // was > 0 (is 0 invalid?) + if (vrfTU.ActualFanVolFlowRate != AutoSize) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow > - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + if (vrfTU.MaxCoolAirVolFlow > + vrfTU.ActualFanVolFlowRate) { ShowWarningError(state, format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, "... has Supply Air Flow Rate During Cooling Operation > Max Fan Volume Flow Rate, should be <="); ShowContinueError(state, format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow)); + vrfTU.MaxCoolAirVolFlow)); ShowContinueError(state, format("... Max Fan Volume Flow Rate = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); + vrfTU.ActualFanVolFlowRate)); ShowContinueError( state, "...the supply air flow rate during cooling operation will be reduced to match and the simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + vrfTU.MaxCoolAirVolFlow = vrfTU.ActualFanVolFlowRate; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow > - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + if (vrfTU.MaxNoCoolAirVolFlow > + vrfTU.ActualFanVolFlowRate) { ShowWarningError(state, format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, "... has Supply Air Flow Rate When No Cooling is Needed > Max Fan Volume Flow Rate, should be <="); ShowContinueError(state, format("... Supply Air Flow Rate When No Cooling is Needed = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow)); + vrfTU.MaxNoCoolAirVolFlow)); ShowContinueError(state, format("... Max Fan Volume Flow Rate = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); + vrfTU.ActualFanVolFlowRate)); ShowContinueError( state, "...the supply air flow rate when no cooling is needed will be reduced to match and the simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + vrfTU.MaxNoCoolAirVolFlow = + vrfTU.ActualFanVolFlowRate; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow) { + if (vrfTU.CoolOutAirVolFlow > vrfTU.MaxCoolAirVolFlow) { ShowWarningError(state, format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError( state, "...The Outdoor Air Flow Rate During Cooling Operation exceeds the Supply Air Flow Rate During Cooling Operation."); ShowContinueError(state, format("...Outdoor Air Flow Rate During Cooling Operation = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow)); + vrfTU.CoolOutAirVolFlow)); ShowContinueError(state, format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow)); + vrfTU.MaxCoolAirVolFlow)); ShowContinueError(state, "...the outdoor air flow rate will be reduced to match and the simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; + vrfTU.CoolOutAirVolFlow = vrfTU.MaxCoolAirVolFlow; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow > - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + if (vrfTU.MaxHeatAirVolFlow > + vrfTU.ActualFanVolFlowRate) { ShowWarningError(state, format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, "... has Supply Air Flow Rate During Heating Operation > Max Fan Volume Flow Rate, should be <="); ShowContinueError(state, format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow)); + vrfTU.MaxHeatAirVolFlow)); ShowContinueError(state, format("... Max Fan Volume Flow Rate = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); + vrfTU.ActualFanVolFlowRate)); ShowContinueError( state, "...the supply air flow rate during cooling operation will be reduced to match and the simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + vrfTU.MaxHeatAirVolFlow = vrfTU.ActualFanVolFlowRate; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow > - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + if (vrfTU.MaxNoHeatAirVolFlow > + vrfTU.ActualFanVolFlowRate) { ShowWarningError(state, format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, "... has Supply Air Flow Rate When No Heating is Needed > Max Fan Volume Flow Rate, should be <="); ShowContinueError(state, format("... Supply Air Flow Rate When No Heating is Needed = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow)); + vrfTU.MaxNoHeatAirVolFlow)); ShowContinueError(state, format("... Max Fan Volume Flow Rate = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); + vrfTU.ActualFanVolFlowRate)); ShowContinueError( state, "...the supply air flow rate when no cooling is needed will be reduced to match and the simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + vrfTU.MaxNoHeatAirVolFlow = + vrfTU.ActualFanVolFlowRate; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow) { + if (vrfTU.HeatOutAirVolFlow > vrfTU.MaxHeatAirVolFlow) { ShowWarningError(state, format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError( state, "...The Outdoor Air Flow Rate During Heating Operation exceeds the Supply Air Flow Rate During Heating Operation."); ShowContinueError(state, format("...Outdoor Air Flow Rate During Heating Operation = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow)); + vrfTU.HeatOutAirVolFlow)); ShowContinueError(state, format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow)); + vrfTU.MaxHeatAirVolFlow)); ShowContinueError(state, "...the outdoor air flow rate will be reduced to match and the simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; + vrfTU.HeatOutAirVolFlow = vrfTU.MaxHeatAirVolFlow; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + if (vrfTU.NoCoolHeatOutAirVolFlow > + vrfTU.ActualFanVolFlowRate) { ShowWarningError(state, format("InitVRF: VRF Terminal Unit = [{}, \"{}\"]", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError( state, "... has a Outdoor Air Flow Rate When No Cooling or Heating is Needed > Max Fan Volume Flow Rate, should be <="); ShowContinueError(state, format("... Outdoor Air Flow Rate When No Cooling or Heating is Needed = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow)); + vrfTU.NoCoolHeatOutAirVolFlow)); ShowContinueError(state, format("... Max Fan Volume Flow Rate = {:.4R} m3/s", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); + vrfTU.ActualFanVolFlowRate)); ShowContinueError(state, "...the outdoor air flow rate when no cooling or heating is needed will be reduced to match and the " "simulation continues."); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + vrfTU.NoCoolHeatOutAirVolFlow = + vrfTU.ActualFanVolFlowRate; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate > 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + if (vrfTU.ActualFanVolFlowRate > 0.0) { + vrfTU.HeatingSpeedRatio = vrfTU.MaxHeatAirVolFlow / + vrfTU.ActualFanVolFlowRate; + vrfTU.CoolingSpeedRatio = vrfTU.MaxCoolAirVolFlow / + vrfTU.ActualFanVolFlowRate; + vrfTU.NoHeatingSpeedRatio = + vrfTU.MaxNoHeatAirVolFlow / + vrfTU.ActualFanVolFlowRate; + vrfTU.NoCoolingSpeedRatio = + vrfTU.MaxNoCoolAirVolFlow / + vrfTU.ActualFanVolFlowRate; } state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum) = false; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate = - state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)->maxAirFlowRate; + vrfTU.ActualFanVolFlowRate = + state.dataFans->fans(vrfTU.FanIndex)->maxAirFlowRate; } } else { state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum) = false; @@ -6583,11 +6004,11 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool TimeStepSysLast = state.dataHVACGlobal->TimeStepSys; state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr > 0) { - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr) == 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp = HVAC::FanOp::Cycling; + if (vrfTU.FanOpModeSchedPtr > 0) { + if (GetCurrentScheduleValue(state, vrfTU.FanOpModeSchedPtr) == 0.0) { + vrfTU.fanOp = HVAC::FanOp::Cycling; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp = HVAC::FanOp::Continuous; + vrfTU.fanOp = HVAC::FanOp::Continuous; } } @@ -6805,65 +6226,65 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxHeatAirMassFlow; + state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = vrfTU.HeatOutAirMassFlow; } else { - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) - state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + if (!vrfTU.isInOASys) + state.dataLoopNodes->Node(InNode).MassFlowRate = vrfTU.MaxHeatAirMassFlow; } } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxCoolAirMassFlow; + state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = vrfTU.CoolOutAirMassFlow; } else { - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) - state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + if (!vrfTU.isInOASys) + state.dataLoopNodes->Node(InNode).MassFlowRate = vrfTU.MaxCoolAirMassFlow; } } else { if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxNoCoolAirMassFlow; + state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = vrfTU.NoCoolHeatOutAirMassFlow; } else { - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) - state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + if (!vrfTU.isInOASys) + state.dataLoopNodes->Node(InNode).MassFlowRate = vrfTU.MaxNoCoolAirMassFlow; } } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxNoHeatAirMassFlow; + state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = vrfTU.NoCoolHeatOutAirMassFlow; } else { - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) - state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + if (!vrfTU.isInOASys) + state.dataLoopNodes->Node(InNode).MassFlowRate = vrfTU.MaxNoHeatAirMassFlow; } } } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) { + if (vrfTU.ATMixerExists) { // There is an air terminal mixer - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::InletSide) { // if there is an inlet side air terminal mixer + if (vrfTU.ATMixerType == HVAC::MixerType::InletSide) { // if there is an inlet side air terminal mixer // set the primary air inlet mass flow rate - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = - min(state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail, - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate); + state.dataLoopNodes->Node(vrfTU.ATMixerPriNode).MassFlowRate = + min(state.dataLoopNodes->Node(vrfTU.ATMixerPriNode).MassFlowRateMaxAvail, + state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate); // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate has already // been set above (it is the "inlet" node flow rate) SimATMixer(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerName, + vrfTU.ATMixerName, FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex); + vrfTU.ATMixerIndex); } } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) + if (vrfTU.OAMixerUsed) MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); + state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); } OnOffAirFlowRatio = 1.0; @@ -6901,17 +6322,17 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // next check for overshoot when constant fan mode is used // check operating load to see if OA will overshoot setpoint temperature when constant fan mode is used - if ((state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Continuous || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) && - !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) { + if ((vrfTU.fanOp == HVAC::FanOp::Continuous || vrfTU.ATMixerExists) && + !vrfTU.isSetPointControlled) { SetCompFlowRate(state, VRFTUNum, VRFCond, true); if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -6929,30 +6350,30 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // If the net cooling capacity overshoots the heating setpoint count as heating load if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != + if (state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::SingleCooling && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // system last operated in cooling mode, change air flows and repeat coil off capacity test - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxHeatAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerOANodeNum).MassFlowRate = + vrfTU.HeatOutAirMassFlow; MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); + state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); } else { - state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataLoopNodes->Node(InNode).MassFlowRate = vrfTU.MaxHeatAirMassFlow; } if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -6986,30 +6407,30 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // If the net heating capacity overshoots the cooling setpoint count as cooling load if (TempOutput > LoadToCoolingSP) { // Don't count as cooling load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != + if (state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::SingleHeating && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxCoolAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerOANodeNum).MassFlowRate = + vrfTU.CoolOutAirMassFlow; MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); + state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); } else { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate = + vrfTU.MaxCoolAirMassFlow; } if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -7027,30 +6448,30 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } } else if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != + if (state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::SingleCooling && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxHeatAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerOANodeNum).MassFlowRate = + vrfTU.HeatOutAirMassFlow; MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); + state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); } else { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate = + vrfTU.MaxHeatAirMassFlow; } if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -7082,28 +6503,28 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } else if (TempOutput > 0.0 && LoadToCoolingSP < 0.0) { // If the net heating capacity overshoots the cooling setpoint count as cooling load // Don't count as cooling load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleHeating && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::SingleHeating && + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxCoolAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerOANodeNum).MassFlowRate = + vrfTU.CoolOutAirMassFlow; MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); + state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); } else { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate = + vrfTU.MaxCoolAirMassFlow; } if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -7125,28 +6546,28 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // see if the terminal unit operation will exceed the setpoint } else if (TempOutput < 0.0 && LoadToHeatingSP > 0.0) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleCooling && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::SingleCooling && + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // system last operated in cooling mode, change air flows and repeat coil off capacity test - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxHeatAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerOANodeNum).MassFlowRate = + vrfTU.HeatOutAirMassFlow; MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); + state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); } else { - state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataLoopNodes->Node(InNode).MassFlowRate = vrfTU.MaxHeatAirMassFlow; } if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -7272,61 +6693,61 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // set the TU flow rate. Check for heat recovery operation first, these will be FALSE if HR is not used. if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoHeatingSpeedRatio; } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && QZnReq != 0.0) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && QZnReq != 0.0) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoHeatingSpeedRatio; } else { if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.HeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoHeatingSpeedRatio; } - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling) { + if (vrfTU.fanOp == HVAC::FanOp::Cycling) { state.dataHVACVarRefFlow->CompOffMassFlow = 0.0; state.dataHVACVarRefFlow->OACompOffMassFlow = 0.0; state.dataHVACVarRefFlow->CompOffFlowRatio = 0.0; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0 || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum = 0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedRatio = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CycRatio = 0.0; + if (vrfTU.NumOfSpeedHeating > 0 || vrfTU.NumOfSpeedCooling > 0) { + vrfTU.SpeedNum = 0; + vrfTU.SpeedRatio = 0.0; + vrfTU.CycRatio = 0.0; } SetAverageAirFlow(state, VRFTUNum, 0.0, OnOffAirFlowRatio); @@ -7361,87 +6782,88 @@ void SetCompFlowRate(EnergyPlusData &state, int const VRFTUNum, int const VRFCon int IndexToTUInTUList; // - index to TU in specific list for this VRF system int TUListIndex; // index to TU list for this VRF system - IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; - TUListIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + IndexToTUInTUList = vrfTU.IndexToTUInTUList; + TUListIndex = vrfTU.TUListIndex; // uses current operating mode to set flow rate (after mode is set) if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoHeatingSpeedRatio; } else if (UseCurrentMode) { // uses current operating mode to set flow rate (after mode is set) if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoHeatingSpeedRatio; } else if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { // if NOT cooling or heating then use last mode - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // if NOT cooling or heating then use last mode - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoHeatingSpeedRatio; } else { // should not happen so just set to cooling flow rate - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } } else { // uses previous operating mode to set flow rate (used for looping through each TU in Init before mode is set) if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoHeatingSpeedRatio; } else { // should not happen so just set to cooling flow rate - state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; - state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; - state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; - state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = vrfTU.MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = vrfTU.MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = vrfTU.CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = vrfTU.NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = vrfTU.CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = vrfTU.NoCoolingSpeedRatio; } } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling) { + if (vrfTU.fanOp == HVAC::FanOp::Cycling) { state.dataHVACVarRefFlow->CompOffMassFlow = 0.0; state.dataHVACVarRefFlow->OACompOffMassFlow = 0.0; state.dataHVACVarRefFlow->CompOffFlowRatio = 0.0; @@ -7515,6 +6937,8 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) int FieldNum = 2; // IDD numeric field number where input field description is found bool PrintFlag = true; // TRUE when sizing information is reported in the eio file + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing; DataSizing::ZoneEqSizingData *select_EqSizing(nullptr); @@ -7547,7 +6971,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) EqSizing.DesHeatingLoad = 0.0; EqSizing.OAVolFlow = 0.0; - VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + VRFCond = vrfTU.VRFSysNum; MaxCoolAirVolFlowDes = 0.0; MaxCoolAirVolFlowUser = 0.0; MaxHeatAirVolFlowDes = 0.0; @@ -7587,45 +7011,42 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) state.dataHVACVarRefFlow->MyOneTimeSizeFlag = false; } - CompType = tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type]; - CompName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name; - state.dataSize->DataZoneNumber = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum; + CompType = tuTypeNames[(int)vrfTU.type]; + CompName = vrfTU.Name; + state.dataSize->DataZoneNumber = vrfTU.ZoneNum; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { - state.dataSize->DataFanType = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType; - state.dataSize->DataFanIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; - state.dataSize->DataFanPlacement = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace; - } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) { - state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanType = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType; - state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanNum = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; - state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanPlace = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace; + if (vrfTU.FanIndex > 0) { + if (vrfTU.isInZone) { + state.dataSize->DataFanType = vrfTU.fanType; + state.dataSize->DataFanIndex = vrfTU.FanIndex; + state.dataSize->DataFanPlacement = vrfTU.fanPlace; + } else if (vrfTU.isInAirLoop) { + state.dataAirSystemsData->PrimaryAirSystems(vrfTU.airLoopNum).supFanType = vrfTU.fanType; + state.dataAirSystemsData->PrimaryAirSystems(vrfTU.airLoopNum).supFanNum = vrfTU.FanIndex; + state.dataAirSystemsData->PrimaryAirSystems(vrfTU.airLoopNum).supFanPlace = vrfTU.fanPlace; } } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex > 0) { + if (vrfTU.HVACSizingIndex > 0) { // initialize OA flow for sizing other inputs (e.g., capacity) - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) { + if (vrfTU.CoolOutAirVolFlow == AutoSize) { EqSizing.OAVolFlow = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA; } else { - EqSizing.OAVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow; + EqSizing.OAVolFlow = vrfTU.CoolOutAirVolFlow; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow != AutoSize) { - EqSizing.OAVolFlow = max(EqSizing.OAVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); + if (vrfTU.HeatOutAirVolFlow != AutoSize) { + EqSizing.OAVolFlow = max(EqSizing.OAVolFlow, vrfTU.HeatOutAirVolFlow); } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for scalable capacity sizing + if (vrfTU.ATMixerExists && + vrfTU.isInZone) { // set up ATMixer conditions for scalable capacity sizing EqSizing.OAVolFlow = 0.0; // Equipment OA flow should always be 0 when ATMixer is used SingleDuct::setATMixerSizingProperties(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum, + vrfTU.ATMixerIndex, + vrfTU.ZoneNum, state.dataSize->CurZoneEqNum); } - int zoneHVACIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex; + int zoneHVACIndex = vrfTU.HVACSizingIndex; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, // HeatingCapacitySizing, etc.) @@ -7663,7 +7084,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == FlowPerCoolingCapacity) { SizingMethod = CoolingCapacitySizing; // either this isn't needed or needs to be assigned to EqSizing @@ -7687,32 +7108,32 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } // Multispeed Fan cooling flow sizing - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) { - Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; - for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling; ++i) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) { - if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] + if (vrfTU.NumOfSpeedCooling > 0) { + Real64 AirFlowRate = vrfTU.MaxCoolAirVolFlow; + for (int i = 1; i <= vrfTU.NumOfSpeedCooling; ++i) { + if (vrfTU.DesignSpecMSHPIndex > -1) { + if (state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex] .coolingVolFlowRatio[i] == DataSizing::AutoSize) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] = - double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling) * AirFlowRate; + vrfTU.CoolVolumeFlowRate[i] = + double(i) / double(vrfTU.NumOfSpeedCooling) * AirFlowRate; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] = - state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] + vrfTU.CoolVolumeFlowRate[i] = + state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex] .coolingVolFlowRatio[i] * AirFlowRate; } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; + vrfTU.CoolMassFlowRate[i] = + vrfTU.CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; } else { - auto *fanSystem = dynamic_cast(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)); + auto *fanSystem = dynamic_cast(state.dataFans->fans(vrfTU.FanIndex)); assert(fanSystem != nullptr); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir; + if (vrfTU.CoolMassFlowRate[i] == 0.0) { + vrfTU.CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; + vrfTU.CoolVolumeFlowRate[i] = + vrfTU.CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir; } } } @@ -7749,7 +7170,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == FlowPerHeatingCapacity) { SizingMethod = HeatingCapacitySizing; // either this isn't needed or needs to be assigned to EqSizing TempSize = AutoSize; @@ -7773,32 +7194,32 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } // Multispeed Fan heating flow sizing - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) { - Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; - for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating; ++i) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) { - if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] + if (vrfTU.NumOfSpeedHeating > 0) { + Real64 AirFlowRate = vrfTU.MaxHeatAirVolFlow; + for (int i = 1; i <= vrfTU.NumOfSpeedHeating; ++i) { + if (vrfTU.DesignSpecMSHPIndex > -1) { + if (state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex] .heatingVolFlowRatio[i] == DataSizing::AutoSize) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] = - double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating) * AirFlowRate; + vrfTU.HeatVolumeFlowRate[i] = + double(i) / double(vrfTU.NumOfSpeedHeating) * AirFlowRate; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] = - state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] + vrfTU.HeatVolumeFlowRate[i] = + state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex] .heatingVolFlowRatio[i] * AirFlowRate; } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; + vrfTU.HeatMassFlowRate[i] = + vrfTU.HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; } else { - auto *fanSystem = dynamic_cast(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)); + auto *fanSystem = dynamic_cast(state.dataFans->fans(vrfTU.FanIndex)); assert(fanSystem != nullptr); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] == 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir; + if (vrfTU.HeatMassFlowRate[i] == 0.0) { + vrfTU.HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; + vrfTU.HeatVolumeFlowRate[i] = + vrfTU.HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir; } } } @@ -7840,15 +7261,15 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[1]; + if (vrfTU.NumOfSpeedCooling > 0) { + vrfTU.MaxNoCoolAirVolFlow = vrfTU.CoolVolumeFlowRate[1]; sizingCoolingAirFlow.reportSizerOutput(state, sizingCoolingAirFlow.compType, sizingCoolingAirFlow.compName, "Design Size " + stringOverride, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow); + vrfTU.MaxNoCoolAirVolFlow); } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxNoCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } } @@ -7890,15 +7311,15 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingNoHeatingAirFlow.overrideSizingString(SizingString); // sizingNoHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingNoHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[1]; + if (vrfTU.NumOfSpeedHeating > 0) { + vrfTU.MaxNoHeatAirVolFlow = vrfTU.HeatVolumeFlowRate[1]; sizingNoHeatingAirFlow.reportSizerOutput(state, sizingNoHeatingAirFlow.compType, sizingNoHeatingAirFlow.compName, "Design Size " + SizingString, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow); + vrfTU.MaxNoHeatAirVolFlow); } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = sizingNoHeatingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxNoHeatAirVolFlow = sizingNoHeatingAirFlow.size(state, TempSize, errorsFound); } } @@ -7930,7 +7351,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) PrintFlag = true; - TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; + TempSize = vrfTU.MaxCoolAirVolFlow; bool errorsFound = false; CoolingAirFlowSizer sizingCoolingAirFlow; std::string stringOverride = "Cooling Supply Air Flow Rate [m3/s]"; @@ -7938,31 +7359,31 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); // Multispeed Fan cooling flow sizing - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) { - Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; - for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling; ++i) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) { - if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] + if (vrfTU.NumOfSpeedCooling > 0) { + Real64 AirFlowRate = vrfTU.MaxCoolAirVolFlow; + for (int i = 1; i <= vrfTU.NumOfSpeedCooling; ++i) { + if (vrfTU.DesignSpecMSHPIndex > -1) { + if (state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex] .coolingVolFlowRatio[i] == DataSizing::AutoSize) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] = - double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling) * AirFlowRate; + vrfTU.CoolVolumeFlowRate[i] = + double(i) / double(vrfTU.NumOfSpeedCooling) * AirFlowRate; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] = - state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] + vrfTU.CoolVolumeFlowRate[i] = + state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex] .coolingVolFlowRatio[i] * AirFlowRate; } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; + vrfTU.CoolMassFlowRate[i] = + vrfTU.CoolVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; } else { - auto *fanSystem = dynamic_cast(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)); + auto *fanSystem = dynamic_cast(state.dataFans->fans(vrfTU.FanIndex)); assert(fanSystem != nullptr); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir; + if (vrfTU.CoolMassFlowRate[i] == 0.0) { + vrfTU.CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; + vrfTU.CoolVolumeFlowRate[i] = + vrfTU.CoolMassFlowRate[i] / state.dataEnvrn->StdRhoAir; } } } @@ -7971,37 +7392,31 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; int SizingMethod = HeatingAirflowSizing; // either this isn't needed or needs to be assigned to EqSizing - TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; + TempSize = vrfTU.MaxHeatAirVolFlow; errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + vrfTU.MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); // Multispeed Fan heating flow sizing - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) { - Real64 AirFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; - for (int i = 1; i <= state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating; ++i) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) { - if (state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] - .heatingVolFlowRatio[i] == DataSizing::AutoSize) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] = - double(i) / double(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating) * AirFlowRate; + if (vrfTU.NumOfSpeedHeating > 0) { + Real64 AirFlowRate = vrfTU.MaxHeatAirVolFlow; + for (int i = 1; i <= vrfTU.NumOfSpeedHeating; ++i) { + if (vrfTU.DesignSpecMSHPIndex > -1) { + if (state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex].heatingVolFlowRatio[i] == DataSizing::AutoSize) { + vrfTU.HeatVolumeFlowRate[i] = double(i) / double(vrfTU.NumOfSpeedHeating) * AirFlowRate; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] = - state.dataUnitarySystems->designSpecMSHP[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex] - .heatingVolFlowRatio[i] * + vrfTU.HeatVolumeFlowRate[i] = state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex].heatingVolFlowRatio[i] * AirFlowRate; } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; + vrfTU.HeatMassFlowRate[i] = vrfTU.HeatVolumeFlowRate[i] * state.dataEnvrn->StdRhoAir; } else { - auto *fanSystem = dynamic_cast(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)); + auto *fanSystem = dynamic_cast(state.dataFans->fans(vrfTU.FanIndex)); assert(fanSystem != nullptr); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] == 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[i] = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir; + if (vrfTU.HeatMassFlowRate[i] == 0.0) { + vrfTU.HeatMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1]; + vrfTU.HeatVolumeFlowRate[i] = vrfTU.HeatMassFlowRate[i] / state.dataEnvrn->StdRhoAir; } } } @@ -8012,68 +7427,68 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) std::string sizingString = "No Cooling Supply Air Flow Rate [m3/s]"; sizerSystemAirFlow.overrideSizingString(sizingString); sizerSystemAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[1]; + if (vrfTU.NumOfSpeedCooling > 0) { + vrfTU.MaxNoCoolAirVolFlow = vrfTU.CoolVolumeFlowRate[1]; sizerSystemAirFlow.reportSizerOutput(state, sizerSystemAirFlow.compType, sizerSystemAirFlow.compName, "Design Size " + sizingString, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow); + vrfTU.MaxNoCoolAirVolFlow); } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = - sizerSystemAirFlow.size(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow, errorsFound); + vrfTU.MaxNoCoolAirVolFlow = + sizerSystemAirFlow.size(state, vrfTU.MaxNoCoolAirVolFlow, errorsFound); } SystemAirFlowSizer sizerSystemAirFlow2; sizingString = "No Heating Supply Air Flow Rate [m3/s]"; sizerSystemAirFlow2.overrideSizingString(sizingString); sizerSystemAirFlow2.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[1]; + if (vrfTU.NumOfSpeedHeating > 0) { + vrfTU.MaxNoHeatAirVolFlow = vrfTU.HeatVolumeFlowRate[1]; sizerSystemAirFlow.reportSizerOutput(state, sizerSystemAirFlow.compType, sizerSystemAirFlow.compName, "Design Size " + sizingString, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow); + vrfTU.MaxNoHeatAirVolFlow); } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = - sizerSystemAirFlow2.size(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow, errorsFound); + vrfTU.MaxNoHeatAirVolFlow = + sizerSystemAirFlow2.size(state, vrfTU.MaxNoHeatAirVolFlow, errorsFound); } } IsAutoSize = false; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) { + if (vrfTU.CoolOutAirVolFlow == AutoSize) { IsAutoSize = true; } if (state.dataSize->CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) { + if (vrfTU.CoolOutAirVolFlow > 0.0) { BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); + vrfTU.CoolOutAirVolFlow); } } else { - CheckZoneSizing(state, tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); + CheckZoneSizing(state, tuTypeNames[(int)vrfTU.type], vrfTU.Name); CoolOutAirVolFlowDes = - min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow); + min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, vrfTU.MaxCoolAirVolFlow); if (CoolOutAirVolFlowDes < HVAC::SmallAirVolFlow) { CoolOutAirVolFlowDes = 0.0; } if (IsAutoSize) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = CoolOutAirVolFlowDes; + vrfTU.CoolOutAirVolFlow = CoolOutAirVolFlowDes; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]", CoolOutAirVolFlowDes); } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 && CoolOutAirVolFlowDes > 0.0) { - CoolOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow; + if (vrfTU.CoolOutAirVolFlow > 0.0 && CoolOutAirVolFlowDes > 0.0) { + CoolOutAirVolFlowUser = vrfTU.CoolOutAirVolFlow; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]", CoolOutAirVolFlowDes, "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]", @@ -8083,8 +7498,8 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeVRF: Potential issue with equipment sizing for {} {}", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError( state, format("User-Specified Outdoor Air Flow Rate During Cooling Operation of {:.5R} [m3/s]", CoolOutAirVolFlowUser)); @@ -8099,56 +7514,56 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) } } } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == DataSizing::AutoSize) { + if (vrfTU.CoolOutAirVolFlow == DataSizing::AutoSize) { if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).OASysExists) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = 0.0; + vrfTU.CoolOutAirVolFlow = 0.0; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = + vrfTU.CoolOutAirVolFlow = min(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesOutAirVolFlow, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow); + vrfTU.MaxCoolAirVolFlow); } BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); + vrfTU.CoolOutAirVolFlow); } } IsAutoSize = false; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow == AutoSize) { + if (vrfTU.HeatOutAirVolFlow == AutoSize) { IsAutoSize = true; } if (state.dataSize->CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) { + if (vrfTU.CoolOutAirVolFlow > 0.0) { BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Outdoor Air Flow Rate During Heating Operation [m3/s]", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); + vrfTU.CoolOutAirVolFlow); } } else { - CheckZoneSizing(state, tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); + CheckZoneSizing(state, tuTypeNames[(int)vrfTU.type], vrfTU.Name); HeatOutAirVolFlowDes = - min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow); + min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, vrfTU.MaxHeatAirVolFlow); if (HeatOutAirVolFlowDes < HVAC::SmallAirVolFlow) { HeatOutAirVolFlowDes = 0.0; } if (IsAutoSize) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = HeatOutAirVolFlowDes; + vrfTU.HeatOutAirVolFlow = HeatOutAirVolFlowDes; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]", HeatOutAirVolFlowDes); } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0 && HeatOutAirVolFlowDes > 0.0) { - HeatOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow; + if (vrfTU.HeatOutAirVolFlow > 0.0 && HeatOutAirVolFlowDes > 0.0) { + HeatOutAirVolFlowUser = vrfTU.HeatOutAirVolFlow; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]", HeatOutAirVolFlowDes, "User-Specified Outdoor Air Flow Rate During Heating Operation [m3/s]", @@ -8158,8 +7573,8 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeVRF: Potential issue with equipment sizing for {} {}", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError( state, format("User-Specified Outdoor Air Flow Rate During Heating Operation of {:.5R} [m3/s]", HeatOutAirVolFlowUser)); @@ -8174,68 +7589,66 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) } } } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow == DataSizing::AutoSize) { + if (vrfTU.HeatOutAirVolFlow == DataSizing::AutoSize) { if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).OASysExists) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = 0.0; + vrfTU.HeatOutAirVolFlow = 0.0; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = - min(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesOutAirVolFlow, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow); + vrfTU.HeatOutAirVolFlow = min(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesOutAirVolFlow, vrfTU.MaxHeatAirVolFlow); } BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); + vrfTU.HeatOutAirVolFlow); } } - EqSizing.OAVolFlow = - max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); + + EqSizing.OAVolFlow = max(vrfTU.CoolOutAirVolFlow, vrfTU.HeatOutAirVolFlow); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for use in component sizing + if (vrfTU.ATMixerExists && + vrfTU.isInZone) { // set up ATMixer conditions for use in component sizing EqSizing.OAVolFlow = 0.0; // Equipment OA flow should always be 0 when ATMixer is used SingleDuct::setATMixerSizingProperties(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum, + vrfTU.ATMixerIndex, + vrfTU.ZoneNum, state.dataSize->CurZoneEqNum); } IsAutoSize = false; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == AutoSize) { + if (vrfTU.NoCoolHeatOutAirVolFlow == AutoSize) { IsAutoSize = true; } if (state.dataSize->CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0) { + if (vrfTU.NoCoolHeatOutAirVolFlow > 0.0) { BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow); + vrfTU.NoCoolHeatOutAirVolFlow); } } else { - CheckZoneSizing(state, tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); + CheckZoneSizing(state, tuTypeNames[(int)vrfTU.type], vrfTU.Name); NoCoolHeatOutAirVolFlowDes = min(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); + vrfTU.HeatOutAirVolFlow, + vrfTU.CoolOutAirVolFlow); if (NoCoolHeatOutAirVolFlowDes < HVAC::SmallAirVolFlow) { NoCoolHeatOutAirVolFlowDes = 0.0; } if (IsAutoSize) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = NoCoolHeatOutAirVolFlowDes; + vrfTU.NoCoolHeatOutAirVolFlow = NoCoolHeatOutAirVolFlowDes; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", NoCoolHeatOutAirVolFlowDes); } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0 && NoCoolHeatOutAirVolFlowDes > 0.0) { - NoCoolHeatOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; + if (vrfTU.NoCoolHeatOutAirVolFlow > 0.0 && NoCoolHeatOutAirVolFlowDes > 0.0) { + NoCoolHeatOutAirVolFlowUser = vrfTU.NoCoolHeatOutAirVolFlow; BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", NoCoolHeatOutAirVolFlowDes, "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", @@ -8245,8 +7658,8 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeVRF: Potential issue with equipment sizing for {} {}", - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); + tuTypeNames[(int)vrfTU.type], + vrfTU.Name)); ShowContinueError(state, format("User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed of {:.5R} [m3/s]", NoCoolHeatOutAirVolFlowUser)); @@ -8262,56 +7675,44 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) } } } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) { + if (vrfTU.NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) { if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).OASysExists) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0.0; - } else { - if (!(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedCooling > 0 && - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NumOfSpeedHeating > 0)) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = - min(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow); - } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSpecMSHPIndex > -1) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = - min(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatVolumeFlowRate[1], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolVolumeFlowRate[1]); - } - } + vrfTU.NoCoolHeatOutAirVolFlow = 0.0; + } else if (!(vrfTU.NumOfSpeedCooling > 0 && vrfTU.NumOfSpeedHeating > 0)) { + vrfTU.NoCoolHeatOutAirVolFlow = min(vrfTU.MaxCoolAirVolFlow, vrfTU.MaxHeatAirVolFlow); + } else if (vrfTU.DesignSpecMSHPIndex > -1) { + vrfTU.NoCoolHeatOutAirVolFlow = min(vrfTU.HeatVolumeFlowRate[1], vrfTU.CoolVolumeFlowRate[1]); } BaseSizer::reportSizerOutput(state, - tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(VRFTUNum).type], - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + tuTypeNames[(int)vrfTU.type], + vrfTU.Name, "Design Size Outdoor Air Flow Rate When No Cooling or Heating Heating is Needed [m3/s]", - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow); + vrfTU.NoCoolHeatOutAirVolFlow); } } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (vrfTU.SuppHeatingCoilPresent) { bool ErrorsFound = false; - TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil; + TempSize = vrfTU.MaxSATFromSuppHeatCoil; MaxHeaterOutletTempSizer sizerMaxHeaterOutTemp; std::string stringOverride = "Maximum Supply Air Temperature from Supplemental Heater [C]"; if (state.dataGlobal->isEpJSON) stringOverride = "maximum_supply_air_temperature_from_supplemental_heater [C]"; sizerMaxHeaterOutTemp.overrideSizingString(stringOverride); sizerMaxHeaterOutTemp.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil = sizerMaxHeaterOutTemp.size(state, TempSize, ErrorsFound); + vrfTU.MaxSATFromSuppHeatCoil = sizerMaxHeaterOutTemp.size(state, TempSize, ErrorsFound); } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { - bool ErrorsFound = false; - WaterCoils::SetCoilDesFlow(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow, - ErrorsFound); + if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SetCoilDesFlow(state, vrfTU.SuppHeatCoilNum, vrfTU.MaxHeatAirVolFlow); } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { - CompType = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType; - CompName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName; + if (vrfTU.SuppHeatingCoilPresent) { + CompType = HVAC::coilTypeNames[(int)vrfTU.suppHeatCoilType]; + CompName = vrfTU.SuppHeatCoilName; PrintFlag = false; // why isn't this being reported? - TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == HVAC::Coil_HeatingWater) { + TempSize = vrfTU.DesignSuppHeatingCapacity; + + if (vrfTU.suppHeatCoilType == HVAC::CoilType::HeatingWater) { // sizing result should always be reported if (TempSize == DataSizing::AutoSize) { WaterHeatingCapacitySizer sizerWaterHeatingCapacity; @@ -8319,8 +7720,8 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) std::string stringOverride = "Supplemental Heating Coil Nominal Capacity [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "supplemental_heating_coil_nominal_capacity [W]"; sizerWaterHeatingCapacity.overrideSizingString(stringOverride); - sizerWaterHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerWaterHeatingCapacity.size(state, TempSize, ErrorsFound); + sizerWaterHeatingCapacity.initializeWithinEP(state, HVAC::coilTypeNames[(int)vrfTU.suppHeatCoilType], CompName, PrintFlag, RoutineName); + vrfTU.DesignSuppHeatingCapacity = sizerWaterHeatingCapacity.size(state, TempSize, ErrorsFound); } } else { SizingString = "Supplemental Heating Coil Nominal Capacity [W]"; @@ -8329,25 +7730,25 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); + vrfTU.DesignSuppHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); } } } EqSizing.CoolingAirFlow = true; - EqSizing.CoolingAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; + EqSizing.CoolingAirVolFlow = vrfTU.MaxCoolAirVolFlow; EqSizing.HeatingAirFlow = true; - EqSizing.HeatingAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; + EqSizing.HeatingAirVolFlow = vrfTU.MaxHeatAirVolFlow; if (CheckVRFCombinationRatio(VRFCond)) { OnOffAirFlowRat = 1.0; // set up the outside air data for sizing the DX coils - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) state.dataSize->ZoneEqDXCoil = true; + if (vrfTU.isInZone) state.dataSize->ZoneEqDXCoil = true; if (state.dataSize->CurZoneEqNum > 0) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 || - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0) { + if (vrfTU.CoolOutAirVolFlow > 0.0 || + vrfTU.HeatOutAirVolFlow > 0.0) { EqSizing.OAVolFlow = - max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); + max(vrfTU.CoolOutAirVolFlow, vrfTU.HeatOutAirVolFlow); } else { EqSizing.OAVolFlow = 0.0; } @@ -8359,11 +7760,11 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) // simulate the TU to size the coils if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( - state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); + // So ... this is a method but yet you have pass the index of the object to it? + vrfTU.CalcVRF_FluidTCtrl(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); + vrfTU.CalcVRF(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); } // ZoneEqDXCoil = .FALSE. @@ -8371,25 +7772,20 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) TUHeatingCapacity = 0.0; bool FoundAll = true; bool errFlag; // temporary variable used for error checking - int TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; + int TUListNum = vrfTU.TUListIndex; for (int NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex > 0) { - DXCoilCap = DXCoils::GetCoilCapacityByIndexType(state, - state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex, - state.dataHVACVarRefFlow->VRFTU(TUIndex).DXCoolCoilType_Num, - errFlag); + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); + if (vrfTU.CoolCoilNum > 0) { + DXCoilCap = DXCoils::GetCoilCapacity(state, vrfTU.CoolCoilNum); TUCoolingCapacity += DXCoilCap; if (DXCoilCap == AutoSize) { FoundAll = false; break; } } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex > 0) { - DXCoilCap = DXCoils::GetCoilCapacityByIndexType(state, - state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex, - state.dataHVACVarRefFlow->VRFTU(TUIndex).DXHeatCoilType_Num, - errFlag); + if (vrfTU.HeatCoilNum > 0) { + DXCoilCap = DXCoils::GetCoilCapacity(state, vrfTU.HeatCoilNum); TUHeatingCapacity += DXCoilCap; if (DXCoilCap == AutoSize) { FoundAll = false; @@ -8940,37 +8336,31 @@ void SimVRF(EnergyPlusData &state, Real64 PartLoadRatio(1.0); Real64 SuppHeatCoilLoad(0.0); // supplemental heating coil load (W) - if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + + if (state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ControlVRF_FluidTCtrl( - state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( - state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided); + vrfTU.ControlVRF_FluidTCtrl(state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); + vrfTU.CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided); if (PartLoadRatio == 0.0) { // set coil inlet conditions when coil does not operate. Inlet conditions are set in ControlVRF_FluidTCtrl when PLR=1 - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeT = - state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).Temp; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeW = - state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).HumRat; + if (vrfTU.CoolingCoilPresent) { + vrfTU.coilInNodeT = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).AirInNode).Temp; + vrfTU.coilInNodeW = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).AirInNode).HumRat; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeT = - state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).Temp; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeW = - state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).HumRat; + vrfTU.coilInNodeT = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).AirInNode).Temp; + vrfTU.coilInNodeW = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).AirInNode).HumRat; } } // CalcVRF( VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, LatOutputProvided ); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ControlVRF( - state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( - state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided); + vrfTU.ControlVRF(state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); + vrfTU.CalcVRF(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided); } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitSensibleRate = SysOutputProvided; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitLatentRate = LatOutputProvided; + vrfTU.TerminalUnitSensibleRate = SysOutputProvided; + vrfTU.TerminalUnitLatentRate = LatOutputProvided; } void VRFTerminalUnitEquipment::ControlVRF(EnergyPlusData &state, @@ -8993,10 +8383,12 @@ void VRFTerminalUnitEquipment::ControlVRF(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Use RegulaFalsi technique to iterate on part-load ratio until convergence is achieved. + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + PartLoadRatio = 0.0; state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0; state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio = 0.0; + vrfTU.SuppHeatPartLoadRatio = 0.0; // The RETURNS here will jump back to SimVRF where the CalcVRF routine will simulate with latest PLR @@ -9225,26 +8617,27 @@ void VRFTerminalUnitEquipment::ControlVRFToLoad(EnergyPlusData &state, } int SolFla = 0; // Flag of RegulaFalsi solver auto f = [&state, VRFTUNum, FirstHVACIteration, QZnReq, OnOffAirFlowRatio](Real64 const PartLoadRatio) { + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); Real64 QZnReqTemp = QZnReq; // denominator representing zone load (W) Real64 ActualOutput; // delivered capacity of VRF terminal unit Real64 SuppHeatCoilLoad = 0.0; - bool setPointControlled = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled; + bool setPointControlled = vrfTU.isSetPointControlled; Real64 nonConstOnOffAirFlowRatio = OnOffAirFlowRatio; - if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmType == + if (state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad); } if (setPointControlled) { - Real64 outletNodeT = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; - return (outletNodeT - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilTempSetPoint); + Real64 outletNodeT = state.dataLoopNodes->Node(vrfTU.VRFTUOutletNodeNum).Temp; + return (outletNodeT - vrfTU.coilTempSetPoint); } else { if (std::abs(QZnReq) < 100.0) QZnReqTemp = sign(100.0, QZnReq); return (ActualOutput - QZnReq) / QZnReqTemp; @@ -9474,10 +8867,10 @@ void VRFTerminalUnitEquipment::CalcVRF(EnergyPlusData &state, (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { SimDXCoil(state, - "", + this->CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - this->CoolCoilIndex, + this->CoolCoilNum, fanOp, PartLoadRatio, OnOffAirFlowRatio, @@ -9485,7 +8878,7 @@ void VRFTerminalUnitEquipment::CalcVRF(EnergyPlusData &state, state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond), state.dataHVACVarRefFlow->VRF(this->VRFSysNum).VRFCondCyclingRatio); } else { // cooling coil is off - SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->CoolCoilIndex, fanOp, 0.0, OnOffAirFlowRatio); + SimDXCoil(state, this->CoolCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, this->CoolCoilNum, fanOp, 0.0, OnOffAirFlowRatio); } state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { @@ -9501,14 +8894,14 @@ void VRFTerminalUnitEquipment::CalcVRF(EnergyPlusData &state, "", HVAC::CompressorOp::Off, FirstHVACIteration, - this->HeatCoilIndex, + this->HeatCoilNum, fanOp, PartLoadRatio, OnOffAirFlowRatio, _, state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond)); } else { - SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->HeatCoilIndex, fanOp, 0.0, OnOffAirFlowRatio, _); + SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->HeatCoilNum, fanOp, 0.0, OnOffAirFlowRatio, _); } state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { @@ -9607,9 +9000,11 @@ void ReportVRFTerminalUnit(EnergyPlusData &state, int const VRFTUNum) // index t bool HRHeatRequestFlag; // - indicates TU could be in heat mode bool HRCoolRequestFlag; // - indicates TU could be in cool mode - VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + + VRFCond = vrfTU.VRFSysNum; TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; - IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; + IndexToTUInTUList = vrfTU.IndexToTUInTUList; HRHeatRequestFlag = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList); HRCoolRequestFlag = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList); ReportingConstant = state.dataHVACGlobal->TimeStepSysSec; @@ -9618,145 +9013,131 @@ void ReportVRFTerminalUnit(EnergyPlusData &state, int const VRFTUNum) // index t // account for heat recovery first since these flags will be FALSE otherwise, each TU may have different operating mode if (HRCoolRequestFlag) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF + - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0; + if (vrfTU.CoolingCoilPresent) { + vrfTU.ParasiticCoolElecPower = + vrfTU.ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF + + vrfTU.ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF); + vrfTU.ParasiticElecCoolConsumption = vrfTU.ParasiticCoolElecPower * ReportingConstant; + vrfTU.ParasiticHeatElecPower = 0.0; + vrfTU.ParasiticElecHeatConsumption = 0.0; } else { // cooling parasitic power report variable is not even available when there is no cooling coil, report for heating - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + vrfTU.ParasiticHeatElecPower = vrfTU.ParasiticOffElec; + vrfTU.ParasiticElecHeatConsumption = vrfTU.ParasiticHeatElecPower * ReportingConstant; } } else if (HRHeatRequestFlag) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF + - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + if (vrfTU.HeatingCoilPresent) { + vrfTU.ParasiticCoolElecPower = 0.0; + vrfTU.ParasiticElecCoolConsumption = 0.0; + vrfTU.ParasiticHeatElecPower = + vrfTU.ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF + + vrfTU.ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF); + vrfTU.ParasiticElecHeatConsumption = vrfTU.ParasiticHeatElecPower * ReportingConstant; } else { // heating parasitic power report variable is not even available when there is no heating coil, report for cooling - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + vrfTU.ParasiticCoolElecPower = vrfTU.ParasiticOffElec; + vrfTU.ParasiticElecCoolConsumption = vrfTU.ParasiticCoolElecPower * ReportingConstant; } } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) || (!state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && - state.dataHVACVarRefFlow->LastModeCooling(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum))) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF + - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0; + state.dataHVACVarRefFlow->LastModeCooling(vrfTU.VRFSysNum))) { + if (vrfTU.CoolingCoilPresent) { + vrfTU.ParasiticCoolElecPower = + vrfTU.ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF + + vrfTU.ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF); + vrfTU.ParasiticElecCoolConsumption = vrfTU.ParasiticCoolElecPower * ReportingConstant; + vrfTU.ParasiticHeatElecPower = 0.0; + vrfTU.ParasiticElecHeatConsumption = 0.0; } else { // cooling parasitic power report variable is not even available when there is no cooling coil, report for heating - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + vrfTU.ParasiticHeatElecPower = vrfTU.ParasiticOffElec; + vrfTU.ParasiticElecHeatConsumption = vrfTU.ParasiticHeatElecPower * ReportingConstant; } } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) || (!state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && - state.dataHVACVarRefFlow->LastModeHeating(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum))) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF + - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + state.dataHVACVarRefFlow->LastModeHeating(vrfTU.VRFSysNum))) { + if (vrfTU.HeatingCoilPresent) { + vrfTU.ParasiticCoolElecPower = 0.0; + vrfTU.ParasiticElecCoolConsumption = 0.0; + vrfTU.ParasiticHeatElecPower = + vrfTU.ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF + + vrfTU.ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF); + vrfTU.ParasiticElecHeatConsumption = vrfTU.ParasiticHeatElecPower * ReportingConstant; } else { // heating parasitic power report variable is not even available when there is no heating coil, report for cooling - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + vrfTU.ParasiticCoolElecPower = vrfTU.ParasiticOffElec; + vrfTU.ParasiticElecCoolConsumption = vrfTU.ParasiticCoolElecPower * ReportingConstant; } } else { // happens when there is no cooling or heating load - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { + if (!vrfTU.CoolingCoilPresent) { // report all for heating - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; - } else if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { + vrfTU.ParasiticHeatElecPower = vrfTU.ParasiticOffElec; + vrfTU.ParasiticElecHeatConsumption = vrfTU.ParasiticHeatElecPower * ReportingConstant; + } else if (!vrfTU.HeatingCoilPresent) { // report all for cooling - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + vrfTU.ParasiticCoolElecPower = vrfTU.ParasiticOffElec; + vrfTU.ParasiticElecCoolConsumption = vrfTU.ParasiticCoolElecPower * ReportingConstant; } else { // split parasitic between both reporting variables - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec / 2.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec / 2.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + vrfTU.ParasiticCoolElecPower = vrfTU.ParasiticOffElec / 2.0; + vrfTU.ParasiticElecCoolConsumption = vrfTU.ParasiticCoolElecPower * ReportingConstant; + vrfTU.ParasiticHeatElecPower = vrfTU.ParasiticOffElec / 2.0; + vrfTU.ParasiticElecHeatConsumption = vrfTU.ParasiticHeatElecPower * ReportingConstant; } } - SensibleConditioning = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitSensibleRate; - LatentConditioning = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitLatentRate; + SensibleConditioning = vrfTU.TerminalUnitSensibleRate; + LatentConditioning = vrfTU.TerminalUnitLatentRate; Real64 TempOut = 0.0; Real64 TempIn = 0.0; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == HVAC::MixerType::SupplySide) { + if (vrfTU.ATMixerExists) { + if (vrfTU.ATMixerType == HVAC::MixerType::SupplySide) { // Air terminal supply side mixer - TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerOutNode).Temp; - TempIn = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp; + TempOut = state.dataLoopNodes->Node(vrfTU.ATMixerOutNode).Temp; + TempIn = state.dataLoopNodes->Node(vrfTU.ZoneAirNode).Temp; } else { // Air terminal inlet side mixer - TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; - TempIn = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp; + TempOut = state.dataLoopNodes->Node(vrfTU.VRFTUOutletNodeNum).Temp; + TempIn = state.dataLoopNodes->Node(vrfTU.ZoneAirNode).Temp; } } else { - TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; - TempIn = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp; + TempOut = state.dataLoopNodes->Node(vrfTU.VRFTUOutletNodeNum).Temp; + TempIn = state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).Temp; } TotalConditioning = SensibleConditioning + LatentConditioning; if (TotalConditioning <= 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate = std::abs(TotalConditioning); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate = 0.0; + vrfTU.TotalCoolingRate = std::abs(TotalConditioning); + vrfTU.TotalHeatingRate = 0.0; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate = TotalConditioning; + vrfTU.TotalCoolingRate = 0.0; + vrfTU.TotalHeatingRate = TotalConditioning; } if (SensibleConditioning <= 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate = std::abs(SensibleConditioning); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate = 0.0; + vrfTU.SensibleCoolingRate = std::abs(SensibleConditioning); + vrfTU.SensibleHeatingRate = 0.0; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate = SensibleConditioning; + vrfTU.SensibleCoolingRate = 0.0; + vrfTU.SensibleHeatingRate = SensibleConditioning; } if (LatentConditioning <= 0.0) { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate = std::abs(LatentConditioning); - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate = 0.0; + vrfTU.LatentCoolingRate = std::abs(LatentConditioning); + vrfTU.LatentHeatingRate = 0.0; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate = LatentConditioning; - } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingEnergy = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingEnergy = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate * ReportingConstant; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate * ReportingConstant; - - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).firstPass) { + vrfTU.LatentCoolingRate = 0.0; + vrfTU.LatentHeatingRate = LatentConditioning; + } + vrfTU.TotalCoolingEnergy = vrfTU.TotalCoolingRate * ReportingConstant; + vrfTU.SensibleCoolingEnergy = vrfTU.SensibleCoolingRate * ReportingConstant; + vrfTU.LatentCoolingEnergy = vrfTU.LatentCoolingRate * ReportingConstant; + vrfTU.TotalHeatingEnergy = vrfTU.TotalHeatingRate * ReportingConstant; + vrfTU.SensibleHeatingEnergy = vrfTU.SensibleHeatingRate * ReportingConstant; + vrfTU.LatentHeatingEnergy = vrfTU.LatentHeatingRate * ReportingConstant; + + if (vrfTU.firstPass) { if (!state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum)) { - DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, 0, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).firstPass); + DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, 0, vrfTU.firstPass); } } @@ -9780,20 +9161,22 @@ void ReportVRFCondenser(EnergyPlusData &state, int const VRFCond) // index to VR ReportingConstant = state.dataHVACGlobal->TimeStepSysSec; + auto &vrfCond = state.dataHVACVarRefFlow->VRF(VRFCond); + // calculate VRF condenser power/energy use - state.dataHVACVarRefFlow->VRF(VRFCond).CoolElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower * ReportingConstant; - state.dataHVACVarRefFlow->VRF(VRFCond).HeatElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower * ReportingConstant; + vrfCond.CoolElecConsumption = vrfCond.ElecCoolingPower * ReportingConstant; + vrfCond.HeatElecConsumption = vrfCond.ElecHeatingPower * ReportingConstant; - state.dataHVACVarRefFlow->VRF(VRFCond).DefrostConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower * ReportingConstant; - state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPower * ReportingConstant; + vrfCond.DefrostConsumption = vrfCond.DefrostPower * ReportingConstant; + vrfCond.BasinHeaterConsumption = vrfCond.BasinHeaterPower * ReportingConstant; - state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecConsumption = - state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower * ReportingConstant; - state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterElecConsumption = - state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower * ReportingConstant; + vrfCond.EvapCondPumpElecConsumption = + vrfCond.EvapCondPumpElecPower * ReportingConstant; + vrfCond.CrankCaseHeaterElecConsumption = + vrfCond.CrankCaseHeaterPower * ReportingConstant; - state.dataHVACVarRefFlow->VRF(VRFCond).QCondEnergy = state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser * ReportingConstant; - state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatEnergyRec = state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatRec * ReportingConstant; + vrfCond.QCondEnergy = vrfCond.QCondenser * ReportingConstant; + vrfCond.VRFHeatEnergyRec = vrfCond.VRFHeatRec * ReportingConstant; } void UpdateVRFCondenser(EnergyPlusData &state, int const VRFCond) // index to VRF condensing unit @@ -9808,11 +9191,11 @@ void UpdateVRFCondenser(EnergyPlusData &state, int const VRFCond) // index to VR // PURPOSE OF THIS SUBROUTINE: // This subroutine updates the node data for the VRF Condenser. - int CondenserOutletNode; // - outlet node for VRF water-cooled condenser + auto &vrfCond = state.dataHVACVarRefFlow->VRF(VRFCond); - CondenserOutletNode = state.dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum; + int CondenserOutletNode = vrfCond.CondenserOutletNodeNum; - state.dataLoopNodes->Node(CondenserOutletNode).Temp = state.dataHVACVarRefFlow->VRF(VRFCond).CondenserSideOutletTemp; + state.dataLoopNodes->Node(CondenserOutletNode).Temp = vrfCond.CondenserSideOutletTemp; state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRate = state.dataHVACVarRefFlow->CondenserWaterMassFlowRate; state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRateMaxAvail = state.dataLoopNodes->Node(CondenserOutletNode).MassFlowRateMaxAvail; @@ -9867,21 +9250,23 @@ void SetAverageAirFlow(EnergyPlusData &state, Real64 AverageUnitMassFlow(0.0); // average supply air mass flow rate over time step Real64 AverageOAMassFlow(0.0); // average outdoor air mass flow rate over time step - InletNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum; - OutsideAirNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; - AirRelNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) { + InletNode = vrfTU.VRFTUInletNodeNum; + OutsideAirNode = vrfTU.VRFTUOAMixerOANodeNum; + AirRelNode = vrfTU.VRFTUOAMixerRelNodeNum; + + if (vrfTU.fanOp == HVAC::FanOp::Cycling && vrfTU.SpeedNum == 0) { Real64 partLoadRat = PartLoadRatio; - if (partLoadRat == 0.0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio > 0.0) { - partLoadRat = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio; + if (partLoadRat == 0.0 && vrfTU.SuppHeatPartLoadRatio > 0.0) { + partLoadRat = vrfTU.SuppHeatPartLoadRatio; } AverageUnitMassFlow = (partLoadRat * state.dataHVACVarRefFlow->CompOnMassFlow) + ((1 - partLoadRat) * state.dataHVACVarRefFlow->CompOffMassFlow); AverageOAMassFlow = (partLoadRat * state.dataHVACVarRefFlow->OACompOnMassFlow) + ((1 - partLoadRat) * state.dataHVACVarRefFlow->OACompOffMassFlow); } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) { + if (vrfTU.SpeedNum == 0) { if (PartLoadRatio == 0.0) { // set the average OA air flow to off compressor values if the compressor PartLoadRatio is zero AverageUnitMassFlow = state.dataHVACVarRefFlow->CompOffMassFlow; @@ -9891,36 +9276,30 @@ void SetAverageAirFlow(EnergyPlusData &state, AverageOAMassFlow = state.dataHVACVarRefFlow->OACompOnMassFlow; } } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 1) { - if (state.dataHVACVarRefFlow->CoolingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { + if (vrfTU.SpeedNum == 1) { + if (state.dataHVACVarRefFlow->CoolingLoad(vrfTU.VRFSysNum)) { AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + + vrfTU.CoolMassFlowRate[vrfTU.SpeedNum] * PartLoadRatio + (1.0 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffMassFlow; - } else if (state.dataHVACVarRefFlow->HeatingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { + } else if (state.dataHVACVarRefFlow->HeatingLoad(vrfTU.VRFSysNum)) { AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + + vrfTU.HeatMassFlowRate[vrfTU.SpeedNum] * PartLoadRatio + (1.0 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffMassFlow; } } else { - if (state.dataHVACVarRefFlow->CoolingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { + if (state.dataHVACVarRefFlow->CoolingLoad(vrfTU.VRFSysNum)) { AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + - (1.0 - PartLoadRatio) * - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum - 1]; - } else if (state.dataHVACVarRefFlow->HeatingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { + vrfTU.CoolMassFlowRate[vrfTU.SpeedNum] * PartLoadRatio + + (1.0 - PartLoadRatio) * vrfTU.CoolMassFlowRate[vrfTU.SpeedNum - 1]; + } else if (state.dataHVACVarRefFlow->HeatingLoad(vrfTU.VRFSysNum)) { AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + - (1.0 - PartLoadRatio) * - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum - 1]; + vrfTU.HeatMassFlowRate[vrfTU.SpeedNum] * PartLoadRatio + + (1.0 - PartLoadRatio) * vrfTU.HeatMassFlowRate[vrfTU.SpeedNum - 1]; } } } } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) { + if (vrfTU.SpeedNum == 0) { if (state.dataHVACVarRefFlow->CompOffFlowRatio > 0.0) { state.dataHVACVarRefFlow->FanSpeedRatio = (PartLoadRatio * state.dataHVACVarRefFlow->CompOnFlowRatio) + ((1 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffFlowRatio); @@ -9930,14 +9309,14 @@ void SetAverageAirFlow(EnergyPlusData &state, } // if the terminal unit and fan are scheduled on then set flow rate - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr) > 0.0 && - (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && + if (GetCurrentScheduleValue(state, vrfTU.SchedPtr) > 0.0 && + (GetCurrentScheduleValue(state, vrfTU.FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { // so for sure OA system TUs should use inlet node flow rate, don't overwrite inlet node flow rate // could there be a reason for air loops to use inlet node flow? Possibly when VAV TUs used? - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow; - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; + if (!vrfTU.isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow; + if (!vrfTU.isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; if (OutsideAirNode > 0) { state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = AverageOAMassFlow; state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMaxAvail = AverageOAMassFlow; @@ -9952,7 +9331,7 @@ void SetAverageAirFlow(EnergyPlusData &state, } else { // terminal unit and/or fan is off - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) { + if (!vrfTU.isInOASys) { state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; OnOffAirFlowRatio = 0.0; } @@ -10017,6 +9396,7 @@ void InitializeOperatingMode(EnergyPlusData &state, // make sure TU's have been sized before looping through each one of them to determine operating mode if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TerminalUnitNotSizedYet)) break; int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); // check to see if coil is present if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTU)) { @@ -10034,33 +9414,33 @@ void InitializeOperatingMode(EnergyPlusData &state, } } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled) { + if (vrfTU.isSetPointControlled) { // set point temperature may only reside at the TU outlet node - Real64 coolCoilTempSetPoint = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint; - state.dataHVACVarRefFlow->VRFTU(TUIndex).suppTempSetPoint = coolCoilTempSetPoint; + Real64 coolCoilTempSetPoint = state.dataLoopNodes->Node(vrfTU.VRFTUOutletNodeNum).TempSetPoint; + vrfTU.suppTempSetPoint = coolCoilTempSetPoint; Real64 heatCoilTempSetPoint = coolCoilTempSetPoint; // adjust coil control for fan heat when set point is at outlet node Real64 coolfanDeltaT = 0.0; Real64 heatfanDeltaT = 0.0; - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanPlace == HVAC::FanPlace::DrawThru) { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOutletNode > 0) - coolfanDeltaT = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOutletNode).Temp - - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).fanInletNode).Temp; + if (vrfTU.fanPlace == HVAC::FanPlace::DrawThru) { + if (vrfTU.fanOutletNode > 0) + coolfanDeltaT = state.dataLoopNodes->Node(vrfTU.fanOutletNode).Temp - + state.dataLoopNodes->Node(vrfTU.fanInletNode).Temp; } heatfanDeltaT = coolfanDeltaT; // or the set point could be placed at either or both coils, update both if necessary - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolingCoilPresent) { - if (state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint != + if (vrfTU.CoolingCoilPresent) { + if (state.dataLoopNodes->Node(vrfTU.coolCoilAirOutNode).TempSetPoint != DataLoopNode::SensedNodeFlagValue) { - coolCoilTempSetPoint = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint; + coolCoilTempSetPoint = state.dataLoopNodes->Node(vrfTU.coolCoilAirOutNode).TempSetPoint; //// should we adjust for fan heat or not? What if it's a mixed air SP that already adjusts for fan heat? // coolfanDeltaT = 0.0; } } - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatingCoilPresent) { - if (state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint != + if (vrfTU.HeatingCoilPresent) { + if (state.dataLoopNodes->Node(vrfTU.heatCoilAirOutNode).TempSetPoint != DataLoopNode::SensedNodeFlagValue) { - heatCoilTempSetPoint = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint; + heatCoilTempSetPoint = state.dataLoopNodes->Node(vrfTU.heatCoilAirOutNode).TempSetPoint; //// should we adjust for fan heat or not? What if it's a mixed air SP that already adjusts for fan heat? // heatfanDeltaT = 0.0; } @@ -10068,70 +9448,62 @@ void InitializeOperatingMode(EnergyPlusData &state, // set a flow rate and simulate ATMixer/OASystem if needed if (FirstHVACIteration) { SetAverageAirFlow(state, TUIndex, 1.0, OnOffAirFlowRatio); - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerExists) { + if (vrfTU.ATMixerExists) { // There is an air terminal mixer - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerType == + if (vrfTU.ATMixerType == HVAC::MixerType::InletSide) { // if there is an inlet side air terminal mixer // set the primary air inlet mass flow rate - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerPriNode).MassFlowRate = - min(state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerPriNode).MassFlowRateMaxAvail, - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate); + state.dataLoopNodes->Node(vrfTU.ATMixerPriNode).MassFlowRate = + min(state.dataLoopNodes->Node(vrfTU.ATMixerPriNode).MassFlowRateMaxAvail, + state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate); // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate // has already been set above (it is the "inlet" node flow rate) - SingleDuct::SimATMixer(state, - state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerName, - FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerIndex); + SingleDuct::SimATMixer(state, vrfTU.ATMixerName, FirstHVACIteration, vrfTU.ATMixerIndex); } } else { // simulate OA Mixer - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) - MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex); + if (vrfTU.OAMixerUsed) + MixedAir::SimOAMixer(state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); } } // identify a coil inlet temperature - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolingCoilPresent) { - state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT = - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirInNode).Temp; - state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW = - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirInNode).HumRat; + if (vrfTU.CoolingCoilPresent) { + vrfTU.coilInNodeT = state.dataLoopNodes->Node(vrfTU.coolCoilAirInNode).Temp; + vrfTU.coilInNodeW = state.dataLoopNodes->Node(vrfTU.coolCoilAirInNode).HumRat; } else { - state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT = - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirInNode).Temp; - state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW = - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirInNode).HumRat; + vrfTU.coilInNodeT = state.dataLoopNodes->Node(vrfTU.heatCoilAirInNode).Temp; + vrfTU.coilInNodeW = state.dataLoopNodes->Node(vrfTU.heatCoilAirInNode).HumRat; } - Real64 coilInletTemp = state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT; - Real64 coilInletHumRat = state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW; - Real64 coilInletMassFlow = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate; - state.dataHVACVarRefFlow->VRFTU(TUIndex).coolSPActive = false; - state.dataHVACVarRefFlow->VRFTU(TUIndex).heatSPActive = false; + Real64 coilInletTemp = vrfTU.coilInNodeT; + Real64 coilInletHumRat = vrfTU.coilInNodeW; + Real64 coilInletMassFlow = state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate; + vrfTU.coolSPActive = false; + vrfTU.heatSPActive = false; if ((heatCoilTempSetPoint - coilInletTemp - heatfanDeltaT) > HVAC::SmallTempDiff) { // heating Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(coilInletHumRat); ZoneLoad = coilInletMassFlow * CpAirIn * (heatCoilTempSetPoint - coilInletTemp - heatfanDeltaT); - state.dataHVACVarRefFlow->VRFTU(TUIndex).heatSPActive = true; - state.dataHVACVarRefFlow->VRFTU(TUIndex).heatLoadToSP = ZoneLoad; + vrfTU.heatSPActive = true; + vrfTU.heatLoadToSP = ZoneLoad; ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond); state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad; state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), -1.0); - state.dataHVACVarRefFlow->VRFTU(TUIndex).coilTempSetPoint = heatCoilTempSetPoint - heatfanDeltaT; + vrfTU.coilTempSetPoint = heatCoilTempSetPoint - heatfanDeltaT; } else if ((coilInletTemp - coolCoilTempSetPoint - coolfanDeltaT) > HVAC::SmallTempDiff) { // cooling Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(coilInletHumRat); ZoneLoad = coilInletMassFlow * CpAirIn * (coolCoilTempSetPoint - coilInletTemp - coolfanDeltaT); - state.dataHVACVarRefFlow->VRFTU(TUIndex).coolSPActive = true; - state.dataHVACVarRefFlow->VRFTU(TUIndex).coolLoadToSP = ZoneLoad; + vrfTU.coolSPActive = true; + vrfTU.coolLoadToSP = ZoneLoad; ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond); state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += ZoneLoad; state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), 1.0); - state.dataHVACVarRefFlow->VRFTU(TUIndex).coilTempSetPoint = coolCoilTempSetPoint - coolfanDeltaT; + vrfTU.coilTempSetPoint = coolCoilTempSetPoint - coolfanDeltaT; } } else { // else is not set point controlled // Constant fan systems are tested for ventilation load to determine if load to be met changes. // more logic may be needed here, what is the OA flow rate, was last mode heating or cooling, what control is used, etc... - int ThisZoneNum = state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum; + int ThisZoneNum = vrfTU.ZoneNum; getVRFTUZoneLoad(state, TUIndex, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, true); if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::ThermostatOffsetPriority) { @@ -10178,16 +9550,16 @@ void InitializeOperatingMode(EnergyPlusData &state, } } else if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::LoadPriority || state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::ZonePriority) { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOp == HVAC::FanOp::Continuous) { + if (vrfTU.fanOp == HVAC::FanOp::Continuous) { SetCompFlowRate(state, TUIndex, VRFCond); if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF( + vrfTU.CalcVRF( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -10201,27 +9573,27 @@ void InitializeOperatingMode(EnergyPlusData &state, state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // if last mode was cooling, make sure heating flow rate is used - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxHeatAirMassFlow; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxHeatAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerOANodeNum).MassFlowRate = + vrfTU.HeatOutAirMassFlow; MixedAir::SimOAMixer(state, - state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName, - state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex); + vrfTU.OAMixerName, + vrfTU.OAMixerIndex); } else { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxHeatAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate = + vrfTU.MaxHeatAirMassFlow; } // recalculate using correct flow rate if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF( + vrfTU.CalcVRF( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -10254,26 +9626,26 @@ void InitializeOperatingMode(EnergyPlusData &state, if (state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::SingleHeating && state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxCoolAirMassFlow; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolOutAirMassFlow; + if (vrfTU.OAMixerUsed) { + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerRetNodeNum).MassFlowRate = + vrfTU.MaxCoolAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUOAMixerOANodeNum).MassFlowRate = + vrfTU.CoolOutAirMassFlow; MixedAir::SimOAMixer(state, - state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName, - state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex); + vrfTU.OAMixerName, + vrfTU.OAMixerIndex); } else { - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate = - state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxCoolAirMassFlow; + state.dataLoopNodes->Node(vrfTU.VRFTUInletNodeNum).MassFlowRate = + vrfTU.MaxCoolAirMassFlow; } if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF( + vrfTU.CalcVRF( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } @@ -10726,65 +10098,67 @@ void getVRFTUZoneLoad( EnergyPlusData &state, int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceCoolingNum > 0 && - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceHeatingNum > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) { + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + + if (vrfTU.zoneSequenceCoolingNum > 0 && + vrfTU.zoneSequenceHeatingNum > 0 && vrfTU.isInAirLoop) { // air loop equipment uses sequenced variables - LoadToCoolingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) - .SequencedOutputRequiredToCoolingSP(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceCoolingNum) / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; - LoadToHeatingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) - .SequencedOutputRequiredToHeatingSP(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceHeatingNum) / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + LoadToCoolingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum) + .SequencedOutputRequiredToCoolingSP(vrfTU.zoneSequenceCoolingNum) / + vrfTU.controlZoneMassFlowFrac; + LoadToHeatingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum) + .SequencedOutputRequiredToHeatingSP(vrfTU.zoneSequenceHeatingNum) / + vrfTU.controlZoneMassFlowFrac; if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::SingleCooling) { zoneLoad = LoadToHeatingSP; } else if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) == HVAC::ThermostatType::SingleCooling) { zoneLoad = 0.0; } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) != HVAC::ThermostatType::SingleHeating) { zoneLoad = LoadToCoolingSP; } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == + state.dataHeatBalFanSys->TempControlType(vrfTU.ZoneNum) == HVAC::ThermostatType::SingleHeating) { zoneLoad = 0.0; } else if (LoadToHeatingSP <= 0.0 && LoadToCoolingSP >= 0.0) { zoneLoad = 0.0; } - } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum > 0) { + } else if (vrfTU.ZoneNum > 0) { // zone equipment uses Remaining* variables if (InitFlag) { // this will need more investigation. Using Remaining* variable during the initial load calculation seems wrong. // This may also have implications when VRF TUs are in the air loop or if SP control is used // another question is whether initialization of the operating mode should look at TotalOutputRequired or RemainingOutputRequired - zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum).RemainingOutputRequired / + vrfTU.controlZoneMassFlowFrac; LoadToCoolingSP = - state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).OutputRequiredToCoolingSP / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum).OutputRequiredToCoolingSP / + vrfTU.controlZoneMassFlowFrac; LoadToHeatingSP = - state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).OutputRequiredToHeatingSP / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum).OutputRequiredToHeatingSP / + vrfTU.controlZoneMassFlowFrac; } else { - zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum).RemainingOutputRequired / + vrfTU.controlZoneMassFlowFrac; LoadToCoolingSP = - state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToCoolSP / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum).RemainingOutputReqToCoolSP / + vrfTU.controlZoneMassFlowFrac; LoadToHeatingSP = - state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToHeatSP / - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + state.dataZoneEnergyDemand->ZoneSysEnergyDemand(vrfTU.ZoneNum).RemainingOutputReqToHeatSP / + vrfTU.controlZoneMassFlowFrac; } - } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolSPActive) { - LoadToCoolingSP = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolLoadToSP; + } else if (vrfTU.isSetPointControlled) { + if (vrfTU.coolSPActive) { + LoadToCoolingSP = vrfTU.coolLoadToSP; zoneLoad = LoadToCoolingSP; LoadToHeatingSP = 0.0; } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatSPActive) { - LoadToHeatingSP = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatLoadToSP; + if (vrfTU.heatSPActive) { + LoadToHeatingSP = vrfTU.heatLoadToSP; zoneLoad = LoadToHeatingSP; LoadToCoolingSP = 0.0; } @@ -10848,7 +10222,7 @@ void VRFCondenserEquipment::CalcVRFIUTeTc_FluidTCtrl(EnergyPlusData &state) for (int i = 1; i <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; i++) { int VRFTUNum = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(i); - // analyze the conditions of each IU + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRFIUVariableTeTc(state, EvapTemp(i), CondTemp(i)); // select the Te/Tc that can satisfy all the zones @@ -10922,8 +10296,8 @@ void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(EnergyPlusData &state, Real64 W_TU_in; // Air humidity ratio at the indoor unit inlet[kg/kg] // Get the equipment/zone index corresponding to the VRFTU - CoolCoilNum = this->CoolCoilIndex; - HeatCoilNum = this->HeatCoilIndex; + CoolCoilNum = this->CoolCoilNum; + HeatCoilNum = this->HeatCoilNum; VRFNum = this->VRFSysNum; TUListIndex = state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr; IndexToTUInTUList = this->IndexToTUInTUList; @@ -11024,8 +10398,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c int NumTUInList; // number of terminal units is list int NumTU; // index for loop on terminal units int TUIndex; // Index to terminal unit - int CoolCoilIndex; // index to cooling coil in terminal unit - int HeatCoilIndex; // index to heating coil in terminal unit int NumTUInCoolingMode; // number of terminal units actually cooling int NumTUInHeatingMode; // number of terminal units actually heating @@ -11212,18 +10584,17 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c // loop through TU's and calculate average inlet conditions for active coils for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) { TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; - HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; - + auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) { - SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(CoolCoilIndex) * + SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(vrfTU.CoolCoilNum) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TU_CoolingLoad; ++NumTUInCoolingMode; } if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) { - SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(HeatCoilIndex) * + SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(vrfTU.HeatCoilNum) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad; - SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(HeatCoilIndex) * + SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(vrfTU.HeatCoilNum) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad; ++NumTUInHeatingMode; } @@ -11349,12 +10720,12 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { // Calc total refrigerant flow rate if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); RefTSat = this->refrig->getSatTemperature(state, max(min(Pevap, RefPHigh), RefPLow), RoutineName); h_IU_evap_out_i = this->refrig->getSupHeatEnthalpy(state, - max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH), + max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH), max(min(Pevap, RefPHigh), RefPLow), RoutineName); @@ -11365,7 +10736,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c (h_IU_evap_out_i - h_IU_evap_in)); // Ref Flow Rate in the IU( kg/s ) m_ref_IU_evap = m_ref_IU_evap + m_ref_IU_evap_i; h_IU_evap_out = h_IU_evap_out + m_ref_IU_evap_i * h_IU_evap_out_i; - SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH; + SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH; } } } @@ -11526,11 +10897,11 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) { TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; + auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); h_IU_cond_out_i = this->refrig->getSatEnthalpy(state, this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName) - - state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC, + state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).ActualSC, 0.0, RoutineName); // Quality=0 m_ref_IU_cond_i = @@ -11539,7 +10910,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i)); m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i; h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i; - SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC; + SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).ActualSC; } } if (m_ref_IU_cond > 0) { @@ -11742,11 +11113,11 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) { TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; + auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); h_IU_cond_out_i = this->refrig->getSatEnthalpy(state, this->refrig->getSatTemperature(state, max(min(Pcond, RefPHigh), RefPLow), RoutineName) - - state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC, + state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).ActualSC, 0.0, RoutineName); // Quality=0 m_ref_IU_cond_i = @@ -11755,7 +11126,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i)); m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i; h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i; - SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC; + SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).ActualSC; } } if (m_ref_IU_cond > 0) { @@ -11786,12 +11157,12 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { // Calc total refrigerant flow rate if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); RefTSat = this->refrig->getSatTemperature(state, max(min(Pevap, RefPHigh), RefPLow), RoutineName); h_IU_evap_out_i = this->refrig->getSupHeatEnthalpy(state, - max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH), + max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH), max(min(Pevap, RefPHigh), RefPLow), RoutineName); @@ -11802,7 +11173,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c (h_IU_evap_out_i - h_IU_evap_in)); // Ref Flow Rate in the IU( kg/s ) m_ref_IU_evap = m_ref_IU_evap + m_ref_IU_evap_i; h_IU_evap_out = h_IU_evap_out + m_ref_IU_evap_i * h_IU_evap_out_i; - SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH; + SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH; } } } @@ -12302,8 +11673,8 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c this->CalcVRFIUTeTc_FluidTCtrl(state); // update coil and IU evaporating temperature, also keep coil RTF updated with the condenser side cycling ratio, for the FluidTCtrl model for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) { - auto const &thisTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); - auto &coolingCoil = state.dataDXCoils->DXCoil(thisTU.CoolCoilIndex); + auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + auto &coolingCoil = state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum); if (this->adjustedTe && (!FirstHVACIteration)) { coolingCoil.EvaporatingTemp = this->EvaporatingTemp; this->IUEvaporatingTemp = this->EvaporatingTemp; @@ -12364,10 +11735,12 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, bool HRCoolingMode; bool HRHeatingMode; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + PartLoadRatio = 0.0; state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0; state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio = 0.0; + vrfTU.SuppHeatPartLoadRatio = 0.0; VRFCond = this->VRFSysNum; IndexToTUInTUList = this->IndexToTUInTUList; auto &thisVRFCond = state.dataHVACVarRefFlow->VRF(VRFCond); @@ -12424,11 +11797,11 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, if (!DXCoolingCoilOprCtrl) PartLoadRatio = 0.0; this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); if (this->CoolingCoilPresent) { - auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->CoolCoilIndex).AirInNode); + auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->CoolCoilNum).AirInNode); this->coilInNodeT = thisAirInNode.Temp; this->coilInNodeW = thisAirInNode.HumRat; } else { - auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->HeatCoilIndex).AirInNode); + auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->HeatCoilNum).AirInNode); this->coilInNodeT = thisAirInNode.Temp; this->coilInNodeW = thisAirInNode.HumRat; } @@ -12540,25 +11913,26 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, if ((VRFHeatingMode || HRHeatingMode) || ((VRFCoolingMode && DXCoolingCoilOprCtrl) || HRCoolingMode)) { int SolFla; // Flag of RegulaFalsi solver auto f = [&state, VRFTUNum, FirstHVACIteration, QZnReq, OnOffAirFlowRatio](Real64 const PartLoadRatio) { + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); Real64 QZnReqTemp = QZnReq; // denominator representing zone load (W) Real64 ActualOutput; // delivered capacity of VRF terminal unit Real64 SuppHeatCoilLoad = 0.0; // supplemental heating coil load (W) - bool setPointControlled = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled; + bool setPointControlled = vrfTU.isSetPointControlled; Real64 nonConstOnOffAirFlowRatio = OnOffAirFlowRatio; - if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(vrfTU.VRFSysNum).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + vrfTU.CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( + vrfTU.CalcVRF( state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, nonConstOnOffAirFlowRatio, SuppHeatCoilLoad); } if (setPointControlled) { - Real64 outletNodeT = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; - return (outletNodeT - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilTempSetPoint); + Real64 outletNodeT = state.dataLoopNodes->Node(vrfTU.VRFTUOutletNodeNum).Temp; + return (outletNodeT - vrfTU.coilTempSetPoint); } else { if (std::abs(QZnReq) < 100.0) QZnReqTemp = sign(100.0, QZnReq); return (ActualOutput - QZnReq) / QZnReqTemp; @@ -12655,7 +12029,9 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state, using SingleDuct::SimATMixer; using SteamCoils::SimulateSteamCoilComponents; using WaterCoils::SimulateWaterCoilComponents; - + + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + int VRFTUOutletNodeNum; // TU air outlet node int VRFTUInletNodeNum; // TU air inlet node Real64 AirMassFlow; // total supply air mass flow [m3/s] @@ -12715,14 +12091,14 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state, } // if blow through, simulate fan then coils if (this->fanPlace == HVAC::FanPlace::BlowThru) { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType == HVAC::FanType::SystemModel) { + if (vrfTU.fanType == HVAC::FanType::SystemModel) { if (OnOffAirFlowRatio > 0.0) { - state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)->simulate(state, FirstHVACIteration, _, _); + state.dataFans->fans(vrfTU.FanIndex)->simulate(state, FirstHVACIteration, _, _); } else { - state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex)->simulate(state, FirstHVACIteration, _, _, PartLoadRatio); + state.dataFans->fans(vrfTU.FanIndex)->simulate(state, FirstHVACIteration, _, _, PartLoadRatio); } } else { - state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex) + state.dataFans->fans(vrfTU.FanIndex) ->simulate(state, FirstHVACIteration, state.dataHVACVarRefFlow->FanSpeedRatio); } } @@ -12732,10 +12108,10 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state, (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { SimDXCoil(state, - "", + this->CoolCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - this->CoolCoilIndex, + this->CoolCoilNum, fanOp, PartLoadRatio, _, @@ -12743,7 +12119,7 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state, state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond), state.dataHVACVarRefFlow->VRF(this->VRFSysNum).VRFCondCyclingRatio); } else { // cooling coil is off - SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->CoolCoilIndex, fanOp, 0.0, _); + SimDXCoil(state, this->CoolCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, this->CoolCoilNum, fanOp, 0.0, _); } state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { @@ -12756,17 +12132,17 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state, (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { SimDXCoil(state, - "", + this->HeatCoilName, HVAC::CompressorOp::On, FirstHVACIteration, - this->HeatCoilIndex, + this->HeatCoilNum, fanOp, PartLoadRatio, _, _, state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond)); } else { - SimDXCoil(state, "", HVAC::CompressorOp::Off, FirstHVACIteration, this->HeatCoilIndex, fanOp, 0.0, _); + SimDXCoil(state, this->HeatCoilName, HVAC::CompressorOp::Off, FirstHVACIteration, this->HeatCoilNum, fanOp, 0.0, _); } state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { @@ -12774,13 +12150,13 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state, } Real64 OnOffFanPartLoadFraction = 1.0; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling) { + if (vrfTU.fanOp == HVAC::FanOp::Cycling) { OnOffFanPartLoadFraction = state.dataHVACGlobal->OnOffFanPartLoadFraction; } // if draw through, simulate coils then fan if (this->fanPlace == HVAC::FanPlace::DrawThru) { - auto *fan = state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType == HVAC::FanType::SystemModel) { + auto *fan = state.dataFans->fans(vrfTU.FanIndex); + if (vrfTU.fanType == HVAC::FanType::SystemModel) { if (OnOffAirFlowRatio > 0.0) { fan->simulate(state, FirstHVACIteration, _, _, _, fan->inletAirMassFlowRate, OnOffFanPartLoadFraction, 0, 0, _); } else { @@ -12872,7 +12248,6 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & int constexpr Mode(1); // Performance mode for MultiMode DX coil. Always 1 for other coil types int constexpr MaxIte(500); // maximum number of iterations - int DXCoilNum; // index to DX Coil int IndexToTUInTUList; // index to TU in specific list for the VRF system int SolFla; // Flag of RegulaFalsi solver int TUListIndex; // index to TU list for this VRF system @@ -12884,7 +12259,9 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & Real64 QCoilReq; // required coil load (W) Real64 QCoilAct; // actual coil load (W) Real64 TeTc; // evaporating temperature or condensing temperature for VRF indoor unit(C) + int DXCoilNum = 0; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); VRFCond = this->VRFSysNum; TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; IndexToTUInTUList = this->IndexToTUInTUList; @@ -12893,8 +12270,8 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { // VRF terminal unit is on cooling mode - DXCoilNum = this->CoolCoilIndex; - QCoilReq = -PartLoadRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + DXCoilNum = vrfTU.CoolCoilNum; + QCoilReq = -PartLoadRatio * state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).RatedTotCap(Mode); TeTc = state.dataHVACVarRefFlow->VRF(VRFCond).IUEvaporatingTemp; // For HR operations, Te is lower than the outdoor air temperature because of outdoor evaporator operations @@ -12905,8 +12282,8 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { // VRF terminal unit is on heating mode - DXCoilNum = this->HeatCoilIndex; - Real64 RatedCapacity = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + DXCoilNum = vrfTU.HeatCoilNum; + Real64 RatedCapacity = state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).RatedTotCap(Mode); if (present(MaxHeatCap)) { RatedCapacity = min(MaxHeatCap, RatedCapacity); } @@ -12921,8 +12298,8 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & } // minimum airflow rate - if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) > 0.0) { - FanSpdRatioMin = min(state.dataHVACVarRefFlow->OACompOnMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode), 1.0); + if (state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).RatedAirMassFlowRate(Mode) > 0.0) { + FanSpdRatioMin = min(state.dataHVACVarRefFlow->OACompOnMassFlow / state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).RatedAirMassFlowRate(Mode), 1.0); } else { // VRF terminal unit is off QCoilAct = 0.0; @@ -12953,8 +12330,10 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & Real64 SHact; // coil actual SH Real64 SCact; // coil actual SC - VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; - VRFInletNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + + VRFCond = vrfTU.VRFSysNum; + VRFInletNode = vrfTU.VRFTUInletNodeNum; if (std::abs(FanSpdRatio) < 0.01) FanSpdRatioBase = sign(0.01, FanSpdRatio); @@ -12968,17 +12347,17 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & Win = state.dataLoopNodes->Node(VRFInletNode).HumRat; // Simulation the OAMixer if there is any - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + if (vrfTU.OAMixerUsed) { MixedAir::SimOAMixer( - state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); - int OAMixNode = state.dataMixedAir->OAMixer(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex).MixNode; + state, vrfTU.OAMixerName, vrfTU.OAMixerIndex); + int OAMixNode = state.dataMixedAir->OAMixer(vrfTU.OAMixerIndex).MixNode; Tin = state.dataLoopNodes->Node(OAMixNode).Temp; Win = state.dataLoopNodes->Node(OAMixNode).HumRat; } // Simulate the blow-through fan if there is any - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanPlace == HVAC::FanPlace::BlowThru) { - auto *fan = state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex); - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType == HVAC::FanType::SystemModel) { + if (vrfTU.fanPlace == HVAC::FanPlace::BlowThru) { + auto *fan = state.dataFans->fans(vrfTU.FanIndex); + if (vrfTU.fanType == HVAC::FanType::SystemModel) { if (temp > 0) { fan->simulate(state, false, _, _); } else { @@ -12987,8 +12366,8 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & } else { fan->simulate(state, false, state.dataHVACVarRefFlow->FanSpeedRatio); } - Tin = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode).Temp; - Win = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode).HumRat; + Tin = state.dataLoopNodes->Node(vrfTU.fanOutletNode).Temp; + Win = state.dataLoopNodes->Node(vrfTU.fanOutletNode).HumRat; } // Call the coil control logic to determine the air flow rate to match the given coil load @@ -13465,11 +12844,9 @@ void VRFCondenserEquipment::VRFOU_TeModification( // METHODOLOGY EMPLOYED: // This is part of the VRF-FluidTCtrl Model. - int CoolCoilIndex; // index to cooling coil in terminal unit int NumTUInList; // number of terminal units is list int NumTeIte; // counter for Te calculation iterations [-] int TUListNum; // index to TU List - int TUIndex; // Index to terminal unit Real64 MaxNumTeIte; // Piping Loss Algorithm Parameter: max number of iterations for Te [-] Real64 Pipe_h_comp_in; // Piping Loss Algorithm Parameter: Enthalpy after piping loss (compressor inlet) [kJ/kg] Real64 Pipe_DeltP; // Piping Loss Algorithm Parameter: Pipe pressure drop [Pa] @@ -13509,12 +12886,12 @@ Label11:; // Re-calculate total refrigerant flow rate, with updated SH for (int NumTU = 1; NumTU <= NumTUInList; NumTU++) { if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { - TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); // The IU coil surface temperature should be the same. - Tfs = Te_up + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH) + - this->C2Te * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH + this->C1Te); + Tfs = Te_up + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH) + + this->C2Te * state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH + this->C1Te); // SH_IU_update is the updated SH for a specific IU if (this->C3Te == 0) @@ -14043,11 +13420,11 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, // Re-calculate total refrigerant flow rate, with updated SH for (int NumTU = 1; NumTU <= NumTUInList; NumTU++) { if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { - TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); - Tfs = this->EvaporatingTemp + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH) + - this->C2Te * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH + this->C1Te); + Tfs = this->EvaporatingTemp + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH) + + this->C2Te * state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).ActualSH + this->C1Te); // Modifi_SH is the updated SH for a specific IU if (this->C3Te == 0) @@ -14896,10 +14273,10 @@ void VRFCondenserEquipment::VRFOU_PipeLossC( NumIUActivated = 0; for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) { int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - int CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); - if (state.dataDXCoils->DXCoil(CoilIndex).TotalCoolingEnergyRate > 0.0) { - Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp; + if (state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).TotalCoolingEnergyRate > 0.0) { + Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(vrfTU.CoolCoilNum).InletAirTemp; NumIUActivated = NumIUActivated + 1; } } @@ -15035,10 +14412,10 @@ void VRFCondenserEquipment::VRFOU_PipeLossH( NumIUActivated = 0; for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) { int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - int CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex); - if (state.dataDXCoils->DXCoil(CoilIndex).TotalHeatingEnergyRate > 0.0) { - Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp; + if (state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).TotalHeatingEnergyRate > 0.0) { + Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).InletAirTemp; NumIUActivated = NumIUActivated + 1; } } @@ -15124,33 +14501,35 @@ void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state, SuppHeatCoilLoad = 0.0; } - switch (this->SuppHeatCoilType_Num) { - case HVAC::Coil_HeatingGasOrOtherFuel: - case HVAC::Coil_HeatingElectric: { + switch (this->suppHeatCoilType) { + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingElectric: { HeatingCoils::SimulateHeatingCoilComponents( - state, this->SuppHeatCoilName, FirstHVACIteration, SuppHeatCoilLoad, this->SuppHeatCoilIndex, QActual, true, this->fanOp, PartLoadRatio); + state, this->SuppHeatCoilName, FirstHVACIteration, SuppHeatCoilLoad, this->SuppHeatCoilNum, QActual, true, this->fanOp, PartLoadRatio); SuppHeatCoilLoad = QActual; } break; - case HVAC::Coil_HeatingWater: { + + case HVAC::CoilType::HeatingWater: { if (SuppHeatCoilLoad > HVAC::SmallLoad) { // see if HW coil has enough capacity to meet the load Real64 mdot = this->SuppHeatCoilFluidMaxFlow; state.dataLoopNodes->Node(this->SuppHeatCoilFluidInletNode).MassFlowRate = mdot; // simulate hot water coil to find the full flow operating capacity WaterCoils::SimulateWaterCoilComponents( - state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, QActual, this->fanOp, PartLoadRatio); + state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilNum, QActual, this->fanOp, PartLoadRatio); if (QActual > SuppHeatCoilLoad) { int SolFla; // Flag of solver, num iterations if >0, else error index auto f = [&state, VRFTUNum, FirstHVACIteration, SuppHeatCoilLoad](Real64 const PartLoadFrac) { Real64 QActual = 0.0; // actual heating load delivered [W] - Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode).MassFlowRate = mdot; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + Real64 mdot = vrfTU.SuppHeatCoilFluidMaxFlow * PartLoadFrac; + state.dataLoopNodes->Node(vrfTU.SuppHeatCoilFluidInletNode).MassFlowRate = mdot; WaterCoils::SimulateWaterCoilComponents(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, + vrfTU.SuppHeatCoilNum, QActual, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp, + vrfTU.fanOp, PartLoadFrac); if (std::abs(SuppHeatCoilLoad) == 0.0) { return (QActual - SuppHeatCoilLoad) / 100.0; @@ -15173,14 +14552,15 @@ void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state, } // simulate water heating coil WaterCoils::SimulateWaterCoilComponents( - state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, SuppHeatCoilLoad, this->fanOp, this->SuppHeatPartLoadRatio); + state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilNum, SuppHeatCoilLoad, this->fanOp, this->SuppHeatPartLoadRatio); } break; - case HVAC::Coil_HeatingSteam: { + + case HVAC::CoilType::HeatingSteam: { // simulate steam heating coil Real64 mdot = this->SuppHeatCoilFluidMaxFlow * PartLoadRatio; state.dataLoopNodes->Node(this->SuppHeatCoilFluidInletNode).MassFlowRate = mdot; SteamCoils::SimulateSteamCoilComponents( - state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, SuppHeatCoilLoad, QActual, this->fanOp, PartLoadRatio); + state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilNum, SuppHeatCoilLoad, QActual, this->fanOp, PartLoadRatio); SuppHeatCoilLoad = QActual; } break; default: @@ -15190,6 +14570,7 @@ void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state, SuppCoilLoad = SuppHeatCoilLoad; } +// We are still doing this Par thing? Real64 VRFTerminalUnitEquipment::HotWaterHeatingCoilResidual(EnergyPlusData &state, Real64 const PartLoadFrac, // water heating coil part-load ratio std::vector const &Par // par(1) = index to current VRF terminal unit @@ -15217,14 +14598,15 @@ Real64 VRFTerminalUnitEquipment::HotWaterHeatingCoilResidual(EnergyPlusData &sta // Real64 mdot = min(state.dataLoopNodes->Node(VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode).MassFlowRateMaxAvail, // VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac); - Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac; - state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode).MassFlowRate = mdot; + auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + Real64 mdot = vrfTU.SuppHeatCoilFluidMaxFlow * PartLoadFrac; + state.dataLoopNodes->Node(vrfTU.SuppHeatCoilFluidInletNode).MassFlowRate = mdot; WaterCoils::SimulateWaterCoilComponents(state, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + vrfTU.SuppHeatCoilName, FirstHVACIteration, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, + vrfTU.SuppHeatCoilNum, QActual, - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp, + vrfTU.fanOp, PartLoadFrac); if (std::abs(SuppHeatCoilLoad) == 0.0) { diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index 72034261b38..26e9d829be3 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -684,17 +684,22 @@ namespace HVACVariableRefrigerantFlow { HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // operation mode: 1 = cycling fan, cycling coil 2 = constant fan, cycling coil HVAC::FanPlace fanPlace = HVAC::FanPlace::Invalid; // fan placement; 1=blow through, 2=draw through Real64 ActualFanVolFlowRate = 0.0; // volumetric flow rate from fan object - std::string SuppHeatCoilType; // type of supplemental heating coil - std::string SuppHeatCoilName; // name of supplemental heating coil std::string OAMixerName; // name of outside air mixer int OAMixerIndex = 0; // index to outside air mixer bool OAMixerUsed = false; // true if OA Mixer object is used - int CoolCoilIndex = 0; // index to terminal unit cooling coil - int HeatCoilIndex = 0; // index to terminal unit heating coil - int SuppHeatCoilIndex = 0; // index to terminal unit supplemental heating coil - int DXCoolCoilType_Num = 0; // type of VRF cooling coil - int DXHeatCoilType_Num = 0; // type of VRF heating coil - int SuppHeatCoilType_Num = 0; // type of VRF supplemental heating coil + + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; // type of VRF cooling coil + std::string CoolCoilName; // name of supplemental heating coil + int CoolCoilNum = 0; // index to terminal unit cooling coil + + HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; // type of VRF heating coil + std::string HeatCoilName; // name of supplemental heating coil + int HeatCoilNum = 0; // index to terminal unit heating coil + + HVAC::CoilType suppHeatCoilType = HVAC::CoilType::Invalid; // type of VRF supplemental heating coil + std::string SuppHeatCoilName; // name of supplemental heating coil + int SuppHeatCoilNum = 0; // index to terminal unit supplemental heating coil + Real64 ParasiticElec = 0.0; // parasitic electric for VRF terminal unit Real64 ParasiticOffElec = 0.0; // parasitic electric for VRF terminal unit when off Real64 HeatingSpeedRatio = 1.0; // Fan speed ratio in heating mode diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index 0ae1263cd16..0875bfd378e 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -285,7 +285,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (mat->group != Material::Group::Regular) { - ShowSevereCustomMessage(state, eoh, format("{} = \"{}\" is not a regular material.", cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} = \"{}\" is not a regular material.", cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -334,7 +334,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -426,7 +426,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -473,7 +473,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -520,7 +520,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -569,7 +569,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index 0454284f97a..a277a0eaa5a 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -5301,7 +5301,7 @@ namespace HeatBalanceManager { windowThermalModel.SDScalar = s_ipsc->rNumericArgs(1); if ((s_ipsc->rNumericArgs(1) < 0.0) || (s_ipsc->rNumericArgs(1) > 1.0)) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} should be >= 0.0 and <= 1.0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); @@ -5319,21 +5319,21 @@ namespace HeatBalanceManager { windowThermalModel.VacuumPressureLimit = s_ipsc->rNumericArgs(2); if (s_ipsc->rNumericArgs(2) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); } windowThermalModel.InitialTemperature = s_ipsc->rNumericArgs(3); if (s_ipsc->rNumericArgs(3) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(3), s_ipsc->rNumericArgs(3))); } windowThermalModel.InitialPressure = s_ipsc->rNumericArgs(4); if (s_ipsc->rNumericArgs(4) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(4), s_ipsc->rNumericArgs(4))); } } @@ -5413,7 +5413,7 @@ namespace HeatBalanceManager { if (NumCols != 2 && NumCols != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} entered value=\"{}\" invalid matrix dimensions. Basis matrix dimension can only be 2 x 1.", locAlphaFieldNames(5), @@ -5437,7 +5437,7 @@ namespace HeatBalanceManager { if (mod((NumAlphas - 9), 3) != 0) { // throw warning if incomplete field set ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} is missing some of the layers or/and gaps.", locAlphaArgs(1))); + ShowSevereCustom(state, eoh, format("{} is missing some of the layers or/and gaps.", locAlphaArgs(1))); } if (thisConstruct.BSDFInput.BasisSymmetryType == DataBSDFWindow::BasisSymmetry::None) { @@ -5455,7 +5455,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5466,7 +5466,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); @@ -5480,7 +5480,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.SolFrtTrans.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); @@ -5498,7 +5498,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis size " @@ -5509,14 +5509,14 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); } thisConstruct.BSDFInput.SolBkRefl.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolBkReflIndex, thisConstruct.BSDFInput.SolBkRefl); @@ -5532,7 +5532,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5543,7 +5543,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); @@ -5552,7 +5552,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.VisFrtTrans.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); @@ -5570,7 +5570,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5581,14 +5581,14 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); } thisConstruct.BSDFInput.VisBkRefl.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visble back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisBkReflIndex, thisConstruct.BSDFInput.VisBkRefl); @@ -5616,7 +5616,7 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", locAlphaArgs(AlphaIndex), @@ -5625,7 +5625,7 @@ namespace HeatBalanceManager { if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " @@ -5641,7 +5641,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", @@ -5664,7 +5664,7 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", locAlphaArgs(AlphaIndex), @@ -5673,7 +5673,7 @@ namespace HeatBalanceManager { if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " @@ -5688,7 +5688,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", @@ -5716,7 +5716,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5727,7 +5727,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); @@ -5736,7 +5736,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.SolFrtTrans.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); @@ -5759,7 +5759,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis size " @@ -5770,14 +5770,14 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); } thisConstruct.BSDFInput.SolBkRefl.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolBkReflIndex, state.dataBSDFWindow->BSDFTempMtrx); @@ -5797,7 +5797,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5808,7 +5808,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); @@ -5817,7 +5817,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.VisFrtTrans.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); @@ -5839,7 +5839,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5850,14 +5850,14 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); } thisConstruct.BSDFInput.VisBkRefl.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisBkReflIndex, state.dataBSDFWindow->BSDFTempMtrx); @@ -5894,7 +5894,7 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", locAlphaArgs(AlphaIndex), @@ -5903,7 +5903,7 @@ namespace HeatBalanceManager { if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " @@ -5920,7 +5920,7 @@ namespace HeatBalanceManager { if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", @@ -5943,7 +5943,7 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", locAlphaArgs(AlphaIndex), @@ -5952,7 +5952,7 @@ namespace HeatBalanceManager { if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " @@ -5968,7 +5968,7 @@ namespace HeatBalanceManager { if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index db59d82ab4f..70ec7f96cb3 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -120,7 +120,7 @@ namespace HeatRecovery { ObjexxFCL::Optional_bool_const RegenInletIsOANode, // flag to determine if supply inlet is OA node, if so air flow cycles ObjexxFCL::Optional_bool_const EconomizerFlag, // economizer operation flag passed by airloop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag, // high humidity control flag passed by airloop or OA sys - ObjexxFCL::Optional_int_const CompanionCoilType_Num // cooling coil type of coil + ObjexxFCL::Optional companionCoilType // cooling coil type of coil ) { @@ -168,8 +168,6 @@ namespace HeatRecovery { } int CompanionCoilNum = present(CompanionCoilIndex) ? int(CompanionCoilIndex) : -1; // Index to companion cooling coil - int companionCoilType = present(CompanionCoilType_Num) ? int(CompanionCoilType_Num) : -1; - bool HXUnitOn; // flag to enable heat exchanger if (present(HXUnitEnable)) { HXUnitOn = HXUnitEnable; @@ -1198,7 +1196,7 @@ namespace HeatRecovery { } } - void HeatExchCond::initialize(EnergyPlusData &state, int const CompanionCoilIndex, int const CompanionCoilType_Num) + void HeatExchCond::initialize(EnergyPlusData &state, int const CompanionCoilIndex, HVAC::CoilType const companionCoilType) { // SUBROUTINE INFORMATION: @@ -1482,10 +1480,12 @@ namespace HeatRecovery { } if ((CompanionCoilIndex > -1) && - ((CompanionCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) || (CompanionCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) || - (CompanionCoilType_Num == HVAC::CoilDX_Cooling))) { + (companionCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + companionCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed || + companionCoilType == HVAC::CoilType::DXCooling)) { - if (CompanionCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || CompanionCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { + if (companionCoilType == HVAC::CoilType::DXCoolingSingleSpeed || + companionCoilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { if (state.dataDXCoils->DXCoilFullLoadOutAirTemp(CompanionCoilIndex) == 0.0 || state.dataDXCoils->DXCoilFullLoadOutAirHumRat(CompanionCoilIndex) == 0.0) { // DX Coil is OFF, read actual inlet conditions @@ -1496,14 +1496,14 @@ namespace HeatRecovery { state.dataHeatRecovery->FullLoadOutAirTemp = state.dataDXCoils->DXCoilFullLoadOutAirTemp(CompanionCoilIndex); state.dataHeatRecovery->FullLoadOutAirHumRat = state.dataDXCoils->DXCoilFullLoadOutAirHumRat(CompanionCoilIndex); } - } else if (CompanionCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (companionCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // how to support VS dx coil here? state.dataHeatRecovery->FullLoadOutAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).OutletAirDBTemp; state.dataHeatRecovery->FullLoadOutAirHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).OutletAirHumRat; - } else if (CompanionCoilType_Num == HVAC::CoilDX_Cooling) { + } else if (companionCoilType == HVAC::CoilType::DXCooling) { // Use the new coil option: - state.dataHeatRecovery->FullLoadOutAirTemp = state.dataCoilCooingDX->coilCoolingDXs[CompanionCoilIndex].outletAirDryBulbTemp; - state.dataHeatRecovery->FullLoadOutAirHumRat = state.dataCoilCooingDX->coilCoolingDXs[CompanionCoilIndex].outletAirHumRat; + state.dataHeatRecovery->FullLoadOutAirTemp = state.dataCoilCoolingDX->coilCoolingDXs[CompanionCoilIndex].outletAirDryBulbTemp; + state.dataHeatRecovery->FullLoadOutAirHumRat = state.dataCoilCoolingDX->coilCoolingDXs[CompanionCoilIndex].outletAirHumRat; } else { // } @@ -2402,7 +2402,7 @@ namespace HeatRecovery { HVAC::FanOp const fanOp, // Supply air fan operating mode (1=cycling, 2=constant) Real64 const PartLoadRatio, // Part load ratio requested of DX compressor int const CompanionCoilIndex, // index of companion cooling coil - int const CompanionCoilType, // type of cooling coil + HVAC::CoilType const companionCoilType, // type of cooling coil bool const RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles ObjexxFCL::Optional_bool_const EconomizerFlag, // economizer flag pass by air loop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag // high humidity control flag passed by airloop or OA sys @@ -2629,10 +2629,10 @@ namespace HeatRecovery { HXPartLoadRatio = max(0.0, HXPartLoadRatio); HXPartLoadRatio = min(1.0, HXPartLoadRatio); - } else if (CompanionCoilType > 0 && CompanionCoilIndex > -1) { - if (CompanionCoilType == HVAC::CoilDX_Cooling) { - HXPartLoadRatio = state.dataCoilCooingDX->coilCoolingDXs[CompanionCoilIndex].partLoadRatioReport; - } else if (CompanionCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (companionCoilType != HVAC::CoilType::Invalid && CompanionCoilIndex > -1) { + if (companionCoilType == HVAC::CoilType::DXCooling) { + HXPartLoadRatio = state.dataCoilCoolingDX->coilCoolingDXs[CompanionCoilIndex].partLoadRatioReport; + } else if (companionCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { HXPartLoadRatio = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).PartLoadRatio; } else { HXPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(CompanionCoilIndex); @@ -4786,199 +4786,91 @@ namespace HeatRecovery { } } - int GetSupplyInletNode(EnergyPlusData &state, - std::string const &HXName, // must match HX names for the state.dataHeatRecovery->ExchCond type - bool &ErrorsFound // set to true if problem - ) - { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN February 2007 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given HX and returns the supply air inlet node number. - // If incorrect HX name is given, ErrorsFound is returned as true and node number as zero. - + int GetHeatExchangerIndex(EnergyPlusData &state, std::string const &hxName, bool &ErrorsFound) { // Obtains and Allocates heat exchanger related parameters from input file if (state.dataHeatRecovery->GetInputFlag) { // First time subroutine has been entered GetHeatRecoveryInput(state); state.dataHeatRecovery->GetInputFlag = false; } - int const WhichHX = Util::FindItemInList(HXName, state.dataHeatRecovery->ExchCond); - if (WhichHX != 0) { - return state.dataHeatRecovery->ExchCond(WhichHX).SupInletNode; - } else { - ShowSevereError(state, format("GetSupplyInletNode: Could not find heat exchanger = \"{}\"", HXName)); + int hxNum = Util::FindItemInList(hxName, state.dataHeatRecovery->ExchCond); + if (hxNum == 0) { + ShowSevereError(state, format("GetHeatExchangerIndex: Could not find heat exchanger = \"{}\"", hxName)); ErrorsFound = true; - return 0; } + return hxNum; } - int GetSupplyOutletNode(EnergyPlusData &state, - std::string const &HXName, // must match HX names for the state.dataHeatRecovery->ExchCond type - bool &ErrorsFound // set to true if problem + int GetSupplyInletNode(EnergyPlusData &state, + std::string const &hxName, + bool &ErrorsFound ) { + int hxNum = GetHeatExchangerIndex(state, hxName, ErrorsFound); + return (hxNum == 0) ? 0 : state.dataHeatRecovery->ExchCond(hxNum).SupInletNode; + } - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN February 2007 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given HX and returns the supply air outlet node number. - // If incorrect HX name is given, ErrorsFound is returned as true and node number as zero. - - // Obtains and Allocates heat exchanger related parameters from input file - if (state.dataHeatRecovery->GetInputFlag) { // First time subroutine has been entered - GetHeatRecoveryInput(state); - state.dataHeatRecovery->GetInputFlag = false; - } - - int const WhichHX = Util::FindItemInList(HXName, state.dataHeatRecovery->ExchCond); - if (WhichHX != 0) { - return state.dataHeatRecovery->ExchCond(WhichHX).SupOutletNode; - } else { - ShowSevereError(state, format("GetSupplyOutletNode: Could not find heat exchanger = \"{}\"", HXName)); - ErrorsFound = true; - return 0; - } + int GetSupplyOutletNode(EnergyPlusData &state, + std::string const &hxName, + bool &ErrorsFound + ) + { + int hxNum = GetHeatExchangerIndex(state, hxName, ErrorsFound); + return (hxNum == 0) ? 0 : state.dataHeatRecovery->ExchCond(hxNum).SupOutletNode; } int GetSecondaryInletNode(EnergyPlusData &state, - std::string const &HXName, // must match HX names for the state.dataHeatRecovery->ExchCond type + std::string const &hxName, // must match HX names for the state.dataHeatRecovery->ExchCond type bool &ErrorsFound // set to true if problem ) { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN February 2007 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given HX and returns the secondary air inlet node number. - // If incorrect HX name is given, ErrorsFound is returned as true and node number as zero. - - // Obtains and Allocates heat exchanger related parameters from input file - if (state.dataHeatRecovery->GetInputFlag) { // First time subroutine has been entered - GetHeatRecoveryInput(state); - state.dataHeatRecovery->GetInputFlag = false; - } - - int const WhichHX = Util::FindItemInList(HXName, state.dataHeatRecovery->ExchCond); - if (WhichHX != 0) { - return state.dataHeatRecovery->ExchCond(WhichHX).SecInletNode; - } else { - ShowSevereError(state, format("GetSecondaryInletNode: Could not find heat exchanger = \"{}\"", HXName)); - ErrorsFound = true; - return 0; - } + int hxNum = GetHeatExchangerIndex(state, hxName, ErrorsFound); + return (hxNum == 0) ? 0 : state.dataHeatRecovery->ExchCond(hxNum).SecInletNode; } int GetSecondaryOutletNode(EnergyPlusData &state, - std::string const &HXName, // must match HX names for the state.dataHeatRecovery->ExchCond type + std::string const &hxName, // must match HX names for the state.dataHeatRecovery->ExchCond type bool &ErrorsFound // set to true if problem ) { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN February 2007 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given HX assisted cooling coil and returns the secondary air outlet node number. - // If incorrect HX name is given, ErrorsFound is returned as true and node number as zero. - - // Obtains and Allocates heat exchanger related parameters from input file - if (state.dataHeatRecovery->GetInputFlag) { // First time subroutine has been entered - GetHeatRecoveryInput(state); - state.dataHeatRecovery->GetInputFlag = false; - } - - int const WhichHX = Util::FindItemInList(HXName, state.dataHeatRecovery->ExchCond); - if (WhichHX != 0) { - return state.dataHeatRecovery->ExchCond(WhichHX).SecOutletNode; - } else { - ShowSevereError(state, format("GetSecondaryOutletNode: Could not find heat exchanger = \"{}\"", HXName)); - ErrorsFound = true; - return 0; - } + int hxNum = GetHeatExchangerIndex(state, hxName, ErrorsFound); + return (hxNum == 0) ? 0 : state.dataHeatRecovery->ExchCond(hxNum).SecOutletNode; } Real64 GetSupplyAirFlowRate(EnergyPlusData &state, - std::string const &HXName, // must match HX names for the state.dataHeatRecovery->ExchCond type + std::string const &hxName, // must match HX names for the state.dataHeatRecovery->ExchCond type bool &ErrorsFound // set to true if problem ) { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN October 2007 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given Generic HX and the volumetric air flow rate. - // If incorrect HX name is given, ErrorsFound is returned as true and air flow rate as zero. - - // Obtains and Allocates heat exchanger related parameters from input file - if (state.dataHeatRecovery->GetInputFlag) { // First time subroutine has been entered - GetHeatRecoveryInput(state); - state.dataHeatRecovery->GetInputFlag = false; - } - - int const WhichHX = Util::FindItemInList(HXName, state.dataHeatRecovery->ExchCond); - if (WhichHX != 0) { - return state.dataHeatRecovery->ExchCond(WhichHX).NomSupAirVolFlow; - } else { - ShowSevereError(state, format("GetSupplyAirFlowRate: Could not find heat exchanger = \"{}\"", HXName)); - ShowContinueError(state, "... Supply Air Flow Rate returned as 0."); - ErrorsFound = true; - return 0.0; - } + int hxNum = GetHeatExchangerIndex(state, hxName, ErrorsFound); + return (hxNum == 0) ? 0.0 : state.dataHeatRecovery->ExchCond(hxNum).NomSupAirVolFlow; } - HVAC::HXType GetHeatExchangerObjectTypeNum(EnergyPlusData &state, - std::string const &HXName, // must match HX names for the state.dataHeatRecovery->ExchCond type - bool &ErrorsFound // set to true if problem + HVAC::HXType GetHeatExchangerType(EnergyPlusData &state, + std::string const &hxName, // must match HX names for the state.dataHeatRecovery->ExchCond type + bool &ErrorsFound // set to true if problem ) { + int hxNum = GetHeatExchangerIndex(state, hxName, ErrorsFound); + return (hxNum == 0) ? HVAC::HXType::Invalid : state.dataHeatRecovery->ExchCond(hxNum).type; + } - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN October 2007 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given Generic HX and the volumetric air flow rate. - // If incorrect HX name is given, ErrorsFound is returned as true and air flow rate as zero. - + int GetHeatExchangerIndex(EnergyPlusData &state, std::string const &hxName) { // Obtains and Allocates heat exchanger related parameters from input file - if (state.dataHeatRecovery->GetInputFlag) { // First time subroutine has been entered + if (state.dataHeatRecovery->GetInputFlag) { GetHeatRecoveryInput(state); state.dataHeatRecovery->GetInputFlag = false; } - int const WhichHX = Util::FindItemInList(HXName, state.dataHeatRecovery->ExchCond); - if (WhichHX != 0) { - return state.dataHeatRecovery->ExchCond(WhichHX).type; - } else { - ShowSevereError(state, format("GetHeatExchangerObjectTypeNum: Could not find heat exchanger = \"{}\"", HXName)); - ErrorsFound = true; - return HVAC::HXType::Invalid; - } + return Util::FindItemInList(hxName, state.dataHeatRecovery->ExchCond); + } + + int GetSupplyInletNode(EnergyPlusData &state, + int const hxNum) + { + assert(hxNum > 0 && hxNum <= state.dataHeatRecovery->NumHeatExchangers); + return state.dataHeatRecovery->ExchCond(hxNum).SupInletNode; } - } // namespace HeatRecovery } // namespace EnergyPlus diff --git a/src/EnergyPlus/HeatRecovery.hh b/src/EnergyPlus/HeatRecovery.hh index 5c0a3ec62f5..1ac0b9488f9 100644 --- a/src/EnergyPlus/HeatRecovery.hh +++ b/src/EnergyPlus/HeatRecovery.hh @@ -201,7 +201,7 @@ namespace HeatRecovery { bool MySetPointTest = true; bool MySizeFlag = true; - void initialize(EnergyPlusData &state, int CompanionCoilIndex, int CompanionCoilType_Num); + void initialize(EnergyPlusData &state, int CompanionCoilIndex, HVAC::CoilType companionCoilType); void size(EnergyPlusData &state); @@ -227,7 +227,7 @@ namespace HeatRecovery { HVAC::FanOp const fanOp, // Supply air fan operating mode (1=cycling, 2=constant) Real64 PartLoadRatio, // Part load ratio requested of DX compressor int CompanionCoilIndex, // index of companion cooling coil - int CompanionCoilType, // type of cooling coil + HVAC::CoilType companionCoilType, // type of cooling coil bool RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _ // high humidity control flag passed by airloop or OA sys @@ -401,7 +401,7 @@ namespace HeatRecovery { ObjexxFCL::Optional_bool_const RegenInletIsOANode = _, // flag to determine if supply inlet is OA node, if so air flow cycles ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer operation flag passed by airloop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _, // high humidity control flag passed by airloop or OA sys - ObjexxFCL::Optional CompanionCoilType = _ // cooling coil type of coil + HVAC::CoilType companionCoilType = HVAC::CoilType::Invalid ); void GetHeatRecoveryInput(EnergyPlusData &state); @@ -427,6 +427,9 @@ namespace HeatRecovery { Real64 Z // capacity rate ratio ); + int GetHeatExchangerIndex(EnergyPlusData &state, + std::string const &hxName); + int GetSupplyInletNode(EnergyPlusData &state, std::string const &HXName, // must match HX names for the ExchCond type bool &ErrorsFound // set to true if problem @@ -452,10 +455,22 @@ namespace HeatRecovery { bool &ErrorsFound // set to true if problem ); - HVAC::HXType GetHeatExchangerObjectTypeNum(EnergyPlusData &state, - std::string const &HXName, // must match HX names for the ExchCond type - bool &ErrorsFound // set to true if problem - ); + HVAC::HXType GetHeatExchangerType(EnergyPlusData &state, + std::string const &HXName, // must match HX names for the ExchCond type + bool &ErrorsFound // set to true if problem + ); + // New API + int GetSupplyInletNode(EnergyPlusData &state, int const hxNum); + + int GetSupplyOutletNode(EnergyPlusData &state, int const hxNum); + + int GetSecondaryInletNode(EnergyPlusData &state, int const hxNum); + + int GetSecondaryOutletNode(EnergyPlusData &state, int const hxNum); + + Real64 GetSupplyAirFlowRate(EnergyPlusData &state, int const hxNum); + + HVAC::HXType GetHeatExchangerType(EnergyPlusData &state, int const hxNum); } // namespace HeatRecovery diff --git a/src/EnergyPlus/HeatingCoils.cc b/src/EnergyPlus/HeatingCoils.cc index 6b8a613eefd..c665604fadb 100644 --- a/src/EnergyPlus/HeatingCoils.cc +++ b/src/EnergyPlus/HeatingCoils.cc @@ -194,11 +194,11 @@ namespace HeatingCoils { InitHeatingCoil(state, CoilNum, FirstHVACIteration, QCoilRequired); // Initialize all HeatingCoil related parameters // Calculate the Correct HeatingCoil Model with the current CoilNum - switch (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num) { - case HVAC::Coil_HeatingElectric: { + switch (state.dataHeatingCoils->HeatingCoil(CoilNum).coilType) { + case HVAC::CoilType::HeatingElectric: { CalcElectricHeatingCoil(state, CoilNum, QCoilRequired, QCoilActual2, fanOp, PartLoadFrac); } break; - case HVAC::Coil_HeatingElectric_MultiStage: { + case HVAC::CoilType::HeatingElectricMultiStage: { CalcMultiStageElectricHeatingCoil( state, CoilNum, @@ -209,10 +209,12 @@ namespace HeatingCoils { QCoilActual2, state.dataHeatingCoils->CoilIsSuppHeater); // Autodesk:OPTIONAL SpeedRatio, PartLoadRatio, StageNum used without PRESENT check } break; - case HVAC::Coil_HeatingGasOrOtherFuel: { + + case HVAC::CoilType::HeatingGasOrOtherFuel: { CalcFuelHeatingCoil(state, CoilNum, QCoilRequired, QCoilActual2, fanOp, PartLoadFrac); } break; - case HVAC::Coil_HeatingGas_MultiStage: { + + case HVAC::CoilType::HeatingGasMultiStage: { CalcMultiStageGasHeatingCoil(state, CoilNum, SpeedRatio, @@ -220,7 +222,8 @@ namespace HeatingCoils { StageNum, fanOp); // Autodesk:OPTIONAL SpeedRatio, PartLoadRatio, StageNum used without PRESENT check } break; - case HVAC::Coil_HeatingDesuperheater: { + + case HVAC::CoilType::HeatingDesuperheater: { CalcDesuperheaterHeatingCoil(state, CoilNum, QCoilRequired, QCoilActual2); } break; default: @@ -364,9 +367,8 @@ namespace HeatingCoils { } } - heatingCoil.HeatingCoilType = "Heating"; heatingCoil.HeatingCoilModel = "Electric"; - heatingCoil.HCoilType_Num = HVAC::Coil_HeatingElectric; + heatingCoil.coilType = HVAC::CoilType::HeatingElectric; heatingCoil.Efficiency = Numbers(1); heatingCoil.NominalCapacity = Numbers(2); @@ -493,9 +495,8 @@ namespace HeatingCoils { } } - heatingCoil.HeatingCoilType = "Heating"; heatingCoil.HeatingCoilModel = "ElectricMultiStage"; - heatingCoil.HCoilType_Num = HVAC::Coil_HeatingElectric_MultiStage; + heatingCoil.coilType = HVAC::CoilType::HeatingElectricMultiStage; heatingCoil.NumOfStages = static_cast(Numbers(1)); @@ -630,9 +631,8 @@ namespace HeatingCoils { } } - heatingCoil.HeatingCoilType = "Heating"; heatingCoil.HeatingCoilModel = "Fuel"; - heatingCoil.HCoilType_Num = HVAC::Coil_HeatingGasOrOtherFuel; + heatingCoil.coilType = HVAC::CoilType::HeatingGasOrOtherFuel; heatingCoil.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, Alphas(3))); if (!(heatingCoil.FuelType == Constant::eFuel::NaturalGas || heatingCoil.FuelType == Constant::eFuel::Propane || @@ -827,9 +827,8 @@ namespace HeatingCoils { } } - heatingCoil.HeatingCoilType = "Heating"; heatingCoil.HeatingCoilModel = "GasMultiStage"; - heatingCoil.HCoilType_Num = HVAC::Coil_HeatingGas_MultiStage; + heatingCoil.coilType = HVAC::CoilType::HeatingGasMultiStage; heatingCoil.ParasiticFuelCapacity = Numbers(1); @@ -1027,9 +1026,8 @@ namespace HeatingCoils { } } - heatingCoil.HeatingCoilType = "Heating"; heatingCoil.HeatingCoilModel = "Desuperheater"; - heatingCoil.HCoilType_Num = HVAC::Coil_HeatingDesuperheater; + heatingCoil.coilType = HVAC::CoilType::HeatingDesuperheater; // HeatingCoil(CoilNum)%Efficiency = Numbers(1) //(Numbers(1)) error limits checked and defaults applied on efficiency after @@ -1108,7 +1106,7 @@ namespace HeatingCoils { ShowSevereError( state, format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{} \" cannot be over 0.3", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1138,7 +1136,7 @@ namespace HeatingCoils { ShowSevereError( state, format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{} \" cannot be over 0.9", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1161,7 +1159,7 @@ namespace HeatingCoils { ShowSevereError( state, format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{} \" cannot be over 0.3", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1185,7 +1183,7 @@ namespace HeatingCoils { ShowSevereError( state, format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{} \" cannot be over 0.3", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1208,7 +1206,7 @@ namespace HeatingCoils { ShowSevereError( state, format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{} \" cannot be over 0.3", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1231,7 +1229,7 @@ namespace HeatingCoils { ShowSevereError( state, format(R"({}, "{}" sum of heat reclaim recovery efficiencies from the same source coil: "{} " cannot be over 0.3)", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1247,7 +1245,7 @@ namespace HeatingCoils { state.dataHeatingCoils->InputErrorsFound = true; } DataHeatBalance::HeatReclaimDataBase &HeatReclaim = - state.dataCoilCooingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; + state.dataCoilCoolingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); std::fill(HeatReclaim.HVACDesuperheaterReclaimedHeat.begin(), HeatReclaim.HVACDesuperheaterReclaimedHeat.end(), 0.0); @@ -1257,7 +1255,7 @@ namespace HeatingCoils { ShowSevereError( state, format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{}\" cannot be over 0.3", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1418,7 +1416,7 @@ namespace HeatingCoils { } if (QCoilRequired == DataLoopNode::SensedLoadFlagValue && state.dataHeatingCoils->MySPTestFlag(CoilNum) && - heatingCoil.HCoilType_Num != HVAC::Coil_HeatingElectric_MultiStage && heatingCoil.HCoilType_Num != HVAC::Coil_HeatingGas_MultiStage) { + heatingCoil.coilType != HVAC::CoilType::HeatingElectricMultiStage && heatingCoil.coilType != HVAC::CoilType::HeatingGasMultiStage) { // If the coil is temperature controlled (QCoilReq == -999.0), both a control node and setpoint are required. if (!state.dataGlobal->SysSizingCalc && state.dataHVACGlobal->DoSetPointTest) { @@ -1428,7 +1426,7 @@ namespace HeatingCoils { // 3) TempSetPointNodeNum .GT. 0 and TempSetPoint == SensedNodeFlagValue, this is not correct, missing temperature setpoint // test 2) here (fatal message) if (ControlNodeNum == 0) { - ShowSevereError(state, format("{} \"{}\"", HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), heatingCoil.Name)); + ShowSevereError(state, format("{} \"{}\"", HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, "... Missing control node for heating coil."); ShowContinueError(state, "... enter a control node name in the coil temperature setpoint node field for this heating coil."); ShowContinueError(state, "... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node."); @@ -1438,7 +1436,7 @@ namespace HeatingCoils { auto const &controlNode = state.dataLoopNodes->Node(ControlNodeNum); if (controlNode.TempSetPoint == DataLoopNode::SensedNodeFlagValue) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { - ShowSevereError(state, format("{} \"{}\"", HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), heatingCoil.Name)); + ShowSevereError(state, format("{} \"{}\"", HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, "... Missing temperature setpoint for heating coil."); ShowContinueError(state, "... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node."); state.dataHeatingCoils->HeatingCoilFatalError = true; @@ -1446,7 +1444,7 @@ namespace HeatingCoils { EMSManager::CheckIfNodeSetPointManagedByEMS( state, ControlNodeNum, HVAC::CtrlVarType::Temp, state.dataHeatingCoils->HeatingCoilFatalError); if (state.dataHeatingCoils->HeatingCoilFatalError) { - ShowSevereError(state, format("{} \"{}\"", HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), heatingCoil.Name)); + ShowSevereError(state, format("{} \"{}\"", HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, "... Missing temperature setpoint for heating coil."); ShowContinueError(state, "... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node."); ShowContinueError(state, "... or use an EMS Actuator to establish a setpoint at the coil temperature setpoint node."); @@ -1466,7 +1464,7 @@ namespace HeatingCoils { // 4) TempSetPointNodeNum .GT. 0 and TempSetPoint /= SensedNodeFlagValue, control node not required if load based control // test 3) and 4) here (warning only) if (ControlNodeNum > 0) { - ShowWarningError(state, format("{} \"{}\"", HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), heatingCoil.Name)); + ShowWarningError(state, format("{} \"{}\"", HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, " The \"Temperature Setpoint Node Name\" input is not required for this heating coil."); ShowContinueError(state, " Leaving the input field \"Temperature Setpoint Node Name\" blank will eliminate this warning."); } @@ -1481,7 +1479,7 @@ namespace HeatingCoils { // Find the heating source index for the desuperheater heating coil if not already found. This occurs when zone heating // equip. exists. (when zone equipment heating coils are included in the input, the air loop DX equipment has not yet been read) // Issue a single warning if the coil is not found and continue the simulation - if (!state.dataHeatingCoils->ValidSourceType(CoilNum) && (heatingCoil.HCoilType_Num == HVAC::Coil_HeatingDesuperheater) && + if (!state.dataHeatingCoils->ValidSourceType(CoilNum) && (heatingCoil.coilType == HVAC::CoilType::HeatingDesuperheater) && state.dataHeatingCoils->ShowSingleWarning(CoilNum)) { ++state.dataHeatingCoils->ValidSourceTypeCounter; switch (heatingCoil.ReclaimHeatingSource) { @@ -1500,7 +1498,7 @@ namespace HeatingCoils { ShowSevereError( state, format(R"({}, "{}" sum of heat reclaim recovery efficiencies from the same source coil: "{}" cannot be over 0.3)", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1525,7 +1523,7 @@ namespace HeatingCoils { ShowSevereError( state, format(R"({}, "{}" sum of heat reclaim recovery efficiencies from the same source coil: "{}" cannot be over 0.9)", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1552,7 +1550,7 @@ namespace HeatingCoils { ShowSevereError( state, format(R"({}, "{}" sum of heat reclaim recovery efficiencies from the same source coil: "{}" cannot be over 0.3)", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1577,7 +1575,7 @@ namespace HeatingCoils { ShowSevereError( state, format(R"({}, "{}" sum of heat reclaim recovery efficiencies from the same source coil: "{}" cannot be over 0.3)", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1588,7 +1586,7 @@ namespace HeatingCoils { } case HeatObjTypes::COIL_COOLING_DX_NEW: DataHeatBalance::HeatReclaimDataBase &HeatReclaim = - state.dataCoilCooingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; + state.dataCoilCoolingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); std::fill(HeatReclaim.HVACDesuperheaterReclaimedHeat.begin(), HeatReclaim.HVACDesuperheaterReclaimedHeat.end(), 0.0); @@ -1597,7 +1595,7 @@ namespace HeatingCoils { ShowSevereError( state, format("{}, \"{}\" sum of heat reclaim recovery efficiencies from the same source coil: \"{}\" cannot be over 0.3", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name, heatingCoil.ReclaimHeatingCoilName)); } @@ -1656,20 +1654,20 @@ namespace HeatingCoils { auto &heatingCoil = state.dataHeatingCoils->HeatingCoil(CoilNum); - if (heatingCoil.HCoilType_Num == HVAC::Coil_HeatingElectric_MultiStage) { + if (heatingCoil.coilType == HVAC::CoilType::HeatingElectricMultiStage) { FieldNum = 1 + (heatingCoil.NumOfStages * 2); TempCap = heatingCoil.MSNominalCapacity(heatingCoil.NumOfStages); - } else if (heatingCoil.HCoilType_Num == HVAC::Coil_HeatingGas_MultiStage) { + } else if (heatingCoil.coilType == HVAC::CoilType::HeatingGasMultiStage) { FieldNum = 1 + (heatingCoil.NumOfStages * 3); TempCap = heatingCoil.MSNominalCapacity(heatingCoil.NumOfStages); - } else if (heatingCoil.HCoilType_Num == HVAC::Coil_HeatingDesuperheater) { + } else if (heatingCoil.coilType == HVAC::CoilType::HeatingDesuperheater) { return; // no autosizable inputs for desupterheater } else { FieldNum = 2; TempCap = heatingCoil.NominalCapacity; } SizingString = state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames(FieldNum) + " [W]"; - CompType = "Coil:" + heatingCoil.HeatingCoilType + ':' + heatingCoil.HeatingCoilModel; + CompType = "Coil:Heating:" + heatingCoil.HeatingCoilModel; CompName = heatingCoil.Name; state.dataSize->DataCoilIsSuppHeater = state.dataHeatingCoils->CoilIsSuppHeater; // set global instead of using optional argument state.dataSize->DataCoolCoilCap = @@ -1709,7 +1707,8 @@ namespace HeatingCoils { state.dataSize->DataDesInletAirTemp = 0.0; // reset global data to zero so other heating coils are not state.dataSize->DataDesOutletAirTemp = 0.0; // reset global data to zero so other heating coils are not affected - if (heatingCoil.HCoilType_Num == HVAC::Coil_HeatingElectric_MultiStage || heatingCoil.HCoilType_Num == HVAC::Coil_HeatingGas_MultiStage) { + if (heatingCoil.coilType == HVAC::CoilType::HeatingElectricMultiStage || + heatingCoil.coilType == HVAC::CoilType::HeatingGasMultiStage) { heatingCoil.MSNominalCapacity(heatingCoil.NumOfStages) = TempCap; bool IsAutoSize = false; int NumOfStages; // total number of stages of multi-stage heating coil @@ -1720,7 +1719,7 @@ namespace HeatingCoils { NumOfStages = heatingCoil.NumOfStages; for (int StageNum = NumOfStages - 1; StageNum >= 1; --StageNum) { bool ThisStageAutoSize = false; - FieldNum = 1 + StageNum * ((heatingCoil.HCoilType_Num == HVAC::Coil_HeatingElectric_MultiStage) ? 2 : 3); + FieldNum = 1 + StageNum * ((heatingCoil.coilType == HVAC::CoilType::HeatingElectricMultiStage) ? 2 : 3); SizingString = state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames(FieldNum) + " [W]"; if (heatingCoil.MSNominalCapacity(StageNum) == DataSizing::AutoSize) { ThisStageAutoSize = true; @@ -1768,7 +1767,7 @@ namespace HeatingCoils { ShowSevereError(state, format("SizeHeatingCoil: {} {}, Stage {} Nominal Capacity ({:.2R} W) must be less than or equal to Stage {} " "Nominal Capacity ({:.2R} W).", - heatingCoil.HeatingCoilType, + "Heating", heatingCoil.Name, StageNum, heatingCoil.MSNominalCapacity(StageNum), @@ -1785,14 +1784,15 @@ namespace HeatingCoils { state.dataHeatingCoils->HeatingCoilNumericFields.deallocate(); // remove temporary array for field names at end of sizing // create predefined report entries - switch (heatingCoil.HCoilType_Num) { - case HVAC::Coil_HeatingElectric: { + switch (heatingCoil.coilType) { + case HVAC::CoilType::HeatingElectric: { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilType, heatingCoil.Name, "Coil:Heating:Electric"); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilNomCap, heatingCoil.Name, heatingCoil.NominalCapacity); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, heatingCoil.Name, heatingCoil.Efficiency); } break; - case HVAC::Coil_HeatingElectric_MultiStage: { + + case HVAC::CoilType::HeatingElectricMultiStage: { OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilType, heatingCoil.Name, "Coil:Heating:Electric:MultiStage"); OutputReportPredefined::PreDefTableEntry( @@ -1800,13 +1800,15 @@ namespace HeatingCoils { OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilNomEff, heatingCoil.Name, heatingCoil.MSEfficiency(heatingCoil.NumOfStages)); } break; - case HVAC::Coil_HeatingGasOrOtherFuel: { + + case HVAC::CoilType::HeatingGasOrOtherFuel: { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilType, heatingCoil.Name, "Coil:Heating:Fuel"); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilNomCap, heatingCoil.Name, heatingCoil.NominalCapacity); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, heatingCoil.Name, heatingCoil.Efficiency); } break; - case HVAC::Coil_HeatingGas_MultiStage: { + + case HVAC::CoilType::HeatingGasMultiStage: { OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilType, heatingCoil.Name, "Coil:Heating:Gas:MultiStage"); OutputReportPredefined::PreDefTableEntry( @@ -1814,13 +1816,15 @@ namespace HeatingCoils { OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilNomEff, heatingCoil.Name, heatingCoil.MSEfficiency(heatingCoil.NumOfStages)); } break; - case HVAC::Coil_HeatingDesuperheater: { + + case HVAC::CoilType::HeatingDesuperheater: { OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilType, heatingCoil.Name, "Coil:Heating:Desuperheater"); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilNomCap, heatingCoil.Name, heatingCoil.NominalCapacity); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, heatingCoil.Name, heatingCoil.Efficiency); } break; + default: break; } @@ -2281,7 +2285,7 @@ namespace HeatingCoils { ++heatingCoil.PLFErrorCount; ShowWarningError(state, format("CalcFuelHeatingCoil: {}=\"{}\", PLF curve values", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, format("The PLF curve value = {:.5T} for part-load ratio = {:.5T}", PLF, PartLoadRat)); ShowContinueError(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and the simulation continues..."); @@ -2299,7 +2303,7 @@ namespace HeatingCoils { ++heatingCoil.RTFErrorCount; ShowWarningError(state, format("CalcFuelHeatingCoil: {}=\"{}\", runtime fraction", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, format("The runtime fraction exceeded 1.0. [{:.4T}].", heatingCoil.RTF)); ShowContinueError(state, "Runtime fraction is set to 1.0 and the simulation continues..."); @@ -2554,7 +2558,7 @@ namespace HeatingCoils { ++heatingCoil.PLFErrorCount; ShowWarningError(state, format("CalcFuelHeatingCoil: {}=\"{}\", PLF curve values", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, format("The PLF curve value = {:.5T} for part-load ratio = {:.5T}", PLF, PartLoadRat)); ShowContinueError(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and the simulation continues..."); @@ -2575,7 +2579,7 @@ namespace HeatingCoils { ++heatingCoil.RTFErrorCount; ShowWarningError(state, format("CalcFuelHeatingCoil: {}=\"{}\", runtime fraction", - HVAC::cAllCoilTypes(heatingCoil.HCoilType_Num), + HVAC::coilTypeNames[(int)heatingCoil.coilType], heatingCoil.Name)); ShowContinueError(state, format("The runtime fraction exceeded 1.0. [{:.4T}].", heatingCoil.RTF)); ShowContinueError(state, "Runtime fraction is set to 1.0 and the simulation continues..."); @@ -2699,7 +2703,7 @@ namespace HeatingCoils { case HeatObjTypes::COIL_COOLING_DX_NEW: // get RTF and NominalCapacity from Coil:CoolingDX { - auto const &thisCoolingCoil = state.dataCoilCooingDX->coilCoolingDXs[SourceID]; + auto const &thisCoolingCoil = state.dataCoilCoolingDX->coilCoolingDXs[SourceID]; heatingCoil.RTF = thisCoolingCoil.runTimeFraction; heatingCoil.NominalCapacity = thisCoolingCoil.reclaimHeat.AvailCapacity * Effic - thisCoolingCoil.reclaimHeat.WaterHeatingDesuperheaterReclaimedHeatTotal; @@ -2887,61 +2891,27 @@ namespace HeatingCoils { heatingCoil.ParasiticFuelConsumption = heatingCoil.ParasiticFuelRate * TimeStepSysSec; - std::string coilObjClassName; - switch (heatingCoil.HCoilType_Num) { - case HVAC::Coil_HeatingElectric: { - coilObjClassName = "Coil:Heating:Electric"; - } break; - case HVAC::Coil_HeatingElectric_MultiStage: { - coilObjClassName = "Coil:Heating:Electric:MultiStage"; - } break; - case HVAC::Coil_HeatingGasOrOtherFuel: { - coilObjClassName = "Coil:Heating:Fuel"; - } break; - case HVAC::Coil_HeatingGas_MultiStage: { - coilObjClassName = "Coil:Heating:Gas:MultiStage"; - } break; - case HVAC::Coil_HeatingDesuperheater: { - coilObjClassName = "Coil:Heating:Desuperheater"; - } break; - default: - break; - } if (heatingCoil.reportCoilFinalSizes) { if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes( - state, heatingCoil.Name, coilObjClassName, heatingCoil.NominalCapacity, heatingCoil.NominalCapacity, -999.0, -999.0); + state, heatingCoil.Name, heatingCoil.coilType, heatingCoil.NominalCapacity, heatingCoil.NominalCapacity, -999.0, -999.0); heatingCoil.reportCoilFinalSizes = false; } } } // End of Reporting subroutines for the HeatingCoil Module - - void GetCoilIndex(EnergyPlusData &state, std::string const &HeatingCoilName, int &HeatingCoilIndex, bool &ErrorsFound) + int GetCoilIndex(EnergyPlusData &state, std::string const &HeatingCoilName) { - - // SUBROUTINE INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN March 2005 - - // PURPOSE OF THIS SUBROUTINE: - // This subroutine sets an index for a given DX Coil -- issues error message if that - // DX Coil is not a legal DX Coil. - // Obtains and Allocates HeatingCoil related parameters from input file if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); state.dataHeatingCoils->GetCoilsInputFlag = false; } - HeatingCoilIndex = Util::FindItem(HeatingCoilName, state.dataHeatingCoils->HeatingCoil); - if (HeatingCoilIndex == 0) { - ShowSevereError(state, format("GetCoilIndex: Heating coil not found={}", HeatingCoilName)); - ErrorsFound = true; - } + return Util::FindItem(HeatingCoilName, state.dataHeatingCoils->HeatingCoil); } - + void CheckHeatingCoilSchedule(EnergyPlusData &state, std::string const &CompType, // unused1208 std::string_view CompName, @@ -2969,12 +2939,12 @@ namespace HeatingCoils { if (CoilNum == 0) { ShowFatalError(state, format("CheckHeatingCoilSchedule: Coil not found=\"{}\".", CompName)); } - if (!Util::SameString(CompType, HVAC::cAllCoilTypes(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num))) { + if (!Util::SameString(CompType, HVAC::coilTypeNames[(int)state.dataHeatingCoils->HeatingCoil(CoilNum).coilType])) { ShowSevereError(state, format("CheckHeatingCoilSchedule: Coil=\"{}\"", CompName)); ShowContinueError(state, format("...expected type=\"{}\", actual type=\"{}\".", CompType, - HVAC::cAllCoilTypes(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num))); + HVAC::coilTypeNames[(int)state.dataHeatingCoils->HeatingCoil(CoilNum).coilType])); ShowFatalError(state, "Program terminates due to preceding conditions."); } CompIndex = CoilNum; @@ -2997,7 +2967,7 @@ namespace HeatingCoils { ShowContinueError(state, format("...expected type=\"{}\", actual type=\"{}\".", CompType, - HVAC::cAllCoilTypes(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num))); + HVAC::coilTypeNames[(int)state.dataHeatingCoils->HeatingCoil(CoilNum).coilType])); ShowFatalError(state, "Program terminates due to preceding conditions."); } Value = ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr); // not scheduled? @@ -3005,202 +2975,41 @@ namespace HeatingCoils { } Real64 GetCoilCapacity(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN February 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the coil capacity for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned - // as negative. - - // Return value - Real64 CoilCapacity; // returned capacity of matched coil - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int WhichCoil; - - // Obtains and Allocates HeatingCoil related parameters from input file - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingGasOrOtherFuel || - FoundType == HVAC::Coil_HeatingDesuperheater) { - WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - CoilCapacity = state.dataHeatingCoils->HeatingCoil(WhichCoil).NominalCapacity; - } - } else if (FoundType == HVAC::Coil_HeatingElectric_MultiStage || FoundType == HVAC::Coil_HeatingGas_MultiStage) { - WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - CoilCapacity = - state.dataHeatingCoils->HeatingCoil(WhichCoil).MSNominalCapacity(state.dataHeatingCoils->HeatingCoil(WhichCoil).NumOfStages); - } + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + auto &heatingCoil = state.dataHeatingCoils->HeatingCoil(coilNum); + if (heatingCoil.coilType == HVAC::CoilType::HeatingElectric || + heatingCoil.coilType == HVAC::CoilType::HeatingGasOrOtherFuel || + heatingCoil.coilType == HVAC::CoilType::HeatingDesuperheater) { + return heatingCoil.NominalCapacity; + } else if (heatingCoil.coilType == HVAC::CoilType::HeatingElectricMultiStage || + heatingCoil.coilType == HVAC::CoilType::HeatingGasMultiStage) { + return heatingCoil.MSNominalCapacity(heatingCoil.NumOfStages); } else { - WhichCoil = 0; - } - - if (WhichCoil == 0) { // Autodesk:Return Reworked block to assure CoilCapacity is set before return - if (FoundType == 0) { - ShowSevereError(state, format("GetCoilCapacity: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - } else if (FoundType > 0) { - ShowSevereError(state, format("GetCoilCapacity: Invalid coil type for capacity, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ShowContinueError(state, - format("...only {}, {} or {} are valid in this context.", - HVAC::cAllCoilTypes(HVAC::Coil_HeatingElectric), - HVAC::cAllCoilTypes(HVAC::Coil_HeatingGasOrOtherFuel), - HVAC::cAllCoilTypes(HVAC::Coil_HeatingDesuperheater))); - } - ShowContinueError(state, "... returning Coil Capacity as -1000."); - ErrorsFound = true; - CoilCapacity = -1000.0; + return -1000.0; } - - return CoilCapacity; } int GetCoilAvailScheduleIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) - { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad, FSEC - // DATE WRITTEN February 2013 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the availability schedule index. If - // incorrect coil type or name is given, ErrorsFound is returned as true and index is returned - // as zero. - - // Obtains and Allocates HeatingCoil related parameters from input file - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int WhichCoil = 0; - int AvailSchIndex = 0; - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || - FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || - FoundType == HVAC::Coil_HeatingDesuperheater) { - WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - AvailSchIndex = state.dataHeatingCoils->HeatingCoil(WhichCoil).SchedPtr; - } - } else { - WhichCoil = 0; - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("GetCoilAvailScheduleIndex: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - AvailSchIndex = 0; - } - - return AvailSchIndex; + int const coilNum) + { + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + return state.dataHeatingCoils->HeatingCoil(coilNum).SchedPtr; } int GetCoilInletNode(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN February 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the inlet node number. If - // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned - // as zero. - - // Obtains and Allocates HeatingCoil related parameters from input file - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int WhichCoil = 0; - int NodeNumber = 0; - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || - FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || - FoundType == HVAC::Coil_HeatingDesuperheater) { - WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - NodeNumber = state.dataHeatingCoils->HeatingCoil(WhichCoil).AirInletNodeNum; - } - } else { - WhichCoil = 0; - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("GetCoilInletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - NodeNumber = 0; - } - - return NodeNumber; + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + return state.dataHeatingCoils->HeatingCoil(coilNum).AirInletNodeNum; } int GetCoilOutletNode(EnergyPlusData &state, - std::string_view CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN August 2006 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the outlet node number. If - // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned - // as zero. - - // Obtains and Allocates HeatingCoil related parameters from input file - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int WhichCoil = 0; - int NodeNumber = 0; - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || - FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || - FoundType == HVAC::Coil_HeatingDesuperheater) { - WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - NodeNumber = state.dataHeatingCoils->HeatingCoil(WhichCoil).AirOutletNodeNum; - } - } else { - WhichCoil = 0; - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("GetCoilOutletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - NodeNumber = 0; - } - - return NodeNumber; + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + return state.dataHeatingCoils->HeatingCoil(coilNum).AirOutletNodeNum; } int GetHeatReclaimSourceIndex(EnergyPlusData &state, @@ -3265,250 +3074,60 @@ namespace HeatingCoils { } int GetCoilControlNodeNum(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN June 2007 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the control node number. If - // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned - // as zero. - - // Obtains and Allocates HeatingCoil related parameters from input file - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || - FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || - FoundType == HVAC::Coil_HeatingDesuperheater) { - int WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - return state.dataHeatingCoils->HeatingCoil(WhichCoil).TempSetPointNodeNum; - } - } - - ShowSevereError(state, format("GetCoilControlNodeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return 0; - } - - int GetHeatingCoilTypeNum(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) - { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN August 2008 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the type number. If - // incorrect coil type or name is given, ErrorsFound is returned as true and type number is returned - // as zero. - - // Obtains and Allocates HeatingCoil related parameters from input file - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || - FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || - FoundType == HVAC::Coil_HeatingDesuperheater) { - int WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - return state.dataHeatingCoils->HeatingCoil(WhichCoil).HCoilType_Num; - } - } - - ShowSevereError(state, format("GetHeatingCoilTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return 0; + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + return state.dataHeatingCoils->HeatingCoil(coilNum).TempSetPointNodeNum; } int GetHeatingCoilIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + std::string const &CoilName) { - - // FUNCTION INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN February 2011 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the index into the structure. If - // incorrect coil type or name is given, ErrorsFound is returned as true and index is returned - // as zero. - // Obtains and Allocates HeatingCoil related parameters from input file if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); state.dataHeatingCoils->GetCoilsInputFlag = false; } - int WhichCoil = 0; - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || - FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || - FoundType == HVAC::Coil_HeatingDesuperheater) { - WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - } - - if (WhichCoil == 0) { - ShowSevereError(state, format("GetHeatingCoilIndex: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - } - - return WhichCoil; + return Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); } int GetHeatingCoilPLFCurveIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Richard Raustad - // DATE WRITTEN December 2008 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the PLF curve index. If - // incorrect coil name is given for gas or electric heating coils, ErrorsFound - // is returned as true and curve index is returned as zero. - // If not a gas or electric heating coil, ErrorsFound is unchanged and index is 0. - - // Obtains and Allocates HeatingCoil related parameters from input file - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); - if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || - FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || - FoundType == HVAC::Coil_HeatingDesuperheater) { - int WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - return state.dataHeatingCoils->HeatingCoil(WhichCoil).PLFCurveIndex; - } else { - ShowSevereError(state, format("GetHeatingCoilPLFCurveIndex: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return 0; - } - } else { - return 0; - } + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + return state.dataHeatingCoils->HeatingCoil(coilNum).PLFCurveIndex; } int GetHeatingCoilNumberOfStages(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem - ) + int const coilNum) { - - // FUNCTION INFORMATION: - // AUTHOR Chandan Sharma - // DATE WRITTEN February 2013 - - // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the number of speeds for multistage coils. - // If incorrect coil type or name is given, ErrorsFound is returned as true. - - // Obtains and Allocates HeatingCoils - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - int WhichCoil = Util::FindItemInList(CoilName, state.dataHeatingCoils->HeatingCoil); - if (WhichCoil != 0) { - return state.dataHeatingCoils->HeatingCoil(WhichCoil).NumOfStages; - } else { - ShowSevereError(state, format("GetHeatingCoilNumberOfSpeeds: Invalid Heating Coil Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); - ErrorsFound = true; - return 0; - } + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + return state.dataHeatingCoils->HeatingCoil(coilNum).NumOfStages; } - void SetHeatingCoilData(EnergyPlusData &state, - int const CoilNum, // Number of electric or gas heating Coil - bool &ErrorsFound, // Set to true if certain errors found - ObjexxFCL::Optional_bool DesiccantRegenerationCoil, // Flag that this coil is used as regeneration air heating coil - ObjexxFCL::Optional_int DesiccantDehumIndex // Index for the desiccant dehum system where this coil is used - ) + void SetHeatingCoilDesicRegenCoil(EnergyPlusData &state, + int const coilNum, // Number of electric or gas heating Coil + bool desiccantRegenerationCoil) // Flag that this coil is used as regeneration air heating coil { - - // FUNCTION INFORMATION: - // AUTHOR Bereket Nigusse - // DATE WRITTEN February 2016 - - // PURPOSE OF THIS FUNCTION: - // This function sets data to Heating Coil using the coil index and arguments passed - - auto &heatingCoil = state.dataHeatingCoils->HeatingCoil(CoilNum); - if (state.dataHeatingCoils->GetCoilsInputFlag) { - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - if (CoilNum <= 0 || CoilNum > state.dataHeatingCoils->NumHeatingCoils) { - ShowSevereError(state, - format("SetHeatingCoilData: called with heating coil Number out of range={} should be >0 and <{}", - CoilNum, - state.dataHeatingCoils->NumHeatingCoils)); - ErrorsFound = true; - return; - } - - if (present(DesiccantRegenerationCoil)) { - heatingCoil.DesiccantRegenerationCoil = DesiccantRegenerationCoil; - } - - if (present(DesiccantDehumIndex)) { - heatingCoil.DesiccantDehumNum = DesiccantDehumIndex; - } + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->HeatingCoil(coilNum).DesiccantRegenerationCoil = desiccantRegenerationCoil; } - void SetHeatingCoilAirLoopNumber(EnergyPlusData &state, std::string const &HeatingCoilName, int AirLoopNum, bool &ErrorsFound) + void SetHeatingCoilDesicDehumIndex(EnergyPlusData &state, + int const coilNum, // Number of electric or gas heating Coil + int desiccantDehumIndex) // Index for the desiccant dehum system where this coil is used { - // SUBROUTINE INFORMATION: - // AUTHOR L.Gu - // DATE WRITTEN March 2018 - - // PURPOSE OF THIS SUBROUTINE: - // This subroutine sets an AirLoopNum for a given heating Coil - - int HeatingCoilIndex; - - if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered - GetHeatingCoilInput(state); - state.dataHeatingCoils->GetCoilsInputFlag = false; - } - - HeatingCoilIndex = Util::FindItem(HeatingCoilName, state.dataHeatingCoils->HeatingCoil); - if (HeatingCoilIndex == 0) { - ShowSevereError(state, format("GetCoilIndex: Heating coil not found={}", HeatingCoilName)); - ErrorsFound = true; - } else { - state.dataHeatingCoils->HeatingCoil(HeatingCoilIndex).AirLoopNum = AirLoopNum; - } + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->HeatingCoil(coilNum).DesiccantDehumNum = desiccantDehumIndex; + } + + void SetHeatingCoilAirLoopNumber(EnergyPlusData &state, + int const coilNum, + int AirLoopNum) + { + assert(coilNum > 0 && coilNum <= state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->HeatingCoil(coilNum).AirLoopNum = AirLoopNum; } } // namespace HeatingCoils diff --git a/src/EnergyPlus/HeatingCoils.hh b/src/EnergyPlus/HeatingCoils.hh index b468269981f..c0a70fc75b1 100644 --- a/src/EnergyPlus/HeatingCoils.hh +++ b/src/EnergyPlus/HeatingCoils.hh @@ -84,9 +84,8 @@ namespace HeatingCoils { { // Members std::string Name; // Name of the HeatingCoil - std::string HeatingCoilType; // Type of HeatingCoil ie. Heating or Cooling std::string HeatingCoilModel; // Type of HeatingCoil ie. Simple, Detailed, etc. - int HCoilType_Num = 0; + HVAC::CoilType coilType = HVAC::CoilType::Invalid; Constant::eFuel FuelType = Constant::eFuel::Invalid; // Type of fuel used, reference resource type integers std::string Schedule; // HeatingCoil Operation Schedule int SchedPtr = 0; // Pointer to the correct schedule @@ -209,6 +208,8 @@ namespace HeatingCoils { void GetCoilIndex(EnergyPlusData &state, std::string const &HeatingCoilName, int &HeatingCoilIndex, bool &ErrorsFound); + int GetCoilIndex(EnergyPlusData &state, std::string const &HeatingCoilName); + void CheckHeatingCoilSchedule(EnergyPlusData &state, std::string const &CompType, // unused1208 std::string_view CompName, @@ -221,6 +222,10 @@ namespace HeatingCoils { bool &ErrorsFound // set to true if problem ); + Real64 GetCoilCapacity(EnergyPlusData &state, + int const coilNum + ); + int GetCoilAvailScheduleIndex(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -233,24 +238,40 @@ namespace HeatingCoils { bool &ErrorsFound // set to true if problem ); + int GetCoilInletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilOutletNode(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilOutletNode(EnergyPlusData &state, + int const coilNum + ); + int GetHeatReclaimSourceIndex(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetHeatReclaimSourceIndex(EnergyPlusData &state, + int const coilNum + ); + int GetCoilControlNodeNum(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilControlNodeNum(EnergyPlusData &state, + int const coilNum + ); + int GetHeatingCoilTypeNum(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -263,12 +284,20 @@ namespace HeatingCoils { bool &ErrorsFound // set to true if problem ); + int GetHeatingCoilIndex(EnergyPlusData &state, + std::string const &CoilName // must match coil names for the coil type + ); + int GetHeatingCoilPLFCurveIndex(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetHeatingCoilPLFCurveIndex(EnergyPlusData &state, + int const coilNum + ); + int GetHeatingCoilNumberOfStages(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type diff --git a/src/EnergyPlus/IntegratedHeatPump.hh b/src/EnergyPlus/IntegratedHeatPump.hh index 002f42622dd..fd3af325005 100644 --- a/src/EnergyPlus/IntegratedHeatPump.hh +++ b/src/EnergyPlus/IntegratedHeatPump.hh @@ -307,6 +307,10 @@ namespace IntegratedHeatPump { bool &ErrorsFound // set to true if problem ); + int GetCoilIndexIHP(EnergyPlusData &state, + std::string const &CoilName + ); + int GetCoilInletNodeIHP(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type diff --git a/src/EnergyPlus/Material.cc b/src/EnergyPlus/Material.cc index de528961c7b..40fb0f090ae 100644 --- a/src/EnergyPlus/Material.cc +++ b/src/EnergyPlus/Material.cc @@ -485,7 +485,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (mat->windowOpticalData == Window::OpticalDataModel::Spectral) { if (s_ipsc->lAlphaFieldBlanks(3)) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} = Spectral but {} is blank.", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaFieldNames(3))); ErrorsFound = true; } else if ((mat->GlassSpectralDataPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(3), s_mat->SpectralData)) == 0) { @@ -499,52 +499,52 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(3) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(3))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(3))); } if (s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(4) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(4))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(4))); } if (s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(6) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(6))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(6))); } if (s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(7) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(7))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(7))); } if (s_ipsc->rNumericArgs(8) + s_ipsc->rNumericArgs(9) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(9))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(9))); } if (s_ipsc->rNumericArgs(8) + s_ipsc->rNumericArgs(10) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(10))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(10))); } if (s_ipsc->rNumericArgs(2) < 0.0) { - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(2))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(2))); ErrorsFound = true; } if (s_ipsc->rNumericArgs(2) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(2))); + ShowSevereCustom(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(2))); } if (s_ipsc->rNumericArgs(3) < 0.0 || s_ipsc->rNumericArgs(3) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(3))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(3))); } if (s_ipsc->rNumericArgs(4) < 0.0 || s_ipsc->rNumericArgs(4) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(4))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(4))); } if (s_ipsc->rNumericArgs(5) < 0.0) { @@ -553,28 +553,28 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(5) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(5))); + ShowSevereCustom(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(5))); } if (s_ipsc->rNumericArgs(6) < 0.0 || s_ipsc->rNumericArgs(6) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(6))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(6))); } if (s_ipsc->rNumericArgs(7) < 0.0 || s_ipsc->rNumericArgs(7) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(7))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(7))); } } if (s_ipsc->rNumericArgs(8) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(8))); + ShowSevereCustom(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(8))); } if (s_ipsc->rNumericArgs(9) <= 0.0 || s_ipsc->rNumericArgs(9) >= 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(9))); + ShowSevereCustom(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(9))); } if (s_ipsc->rNumericArgs(10) <= 0.0 || s_ipsc->rNumericArgs(10) >= 1.0) { @@ -585,17 +585,17 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(11) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(11))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(11))); } if (s_ipsc->rNumericArgs(13) < 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(13))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(13))); } if (s_ipsc->rNumericArgs(14) < 0.0 || s_ipsc->rNumericArgs(14) >= 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(14))); + ShowSevereCustom(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(14))); } if (s_ipsc->cAlphaArgs(4) == "") { @@ -631,7 +631,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if GetCurveMinMaxValues(state, mat->GlassSpecAngTransDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); if (minAngValue > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the minumum value = 0.0 in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -640,7 +640,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (std::abs(maxAngValue - 90.0) > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the maximum value = 90.0 in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -649,7 +649,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (minLamValue < 0.1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the minumum value = 0.1 micron in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -658,7 +658,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (maxLamValue > 4.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the maximum value = 4.0 microns in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -684,7 +684,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if GetCurveMinMaxValues(state, mat->GlassSpecAngFRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); if (minAngValue > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the minumum value = 0.0 in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -692,7 +692,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if } if (std::abs(maxAngValue - 90.0) > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the maximum value = 90.0 in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -700,7 +700,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if } if (minLamValue < 0.1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the minumum value = 0.1 micron in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -708,7 +708,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if } if (maxLamValue > 4.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the maximum value = 4.0 microns in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -734,7 +734,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if GetCurveMinMaxValues(state, mat->GlassSpecAngBRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); if (minAngValue > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the minumum value = 0.0 in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -742,7 +742,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if } if (std::abs(maxAngValue - 90.0) > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the maximum value = 90.0 in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -750,7 +750,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if } if (minLamValue < 0.1) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the minumum value = 0.1 micron in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -758,7 +758,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if } if (maxLamValue > 4.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} requires the maximum value = 4.0 microns in the entered table name={}", s_ipsc->cAlphaFieldNames(5), @@ -841,7 +841,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(7) >= 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(6), s_ipsc->cNumericFieldNames(7))); + ShowSevereCustom(state, eoh, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(6), s_ipsc->cNumericFieldNames(7))); } if (s_ipsc->cAlphaArgs(2) == "") { @@ -1024,11 +1024,11 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (matGas->gases[0].vis.c0 <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(5))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(5))); } if (matGas->gases[0].cp.c0 <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(8))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(8))); } if (matGas->gases[0].wght <= 0.0) { ErrorsFound = true; @@ -2340,7 +2340,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if s_mat->materialMap.insert_or_assign(nameUC, mat->Num); if (NumNums + 1 != NumAlphas) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Check number of {} compared to number of {}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cNumericFieldNames(1))); ErrorsFound = true; continue; @@ -2365,7 +2365,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if auto *matGlass = s_mat->materials(matRef.matNum); // test that named material is of the right type if (matGlass->group != Group::Glass) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} = {}, Material is not a window glazing ", s_ipsc->cAlphaFieldNames(1 + iMatRef), s_ipsc->cAlphaArgs(1 + iMatRef))); @@ -2462,13 +2462,13 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if mat->Thickness = s_ipsc->rNumericArgs(1); if (s_ipsc->rNumericArgs(1) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + ShowSevereCustom(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); } mat->Pressure = s_ipsc->rNumericArgs(2); if (s_ipsc->rNumericArgs(2) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + ShowSevereCustom(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); } if (!s_ipsc->lAlphaFieldBlanks(2)) { @@ -2609,61 +2609,61 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(1) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); } if (s_ipsc->rNumericArgs(2) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); } if ((s_ipsc->rNumericArgs(3) < 0.0) || (s_ipsc->rNumericArgs(3) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(3), s_ipsc->rNumericArgs(3))); } if ((s_ipsc->rNumericArgs(4) <= 0.0) || (s_ipsc->rNumericArgs(4) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(4), s_ipsc->rNumericArgs(4))); } if ((s_ipsc->rNumericArgs(5) <= 0.0) || (s_ipsc->rNumericArgs(5) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(5), s_ipsc->rNumericArgs(5))); } if ((s_ipsc->rNumericArgs(6) < 0.0) || (s_ipsc->rNumericArgs(6) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >= 0 or <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(6), s_ipsc->rNumericArgs(6))); } if ((s_ipsc->rNumericArgs(7) < 0.0) || (s_ipsc->rNumericArgs(7) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >=0 or <=1, entered {:.2R}", s_ipsc->cNumericFieldNames(7), s_ipsc->rNumericArgs(7))); } if ((s_ipsc->rNumericArgs(8) < 0.0) || (s_ipsc->rNumericArgs(8) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(8), s_ipsc->rNumericArgs(8))); } if ((s_ipsc->rNumericArgs(9) < 0.0) || (s_ipsc->rNumericArgs(9) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(9), s_ipsc->rNumericArgs(9))); } if ((s_ipsc->rNumericArgs(10) < 0.0) || (s_ipsc->rNumericArgs(10) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(10), s_ipsc->rNumericArgs(10))); } @@ -2671,7 +2671,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if (mat->LayerType == TARCOGParams::TARCOGLayerType::VENETBLIND_VERT)) { if ((s_ipsc->rNumericArgs(16) > 0.0) && (s_ipsc->rNumericArgs(16) < (s_ipsc->rNumericArgs(11) / 2))) { ErrorsFound = true; - ShowSevereCustomMessage(state, + ShowSevereCustom(state, eoh, format("{} must be = 0 or greater than SlatWidth/2, entered value = {:.2R}", s_ipsc->cNumericFieldNames(16), @@ -2930,7 +2930,7 @@ void GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound) // set } if (TotLam > MaxSpectralDataElements) { - ShowSevereCustomMessage(state, eoh, format("More than {} entries in set ({})", MaxSpectralDataElements, NumNums)); + ShowSevereCustom(state, eoh, format("More than {} entries in set ({})", MaxSpectralDataElements, NumNums)); ErrorsFound = true; continue; } diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 36d1c26f7c0..83f32abe459 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -578,11 +578,11 @@ void SimOAComponent(EnergyPlusData &state, AirLoopNum, CompName, CompIndex, - state.dataHVACAssistedCC->HXAssistedCoil(CompIndex).ControllerName, - state.dataHVACAssistedCC->HXAssistedCoil(CompIndex).ControllerIndex, + state.dataHVACAssistedCC->HXAssistedCoils(CompIndex).ControllerName, + state.dataHVACAssistedCC->HXAssistedCoils(CompIndex).ControllerIndex, true); // set flag to tell HVAC controller it will be simulated only in SolveWaterCoilController() - state.dataHVACControllers->ControllerProps(state.dataHVACAssistedCC->HXAssistedCoil(CompIndex).ControllerIndex).BypassControllerCalc = + state.dataHVACControllers->ControllerProps(state.dataHVACAssistedCC->HXAssistedCoils(CompIndex).ControllerIndex).BypassControllerCalc = true; } OACoolingCoil = true; @@ -790,15 +790,13 @@ void SimOAController(EnergyPlusData &state, std::string const &CtrlName, int &Ct for (int CompNum = 1; CompNum <= primaryAirSystems.Branch(BranchNum).TotalComponents; ++CompNum) { if (primaryAirSystems.Branch(BranchNum).Comp(CompNum).CompType_Num == SimAirServingZones::CompType::UnitarySystemModel) { std::string_view unitarySystemName = primaryAirSystems.Branch(BranchNum).Comp(CompNum).Name; - int unitarySystemNum = Util::FindItemInList( + int usNum = Util::FindItemInList( unitarySystemName, state.dataUnitarySystems->unitarySys, state.dataUnitarySystems->numUnitarySystems); - if (state.dataUnitarySystems->unitarySys[unitarySystemNum - 1].m_ControlType == + if (state.dataUnitarySystems->unitarySys[usNum - 1].m_ControlType == UnitarySystems::UnitarySys::UnitarySysCtrlType::Load) { - if (state.dataUnitarySystems->unitarySys[unitarySystemNum - 1].m_CoolingCoilType_Num == - HVAC::CoilDX_MultiSpeedCooling || - state.dataUnitarySystems->unitarySys[unitarySystemNum - 1].m_CoolingCoilType_Num == - HVAC::Coil_CoolingAirToAirVariableSpeed || - state.dataUnitarySystems->unitarySys[unitarySystemNum - 1].m_CoolingCoilType_Num == HVAC::CoilDX_Cooling) { + if (state.dataUnitarySystems->unitarySys[usNum - 1].m_CoolingCoilType == HVAC::CoilType::DXMultiSpeedCooling || + state.dataUnitarySystems->unitarySys[usNum - 1].m_CoolingCoilType == HVAC::CoilType::CoolingAirToAirVariableSpeed || + state.dataUnitarySystems->unitarySys[usNum - 1].m_CoolingCoilType == HVAC::CoilType::DXCooling) { sensLoadCtrlUnitarySystemFound = true; break; } @@ -4788,19 +4786,17 @@ void OAControllerProps::SizeOAController(EnergyPlusData &state) for (int CompNum = 1; CompNum <= state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).NumComponents; ++CompNum) { std::string const &CompType = state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).ComponentType(CompNum); std::string const &CompName = state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).ComponentName(CompNum); - if (Util::SameString(CompType, "COIL:COOLING:WATER:DETAILEDGEOMETRY") || Util::SameString(CompType, "COIL:HEATING:WATER") || - Util::SameString(CompType, "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED")) { - std::string CoilName; - std::string CoilType; - - if (Util::SameString(CompType, "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED")) { - CoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, CompType, CompName, ErrorsFound); - CoilType = HVACHXAssistedCoolingCoil::GetHXCoilType(state, CompType, CompName, ErrorsFound); + if (Util::SameString(CompType, "COIL:COOLING:WATER:DETAILEDGEOMETRY") || + Util::SameString(CompType, "COIL:HEATING:WATER")) { + WaterCoils::SetCoilDesFlow(state, CompType, CompName, this->MinOA, ErrorsFound); + } else if (Util::SameString(CompType, "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED")) { + int hxCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, CompName); + if (hxCoilNum == 0) { + ShowSevereError(state, format("Item not found: {} = \"{}\"", CompType, CompName)); + ErrorsFound = true; } else { - CoilName = CompName; - CoilType = CompType; + WaterCoils::SetCoilDesFlow(state, HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilIndex(state, hxCoilNum), this->MinOA); } - WaterCoils::SetCoilDesFlow(state, CoilType, CoilName, this->MinOA, ErrorsFound); } } // End of component loop } diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index e7a4129b080..bf275ea3c8b 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -200,7 +200,7 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state) auto *mat = s_mat->materials(matNum); if (mat->group != Material::Group::Regular || mat->ROnly) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, "Reference Material is not appropriate type for EMPD properties, must have regular properties (L,Cp,K,D)"); ErrorsFound = true; continue; diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index fe95a264c28..eac967b5924 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -219,19 +219,8 @@ namespace OutdoorAirUnit { using BranchNodeConnections::TestCompSet; using NodeInputManager::GetOnlySingleNode; using ScheduleManager::GetScheduleIndex; - using SteamCoils::GetCoilAirInletNode; - using SteamCoils::GetCoilAirOutletNode; - using SteamCoils::GetCoilMaxSteamFlowRate; - using SteamCoils::GetCoilSteamInletNode; - using SteamCoils::GetCoilSteamOutletNode; - using SteamCoils::GetSteamCoilIndex; using namespace DataLoopNode; - using HeatingCoils::GetCoilInletNode; - using HeatingCoils::GetCoilOutletNode; using OutAirNodeManager::CheckAndAddAirNodeNumber; - using WaterCoils::GetCoilWaterInletNode; - using WaterCoils::GetCoilWaterOutletNode; - using WaterCoils::GetWaterCoilIndex; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetOutdoorAirUnitInputs: "); // include trailing blank space @@ -620,206 +609,115 @@ namespace OutdoorAirUnit { // Get information of component for (int InListNum = 1; InListNum <= NumInList; ++InListNum) { - thisOutAirUnit.OAEquip(InListNum).ComponentName = AlphArray(InListNum * 2 + 1); - - thisOutAirUnit.OAEquip(InListNum).Type = - static_cast(getEnumValue(CompTypeNamesUC, Util::makeUPPER(AlphArray(InListNum * 2)))); + auto &oaEquip = thisOutAirUnit.OAEquip(InListNum); + oaEquip.ComponentName = AlphArray(InListNum * 2 + 1); + oaEquip.Type = static_cast(getEnumValue(CompTypeNamesUC, AlphArray(InListNum * 2))); int const CompNum = InListNum; - + // Coil Types - switch (thisOutAirUnit.OAEquip(InListNum).Type) { + switch (oaEquip.Type) { case CompType::WaterCoil_Cooling: { - thisOutAirUnit.OAEquip(CompNum).CoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; - thisOutAirUnit.OAEquip(CompNum).ComponentIndex = - GetWaterCoilIndex(state, - CompTypeNamesUC[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirInletNode = - WaterCoils::GetCoilInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirOutletNode = - WaterCoils::GetCoilOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterInletNode = - GetCoilWaterInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterOutletNode = - GetCoilWaterOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MaxVolWaterFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MinVolWaterFlow = 0.0; - break; - } + oaEquip.CoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; + oaEquip.ComponentIndex = WaterCoils::GetWaterCoilIndex(state, oaEquip.ComponentName); + if (oaEquip.ComponentIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(InListNum * 2 + 1), oaEquip.ComponentName); + ErrorsFound = true; + } else { + oaEquip.CoilAirInletNode = WaterCoils::GetCoilInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, oaEquip.ComponentIndex); + oaEquip.MaxVolWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, oaEquip.ComponentIndex); + oaEquip.MinVolWaterFlow = 0.0; + } + } break; + case CompType::WaterCoil_SimpleHeat: { - thisOutAirUnit.OAEquip(CompNum).CoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - thisOutAirUnit.OAEquip(CompNum).ComponentIndex = - GetWaterCoilIndex(state, - CompTypeNamesUC[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirInletNode = - WaterCoils::GetCoilInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirOutletNode = WaterCoils::GetCoilOutletNode( - state, "Coil:Heating:Water", thisOutAirUnit.OAEquip(CompNum).ComponentName, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterInletNode = - GetCoilWaterInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterOutletNode = - GetCoilWaterOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MaxVolWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate( - state, "Coil:Heating:Water", thisOutAirUnit.OAEquip(CompNum).ComponentName, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MinVolWaterFlow = 0.0; - break; - } + oaEquip.CoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + oaEquip.ComponentIndex = WaterCoils::GetWaterCoilIndex(state, oaEquip.ComponentName); + if (oaEquip.ComponentIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(InListNum * 2 + 1), oaEquip.ComponentName); + ErrorsFound = true; + } else { + oaEquip.CoilAirInletNode = WaterCoils::GetCoilInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, oaEquip.ComponentIndex); + oaEquip.MaxVolWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, oaEquip.ComponentIndex); + oaEquip.MinVolWaterFlow = 0.0; + } + } break; + case CompType::SteamCoil_AirHeat: { - thisOutAirUnit.OAEquip(CompNum).CoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; - thisOutAirUnit.OAEquip(CompNum).ComponentIndex = - GetSteamCoilIndex(state, - CompTypeNamesUC[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirInletNode = GetCoilAirInletNode( - state, thisOutAirUnit.OAEquip(CompNum).ComponentIndex, thisOutAirUnit.OAEquip(CompNum).ComponentName, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirOutletNode = GetCoilAirOutletNode( - state, thisOutAirUnit.OAEquip(CompNum).ComponentIndex, thisOutAirUnit.OAEquip(CompNum).ComponentName, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterInletNode = GetCoilSteamInletNode( - state, thisOutAirUnit.OAEquip(CompNum).ComponentIndex, thisOutAirUnit.OAEquip(CompNum).ComponentName, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterOutletNode = - GetCoilSteamOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - - thisOutAirUnit.OAEquip(CompNum).MaxVolWaterFlow = - GetCoilMaxSteamFlowRate(state, thisOutAirUnit.OAEquip(CompNum).ComponentIndex, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MinVolWaterFlow = 0.0; - // below: no extra error needed if steam properties not in input - // file because getting the steam coil will have done that. - thisOutAirUnit.OAEquip(CompNum).FluidIndex = Fluid::GetRefrigNum(state, "STEAM"); - break; - } + oaEquip.CoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + oaEquip.ComponentIndex = SteamCoils::GetSteamCoilIndex(state, oaEquip.ComponentName); + if (oaEquip.ComponentIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(InListNum * 2 + 1), oaEquip.ComponentName); + ErrorsFound = true; + } else { + oaEquip.CoilAirInletNode = SteamCoils::GetCoilAirInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterInletNode = SteamCoils::GetCoilSteamInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterOutletNode = SteamCoils::GetCoilSteamOutletNode(state, oaEquip.ComponentIndex); + oaEquip.MaxVolWaterFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, oaEquip.ComponentIndex); + oaEquip.MinVolWaterFlow = 0.0; + // below: no extra error needed if steam properties not in input + // file because getting the steam coil will have done that. + oaEquip.FluidIndex = Fluid::GetRefrigNum(state, "STEAM"); + } + } break; + case CompType::WaterCoil_DetailedCool: { - thisOutAirUnit.OAEquip(CompNum).ComponentIndex = - GetWaterCoilIndex(state, - CompTypeNamesUC[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; - thisOutAirUnit.OAEquip(CompNum).CoilAirInletNode = - WaterCoils::GetCoilInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirOutletNode = - WaterCoils::GetCoilOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterInletNode = - GetCoilWaterInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterOutletNode = - GetCoilWaterOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MaxVolWaterFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MinVolWaterFlow = 0.0; - break; - } + oaEquip.CoilType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; + oaEquip.ComponentIndex = WaterCoils::GetWaterCoilIndex(state, oaEquip.ComponentName); + if (oaEquip.ComponentIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(InListNum * 2 + 1), oaEquip.ComponentName); + ErrorsFound = true; + } else { + oaEquip.CoilAirInletNode = WaterCoils::GetCoilInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, oaEquip.ComponentIndex); + oaEquip.MaxVolWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, oaEquip.ComponentIndex); + oaEquip.MinVolWaterFlow = 0.0; + } + } break; + case CompType::WaterCoil_CoolingHXAsst: { - thisOutAirUnit.OAEquip(CompNum).CoilAirInletNode = - HVACHXAssistedCoolingCoil::GetCoilInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirOutletNode = - HVACHXAssistedCoolingCoil::GetCoilOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterInletNode = - GetCoilWaterInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilWaterOutletNode = - GetCoilWaterOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MaxVolWaterFlow = HVACHXAssistedCoolingCoil::GetCoilMaxWaterFlowRate( - state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).MinVolWaterFlow = 0.0; - break; - } - case CompType::Coil_ElectricHeat: { - // Get OutAirUnit( OAUnitNum ).OAEquip( CompNum ).ComponentIndex, 2 types of mining functions to choose from - HeatingCoils::GetCoilIndex( - state, thisOutAirUnit.OAEquip(CompNum).ComponentName, thisOutAirUnit.OAEquip(CompNum).ComponentIndex, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirInletNode = - HeatingCoils::GetCoilInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirOutletNode = - HeatingCoils::GetCoilOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - break; - } + // Does this not have a PlantEquipmentType? + oaEquip.ComponentIndex = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, oaEquip.ComponentName); + if (oaEquip.ComponentIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(InListNum * 2 + 1), oaEquip.ComponentName); + ErrorsFound = true; + } else { + // Should this be the index of the child coil or the parent HXAssisted Coil? + oaEquip.CoilAirInletNode = HVACHXAssistedCoolingCoil::GetHXCoilInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilAirOutletNode = HVACHXAssistedCoolingCoil::GetHXCoilOutletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterInletNode = HVACHXAssistedCoolingCoil::GetHXCoilWaterInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilWaterOutletNode = HVACHXAssistedCoolingCoil::GetHXCoilWaterOutletNode(state, oaEquip.ComponentIndex); + oaEquip.MaxVolWaterFlow = HVACHXAssistedCoolingCoil::GetHXCoilMaxWaterFlowRate(state, oaEquip.ComponentIndex); + oaEquip.MinVolWaterFlow = 0.0; + } + } break; + + case CompType::Coil_ElectricHeat: case CompType::Coil_GasHeat: { // Get OutAirUnit( OAUnitNum ).OAEquip( CompNum ).ComponentIndex, 2 types of mining functions to choose from - HeatingCoils::GetCoilIndex( - state, thisOutAirUnit.OAEquip(CompNum).ComponentName, thisOutAirUnit.OAEquip(CompNum).ComponentIndex, ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirInletNode = - GetCoilInletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - thisOutAirUnit.OAEquip(CompNum).CoilAirOutletNode = - GetCoilOutletNode(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)], - thisOutAirUnit.OAEquip(CompNum).ComponentName, - ErrorsFound); - break; - } + oaEquip.ComponentIndex = HeatingCoils::GetCoilIndex(state, oaEquip.ComponentName); + if (oaEquip.ComponentIndex == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(InListNum * 2 + 1), oaEquip.ComponentName); + ErrorsFound = true; + } else { + oaEquip.CoilAirInletNode = HeatingCoils::GetCoilInletNode(state, oaEquip.ComponentIndex); + oaEquip.CoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, oaEquip.ComponentIndex); + } + } break; + case CompType::DXSystem: { // set the data for 100% DOAS DX cooling coil // is a different function call needed here? similar to one in HVACDXSystem - // CheckDXCoolingCoilInOASysExists(state, thisOutAirUnit.OAEquip(CompNum).ComponentName); + // CheckDXCoolingCoilInOASysExists(state, oaEquip.ComponentName); break; } case CompType::DXHeatPumpSystem: { @@ -827,10 +725,10 @@ namespace OutdoorAirUnit { } case CompType::UnitarySystemModel: { UnitarySystems::UnitarySys thisSys; - thisOutAirUnit.OAEquip(CompNum).compPointer = thisSys.factory( - state, HVAC::UnitarySysType::Unitary_AnyCoilType, thisOutAirUnit.OAEquip(CompNum).ComponentName, false, OAUnitNum); + oaEquip.compPointer = thisSys.factory( + state, HVAC::UnitarySysType::Unitary_AnyCoilType, oaEquip.ComponentName, false, OAUnitNum); UnitarySystems::UnitarySys::checkUnitarySysCoilInOASysExists( - state, thisOutAirUnit.OAEquip(CompNum).ComponentName, OAUnitNum); + state, oaEquip.ComponentName, OAUnitNum); // Heat recovery break; @@ -850,11 +748,7 @@ namespace OutdoorAirUnit { break; } default: { - ShowSevereError(state, - format("{}= \"{}\" invalid Outside Air Component=\"{}\".", - CurrentModuleObject, - AlphArray(1), - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(CompNum).Type)])); + ShowSevereInvalidKey(state, eoh, cAlphaFields(InListNum * 2), state.dataIPShortCut->cAlphaArgs(InListNum * 2)); ErrorsFound = true; } } @@ -866,24 +760,24 @@ namespace OutdoorAirUnit { SetUpCompSets(state, "ZoneHVAC:OutdoorAirUnit", thisOutAirUnit.Name, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(InListNum).Type)], - thisOutAirUnit.OAEquip(InListNum).ComponentName, + CompTypeNames[(int)oaEquip.Type], + oaEquip.ComponentName, state.dataIPShortCut->cAlphaArgs(15), "UNDEFINED"); } else if (InListNum != NumInList) { // the component is placed in b/w components SetUpCompSets(state, "ZoneHVAC:OutdoorAirUnit", thisOutAirUnit.Name, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(InListNum).Type)], - thisOutAirUnit.OAEquip(InListNum).ComponentName, + CompTypeNames[(int)oaEquip.Type], + oaEquip.ComponentName, "UNDEFINED", "UNDEFINED"); } else { // (InListNum == NumInList) => the component is the last one SetUpCompSets(state, "ZoneHVAC:OutdoorAirUnit", thisOutAirUnit.Name, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(InListNum).Type)], - thisOutAirUnit.OAEquip(InListNum).ComponentName, + CompTypeNames[(int)oaEquip.Type], + oaEquip.ComponentName, "UNDEFINED", state.dataIPShortCut->cAlphaArgs(13)); } @@ -893,32 +787,31 @@ namespace OutdoorAirUnit { SetUpCompSets(state, "ZoneHVAC:OutdoorAirUnit", thisOutAirUnit.Name, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(InListNum).Type)], - thisOutAirUnit.OAEquip(InListNum).ComponentName, + CompTypeNames[(int)oaEquip.Type], + oaEquip.ComponentName, state.dataIPShortCut->cAlphaArgs(12), "UNDEFINED"); } else if (InListNum != NumInList) { SetUpCompSets(state, "ZoneHVAC:OutdoorAirUnit", thisOutAirUnit.Name, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(InListNum).Type)], - thisOutAirUnit.OAEquip(InListNum).ComponentName, + CompTypeNames[(int)oaEquip.Type], + oaEquip.ComponentName, "UNDEFINED", "UNDEFINED"); } else { // (InListNum == NumInList) => the component is the last one SetUpCompSets(state, "ZoneHVAC:OutdoorAirUnit", thisOutAirUnit.Name, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(InListNum).Type)], - thisOutAirUnit.OAEquip(InListNum).ComponentName, + CompTypeNames[(int)oaEquip.Type], + oaEquip.ComponentName, "UNDEFINED", "UNDEFINED"); } } // Must call after SetUpCompSets since this will add another CoilSystem:Cooling:DX object in CompSets - if (CompTypeNamesUC[static_cast(thisOutAirUnit.OAEquip(InListNum).Type)] == "COILSYSTEM:COOLING:DX") { - UnitarySystems::UnitarySys::checkUnitarySysCoilInOASysExists( - state, thisOutAirUnit.OAEquip(CompNum).ComponentName, OAUnitNum); + if (CompTypeNamesUC[(int)oaEquip.Type] == "COILSYSTEM:COOLING:DX") { // Why not compare the types? + UnitarySystems::UnitarySys::checkUnitarySysCoilInOASysExists(state, oaEquip.ComponentName, OAUnitNum); } } // End Inlist @@ -1114,7 +1007,6 @@ namespace OutdoorAirUnit { // Using/Aliasing using DataZoneEquipment::CheckZoneEquipmentList; - using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; using ScheduleManager::GetCurrentScheduleValue; @@ -1239,68 +1131,55 @@ namespace OutdoorAirUnit { if (!state.dataOutdoorAirUnit->MyPlantScanFlag(OAUnitNum)) { bool errFlag = false; for (int compLoop = 1; compLoop <= thisOutAirUnit.NumComponents; ++compLoop) { - if ((thisOutAirUnit.OAEquip(compLoop).Type == CompType::WaterCoil_Cooling) || - (thisOutAirUnit.OAEquip(compLoop).Type == CompType::WaterCoil_DetailedCool)) { - thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(compLoop).Type)], - thisOutAirUnit.OAEquip(compLoop).ComponentName, - errFlag); - Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + auto &oaEquip = thisOutAirUnit.OAEquip(compLoop); + if (oaEquip.Type == CompType::WaterCoil_Cooling || + oaEquip.Type == CompType::WaterCoil_DetailedCool) { + oaEquip.MaxVolWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, oaEquip.ComponentIndex); + Real64 const rho = state.dataPlnt->PlantLoop(oaEquip.plantLoc.loopNum) .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; + oaEquip.MaxWaterMassFlow = rho * oaEquip.MaxVolWaterFlow; + oaEquip.MinWaterMassFlow = rho * oaEquip.MinVolWaterFlow; InitComponentNodes(state, - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).CoilWaterInletNode, - thisOutAirUnit.OAEquip(compLoop).CoilWaterOutletNode); - } - - if (thisOutAirUnit.OAEquip(compLoop).Type == CompType::WaterCoil_SimpleHeat) { - thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(compLoop).Type)], - thisOutAirUnit.OAEquip(compLoop).ComponentName, - errFlag); - Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + oaEquip.MinWaterMassFlow, + oaEquip.MaxWaterMassFlow, + oaEquip.CoilWaterInletNode, + oaEquip.CoilWaterOutletNode); + + } else if (oaEquip.Type == CompType::WaterCoil_SimpleHeat) { + oaEquip.MaxVolWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, oaEquip.ComponentIndex); + Real64 const rho = state.dataPlnt->PlantLoop(oaEquip.plantLoc.loopNum) .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; + oaEquip.MaxWaterMassFlow = rho * oaEquip.MaxVolWaterFlow; + oaEquip.MinWaterMassFlow = rho * oaEquip.MinVolWaterFlow; InitComponentNodes(state, - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).CoilWaterInletNode, - thisOutAirUnit.OAEquip(compLoop).CoilWaterOutletNode); - } - if (thisOutAirUnit.OAEquip(compLoop).Type == CompType::SteamCoil_AirHeat) { - thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow = - GetCoilMaxSteamFlowRate(state, thisOutAirUnit.OAEquip(compLoop).ComponentIndex, errFlag); - Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + oaEquip.MinWaterMassFlow, + oaEquip.MaxWaterMassFlow, + oaEquip.CoilWaterInletNode, + oaEquip.CoilWaterOutletNode); + + } else if (oaEquip.Type == CompType::SteamCoil_AirHeat) { + oaEquip.MaxVolWaterFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, oaEquip.ComponentIndex); + Real64 const rho = state.dataPlnt->PlantLoop(oaEquip.plantLoc.loopNum) .steam->getSatDensity(state, Constant::SteamInitConvTemp, 1.0, RoutineName); - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; + oaEquip.MaxWaterMassFlow = rho * oaEquip.MaxVolWaterFlow; + oaEquip.MinWaterMassFlow = rho * oaEquip.MinVolWaterFlow; InitComponentNodes(state, - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).CoilWaterInletNode, - thisOutAirUnit.OAEquip(compLoop).CoilWaterOutletNode); - } - if (thisOutAirUnit.OAEquip(compLoop).Type == CompType::WaterCoil_CoolingHXAsst) { - thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, - CompTypeNames[static_cast(thisOutAirUnit.OAEquip(compLoop).Type)], - thisOutAirUnit.OAEquip(compLoop).ComponentName, - errFlag); - Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + oaEquip.MinWaterMassFlow, + oaEquip.MaxWaterMassFlow, + oaEquip.CoilWaterInletNode, + oaEquip.CoilWaterOutletNode); + + } else if (oaEquip.Type == CompType::WaterCoil_CoolingHXAsst) { + oaEquip.MaxVolWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, oaEquip.ComponentIndex); + Real64 const rho = state.dataPlnt->PlantLoop(oaEquip.plantLoc.loopNum) .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; + oaEquip.MaxWaterMassFlow = rho * oaEquip.MaxVolWaterFlow; + oaEquip.MinWaterMassFlow = rho * oaEquip.MinVolWaterFlow; InitComponentNodes(state, - thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow, - thisOutAirUnit.OAEquip(compLoop).CoilWaterInletNode, - thisOutAirUnit.OAEquip(compLoop).CoilWaterOutletNode); + oaEquip.MinWaterMassFlow, + oaEquip.MaxWaterMassFlow, + oaEquip.CoilWaterInletNode, + oaEquip.CoilWaterOutletNode); } } } @@ -1398,7 +1277,6 @@ namespace OutdoorAirUnit { // Using/Aliasing using namespace DataSizing; - using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; using PlantUtilities::MyPlantSizingIndex; using SteamCoils::SimulateSteamCoilComponents; using WaterCoils::SimulateWaterCoilComponents; @@ -1537,7 +1415,7 @@ namespace OutdoorAirUnit { } if (thisOAEquip.Type == CompType::WaterCoil_CoolingHXAsst) { if (thisOAEquip.MaxVolWaterFlow == AutoSize) { - SimHXAssistedCoolingCoil( + HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( state, thisOAEquip.ComponentName, true, HVAC::CompressorOp::On, 0.0, thisOAEquip.ComponentIndex, HVAC::FanOp::Continuous); } } @@ -1897,7 +1775,6 @@ namespace OutdoorAirUnit { using HeatRecovery::SimHeatRecovery; using HVAC::SmallLoad; using HVACDXHeatPumpSystem::SimDXHeatPumpSystem; - using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; using ScheduleManager::GetCurrentScheduleValue; using WaterCoils::SimulateWaterCoilComponents; @@ -2098,6 +1975,7 @@ namespace OutdoorAirUnit { thisOAEquip.plantLoc); } } break; + case CompType::WaterCoil_CoolingHXAsst: { // 'CoilSystem:Cooling:Water:HeatExchangerAssisted' if (Sim) { int const ControlNode = thisOAEquip.CoilWaterInletNode; @@ -2244,7 +2122,6 @@ namespace OutdoorAirUnit { // Using/Aliasing using HVAC::SmallLoad; - using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; using SteamCoils::SimulateSteamCoilComponents; using WaterCoils::SimulateWaterCoilComponents; @@ -2319,8 +2196,9 @@ namespace OutdoorAirUnit { LoadMet = AirMassFlow * (PsyHFnTdbW(oaOutletNode.Temp, oaInletNode.HumRat) - PsyHFnTdbW(oaInletNode.Temp, oaInletNode.HumRat)); } break; + case CompType::WaterCoil_CoolingHXAsst: { - SimHXAssistedCoolingCoil( + HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( state, thisOAEquip.ComponentName, FirstHVACIteration, HVAC::CompressorOp::On, 0.0, CoilIndex, HVAC::FanOp::Continuous); Real64 const AirMassFlow = oaInletNode.MassFlowRate; LoadMet = AirMassFlow * (PsyHFnTdbW(oaOutletNode.Temp, oaInletNode.HumRat) - PsyHFnTdbW(oaInletNode.Temp, oaInletNode.HumRat)); diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index cb1f8501b2a..ee64247dc93 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -4367,31 +4367,31 @@ void CalcHeatEmissionReport(EnergyPlusData &state) // DX Coils air to air for (int iCoil = 1; iCoil <= state.dataDXCoils->NumDXCoils; ++iCoil) { - auto const &thisDXCoil = state.dataDXCoils->DXCoil(iCoil); + auto const &dxCoil = state.dataDXCoils->DXCoil(iCoil); - if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed || - thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - if (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Air) { - state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisDXCoil.ElecCoolingConsumption + thisDXCoil.DefrostConsumption + - thisDXCoil.CrankcaseHeaterConsumption + thisDXCoil.TotalCoolingEnergy; - } else if (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap) { - state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisDXCoil.EvapCondPumpElecConsumption + thisDXCoil.BasinHeaterConsumption + - thisDXCoil.EvapWaterConsump * RhoWater * H2OHtOfVap_HVAC; + if (dxCoil.coilType == HVAC::CoilType::DXCoolingSingleSpeed || dxCoil.coilType == HVAC::CoilType::DXCoolingTwoSpeed || + dxCoil.coilType == HVAC::CoilType::DXMultiSpeedCooling || dxCoil.coilType == HVAC::CoilType::DXCoolingTwoStageWHumControl) { + if (dxCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Air) { + state.dataHeatBal->SysTotalHVACRejectHeatLoss += dxCoil.ElecCoolingConsumption + dxCoil.DefrostConsumption + + dxCoil.CrankcaseHeaterConsumption + dxCoil.TotalCoolingEnergy; + } else if (dxCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Evap) { + state.dataHeatBal->SysTotalHVACRejectHeatLoss += dxCoil.EvapCondPumpElecConsumption + dxCoil.BasinHeaterConsumption + + dxCoil.EvapWaterConsump * RhoWater * H2OHtOfVap_HVAC; } - if (thisDXCoil.FuelType != Constant::eFuel::Electricity) { - state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisDXCoil.MSFuelWasteHeat * TimeStepSysSec; + if (dxCoil.FuelType != Constant::eFuel::Electricity) { + state.dataHeatBal->SysTotalHVACRejectHeatLoss += dxCoil.MSFuelWasteHeat * TimeStepSysSec; } - } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { - state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisDXCoil.ElecHeatingConsumption + thisDXCoil.DefrostConsumption + - thisDXCoil.FuelConsumed + thisDXCoil.CrankcaseHeaterConsumption - - thisDXCoil.TotalHeatingEnergy; + } else if (dxCoil.coilType == HVAC::CoilType::DXHeatingEmpirical || dxCoil.coilType == HVAC::CoilType::DXMultiSpeedHeating) { + state.dataHeatBal->SysTotalHVACRejectHeatLoss += dxCoil.ElecHeatingConsumption + dxCoil.DefrostConsumption + + dxCoil.FuelConsumed + dxCoil.CrankcaseHeaterConsumption - + dxCoil.TotalHeatingEnergy; } } // VAV coils - air to air for (int iCoil = 1; iCoil <= state.dataVariableSpeedCoils->NumVarSpeedCoils; ++iCoil) { auto const &thisCoil = state.dataVariableSpeedCoils->VarSpeedCoil(iCoil); - if (thisCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (thisCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { if (thisCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisCoil.Energy + thisCoil.CrankcaseHeaterConsumption + thisCoil.DefrostConsumption + thisCoil.EnergyLoadTotal; @@ -4399,7 +4399,7 @@ void CalcHeatEmissionReport(EnergyPlusData &state) state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisCoil.EvapCondPumpElecConsumption + thisCoil.BasinHeaterConsumption + thisCoil.EvapWaterConsump * RhoWater * H2OHtOfVap_HVAC; } - } else if (thisCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + } else if (thisCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisCoil.Energy + thisCoil.CrankcaseHeaterConsumption + thisCoil.DefrostConsumption - thisCoil.EnergyLoadTotal; } @@ -4409,7 +4409,7 @@ void CalcHeatEmissionReport(EnergyPlusData &state) for (int iCoil = 1; iCoil <= state.dataHeatingCoils->NumHeatingCoils; ++iCoil) { auto const &thisCoil = state.dataHeatingCoils->HeatingCoil(iCoil); - if (thisCoil.HCoilType_Num == HVAC::Coil_HeatingGas_MultiStage || thisCoil.HCoilType_Num == HVAC::Coil_HeatingGasOrOtherFuel) { + if (thisCoil.coilType == HVAC::CoilType::HeatingGasMultiStage || thisCoil.coilType == HVAC::CoilType::HeatingGasOrOtherFuel) { state.dataHeatBal->SysTotalHVACRejectHeatLoss += thisCoil.FuelUseLoad + thisCoil.ParasiticFuelConsumption - thisCoil.HeatingCoilLoad; } } diff --git a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc index af6ce681245..50fbdb79bc4 100644 --- a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc +++ b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc @@ -350,26 +350,26 @@ namespace Material { auto *mat = s_mat->materials(matNum); if (mat->group != Group::Regular) { - ShowSevereCustomMessage(state, eoh, format("Material {} is not a Regular material.", mat->Name)); + ShowSevereCustom(state, eoh, format("Material {} is not a Regular material.", mat->Name)); ErrorsFound = true; continue; } if (mat->hasPCM) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Material {} already has {} properties defined.", mat->Name, s_ipsc->cCurrentModuleObject)); ErrorsFound = true; continue; } if (mat->hasEMPD) { - ShowSevereCustomMessage(state, eoh, format("Material {} already has EMPD properties defined.", mat->Name)); + ShowSevereCustom(state, eoh, format("Material {} already has EMPD properties defined.", mat->Name)); ErrorsFound = true; continue; } if (mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("Material {} already has HAMT properties defined.", mat->Name)); + ShowSevereCustom(state, eoh, format("Material {} already has HAMT properties defined.", mat->Name)); ErrorsFound = true; continue; } diff --git a/src/EnergyPlus/ReportCoilSelection.cc b/src/EnergyPlus/ReportCoilSelection.cc index edfb20e8f3b..becc0ff750f 100644 --- a/src/EnergyPlus/ReportCoilSelection.cc +++ b/src/EnergyPlus/ReportCoilSelection.cc @@ -136,7 +136,7 @@ void ReportCoilSelection::writeCoilSelectionOutput(EnergyPlusData &state) // make calls to fill out predefined tabular report entries for each coil selection report object for (auto &c : coilSelectionDataObjs) { - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilType, c->coilName_, c->coilObjName); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilType, c->coilName_, HVAC::coilTypeNames[(int)c->coilType]); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilLocation, c->coilName_, c->coilLocation); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACType, c->coilName_, c->typeHVACname); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACName, c->coilName_, c->userNameforHVACsystem); @@ -160,7 +160,7 @@ void ReportCoilSelection::writeCoilSelectionOutput(EnergyPlusData &state) // begin std 229 New coil connections table entries OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilName_CCs, c->coilName_, c->coilName_); - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilType_CCs, c->coilName_, c->coilObjName); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilType_CCs, c->coilName_, HVAC::coilTypeNames[(int)c->coilType]); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilLoc_CCs, c->coilName_, c->coilLocation); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACType_CCs, c->coilName_, c->typeHVACname); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACName_CCs, c->coilName_, c->userNameforHVACsystem); @@ -434,7 +434,7 @@ void ReportCoilSelection::writeCoilSelectionOutput2(EnergyPlusData &state) // make calls to fill out predefined tabular report entries for each coil selection report object for (auto &c : coilSelectionDataObjs) { - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilType, c->coilName_, c->coilObjName); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilType, c->coilName_, HVAC::coilTypeNames[(int)c->coilType]); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilHVACType, c->coilName_, c->typeHVACname); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilHVACName, c->coilName_, c->userNameforHVACsystem); @@ -525,14 +525,14 @@ void ReportCoilSelection::writeCoilSelectionOutput2(EnergyPlusData &state) void ReportCoilSelection::setCoilFinalSizes(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilObjName, // coil object name, e.g., Coil:Cooling:Water + HVAC::CoilType const coilType, // coil object name, e.g., Coil:Cooling:Water Real64 const totGrossCap, // total capacity [W] Real64 const sensGrossCap, // sensible capacity [W] Real64 const airFlowRate, // design or reference or rated air flow rate [m3/s] Real64 const waterFlowRate // design or reference or rated water flow rate [m3/s] ) { - int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilObjName); + int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType); auto &c(coilSelectionDataObjs[index]); if (c != nullptr) { c->coilTotCapFinal = totGrossCap; @@ -621,7 +621,7 @@ void ReportCoilSelection::doZoneEqSetup(EnergyPlusData &state, int const coilVec // fill out supply fan info auto *fan = state.dataFans->fans(state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).supFanNum); state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( - state, c->coilName_, c->coilObjName, fan->Name, fan->type, state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).supFanNum); + state, c->coilName_, c->coilType, fan->Name, fan->type, state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).supFanNum); } if (c->zoneEqNum > 0) { @@ -831,48 +831,34 @@ void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state) int ReportCoilSelection::getIndexForOrCreateDataObjFromCoilName(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType // idf input object class name of coil + HVAC::CoilType coilType // idf input object class name of coil ) { int index(-1); for (int i = 0; i < numCoilsReported_; i++) { if (coilSelectionDataObjs[i] != nullptr) { if (Util::SameString(coilSelectionDataObjs[i]->coilName_, coilName)) { - if (Util::SameString(coilSelectionDataObjs[i]->coilObjName, coilType)) { + if (coilSelectionDataObjs[i]->coilType == coilType) { return index = i; } else { // throw error coil type does not match coil name, check for unique names across coil types ShowWarningError(state, format("check for unique coil names across different coil types: {} occurs in both {} and {}", coilName, - coilType, - coilSelectionDataObjs[i]->coilObjName)); + HVAC::coilTypeNames[(int)coilType], + HVAC::coilTypeNames[(int)coilSelectionDataObjs[i]->coilType])); } } } } if (index == -1) { // then did not find it - // check if really a coil type - bool found(false); - bool locIsCooling(false); - bool locIsHeating(false); - for (int loop = 1; loop <= HVAC::NumAllCoilTypes; ++loop) { - if (Util::SameString(coilType, HVAC::cAllCoilTypes(loop))) { - found = true; - locIsCooling = Util::SameString(coilType, HVAC::cCoolingCoilTypes(loop)); - locIsHeating = Util::SameString(coilType, HVAC::cHeatingCoilTypes(loop)); - break; - } - } - if (found) { - coilSelectionDataObjs.emplace_back(new CoilSelectionData(coilName)); - index = coilSelectionDataObjs.size() - 1; - coilSelectionDataObjs[index]->coilObjName = coilType; - ++numCoilsReported_; - coilSelectionDataObjs[index]->isCooling = locIsCooling; - coilSelectionDataObjs[index]->isHeating = locIsHeating; - } + coilSelectionDataObjs.emplace_back(new CoilSelectionData(coilName)); + index = coilSelectionDataObjs.size() - 1; + coilSelectionDataObjs[index]->coilType = coilType; + ++numCoilsReported_; + coilSelectionDataObjs[index]->isCooling = HVAC::coilTypeIsCooling[(int)coilType]; + coilSelectionDataObjs[index]->isHeating = HVAC::coilTypeIsHeating[(int)coilType]; } if (index == -1) { @@ -970,7 +956,7 @@ void ReportCoilSelection::associateZoneCoilWithParent(EnergyPlusData &state, std void ReportCoilSelection::setRatedCoilConditions(EnergyPlusData &state, std::string const &coilName, // ! user-defined name of the coil - std::string const &coilObjName, // coil object name, e.g., Coil:Cooling:Water + HVAC::CoilType const coilType, // coil object name, e.g., Coil:Cooling:Water Real64 const RatedCoilTotCap, // ! rated coil total capacity [W] Real64 const RatedCoilSensCap, // rated coil sensible capacity [W] Real64 const RatedAirMassFlow, // rated coil design air mass flow rate [m3/s] @@ -986,7 +972,7 @@ void ReportCoilSelection::setRatedCoilConditions(EnergyPlusData &state, Real64 const RatedCoilEff // rated coil effectiveness ) { - int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilObjName); + int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType); auto &c(coilSelectionDataObjs[index]); c->coilRatedTotCap = RatedCoilTotCap; c->coilRatedSensCap = RatedCoilSensCap; @@ -1018,7 +1004,7 @@ void ReportCoilSelection::setRatedCoilConditions(EnergyPlusData &state, void ReportCoilSelection::setCoilAirFlow(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const airVdot, // air flow rate in m3/s bool const isAutoSized // true if air flow was autosized ) @@ -1033,7 +1019,7 @@ void ReportCoilSelection::setCoilAirFlow(EnergyPlusData &state, void ReportCoilSelection::setCoilWaterFlowNodeNums(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const waterVdot, // plant fluid flow rate in m3/s bool const isAutoSized, // true if water flow was autosized int const inletNodeNum, // coil chw inlet node num @@ -1052,7 +1038,7 @@ void ReportCoilSelection::setCoilWaterFlowNodeNums(EnergyPlusData &state, void ReportCoilSelection::setCoilWaterFlowPltSizNum(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const waterVdot, // plant fluid flow rate in m3/s bool const isAutoSized, // true if water flow was autosized int const plantSizNum, // plant sizing structure index @@ -1092,7 +1078,7 @@ void ReportCoilSelection::setCoilWaterFlowPltSizNum(EnergyPlusData &state, void ReportCoilSelection::setCoilEntAirTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const entAirDryBulbTemp, // degree C air entering coil int const curSysNum, // airloop system number index, if non zero int const curZoneEqNum // zone equipment list index, if non-zero @@ -1108,7 +1094,7 @@ void ReportCoilSelection::setCoilEntAirTemp(EnergyPlusData &state, void ReportCoilSelection::setCoilEntAirHumRat(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const entAirHumrat // ) { @@ -1119,7 +1105,7 @@ void ReportCoilSelection::setCoilEntAirHumRat(EnergyPlusData &state, void ReportCoilSelection::setCoilEntWaterTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const entWaterTemp // ) { @@ -1130,7 +1116,7 @@ void ReportCoilSelection::setCoilEntWaterTemp(EnergyPlusData &state, void ReportCoilSelection::setCoilLvgWaterTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const lvgWaterTemp // ) { @@ -1141,7 +1127,7 @@ void ReportCoilSelection::setCoilLvgWaterTemp(EnergyPlusData &state, void ReportCoilSelection::setCoilWaterDeltaT(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const CoilWaterDeltaT // degree C temperature difference used to size coil ) { @@ -1152,7 +1138,7 @@ void ReportCoilSelection::setCoilWaterDeltaT(EnergyPlusData &state, void ReportCoilSelection::setCoilLvgAirTemp(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const lvgAirDryBulbTemp // ) { @@ -1163,7 +1149,7 @@ void ReportCoilSelection::setCoilLvgAirTemp(EnergyPlusData &state, void ReportCoilSelection::setCoilLvgAirHumRat(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const lvgAirHumRat // ) { @@ -1183,7 +1169,7 @@ std::string PeakHrMinString(EnergyPlusData &state, const int designDay, const in void ReportCoilSelection::setCoilCoolingCapacity( EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const TotalCoolingCap, // {W} coil cooling capacity, sizing result bool const isAutoSize, // true if value was autosized int const curSysNum, // airloop system number index, if non zero @@ -1481,7 +1467,7 @@ void ReportCoilSelection::setCoilCoolingCapacity( void ReportCoilSelection::setCoilHeatingCapacity( EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const totalHeatingCap, // {W} coil Heating capacity bool const isAutoSize, // true if value was autosized int const curSysNum, // airloop system number index, if non zero @@ -1840,7 +1826,7 @@ void ReportCoilSelection::setCoilHeatingCapacity( void ReportCoilSelection::setCoilWaterCoolingCapacity(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const totalCoolingCap, // {W} coil cooling capacity bool const isAutoSize, // true if value was autosized int const inletNodeNum, // coil chw inlet node num @@ -1863,7 +1849,7 @@ void ReportCoilSelection::setCoilWaterCoolingCapacity(EnergyPlusData &state, void ReportCoilSelection::setCoilWaterHeaterCapacityNodeNums(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const totalHeatingCap, // {W} coil Heating capacity bool const isAutoSize, // true if value was autosized int const inletNodeNum, // coil chw inlet node num @@ -1886,7 +1872,7 @@ void ReportCoilSelection::setCoilWaterHeaterCapacityNodeNums(EnergyPlusData &sta void ReportCoilSelection::setCoilWaterHeaterCapacityPltSizNum(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const totalHeatingCap, // {W} coil Heating capacity bool const isAutoSize, // true if value was autosized int const dataPltSizNum, // plant sizing structure index @@ -1903,7 +1889,7 @@ void ReportCoilSelection::setCoilWaterHeaterCapacityPltSizNum(EnergyPlusData &st void ReportCoilSelection::setCoilUA(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const UAvalue, // [W/k] UA value for coil, Real64 const dataCapacityUsedForSizing, // [W] sizing global bool const isAutoSize, // true if value was autosized @@ -1923,7 +1909,7 @@ void ReportCoilSelection::setCoilUA(EnergyPlusData &state, void ReportCoilSelection::setCoilReheatMultiplier(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil Real64 const multiplierReheatLoad) { int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType); @@ -1933,7 +1919,7 @@ void ReportCoilSelection::setCoilReheatMultiplier(EnergyPlusData &state, void ReportCoilSelection::setCoilSupplyFanInfo(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType, // idf input object class name of coil + HVAC::CoilType const coilType, // idf input object class name of coil std::string const &fanName, HVAC::FanType fanType, int fanIndex) @@ -1951,7 +1937,7 @@ void ReportCoilSelection::setCoilSupplyFanInfo(EnergyPlusData &state, void ReportCoilSelection::setCoilEqNum(EnergyPlusData &state, std::string const &coilName, - std::string const &coilType, + HVAC::CoilType const coilType, int const curSysNum, int const curOASysNum, int const curZoneEqNum) @@ -1997,34 +1983,13 @@ std::string ReportCoilSelection::getTimeText(EnergyPlusData &state, int const ti bool ReportCoilSelection::isCompTypeFan(std::string const &compType // string component type, input object class name ) { - // if compType name is one of the fan objects, then return true - if (Util::SameString(compType, "Fan:SystemModel")) { - return true; - } else if (Util::SameString(compType, "Fan:ComponentModel")) { - return true; - } else if (Util::SameString(compType, "Fan:OnOff")) { - return true; - } else if (Util::SameString(compType, "Fan:ConstantVolume")) { - return true; - } else if (Util::SameString(compType, "Fan:VariableVolume")) { - return true; - } else { - return false; - } + return getEnumValue(HVAC::fanTypeNamesUC, Util::makeUPPER(compType)) != -1; } bool ReportCoilSelection::isCompTypeCoil(std::string const &compType // string component type, input object class name ) { - // if compType name is one of the coil objects, then return true - bool found(false); - for (int loop = 1; loop <= HVAC::NumAllCoilTypes; ++loop) { - if (Util::SameString(compType, HVAC::cAllCoilTypes(loop))) { - found = true; - break; - } - } - return found; + return getEnumValue(HVAC::coilTypeNamesUC, Util::makeUPPER(compType)) != -1; } void ReportCoilSelection::setZoneLatentLoadCoolingIdealPeak(int const zoneIndex, Real64 const zoneCoolingLatentLoad) diff --git a/src/EnergyPlus/ReportCoilSelection.hh b/src/EnergyPlus/ReportCoilSelection.hh index deef120eaa0..2c9d42928d8 100644 --- a/src/EnergyPlus/ReportCoilSelection.hh +++ b/src/EnergyPlus/ReportCoilSelection.hh @@ -74,7 +74,7 @@ public: // methods public: // data std::string coilName_; // user-defined coil name - std::string coilObjName; // coil object name, e.g., Coil:Cooling:Water, Coil:Heating:DX:SingleSpeed, etc. + HVAC::CoilType coilType = HVAC::CoilType::Invalid; bool isCooling; // true if this coil is for cooling bool isHeating; // true if this coil is for heating std::string coilLocation; // where is the coil located?, AirLoop or Zone @@ -232,7 +232,7 @@ public: // methods void setCoilFinalSizes(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - HVAC::CoilType coilType, // coil type, e.g., Coil:Cooling:Water + HVAC::CoilType const coilType, // coil type, e.g., Coil:Cooling:Water Real64 const totGrossCap, // total capacity [W] Real64 const sensGrossCap, // sensible capacity [W] Real64 const airFlowRate, // design or reference or rated air flow rate [m3/s] @@ -241,7 +241,7 @@ public: // methods void setRatedCoilConditions(EnergyPlusData &state, std::string const &coilName, // ! user-defined name of the coil - HVAC::CoilType coilObjName, // coil object name, e.g., Coil:Cooling:Water + HVAC::CoilType const coilType, // coil object name, e.g., Coil:Cooling:Water Real64 const RatedCoilTotCap, // ! rated coil total capacity [W] Real64 const RatedCoilSensCap, // rated coil sensible capacity [W] Real64 const RatedAirMassFlow, // rated coil design air mass flow rate [m3/s] @@ -438,7 +438,7 @@ private: // methods int getIndexForOrCreateDataObjFromCoilName(EnergyPlusData &state, std::string const &coilName, // user-defined name of the coil - std::string const &coilType // idf input object class name of coil + HVAC::CoilType const coilType // idf input object class name of coil ); void associateZoneCoilWithParent(EnergyPlusData &state, std::unique_ptr &c); diff --git a/src/EnergyPlus/SZVAVModel.cc b/src/EnergyPlus/SZVAVModel.cc index d505f130f45..8734d7595df 100644 --- a/src/EnergyPlus/SZVAVModel.cc +++ b/src/EnergyPlus/SZVAVModel.cc @@ -127,10 +127,10 @@ namespace SZVAVModel { maxAirMassFlow = SZVAVModel.MaxCoolAirMassFlow; lowSpeedFanRatio = SZVAVModel.LowSpeedCoolFanRatio; coilFluidInletNode = SZVAVModel.CoolCoilFluidInletNode; - coilFluidOutletNode = SZVAVModel.CoolCoilFluidOutletNodeNum; + coilFluidOutletNode = SZVAVModel.CoolCoilFluidOutletNode; coilPlantLoc = SZVAVModel.CoolCoilPlantLoc; - coilAirInletNode = SZVAVModel.CoolCoilInletNodeNum; - coilAirOutletNode = SZVAVModel.CoolCoilOutletNodeNum; + coilAirInletNode = SZVAVModel.CoolCoilAirInletNode; + coilAirOutletNode = SZVAVModel.CoolCoilAirOutletNode; } else if (HeatingLoad) { maxCoilFluidFlow = SZVAVModel.MaxHeatCoilFluidFlow; maxOutletTemp = SZVAVModel.DesignMaxOutletTemp; @@ -138,10 +138,10 @@ namespace SZVAVModel { maxAirMassFlow = SZVAVModel.MaxHeatAirMassFlow; lowSpeedFanRatio = SZVAVModel.LowSpeedHeatFanRatio; coilFluidInletNode = SZVAVModel.HeatCoilFluidInletNode; - coilFluidOutletNode = SZVAVModel.HeatCoilFluidOutletNodeNum; + coilFluidOutletNode = SZVAVModel.HeatCoilFluidOutletNode; coilPlantLoc = SZVAVModel.HeatCoilPlantLoc; - coilAirInletNode = SZVAVModel.HeatCoilInletNodeNum; - coilAirOutletNode = SZVAVModel.HeatCoilOutletNodeNum; + coilAirInletNode = SZVAVModel.HeatCoilAirInletNode; + coilAirOutletNode = SZVAVModel.HeatCoilAirOutletNode; } else { // should never get here, protect against uninitialized variables maxCoilFluidFlow = 0.0; maxOutletTemp = 0.0; @@ -302,7 +302,7 @@ namespace SZVAVModel { PlantUtilities::SetComponentFlowRate(state, maxCoilFluidFlow, coilFluidInletNode, coilFluidOutletNode, coilPlantLoc); if ((CoolingLoad && (TempSensOutput < ZoneLoad)) || (HeatingLoad && (TempSensOutput > ZoneLoad))) { - if (SZVAVModel.HCoilType_Num == FanCoilUnits::HCoil::Water || !HeatingLoad) { + if (SZVAVModel.heatCoilType == HVAC::CoilType::HeatingWater || !HeatingLoad) { auto f = [&state, SysIndex, FirstHVACIteration, &SZVAVModel, ZoneLoad, coilFluidInletNode, maxCoilFluidFlow, AirMassFlow]( Real64 const PLR) { return FanCoilUnits::CalcFanCoilWaterFlowResidual(state, @@ -334,7 +334,7 @@ namespace SZVAVModel { } else { // not enough capacity at this air flow rate. Unit does have enough capacity a full water/air, otherwise wouldn't be here // this is different from the PTUnit and UnitarySys routines in this module // find the water flow rate that meets the min load at region 1/2 boundary - if (SZVAVModel.HCoilType_Num == FanCoilUnits::HCoil::Water || !HeatingLoad) { + if (SZVAVModel.heatCoilType == HVAC::CoilType::HeatingWater || !HeatingLoad) { auto f = // (AUTO_OK_LAMBDA) [&state, SysIndex, FirstHVACIteration, &SZVAVModel, ZoneLoad, coilFluidInletNode, maxCoilFluidFlow, minAirMassFlow]( Real64 const PLR) { @@ -383,7 +383,7 @@ namespace SZVAVModel { } } } else { // too much capacity when coil off, could lower air flow rate here to meet load if air flow is above minimum - if (SZVAVModel.HCoilType_Num == FanCoilUnits::HCoil::Water || !HeatingLoad) { + if (SZVAVModel.heatCoilType == HVAC::CoilType::HeatingWater || !HeatingLoad) { auto f2 = [&state, SysIndex, FirstHVACIteration, &SZVAVModel, ZoneLoad, coilFluidInletNode](Real64 const PLR) { return FanCoilUnits::CalcFanCoilAirAndWaterFlowResidual(state, PLR, @@ -446,7 +446,7 @@ namespace SZVAVModel { FanCoilUnits::Calc4PipeFanCoil(state, SysIndex, SZVAVModel.ControlZoneNum, FirstHVACIteration, TempSensOutput, PartLoadRatio); if ((CoolingLoad && ZoneLoad < TempSensOutput) || (HeatingLoad && ZoneLoad > TempSensOutput)) { // otherwise iterate on load - if (SZVAVModel.HCoilType_Num == FanCoilUnits::HCoil::Water || !HeatingLoad) { + if (SZVAVModel.heatCoilType == HVAC::CoilType::HeatingWater || !HeatingLoad) { auto f = [&state, SysIndex, FirstHVACIteration, &SZVAVModel, ZoneLoad, coilFluidInletNode, maxCoilFluidFlow, maxAirMassFlow]( Real64 const PLR) { return FanCoilUnits::CalcFanCoilWaterFlowResidual(state, @@ -472,7 +472,7 @@ namespace SZVAVModel { MessagePrefix = "Step 3: "; } } else { // too much capacity at full air flow with coil off, operate coil and fan in unison - if (SZVAVModel.HCoilType_Num == FanCoilUnits::HCoil::Water || !HeatingLoad) { + if (SZVAVModel.heatCoilType == HVAC::CoilType::HeatingWater || !HeatingLoad) { auto f2 = [&state, SysIndex, FirstHVACIteration, &SZVAVModel, ZoneLoad, coilFluidInletNode](Real64 const PLR) { return FanCoilUnits::CalcFanCoilAirAndWaterFlowResidual(state, PLR, diff --git a/src/EnergyPlus/SetPointManager.cc b/src/EnergyPlus/SetPointManager.cc index 8a04e51133d..9ef1338ede1 100644 --- a/src/EnergyPlus/SetPointManager.cc +++ b/src/EnergyPlus/SetPointManager.cc @@ -1698,7 +1698,7 @@ void InitSetPointManagers(EnergyPlusData &state) } // still need to validate... if (spmSZH->ctrlZoneNum == 0) { // didn't find - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("could not find Controlled Zone={}", state.dataHeatBal->Zone(spmSZH->ctrlZoneNum).Name)); ErrorsFound = true; } else { diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index af22f28d3b0..f6e69d72d9e 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -3983,8 +3983,6 @@ void SizeAirLoopBranches(EnergyPlusData &state, int const AirLoopNum, int const // Using/Aliasing using namespace DataSizing; - using HVACHXAssistedCoolingCoil::GetHXCoilType; - using HVACHXAssistedCoolingCoil::GetHXDXCoilName; using WaterCoils::SetCoilDesFlow; std::string CompType; // Component type @@ -4059,8 +4057,8 @@ void SizeAirLoopBranches(EnergyPlusData &state, int const AirLoopNum, int const if (CompType_Num == CompType::WaterCoil_DetailedCool || CompType_Num == CompType::WaterCoil_SimpleHeat || CompType_Num == CompType::WaterCoil_CoolingHXAsst) { if (CompType_Num == CompType::WaterCoil_CoolingHXAsst) { - CoilName = GetHXDXCoilName(state, CompType, CompName, ErrorsFound); - CoilType = GetHXCoilType(state, CompType, CompName, ErrorsFound); + CoilName = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilName(state, CompType, CompName, ErrorsFound); + CoilType = HVAC::coilTypeNames[(int)HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilType(state, CompType, CompName, ErrorsFound)]; } else { CoilName = CompName; CoilType = CompType; @@ -7525,10 +7523,10 @@ bool CheckWaterCoilSystemOnAirLoopOrOASystem(EnergyPlusData &state, SimAirServin if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) { // check if the water coil is placed on 'CoilSystem:Cooling:Water:HeatExchangerAssisted' object for (int HXASSCoilNum = 1; HXASSCoilNum <= state.dataHVACAssistedCC->TotalNumHXAssistedCoils; ++HXASSCoilNum) { - std::string CompType = state.dataHVACAssistedCC->HXAssistedCoil(HXASSCoilNum).CoolingCoilType; + std::string_view CompType = HVAC::coilTypeNames[(int)state.dataHVACAssistedCC->HXAssistedCoils(HXASSCoilNum).coolCoilType]; if ((Util::SameString(CompType, "Coil:Cooling:Water") || Util::SameString(CompType, "Coil:Cooling:Water:DetailedGeometry")) && - Util::SameString(CompName, state.dataHVACAssistedCC->HXAssistedCoil(HXASSCoilNum).CoolingCoilName)) { - CoilSystemName = state.dataHVACAssistedCC->HXAssistedCoil(HXASSCoilNum).Name; + Util::SameString(CompName, state.dataHVACAssistedCC->HXAssistedCoils(HXASSCoilNum).CoolCoilName)) { + CoilSystemName = state.dataHVACAssistedCC->HXAssistedCoils(HXASSCoilNum).Name; CoilSystemTypeNum = SimAirServingZones::CompType::WaterCoil_CoolingHXAsst; WaterCoilIsOnWaterCoilSystem = true; break; diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index 0713d2ca029..33e27475e35 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -222,13 +222,6 @@ void GetSysInput(EnergyPlusData &state) // Using/Aliasing using NodeInputManager::GetOnlySingleNode; - using SteamCoils::GetCoilAirOutletNode; - using SteamCoils::GetCoilSteamInletNode; - using SteamCoils::GetSteamCoilIndex; - using WaterCoils::GetCoilOutletNode; - using WaterCoils::GetCoilWaterInletNode; - auto &GetHeatingCoilCapacity(HeatingCoils::GetCoilCapacity); - auto &GetHeatingCoilOutletNode(HeatingCoils::GetCoilOutletNode); using namespace DataHeatBalance; // SUBROUTINE PARAMETER DEFINITIONS: @@ -355,66 +348,62 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &sdAirTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + + sdAirTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctVAVReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(7); - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; - } else if (!state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp.empty()) { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(8), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.SysName = Alphas(1); + sdAirTerm.sysType = CurrentModuleObject; + sdAirTerm.SysType_Num = SysType::SingleDuctVAVReheat; + + sdAirTerm.reheatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(7))); + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(7), Alphas(7)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(8); + + sdAirTerm.ReheatCoilName = Alphas(8); ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, + HVAC::coilTypeNames[(int)sdAirTerm.reheatCoilType], + sdAirTerm.ReheatCoilName, IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + sdAirTerm.sysType); if (IsNotOK) { ShowContinueError(state, format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + sdAirTerm.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + sdAirTerm.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { + sdAirTerm.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (sdAirTerm.SchedPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } } + // For node connections, this object is both a parent and a non-parent, because the // VAV damper is not called out as a separate component, its nodes must be connected // as ObjectIsNotParent. But for the reheat coil, the nodes are connected as ObjectIsParent - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = + sdAirTerm.OutletNodeNum = GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -425,7 +414,7 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = + sdAirTerm.InletNodeNum = GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -436,116 +425,110 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); + sdAirTerm.MaxAirVolFlowRate = Numbers(1); if (Util::SameString(Alphas(5), "Constant")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Constant; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::Constant; } else if (Util::SameString(Alphas(5), "FixedFlowRate")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Fixed; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::Fixed; } else if (Util::SameString(Alphas(5), "Scheduled")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Scheduled; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::Scheduled; } else { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(5), Alphas(5))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); + sdAirTerm.ZoneMinAirFracDes = Numbers(2); if (lNumericBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = 0.0; + sdAirTerm.ConstantMinAirFracSetByUser = false; + sdAirTerm.DesignMinAirFrac = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Fixed) { + sdAirTerm.ConstantMinAirFracSetByUser = true; + sdAirTerm.DesignMinAirFrac = Numbers(2); + if (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Fixed) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + sdAirTerm.sysType, + sdAirTerm.SysName)); + sdAirTerm.ZoneMinAirFracDes = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = Numbers(3); + sdAirTerm.ZoneFixedMinAir = Numbers(3); if (lNumericBlanks(3)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = 0.0; + sdAirTerm.FixedMinAirSetByUser = false; + sdAirTerm.DesignMinAirFrac = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = Numbers(3); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Constant) { + sdAirTerm.FixedMinAirSetByUser = true; + sdAirTerm.DesignMinAirFrac = Numbers(3); + if (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Constant) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(3))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = 0.0; + sdAirTerm.sysType, + sdAirTerm.SysName)); + sdAirTerm.ZoneFixedMinAir = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr = GetScheduleIndex(state, Alphas(6)); - if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr == 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { + sdAirTerm.ZoneMinAirFracSchPtr = GetScheduleIndex(state, Alphas(6)); + if ((sdAirTerm.ZoneMinAirFracSchPtr == 0) && + (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(6), Alphas(6))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "A valid schedule is required"); ErrorsFound = true; - } else if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr > 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { + } else if ((sdAirTerm.ZoneMinAirFracSchPtr > 0) && + (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { // check range of values in schedule if (!CheckScheduleValueMinMax( - state, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr, ">=", 0.0, "<=", 1.0)) { + state, sdAirTerm.ZoneMinAirFracSchPtr, ">=", 0.0, "<=", 1.0)) { ShowSevereError(state, format("Error found in {} = {}", cAlphaFields(6), Alphas(6))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); } } // The reheat coil control node is necessary for hot water and steam reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num != HeatingCoilType::Gas && - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num != HeatingCoilType::Electric) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel && + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + sdAirTerm.ReheatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), sdAirTerm.ReheatCoilName); + ErrorsFound = true; + } + + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoilNum = SteamCoils::GetSteamCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), sdAirTerm.ReheatCoilName); + ErrorsFound = true; } else { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + sdAirTerm.ReheatControlNode = SteamCoils::GetCoilSteamInletNode(state, sdAirTerm.ReheatCoilNum); + } + + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + if (sdAirTerm.ReheatControlNode == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), sdAirTerm.ReheatCoilName); + ErrorsFound = true; + } else { + sdAirTerm.ReheatControlNode = WaterCoils::GetCoilWaterInletNode(state, sdAirTerm.ReheatCoilNum); } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = + + sdAirTerm.ReheatAirOutletNode = GetOnlySingleNode(state, Alphas(9), ErrorsFound, @@ -556,61 +539,62 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsParent, cAlphaFields(9)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(5); - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(5); + + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.MaxReheatSteamVolFlow = Numbers(4); + sdAirTerm.MinReheatSteamVolFlow = Numbers(5); + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.MaxReheatWaterVolFlow = Numbers(4); + sdAirTerm.MinReheatWaterVolFlow = Numbers(5); } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(6); + sdAirTerm.ControllerOffset = Numbers(6); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (sdAirTerm.ControllerOffset <= 0.0) { + sdAirTerm.ControllerOffset = 0.001; } if (Util::SameString(Alphas(10), "Reverse")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::Reverse; + sdAirTerm.DamperHeatingAction = Action::Reverse; } else if (Util::SameString(Alphas(10), "Normal")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::Normal; + sdAirTerm.DamperHeatingAction = Action::Normal; } else if (Util::SameString(Alphas(10), "ReverseWithLimits")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::ReverseWithLimits; + sdAirTerm.DamperHeatingAction = Action::ReverseWithLimits; } else { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(10), Alphas(10))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode), + sdAirTerm.sysType, + sdAirTerm.SysName, + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + sdAirTerm.InletNodeNum; + sdAirTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (sdAirTerm.ADUNum == 0) { ShowSevereError(state, format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError( state, format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -618,34 +602,34 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, format("{} already connects to another zone", state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + sdAirTerm.ReheatAirOutletNode))); ShowContinueError(state, format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; + sdAirTerm.InletNodeNum; state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + sdAirTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = + sdAirTerm.CtrlZoneNum = CtrlZone; + sdAirTerm.CtrlZoneInNodeIndex = SupAirIn; + sdAirTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } @@ -653,85 +637,85 @@ void GetSysInput(EnergyPlusData &state) } } if (Numbers(7) == Constant::AutoCalculate) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRateDuringReheat = Numbers(7); + sdAirTerm.MaxAirVolFlowRateDuringReheat = Numbers(7); } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRateDuringReheat = - Numbers(7) * state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea; + sdAirTerm.MaxAirVolFlowRateDuringReheat = + Numbers(7) * sdAirTerm.ZoneFloorArea; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFractionDuringReheat = Numbers(8); + sdAirTerm.MaxAirVolFractionDuringReheat = Numbers(8); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction != Action::ReverseWithLimits) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRateDuringReheat > 0.0) { + if (sdAirTerm.DamperHeatingAction != Action::ReverseWithLimits) { + if (sdAirTerm.MaxAirVolFlowRateDuringReheat > 0.0) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(10), Alphas(10), cNumericFields(7))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFractionDuringReheat > 0.0) { + if (sdAirTerm.MaxAirVolFractionDuringReheat > 0.0) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(10), Alphas(10), cNumericFields(8))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); } } // Maximum reheat air temperature, i.e. the maximum supply air temperature leaving the reheat coil if (!lNumericBlanks(9)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTemp = Numbers(9); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = true; + sdAirTerm.MaxReheatTemp = Numbers(9); + sdAirTerm.MaxReheatTempSetByUser = true; } else { // user does not specify maximum supply air temperature // sd_airterminal(SysNum)%MaxReheatTemp = 35.0D0 !C - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = false; + sdAirTerm.MaxReheatTempSetByUser = false; } if (!lAlphaBlanks(11)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr = + sdAirTerm.OARequirementsPtr = Util::FindItemInList(Alphas(11), state.dataSize->OARequirements); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr == 0) { + if (sdAirTerm.OARequirementsPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(11), Alphas(11))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = false; + sdAirTerm.NoOAFlowInputFromUser = false; } } if (lAlphaBlanks(12)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; + sdAirTerm.ZoneTurndownMinAirFrac = 1.0; + sdAirTerm.ZoneTurndownMinAirFracSchExist = false; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(12)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { + sdAirTerm.ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(12)); + if (sdAirTerm.ZoneTurndownMinAirFracSchPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(12), Alphas(12))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + sdAirTerm.ZoneTurndownMinAirFracSchExist = true; } - ValidateComponent(state, Alphas(7), Alphas(8), IsNotOK, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + ValidateComponent(state, Alphas(7), Alphas(8), IsNotOK, sdAirTerm.sysType); if (IsNotOK) { ShowContinueError(state, format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } // Add reheat coil to component sets array SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + sdAirTerm.sysType, + sdAirTerm.SysName, Alphas(7), Alphas(8), Alphas(3), @@ -741,17 +725,17 @@ void GetSysInput(EnergyPlusData &state) SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + sdAirTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + sdAirTerm.SysName); SetupOutputVariable(state, "Zone Air Terminal Minimum Air Flow Fraction", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracReport, + sdAirTerm.ZoneMinAirFracReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + sdAirTerm.SysName); } // end Number of Sys Loop @@ -773,66 +757,60 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &sdAirTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + sdAirTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctCBVAVReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(5); - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; - } else if (!state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp.empty()) { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(5), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.SysName = Alphas(1); + sdAirTerm.sysType = CurrentModuleObject; + sdAirTerm.SysType_Num = SysType::SingleDuctCBVAVReheat; + + sdAirTerm.reheatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(5))); + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(5), Alphas(5)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(6); + + sdAirTerm.ReheatCoilName = Alphas(6); ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, + HVAC::coilTypeNames[(int)sdAirTerm.reheatCoilType], + sdAirTerm.ReheatCoilName, IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + sdAirTerm.sysType); if (IsNotOK) { ShowContinueError(state, format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + sdAirTerm.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + sdAirTerm.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { + sdAirTerm.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (sdAirTerm.SchedPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } } // For node connections, this object is both a parent and a non-parent, because the // VAV damper is not called out as a separate component, its nodes must be connected // as ObjectIsNotParent. But for the reheat coil, the nodes are connected as ObjectIsParent - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = + sdAirTerm.OutletNodeNum = GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -843,7 +821,7 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = + sdAirTerm.InletNodeNum = GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -854,62 +832,55 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes < 0.0) { + sdAirTerm.MaxAirVolFlowRate = Numbers(1); + sdAirTerm.ZoneMinAirFracDes = Numbers(2); + if (sdAirTerm.ZoneMinAirFracDes < 0.0) { ShowWarningError(state, format("{} \"{}\"", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, format("{} must be greater than or equal to 0. Resetting to 0 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + sdAirTerm.ZoneMinAirFracDes = 0.0; } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes > 1.0) { + if (sdAirTerm.ZoneMinAirFracDes > 1.0) { ShowWarningError(state, format("{} \"{}\"", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, format("{} must be less than or equal to 1. Resetting to 1 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 1.0; + sdAirTerm.ZoneMinAirFracDes = 1.0; } // The reheat coil control node is necessary for hot water and steam reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Gas || - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Electric) { - } else { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + sdAirTerm.ReheatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; + } + + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoilNum = SteamCoils::GetSteamCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; } else { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + sdAirTerm.ReheatControlNode = SteamCoils::GetCoilSteamInletNode(state, sdAirTerm.ReheatCoilNum); + } + + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.ReheatCoilNum = WaterCoils::GetWaterCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; + } else { + sdAirTerm.ReheatControlNode = WaterCoils::GetCoilWaterInletNode(state, sdAirTerm.ReheatCoilNum); } - // END IF } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = + + sdAirTerm.ReheatAirOutletNode = GetOnlySingleNode(state, Alphas(7), ErrorsFound, @@ -920,49 +891,49 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsParent, cAlphaFields(7)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(3); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(4); - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(3); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(4); + + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.MaxReheatSteamVolFlow = Numbers(3); + sdAirTerm.MinReheatSteamVolFlow = Numbers(4); + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.MaxReheatWaterVolFlow = Numbers(3); + sdAirTerm.MinReheatWaterVolFlow = Numbers(4); } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(5); + sdAirTerm.ControllerOffset = Numbers(5); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (sdAirTerm.ControllerOffset <= 0.0) { + sdAirTerm.ControllerOffset = 0.001; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::Reverse; + sdAirTerm.DamperHeatingAction = Action::Reverse; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode), + sdAirTerm.sysType, + sdAirTerm.SysName, + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = sdAirTerm.InletNodeNum; + sdAirTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (sdAirTerm.ADUNum == 0) { ShowSevereError(state, format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError( state, format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -970,33 +941,33 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, format("{} already connects to another zone", state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + sdAirTerm.ReheatAirOutletNode))); ShowContinueError(state, format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; + sdAirTerm.InletNodeNum; state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + sdAirTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = + sdAirTerm.CtrlZoneNum = CtrlZone; + sdAirTerm.CtrlZoneInNodeIndex = SupAirIn; + sdAirTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } @@ -1004,43 +975,43 @@ void GetSysInput(EnergyPlusData &state) } } if (!lNumericBlanks(6)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTemp = Numbers(6); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = true; + sdAirTerm.MaxReheatTemp = Numbers(6); + sdAirTerm.MaxReheatTempSetByUser = true; } else { // user does not specify maximum supply air temperature // sd_airterminal(SysNum)%MaxReheatTemp = 35.0D0 !C - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = false; + sdAirTerm.MaxReheatTempSetByUser = false; } - ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, sdAirTerm.sysType); if (IsNotOK) { ShowContinueError(state, format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } if (lAlphaBlanks(8)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; + sdAirTerm.ZoneTurndownMinAirFrac = 1.0; + sdAirTerm.ZoneTurndownMinAirFracSchExist = false; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(8)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { + sdAirTerm.ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(8)); + if (sdAirTerm.ZoneTurndownMinAirFracSchPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(8), Alphas(8))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + sdAirTerm.ZoneTurndownMinAirFracSchExist = true; } // Add reheat coil to component sets array SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + sdAirTerm.sysType, + sdAirTerm.SysName, Alphas(5), Alphas(6), Alphas(3), @@ -1050,10 +1021,10 @@ void GetSysInput(EnergyPlusData &state) SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + sdAirTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + sdAirTerm.SysName); } // end Number of VAVHeatandCool Sys Loop @@ -1075,64 +1046,61 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + + auto &sdAirTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + + sdAirTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctConstVolReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(5); - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; + sdAirTerm.SysName = Alphas(1); + sdAirTerm.sysType = CurrentModuleObject; + sdAirTerm.SysType_Num = SysType::SingleDuctConstVolReheat; + + sdAirTerm.reheatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(5))); + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; } else { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(5), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowSevereInvalidKey(state, eoh, cAlphaFields(5), Alphas(5)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(6); + + sdAirTerm.ReheatCoilName = Alphas(6); ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, + HVAC::coilTypeNames[(int)sdAirTerm.reheatCoilType], + sdAirTerm.ReheatCoilName, IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + sdAirTerm.sysType); if (IsNotOK) { ShowContinueError(state, format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + sdAirTerm.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + sdAirTerm.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { + sdAirTerm.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (sdAirTerm.SchedPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = + + sdAirTerm.OutletNodeNum = GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -1143,7 +1111,7 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsParent, cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = + sdAirTerm.InletNodeNum = GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -1154,97 +1122,91 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsParent, cAlphaFields(4)); + // The reheat coil control node is necessary for hot water reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Gas || - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Electric) { - } else { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + sdAirTerm.ReheatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; + } + + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoilNum = SteamCoils::GetSteamCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; } else { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + sdAirTerm.ReheatControlNode = SteamCoils::GetCoilSteamInletNode(state, sdAirTerm.ReheatCoilNum); + } + + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.ReheatCoilNum = WaterCoils::GetWaterCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; + } else { + sdAirTerm.ReheatControlNode = WaterCoils::GetCoilWaterInletNode(state, sdAirTerm.ReheatCoilNum); } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(2); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(3); - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(2); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(3); - } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(4); + + sdAirTerm.ReheatAirOutletNode = sdAirTerm.OutletNodeNum; + sdAirTerm.MaxAirVolFlowRate = Numbers(1); + sdAirTerm.ZoneMinAirFracDes = 0.0; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; + sdAirTerm.DamperHeatingAction = Action::HeatingNotUsed; + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.MaxReheatSteamVolFlow = Numbers(2); + sdAirTerm.MinReheatSteamVolFlow = Numbers(3); + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.MaxReheatWaterVolFlow = Numbers(2); + sdAirTerm.MinReheatWaterVolFlow = Numbers(3); + } + sdAirTerm.ControllerOffset = Numbers(4); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (sdAirTerm.ControllerOffset <= 0.0) { + sdAirTerm.ControllerOffset = 0.001; } // Maximum reheat air temperature, i.e. the maximum supply air temperature leaving the reheat coil if (!lNumericBlanks(5)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTemp = Numbers(5); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = true; + sdAirTerm.MaxReheatTemp = Numbers(5); + sdAirTerm.MaxReheatTempSetByUser = true; } else { // user does not specify maximum supply air temperature // sd_airterminal(SysNum)%MaxReheatTemp = 35.0D0 !C - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = false; + sdAirTerm.MaxReheatTempSetByUser = false; } // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + sdAirTerm.sysType, + sdAirTerm.SysName, + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + sdAirTerm.InletNodeNum; + sdAirTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (sdAirTerm.ADUNum == 0) { ShowSevereError(state, format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError( state, format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -1252,33 +1214,30 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == + if (sdAirTerm.OutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, format("{} already connects to another zone", state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum))); + sdAirTerm.OutletNodeNum))); ShowContinueError(state, format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = sdAirTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = sdAirTerm.OutletNodeNum; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = + sdAirTerm.CtrlZoneNum = CtrlZone; + sdAirTerm.CtrlZoneInNodeIndex = SupAirIn; + sdAirTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } @@ -1286,19 +1245,19 @@ void GetSysInput(EnergyPlusData &state) } } - ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, sdAirTerm.sysType); if (IsNotOK) { ShowContinueError(state, format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } // Add reheat coil to component sets array SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + sdAirTerm.sysType, + sdAirTerm.SysName, Alphas(5), Alphas(6), Alphas(4), @@ -1329,30 +1288,34 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &sdAirTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + + sdAirTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctConstVolNoReheat; + sdAirTerm.SysName = Alphas(1); + sdAirTerm.sysType = CurrentModuleObject; + sdAirTerm.SysType_Num = SysType::SingleDuctConstVolNoReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + sdAirTerm.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + sdAirTerm.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { + sdAirTerm.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (sdAirTerm.SchedPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = + sdAirTerm.InletNodeNum = GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -1363,7 +1326,7 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = + sdAirTerm.OutletNodeNum = GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -1375,48 +1338,48 @@ void GetSysInput(EnergyPlusData &state) ObjectIsNotParent, cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; + sdAirTerm.MaxAirVolFlowRate = Numbers(1); + sdAirTerm.ZoneMinAirFracDes = 0.0; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; + sdAirTerm.DamperHeatingAction = Action::HeatingNotUsed; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = 0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.000001; + sdAirTerm.ReheatControlNode = 0; + sdAirTerm.ReheatAirOutletNode = + sdAirTerm.OutletNodeNum; + sdAirTerm.MaxReheatWaterVolFlow = 0.0; + sdAirTerm.MaxReheatSteamVolFlow = 0.0; + sdAirTerm.MinReheatWaterVolFlow = 0.0; + sdAirTerm.MinReheatSteamVolFlow = 0.0; + sdAirTerm.ControllerOffset = 0.000001; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + sdAirTerm.sysType, + sdAirTerm.SysName, + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == + if (sdAirTerm.OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + sdAirTerm.InletNodeNum; + sdAirTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (sdAirTerm.ADUNum == 0) { ShowSevereError(state, format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError( state, format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum))); + state.dataLoopNodes->NodeID(sdAirTerm.OutletNodeNum))); ErrorsFound = true; } else { @@ -1424,33 +1387,33 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == + if (sdAirTerm.OutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, format("{} already connects to another zone", state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum))); + sdAirTerm.OutletNodeNum))); ShowContinueError(state, format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; + sdAirTerm.InletNodeNum; state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + sdAirTerm.OutletNodeNum; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = + sdAirTerm.CtrlZoneNum = CtrlZone; + sdAirTerm.CtrlZoneInNodeIndex = SupAirIn; + sdAirTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } @@ -1459,31 +1422,31 @@ void GetSysInput(EnergyPlusData &state) } if (lAlphaBlanks(5)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = true; + sdAirTerm.NoOAFlowInputFromUser = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr = + sdAirTerm.OARequirementsPtr = Util::FindItemInList(Alphas(5), state.dataSize->OARequirements); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr == 0) { + if (sdAirTerm.OARequirementsPtr == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid data.", RoutineName, CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("..invalid {}=\"{}\".", cAlphaFields(5), Alphas(5))); ErrorsFound = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = false; + sdAirTerm.NoOAFlowInputFromUser = false; } } if (lAlphaBlanks(6)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = + sdAirTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; } else { if (Alphas(6) == "CURRENTOCCUPANCY") { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = + sdAirTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; } else if (Alphas(6) == "DESIGNOCCUPANCY") { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = + sdAirTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::ByDesignLevel; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = + sdAirTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; ShowWarningError(state, format("{}{}=\"{}\", invalid data.", RoutineName, CurrentModuleObject, Alphas(1))); ShowContinueError(state, @@ -1495,17 +1458,17 @@ void GetSysInput(EnergyPlusData &state) // model results related actuators SetupEMSActuator(state, "AirTerminal:SingleDuct:ConstantVolume:NoReheat", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + sdAirTerm.SysName, "Mass Flow Rate", "[kg/s]", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).EMSOverrideAirFlow, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).EMSMassFlowRateValue); + sdAirTerm.EMSOverrideAirFlow, + sdAirTerm.EMSMassFlowRateValue); // model input related internal variables SetupEMSInternalVariable(state, "AirTerminal:SingleDuct:ConstantVolume:NoReheat Maximum Mass Flow Rate", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + sdAirTerm.SysName, "[kg/s]", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).AirMassFlowRateMax); + sdAirTerm.AirMassFlowRateMax); } } // End Number of Sys Loop @@ -1531,29 +1494,30 @@ void GetSysInput(EnergyPlusData &state) state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys + state.dataSingleDuct->NumCVNoReheatSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &sdAirTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + sdAirTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctVAVNoReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + sdAirTerm.SysName = Alphas(1); + sdAirTerm.sysType = CurrentModuleObject; + sdAirTerm.SysType_Num = SysType::SingleDuctVAVNoReheat; + sdAirTerm.reheatCoilType = HVAC::CoilType::Invalid; + sdAirTerm.ReheatCoilName = ""; + sdAirTerm.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + sdAirTerm.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { + sdAirTerm.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (sdAirTerm.SchedPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = + sdAirTerm.OutletNodeNum = GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -1564,7 +1528,7 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = + sdAirTerm.InletNodeNum = GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -1575,118 +1539,118 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); + sdAirTerm.MaxAirVolFlowRate = Numbers(1); if (Util::SameString(Alphas(5), "Constant")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Constant; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::Constant; } else if (Util::SameString(Alphas(5), "FixedFlowRate")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Fixed; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::Fixed; } else if (Util::SameString(Alphas(5), "Scheduled")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Scheduled; + sdAirTerm.ZoneMinAirFracMethod = MinFlowFraction::Scheduled; } else { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(5), Alphas(5))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); + sdAirTerm.ZoneMinAirFracDes = Numbers(2); if (lNumericBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + sdAirTerm.ConstantMinAirFracSetByUser = false; + sdAirTerm.ZoneMinAirFracDes = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Fixed) { + sdAirTerm.ConstantMinAirFracSetByUser = true; + sdAirTerm.ZoneMinAirFracDes = Numbers(2); + if (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Fixed) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + sdAirTerm.sysType, + sdAirTerm.SysName)); + sdAirTerm.ZoneMinAirFracDes = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = Numbers(3); + sdAirTerm.ZoneFixedMinAir = Numbers(3); if (lNumericBlanks(3)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignFixedMinAir = 0.0; + sdAirTerm.FixedMinAirSetByUser = false; + sdAirTerm.DesignFixedMinAir = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignFixedMinAir = Numbers(3); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Constant) { + sdAirTerm.FixedMinAirSetByUser = true; + sdAirTerm.DesignFixedMinAir = Numbers(3); + if (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Constant) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(3))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = 0.0; + sdAirTerm.sysType, + sdAirTerm.SysName)); + sdAirTerm.ZoneFixedMinAir = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr = GetScheduleIndex(state, Alphas(6)); - if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr == 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { + sdAirTerm.ZoneMinAirFracSchPtr = GetScheduleIndex(state, Alphas(6)); + if ((sdAirTerm.ZoneMinAirFracSchPtr == 0) && + (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(6), Alphas(6))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "A valid schedule is required"); ErrorsFound = true; - } else if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr > 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { + } else if ((sdAirTerm.ZoneMinAirFracSchPtr > 0) && + (sdAirTerm.ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { // check range of values in schedule if (!CheckScheduleValueMinMax( - state, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr, ">=", 0.0, "<=", 1.0)) { + state, sdAirTerm.ZoneMinAirFracSchPtr, ">=", 0.0, "<=", 1.0)) { ShowSevereError(state, format("Error found in {} = {}", cAlphaFields(6), Alphas(6))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = 0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.000001; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; + sdAirTerm.ReheatControlNode = 0; + sdAirTerm.ReheatAirOutletNode = + sdAirTerm.OutletNodeNum; + sdAirTerm.MaxReheatWaterVolFlow = 0.0; + sdAirTerm.MaxReheatSteamVolFlow = 0.0; + sdAirTerm.MinReheatWaterVolFlow = 0.0; + sdAirTerm.MinReheatSteamVolFlow = 0.0; + sdAirTerm.ControllerOffset = 0.000001; + sdAirTerm.DamperHeatingAction = Action::HeatingNotUsed; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + sdAirTerm.sysType, + sdAirTerm.SysName, + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == + if (sdAirTerm.OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + sdAirTerm.InletNodeNum; + sdAirTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (sdAirTerm.ADUNum == 0) { ShowSevereError(state, format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError( state, format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -1694,34 +1658,34 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, format("{} already connects to another zone", state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + sdAirTerm.ReheatAirOutletNode))); ShowContinueError(state, format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; + sdAirTerm.InletNodeNum; state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + sdAirTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = + sdAirTerm.CtrlZoneNum = CtrlZone; + sdAirTerm.CtrlZoneInNodeIndex = SupAirIn; + sdAirTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } @@ -1729,51 +1693,51 @@ void GetSysInput(EnergyPlusData &state) } } if (!lAlphaBlanks(7)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr = + sdAirTerm.OARequirementsPtr = Util::FindItemInList(Alphas(7), state.dataSize->OARequirements); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr == 0) { + if (sdAirTerm.OARequirementsPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(7), Alphas(7))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = false; + sdAirTerm.NoOAFlowInputFromUser = false; } } if (lAlphaBlanks(8)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; + sdAirTerm.ZoneTurndownMinAirFrac = 1.0; + sdAirTerm.ZoneTurndownMinAirFracSchExist = false; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(8)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { + sdAirTerm.ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(8)); + if (sdAirTerm.ZoneTurndownMinAirFracSchPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(8), Alphas(8))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + sdAirTerm.ZoneTurndownMinAirFracSchExist = true; } // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + sdAirTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + sdAirTerm.SysName); SetupOutputVariable(state, "Zone Air Terminal Minimum Air Flow Fraction", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracReport, + sdAirTerm.ZoneMinAirFracReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + sdAirTerm.SysName); } // end Number of Sys Loop @@ -1798,29 +1762,31 @@ void GetSysInput(EnergyPlusData &state) state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys + state.dataSingleDuct->NumCVNoReheatSysGSI + state.dataSingleDuct->NumNoRHVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &sdAirTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + sdAirTerm.SysNum = state.dataSingleDuct->SysNumGSI; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctCBVAVNoReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + sdAirTerm.SysName = Alphas(1); + sdAirTerm.sysType = CurrentModuleObject; + sdAirTerm.SysType_Num = SysType::SingleDuctCBVAVNoReheat; + sdAirTerm.reheatCoilType = HVAC::CoilType::Invalid; + sdAirTerm.ReheatCoilName = ""; + sdAirTerm.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + sdAirTerm.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { + sdAirTerm.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (sdAirTerm.SchedPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = + sdAirTerm.OutletNodeNum = GetOnlySingleNode(state, Alphas(3), ErrorsFound, @@ -1831,7 +1797,7 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = + sdAirTerm.InletNodeNum = GetOnlySingleNode(state, Alphas(4), ErrorsFound, @@ -1842,64 +1808,64 @@ void GetSysInput(EnergyPlusData &state) NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent, cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes < 0.0) { + sdAirTerm.MaxAirVolFlowRate = Numbers(1); + sdAirTerm.ZoneMinAirFracDes = Numbers(2); + if (sdAirTerm.ZoneMinAirFracDes < 0.0) { ShowWarningError(state, format("{} = \"{}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, format("{} must be greater than or equal to 0. Resetting to 0 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + sdAirTerm.ZoneMinAirFracDes = 0.0; } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes > 1.0) { + if (sdAirTerm.ZoneMinAirFracDes > 1.0) { ShowWarningError(state, format("{} = \"{}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, format("{} must be less than or equal to 1. Resetting to 1 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 1.0; + sdAirTerm.ZoneMinAirFracDes = 1.0; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = 0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.000001; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; + sdAirTerm.ReheatControlNode = 0; + sdAirTerm.ReheatAirOutletNode = + sdAirTerm.OutletNodeNum; + sdAirTerm.MaxReheatWaterVolFlow = 0.0; + sdAirTerm.MaxReheatSteamVolFlow = 0.0; + sdAirTerm.MinReheatWaterVolFlow = 0.0; + sdAirTerm.MinReheatSteamVolFlow = 0.0; + sdAirTerm.ControllerOffset = 0.000001; + sdAirTerm.DamperHeatingAction = Action::HeatingNotUsed; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + sdAirTerm.sysType, + sdAirTerm.SysName, + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == + if (sdAirTerm.OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + sdAirTerm.InletNodeNum; + sdAirTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (sdAirTerm.ADUNum == 0) { ShowSevereError(state, format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError( state, format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -1907,33 +1873,33 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, format("{} already connects to another zone", state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + sdAirTerm.ReheatAirOutletNode))); ShowContinueError(state, format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; + sdAirTerm.InletNodeNum; state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + sdAirTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = + sdAirTerm.CtrlZoneNum = CtrlZone; + sdAirTerm.CtrlZoneInNodeIndex = SupAirIn; + sdAirTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } @@ -1942,29 +1908,29 @@ void GetSysInput(EnergyPlusData &state) } if (lAlphaBlanks(5)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; + sdAirTerm.ZoneTurndownMinAirFrac = 1.0; + sdAirTerm.ZoneTurndownMinAirFracSchExist = false; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(5)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { + sdAirTerm.ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(5)); + if (sdAirTerm.ZoneTurndownMinAirFracSchPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(5), Alphas(5))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + sdAirTerm.ZoneTurndownMinAirFracSchExist = true; } // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + sdAirTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + sdAirTerm.SysName); } // end Number of VAVHeatandCool:NoReheat Sys Loop @@ -1988,81 +1954,51 @@ void GetSysInput(EnergyPlusData &state) cNumericFields); ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; - + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys + state.dataSingleDuct->NumCVNoReheatSysGSI + state.dataSingleDuct->NumNoRHVAVSysGSI + state.dataSingleDuct->NumNoRHCBVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &sdAirTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + sdAirTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctVAVReheatVSFan; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(7); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(8); - IsNotOK = false; - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetHeatingCoilOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatCoilMaxCapacity = - GetHeatingCoilCapacity(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetHeatingCoilOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatCoilMaxCapacity = - GetHeatingCoilCapacity(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; - } else if (!state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp.empty()) { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(7), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.SysName = Alphas(1); + sdAirTerm.sysType = CurrentModuleObject; + sdAirTerm.SysType_Num = SysType::SingleDuctVAVReheatVSFan; + + sdAirTerm.reheatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(7))); + sdAirTerm.ReheatCoilName = Alphas(8); + + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + sdAirTerm.ReheatCoilNum = HeatingCoils::GetHeatingCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), sdAirTerm.ReheatCoilName); + ErrorsFound = true; + } else { + sdAirTerm.ReheatAirOutletNode = HeatingCoils::GetCoilOutletNode(state, sdAirTerm.ReheatCoilNum); + sdAirTerm.ReheatCoilMaxCapacity = HeatingCoils::GetCoilCapacity(state, sdAirTerm.ReheatCoilNum); + } + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoil_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(7), Alphas(7)); ErrorsFound = true; } + ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, + HVAC::coilTypeNames[(int)sdAirTerm.reheatCoilType], + sdAirTerm.ReheatCoilName, IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + sdAirTerm.sysType); if (IsNotOK) { ShowContinueError(state, format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } @@ -2089,183 +2025,116 @@ void GetSysInput(EnergyPlusData &state) dynamic_cast(state.dataFans->fans(airTerm.Fan_Index))->isSecondaryDriver = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + sdAirTerm.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + sdAirTerm.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { + sdAirTerm.SchedPtr = GetScheduleIndex(state, Alphas(2)); + if (sdAirTerm.SchedPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } } - AirTermSysInletNodeName = state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum); + AirTermSysInletNodeName = state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum); if (!Util::SameString(Alphas(3), AirTermSysInletNodeName)) { ShowWarningError(state, format("{}Invalid air terminal object air inlet node name in {} = {}", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, format(" Specified air inlet node name is = {}.", Alphas(3))); ShowContinueError(state, format(" Expected air inlet node name is = {}.", AirTermSysInletNodeName)); // ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxHeatAirVolFlowRate = Numbers(2); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(3); + sdAirTerm.MaxAirVolFlowRate = Numbers(1); + sdAirTerm.MaxHeatAirVolFlowRate = Numbers(2); + sdAirTerm.ZoneMinAirFracDes = Numbers(3); // The reheat coil control node is necessary for hot water reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Gas || - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Electric) { - // IF(.NOT. lAlphaBlanks(6)) THEN - // CALL ShowWarningError(state, 'In '//TRIM(sd_airterminal(SysNum)%SysType)//' = ' // TRIM(sd_airterminal(SysNum)%SysName) & - // // ' the '//TRIM(cAlphaFields(6))//' is not needed and will be ignored.') - // CALL ShowContinueError(state, ' It is used for hot water reheat coils only.') - // END IF - } else { - // IF(lAlphaBlanks(6)) THEN - // CALL ShowSevereError(state, 'In '//TRIM(sd_airterminal(SysNum)%SysType)//' = ' // TRIM(sd_airterminal(SysNum)%SysName) & - // // ' the '//TRIM(cAlphaFields(6))//' is undefined') - // ErrorsFound=.TRUE. - // END IF - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } else { - // A4, \field Unit supply air outlet node - // \note same as heating coil air outlet node - // \note same as zone inlet node - // \type alpha - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetCoilAirOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } - } - // GetOnlySingleNode(state, Alphas(6),ErrorsFound,sd_airterminal(SysNum)%SysType,Alphas(1), & - // DataLoopNode::NodeFluidType::Steam,DataLoopNode::NodeConnectionType::Actuator,1,ObjectIsParent) + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || + sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingElectric) { + + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.ReheatCoilNum = SteamCoils::GetSteamCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), sdAirTerm.ReheatCoilName); + ErrorsFound = true; } else { - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } else { - // A4, \field Unit supply air outlet node - // \note same as heating coil air outlet node - // \note same as zone inlet node - // \type alpha - IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetCoilOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } - } - // GetOnlySingleNode(state, Alphas(6),ErrorsFound,sd_airterminal(SysNum)%SysType,Alphas(1), & - // DataLoopNode::NodeFluidType::Water,DataLoopNode::NodeConnectionType::Actuator,1,ObjectIsParent) - } - } - // A4, \field Unit supply air outlet node - // \note same as heating coil air outlet node - // \note same as zone inlet node - // \type alpha - // sd_airterminal(SysNum)%ReheatAirOutletNode = & - // GetOnlySingleNode(state, Alphas(4),ErrorsFound,sd_airterminal(SysNum)%SysType,Alphas(1), & - // DataLoopNode::NodeFluidType::Air,DataLoopNode::NodeConnectionType::Outlet,1,ObjectIsParent) - AirTermSysOutletNodeName = - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode); + sdAirTerm.ReheatControlNode = SteamCoils::GetCoilSteamInletNode(state, sdAirTerm.ReheatCoilNum); + sdAirTerm.ReheatAirOutletNode = SteamCoils::GetCoilAirOutletNode(state, sdAirTerm.ReheatCoilNum); + } + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.ReheatCoilNum = WaterCoils::GetWaterCoilIndex(state, sdAirTerm.ReheatCoilName); + if (sdAirTerm.ReheatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), sdAirTerm.ReheatCoilName); + ErrorsFound = true; + } else { + sdAirTerm.ReheatControlNode = WaterCoils::GetCoilWaterInletNode(state, sdAirTerm.ReheatCoilNum); + sdAirTerm.ReheatAirOutletNode = WaterCoils::GetCoilOutletNode(state, sdAirTerm.ReheatCoilNum); + } + } + + AirTermSysOutletNodeName = state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode); if (!Util::SameString(Alphas(4), AirTermSysOutletNodeName)) { ShowWarningError(state, format("{}Invalid air terminal object air outlet node name in {} = {}", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, format(" Specified air outlet node name is = {}.", Alphas(4))); ShowContinueError(state, format(" Expected air outlet node name is = {}.", AirTermSysOutletNodeName)); // ErrorsFound = true; } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(5); - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(5); + if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingSteam) { + sdAirTerm.MaxReheatSteamVolFlow = Numbers(4); + sdAirTerm.MinReheatSteamVolFlow = Numbers(5); + } else if (sdAirTerm.reheatCoilType == HVAC::CoilType::HeatingWater) { + sdAirTerm.MaxReheatWaterVolFlow = Numbers(4); + sdAirTerm.MinReheatWaterVolFlow = Numbers(5); } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(6); + + sdAirTerm.ControllerOffset = Numbers(6); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (sdAirTerm.ControllerOffset <= 0.0) { + sdAirTerm.ControllerOffset = 0.001; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; + sdAirTerm.DamperHeatingAction = Action::HeatingNotUsed; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode), + sdAirTerm.sysType, + sdAirTerm.SysName, + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + sdAirTerm.InletNodeNum; + sdAirTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (sdAirTerm.ADUNum == 0) { ShowSevereError(state, format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError( state, format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -2275,7 +2144,7 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == + if (sdAirTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { IsNotOK = false; if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { @@ -2283,26 +2152,26 @@ void GetSysInput(EnergyPlusData &state) ShowContinueError(state, format("{} already connects to another zone", state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + sdAirTerm.ReheatAirOutletNode))); ShowContinueError(state, format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; + sdAirTerm.InletNodeNum; state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + sdAirTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) + state.dataDefineEquipment->AirDistUnit(sdAirTerm.ADUNum) .ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = + sdAirTerm.CtrlZoneNum = CtrlZone; + sdAirTerm.CtrlZoneInNodeIndex = SupAirIn; + sdAirTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } @@ -2313,51 +2182,51 @@ void GetSysInput(EnergyPlusData &state) ShowWarningError(state, "Did not Match Supply Air Outlet Node to any Zone Node"); ShowContinueError(state, format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); } if (lAlphaBlanks(9)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; + sdAirTerm.ZoneTurndownMinAirFrac = 1.0; + sdAirTerm.ZoneTurndownMinAirFracSchExist = false; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(9)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { + sdAirTerm.ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(9)); + if (sdAirTerm.ZoneTurndownMinAirFracSchPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(9), Alphas(9))); ShowContinueError(state, format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + sdAirTerm.sysType, + sdAirTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + sdAirTerm.ZoneTurndownMinAirFracSchExist = true; } // Add reheat coil to component sets array SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + sdAirTerm.sysType, + sdAirTerm.SysName, Alphas(7), Alphas(8), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode)); + state.dataLoopNodes->NodeID(sdAirTerm.OutletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.ReheatAirOutletNode)); // Add fan to component sets array SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + sdAirTerm.sysType, + sdAirTerm.SysName, Alphas(5), Alphas(6), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum)); + state.dataLoopNodes->NodeID(sdAirTerm.InletNodeNum), + state.dataLoopNodes->NodeID(sdAirTerm.OutletNodeNum)); // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + sdAirTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + sdAirTerm.SysName); } // common report variable for all single duct air terminals @@ -2435,7 +2304,6 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI using DataZoneEquipment::CheckZoneEquipmentList; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; - auto &GetHeatingCoilCapacity(HeatingCoils::GetCoilCapacity); // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("InitSys"); @@ -2453,11 +2321,11 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI // Do the Begin Simulation initializations if (this->PlantLoopScanFlag && allocated(state.dataPlnt->PlantLoop)) { - if ((this->ReheatComp_PlantType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || - (this->ReheatComp_PlantType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { + if ((this->ReheatCoil_PlantType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || + (this->ReheatCoil_PlantType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { // setup plant topology indices for plant fed heating coils errFlag = false; - ScanPlantLoopsForObject(state, this->ReheatName, this->ReheatComp_PlantType, this->HWplantLoc, errFlag, _, _, _, _, _); + ScanPlantLoopsForObject(state, this->ReheatCoilName, this->ReheatCoil_PlantType, this->HWplantLoc, errFlag, _, _, _, _, _); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type={}", this->SysName, this->sysType)); @@ -2508,11 +2376,9 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI } if (this->GetGasElecHeatCoilCap) { - if (this->ReheatComp_Num == HeatingCoilType::Electric || this->ReheatComp_Num == HeatingCoilType::Gas) { + if (this->reheatCoilType == HVAC::CoilType::HeatingElectric || this->reheatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel) { if (this->ReheatCoilMaxCapacity == AutoSize) { - errFlag = false; - this->ReheatCoilMaxCapacity = GetHeatingCoilCapacity(state, this->ReheatComp, this->ReheatName, errFlag); - if (errFlag) ShowContinueError(state, format("Occurs for terminal unit {} = {}", this->sysType, this->SysName)); + this->ReheatCoilMaxCapacity = HeatingCoils::GetCoilCapacity(state, this->ReheatCoilNum); } if (this->ReheatCoilMaxCapacity != AutoSize) { this->GetGasElecHeatCoilCap = false; @@ -2534,7 +2400,7 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI state.dataLoopNodes->Node(InletNode).MassFlowRateMax = this->MaxAirVolFlowRate * state.dataEnvrn->StdRhoAir; this->MassFlowDiff = 1.0e-10 * this->AirMassFlowRateMax; - if (this->HWplantLoc.loopNum > 0 && this->ReheatComp_Num != HeatingCoilType::SteamAirHeating) { // protect early calls before plant is setup + if (this->HWplantLoc.loopNum > 0 && this->reheatCoilType != HVAC::CoilType::HeatingSteam) { // protect early calls before plant is setup rho = state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } else { rho = 1000.0; @@ -2547,7 +2413,7 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI // set the upstream leakage flowrate - remove from here - done in ZoneAirLoopEquipmentManager::SimZoneAirLoopEquipment - if (this->ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + if (this->reheatCoilType == HVAC::CoilType::HeatingSteam) { SteamTemp = 100.0; SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, SteamTemp, 1.0, RoutineNameFull); this->MaxReheatSteamFlow = SteamDensity * this->MaxReheatSteamVolFlow; @@ -2574,7 +2440,7 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI state.dataLoopNodes->Node(InletNode).MassFlowRateMin = 0.0; } if ((this->ReheatControlNode > 0) && !this->PlantLoopScanFlag) { - if (this->ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + if (this->reheatCoilType == HVAC::CoilType::HeatingSteam) { InitComponentNodes(state, this->MinReheatSteamFlow, this->MaxReheatSteamFlow, this->ReheatControlNode, this->ReheatCoilOutletNode); } else { InitComponentNodes(state, this->MinReheatWaterFlow, this->MaxReheatWaterFlow, this->ReheatControlNode, this->ReheatCoilOutletNode); @@ -2753,11 +2619,6 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) // Using/Aliasing using General::SafeDivide; using PlantUtilities::MyPlantSizingIndex; - using SteamCoils::GetCoilSteamInletNode; - using SteamCoils::GetCoilSteamOutletNode; - using WaterCoils::GetCoilWaterInletNode; - using WaterCoils::GetCoilWaterOutletNode; - using WaterCoils::SetCoilDesFlow; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("SizeSys"); @@ -3409,9 +3270,9 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) TermUnitSizing(state.dataSize->CurTermUnitSizingNum).ReheatAirFlowMult = 1.0; TermUnitSizing(state.dataSize->CurTermUnitSizingNum).ReheatLoadMult = 1.0; } - if (this->ReheatComp_Index > 0) { + if (this->ReheatCoilNum > 0) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier( - state, this->ReheatName, this->ReheatComp, TermUnitSizing(state.dataSize->CurTermUnitSizingNum).ReheatLoadMult); + state, this->ReheatCoilName, this->reheatCoilType, TermUnitSizing(state.dataSize->CurTermUnitSizingNum).ReheatLoadMult); } } @@ -3427,14 +3288,14 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) } } else { CheckZoneSizing(state, this->sysType, this->SysName); - if (Util::SameString(this->ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->CoilWaterInletNodeSS = GetCoilWaterInletNode(state, "Coil:Heating:Water", this->ReheatName, ErrorsFound); - state.dataSingleDuct->CoilWaterOutletNodeSS = GetCoilWaterOutletNode(state, "Coil:Heating:Water", this->ReheatName, ErrorsFound); + if (this->reheatCoilType == HVAC::CoilType::HeatingWater) { + state.dataSingleDuct->CoilWaterInletNodeSS = WaterCoils::GetCoilWaterInletNode(state, this->ReheatCoilNum); + state.dataSingleDuct->CoilWaterOutletNodeSS = WaterCoils::GetCoilWaterOutletNode(state, this->ReheatCoilNum); if (IsAutoSize) { PlantSizingErrorsFound = false; PltSizHeatNum = MyPlantSizingIndex(state, "Coil:Heating:Water", - this->ReheatName, + this->ReheatCoilName, state.dataSingleDuct->CoilWaterInletNodeSS, state.dataSingleDuct->CoilWaterOutletNodeSS, PlantSizingErrorsFound); @@ -3538,14 +3399,15 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) } } else { CheckZoneSizing(state, this->sysType, this->SysName); - if (Util::SameString(this->ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->CoilSteamInletNodeSS = GetCoilSteamInletNode(state, "Coil:Heating:Steam", this->ReheatName, ErrorsFound); - state.dataSingleDuct->CoilSteamOutletNodeSS = GetCoilSteamOutletNode(state, "Coil:Heating:Steam", this->ReheatName, ErrorsFound); + if (this->reheatCoilType == HVAC::CoilType::HeatingSteam) { + // Why are these state variables? + state.dataSingleDuct->CoilSteamInletNodeSS = SteamCoils::GetCoilSteamInletNode(state, this->ReheatCoilNum); + state.dataSingleDuct->CoilSteamOutletNodeSS = SteamCoils::GetCoilSteamOutletNode(state, this->ReheatCoilNum); if (IsAutoSize) { PlantSizingErrorsFound = false; PltSizHeatNum = MyPlantSizingIndex(state, - "Coil:Heating:Steam", - this->ReheatName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilName, state.dataSingleDuct->CoilSteamInletNodeSS, state.dataSingleDuct->CoilSteamOutletNodeSS, PlantSizingErrorsFound); @@ -3628,12 +3490,11 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) TermUnitSizing(state.dataSize->CurTermUnitSizingNum).MaxHWVolFlow = this->MaxReheatWaterVolFlow; TermUnitSizing(state.dataSize->CurTermUnitSizingNum).MaxSTVolFlow = this->MaxReheatSteamVolFlow; TermUnitSizing(state.dataSize->CurTermUnitSizingNum).DesHeatingLoad = state.dataSingleDuct->DesCoilLoadSS; // Coil Summary report - if (this->ReheatComp_Num == HeatingCoilType::SimpleHeating) { + if (this->reheatCoilType == HVAC::CoilType::HeatingWater) { if (this->DamperHeatingAction == Action::Normal) { - SetCoilDesFlow(state, this->ReheatComp, this->ReheatName, this->ZoneMinAirFracDes * this->MaxAirVolFlowRate, ErrorsFound); + WaterCoils::SetCoilDesFlow(state, this->ReheatCoilNum, this->ZoneMinAirFracDes * this->MaxAirVolFlowRate); } else { - SetCoilDesFlow( - state, this->ReheatComp, this->ReheatName, TermUnitSizing(state.dataSize->CurTermUnitSizingNum).AirVolFlow, ErrorsFound); + WaterCoils::SetCoilDesFlow(state, this->ReheatCoilNum, TermUnitSizing(state.dataSize->CurTermUnitSizingNum).AirVolFlow); } } } @@ -3694,11 +3555,8 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt // Using/Aliasing using namespace DataZoneEnergyDemands; // unused USE DataHeatBalFanSys, ONLY: Mat - using HeatingCoils::SimulateHeatingCoilComponents; using HVAC::SmallLoad; using PlantUtilities::SetActuatedBranchFlowRate; - using SteamCoils::SimulateSteamCoilComponents; - using WaterCoils::SimulateWaterCoilComponents; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 MassFlow; // [kg/sec] Total Mass Flow Rate from Hot & Cold Inlets @@ -3935,9 +3793,9 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt this->UpdateSys(state); // Now do the heating coil calculation for each heating coil type - switch (this->ReheatComp_Num) { // Reverse damper option is working only for water coils for now. + switch (this->reheatCoilType) { // Reverse damper option is working only for water coils for now. // hot water heating coil - case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING + case HVAC::CoilType::HeatingWater: { // COIL:WATER:SIMPLEHEATING // Determine the load required to pass to the Component controller // Although this equation looks strange (using temp instead of deltaT), it is corrected later in ControlCompOutput // and is working as-is, temperature setpoints are maintained as expected. @@ -3961,9 +3819,9 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt // hot water flow rate. // FB use QActualHeating, change ControlCompOutput to use new ControlCompOutput(state, - this->ReheatName, - this->ReheatComp, - this->ReheatComp_Index, + this->ReheatCoilName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilNum, FirstHVACIteration, QZnReq, this->ReheatControlNode, @@ -3985,6 +3843,8 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt if (this->DamperHeatingAction == Action::Reverse || this->DamperHeatingAction == Action::ReverseWithLimits) { if (state.dataLoopNodes->Node(this->ReheatControlNode).MassFlowRate == MaxFlowWater) { // fill limits for air flow for controller + + // Why are all of these state variables? state.dataSingleDuct->MinAirMassFlowRevActSVAV = this->AirMassFlowRateMax * this->ZoneMinAirFrac; state.dataSingleDuct->MinAirMassFlowRevActSVAV = min(state.dataSingleDuct->MinAirMassFlowRevActSVAV, this->sd_airterminalInlet.AirMassFlowRateMaxAvail); @@ -4002,9 +3862,9 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt state.dataLoopNodes->Node(this->OutletNodeNum).MassFlowRateMaxAvail = state.dataSingleDuct->MaxAirMassFlowRevActSVAV; // suspect, check how/if used in ControlCompOutput ControlCompOutput(state, - this->ReheatName, - this->ReheatComp, - this->ReheatComp_Index, + this->ReheatCoilName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilNum, FirstHVACIteration, state.dataSingleDuct->QZoneMax2SDAT, this->OutletNodeNum, @@ -4033,9 +3893,9 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt // and is working as-is, temperature setpoints are maintained as expected. QZnReq = state.dataSingleDuct->QZoneMax2SDAT + MassFlow * CpAirAvg * state.dataSingleDuct->ZoneTempSDAT; ControlCompOutput(state, - this->ReheatName, - this->ReheatComp, - this->ReheatComp_Index, + this->ReheatCoilName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilNum, FirstHVACIteration, QZnReq, this->ReheatControlNode, @@ -4070,68 +3930,58 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt this->ZoneMinAirFracReport = this->ZoneMinAirFrac; } } break; - case HeatingCoilType::SteamAirHeating: { // ! COIL:STEAM:AIRHEATING + + case HVAC::CoilType::HeatingSteam: { // ! COIL:STEAM:AIRHEATING // Determine the load required to pass to the Component controller QZnReq = state.dataSingleDuct->QZoneMax2SDAT - MassFlow * CpAirAvg * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSDAT); // Simulate reheat coil for the VAV system - SimulateSteamCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index, QZnReq); + SteamCoils::SimulateSteamCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum, QZnReq); } break; - case HeatingCoilType::Electric: { // COIL:ELECTRIC:HEATING - // Determine the load required to pass to the Component controller - QZnReq = - state.dataSingleDuct->QZoneMax2SDAT - MassFlow * CpAirAvg * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSDAT); - // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, QZnReq, this->ReheatComp_Index); - } break; - case HeatingCoilType::Gas: { // COIL:GAS:HEATING + case HVAC::CoilType::HeatingElectric: // COIL:ELECTRIC:HEATING + case HVAC::CoilType::HeatingGasOrOtherFuel: { // COIL:GAS:HEATING // Determine the load required to pass to the Component controller QZnReq = state.dataSingleDuct->QZoneMax2SDAT - MassFlow * CpAirAvg * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSDAT); // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, QZnReq, this->ReheatComp_Index, QHeatingDelivered); + HeatingCoils::SimulateHeatingCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, QZnReq, this->ReheatCoilNum); } break; - case HeatingCoilType::None: { // blank - // I no reheat is defined then assume that the damper is the only component. + + case HVAC::CoilType::Invalid: { // blank + // I no reheat is defined then assume that the damper is the only component. // If something else is there that is not a reheat coil or a blank then give the error message } break; default: { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } break; } // the COIL is OFF the properties are calculated for this special case. } else { - switch (this->ReheatComp_Num) { - case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING + switch (this->reheatCoilType) { + case HVAC::CoilType::HeatingWater: { // COIL:WATER:SIMPLEHEATING // Simulate reheat coil for the Const Volume system DummyMdot = 0.0; SetActuatedBranchFlowRate(state, DummyMdot, this->ReheatControlNode, this->HWplantLoc, true); // call the reheat coil with the NO FLOW condition to make sure that the Node values // are passed through to the coil outlet correctly - SimulateWaterCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index); + WaterCoils::SimulateWaterCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum); } break; - case HeatingCoilType::SteamAirHeating: { // COIL:STEAM:AIRHEATING + case HVAC::CoilType::HeatingSteam: { // COIL:STEAM:AIRHEATING // Simulate reheat coil for the VAV system - SimulateSteamCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index, 0.0); + SteamCoils::SimulateSteamCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum, 0.0); } break; - case HeatingCoilType::Electric: { // COIL:ELECTRIC:HEATING - // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, 0.0, this->ReheatComp_Index); - } break; - case HeatingCoilType::Gas: { // COIL:GAS:HEATING - // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, 0.0, this->ReheatComp_Index); - } break; - case HeatingCoilType::None: { // blank - // If no reheat is defined then assume that the damper is the only component. - // If something else is that is not a reheat coil or a blank then give the error message + case HVAC::CoilType::HeatingElectric: // COIL:ELECTRIC:HEATING + case HVAC::CoilType::HeatingGasOrOtherFuel: { // COIL:GAS:HEATING + // Simulate reheat coil for the VAV system + HeatingCoils::SimulateHeatingCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, 0.0, this->ReheatCoilNum); } break; + default: { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } break; } } @@ -4208,9 +4058,6 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC using namespace DataZoneEnergyDemands; using HVAC::SmallLoad; // unused USE DataHeatBalFanSys, ONLY: Mat - using HeatingCoils::SimulateHeatingCoilComponents; - using SteamCoils::SimulateSteamCoilComponents; - using WaterCoils::SimulateWaterCoilComponents; // unused USE DataHeatBalFanSys, ONLY: ZoneThermostatSetPointHi, ZoneThermostatSetPointLo using PlantUtilities::SetActuatedBranchFlowRate; @@ -4355,8 +4202,8 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC this->UpdateSys(state); - switch (this->ReheatComp_Num) { // hot water heating coil - case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING + switch (this->reheatCoilType) { // hot water heating coil + case HVAC::CoilType::HeatingWater: { // COIL:WATER:SIMPLEHEATING // Determine the load required to pass to the Component controller // Although this equation looks strange (using temp instead of deltaT), it is corrected later in ControlCompOutput // and is working as-is, temperature setpoints are maintained as expected. @@ -4381,9 +4228,9 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC // Simulate the reheat coil at constant air flow. Control by varying the // hot water flow rate. ControlCompOutput(state, - this->ReheatName, - this->ReheatComp, - this->ReheatComp_Index, + this->ReheatCoilName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilNum, FirstHVACIteration, QZnReq, this->ReheatControlNode, @@ -4405,9 +4252,9 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC if (this->DamperHeatingAction == Action::Reverse) { if (state.dataLoopNodes->Node(this->ReheatControlNode).MassFlowRate == this->MaxReheatWaterFlow) { ControlCompOutput(state, - this->ReheatName, - this->ReheatComp, - this->ReheatComp_Index, + this->ReheatCoilName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilNum, FirstHVACIteration, state.dataSingleDuct->QZoneMax2SCBVAV, this->OutletNodeNum, @@ -4433,9 +4280,9 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC this->sd_airterminalOutlet.AirMassFlowRate = MassFlow; this->UpdateSys(state); ControlCompOutput(state, - this->ReheatName, - this->ReheatComp, - this->ReheatComp_Index, + this->ReheatCoilName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilNum, FirstHVACIteration, QZnReq, this->ReheatControlNode, @@ -4459,46 +4306,41 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC } } } break; - case HeatingCoilType::SteamAirHeating: { // ! COIL:STEAM:AIRHEATING + + case HVAC::CoilType::HeatingSteam: { // ! COIL:STEAM:AIRHEATING // Determine the load required to pass to the Component controller QZnReq = state.dataSingleDuct->QZoneMax2SCBVAV - MassFlow * CpAirZn * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCBVAV); if (QZnReq < SmallLoad) QZnReq = 0.0; // Simulate reheat coil for the VAV system - SimulateSteamCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index, QZnReq); + SteamCoils::SimulateSteamCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum, QZnReq); } break; - case HeatingCoilType::Electric: { // COIL:ELECTRIC:HEATING + + case HVAC::CoilType::HeatingElectric: // COIL:ELECTRIC:HEATING + case HVAC::CoilType::HeatingGasOrOtherFuel: { // COIL:GAS:HEATING // Determine the load required to pass to the Component controller QSupplyAir = MassFlow * CpAirZn * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCBVAV); QZnReq = state.dataSingleDuct->QZoneMax2SCBVAV - QSupplyAir; if (QZnReq < SmallLoad) QZnReq = 0.0; // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, QZnReq, this->ReheatComp_Index); + HeatingCoils::SimulateHeatingCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, QZnReq, this->ReheatCoilNum); } break; - case HeatingCoilType::Gas: { // COIL:GAS:HEATING - // Determine the load required to pass to the Component controller - QZnReq = state.dataSingleDuct->QZoneMax2SCBVAV - - MassFlow * CpAirZn * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCBVAV); - if (QZnReq < SmallLoad) QZnReq = 0.0; - // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, QZnReq, this->ReheatComp_Index); - } break; - case HeatingCoilType::None: { // blank + case HVAC::CoilType::Invalid: { // blank // If no reheat is defined then assume that the damper is the only component. // If something else is there that is not a reheat coil then give the error message below. } break; default: { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } break; } // the COIL is OFF the properties are calculated for this special case. } else { - switch (this->ReheatComp_Num) { - case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING + switch (this->reheatCoilType) { + case HVAC::CoilType::HeatingWater: { // COIL:WATER:SIMPLEHEATING // Simulate reheat coil for the Const Volume system // Node(sd_airterminal(SysNum)%ReheatControlNode)%MassFlowRate = 0.0D0 // Initialize hot water flow rate to zero. @@ -4507,26 +4349,26 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC // call the reheat coil with the NO FLOW condition to make sure that the Node values // are passed through to the coil outlet correctly - SimulateWaterCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index); + WaterCoils::SimulateWaterCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum); } break; - case HeatingCoilType::SteamAirHeating: { // COIL:STEAM:AIRHEATING + + case HVAC::CoilType::HeatingSteam: { // COIL:STEAM:AIRHEATING // Simulate reheat coil for the VAV system - SimulateSteamCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index, 0.0); + SteamCoils::SimulateSteamCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum, 0.0); } break; - case HeatingCoilType::Electric: { // COIL:ELECTRIC:HEATING + + case HVAC::CoilType::HeatingElectric: // COIL:ELECTRIC:HEATING + case HVAC::CoilType::HeatingGasOrOtherFuel: { // COIL:GAS:HEATING // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, 0.0, this->ReheatComp_Index); + HeatingCoils::SimulateHeatingCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, 0.0, this->ReheatCoilNum); } break; - case HeatingCoilType::Gas: { // COIL:GAS:HEATING - // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, 0.0, this->ReheatComp_Index); - } break; - case HeatingCoilType::None: { // blank + + case HVAC::CoilType::Invalid: { // blank // If no reheat is defined then assume that the damper is the only component. // If something else is there that is not a reheat coil then give the error message } break; default: { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } break; } } @@ -4555,7 +4397,6 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC // Using/Aliasing using namespace DataZoneEnergyDemands; using General::SolveRoot; - using SteamCoils::GetCoilCapacity; // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr BigLoad(1.0e+20); @@ -4582,7 +4423,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC Real64 QHeatFanOnMin; // min heating - fan at min flow, hot water at max flow [W] Real64 QHeatFanOffMax; // max heating - fan off, hot water flow at max [W] Real64 QNoHeatFanOff; // min heating - fan off, hot water at min flow [W] - HeatingCoilType HCType; // heating coil type + HVAC::CoilType heatCoilType; // heating coil type HVAC::FanType fanType; // fan type (as a number) int FanOp; // 1 if fan is on; 0 if off. Real64 MaxCoolMassFlow; // air flow at max cooling [kg/s] @@ -4600,7 +4441,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC SysOutletNode = this->ReheatAirOutletNode; SysInletNode = this->InletNodeNum; CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNodeNum).HumRat); - HCType = this->ReheatComp_Num; + heatCoilType = this->reheatCoilType; fanType = this->fanType; MaxCoolMassFlow = this->sd_airterminalInlet.AirMassFlowRateMaxAvail; MaxHeatMassFlow = min(this->HeatAirMassFlowRateMax, this->sd_airterminalInlet.AirMassFlowRateMaxAvail); @@ -4615,7 +4456,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC return; } - if (HCType == HeatingCoilType::SimpleHeating) { + if (heatCoilType == HVAC::CoilType::HeatingWater) { WaterControlNode = this->ReheatControlNode; if (FirstHVACIteration) { MaxFlowWater = this->MaxReheatWaterFlow; @@ -4631,7 +4472,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC MinFlowWater = 0.0; } - if (HCType == HeatingCoilType::SteamAirHeating) { + if (heatCoilType == HVAC::CoilType::HeatingSteam) { SteamControlNode = this->ReheatControlNode; if (FirstHVACIteration) { MaxFlowSteam = this->MaxReheatSteamFlow; @@ -4649,13 +4490,13 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC // define 3 load regions and assign the current load to the correct region. // region 1: active cooling with fan on FanOp = 1; - if (HCType == HeatingCoilType::SteamAirHeating) { + if (heatCoilType == HVAC::CoilType::HeatingSteam) { bool ErrorsFound; // returned from mining function call this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowSteam, 0.0, fanType, MaxCoolMassFlow, FanOp, QCoolFanOnMax); this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowSteam, 0.0, fanType, MinMassFlow, FanOp, QCoolFanOnMin); // region 2: active heating with fan on this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MaxFlowSteam, BigLoad, fanType, MaxHeatMassFlow, FanOp, QHeatFanOnMax); - MaxSteamCap = GetCoilCapacity(state, this->ReheatComp, this->ReheatName, ErrorsFound); + MaxSteamCap = SteamCoils::GetCoilCapacity(state, this->ReheatCoilNum); this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MaxFlowSteam, 0.0, fanType, MinMassFlow, FanOp, QHeatFanOnMin); // region 3: active heating with fan off FanOp = 0; @@ -4679,7 +4520,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC // check that it can meet the load FanOp = 1; if (QCoolFanOnMax < QTotLoad - SmallLoad) { - Real64 MinHWFlow = (HCType == HeatingCoilType::SteamAirHeating) ? MinFlowSteam : MinFlowWater; + Real64 MinHWFlow = (heatCoilType == HVAC::CoilType::HeatingSteam) ? MinFlowSteam : MinFlowWater; auto f = [&state, this, FirstHVACIteration, ZoneNodeNum, MinHWFlow, fanType, FanOp, QTotLoad](Real64 const SupplyAirMassFlow) { Real64 UnitOutput = 0.0; // cooling output [W] (cooling is negative) @@ -4710,7 +4551,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC MassFlow = MaxCoolMassFlow; - if (HCType == HeatingCoilType::SteamAirHeating) { + if (heatCoilType == HVAC::CoilType::HeatingSteam) { this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowSteam, 0.0, fanType, MassFlow, FanOp, QDelivered); } else { this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowWater, 0.0, fanType, MassFlow, FanOp, QDelivered); @@ -4723,7 +4564,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC (this->sd_airterminalInlet.AirMassFlowRateMaxAvail > 0.0 && state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum))) { MassFlow = MinMassFlow; FanOp = 0; - if (HCType == HeatingCoilType::SteamAirHeating) { + if (heatCoilType == HVAC::CoilType::HeatingSteam) { this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowSteam, QTotLoad, fanType, MassFlow, FanOp, QNoHeatFanOff); } else { this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowWater, 0.0, fanType, MassFlow, FanOp, QNoHeatFanOff); @@ -4733,7 +4574,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC } else if (QTotLoad > QNoHeatFanOff + SmallLoad && this->sd_airterminalInlet.AirMassFlowRateMaxAvail > 0.0 && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { // hot water coil - if (HCType == HeatingCoilType::SimpleHeating) { + if (heatCoilType == HVAC::CoilType::HeatingWater) { if (QTotLoad < QHeatFanOffMax - SmallLoad) { // vary HW flow, leave air flow at minimum ErrTolerance = this->ControllerOffset; @@ -4795,7 +4636,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC FanOp = 1; this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MaxFlowWater, 0.0, fanType, MassFlow, FanOp, QDelivered); } - } else if (HCType == HeatingCoilType::SteamAirHeating) { + } else if (heatCoilType == HVAC::CoilType::HeatingSteam) { // IF (QTotLoad > QNoHeatFanOff + SmallLoad .AND. QTotLoad < QHeatFanOffMax - SmallLoad) THEN if (QTotLoad < QHeatFanOffMax - SmallLoad) { ErrTolerance = this->ControllerOffset; @@ -4865,7 +4706,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC FanOp = 1; this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, QTotLoad, QTotLoad, fanType, MassFlow, FanOp, QDelivered); } - } else if (HCType == HeatingCoilType::Gas || HCType == HeatingCoilType::Electric) { + } else if (heatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel || heatCoilType == HVAC::CoilType::HeatingElectric) { if (QTotLoad <= QHeatFanOnMin + SmallLoad) { // vary heating coil power, leave mass flow at minimum MassFlow = MinMassFlow; @@ -4914,7 +4755,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, 0.0, QTotLoad, fanType, MassFlow, FanOp, QDelivered); } } else { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } } else { @@ -4953,10 +4794,7 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH // Using/Aliasing using namespace DataZoneEnergyDemands; // unused USE DataHeatBalFanSys, ONLY: Mat - using HeatingCoils::SimulateHeatingCoilComponents; using PlantUtilities::SetActuatedBranchFlowRate; - using SteamCoils::SimulateSteamCoilComponents; - using WaterCoils::SimulateWaterCoilComponents; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 MaxFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not @@ -5002,8 +4840,8 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleCooling)) { Real64 QZnReq; // [Watts] - switch (this->ReheatComp_Num) { - case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING + switch (this->reheatCoilType) { + case HVAC::CoilType::HeatingWater: { // COIL:WATER:SIMPLEHEATING // Determine the load required to pass to the Component controller QZnReq = state.dataSingleDuct->QMax2SCV + MassFlow * CpAir * state.dataSingleDuct->ZoneTempSCV; @@ -5028,9 +4866,9 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH // Simulate reheat coil for the Const Volume system // Set Converged to True & when controller is not converged it will set to False. ControlCompOutput(state, - this->ReheatName, - this->ReheatComp, - this->ReheatComp_Index, + this->ReheatCoilName, + HVAC::coilTypeNames[(int)this->reheatCoilType], + this->ReheatCoilNum, FirstHVACIteration, QZnReq, this->ReheatControlNode, @@ -5047,37 +4885,33 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH this->HWplantLoc); } break; - case HeatingCoilType::SteamAirHeating: { // COIL:STEAM:STEAMAIRHEATING + case HVAC::CoilType::HeatingSteam: { // COIL:STEAM:STEAMAIRHEATING // Determine the load required to pass to the Component controller QZnReq = state.dataSingleDuct->QMax2SCV - MassFlow * CpAir * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCV); // Simulate reheat coil for the VAV system - SimulateSteamCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index, QZnReq); + SteamCoils::SimulateSteamCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum, QZnReq); } break; - case HeatingCoilType::Electric: { // COIL:ELECTRIC:HEATING + + case HVAC::CoilType::HeatingElectric: // COIL:ELECTRIC:HEATING + case HVAC::CoilType::HeatingGasOrOtherFuel: { // COIL:GAS:HEATING // Determine the load required to pass to the Component controller QZnReq = state.dataSingleDuct->QMax2SCV - MassFlow * CpAir * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCV); // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, QZnReq, this->ReheatComp_Index); + HeatingCoils::SimulateHeatingCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, QZnReq, this->ReheatCoilNum); } break; - case HeatingCoilType::Gas: { // COIL:GAS:HEATING - // Determine the load required to pass to the Component controller - QZnReq = state.dataSingleDuct->QMax2SCV - MassFlow * CpAir * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCV); - // Simulate reheat coil for the VAV system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, QZnReq, this->ReheatComp_Index); - } break; default: { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } break; } // the COIL is OFF the properties are calculated for this special case. } else { - switch (this->ReheatComp_Num) { - case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING + switch (this->reheatCoilType) { + case HVAC::CoilType::HeatingWater: { // COIL:WATER:SIMPLEHEATING // Simulate reheat coil for the Const Volume system // Node(sd_airterminal(SysNum)%ReheatControlNode)%MassFlowRate = 0.0D0 // Initialize hot water flow rate to zero. @@ -5086,22 +4920,22 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH // call the reheat coil with the NO FLOW condition to make sure that the Node values // are passed through to the coil outlet correctly - SimulateWaterCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index); - } break; - case HeatingCoilType::SteamAirHeating: { // COIL:STEAM:AIRHEATING - // Simulate reheat coil for the Const Volume system - SimulateSteamCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index, 0.0); + WaterCoils::SimulateWaterCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum); } break; - case HeatingCoilType::Electric: { // COIL:ELECTRIC:HEATING + + case HVAC::CoilType::HeatingSteam: { // COIL:STEAM:AIRHEATING // Simulate reheat coil for the Const Volume system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, 0.0, this->ReheatComp_Index); + SteamCoils::SimulateSteamCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum, 0.0); } break; - case HeatingCoilType::Gas: { // COIL:GAS:HEATING + + case HVAC::CoilType::HeatingElectric: // COIL:ELECTRIC:HEATING + case HVAC::CoilType::HeatingGasOrOtherFuel: { // COIL:GAS:HEATING // Simulate reheat coil for the Const Volume system - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, 0.0, this->ReheatComp_Index); + HeatingCoils::SimulateHeatingCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, 0.0, this->ReheatCoilNum); } break; + default: { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } break; } } @@ -5142,10 +4976,7 @@ void SingleDuctAirTerminal::CalcVAVVS(EnergyPlusData &state, // Simulates the unit components sequentially in the air flow direction. // Using/Aliasing - using HeatingCoils::SimulateHeatingCoilComponents; using PlantUtilities::SetComponentFlowRate; - using SteamCoils::SimulateSteamCoilComponents; - using WaterCoils::SimulateWaterCoilComponents; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int FanInNode; // unit air inlet node (fan inlet) @@ -5176,30 +5007,31 @@ void SingleDuctAirTerminal::CalcVAVVS(EnergyPlusData &state, state.dataLoopNodes->Node(FanOutNode).MassFlowRateMaxAvail = state.dataLoopNodes->Node(FanInNode).MassFlowRateMaxAvail; state.dataLoopNodes->Node(FanOutNode).MassFlowRateMinAvail = state.dataLoopNodes->Node(FanInNode).MassFlowRateMinAvail; } - switch (this->ReheatComp_Num) { - case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING + + switch (this->reheatCoilType) { + case HVAC::CoilType::HeatingWater: { // COIL:WATER:SIMPLEHEATING mdot = HWFlow; if (this->HWplantLoc.loopNum > 0) { SetComponentFlowRate(state, mdot, this->ReheatControlNode, this->ReheatCoilOutletNode, this->HWplantLoc); } - SimulateWaterCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index); + WaterCoils::SimulateWaterCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum); } break; - case HeatingCoilType::SteamAirHeating: { // HW Flow is steam mass flow here + + case HVAC::CoilType::HeatingSteam: { // HW Flow is steam mass flow here mdot = HWFlow; if (this->HWplantLoc.loopNum > 0) { SetComponentFlowRate(state, mdot, this->ReheatControlNode, this->ReheatCoilOutletNode, this->HWplantLoc); } - SimulateSteamCoilComponents(state, this->ReheatName, FirstHVACIteration, this->ReheatComp_Index, HCoilReq); - } break; - case HeatingCoilType::Electric: { // COIL:ELECTRIC:HEATING - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, HCoilReq, this->ReheatComp_Index); + SteamCoils::SimulateSteamCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, this->ReheatCoilNum, HCoilReq); } break; - case HeatingCoilType::Gas: { // COIL:GAS:HEATING - SimulateHeatingCoilComponents(state, this->ReheatName, FirstHVACIteration, HCoilReq, this->ReheatComp_Index); + + case HVAC::CoilType::HeatingElectric: // COIL:ELECTRIC:HEATING + case HVAC::CoilType::HeatingGasOrOtherFuel: { // COIL:GAS:HEATING + HeatingCoils::SimulateHeatingCoilComponents(state, this->ReheatCoilName, FirstHVACIteration, HCoilReq, this->ReheatCoilNum); } break; default: { - ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatComp)); + ShowFatalError(state, format("Invalid Reheat Component={}", this->ReheatCoilName)); } break; } @@ -6200,7 +6032,7 @@ void SingleDuctAirTerminal::reportTerminalUnit(EnergyPlusData &state) if (minOAsch > 0) schName = ScheduleManager::GetScheduleName(state, minOAsch); } OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMinOAflowSch, adu.Name, schName); - OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermHeatCoilType, adu.Name, this->ReheatComp); + OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermHeatCoilType, adu.Name, HVAC::coilTypeNames[(int)this->reheatCoilType]); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermCoolCoilType, adu.Name, "n/a"); if ((int)this->fanType >= 0) { OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermFanType, adu.Name, HVAC::fanTypeNames[(int)this->fanType]); diff --git a/src/EnergyPlus/SingleDuct.hh b/src/EnergyPlus/SingleDuct.hh index 75f2ed7af63..4a10e6b7486 100644 --- a/src/EnergyPlus/SingleDuct.hh +++ b/src/EnergyPlus/SingleDuct.hh @@ -91,16 +91,7 @@ namespace SingleDuct { SingleDuctCBVAVNoReheat, Num, }; - enum class HeatingCoilType : int - { - Invalid = -1, - None, - Gas, - Electric, - SimpleHeating, - SteamAirHeating, - Num, - }; + enum class MinFlowFraction { Invalid = -1, @@ -137,11 +128,12 @@ namespace SingleDuct { SysType SysType_Num; // Numeric Equivalent for System type std::string Schedule; // Sys Operation Schedule int SchedPtr; // Pointer to the correct schedule - std::string ReheatComp; // Type of the Reheat Coil Object - HeatingCoilType ReheatComp_Num; // Numeric Equivalent in this module for Coil type - int ReheatComp_Index; // Returned Index number from other routines - std::string ReheatName; // name of reheat coil - DataPlant::PlantEquipmentType ReheatComp_PlantType; // typeOf_ number for plant type of heating coil + + HVAC::CoilType reheatCoilType = HVAC::CoilType::Invalid; // Coil type + int ReheatCoilNum = 0; // Returned Index number from other routines + std::string ReheatCoilName; // name of reheat coil + DataPlant::PlantEquipmentType ReheatCoil_PlantType = DataPlant::PlantEquipmentType::Invalid; // plant type of heating coil + HVAC::FanType fanType; // Numeric Equivalent in this module for fan type int Fan_Index; // Returned Index number from other routines int ControlCompTypeNum; @@ -222,8 +214,8 @@ namespace SingleDuct { // Default Constructor SingleDuctAirTerminal() - : SysNum(-1), SysType_Num(SysType::Invalid), SchedPtr(0), ReheatComp_Num(HeatingCoilType::None), ReheatComp_Index(0), - ReheatComp_PlantType(DataPlant::PlantEquipmentType::Invalid), fanType(HVAC::FanType::Invalid), Fan_Index(0), ControlCompTypeNum(0), + : SysNum(-1), SysType_Num(SysType::Invalid), SchedPtr(0), + fanType(HVAC::FanType::Invalid), Fan_Index(0), ControlCompTypeNum(0), CompErrIndex(0), MaxAirVolFlowRate(0.0), AirMassFlowRateMax(0.0), MaxHeatAirVolFlowRate(0.0), HeatAirMassFlowRateMax(0.0), ZoneMinAirFracMethod(MinFlowFraction::Constant), ZoneMinAirFracDes(0.0), ZoneMinAirFrac(0.0), ZoneMinAirFracReport(0.0), ZoneFixedMinAir(0.0), ZoneMinAirFracSchPtr(0), ConstantMinAirFracSetByUser(false), FixedMinAirSetByUser(false), DesignMinAirFrac(0.0), diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index d81838d09e7..99ded7281be 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -889,7 +889,7 @@ namespace StandardRatings { EnergyPlusData &state, std::string const &DXCoilName, // Name of DX coil for which HSPF is calculated std::string const &DXCoilType, // Type of DX coil for which HSPF is calculated - int const DXCoilType_Num, // Integer Type of DX coil - heating or cooling + HVAC::CoilType coilType, // Integer Type of DX coil - heating or cooling int const ns, // Number of compressor speeds Array1A const RatedTotalCapacity, // Reference capacity of DX coil [W] Array1A const RatedCOP, // Reference coefficient of performance [W/W] @@ -1024,11 +1024,6 @@ namespace StandardRatings { // Using/Aliasing using Curve::CurveValue; using Curve::GetCurveMinMaxValues; - using HVAC::Coil_CoolingAirToAirVariableSpeed; - using HVAC::CoilDX_CoolingSingleSpeed; - using HVAC::CoilDX_HeatingEmpirical; - using HVAC::CoilDX_MultiSpeedCooling; - using HVAC::CoilDX_MultiSpeedHeating; // Argument array dimensioning RatedTotalCapacity.dim(ns); @@ -1096,14 +1091,14 @@ namespace StandardRatings { NetCoolingCapRated = 0.0; - switch (DXCoilType_Num) { + switch (coilType) { - case CoilDX_CoolingSingleSpeed: { // Coil:Cooling:DX:SingleSpeed + case HVAC::CoilType::DXCoolingSingleSpeed: { // Coil:Cooling:DX:SingleSpeed CheckCurveLimitsForStandardRatings(state, DXCoilName, DXCoilType, - DXCoilType_Num, + coilType, CapFTempCurveIndex(1), CapFFlowCurveIndex(1), EIRFTempCurveIndex(1), @@ -1141,7 +1136,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated(1), SEER_User * ConvFromSIToIP, SEER_Standard * ConvFromSIToIP, @@ -1160,7 +1155,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated_2023(1), SEER2_User * ConvFromSIToIP, SEER2_Standard * ConvFromSIToIP, @@ -1188,16 +1183,16 @@ namespace StandardRatings { FanPowerPerEvapAirFlowRateFromInput(1), NetTotCoolingCapRated, TotElectricPowerRated); - ReportDXCoolCoilDataCenterApplication(state, DXCoilType, DXCoilName, DXCoilType_Num, NetTotCoolingCapRated, TotElectricPowerRated); + ReportDXCoolCoilDataCenterApplication(state, DXCoilType, DXCoilName, coilType, NetTotCoolingCapRated, TotElectricPowerRated); } break; } - case CoilDX_HeatingEmpirical: { // Coil:Heating:DX:SingleSpeed + case HVAC::CoilType::DXHeatingEmpirical: { // Coil:Heating:DX:SingleSpeed CheckCurveLimitsForStandardRatings(state, DXCoilName, DXCoilType, - DXCoilType_Num, + coilType, CapFTempCurveIndex(1), CapFFlowCurveIndex(1), EIRFTempCurveIndex(1), @@ -1233,7 +1228,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated(1), SEER_User * ConvFromSIToIP, SEER_Standard * ConvFromSIToIP, @@ -1251,7 +1246,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated_2023(1), SEER2_User * ConvFromSIToIP, SEER2_Standard * ConvFromSIToIP, @@ -1265,13 +1260,14 @@ namespace StandardRatings { true); break; } - case CoilDX_MultiSpeedCooling: { // Coil:Cooling:DX:MultiSpeed, + + case HVAC::CoilType::DXMultiSpeedCooling: { // Coil:Cooling:DX:MultiSpeed, for (spnum = 1; spnum <= ns; ++spnum) { CheckCurveLimitsForStandardRatings(state, DXCoilName, DXCoilType, - DXCoilType_Num, + coilType, CapFTempCurveIndex(spnum), CapFFlowCurveIndex(spnum), EIRFTempCurveIndex(spnum), @@ -1311,7 +1307,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated(ns), SEER_User * ConvFromSIToIP, SEER_Standard * ConvFromSIToIP, @@ -1328,7 +1324,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated_2023(ns), SEER2_User * ConvFromSIToIP, SEER2_Standard * ConvFromSIToIP, @@ -1343,13 +1339,13 @@ namespace StandardRatings { break; } - case CoilDX_MultiSpeedHeating: { // Coil:Heating:DX:MultiSpeed + case HVAC::CoilType::DXMultiSpeedHeating: { // Coil:Heating:DX:MultiSpeed for (spnum = 1; spnum <= ns; ++spnum) { CheckCurveLimitsForStandardRatings(state, DXCoilName, DXCoilType, - DXCoilType_Num, + coilType, CapFTempCurveIndex(spnum), CapFFlowCurveIndex(spnum), EIRFTempCurveIndex(spnum), @@ -1391,7 +1387,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated(ns), SEER_User * ConvFromSIToIP, SEER_Standard * ConvFromSIToIP, @@ -1409,7 +1405,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated(ns), SEER_User * ConvFromSIToIP, SEER_Standard * ConvFromSIToIP, @@ -1424,12 +1420,12 @@ namespace StandardRatings { break; } - case Coil_CoolingAirToAirVariableSpeed: { + case HVAC::CoilType::CoolingAirToAirVariableSpeed: { for (spnum = 1; spnum <= ns; ++spnum) { CheckCurveLimitsForStandardRatings(state, DXCoilName, DXCoilType, - DXCoilType_Num, + coilType, CapFTempCurveIndex(spnum), CapFFlowCurveIndex(spnum), EIRFTempCurveIndex(spnum), @@ -1470,7 +1466,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated_2023(ns), SEER2_User * ConvFromSIToIP, SEER2_Standard * ConvFromSIToIP, @@ -1492,7 +1488,7 @@ namespace StandardRatings { void CalcTwoSpeedDXCoilRating(EnergyPlusData &state, std::string const &DXCoilName, std::string const &DXCoilType, - int const DXCoilType_Num, + HVAC::CoilType const coilType, Array1A const &RatedTotalCapacity, Real64 const RatedTotCap2, Array1A const &RatedCOP, @@ -1529,7 +1525,7 @@ namespace StandardRatings { StandardRatingsResult = TwoSpeedDXCoilStandardRatings(state, DXCoilName, DXCoilType, - DXCoilType_Num, + coilType, RatedTotalCapacity, RatedTotCap2, RatedCOP, @@ -1571,7 +1567,7 @@ namespace StandardRatings { ReportDXCoilRating(state, DXCoilType, DXCoilName, - DXCoilType_Num, + coilType, NetCoolingCapRated, SEER2_User * ConvFromSIToIP, SEER2_Standard * ConvFromSIToIP, @@ -1588,9 +1584,9 @@ namespace StandardRatings { std::map TwoSpeedDXCoilStandardRatings(EnergyPlusData &state, std::string const &DXCoilName, std::string const &DXCoilType, - int const &DXCoilType_Num, + HVAC::CoilType const coilType, Array1A const &RatedTotalCapacity, - Real64 const &RatedTotCap2, + Real64 const &RatedTotCap2, // What is the point of passing a scalar by const &? Array1A const &RatedCOP, Real64 const &RatedCOP2, Array1A_int const &CapFFlowCurveIndex, // only hs @@ -1652,7 +1648,7 @@ namespace StandardRatings { CheckCurveLimitsForStandardRatings(state, DXCoilName, DXCoilType, - DXCoilType_Num, + coilType, TSCCapFTemp(spnum), CapFFlowCurveIndex(1), // only HS TSEIRFTemp(spnum), @@ -6689,7 +6685,7 @@ namespace StandardRatings { void ReportDXCoilRating(EnergyPlusData &state, std::string const &CompType, // Type of component std::string_view CompName, // Name of component - int const CompTypeNum, // TypeNum of component + HVAC::CoilType coilType, Real64 const CoolCapVal, // Standard total (net) cooling capacity for AHRI Std. 210/240 {W} Real64 const SEERUserIP, // SEER value in IP units from user PLR curve {Btu/W-h} Real64 const SEERStandardIP, // SEER value in IP units from AHRI Std 210/240-2008 default PLF curve and C_D {Btu/W-h} @@ -6723,13 +6719,6 @@ namespace StandardRatings { // Using/Aliasing using namespace OutputReportPredefined; - using HVAC::Coil_CoolingAirToAirVariableSpeed; - using HVAC::CoilDX_CoolingSingleSpeed; - using HVAC::CoilDX_CoolingTwoSpeed; - using HVAC::CoilDX_HeatingEmpirical; - using HVAC::CoilDX_MultiSpeedCooling; - using HVAC::CoilDX_MultiSpeedHeating; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // or ANSI/AHRI Std. 340/360 {W} @@ -6747,9 +6736,9 @@ namespace StandardRatings { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - switch (CompTypeNum) { + switch (coilType) { - case CoilDX_CoolingSingleSpeed: { + case HVAC::CoilType::DXCoolingSingleSpeed: { if (!AHRI2023StandardRatings) { if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag) { static constexpr std::string_view Format_994( @@ -6868,8 +6857,9 @@ namespace StandardRatings { } break; } - case CoilDX_HeatingEmpirical: - case CoilDX_MultiSpeedHeating: { + + case HVAC::CoilType::DXHeatingEmpirical: + case HVAC::CoilType::DXMultiSpeedHeating: { if (!AHRI2023StandardRatings) { if (state.dataHVACGlobal->StandardRatingsMyHeatOneTimeFlag) { static constexpr std::string_view Format_992( @@ -6918,9 +6908,10 @@ namespace StandardRatings { } break; } - case CoilDX_CoolingTwoSpeed: - case Coil_CoolingAirToAirVariableSpeed: - case CoilDX_MultiSpeedCooling: { + + case HVAC::CoilType::DXCoolingTwoSpeed: + case HVAC::CoilType::CoolingAirToAirVariableSpeed: + case HVAC::CoilType::DXMultiSpeedCooling: { if (!AHRI2023StandardRatings) { if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag) { static constexpr std::string_view Format_994( @@ -7045,7 +7036,7 @@ namespace StandardRatings { void ReportDXCoolCoilDataCenterApplication(EnergyPlusData &state, std::string const &CompType, // Type of component std::string_view CompName, // Name of component - int const CompTypeNum, // TypeNum of component + HVAC::CoilType const coilType, // TypeNum of component Array1D &NetCoolingCapRated, // net cooling capacity of single speed DX cooling coil Array1D &TotElectricPowerRated // total electric power including supply fan ) @@ -7073,9 +7064,8 @@ namespace StandardRatings { // Using/Aliasing using namespace OutputReportPredefined; - using HVAC::CoilDX_CoolingSingleSpeed; - if (CompTypeNum == CoilDX_CoolingSingleSpeed) { + if (coilType == HVAC::CoilType::DXCoolingSingleSpeed) { if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag3) { static constexpr std::string_view Format_101( "! , Component Type, Component Name, Standard 127 " @@ -7132,7 +7122,7 @@ namespace StandardRatings { void CheckCurveLimitsForStandardRatings(EnergyPlusData &state, std::string const &DXCoilName, // Name of DX coil for which HSPF is calculated std::string const &DXCoilType, // Type of DX coil - heating or cooling - int const DXCoilTypeNum, // Integer type of DX coil - heating or cooling + HVAC::CoilType coilType, // Integer type of DX coil - heating or cooling int const CapFTempCurveIndex, // Index for the capacity as a function of temperature modifier curve int const CapFFlowCurveIndex, // Index for the capacity as a function of flow fraction modifier curve int const EIRFTempCurveIndex, // Index for the EIR as a function of temperature modifier curve @@ -7162,10 +7152,6 @@ namespace StandardRatings { using Curve::GetCurveIndex; using Curve::GetCurveMinMaxValues; using Curve::GetCurveName; - using HVAC::CoilDX_CoolingSingleSpeed; - using HVAC::CoilDX_HeatingEmpirical; - using HVAC::CoilDX_MultiSpeedCooling; - using HVAC::CoilDX_MultiSpeedHeating; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -7228,9 +7214,9 @@ namespace StandardRatings { bool HeatingEIRCurveHSPFLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded // (HSPF calcs) - switch (DXCoilTypeNum) { + switch (coilType) { - case CoilDX_CoolingSingleSpeed: { + case HVAC::CoilType::DXCoolingSingleSpeed: { bool CapCurveMidOATLimitsExceeded = false; // Logical for capacity curve temperature limits being exceeded (mid temp) bool EIRCurveMidOATLimitsExceeded = false; // Logical for EIR curve temperature limits being exceeded (mid temp) bool PLFfPLRforSEERLimitsExceeded = false; // Logical for PLF function of PLR limits being exceeded @@ -7452,7 +7438,7 @@ namespace StandardRatings { } // End of curve error messages break; } - case CoilDX_HeatingEmpirical: { + case HVAC::CoilType::DXHeatingEmpirical: { { if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex)->numDims == 1) { GetCurveMinMaxValues(state, CapFTempCurveIndex, HeatingCapODBTempMin, HeatingCapODBTempMax); @@ -7534,7 +7520,8 @@ namespace StandardRatings { // MultiSpeed DX Coil Net Cooling Capacity and SEER: break; } - case CoilDX_MultiSpeedCooling: { + + case HVAC::CoilType::DXMultiSpeedCooling: { bool CapCurveLowOATLimitsExceeded = false; // Logical for capacity curve temperature limits being exceeded (low temp) bool EIRCurveLowOATLimitsExceeded = false; // Logical for EIR curve temperature limits being exceeded (Low temp) @@ -7657,7 +7644,8 @@ namespace StandardRatings { break; } - case CoilDX_MultiSpeedHeating: { + + case HVAC::CoilType::DXMultiSpeedHeating: { bool CapCurveOATLimitsExceeded = false; // Logical for capacity curve OD temp. limits being exceeded (low and High) { diff --git a/src/EnergyPlus/StandardRatings.hh b/src/EnergyPlus/StandardRatings.hh index 4240c067de3..da1ea8b81b9 100644 --- a/src/EnergyPlus/StandardRatings.hh +++ b/src/EnergyPlus/StandardRatings.hh @@ -193,10 +193,11 @@ namespace StandardRatings { Array1D const &CondenserType, int const PLFFPLRCurveIndex); + // Why are all parameters passed by reference? std::map TwoSpeedDXCoilStandardRatings(EnergyPlusData &state, std::string const &DXCoilName, std::string const &DXCoilType, - int const &DXCoilType_Num, + HVAC::CoilType const coilType, Array1A const &RatedTotalCapacity, Real64 const &RatedTotCap2, Array1A const &RatedCOP, @@ -633,7 +634,7 @@ namespace StandardRatings { void ReportDXCoilRating(EnergyPlusData &state, std::string const &CompType, // Type of component std::string_view CompName, // Name of component - int const CompTypeNum, // TypeNum of component + HVAC::CoilType coilType, // TypeNum of component Real64 const CoolCapVal, // Standard total (net) cooling capacity for AHRI Std. 210/240 {W} Real64 const SEERValueIP, // SEER value in IP units from user PLR curve {Btu/W-h} Real64 const SEERValueDefaultIP, // SEER value in IP units from AHRI Std 210/240-2008 default PLF curve and C_D {Btu/W-h} @@ -649,7 +650,7 @@ namespace StandardRatings { void ReportDXCoolCoilDataCenterApplication(EnergyPlusData &state, std::string const &CompType, // Type of component std::string_view CompName, // Name of component - int const CompTypeNum, // TypeNum of component + HVAC::CoilType const coilType, // TypeNum of component Array1D &NetCoolingCapRated, // net cooling capacity of single speed DX cooling coil Array1D &TotElectricPowerRated // total electric power including supply fan ); @@ -657,7 +658,7 @@ namespace StandardRatings { void CheckCurveLimitsForStandardRatings(EnergyPlusData &state, std::string const &DXCoilName, // Name of DX coil for which HSPF is calculated std::string const &DXCoilType, // Type of DX coil - heating or cooling - int const DXCoilTypeNum, // Integer type of DX coil - heating or cooling + HVAC::CoilType coilType, // Integer type of DX coil - heating or cooling int const CapFTempCurveIndex, // Index for the capacity as a function of temperature modifier curve int const CapFFlowCurveIndex, // Index for the capacity as a function of flow fraction modifier curve int const EIRFTempCurveIndex, // Index for the EIR as a function of temperature modifier curve diff --git a/src/EnergyPlus/SteamCoils.cc b/src/EnergyPlus/SteamCoils.cc index 25220025704..fd02807f608 100644 --- a/src/EnergyPlus/SteamCoils.cc +++ b/src/EnergyPlus/SteamCoils.cc @@ -828,7 +828,7 @@ namespace SteamCoils { state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( state, state.dataSteamCoils->SteamCoil(CoilNum).Name, - "Coil:Heating:Steam", + state.dataSteamCoils->SteamCoil(CoilNum).coilType, state.dataFans->fans(state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanNum)->Name, state.dataFans->fans(state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanNum)->type, state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanNum); @@ -908,7 +908,7 @@ namespace SteamCoils { state.dataRptCoilSelection->coilSelectionReportObj->setCoilHeatingCapacity(state, state.dataSteamCoils->SteamCoil(CoilNum).Name, - "Coil:Heating:Steam", + state.dataSteamCoils->SteamCoil(CoilNum).coilType, DesCoilLoad, coilWasAutosized, state.dataSize->CurSysNum, @@ -920,7 +920,7 @@ namespace SteamCoils { -999.0); state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterFlowNodeNums(state, state.dataSteamCoils->SteamCoil(CoilNum).Name, - "Coil:Heating:Steam", + state.dataSteamCoils->SteamCoil(CoilNum).coilType, state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamVolFlowRate, coilWasAutosized, state.dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum, @@ -929,23 +929,23 @@ namespace SteamCoils { state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterHeaterCapacityNodeNums( state, state.dataSteamCoils->SteamCoil(CoilNum).Name, - "Coil:Heating:Steam", + state.dataSteamCoils->SteamCoil(CoilNum).coilType, DesCoilLoad, coilWasAutosized, state.dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum, state.dataSteamCoils->SteamCoil(CoilNum).SteamOutletNodeNum, state.dataSteamCoils->SteamCoil(CoilNum).plantLoc.loopNum); state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp( - state, state.dataSteamCoils->SteamCoil(CoilNum).Name, "Coil:Heating:Steam", TempSteamIn); // coil report + state, state.dataSteamCoils->SteamCoil(CoilNum).Name, state.dataSteamCoils->SteamCoil(CoilNum).coilType, TempSteamIn); // coil report state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgWaterTemp( state, state.dataSteamCoils->SteamCoil(CoilNum).Name, - "Coil:Heating:Steam", + state.dataSteamCoils->SteamCoil(CoilNum).coilType, TempSteamIn - state.dataSteamCoils->SteamCoil(CoilNum).DegOfSubcooling); // coil report state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterDeltaT( state, state.dataSteamCoils->SteamCoil(CoilNum).Name, - "Coil:Heating:Steam", + state.dataSteamCoils->SteamCoil(CoilNum).coilType, state.dataSteamCoils->SteamCoil(CoilNum).DegOfSubcooling); // coil report state.dataSteamCoils->SteamCoil(CoilNum).DesCoilCapacity = DesCoilLoad; state.dataSteamCoils->SteamCoil(CoilNum).DesAirVolFlow = DesVolFlow; @@ -956,7 +956,7 @@ namespace SteamCoils { // There is no standard rating for heating coils at this point, so fill with dummy flag values state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions(state, state.dataSteamCoils->SteamCoil(CoilNum).Name, - "Coil:Heating:Steam", + state.dataSteamCoils->SteamCoil(CoilNum).coilType, -999.0, -999.0, -999.0, diff --git a/src/EnergyPlus/SteamCoils.hh b/src/EnergyPlus/SteamCoils.hh index 6211aa454de..c763e13a0c5 100644 --- a/src/EnergyPlus/SteamCoils.hh +++ b/src/EnergyPlus/SteamCoils.hh @@ -78,6 +78,8 @@ namespace SteamCoils { { // Members std::string Name; // Name of the SteamCoil + HVAC::CoilType coilType = HVAC::CoilType::HeatingSteam; + std::string SteamCoilTypeA; // Type of SteamCoil ie. Heating or Cooling int SteamCoilType; // Type of SteamCoil ie. Heating or Cooling int SteamCoilModel; // Type of SteamCoil ie. Simple, Detailed, etc. @@ -184,6 +186,11 @@ namespace SteamCoils { std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + + int GetSteamCoilIndex(EnergyPlusData &state, + std::string const &CoilName + ); + int GetCompIndex(EnergyPlusData &state, std::string_view coilName); void CheckSteamCoilSchedule(EnergyPlusData &state, std::string const &CompType, std::string_view CompName, Real64 &Value, int &CompIndex); @@ -195,8 +202,7 @@ namespace SteamCoils { ); Real64 GetCoilMaxSteamFlowRate(EnergyPlusData &state, - int CoilIndex, // must match coil types in this module - bool &ErrorsFound // set to true if problem + int const coilNum ); int GetCoilAirInletNode(EnergyPlusData &state, @@ -205,10 +211,12 @@ namespace SteamCoils { bool &ErrorsFound // set to true if problem ); + int GetCoilAirInletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilAirOutletNode(EnergyPlusData &state, - int CoilIndex, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + int const coilNum ); int GetCoilAirOutletNode(EnergyPlusData &state, @@ -217,12 +225,21 @@ namespace SteamCoils { bool &ErrorsFound // set to true if problem ); + int GetCoilAirOutletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilSteamInletNode(EnergyPlusData &state, int CoilIndex, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilSteamInletNode(EnergyPlusData &state, + int const coilNum + ); + + int GetCoilSteamInletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -235,6 +252,10 @@ namespace SteamCoils { bool &ErrorsFound // set to true if problem ); + int GetCoilSteamOutletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilSteamOutletNode(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -247,6 +268,10 @@ namespace SteamCoils { bool &ErrorsFound // set to true if problem ); + Real64 GetCoilCapacity(EnergyPlusData &state, + int const coilNum + ); + CoilControlType GetTypeOfCoil(EnergyPlusData &state, int CoilIndex, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -259,6 +284,10 @@ namespace SteamCoils { bool &ErrorFlag // set to true if problem ); + int GetSteamCoilControlNodeNum(EnergyPlusData &state, + int const coilNum + ); + int GetSteamCoilAvailScheduleIndex(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index 2f618174962..b1f94557d35 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -221,6 +221,8 @@ namespace UnitHeater { int CtrlZone; // index to loop counter int NodeNum; // index to loop counter + auto &s_node = state.dataLoopNodes; + // Figure out how many unit heaters there are in the input file std::string CurrentModuleObject = state.dataUnitHeaters->cMO_UnitHeater; state.dataUnitHeaters->NumOfUnitHeats = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); @@ -353,51 +355,45 @@ namespace UnitHeater { } // Heating coil information: - { - unitHeat.Type = static_cast(getEnumValue(HCoilTypeNamesUC, Util::makeUPPER(Alphas(7)))); - switch (unitHeat.Type) { - case HCoilType::WaterHeatingCoil: - unitHeat.HeatingCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - break; - case HCoilType::SteamCoil: - unitHeat.HeatingCoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; - break; - case HCoilType::Electric: - case HCoilType::Gas: - break; - default: { - ShowSevereError(state, format("Illegal {} = {}", cAlphaFields(7), Alphas(7))); - ShowContinueError(state, format("Occurs in {}={}", CurrentModuleObject, unitHeat.Name)); - ErrorsFound = true; - errFlag = true; - } - } + unitHeat.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(7))); + switch (unitHeat.heatCoilType) { + case HVAC::CoilType::HeatingWater: { + unitHeat.HeatCoilPlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } break; + + case HVAC::CoilType::HeatingSteam: { + unitHeat.HeatCoilPlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + } break; + + case HVAC::CoilType::HeatingElectric: + case HVAC::CoilType::HeatingGasOrOtherFuel: { + } break; + + default: { + ShowSevereInvalidKey(state, eoh, cAlphaFields(7), Alphas(7)); + ErrorsFound = true; + errFlag = true; + } break; } + if (!errFlag) { - unitHeat.HCoilTypeCh = Alphas(7); - unitHeat.HCoilName = Alphas(8); - ValidateComponent(state, Alphas(7), unitHeat.HCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("specified in {} = \"{}\"", CurrentModuleObject, unitHeat.Name)); - ErrorsFound = true; - } else { - // The heating coil control node is necessary for hot water and steam coils, but not necessary for an - // electric or gas coil. - if (unitHeat.Type == HCoilType::WaterHeatingCoil || unitHeat.Type == HCoilType::SteamCoil) { - // mine the hot water or steam node from the coil object - errFlag = false; - if (unitHeat.Type == HCoilType::WaterHeatingCoil) { - unitHeat.HotControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", unitHeat.HCoilName, errFlag); - } else { // its a steam coil - unitHeat.HCoil_Index = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", unitHeat.HCoilName, errFlag); - unitHeat.HotControlNode = SteamCoils::GetCoilSteamInletNode(state, unitHeat.HCoil_Index, unitHeat.HCoilName, errFlag); - unitHeat.HCoil_fluid = Fluid::GetSteam(state); - } - // Other error checks should trap before it gets to this point in the code, but including just in case. - if (errFlag) { - ShowContinueError(state, format("that was specified in {} = \"{}\"", CurrentModuleObject, unitHeat.Name)); - ErrorsFound = true; - } + unitHeat.HeatCoilName = Alphas(8); + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingWater) { + unitHeat.HeatCoilNum = WaterCoils::GetWaterCoilIndex(state, unitHeat.HeatCoilName); + if (unitHeat.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), unitHeat.HeatCoilName); + ErrorsFound = true; + } else { + unitHeat.HotControlNode = WaterCoils::GetCoilWaterInletNode(state, unitHeat.HeatCoilNum); + } + } else if (unitHeat.heatCoilType == HVAC::CoilType::HeatingSteam) { + unitHeat.HeatCoilNum = SteamCoils::GetSteamCoilIndex(state, unitHeat.HeatCoilName); + if (unitHeat.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), unitHeat.HeatCoilName); + ErrorsFound = true; + } else { + unitHeat.HotControlNode = SteamCoils::GetCoilSteamInletNode(state, unitHeat.HeatCoilNum); + unitHeat.HeatCoilFluid = Fluid::GetSteam(state); } } } @@ -478,7 +474,7 @@ namespace UnitHeater { CurrentModuleObject, unitHeat.Name)); ShowContinueError(state, "..Zone exhaust node name is specified in ZoneHVAC:EquipmentConnections object."); - ShowContinueError(state, format("..Unit heater air inlet node name = {}", state.dataLoopNodes->NodeID(unitHeat.AirInNode))); + ShowContinueError(state, format("..Unit heater air inlet node name = {}", s_node->NodeID(unitHeat.AirInNode))); ErrorsFound = true; } // check that unit heater air outlet node is a zone inlet node. @@ -499,7 +495,7 @@ namespace UnitHeater { CurrentModuleObject, unitHeat.Name)); ShowContinueError(state, "..Zone inlet node name is specified in ZoneHVAC:EquipmentConnections object."); - ShowContinueError(state, format("..Unit heater air outlet node name = {}", state.dataLoopNodes->NodeID(unitHeat.AirOutNode))); + ShowContinueError(state, format("..Unit heater air outlet node name = {}", s_node->NodeID(unitHeat.AirOutNode))); ErrorsFound = true; } @@ -509,17 +505,17 @@ namespace UnitHeater { unitHeat.Name, HVAC::fanTypeNamesUC[(int)unitHeat.fanType], unitHeat.FanName, - state.dataLoopNodes->NodeID(unitHeat.AirInNode), - state.dataLoopNodes->NodeID(unitHeat.FanOutletNode)); + s_node->NodeID(unitHeat.AirInNode), + s_node->NodeID(unitHeat.FanOutletNode)); // Add heating coil to component sets array BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, unitHeat.Name, - unitHeat.HCoilTypeCh, - unitHeat.HCoilName, - state.dataLoopNodes->NodeID(unitHeat.FanOutletNode), - state.dataLoopNodes->NodeID(unitHeat.AirOutNode)); + HVAC::coilTypeNames[(int)unitHeat.heatCoilType], + unitHeat.HeatCoilName, + s_node->NodeID(unitHeat.FanOutletNode), + s_node->NodeID(unitHeat.AirOutNode)); } // ...loop over all of the unit heaters found in the input file @@ -581,7 +577,7 @@ namespace UnitHeater { unitHeat.Name); } state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( - state, unitHeat.HCoilName, unitHeat.HCoilTypeCh, unitHeat.FanName, unitHeat.fanType, unitHeat.Fan_Index); + state, unitHeat.HeatCoilName, unitHeat.heatCoilType, unitHeat.FanName, unitHeat.fanType, unitHeat.Fan_Index); } } @@ -615,6 +611,9 @@ namespace UnitHeater { Real64 SteamDensity; Real64 rho; // local fluid density + auto &s_node = state.dataLoopNodes; + + auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); // Do the one time initializations if (state.dataUnitHeaters->InitUnitHeaterOneTimeFlag) { @@ -632,21 +631,21 @@ namespace UnitHeater { if (allocated(state.dataAvail->ZoneComp)) { auto &availMgr = state.dataAvail->ZoneComp(DataZoneEquipment::ZoneEquipType::UnitHeater).ZoneCompAvailMgrs(UnitHeatNum); if (state.dataUnitHeaters->MyZoneEqFlag(UnitHeatNum)) { // initialize the name of each availability manager list and zone number - availMgr.AvailManagerListName = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AvailManagerListName; + availMgr.AvailManagerListName = unitHeat.AvailManagerListName; availMgr.ZoneNum = ZoneNum; state.dataUnitHeaters->MyZoneEqFlag(UnitHeatNum) = false; } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).availStatus = availMgr.availStatus; + unitHeat.availStatus = availMgr.availStatus; } if (state.dataUnitHeaters->MyPlantScanFlag(UnitHeatNum) && allocated(state.dataPlnt->PlantLoop)) { - if ((state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || - (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { + if ((unitHeat.HeatCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || + (unitHeat.HeatCoilPlantType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc, + unitHeat.HeatCoilName, + unitHeat.HeatCoilPlantType, + unitHeat.HWplantLoc, errFlag, _, _, @@ -655,12 +654,12 @@ namespace UnitHeater { _); if (errFlag) { ShowContinueError(state, - format("Reference Unit=\"{}\", type=ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + format("Reference Unit=\"{}\", type=ZoneHVAC:UnitHeater", unitHeat.Name)); ShowFatalError(state, "InitUnitHeater: Program terminated due to previous condition(s)."); } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum = - DataPlant::CompData::getPlantComponent(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc).NodeNumOut; + unitHeat.HotCoilOutNodeNum = + DataPlant::CompData::getPlantComponent(state, unitHeat.HWplantLoc).NodeNumOut; } state.dataUnitHeaters->MyPlantScanFlag(UnitHeatNum) = false; } else if (state.dataUnitHeaters->MyPlantScanFlag(UnitHeatNum) && !state.dataGlobal->AnyPlantInModel) { @@ -687,45 +686,42 @@ namespace UnitHeater { if (state.dataGlobal->BeginEnvrnFlag && state.dataUnitHeaters->MyEnvrnFlag(UnitHeatNum) && !state.dataUnitHeaters->MyPlantScanFlag(UnitHeatNum)) { - InNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; - OutNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; + InNode = unitHeat.AirInNode; + OutNode = unitHeat.AirOutNode; RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the input volume flow rates - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow = RhoAir * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow; + unitHeat.MaxAirMassFlow = RhoAir * unitHeat.MaxAirVolFlow; // set the node max and min mass flow rates - state.dataLoopNodes->Node(OutNode).MassFlowRateMax = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; - state.dataLoopNodes->Node(OutNode).MassFlowRateMin = 0.0; + s_node->Node(OutNode).MassFlowRateMax = unitHeat.MaxAirMassFlow; + s_node->Node(OutNode).MassFlowRateMin = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMax = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; - state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; + s_node->Node(InNode).MassFlowRateMax = unitHeat.MaxAirMassFlow; + s_node->Node(InNode).MassFlowRateMin = 0.0; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { - rho = state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) - .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingWater) { + rho = state.dataPlnt->PlantLoop(unitHeat.HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow = rho * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow; - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotWaterFlow = rho * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinVolHotWaterFlow; + unitHeat.MaxHotWaterFlow = rho * unitHeat.MaxVolHotWaterFlow; + unitHeat.MinHotWaterFlow = rho * unitHeat.MinVolHotWaterFlow; PlantUtilities::InitComponentNodes(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotWaterFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum); + unitHeat.MinHotWaterFlow, + unitHeat.MaxHotWaterFlow, + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum); } - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingSteam) { TempSteamIn = 100.00; - SteamDensity = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_fluid->getSatDensity(state, TempSteamIn, 1.0, RoutineName); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotSteamFlow = - SteamDensity * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow; - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotSteamFlow = - SteamDensity * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinVolHotSteamFlow; + SteamDensity = unitHeat.HeatCoilFluid->getSatDensity(state, TempSteamIn, 1.0, RoutineName); + unitHeat.MaxHotSteamFlow = SteamDensity * unitHeat.MaxVolHotSteamFlow; + unitHeat.MinHotSteamFlow = SteamDensity * unitHeat.MinVolHotSteamFlow; PlantUtilities::InitComponentNodes(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotSteamFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotSteamFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum); + unitHeat.MinHotSteamFlow, + unitHeat.MaxHotSteamFlow, + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum); } state.dataUnitHeaters->MyEnvrnFlag(UnitHeatNum) = false; @@ -734,32 +730,32 @@ namespace UnitHeater { if (!state.dataGlobal->BeginEnvrnFlag) state.dataUnitHeaters->MyEnvrnFlag(UnitHeatNum) = true; // These initializations are done every iteration... - InNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; - OutNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; + InNode = unitHeat.AirInNode; + OutNode = unitHeat.AirOutNode; state.dataUnitHeaters->QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP; // zone load needed - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr) == 0.0 && - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType == HVAC::FanType::OnOff) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Cycling; + if (unitHeat.FanSchedPtr > 0) { + if (ScheduleManager::GetCurrentScheduleValue(state, unitHeat.FanSchedPtr) == 0.0 && + unitHeat.fanType == HVAC::FanType::OnOff) { + unitHeat.fanOp = HVAC::FanOp::Cycling; } else { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Continuous; + unitHeat.fanOp = HVAC::FanOp::Continuous; } if ((state.dataUnitHeaters->QZnReq < HVAC::SmallLoad) || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { // Unit is available, but there is no load on it or we are in setback/deadband - if (!state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOffNoHeating && - ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr) > 0.0) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Continuous; + if (!unitHeat.FanOffNoHeating && + ScheduleManager::GetCurrentScheduleValue(state, unitHeat.FanSchedPtr) > 0.0) { + unitHeat.fanOp = HVAC::FanOp::Continuous; } } } state.dataUnitHeaters->SetMassFlowRateToZero = false; - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr) > 0) { - if ((ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanAvailSchedPtr) > 0 || + if (ScheduleManager::GetCurrentScheduleValue(state, unitHeat.SchedPtr) > 0) { + if ((ScheduleManager::GetCurrentScheduleValue(state, unitHeat.FanAvailSchedPtr) > 0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOffNoHeating && + if (unitHeat.FanOffNoHeating && ((state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP < HVAC::SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)))) { state.dataUnitHeaters->SetMassFlowRateToZero = true; @@ -772,28 +768,28 @@ namespace UnitHeater { } if (state.dataUnitHeaters->SetMassFlowRateToZero) { - state.dataLoopNodes->Node(InNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = 0.0; - state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = 0.0; - state.dataLoopNodes->Node(OutNode).MassFlowRate = 0.0; - state.dataLoopNodes->Node(OutNode).MassFlowRateMaxAvail = 0.0; - state.dataLoopNodes->Node(OutNode).MassFlowRateMinAvail = 0.0; + s_node->Node(InNode).MassFlowRate = 0.0; + s_node->Node(InNode).MassFlowRateMaxAvail = 0.0; + s_node->Node(InNode).MassFlowRateMinAvail = 0.0; + s_node->Node(OutNode).MassFlowRate = 0.0; + s_node->Node(OutNode).MassFlowRateMaxAvail = 0.0; + s_node->Node(OutNode).MassFlowRateMinAvail = 0.0; } else { - state.dataLoopNodes->Node(InNode).MassFlowRate = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; - state.dataLoopNodes->Node(InNode).MassFlowRateMaxAvail = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; - state.dataLoopNodes->Node(InNode).MassFlowRateMinAvail = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; - state.dataLoopNodes->Node(OutNode).MassFlowRate = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; - state.dataLoopNodes->Node(OutNode).MassFlowRateMaxAvail = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; - state.dataLoopNodes->Node(OutNode).MassFlowRateMinAvail = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirMassFlow; + s_node->Node(InNode).MassFlowRate = unitHeat.MaxAirMassFlow; + s_node->Node(InNode).MassFlowRateMaxAvail = unitHeat.MaxAirMassFlow; + s_node->Node(InNode).MassFlowRateMinAvail = unitHeat.MaxAirMassFlow; + s_node->Node(OutNode).MassFlowRate = unitHeat.MaxAirMassFlow; + s_node->Node(OutNode).MassFlowRateMaxAvail = unitHeat.MaxAirMassFlow; + s_node->Node(OutNode).MassFlowRateMinAvail = unitHeat.MaxAirMassFlow; } // Just in case the unit is off and conditions do not get sent through // the unit for some reason, set the outlet conditions equal to the inlet // conditions of the unit heater - state.dataLoopNodes->Node(OutNode).Temp = state.dataLoopNodes->Node(InNode).Temp; - state.dataLoopNodes->Node(OutNode).Press = state.dataLoopNodes->Node(InNode).Press; - state.dataLoopNodes->Node(OutNode).HumRat = state.dataLoopNodes->Node(InNode).HumRat; - state.dataLoopNodes->Node(OutNode).Enthalpy = state.dataLoopNodes->Node(InNode).Enthalpy; + s_node->Node(OutNode).Temp = s_node->Node(InNode).Temp; + s_node->Node(OutNode).Press = s_node->Node(InNode).Press; + s_node->Node(OutNode).HumRat = s_node->Node(InNode).HumRat; + s_node->Node(OutNode).Enthalpy = s_node->Node(InNode).Enthalpy; } void SizeUnitHeater(EnergyPlusData &state, int const UnitHeatNum) @@ -842,21 +838,23 @@ namespace UnitHeater { Real64 MaxVolHotSteamFlowDes = 0.0; Real64 MaxVolHotSteamFlowUser = 0.0; + auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); + state.dataSize->DataScalableSizingON = false; state.dataSize->DataScalableCapSizingON = false; state.dataSize->ZoneHeatingOnlyFan = true; std::string CompType = "ZoneHVAC:UnitHeater"; - std::string CompName = state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name; - state.dataSize->DataZoneNumber = state.dataUnitHeaters->UnitHeat(UnitHeatNum).ZonePtr; - state.dataSize->DataFanType = state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType; - state.dataSize->DataFanIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index; + std::string const &CompName = unitHeat.Name; + state.dataSize->DataZoneNumber = unitHeat.ZonePtr; + state.dataSize->DataFanType = unitHeat.fanType; + state.dataSize->DataFanIndex = unitHeat.Fan_Index; // unit heater is always blow thru state.dataSize->DataFanPlacement = HVAC::FanPlace::BlowThru; if (CurZoneEqNum > 0) { auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex > 0) { - zoneHVACIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex; + if (unitHeat.HVACSizingIndex > 0) { + zoneHVACIndex = unitHeat.HVACSizingIndex; int SizingMethod = HVAC::HeatingAirflowSizing; int FieldNum = 1; // N1 , \field Maximum Supply Air Flow Rate PrintFlag = true; @@ -889,7 +887,7 @@ namespace UnitHeater { sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + unitHeat.MaxAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == DataSizing::FlowPerHeatingCapacity) { TempSize = DataSizing::AutoSize; @@ -913,7 +911,7 @@ namespace UnitHeater { sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + unitHeat.MaxAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } state.dataSize->DataScalableSizingON = false; } else { @@ -922,51 +920,49 @@ namespace UnitHeater { int FieldNum = 1; // N1 , \field Maximum Supply Air Flow Rate PrintFlag = true; SizingString = state.dataUnitHeaters->UnitHeatNumericFields(UnitHeatNum).FieldNames(FieldNum) + " [m3/s]"; - TempSize = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow; + TempSize = unitHeat.MaxAirVolFlow; bool errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + unitHeat.MaxAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } } bool IsAutoSize = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow == DataSizing::AutoSize) { + if (unitHeat.MaxVolHotWaterFlow == DataSizing::AutoSize) { IsAutoSize = true; } - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingWater) { if (CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow > 0.0) { + if (unitHeat.MaxVolHotWaterFlow > 0.0) { BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, + unitHeat.Name, "User-Specified Maximum Hot Water Flow [m3/s]", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow); + unitHeat.MaxVolHotWaterFlow); } } else { - CheckZoneSizing(state, "ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); + CheckZoneSizing(state, "ZoneHVAC:UnitHeater", unitHeat.Name); + + int CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, unitHeat.HeatCoilNum); + int CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, unitHeat.HeatCoilNum); - int CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode( - state, "Coil:Heating:Water", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); - int CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode( - state, "Coil:Heating:Water", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); if (IsAutoSize) { bool DoWaterCoilSizing = false; // if TRUE do water coil sizing calculation PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(state, - "Coil:Heating:Water", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + HVAC::coilTypeNames[(int)unitHeat.heatCoilType], + unitHeat.HeatCoilName, CoilWaterInletNode, CoilWaterOutletNode, ErrorsFound); - int CoilNum = WaterCoils::GetWaterCoilIndex( - state, "COIL:HEATING:WATER", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); - if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { - WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; + + if (state.dataWaterCoils->WaterCoil(unitHeat.HeatCoilNum).UseDesignWaterDeltaTemp) { + WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(unitHeat.HeatCoilNum).DesignWaterDeltaTemp; DoWaterCoilSizing = true; } else { if (PltSizHeatNum > 0) { @@ -977,7 +973,7 @@ namespace UnitHeater { // If there is no heating Plant Sizing object and autosizing was requested, issue fatal error message ShowSevereError(state, "Autosizing of water coil requires a heating loop Sizing:Plant object"); ShowContinueError( - state, format("Occurs in ZoneHVAC:UnitHeater Object={}", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + state, format("Occurs in ZoneHVAC:UnitHeater Object={}", unitHeat.Name)); ErrorsFound = true; } } @@ -985,8 +981,8 @@ namespace UnitHeater { if (DoWaterCoilSizing) { auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); int SizingMethod = HVAC::HeatingCapacitySizing; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex > 0) { - zoneHVACIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex; + if (unitHeat.HVACSizingIndex > 0) { + zoneHVACIndex = unitHeat.HVACSizingIndex; int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == DataSizing::HeatingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || @@ -1032,27 +1028,27 @@ namespace UnitHeater { } if (DesCoilLoad >= HVAC::SmallLoad) { - rho = state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + rho = state.dataPlnt->PlantLoop(unitHeat.HWplantLoc.loopNum) .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - Cp = state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + Cp = state.dataPlnt->PlantLoop(unitHeat.HWplantLoc.loopNum) .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); MaxVolHotWaterFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { MaxVolHotWaterFlowDes = 0.0; } } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; + unitHeat.MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, + unitHeat.Name, "Design Size Maximum Hot Water Flow [m3/s]", MaxVolHotWaterFlowDes); } else { - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow > 0.0 && MaxVolHotWaterFlowDes > 0.0) { - MaxVolHotWaterFlowUser = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow; + if (unitHeat.MaxVolHotWaterFlow > 0.0 && MaxVolHotWaterFlowDes > 0.0) { + MaxVolHotWaterFlowUser = unitHeat.MaxVolHotWaterFlow; BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, + unitHeat.Name, "Design Size Maximum Hot Water Flow [m3/s]", MaxVolHotWaterFlowDes, "User-Specified Maximum Hot Water Flow [m3/s]", @@ -1062,7 +1058,7 @@ namespace UnitHeater { state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeUnitHeater: Potential issue with equipment sizing for ZoneHVAC:UnitHeater {}", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + unitHeat.Name)); ShowContinueError(state, format("User-Specified Maximum Hot Water Flow of {:.5R} [m3/s]", MaxVolHotWaterFlowUser)); ShowContinueError( @@ -1076,43 +1072,41 @@ namespace UnitHeater { } } } else { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow = 0.0; + unitHeat.MaxVolHotWaterFlow = 0.0; } IsAutoSize = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow == DataSizing::AutoSize) { + if (unitHeat.MaxVolHotSteamFlow == DataSizing::AutoSize) { IsAutoSize = true; } - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingSteam) { if (CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow > 0.0) { + if (unitHeat.MaxVolHotSteamFlow > 0.0) { BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, + unitHeat.Name, "User-Specified Maximum Steam Flow [m3/s]", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow); + unitHeat.MaxVolHotSteamFlow); } } else { auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); - CheckZoneSizing(state, "ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); + CheckZoneSizing(state, "ZoneHVAC:UnitHeater", unitHeat.Name); - int CoilSteamInletNode = SteamCoils::GetCoilSteamInletNode( - state, "Coil:Heating:Steam", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); - int CoilSteamOutletNode = SteamCoils::GetCoilSteamInletNode( - state, "Coil:Heating:Steam", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); + int CoilSteamInletNode = SteamCoils::GetCoilSteamInletNode(state, unitHeat.HeatCoilNum); + int CoilSteamOutletNode = SteamCoils::GetCoilSteamInletNode(state, unitHeat.HeatCoilNum); if (IsAutoSize) { PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(state, "Coil:Heating:Steam", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + unitHeat.HeatCoilName, CoilSteamInletNode, CoilSteamOutletNode, ErrorsFound); if (PltSizHeatNum > 0) { - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex > 0) { - zoneHVACIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex; + if (unitHeat.HVACSizingIndex > 0) { + zoneHVACIndex = unitHeat.HVACSizingIndex; int SizingMethod = HVAC::HeatingCapacitySizing; int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; @@ -1165,21 +1159,21 @@ namespace UnitHeater { } else { ShowSevereError(state, "Autosizing of Steam flow requires a heating loop Sizing:Plant object"); ShowContinueError(state, - format("Occurs in ZoneHVAC:UnitHeater Object={}", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + format("Occurs in ZoneHVAC:UnitHeater Object={}", unitHeat.Name)); ErrorsFound = true; } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; + unitHeat.MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, + unitHeat.Name, "Design Size Maximum Steam Flow [m3/s]", MaxVolHotSteamFlowDes); } else { - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow > 0.0 && MaxVolHotSteamFlowDes > 0.0) { - MaxVolHotSteamFlowUser = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow; + if (unitHeat.MaxVolHotSteamFlow > 0.0 && MaxVolHotSteamFlowDes > 0.0) { + MaxVolHotSteamFlowUser = unitHeat.MaxVolHotSteamFlow; BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, + unitHeat.Name, "Design Size Maximum Steam Flow [m3/s]", MaxVolHotSteamFlowDes, "User-Specified Maximum Steam Flow [m3/s]", @@ -1189,7 +1183,7 @@ namespace UnitHeater { state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeUnitHeater: Potential issue with equipment sizing for ZoneHVAC:UnitHeater {}", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + unitHeat.Name)); ShowContinueError(state, format("User-Specified Maximum Steam Flow of {:.5R} [m3/s]", MaxVolHotSteamFlowUser)); ShowContinueError(state, format("differs from Design Size Maximum Steam Flow of {:.5R} [m3/s]", MaxVolHotSteamFlowDes)); @@ -1202,19 +1196,16 @@ namespace UnitHeater { } } } else { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow = 0.0; + unitHeat.MaxVolHotSteamFlow = 0.0; } // set the design air flow rate for the heating coil - WaterCoils::SetCoilDesFlow(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilTypeCh, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow, - ErrorsFound); + WaterCoils::SetCoilDesFlow(state, unitHeat.HeatCoilNum, unitHeat.MaxAirVolFlow); + if (CurZoneEqNum > 0) { auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); - ZoneEqSizing.MaxHWVolFlow = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow; + ZoneEqSizing.MaxHWVolFlow = unitHeat.MaxVolHotWaterFlow; } if (ErrorsFound) { @@ -1278,66 +1269,67 @@ namespace UnitHeater { Real64 MaxWaterFlow = 0.0; Real64 MinWaterFlow = 0.0; Real64 PartLoadFrac = 0.0; - int InletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; - int OutletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; - int ControlNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode; - Real64 ControlOffset = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlOffset; - HVAC::FanOp fanOp = state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp; + + auto &s_node = state.dataLoopNodes; + auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); + + Real64 ControlOffset = unitHeat.HotControlOffset; + HVAC::FanOp fanOp = unitHeat.fanOp; if (fanOp != HVAC::FanOp::Cycling) { - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr) <= 0 || - ((ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanAvailSchedPtr) <= 0 && + if (ScheduleManager::GetCurrentScheduleValue(state, unitHeat.SchedPtr) <= 0 || + ((ScheduleManager::GetCurrentScheduleValue(state, unitHeat.FanAvailSchedPtr) <= 0 && !state.dataHVACGlobal->TurnFansOn) || state.dataHVACGlobal->TurnFansOff)) { // Case 1: OFF-->unit schedule says that it it not available // OR child fan in not available OR child fan not being cycled ON by sys avail manager // OR child fan being forced OFF by sys avail manager state.dataUnitHeaters->HCoilOn = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; // try to turn off PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); - } - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); + + } else if (unitHeat.heatCoilType == HVAC::CoilType::HeatingSteam) { mdot = 0.0; // try to turn off PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); } CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, QUnitOut); } else if ((state.dataUnitHeaters->QZnReq < HVAC::SmallLoad) || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { // Unit is available, but there is no load on it or we are in setback/deadband - if (!state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOffNoHeating) { + if (!unitHeat.FanOffNoHeating) { // Case 2: NO LOAD OR COOLING/ON-OFF FAN CONTROL-->turn everything off // because there is no load on the unit heater state.dataUnitHeaters->HCoilOn = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; // try to turn off PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); - } - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); + + } else if (unitHeat.heatCoilType == HVAC::CoilType::HeatingSteam) { mdot = 0.0; // try to turn off PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); } CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, QUnitOut); @@ -1348,25 +1340,25 @@ namespace UnitHeater { // so there is really nothing else left to do except call the components. state.dataUnitHeaters->HCoilOn = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { + if (unitHeat.heatCoilType == HVAC::CoilType::HeatingWater) { mdot = 0.0; // try to turn off - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum > 0) { + if (unitHeat.HWplantLoc.loopNum > 0) { PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); } - } - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { + + } else if (unitHeat.heatCoilType == HVAC::CoilType::HeatingSteam) { mdot = 0.0; // try to turn off - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum > 0) { + if (unitHeat.HWplantLoc.loopNum > 0) { PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); } } @@ -1375,59 +1367,58 @@ namespace UnitHeater { } else { // Case 4: HEATING-->unit is available and there is a heating load - switch (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type) { + switch (unitHeat.heatCoilType) { - case HCoilType::WaterHeatingCoil: { + case HVAC::CoilType::HeatingWater: { // On the first HVAC iteration the system values are given to the controller, but after that // the demand limits are in place and there needs to be feedback to the Zone Equipment if (FirstHVACIteration) { - MaxWaterFlow = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow; - MinWaterFlow = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotWaterFlow; + MaxWaterFlow = unitHeat.MaxHotWaterFlow; + MinWaterFlow = unitHeat.MinHotWaterFlow; } else { - MaxWaterFlow = state.dataLoopNodes->Node(ControlNode).MassFlowRateMaxAvail; - MinWaterFlow = state.dataLoopNodes->Node(ControlNode).MassFlowRateMinAvail; + MaxWaterFlow = s_node->Node(unitHeat.HotControlNode).MassFlowRateMaxAvail; + MinWaterFlow = s_node->Node(unitHeat.HotControlNode).MassFlowRateMinAvail; } // control water flow to obtain output matching QZnReq ControlCompOutput(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, + unitHeat.Name, state.dataUnitHeaters->cMO_UnitHeater, UnitHeatNum, FirstHVACIteration, state.dataUnitHeaters->QZnReq, - ControlNode, + unitHeat.HotControlNode, MaxWaterFlow, MinWaterFlow, - ControlOffset, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).ControlCompTypeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).CompErrIndex, + unitHeat.HotControlOffset, + unitHeat.ControlCompTypeNum, + unitHeat.CompErrIndex, _, _, _, _, _, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); - break; - } - case HCoilType::Electric: - case HCoilType::Gas: - case HCoilType::SteamCoil: { + unitHeat.HWplantLoc); + } break; + + case HVAC::CoilType::HeatingElectric: + case HVAC::CoilType::HeatingGasOrOtherFuel: + case HVAC::CoilType::HeatingSteam: { state.dataUnitHeaters->HCoilOn = true; CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, QUnitOut); - break; - } + } break; default: break; } } - if (state.dataLoopNodes->Node(InletNode).MassFlowRateMax > 0.0) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanPartLoadRatio = - state.dataLoopNodes->Node(InletNode).MassFlowRate / state.dataLoopNodes->Node(InletNode).MassFlowRateMax; + if (s_node->Node(unitHeat.AirInNode).MassFlowRateMax > 0.0) { + unitHeat.FanPartLoadRatio = + s_node->Node(unitHeat.AirInNode).MassFlowRate / s_node->Node(unitHeat.AirInNode).MassFlowRateMax; } } else { // OnOff fan and cycling if ((state.dataUnitHeaters->QZnReq < HVAC::SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) || - ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr) <= 0 || - ((ScheduleManager::GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanAvailSchedPtr) <= 0 && + ScheduleManager::GetCurrentScheduleValue(state, unitHeat.SchedPtr) <= 0 || + ((ScheduleManager::GetCurrentScheduleValue(state, unitHeat.FanAvailSchedPtr) <= 0 && !state.dataHVACGlobal->TurnFansOn) || state.dataHVACGlobal->TurnFansOff)) { // Case 1: OFF-->unit schedule says that it it not available @@ -1437,9 +1428,9 @@ namespace UnitHeater { state.dataUnitHeaters->HCoilOn = false; CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, QUnitOut, fanOp, PartLoadFrac); - if (state.dataLoopNodes->Node(InletNode).MassFlowRateMax > 0.0) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanPartLoadRatio = - state.dataLoopNodes->Node(InletNode).MassFlowRate / state.dataLoopNodes->Node(InletNode).MassFlowRateMax; + if (s_node->Node(unitHeat.AirInNode).MassFlowRateMax > 0.0) { + unitHeat.FanPartLoadRatio = + s_node->Node(unitHeat.AirInNode).MassFlowRate / s_node->Node(unitHeat.AirInNode).MassFlowRateMax; } } else { // Case 4: HEATING-->unit is available and there is a heating load @@ -1478,24 +1469,24 @@ namespace UnitHeater { CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, QUnitOut, fanOp, PartLoadFrac); } // ...end of unit ON/OFF IF-THEN block - state.dataUnitHeaters->UnitHeat(UnitHeatNum).PartLoadFrac = PartLoadFrac; - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanPartLoadRatio = PartLoadFrac; - state.dataLoopNodes->Node(OutletNode).MassFlowRate = state.dataLoopNodes->Node(InletNode).MassFlowRate; + unitHeat.PartLoadFrac = PartLoadFrac; + unitHeat.FanPartLoadRatio = PartLoadFrac; + s_node->Node(unitHeat.AirOutNode).MassFlowRate = s_node->Node(unitHeat.AirInNode).MassFlowRate; } // CR9155 Remove specific humidity calculations - SpecHumOut = state.dataLoopNodes->Node(OutletNode).HumRat; - SpecHumIn = state.dataLoopNodes->Node(InletNode).HumRat; - LatentOutput = state.dataLoopNodes->Node(OutletNode).MassFlowRate * (SpecHumOut - SpecHumIn); // Latent rate (kg/s), dehumid = negative + SpecHumOut = s_node->Node(unitHeat.AirOutNode).HumRat; + SpecHumIn = s_node->Node(unitHeat.AirInNode).HumRat; + LatentOutput = s_node->Node(unitHeat.AirOutNode).MassFlowRate * (SpecHumOut - SpecHumIn); // Latent rate (kg/s), dehumid = negative - QUnitOut = state.dataLoopNodes->Node(OutletNode).MassFlowRate * - (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); + QUnitOut = s_node->Node(unitHeat.AirOutNode).MassFlowRate * + (Psychrometrics::PsyHFnTdbW(s_node->Node(unitHeat.AirOutNode).Temp, s_node->Node(unitHeat.AirInNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(unitHeat.AirInNode).Temp, s_node->Node(unitHeat.AirInNode).HumRat)); // Report variables... - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower = max(0.0, QUnitOut); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecPower = - state.dataFans->fans(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index)->totalPower; + unitHeat.HeatPower = max(0.0, QUnitOut); + unitHeat.ElecPower = + state.dataFans->fans(unitHeat.Fan_Index)->totalPower; PowerMet = QUnitOut; LatOutputProvided = LatentOutput; @@ -1527,165 +1518,146 @@ namespace UnitHeater { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 AirMassFlow; // total mass flow through the unit Real64 CpAirZn; // specific heat of dry air at zone conditions (zone conditions same as unit inlet) - int HCoilInAirNode; // inlet node number for fan exit/coil inlet Real64 mdot; // local temporary for fluid mass flow rate - int InletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; - int OutletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; + auto &s_node = state.dataLoopNodes; + auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); Real64 QCoilReq = 0.0; if (fanOp != HVAC::FanOp::Cycling) { - state.dataFans->fans(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index)->simulate(state, FirstHVACIteration, _, _); + state.dataFans->fans(unitHeat.Fan_Index)->simulate(state, FirstHVACIteration, _, _); - switch (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type) { + switch (unitHeat.heatCoilType) { - case HCoilType::WaterHeatingCoil: { - - WaterCoils::SimulateWaterCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index); - break; - } - case HCoilType::SteamCoil: { + case HVAC::CoilType::HeatingWater: { + WaterCoils::SimulateWaterCoilComponents(state, unitHeat.HeatCoilName, FirstHVACIteration, unitHeat.HeatCoilNum); + } break; + + case HVAC::CoilType::HeatingSteam: { if (!state.dataUnitHeaters->HCoilOn) { QCoilReq = 0.0; } else { - HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(s_node->Node(unitHeat.AirInNode).HumRat); QCoilReq = - state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * - (state.dataLoopNodes->Node(HCoilInAirNode).Temp - - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); + state.dataUnitHeaters->QZnReq - s_node->Node(unitHeat.FanOutletNode).MassFlowRate * CpAirZn * + (s_node->Node(unitHeat.FanOutletNode).Temp - + s_node->Node(unitHeat.AirInNode).Temp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SteamCoils::SimulateSteamCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, - QCoilReq); - break; - } - case HCoilType::Electric: - case HCoilType::Gas: { + SteamCoils::SimulateSteamCoilComponents(state, unitHeat.HeatCoilName, FirstHVACIteration, unitHeat.HeatCoilNum, QCoilReq); + } break; + + case HVAC::CoilType::HeatingElectric: + case HVAC::CoilType::HeatingGasOrOtherFuel: { if (!state.dataUnitHeaters->HCoilOn) { QCoilReq = 0.0; } else { - HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(s_node->Node(unitHeat.AirInNode).HumRat); QCoilReq = - state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * - (state.dataLoopNodes->Node(HCoilInAirNode).Temp - - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); + state.dataUnitHeaters->QZnReq - s_node->Node(unitHeat.FanOutletNode).MassFlowRate * CpAirZn * + (s_node->Node(unitHeat.FanOutletNode).Temp - + s_node->Node(unitHeat.AirInNode).Temp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - HeatingCoils::SimulateHeatingCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - QCoilReq, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index); - break; - } + HeatingCoils::SimulateHeatingCoilComponents(state, unitHeat.HeatCoilName, FirstHVACIteration, QCoilReq, unitHeat.HeatCoilNum); + } break; default: break; } - AirMassFlow = state.dataLoopNodes->Node(OutletNode).MassFlowRate; + AirMassFlow = s_node->Node(unitHeat.AirOutNode).MassFlowRate; - state.dataLoopNodes->Node(InletNode).MassFlowRate = - state.dataLoopNodes->Node(OutletNode).MassFlowRate; // maintain continuity through unit heater + s_node->Node(unitHeat.AirInNode).MassFlowRate = + s_node->Node(unitHeat.AirOutNode).MassFlowRate; // maintain continuity through unit heater } else { // OnOff fan cycling - state.dataLoopNodes->Node(InletNode).MassFlowRate = state.dataLoopNodes->Node(InletNode).MassFlowRateMax * PartLoadRatio; - AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; + s_node->Node(unitHeat.AirInNode).MassFlowRate = s_node->Node(unitHeat.AirInNode).MassFlowRateMax * PartLoadRatio; + AirMassFlow = s_node->Node(unitHeat.AirInNode).MassFlowRate; // Set the fan inlet node maximum available mass flow rates for cycling fans - state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AirMassFlow; + s_node->Node(unitHeat.AirInNode).MassFlowRateMaxAvail = AirMassFlow; if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - state.dataFans->fans(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index)->simulate(state, FirstHVACIteration, _, _); + state.dataFans->fans(unitHeat.Fan_Index)->simulate(state, FirstHVACIteration, _, _); - switch (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type) { + switch (unitHeat.heatCoilType) { - case HCoilType::WaterHeatingCoil: { + case HVAC::CoilType::HeatingWater: { if (!state.dataUnitHeaters->HCoilOn) { mdot = 0.0; QCoilReq = 0.0; } else { - HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(s_node->Node(unitHeat.AirInNode).HumRat); QCoilReq = - state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * - (state.dataLoopNodes->Node(HCoilInAirNode).Temp - - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); - mdot = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow * PartLoadRatio; + state.dataUnitHeaters->QZnReq - s_node->Node(unitHeat.FanOutletNode).MassFlowRate * CpAirZn * + (s_node->Node(unitHeat.FanOutletNode).Temp - + s_node->Node(unitHeat.AirInNode).Temp); + mdot = unitHeat.MaxHotWaterFlow * PartLoadRatio; } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); WaterCoils::SimulateWaterCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + unitHeat.HeatCoilName, FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, + unitHeat.HeatCoilNum, QCoilReq, fanOp, PartLoadRatio); break; } - case HCoilType::SteamCoil: { + case HVAC::CoilType::HeatingSteam: { if (!state.dataUnitHeaters->HCoilOn) { mdot = 0.0; QCoilReq = 0.0; } else { - HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(s_node->Node(unitHeat.AirInNode).HumRat); QCoilReq = - state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * - (state.dataLoopNodes->Node(HCoilInAirNode).Temp - - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); - mdot = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotSteamFlow * PartLoadRatio; + state.dataUnitHeaters->QZnReq - s_node->Node(unitHeat.FanOutletNode).MassFlowRate * CpAirZn * + (s_node->Node(unitHeat.FanOutletNode).Temp - + s_node->Node(unitHeat.AirInNode).Temp); + mdot = unitHeat.MaxHotSteamFlow * PartLoadRatio; } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool PlantUtilities::SetComponentFlowRate(state, mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + unitHeat.HotControlNode, + unitHeat.HotCoilOutNodeNum, + unitHeat.HWplantLoc); SteamCoils::SimulateSteamCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + unitHeat.HeatCoilName, FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, + unitHeat.HeatCoilNum, QCoilReq, _, fanOp, PartLoadRatio); break; } - case HCoilType::Electric: - case HCoilType::Gas: { + case HVAC::CoilType::HeatingElectric: + case HVAC::CoilType::HeatingGasOrOtherFuel: { if (!state.dataUnitHeaters->HCoilOn) { QCoilReq = 0.0; } else { - HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(s_node->Node(unitHeat.AirInNode).HumRat); QCoilReq = - state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * - (state.dataLoopNodes->Node(HCoilInAirNode).Temp - - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); + state.dataUnitHeaters->QZnReq - s_node->Node(unitHeat.FanOutletNode).MassFlowRate * CpAirZn * + (s_node->Node(unitHeat.FanOutletNode).Temp - + s_node->Node(unitHeat.AirInNode).Temp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool HeatingCoils::SimulateHeatingCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + unitHeat.HeatCoilName, FirstHVACIteration, QCoilReq, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, + unitHeat.HeatCoilNum, _, _, fanOp, @@ -1695,11 +1667,10 @@ namespace UnitHeater { default: break; } - state.dataLoopNodes->Node(OutletNode).MassFlowRate = - state.dataLoopNodes->Node(InletNode).MassFlowRate; // maintain continuity through unit heater + s_node->Node(unitHeat.AirOutNode).MassFlowRate = s_node->Node(unitHeat.AirInNode).MassFlowRate; // maintain continuity through unit heater } - LoadMet = AirMassFlow * (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - - Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); + LoadMet = AirMassFlow * (Psychrometrics::PsyHFnTdbW(s_node->Node(unitHeat.AirOutNode).Temp, s_node->Node(unitHeat.AirInNode).HumRat) - + Psychrometrics::PsyHFnTdbW(s_node->Node(unitHeat.AirInNode).Temp, s_node->Node(unitHeat.AirInNode).HumRat)); } // SUBROUTINE UpdateUnitHeater @@ -1725,12 +1696,14 @@ namespace UnitHeater { // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatEnergy = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower * TimeStepSysSec; - state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecEnergy = state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecPower * TimeStepSysSec; + auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); + + unitHeat.HeatEnergy = unitHeat.HeatPower * TimeStepSysSec; + unitHeat.ElecEnergy = unitHeat.ElecPower * TimeStepSysSec; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).FirstPass) { // reset sizing flags so other zone equipment can size normally + if (unitHeat.FirstPass) { // reset sizing flags so other zone equipment can size normally if (!state.dataGlobal->SysSizingCalc) { - DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, 0, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FirstPass); + DataSizing::resetHVACSizingGlobals(state, state.dataSize->CurZoneEqNum, 0, unitHeat.FirstPass); } } } diff --git a/src/EnergyPlus/UnitHeater.hh b/src/EnergyPlus/UnitHeater.hh index 1f70f977c5b..d6672c1367d 100644 --- a/src/EnergyPlus/UnitHeater.hh +++ b/src/EnergyPlus/UnitHeater.hh @@ -65,23 +65,6 @@ struct EnergyPlusData; namespace UnitHeater { - enum class HCoilType - { - Invalid = -1, - Electric, - Gas, - WaterHeatingCoil, - SteamCoil, - Num - }; - - static constexpr std::array(HCoilType::Num)> HCoilTypeNamesUC{ - "COIL:HEATING:ELECTRIC", - "COIL:HEATING:FUEL", - "COIL:HEATING:WATER", - "COIL:HEATING:STEAM", - }; - struct UnitHeaterData { // Members @@ -89,8 +72,8 @@ namespace UnitHeater { std::string Name; // name of unit std::string SchedName; // availability schedule int SchedPtr; // index to schedule - int AirInNode; // inlet air node number - int AirOutNode; // outlet air node number + int AirInNode = 0; // inlet air node number + int AirOutNode = 0; // outlet air node number HVAC::FanType fanType; // Fan type number (see DataHVACGlobals) std::string FanName; // name of fan int Fan_Index; @@ -104,12 +87,13 @@ namespace UnitHeater { int FanOutletNode; // outlet node number for fan exit // (assumes fan is upstream of heating coil) HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation; 1=cycling fan, cycling coil, 2=continuous fan, cycling coil - HCoilType Type; // type of heating coil (water, gas, electric, etc.) - std::string HCoilTypeCh; // actual object name - std::string HCoilName; // name of heating coil - int HCoil_Index; - DataPlant::PlantEquipmentType HeatingCoilType; - Fluid::RefrigProps *HCoil_fluid = nullptr; + HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; // type of heating coil (water, gas, electric, etc.) + + std::string HeatCoilName; // name of heating coil + int HeatCoilNum = 0; + DataPlant::PlantEquipmentType HeatCoilPlantType = DataPlant::PlantEquipmentType::Invalid; + Fluid::RefrigProps *HeatCoilFluid = nullptr; + Real64 MaxVolHotWaterFlow; // m3/s Real64 MaxVolHotSteamFlow; // m3/s Real64 MaxHotWaterFlow; // kg/s @@ -118,8 +102,8 @@ namespace UnitHeater { Real64 MinVolHotSteamFlow; // m3/s Real64 MinHotWaterFlow; // kg/s Real64 MinHotSteamFlow; // kg/s - int HotControlNode; // hot water control node, inlet of coil - Real64 HotControlOffset; // control tolerance + int HotControlNode = 0.0; // hot water control node, inlet of coil + Real64 HotControlOffset = 0.0; // control tolerance int HotCoilOutNodeNum; // outlet of coil PlantLocation HWplantLoc; // Location of plant component for hot plant coil Real64 PartLoadFrac; // part load fraction for the unit @@ -138,9 +122,9 @@ namespace UnitHeater { // Default Constructor UnitHeaterData() - : SchedPtr(0), AirInNode(0), AirOutNode(0), fanType(HVAC::FanType::Invalid), Fan_Index(0), FanSchedPtr(0), FanAvailSchedPtr(0), - ControlCompTypeNum(0), CompErrIndex(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), FanOutletNode(0), HCoil_Index(0), - HeatingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), + : SchedPtr(0), fanType(HVAC::FanType::Invalid), Fan_Index(0), FanSchedPtr(0), FanAvailSchedPtr(0), + ControlCompTypeNum(0), CompErrIndex(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), FanOutletNode(0), + MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), MinHotSteamFlow(0.0), HotControlNode(0), HotControlOffset(0.0), HotCoilOutNodeNum(0), HWplantLoc{}, PartLoadFrac(0.0), HeatPower(0.0), HeatEnergy(0.0), ElecPower(0.0), ElecEnergy(0.0), FanOffNoHeating(false), FanPartLoadRatio(0.0), ZonePtr(0), HVACSizingIndex(0), FirstPass(true) diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index b0ba20de07e..53a4c1a7aab 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -120,10 +120,6 @@ namespace UnitVentilator { "NONE", "HEATINGANDCOOLING", "HEATING", "COOLING"}; static constexpr std::array(OAControl::Num)> OAControlNamesUC = { "VARIABLEPERCENT", "FIXEDTEMPERATURE", "FIXEDAMOUNT"}; - static constexpr std::array(HeatCoilType::Num)> HeatCoilTypeNamesUC = { - "COIL:HEATING:ELECTRIC", "COIL:HEATING:FUEL", "COIL:HEATING:WATER", "COIL:HEATING:STEAM"}; - static constexpr std::array(CoolCoilType::Num)> CoolCoilTypeNamesUC = { - "COIL:COOLING:WATER", "COIL:COOLING:WATER:DETAILEDGEOMETRY", "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED"}; void SimUnitVentilator(EnergyPlusData &state, std::string_view CompName, // name of the fan coil unit @@ -219,8 +215,6 @@ namespace UnitVentilator { int NumNumbers; // Number of Numbers for each GetObjectItem call bool IsValid; // Set for outside air node check bool errFlag(false); // interim error flag - std::string cCoolingCoilType; // Cooling coil object type - std::string cHeatingCoilType; // Heating coil object type Real64 FanVolFlow; // volumetric flow rate of fan Array1D_string Alphas; // Alpha items for object Array1D Numbers; // Numeric items for object @@ -301,8 +295,6 @@ namespace UnitVentilator { } unitVent.OutAirVolFlow = Numbers(3); - cCoolingCoilType = ""; - cHeatingCoilType = ""; { unitVent.OAControlType = (OAControl)getEnumValue(OAControlNamesUC, Alphas(3)); @@ -544,7 +536,7 @@ namespace UnitVentilator { } } - unitVent.CoilOption = (CoilsUsed)getEnumValue(CoilsUsedNamesUC, Alphas(13)); + unitVent.CoilOption = static_cast(getEnumValue(CoilsUsedNamesUC, Alphas(13))); unitVent.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(14)); // Default to cycling fan when fan mode schedule is not present @@ -574,43 +566,43 @@ namespace UnitVentilator { // Get Coil information if (unitVent.CoilOption == CoilsUsed::Both || unitVent.CoilOption == CoilsUsed::Heating) { if ((!lAlphaBlanks(16))) { - unitVent.HCoilPresent = true; - cHeatingCoilType = Alphas(15); - unitVent.HCoilTypeCh = cHeatingCoilType; - unitVent.HCoilType = (HeatCoilType)getEnumValue(HeatCoilTypeNamesUC, cHeatingCoilType); - unitVent.HeatingCoilType = (DataPlant::PlantEquipmentType)getEnumValue(DataPlant::PlantEquipTypeNamesUC, cHeatingCoilType); - - unitVent.HCoilName = Alphas(16); - ValidateComponent(state, cHeatingCoilType, unitVent.HCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...specified in {} = \"{}\".", CurrentModuleObject, unitVent.Name)); - ErrorsFound = true; - } else { - // The heating coil control node is necessary for a hot water coil, but not necessary for electric or gas. - if (unitVent.HCoilType == HeatCoilType::Water || unitVent.HCoilType == HeatCoilType::Steam) { - // mine the hot water or steam node from the coil object - if (unitVent.HCoilType == HeatCoilType::Water) { - unitVent.HCoil_Index = WaterCoils::GetCompIndex(state, WaterCoils::CoilModel::HeatingSimple, unitVent.HCoilName); - unitVent.HotControlNode = state.dataWaterCoils->WaterCoil(unitVent.HCoil_Index).WaterInletNodeNum; - unitVent.MaxVolHotWaterFlow = state.dataWaterCoils->WaterCoil(unitVent.HCoil_Index).MaxWaterVolFlowRate; - // Could probably remove MaxVolHotSteamFlow here - unitVent.MaxVolHotSteamFlow = unitVent.MaxVolHotWaterFlow; - } else { - unitVent.HCoil_Index = SteamCoils::GetCompIndex(state, unitVent.HCoilName); - unitVent.HotControlNode = state.dataSteamCoils->SteamCoil(unitVent.HCoil_Index).SteamInletNodeNum; - // Could probably replace MaxVolHotWaterFlow here with MaxVolHotSteamFlow - unitVent.MaxVolHotWaterFlow = state.dataSteamCoils->SteamCoil(unitVent.HCoil_Index).MaxSteamVolFlowRate; - // unitVent.MaxVolHotWaterFlow = - // SteamCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Steam", unitVent.HCoilName, ErrorsFound); - unitVent.MaxVolHotSteamFlow = unitVent.MaxVolHotWaterFlow; - } + unitVent.HeatCoilPresent = true; + unitVent.heatCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(15))); + unitVent.HeatCoilPlantType = static_cast(getEnumValue(DataPlant::PlantEquipTypeNamesUC, Alphas(15))); + + unitVent.HeatCoilName = Alphas(16); + if (unitVent.heatCoilType == HVAC::CoilType::HeatingWater) { + unitVent.HeatCoilNum = WaterCoils::GetWaterCoilIndex(state, unitVent.HeatCoilName); + if (unitVent.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(16), unitVent.HeatCoilName); + ErrorsFound = true; + } else { + unitVent.HeatCoilControlNodeNum = WaterCoils::GetCoilInletNode(state, unitVent.HeatCoilNum); + unitVent.HeatCoilOutNodeNum = WaterCoils::GetCoilOutletNode(state, unitVent.HeatCoilNum); + unitVent.MaxVolHotWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, unitVent.HeatCoilNum); + // Could probably remove MaxVolHotSteamFlow here + unitVent.MaxVolHotSteamFlow = unitVent.MaxVolHotWaterFlow; + } + } else if (unitVent.heatCoilType == HVAC::CoilType::HeatingSteam) { + unitVent.HeatCoilNum = SteamCoils::GetSteamCoilIndex(state, unitVent.HeatCoilName); + if (unitVent.HeatCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(16), unitVent.HeatCoilName); + ErrorsFound = true; + } else { + unitVent.HeatCoilControlNodeNum = SteamCoils::GetSteamCoilInletNode(state, unitVent.HeatCoilNum); + unitVent.HeatCoilOutNodeNum = SteamCoils::GetSteamCoilOutletNode(state, unitVent.HeatCoilNum); + // Could probably replace MaxVolHotWaterFlow here with MaxVolHotSteamFlow + unitVent.MaxVolHotWaterFlow = SteamCoils::GetSteamCoilMaxstate.dataSteamCoils->SteamCoil(unitVent.HeatCoilNum).MaxSteamVolFlowRate; + // unitVent.MaxVolHotWaterFlow = + // SteamCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Steam", unitVent.HCoilName, ErrorsFound); + unitVent.MaxVolHotSteamFlow = unitVent.MaxVolHotWaterFlow; } } - unitVent.HotControlOffset = Numbers(4); + unitVent.HeatCoilControlOffset = Numbers(4); // Set default convergence tolerance - if (unitVent.HotControlOffset <= 0.0) { - unitVent.HotControlOffset = 0.001; + if (unitVent.HeatCoilControlOffset <= 0.0) { + unitVent.HeatCoilControlOffset = 0.001; } } else { // heating coil is required for these options ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, unitVent.Name)); @@ -621,60 +613,40 @@ namespace UnitVentilator { if (unitVent.CoilOption == CoilsUsed::Both || unitVent.CoilOption == CoilsUsed::Cooling) { if (!lAlphaBlanks(18)) { - unitVent.CCoilPresent = true; + unitVent.CoolCoilPresent = true; errFlag = false; - cCoolingCoilType = Alphas(17); - unitVent.CCoilTypeCh = cCoolingCoilType; - unitVent.CCoilType = (CoolCoilType)getEnumValue(CoolCoilTypeNamesUC, cCoolingCoilType); - unitVent.CoolingCoilType = (DataPlant::PlantEquipmentType)getEnumValue(DataPlant::PlantEquipTypeNamesUC, cCoolingCoilType); - unitVent.CCoilPlantName = Alphas(18); - - if (cCoolingCoilType == "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED") { - unitVent.CCoilType = CoolCoilType::HXAssisted; - HVACHXAssistedCoolingCoil::GetHXCoilTypeAndName( - state, cCoolingCoilType, Alphas(18), ErrorsFound, unitVent.CCoilPlantType, unitVent.CCoilPlantName); - if (Util::SameString(unitVent.CCoilPlantType, "Coil:Cooling:Water")) { - unitVent.CoolingCoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; - } else if (Util::SameString(unitVent.CCoilPlantType, "Coil:Cooling:Water:DetailedGeometry")) { - unitVent.CoolingCoilType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; - } else { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, unitVent.Name)); - ShowContinueError(state, format("For: {}=\"{}\".", cAlphaFields(17), Alphas(17))); - ShowContinueError(state, format("Invalid Coil Type={}, Name={}", unitVent.CCoilPlantType, unitVent.CCoilPlantName)); - ShowContinueError(state, - "must be \"Coil:Cooling:Water\", \"Coil:Cooling:Water:DetailedGeometry\" or, " - "\"CoilSystem:Cooling:Water:HeatExchangerAssisted\"."); - errFlag = true; + unitVent.coolCoilType = static_cast(getEnumValue(HVAC::coilTypeNamesUC, Alphas(17))); + unitVent.CoolCoilPlantType = static_cast(getEnumValue(DataPlant::PlantEquipTypeNamesUC, Alphas(17))); + unitVent.CoolCoilName = Alphas(18); + + if (unitVent.coolCoilType == HVAC::CoilType::WaterCoolingHXAssisted) { + unitVent.CoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilIndex(state, unitVent.CoolCoilName); + if (unitVent.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(18), unitVent.HeatCoilName); ErrorsFound = true; + } else { + unitVent.ChildCoolCoilName = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilName(state, unitVent.CoolCoilNum); + unitVent.ChildCoolCoilType = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilType(state, unitVent.CoolCoilNum); + unitVent.ChildCoolCoilNum = HVACHXAssistedCoolingCoil::GetHXCoilCoolCoilIndex(state, unitVent.CoolCoilNum); + // special case, call the parent and return the child water inlet node and water volume flow rate + unitVent.ColdControlNode = HVACHXAssistedCoolingCoil::GetHXCoilWaterInletNode(state, unitVent.CoolCoilNum); + unitVent.MaxVolColdWaterFlow = HVACHXAssistedCoolingCoil::GetHXCoilMaxWaterFlowRate(state, unitVent.CoolCoilNum); } - } - if (!errFlag) { - unitVent.CCoilName = Alphas(18); - ValidateComponent(state, cCoolingCoilType, unitVent.CCoilName, IsNotOK, CurrentModuleObject); - if (IsNotOK) { - ShowContinueError(state, format("...specified in {} = \"{}\".", CurrentModuleObject, unitVent.Name)); + } else if (unitVent.coolCoilType == HVAC::CoilType::CoolingWater) { + unitVent.CoolCoilNum = WaterCoils::GetWaterCoilIndex(state, unitVent.CoolCoilName); + if (unitVent.CoolCoilNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(18), unitVent.HeatCoilName); ErrorsFound = true; } else { - if (unitVent.CCoilType != CoolCoilType::HXAssisted) { - WaterCoils::CoilModel coilModel = WaterCoils::CoilModel::CoolingSimple; - if (unitVent.CCoilType == CoolCoilType::Detailed) coilModel = WaterCoils::CoilModel::CoolingDetailed; - unitVent.CCoil_Index = WaterCoils::GetCompIndex(state, coilModel, unitVent.CCoilName); - unitVent.ColdControlNode = state.dataWaterCoils->WaterCoil(unitVent.CCoil_Index).WaterInletNodeNum; - unitVent.MaxVolColdWaterFlow = state.dataWaterCoils->WaterCoil(unitVent.CCoil_Index).MaxWaterVolFlowRate; - } else { - // special case, call the parent and return the child water inlet node and water volume flow rate - unitVent.ColdControlNode = - HVACHXAssistedCoolingCoil::GetCoilWaterInletNode(state, unitVent.CCoilTypeCh, unitVent.CCoilName, errFlag); - unitVent.MaxVolColdWaterFlow = HVACHXAssistedCoolingCoil::GetCoilMaxWaterFlowRate( - state, "CoilSystem:Cooling:Water:HeatExchangerAssisted", unitVent.CCoilName, errFlag); - } - // Other error checks should trap before it gets to this point in the code, but including just in case. - if (errFlag) { - ShowContinueError(state, format("...specified in {} = \"{}\".", CurrentModuleObject, unitVent.Name)); - ErrorsFound = true; - } +#ifdef GET_OUT + // Not sure what to do with this + WaterCoils::CoilModel coilModel = WaterCoils::CoilModel::CoolingSimple; + if (unitVent.CCoilType == CoolCoilType::Detailed) coilModel = WaterCoils::CoilModel::CoolingDetailed; +#endif // GET_OUT + unitVent.ColdControlNode = WaterCoils::GetCoilInletNode(state, unitVent.CoolCoilNum); + unitVent.MaxVolColdWaterFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, unitVent.CoolCoilNum); } } @@ -690,6 +662,7 @@ namespace UnitVentilator { ErrorsFound = true; } // IF (.NOT. lAlphaBlanks(17)) THEN - from the start of cooling coil information } + if (!unitVent.ATMixerExists) { // check that unit ventilator air inlet node is the same as a zone exhaust node ZoneNodeNotFound = true; @@ -843,8 +816,8 @@ namespace UnitVentilator { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, unitVent.Name, - cCoolingCoilType, - unitVent.CCoilName, + HVAC::coilTypeNames[(int)unitVent.coolCoilType], + unitVent.CoolCoilName, state.dataLoopNodes->NodeID(unitVent.FanOutletNode), "UNDEFINED"); @@ -852,18 +825,19 @@ namespace UnitVentilator { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, unitVent.Name, - cHeatingCoilType, - unitVent.HCoilName, + HVAC::coilTypeNames[(int)unitVent.heatCoilType], + unitVent.HeatCoilName, "UNDEFINED", state.dataLoopNodes->NodeID(unitVent.AirOutNode)); } break; + case CoilsUsed::Heating: { // Add heating coil to component sets array when no cooling coil present BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, unitVent.Name, - cHeatingCoilType, - unitVent.HCoilName, + HVAC::coilTypeNames[(int)unitVent.heatCoilType], + unitVent.HeatCoilName, state.dataLoopNodes->NodeID(unitVent.FanOutletNode), state.dataLoopNodes->NodeID(unitVent.AirOutNode)); } break; @@ -872,8 +846,8 @@ namespace UnitVentilator { BranchNodeConnections::SetUpCompSets(state, CurrentModuleObject, unitVent.Name, - cCoolingCoilType, - unitVent.CCoilName, + HVAC::coilTypeNames[(int)unitVent.coolCoilType], + unitVent.CoolCoilName, state.dataLoopNodes->NodeID(unitVent.FanOutletNode), state.dataLoopNodes->NodeID(unitVent.AirOutNode)); } break; @@ -972,13 +946,13 @@ namespace UnitVentilator { unitVent.Name); } - if (unitVent.HCoilPresent) { + if (unitVent.HeatCoilPresent) { coilReportObj->setCoilSupplyFanInfo( - state, unitVent.HCoilName, unitVent.HCoilTypeCh, unitVent.FanName, unitVent.fanType, unitVent.Fan_Index); + state, unitVent.HeatCoilName, unitVent.heatCoilType, unitVent.FanName, unitVent.fanType, unitVent.Fan_Index); } - if (unitVent.CCoilPresent) { + if (unitVent.CoolCoilPresent) { coilReportObj->setCoilSupplyFanInfo( - state, unitVent.CCoilName, unitVent.CCoilTypeCh, unitVent.FanName, unitVent.fanType, unitVent.Fan_Index); + state, unitVent.CoolCoilName, unitVent.coolCoilType, unitVent.FanName, unitVent.fanType, unitVent.Fan_Index); } } } @@ -1033,23 +1007,24 @@ namespace UnitVentilator { } if (state.dataUnitVentilators->MyPlantScanFlag(UnitVentNum) && allocated(state.dataPlnt->PlantLoop)) { - if ((unitVent.HeatingCoilType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || - (unitVent.HeatingCoilType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { + if ((unitVent.HeatCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || + (unitVent.HeatCoilPlantType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject( - state, unitVent.HCoilName, unitVent.HeatingCoilType, unitVent.HWplantLoc, errFlag, _, _, _, _, _); + state, unitVent.HeatCoilName, unitVent.HeatCoilPlantType, unitVent.HWplantLoc, errFlag, _, _, _, _, _); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type=ZoneHVAC:UnitVentilator", unitVent.Name)); ShowFatalError(state, "InitUnitVentilator: Program terminated due to previous condition(s)."); } - unitVent.HotCoilOutNodeNum = DataPlant::CompData::getPlantComponent(state, unitVent.HWplantLoc).NodeNumOut; + // Why do we sometimes get it from the coil object and sometimes from the plant component? Are these the same? + unitVent.HeatCoilOutNodeNum = DataPlant::CompData::getPlantComponent(state, unitVent.HWplantLoc).NodeNumOut; } - if ((unitVent.CoolingCoilType == DataPlant::PlantEquipmentType::CoilWaterCooling) || - (unitVent.CoolingCoilType == DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling)) { + if ((unitVent.CoolCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterCooling) || + (unitVent.CoolCoilPlantType == DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling)) { bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject( - state, unitVent.CCoilPlantName, unitVent.CoolingCoilType, unitVent.CWPlantLoc, errFlag, _, _, _, _, _); + state, unitVent.CoolCoilName, unitVent.CoolCoilPlantType, unitVent.CWPlantLoc, errFlag, _, _, _, _, _); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type=ZoneHVAC:UnitVentilator", unitVent.Name)); ShowFatalError(state, "InitUnitVentilator: Program terminated due to previous condition(s)."); @@ -1057,7 +1032,7 @@ namespace UnitVentilator { unitVent.ColdCoilOutNodeNum = DataPlant::CompData::getPlantComponent(state, unitVent.CWPlantLoc).NodeNumOut; } else { - if (unitVent.CCoilPresent) + if (unitVent.CoolCoilPresent) ShowFatalError(state, format("InitUnitVentilator: Unit={}, invalid cooling coil type. Program terminated.", unitVent.Name)); } state.dataUnitVentilators->MyPlantScanFlag(UnitVentNum) = false; @@ -1116,9 +1091,9 @@ namespace UnitVentilator { state.dataLoopNodes->Node(InNode).MassFlowRateMax = unitVent.MaxAirMassFlow; state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; - if (unitVent.HCoilPresent) { // Only initialize these if a heating coil is actually present + if (unitVent.HeatCoilPresent) { // Only initialize these if a heating coil is actually present - if (unitVent.HCoilType == HeatCoilType::Water) { + if (unitVent.heatCoilType == HVAC::CoilType::HeatingWater) { Real64 rho = state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); @@ -1127,20 +1102,20 @@ namespace UnitVentilator { unitVent.MinHotWaterFlow = rho * unitVent.MinVolHotWaterFlow; PlantUtilities::InitComponentNodes( - state, unitVent.MinHotWaterFlow, unitVent.MaxHotWaterFlow, unitVent.HotControlNode, unitVent.HotCoilOutNodeNum); - } - if (unitVent.HCoilType == HeatCoilType::Steam) { + state, unitVent.MinHotWaterFlow, unitVent.MaxHotWaterFlow, unitVent.HeatCoilControlNodeNum, unitVent.HeatCoilOutNodeNum); + + } else if (unitVent.heatCoilType == HVAC::CoilType::HeatingSteam) { Real64 TempSteamIn = 100.00; - Real64 SteamDensity = unitVent.HCoil_fluid->getSatDensity(state, TempSteamIn, 1.0, RoutineName); + Real64 SteamDensity = unitVent.HeatCoilFluid->getSatDensity(state, TempSteamIn, 1.0, RoutineName); unitVent.MaxHotSteamFlow = SteamDensity * unitVent.MaxVolHotSteamFlow; unitVent.MinHotSteamFlow = SteamDensity * unitVent.MinVolHotSteamFlow; PlantUtilities::InitComponentNodes( - state, unitVent.MinHotSteamFlow, unitVent.MaxHotSteamFlow, unitVent.HotControlNode, unitVent.HotCoilOutNodeNum); + state, unitVent.MinHotSteamFlow, unitVent.MaxHotSteamFlow, unitVent.HeatCoilControlNodeNum, unitVent.HeatCoilOutNodeNum); } } //(UnitVent(UnitVentNum)%HCoilPresent) - if (unitVent.CCoilPresent) { // Only initialize these if a cooling coil is actually present + if (unitVent.CoolCoilPresent) { // Only initialize these if a cooling coil is actually present Real64 rho = state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).glycol->getDensity(state, 5.0, RoutineName); unitVent.MaxColdWaterFlow = rho * unitVent.MaxVolColdWaterFlow; @@ -1765,7 +1740,7 @@ namespace UnitVentilator { if (unitVent.MaxVolHotWaterFlow == DataSizing::AutoSize) { IsAutoSize = true; } - if (unitVent.HCoilType == HeatCoilType::Water) { + if (unitVent.heatCoilType == HVAC::CoilType::HeatingWater) { if (state.dataSize->CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue if (unitVent.MaxVolHotWaterFlow > 0.0) { @@ -1777,14 +1752,12 @@ namespace UnitVentilator { } } else { CheckZoneSizing(state, state.dataUnitVentilators->cMO_UnitVentilator, unitVent.Name); - - CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, "Coil:Heating:Water", unitVent.HCoilName, ErrorsFound); if (IsAutoSize) { PltSizHeatNum = PlantUtilities::MyPlantSizingIndex( - state, "COIL:HEATING:WATER", unitVent.HCoilName, unitVent.HotControlNode, CoilWaterOutletNode, ErrorsFound); + state, "COIL:HEATING:WATER", unitVent.HeatCoilName, unitVent.HeatCoilControlNodeNum, unitVent.HeatCoilOutNodeNum, ErrorsFound); - if (state.dataWaterCoils->WaterCoil(unitVent.HCoil_Index).UseDesignWaterDeltaTemp) { - WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(unitVent.HCoil_Index).DesignWaterDeltaTemp; + if (state.dataWaterCoils->WaterCoil(unitVent.HeatCoilNum).UseDesignWaterDeltaTemp) { + WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(unitVent.HeatCoilNum).DesignWaterDeltaTemp; DoWaterCoilSizing = true; } else { if (PltSizHeatNum > 0) { @@ -1911,7 +1884,7 @@ namespace UnitVentilator { if (unitVent.MaxVolHotSteamFlow == DataSizing::AutoSize) { IsAutoSize = true; } - if (unitVent.HCoilType == HeatCoilType::Steam) { + if (unitVent.heatCoilType == HVAC::CoilType::HeatingSteam) { if (state.dataSize->CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue if (unitVent.MaxVolHotSteamFlow > 0.0) { @@ -1924,10 +1897,10 @@ namespace UnitVentilator { } else { CheckZoneSizing(state, state.dataUnitVentilators->cMO_UnitVentilator, unitVent.Name); - int CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, "Coil:Heating:Steam", unitVent.HCoilName, ErrorsFound); + int CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, "Coil:Heating:Steam", unitVent.HeatCoilName, ErrorsFound); if (IsAutoSize) { PltSizHeatNum = PlantUtilities::MyPlantSizingIndex( - state, "Coil:Heating:Steam", unitVent.HCoilName, unitVent.HotControlNode, CoilSteamOutletNode, ErrorsFound); + state, "Coil:Heating:Steam", unitVent.HeatCoilName, unitVent.HeatCoilControlNodeNum, CoilSteamOutletNode, ErrorsFound); if (PltSizHeatNum > 0) { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatMassFlow >= HVAC::SmallAirVolFlow) { SizingMethod = HVAC::HeatingCapacitySizing; @@ -2041,8 +2014,8 @@ namespace UnitVentilator { if (unitVent.MaxVolColdWaterFlow == DataSizing::AutoSize) { IsAutoSize = true; } - if (unitVent.CCoilType == CoolCoilType::Water || unitVent.CCoilType == CoolCoilType::Detailed || - unitVent.CCoilType == CoolCoilType::HXAssisted) { + if (unitVent.coolCoilType == HVAC::CoilType::HeatingWater || unitVent.CCoilType == HVAC::CoilType::CoolingWaterDetailed || + unitVent.coolCoilType == CoolCoilType::HXAssisted) { if (state.dataSize->CurZoneEqNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // Simulation continue diff --git a/src/EnergyPlus/UnitVentilator.hh b/src/EnergyPlus/UnitVentilator.hh index 53669ab3b49..5e612b9941f 100644 --- a/src/EnergyPlus/UnitVentilator.hh +++ b/src/EnergyPlus/UnitVentilator.hh @@ -78,23 +78,7 @@ namespace UnitVentilator { Cooling, Num }; - enum class HeatCoilType - { - Invalid = -1, - Electric, - Gas, - Water, - Steam, - Num - }; - enum class CoolCoilType - { - Invalid = -1, - Water, - Detailed, - HXAssisted, - Num - }; + enum class OAControl { Invalid = -1, @@ -134,13 +118,18 @@ namespace UnitVentilator { Real64 MinOutAirVolFlow = 0.0; // m3/s Real64 MinOutAirMassFlow = 0.0; // kg/s CoilsUsed CoilOption = CoilsUsed::Invalid; // type of coil option; options are BOTH, HEATING, COOLING, AND NONE - bool HCoilPresent = false; // .TRUE. if unit ventilator has a heating coil - HeatCoilType HCoilType = HeatCoilType::Invalid; // type of heating coil (water, gas, electric, etc.) - std::string HCoilName; // name of heating coil - std::string HCoilTypeCh; // type of heating coil character string (same as type on idf file). - int HCoil_Index = 0; - DataPlant::PlantEquipmentType HeatingCoilType = DataPlant::PlantEquipmentType::Invalid; - Fluid::RefrigProps *HCoil_fluid = nullptr; + + bool HeatCoilPresent = false; // .TRUE. if unit ventilator has a heating coil + HVAC::CoilType heatCoilType = HVAC::CoilType::Invalid; // type of heating coil (water, gas, electric, etc.) + std::string HeatCoilName; // name of heating coil + int HeatCoilNum = 0; + DataPlant::PlantEquipmentType HeatCoilPlantType = DataPlant::PlantEquipmentType::Invalid; + Fluid::RefrigProps *HeatCoilFluid = nullptr; + int HeatCoilOutNodeNum = 0; // outlet of coil + int HeatCoilControlNodeNum = 0; // hot water control node + Real64 HeatCoilControlOffset = 0.0; // control tolerance + PlantLocation HWplantLoc; // index for plant location for hot water coil + int HCoilSchedPtr = 0; // index to schedule Real64 HCoilSchedValue = 0.0; Real64 MaxVolHotWaterFlow = 0.0; // m3/s @@ -151,18 +140,16 @@ namespace UnitVentilator { Real64 MinVolHotWaterFlow = 0.0; // m3/s Real64 MinVolHotSteamFlow = 0.0; // m3/s Real64 MinHotWaterFlow = 0.0; // kg/s - int HotControlNode = 0; // hot water control node - int HotCoilOutNodeNum = 0; // outlet of coil - Real64 HotControlOffset = 0.0; // control tolerance - PlantLocation HWplantLoc; // index for plant location for hot water coil - bool CCoilPresent = false; // .TRUE. if unit ventilator has a cooling coil - std::string CCoilName; // name of cooling coil - std::string CCoilTypeCh; // type of cooling coil as character string (same as on idf file) - int CCoil_Index = 0; - std::string CCoilPlantName; // name of cooling coil for plant - std::string CCoilPlantType; // type of cooling coil for plant - DataPlant::PlantEquipmentType CoolingCoilType = DataPlant::PlantEquipmentType::Invalid; - CoolCoilType CCoilType = CoolCoilType::Invalid; + + bool CoolCoilPresent = false; // .TRUE. if unit ventilator has a cooling coil + HVAC::CoilType coolCoilType = HVAC::CoilType::Invalid; + std::string CoolCoilName; // name of cooling coil + int CoolCoilNum = 0; + DataPlant::PlantEquipmentType CoolCoilPlantType = DataPlant::PlantEquipmentType::Invalid; + std::string ChildCoolCoilName; // name of child coil if this is an HXAssisted coil + HVAC::CoilType ChildCoolCoilType; // name of child coil if this is an HXAssisted coil + int ChildCoolCoilNum = 0; + int CCoilSchedPtr = 0; // index to schedule Real64 CCoilSchedValue = 0.0; Real64 MaxVolColdWaterFlow = 0.0; // m3/s diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index a82ca171001..7e6d3a02ab6 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -257,9 +257,10 @@ namespace UnitarySystems { int m_ZoneInletNode = 0; int m_ZoneSequenceCoolingNum = 0; int m_ZoneSequenceHeatingNum = 0; + bool m_HeatCoilExists = false; Real64 m_HeatingSizingRatio = 1.0; - int m_HeatingCoilType_Num = 0; + HVAC::CoilType m_HeatingCoilType = HVAC::CoilType::Invalid; bool m_DXHeatingCoil = false; int m_HeatingCoilIndex = 0; int m_HeatingCoilAvailSchPtr = 0; @@ -270,8 +271,9 @@ namespace UnitarySystems { bool m_MultiSpeedHeatingCoil = false; bool m_VarSpeedHeatingCoil = false; int HeatCtrlNode = 0; + bool m_CoolCoilExists = false; - int m_CoolingCoilType_Num = 0; + HVAC::CoilType m_CoolingCoilType = HVAC::CoilType::Invalid; int m_NumOfSpeedCooling = 0; int m_CoolingCoilAvailSchPtr = 0; Real64 m_DesignCoolingCapacity = 0.0; @@ -290,7 +292,8 @@ namespace UnitarySystems { bool m_RunOnLatentLoad = false; bool m_RunOnLatentOnlyWithSensible = false; HVAC::CoilMode m_DehumidificationMode = HVAC::CoilMode::Normal; // Only explicitly initialized if something other than Normal - int m_SuppHeatCoilType_Num = 0; + + HVAC::CoilType m_SuppHeatCoilType = HVAC::CoilType::Invalid; bool m_SuppCoilExists = false; Real64 m_DesignSuppHeatingCapacity = 0.0; int m_SuppCoilAirInletNode = 0; diff --git a/src/EnergyPlus/UtilityRoutines.hh b/src/EnergyPlus/UtilityRoutines.hh index 67c761484ed..e770c2513ca 100644 --- a/src/EnergyPlus/UtilityRoutines.hh +++ b/src/EnergyPlus/UtilityRoutines.hh @@ -290,7 +290,7 @@ void ShowSevereInvalidKey( EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view msg = {}); void ShowSevereInvalidBool(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue); -void ShowSevereCustomMessage(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg); +void ShowSevereCustom(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg); void ShowWarningDuplicateName(EnergyPlusData &state, ErrorObjectHeader const &eoh); void ShowWarningEmptyField(EnergyPlusData &state, ErrorObjectHeader const &eoh, diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index 52c79d72632..f3d056b361f 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -171,20 +171,21 @@ namespace VariableSpeedCoils { SpeedCal = SpeedNum; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); + if ((vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) || + (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed)) { // Cooling mode InitVarSpeedCoil(state, DXCoilNum, SensLoad, LatentLoad, fanOp, OnOffAirFlowRatio, SpeedRatio, SpeedCal); CalcVarSpeedCoilCooling( state, DXCoilNum, fanOp, SensLoad, LatentLoad, compressorOp, PartLoadFrac, OnOffAirFlowRatio, SpeedRatio, SpeedCal); UpdateVarSpeedCoil(state, DXCoilNum); - } else if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { + } else if ((vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) || + (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed)) { // Heating mode InitVarSpeedCoil(state, DXCoilNum, SensLoad, LatentLoad, fanOp, OnOffAirFlowRatio, SpeedRatio, SpeedCal); CalcVarSpeedCoilHeating(state, DXCoilNum, fanOp, SensLoad, compressorOp, PartLoadFrac, OnOffAirFlowRatio, SpeedRatio, SpeedCal); UpdateVarSpeedCoil(state, DXCoilNum); - } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + } else if (vsCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed) { // Heating mode InitVarSpeedCoil(state, DXCoilNum, SensLoad, LatentLoad, fanOp, OnOffAirFlowRatio, SpeedRatio, SpeedCal); CalcVarSpeedHPWH(state, DXCoilNum, PartLoadFrac, SpeedRatio, SpeedNum, fanOp); @@ -194,8 +195,8 @@ namespace VariableSpeedCoils { } // two additional output variables - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport = SpeedCal; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport = SpeedRatio; + vsCoil.SpeedNumReport = SpeedCal; + vsCoil.SpeedRatioReport = SpeedRatio; } void GetVarSpeedCoilInput(EnergyPlusData &state) @@ -310,26 +311,26 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "COOLING"; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType = HVAC::Coil_CoolingWaterToAirHPVSEquationFit; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = - HVAC::cAllCoilTypes(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = NumArray(3); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated = NumArray(6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated = NumArray(7); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = NumArray(8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant = NumArray(9); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime = NumArray(10); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HOTGASREHEATFLG = int(NumArray(11)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = DataHeatBalance::RefrigCondenserType::Water; - - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); + + vsCoil.bIsDesuperheater = false; + vsCoil.Name = AlphArray(1); + vsCoil.CoolHeatType = "COOLING"; + vsCoil.coilType = HVAC::CoilType::CoolingWaterToAirHPVSEquationFit; + vsCoil.NumOfSpeeds = int(NumArray(1)); + vsCoil.NormSpedLevel = int(NumArray(2)); + vsCoil.RatedCapCoolTotal = NumArray(3); + vsCoil.RatedAirVolFlowRate = NumArray(4); + vsCoil.RatedWaterVolFlowRate = NumArray(5); + vsCoil.Twet_Rated = NumArray(6); + vsCoil.Gamma_Rated = NumArray(7); + vsCoil.MaxONOFFCyclesperHour = NumArray(8); + vsCoil.LatentCapacityTimeConstant = NumArray(9); + vsCoil.FanDelayTime = NumArray(10); + vsCoil.HOTGASREHEATFLG = int(NumArray(11)); + vsCoil.CondenserType = DataHeatBalance::RefrigCondenserType::Water; + + vsCoil.WaterInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, @@ -339,7 +340,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = + vsCoil.WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, @@ -349,7 +350,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = + vsCoil.AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), ErrorsFound, @@ -359,7 +360,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = + vsCoil.AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, @@ -374,105 +375,99 @@ namespace VariableSpeedCoils { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + if (vsCoil.NumOfSpeeds < 1) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 1. entered number is {:.0T}", cNumericFields(1), NumArray(1))); ErrorsFound = true; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) { + vsCoil.NormSpedLevel = vsCoil.NumOfSpeeds; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + if ((vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) || (vsCoil.NormSpedLevel <= 0)) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be valid speed level entered number is {:.0T}", cNumericFields(2), NumArray(2))); ErrorsFound = true; } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + vsCoil.PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number + if (vsCoil.PLFFPLR == 0) { if (lAlphaBlanks(6)) { ShowSevereError( state, - format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(6))); } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(6), AlphArray(6))); } ErrorsFound = true; } else { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(6))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); } } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(13 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(14 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(15 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(16 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(I) = NumArray(17 + (I - 1) * 6); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); + vsCoil.MSRatedSHR(I) = NumArray(13 + (I - 1) * 6); + vsCoil.MSRatedCOP(I) = NumArray(14 + (I - 1) * 6); + vsCoil.MSRatedAirVolFlowRate(I) = NumArray(15 + (I - 1) * 6); + vsCoil.MSRatedWaterVolFlowRate(I) = NumArray(16 + (I - 1) * 6); + vsCoil.MSWasteHeatFrac(I) = NumArray(17 + (I - 1) * 6); AlfaFieldIncre = 7 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + vsCoil.MSCCapFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + vsCoil.MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -481,43 +476,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 8 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + vsCoil.MSCCapAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + vsCoil.MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -526,43 +520,43 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 9 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = + vsCoil.MSCCapWaterFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { + if (vsCoil.MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index + vsCoil.MSCCapWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -571,44 +565,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 10 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + vsCoil.MSEIRFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + vsCoil.MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -617,43 +609,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 11 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + vsCoil.MSEIRAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + vsCoil.MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -662,43 +653,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { + vsCoil.MSEIRWaterFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index + vsCoil.MSEIRWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -708,44 +698,42 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { + vsCoil.MSWasteHeat(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), // Curve index + vsCoil.MSWasteHeat(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), RatedInletWaterTemp, RatedInletAirTemp); + CurveVal = Curve::CurveValue(state, vsCoil.MSWasteHeat(I), RatedInletWaterTemp, RatedInletAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -754,66 +742,59 @@ namespace VariableSpeedCoils { } } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedPercentTotCap(I) = vsCoil.MSRatedTotCap(I) / vsCoil.MSRatedTotCap(vsCoil.NumOfSpeeds); + vsCoil.MSRatedAirVolFlowPerRatedTotCap(I) = vsCoil.MSRatedAirVolFlowRate(I) / vsCoil.MSRatedTotCap(I); + vsCoil.MSRatedWaterVolFlowPerRatedTotCap(I) = vsCoil.MSRatedWaterVolFlowRate(I) / vsCoil.MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit" SetupOutputVariable(state, "Cooling Coil Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, + vsCoil.Energy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); SetupOutputVariable(state, "Cooling Coil Total Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + vsCoil.EnergyLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::EnergyTransfer, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::CoolingCoils); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible, + vsCoil.EnergySensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent, + vsCoil.EnergyLatent, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, + vsCoil.EnergySource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::PlantLoopCoolingDemand, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::CoolingCoils); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = + vsCoil.RatedCapCoolSens = DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } @@ -841,25 +822,26 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); + + vsCoil.bIsDesuperheater = false; + vsCoil.Name = AlphArray(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils - state.dataHeatBal->HeatReclaimVS_DXCoil(DXCoilNum).Name = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name; + state.dataHeatBal->HeatReclaimVS_DXCoil(DXCoilNum).Name = vsCoil.Name; state.dataHeatBal->HeatReclaimVS_DXCoil(DXCoilNum).SourceType = CurrentModuleObject; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "COOLING"; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType = HVAC::Coil_CoolingAirToAirVariableSpeed; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = HVAC::cAllCoilTypes(HVAC::Coil_CoolingAirToAirVariableSpeed); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = NumArray(3); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated = NumArray(5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated = NumArray(6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = NumArray(7); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant = NumArray(8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime = NumArray(9); - - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = + vsCoil.CoolHeatType = "COOLING"; + vsCoil.coilType = HVAC::CoilType::CoolingAirToAirVariableSpeed; + vsCoil.NumOfSpeeds = int(NumArray(1)); + vsCoil.NormSpedLevel = int(NumArray(2)); + vsCoil.RatedCapCoolTotal = NumArray(3); + vsCoil.RatedAirVolFlowRate = NumArray(4); + vsCoil.Twet_Rated = NumArray(5); + vsCoil.Gamma_Rated = NumArray(6); + vsCoil.MaxONOFFCyclesperHour = NumArray(7); + vsCoil.LatentCapacityTimeConstant = NumArray(8); + vsCoil.FanDelayTime = NumArray(9); + + vsCoil.AirInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, @@ -869,7 +851,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = + vsCoil.AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, @@ -882,53 +864,49 @@ namespace VariableSpeedCoils { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + if (vsCoil.NumOfSpeeds < 1) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 1. entered number is {:.0T}", cNumericFields(1), NumArray(1))); ErrorsFound = true; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) { + vsCoil.NormSpedLevel = vsCoil.NumOfSpeeds; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + if ((vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) || (vsCoil.NormSpedLevel <= 0)) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be valid speed level entered number is {:.0T}", cNumericFields(2), NumArray(2))); ErrorsFound = true; } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + vsCoil.PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number + if (vsCoil.PLFFPLR == 0) { if (lAlphaBlanks(4)) { ShowSevereError( state, - format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(6))); } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(4), AlphArray(4))); } ErrorsFound = true; } else { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(4))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); } @@ -936,25 +914,25 @@ namespace VariableSpeedCoils { // outdoor condenser node if (lAlphaBlanks(5)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum = 0; + vsCoil.CondenserInletNodeNum = 0; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum = + vsCoil.CondenserInletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, DataLoopNode::ConnectionObjectType::CoilCoolingDXVariableSpeed, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::OutsideAirReference, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - if (!OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum)) { + if (!OutAirNodeManager::CheckOutAirNodeNumber(state, vsCoil.CondenserInletNodeNum)) { ShowWarningError(state, format("{}{}=\"{}\", may be invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("{}=\"{}\", node does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node.", cAlphaFields(10), @@ -965,26 +943,26 @@ namespace VariableSpeedCoils { } if ((Util::SameString(AlphArray(6), "AirCooled")) || lAlphaBlanks(6)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = DataHeatBalance::RefrigCondenserType::Air; + vsCoil.CondenserType = DataHeatBalance::RefrigCondenserType::Air; } else if (Util::SameString(AlphArray(6), "EvaporativelyCooled")) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = DataHeatBalance::RefrigCondenserType::Evap; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ReportEvapCondVars = true; + vsCoil.CondenserType = DataHeatBalance::RefrigCondenserType::Evap; + vsCoil.ReportEvapCondVars = true; } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{}=\"{}\":", cAlphaFields(6), AlphArray(6))); ShowContinueError(state, "...must be AirCooled or EvaporativelyCooled."); ErrorsFound = true; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower = NumArray(10); + vsCoil.EvapCondPumpElecNomPower = NumArray(10); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower != DataSizing::AutoSize) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower < 0.0) { + if (vsCoil.EvapCondPumpElecNomPower != DataSizing::AutoSize) { + if (vsCoil.EvapCondPumpElecNomPower < 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} cannot be < 0.0.", cNumericFields(10))); ShowContinueError(state, format("...entered value=[{:.2T}].", NumArray(10))); ErrorsFound = true; @@ -992,160 +970,157 @@ namespace VariableSpeedCoils { } // Set crankcase heater capacity - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(11); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + vsCoil.CrankcaseHeaterCapacity = NumArray(11); + if (vsCoil.CrankcaseHeaterCapacity < 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} cannot be < 0.0.", cNumericFields(11))); ShowContinueError(state, format("...entered value=[{:.2T}].", NumArray(11))); ErrorsFound = true; } // Set crankcase heater cutout temperature - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(12); + vsCoil.MaxOATCrankcaseHeater = NumArray(12); // Set crankcase heater cutout temperature - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor = NumArray(13); + vsCoil.MinOATCompressor = NumArray(13); // A7; \field Crankcase Heater Capacity Function of Outdoor Temperature Curve Name if (!lAlphaBlanks(7)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(7)); + vsCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(7)); ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, // Curve index + vsCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(7)); // Field Name } // Get Water System tank connections // A8, \field Name of Water Storage Tank for Supply - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName = AlphArray(8); + vsCoil.EvapWaterSupplyName = AlphArray(8); if (lAlphaBlanks(8)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; + vsCoil.EvapWaterSupplyMode = WaterSupplyFromMains; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; + vsCoil.EvapWaterSupplyMode = WaterSupplyFromTank; WaterManager::SetupTankDemandComponent(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName, + vsCoil.EvapWaterSupplyName, ErrorsFound, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID); + vsCoil.EvapWaterSupTankID, + vsCoil.EvapWaterTankDemandARRID); } // A9; \field Name of Water Storage Tank for Condensate Collection - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName = AlphArray(9); + vsCoil.CondensateCollectName = AlphArray(9); if (lAlphaBlanks(9)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + vsCoil.CondensateCollectMode = CondensateDiscarded; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; + vsCoil.CondensateCollectMode = CondensateToTank; WaterManager::SetupTankSupplyComponent(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName, + vsCoil.CondensateCollectName, ErrorsFound, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankID, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankSupplyARRID); + vsCoil.CondensateTankID, + vsCoil.CondensateTankSupplyARRID); } // Basin heater power as a function of temperature must be greater than or equal to 0 - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff = NumArray(14); + vsCoil.BasinHeaterPowerFTempDiff = NumArray(14); if (NumArray(14) < 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 0.0.", cNumericFields(14))); ShowContinueError(state, format("...entered value=[{:.2T}].", NumArray(14))); ErrorsFound = true; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp = NumArray(15); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { + vsCoil.BasinHeaterSetPointTemp = NumArray(15); + if (vsCoil.BasinHeaterPowerFTempDiff > 0.0) { + if (vsCoil.BasinHeaterSetPointTemp < 2.0) { ShowWarningError(state, format("{}{}=\"{}\", freeze possible", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...{} is < 2 {{C}}. Freezing could occur.", cNumericFields(15))); ShowContinueError(state, format("...entered value=[{:.2T}].", NumArray(15))); } } if (!lAlphaBlanks(10)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr = + vsCoil.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, AlphArray(10)); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { + if (vsCoil.BasinHeaterSchedulePtr == 0) { ShowWarningError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(10), AlphArray(10))); ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); } } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(16 + (I - 1) * 8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(17 + (I - 1) * 8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(18 + (I - 1) * 8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(19 + (I - 1) * 8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvaporatorFanPowerPerVolumeFlowRate2017(I) = NumArray(20 + (I - 1) * 8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvaporatorFanPowerPerVolumeFlowRate2023(I) = NumArray(21 + (I - 1) * 8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(I) = NumArray(22 + (I - 1) * 8); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(I) = NumArray(23 + (I - 1) * 8); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(I) < 0.0 || - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(I) > 1.0) { + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedTotCap(I) = NumArray(16 + (I - 1) * 8); + vsCoil.MSRatedSHR(I) = NumArray(17 + (I - 1) * 8); + vsCoil.MSRatedCOP(I) = NumArray(18 + (I - 1) * 8); + vsCoil.MSRatedAirVolFlowRate(I) = NumArray(19 + (I - 1) * 8); + vsCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2017(I) = NumArray(20 + (I - 1) * 8); + vsCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2023(I) = NumArray(21 + (I - 1) * 8); + vsCoil.EvapCondAirFlow(I) = NumArray(22 + (I - 1) * 8); + vsCoil.EvapCondEffect(I) = NumArray(23 + (I - 1) * 8); + if (vsCoil.EvapCondEffect(I) < 0.0 || vsCoil.EvapCondEffect(I) > 1.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} cannot be < 0.0 or > 1.0.", cNumericFields(23 + (I - 1) * 8))); ShowContinueError(state, format("...entered value=[{:.2T}].", NumArray(23 + (I - 1) * 8))); ErrorsFound = true; } AlfaFieldIncre = 11 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + vsCoil.MSCCapFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + vsCoil.MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1154,43 +1129,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + vsCoil.MSCCapAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + vsCoil.MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1199,44 +1173,43 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 13 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + vsCoil.MSEIRFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + vsCoil.MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); + state, vsCoil.MSEIRFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1245,43 +1218,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 14 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + vsCoil.MSEIRAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + vsCoil.MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1290,63 +1262,56 @@ namespace VariableSpeedCoils { } } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedPercentTotCap(I) = vsCoil.MSRatedTotCap(I) / vsCoil.MSRatedTotCap(vsCoil.NumOfSpeeds); + vsCoil.MSRatedAirVolFlowPerRatedTotCap(I) = vsCoil.MSRatedAirVolFlowRate(I) / vsCoil.MSRatedTotCap(I); + vsCoil.MSRatedEvapCondVolFlowPerRatedTotCap(I) = vsCoil.EvapCondAirFlow(I) / vsCoil.MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed" SetupOutputVariable(state, "Cooling Coil Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, + vsCoil.Energy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); SetupOutputVariable(state, "Cooling Coil Total Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + vsCoil.EnergyLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::EnergyTransfer, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::CoolingCoils); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible, + vsCoil.EnergySensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent, + vsCoil.EnergyLatent, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, + vsCoil.EnergySource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = + vsCoil.RatedCapCoolSens = DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } @@ -1374,26 +1339,26 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "HEATING"; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType = HVAC::Coil_HeatingWaterToAirHPVSEquationFit; // fix coil type + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); + + vsCoil.bIsDesuperheater = false; + vsCoil.Name = AlphArray(1); + vsCoil.CoolHeatType = "HEATING"; + vsCoil.coilType = HVAC::CoilType::HeatingWaterToAirHPVSEquationFit; // fix coil type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = - HVAC::cAllCoilTypes(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat = NumArray(3); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = DataHeatBalance::RefrigCondenserType::Water; + vsCoil.NumOfSpeeds = int(NumArray(1)); + vsCoil.NormSpedLevel = int(NumArray(2)); + vsCoil.RatedCapHeat = NumArray(3); + vsCoil.RatedAirVolFlowRate = NumArray(4); + vsCoil.RatedWaterVolFlowRate = NumArray(5); + vsCoil.CondenserType = DataHeatBalance::RefrigCondenserType::Water; // Previously set by parent objects, but not user-definable - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant = 0.; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime = 0.; + vsCoil.MaxONOFFCyclesperHour = 4; + vsCoil.LatentCapacityTimeConstant = 0.; + vsCoil.FanDelayTime = 0.; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = + vsCoil.WaterInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, @@ -1403,7 +1368,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = + vsCoil.WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, @@ -1413,7 +1378,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = + vsCoil.AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), ErrorsFound, @@ -1423,7 +1388,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = + vsCoil.AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, @@ -1438,98 +1403,93 @@ namespace VariableSpeedCoils { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + if (vsCoil.NumOfSpeeds < 1) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 1. entered number is {:.0T}", cNumericFields(1), NumArray(1))); ErrorsFound = true; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) { + vsCoil.NormSpedLevel = vsCoil.NumOfSpeeds; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + if ((vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) || (vsCoil.NormSpedLevel <= 0)) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be valid speed level entered number is {:.0T}", cNumericFields(2), NumArray(2))); ErrorsFound = true; } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + vsCoil.PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number + if (vsCoil.PLFFPLR == 0) { if (lAlphaBlanks(6)) { ShowSevereError( state, - format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(6))); } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(6), AlphArray(6))); } ErrorsFound = true; } else { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(6))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); } } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(6 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(7 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(8 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(9 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(I) = NumArray(10 + (I - 1) * 5); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedTotCap(I) = NumArray(6 + (I - 1) * 5); + vsCoil.MSRatedCOP(I) = NumArray(7 + (I - 1) * 5); + vsCoil.MSRatedAirVolFlowRate(I) = NumArray(8 + (I - 1) * 5); + vsCoil.MSRatedWaterVolFlowRate(I) = NumArray(9 + (I - 1) * 5); + vsCoil.MSWasteHeatFrac(I) = NumArray(10 + (I - 1) * 5); AlfaFieldIncre = 7 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + vsCoil.MSCCapFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + vsCoil.MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { CurveVal = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), + vsCoil.MSCCapFTemp(I), RatedInletAirTempHeat, RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { @@ -1537,7 +1497,7 @@ namespace VariableSpeedCoils { format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1546,43 +1506,43 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 8 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = + vsCoil.MSCCapAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + if (vsCoil.MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + vsCoil.MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1591,43 +1551,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 9 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { + vsCoil.MSCCapWaterFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index + vsCoil.MSCCapWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1636,38 +1595,37 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 10 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + vsCoil.MSEIRFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + vsCoil.MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { CurveVal = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), + vsCoil.MSEIRFTemp(I), RatedInletAirTempHeat, RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { @@ -1675,7 +1633,7 @@ namespace VariableSpeedCoils { format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1684,43 +1642,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 11 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + vsCoil.MSEIRAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + vsCoil.MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1729,43 +1686,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 7; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { + vsCoil.MSEIRWaterFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index + vsCoil.MSEIRWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1775,38 +1731,37 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { + vsCoil.MSWasteHeat(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), // Curve index + vsCoil.MSWasteHeat(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { CurveVal = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), + vsCoil.MSWasteHeat(I), RatedInletAirTempHeat, RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { @@ -1814,7 +1769,7 @@ namespace VariableSpeedCoils { format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -1823,63 +1778,56 @@ namespace VariableSpeedCoils { } } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedPercentTotCap(I) = vsCoil.MSRatedTotCap(I) / vsCoil.MSRatedTotCap(vsCoil.NumOfSpeeds); + vsCoil.MSRatedAirVolFlowPerRatedTotCap(I) = vsCoil.MSRatedAirVolFlowRate(I) / vsCoil.MSRatedTotCap(I); + vsCoil.MSRatedWaterVolFlowPerRatedTotCap(I) = vsCoil.MSRatedWaterVolFlowRate(I) / vsCoil.MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit" SetupOutputVariable(state, "Heating Coil Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, + vsCoil.Energy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); SetupOutputVariable(state, "Heating Coil Heating Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + vsCoil.EnergyLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::EnergyTransfer, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::HeatingCoils); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, + vsCoil.EnergySource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::PlantLoopHeatingDemand, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::HeatingCoils); // create predefined report entries OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); + state, state.dataOutRptPredefined->pdchHeatCoilType, vsCoil.Name, CurrentModuleObject); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); + vsCoil.Name, + vsCoil.RatedCapHeat); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); + vsCoil.Name, + vsCoil.MSRatedCOP( + vsCoil.NormSpedLevel)); } //-------------------------AIR SOURCE, HEATING---BEGIN @@ -1905,22 +1853,23 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "HEATING"; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType = HVAC::Coil_HeatingAirToAirVariableSpeed; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = HVAC::cAllCoilTypes(HVAC::Coil_HeatingAirToAirVariableSpeed); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat = NumArray(3); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); + + vsCoil.bIsDesuperheater = false; + vsCoil.Name = AlphArray(1); + vsCoil.CoolHeatType = "HEATING"; + vsCoil.coilType = HVAC::CoilType::HeatingAirToAirVariableSpeed; + vsCoil.NumOfSpeeds = int(NumArray(1)); + vsCoil.NormSpedLevel = int(NumArray(2)); + vsCoil.RatedCapHeat = NumArray(3); + vsCoil.RatedAirVolFlowRate = NumArray(4); // Previously set by parent objects, but not user-definable - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant = 0.; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime = 0.; + vsCoil.MaxONOFFCyclesperHour = 4; + vsCoil.LatentCapacityTimeConstant = 0.; + vsCoil.FanDelayTime = 0.; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = + vsCoil.AirInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, @@ -1930,7 +1879,7 @@ namespace VariableSpeedCoils { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = + vsCoil.AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, @@ -1943,81 +1892,76 @@ namespace VariableSpeedCoils { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + if (vsCoil.NumOfSpeeds < 1) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 1. entered number is {:.0T}", cNumericFields(1), NumArray(1))); ErrorsFound = true; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) { + vsCoil.NormSpedLevel = vsCoil.NumOfSpeeds; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + if ((vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) || (vsCoil.NormSpedLevel <= 0)) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be valid speed level entered number is {:.0T}", cNumericFields(2), NumArray(2))); ErrorsFound = true; } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + vsCoil.PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number + if (vsCoil.PLFFPLR == 0) { if (lAlphaBlanks(4)) { ShowSevereError( state, - format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(4))); } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(4), AlphArray(4))); } ErrorsFound = true; } else { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(4))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); } } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT = - Curve::GetCurveIndex(state, AlphArray(5)); // convert curve name to number + vsCoil.DefrostEIRFT = Curve::GetCurveIndex(state, AlphArray(5)); // convert curve name to number if (!lAlphaBlanks(6)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(6)); + vsCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(6)); ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, // Curve index + vsCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(6)); // Field Name } if (Util::SameString(AlphArray(7), "ReverseCycle")) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT == 0) { + if (vsCoil.DefrostEIRFT == 0) { if (lAlphaBlanks(5)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(5))); ShowContinueError(state, format("...field is required because {} is \"ReverseCycle\".", cAlphaFields(7))); } else { @@ -2025,144 +1969,140 @@ namespace VariableSpeedCoils { format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(5), AlphArray(5))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, // Curve index + vsCoil.DefrostEIRFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name } } - if (Util::SameString(AlphArray(7), "ReverseCycle")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy = ReverseCycle; - if (Util::SameString(AlphArray(7), "Resistive")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy = Resistive; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy == 0) { + if (Util::SameString(AlphArray(7), "ReverseCycle")) vsCoil.DefrostStrategy = ReverseCycle; + if (Util::SameString(AlphArray(7), "Resistive")) vsCoil.DefrostStrategy = Resistive; + if (vsCoil.DefrostStrategy == 0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...illegal {}=\"{}\".", cAlphaFields(7), AlphArray(7))); ShowContinueError(state, "...valid values for this field are ReverseCycle or Resistive."); ErrorsFound = true; } - if (Util::SameString(AlphArray(8), "Timed")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl = Timed; - if (Util::SameString(AlphArray(8), "OnDemand")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl = OnDemand; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl == 0) { + if (Util::SameString(AlphArray(8), "Timed")) vsCoil.DefrostControl = Timed; + if (Util::SameString(AlphArray(8), "OnDemand")) vsCoil.DefrostControl = OnDemand; + if (vsCoil.DefrostControl == 0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...illegal {}=\"{}\".", cAlphaFields(8), AlphArray(8))); ShowContinueError(state, "...valid values for this field are Timed or OnDemand."); ErrorsFound = true; } // Set minimum OAT for heat pump compressor operation - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor = NumArray(5); + vsCoil.MinOATCompressor = NumArray(5); // reserved for HSPF calculation - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OATempCompressorOn = NumArray(6); + vsCoil.OATempCompressorOn = NumArray(6); // Set maximum outdoor temp for defrost to occur - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATDefrost = NumArray(7); + vsCoil.MaxOATDefrost = NumArray(7); // Set crankcase heater capacity - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(8); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + vsCoil.CrankcaseHeaterCapacity = NumArray(8); + if (vsCoil.CrankcaseHeaterCapacity < 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} cannot be < 0.0.", cNumericFields(9))); ShowContinueError(state, format("...entered value=[{:.2T}].", NumArray(9))); ErrorsFound = true; } // Set crankcase heater cutout temperature - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(9); + vsCoil.MaxOATCrankcaseHeater = NumArray(9); // Set defrost time period - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostTime = NumArray(10); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostTime == 0.0 && - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl == 1) { + vsCoil.DefrostTime = NumArray(10); + if (vsCoil.DefrostTime == 0.0 && vsCoil.DefrostControl == 1) { ShowWarningError( - state, format("{}{}=\"{}\", ", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + state, format("{}{}=\"{}\", ", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} = 0.0 for defrost control = TIMED.", cNumericFields(5))); } // Set defrost capacity (for resistive defrost) - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity = NumArray(11); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity == 0.0 && - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy == 2) { + vsCoil.DefrostCapacity = NumArray(11); + if (vsCoil.DefrostCapacity == 0.0 && vsCoil.DefrostStrategy == 2) { ShowWarningError( - state, format("{}{}=\"{}\", ", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + state, format("{}{}=\"{}\", ", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} = 0.0 for defrost strategy = RESISTIVE.", cNumericFields(6))); } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(14 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvaporatorFanPowerPerVolumeFlowRate2017(I) = NumArray(15 + (I - 1) * 5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvaporatorFanPowerPerVolumeFlowRate2023(I) = NumArray(16 + (I - 1) * 5); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedTotCap(I) = NumArray(12 + (I - 1) * 5); + vsCoil.MSRatedCOP(I) = NumArray(13 + (I - 1) * 5); + vsCoil.MSRatedAirVolFlowRate(I) = NumArray(14 + (I - 1) * 5); + vsCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2017(I) = NumArray(15 + (I - 1) * 5); + vsCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2023(I) = NumArray(16 + (I - 1) * 5); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) < 1.e-10) { + if (vsCoil.MSRatedTotCap(I) < 1.e-10) { ShowSevereError(state, format("{}{}=\"{}\", invalid value", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...too small {}=[{:.2R}].", cNumericFields(12 + (I - 1) * 3), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I))); + vsCoil.MSRatedTotCap(I))); ErrorsFound = true; } AlfaFieldIncre = 9 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + vsCoil.MSCCapFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + vsCoil.MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2171,43 +2111,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 10 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + vsCoil.MSCCapAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + vsCoil.MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2216,44 +2155,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 11 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + vsCoil.MSEIRFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + vsCoil.MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2262,43 +2199,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 4; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + vsCoil.MSEIRAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + vsCoil.MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2309,57 +2245,51 @@ namespace VariableSpeedCoils { if (ErrorsFound) continue; - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedPercentTotCap(I) = vsCoil.MSRatedTotCap(I) / vsCoil.MSRatedTotCap(vsCoil.NumOfSpeeds); + vsCoil.MSRatedAirVolFlowPerRatedTotCap(I) = vsCoil.MSRatedAirVolFlowRate(I) / vsCoil.MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Heating:DX:Variablespeed " SetupOutputVariable(state, "Heating Coil Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, + vsCoil.Energy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); SetupOutputVariable(state, "Heating Coil Heating Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + vsCoil.EnergyLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::EnergyTransfer, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::HeatingCoils); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, + vsCoil.EnergySource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); // create predefined report entries OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); + state, state.dataOutRptPredefined->pdchHeatCoilType, vsCoil.Name, CurrentModuleObject); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); + vsCoil.Name, + vsCoil.RatedCapHeat); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); + vsCoil.Name, + vsCoil.MSRatedCOP(vsCoil.NormSpedLevel)); } //-------------------------AIR SOURCE HEATING---END @@ -2386,87 +2316,83 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = DataHeatBalance::RefrigCondenserType::WaterHeater; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "WATERHEATING"; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType = HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = - HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed); + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); + vsCoil.bIsDesuperheater = false; + vsCoil.CondenserType = DataHeatBalance::RefrigCondenserType::WaterHeater; + vsCoil.CoolHeatType = "WATERHEATING"; + vsCoil.coilType = HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed; + vsCoil.Name = AlphArray(1); + vsCoil.NumOfSpeeds = int(NumArray(1)); + vsCoil.NormSpedLevel = int(NumArray(2)); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + if (vsCoil.NumOfSpeeds < 1) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 1. entered number is {:.0T}", cNumericFields(1), NumArray(1))); ErrorsFound = true; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) { + vsCoil.NormSpedLevel = vsCoil.NumOfSpeeds; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + if ((vsCoil.NormSpedLevel > vsCoil.NumOfSpeeds) || (vsCoil.NormSpedLevel <= 0)) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be valid speed level entered number is {:.0T}", cNumericFields(2), NumArray(2))); ErrorsFound = true; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH = NumArray(3); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH <= 0.0) { + vsCoil.RatedCapWH = NumArray(3); + if (vsCoil.RatedCapWH <= 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be > 0.0, entered value=[{:.2T}].", cNumericFields(3), NumArray(3))); ErrorsFound = true; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp = NumArray(4); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp = NumArray(5); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp = NumArray(6); + vsCoil.WHRatedInletDBTemp = NumArray(4); + vsCoil.WHRatedInletWBTemp = NumArray(5); + vsCoil.WHRatedInletWaterTemp = NumArray(6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(7); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(8); + vsCoil.RatedAirVolFlowRate = NumArray(7); + vsCoil.RatedWaterVolFlowRate = NumArray(8); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate != Constant::AutoCalculate) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate <= 0.0) { + if (vsCoil.RatedAirVolFlowRate != Constant::AutoCalculate) { + if (vsCoil.RatedAirVolFlowRate <= 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be > 0.0. entered value=[{:.3T}].", cNumericFields(7), NumArray(7))); ErrorsFound = true; } } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate != Constant::AutoCalculate) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate <= 0.0) { + if (vsCoil.RatedWaterVolFlowRate != Constant::AutoCalculate) { + if (vsCoil.RatedWaterVolFlowRate <= 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be > 0.0 entered value=[{:.3T}].", cNumericFields(8), NumArray(8))); ErrorsFound = true; } } + // Count how many times you are capitalizing AlphArray here (3) and comparing it to "No" (2) if (Util::SameString(AlphArray(2), "Yes") || Util::SameString(AlphArray(2), "No")) { // initialized to TRUE on allocate if (Util::SameString(AlphArray(2), "No")) - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP = false; + vsCoil.FanPowerIncludedInCOP = false; else - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP = true; + vsCoil.FanPowerIncludedInCOP = true; } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format(",,,invalid choice for {}. Entered choice = {}", cAlphaFields(2), AlphArray(2))); ShowContinueError(state, "Valid choices are Yes or No."); ErrorsFound = true; @@ -2475,13 +2401,13 @@ namespace VariableSpeedCoils { if (Util::SameString(AlphArray(3), "Yes") || Util::SameString(AlphArray(3), "No")) { // initialized to FALSE on allocate if (Util::SameString(AlphArray(3), "Yes")) - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP = true; + vsCoil.CondPumpPowerInCOP = true; else - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP = false; + vsCoil.CondPumpPowerInCOP = false; } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format(",,,invalid choice for {}. Entered choice = {}", cAlphaFields(3), AlphArray(3))); ShowContinueError(state, "Valid choices are Yes or No."); ErrorsFound = true; @@ -2490,34 +2416,33 @@ namespace VariableSpeedCoils { if (Util::SameString(AlphArray(4), "Yes") || Util::SameString(AlphArray(4), "No")) { // initialized to FALSE on allocate if (Util::SameString(AlphArray(4), "Yes")) - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity = true; + vsCoil.CondPumpHeatInCapacity = true; else - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity = false; + vsCoil.CondPumpHeatInCapacity = false; } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format(",,,invalid choice for {}. Entered choice = {}", cAlphaFields(4), AlphArray(4))); ShowContinueError(state, "Valid choices are Yes or No."); ErrorsFound = true; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater = NumArray(9); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater <= 0.0 || - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater > 1.0) { + vsCoil.HPWHCondPumpFracToWater = NumArray(9); + if (vsCoil.HPWHCondPumpFracToWater <= 0.0 || vsCoil.HPWHCondPumpFracToWater > 1.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 0 and <= 1. entered value=[{:.3T}].", cNumericFields(10), NumArray(9))); ErrorsFound = true; } - if (!state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater = 0.0; + if (!vsCoil.CondPumpHeatInCapacity) { + vsCoil.HPWHCondPumpFracToWater = 0.0; } // Air nodes - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = + vsCoil.AirInletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, @@ -2528,7 +2453,7 @@ namespace VariableSpeedCoils { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = + vsCoil.AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(6), ErrorsFound, @@ -2542,11 +2467,10 @@ namespace VariableSpeedCoils { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes"); // Check if the air inlet node is OA node, to justify whether the coil is placed in zone or not - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).IsDXCoilInZone = - !OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum); + vsCoil.IsDXCoilInZone = !OutAirNodeManager::CheckOutAirNodeNumber(state, vsCoil.AirInletNodeNum); // Water nodes - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = + vsCoil.WaterInletNodeNum = GetOnlySingleNode(state, AlphArray(7), ErrorsFound, @@ -2557,7 +2481,7 @@ namespace VariableSpeedCoils { NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = + vsCoil.WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(8), ErrorsFound, @@ -2570,135 +2494,133 @@ namespace VariableSpeedCoils { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(7), AlphArray(8), "Water Nodes"); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(10); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + vsCoil.CrankcaseHeaterCapacity = NumArray(10); + if (vsCoil.CrankcaseHeaterCapacity < 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 0.0 entered value=[{:.1T}].", cNumericFields(10), NumArray(10))); ErrorsFound = true; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(11); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater < 0.0) { + vsCoil.MaxOATCrankcaseHeater = NumArray(11); + if (vsCoil.MaxOATCrankcaseHeater < 0.0) { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be >= 0 {{C}}. entered value=[{:.1T}].", cNumericFields(11), NumArray(11))); ErrorsFound = true; } if (!lAlphaBlanks(9)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(9)); + vsCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(9)); ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, // Curve index + vsCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(9)); // Field Name } if (Util::SameString(AlphArray(10), "DryBulbTemperature")) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType = HVAC::OATType::DryBulb; + vsCoil.InletAirTemperatureType = HVAC::OATType::DryBulb; } else if (Util::SameString(AlphArray(10), "WetBulbTemperature")) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType = HVAC::OATType::WetBulb; + vsCoil.InletAirTemperatureType = HVAC::OATType::WetBulb; } else { // wrong temperature type selection ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...{} must be DryBulbTemperature or WetBulbTemperature.", cAlphaFields(10))); ShowContinueError(state, format("...entered value=\"{}\".", AlphArray(10))); ErrorsFound = true; } // set rated inlet air temperature for curve object verification - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType == HVAC::OATType::WetBulb) { - WHInletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp; + if (vsCoil.InletAirTemperatureType == HVAC::OATType::WetBulb) { + WHInletAirTemp = vsCoil.WHRatedInletWBTemp; } else { - WHInletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp; + WHInletAirTemp = vsCoil.WHRatedInletDBTemp; } // set rated water temperature for curve object verification - WHInletWaterTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp; + WHInletWaterTemp = vsCoil.WHRatedInletWaterTemp; // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = + vsCoil.PLFFPLR = Curve::GetCurveIndex(state, AlphArray(11)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + if (vsCoil.PLFFPLR == 0) { if (lAlphaBlanks(11)) { ShowSevereError( state, - format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(11))); } else { ShowSevereError( state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(11), AlphArray(11))); } ErrorsFound = true; } else { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(11))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); } } - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(15 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(16 + (I - 1) * 6); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(I) = NumArray(17 + (I - 1) * 6); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); + vsCoil.MSRatedCOP(I) = NumArray(13 + (I - 1) * 6); + vsCoil.MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); + vsCoil.MSRatedAirVolFlowRate(I) = NumArray(15 + (I - 1) * 6); + vsCoil.MSRatedWaterVolFlowRate(I) = NumArray(16 + (I - 1) * 6); + vsCoil.MSWHPumpPower(I) = NumArray(17 + (I - 1) * 6); AlfaFieldIncre = 12 + (I - 1) * 6; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + vsCoil.MSCCapFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + vsCoil.MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2707,43 +2629,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 13 + (I - 1) * 6; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + vsCoil.MSCCapAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + vsCoil.MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2752,43 +2673,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 14 + (I - 1) * 6; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { + vsCoil.MSCCapWaterFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index + vsCoil.MSCCapWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2797,44 +2717,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 15 + (I - 1) * 6; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + vsCoil.MSEIRFTemp(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + vsCoil.MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2843,43 +2761,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 16 + (I - 1) * 6; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + vsCoil.MSEIRAirFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + vsCoil.MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2888,43 +2805,42 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 17 + (I - 1) * 6; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { + vsCoil.MSEIRWaterFFlow(I) = Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (vsCoil.MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); } else { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(AlfaFieldIncre), AlphArray(AlfaFieldIncre))); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic ErrorsFound |= Curve::CheckCurveDims(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index + vsCoil.MSEIRWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + vsCoil.Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", RoutineName, CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); + vsCoil.Name)); ShowContinueError( state, format("...{} output is not equal to 1.0 (+ or - 10%) at rated conditions.", cAlphaFields(AlfaFieldIncre))); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); @@ -2934,66 +2850,57 @@ namespace VariableSpeedCoils { } // get scale values - for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPowerPerRatedTotCap(I) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(I) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (int I = 1; I <= vsCoil.NumOfSpeeds; ++I) { + vsCoil.MSRatedPercentTotCap(I) = vsCoil.MSRatedTotCap(I) / vsCoil.MSRatedTotCap(vsCoil.NumOfSpeeds); + vsCoil.MSRatedAirVolFlowPerRatedTotCap(I) = vsCoil.MSRatedAirVolFlowRate(I) / vsCoil.MSRatedTotCap(I); + vsCoil.MSRatedWaterVolFlowPerRatedTotCap(I) = vsCoil.MSRatedWaterVolFlowRate(I) / vsCoil.MSRatedTotCap(I); + vsCoil.MSWHPumpPowerPerRatedTotCap(I) = vsCoil.MSWHPumpPower(I) / vsCoil.MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Waterheating:Airtowaterheatpump:Variablespeed" SetupOutputVariable(state, "Cooling Coil Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, + vsCoil.Energy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible, + vsCoil.EnergySensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent, + vsCoil.EnergyLatent, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Water Side Heat Transfer Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, + vsCoil.EnergySource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::PlantLoopHeatingDemand, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::HeatingCoils); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).IsDXCoilInZone) { + if (vsCoil.IsDXCoilInZone) { SetupOutputVariable(state, "Cooling Coil Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + vsCoil.EnergyLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::EnergyTransfer, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::CoolingCoils); @@ -3001,14 +2908,13 @@ namespace VariableSpeedCoils { SetupOutputVariable(state, "Cooling Coil Cooling Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + vsCoil.EnergyLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = - DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation + vsCoil.RatedCapCoolSens = DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } //---------------------------VARIABLE-SPEED AIR SOURCE HPWH END -------------- @@ -3024,192 +2930,193 @@ namespace VariableSpeedCoils { } for (DXCoilNum = 1; DXCoilNum <= state.dataVariableSpeedCoils->NumVarSpeedCoils; ++DXCoilNum) { - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); + if ((vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) || + (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed)) { // Setup Report variables for the Heat Pump // cooling and heating coils separately - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // air source cooling coils SetupOutputVariable(state, "Cooling Coil Air Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, + vsCoil.AirMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, + vsCoil.InletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + vsCoil.InletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent, + vsCoil.QLatent, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + vsCoil.OutletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, + vsCoil.QSensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Total Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, + vsCoil.QLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Part Load Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, + vsCoil.PartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, + vsCoil.Power, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Runtime Fraction", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, + vsCoil.RunFrac, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, + vsCoil.QSource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Upper Speed Level", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, + vsCoil.SpeedNumReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Neighboring Speed Levels Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, + vsCoil.SpeedRatioReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode == CondensateToTank) { + if (vsCoil.CondensateCollectMode == CondensateToTank) { SetupOutputVariable(state, "Cooling Coil Condensate Volume Flow Rate", Constant::Units::m3_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot, + vsCoil.CondensateVdot, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Condensate Volume", Constant::Units::m3, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVol, + vsCoil.CondensateVol, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::OnSiteWater, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Condensate); } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ReportEvapCondVars) { + if (vsCoil.ReportEvapCondVars) { SetupOutputVariable(state, "Cooling Coil Condenser Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondInletTemp, + vsCoil.CondInletTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Water Volume", Constant::Units::m3, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump, + vsCoil.EvapWaterConsump, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Water, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Mains Water Volume", Constant::Units::m3, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump, + vsCoil.EvapWaterConsump, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::MainsWater, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Pump Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower, + vsCoil.EvapCondPumpElecPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Pump Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption, + vsCoil.EvapCondPumpElecConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { + if (vsCoil.BasinHeaterPowerFTempDiff > 0.0) { SetupOutputVariable(state, "Cooling Coil Basin Heater Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower, + vsCoil.BasinHeaterPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Basin Heater Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption, + vsCoil.BasinHeaterConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); @@ -3219,17 +3126,17 @@ namespace VariableSpeedCoils { SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, + vsCoil.CrankcaseHeaterPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, + vsCoil.CrankcaseHeaterConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Cooling); @@ -3238,514 +3145,514 @@ namespace VariableSpeedCoils { SetupOutputVariable(state, "Heating Coil Air Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, + vsCoil.AirMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, + vsCoil.InletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Inlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + vsCoil.InletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + vsCoil.OutletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Outlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Sensible Heating Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, + vsCoil.QSensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Heating Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, + vsCoil.QLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Part Load Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, + vsCoil.PartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, + vsCoil.Power, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Runtime Fraction", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, + vsCoil.RunFrac, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, + vsCoil.QSource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Upper Speed Level", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, + vsCoil.SpeedNumReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Neighboring Speed Levels Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, + vsCoil.SpeedRatioReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Defrost Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower, + vsCoil.DefrostPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Defrost Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostConsumption, + vsCoil.DefrostConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); SetupOutputVariable(state, "Heating Coil Crankcase Heater Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, + vsCoil.CrankcaseHeaterPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Crankcase Heater Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, + vsCoil.CrankcaseHeaterConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); } } else { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == - HVAC::Coil_CoolingWaterToAirHPVSEquationFit) { // fix coil type + if (vsCoil.coilType == + HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { // fix coil type // cooling WAHP coil // Setup Report variables for water source Heat Pump SetupOutputVariable(state, "Cooling Coil Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, + vsCoil.Power, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Total Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, + vsCoil.QLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, + vsCoil.QSensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent, + vsCoil.QLatent, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, + vsCoil.QSource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Part Load Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, + vsCoil.PartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Runtime Fraction", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, + vsCoil.RunFrac, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, + vsCoil.AirMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, + vsCoil.InletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + vsCoil.InletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + vsCoil.OutletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Source Side Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + vsCoil.WaterMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Source Side Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp, + vsCoil.InletWaterTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Source Side Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp, + vsCoil.OutletWaterTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Upper Speed Level", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, + vsCoil.SpeedNumReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Neighboring Speed Levels Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, + vsCoil.SpeedRatioReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Recoverable Heat Transfer Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat, + vsCoil.QWasteHeat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); - } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == - HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { // fix coil type + vsCoil.Name); + } else if (vsCoil.coilType == + HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { // fix coil type // heating WAHP coil // Setup Report variables for water source Heat Pump SetupOutputVariable(state, "Heating Coil Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, + vsCoil.Power, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Heating Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, + vsCoil.QLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Sensible Heating Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, + vsCoil.QSensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, + vsCoil.QSource, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Part Load Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, + vsCoil.PartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Runtime Fraction", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, + vsCoil.RunFrac, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, + vsCoil.AirMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, + vsCoil.InletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Inlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + vsCoil.InletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + vsCoil.OutletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Air Outlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Source Side Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + vsCoil.WaterMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Source Side Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp, + vsCoil.InletWaterTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Source Side Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp, + vsCoil.OutletWaterTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Upper Speed Level", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, + vsCoil.SpeedNumReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Neighboring Speed Levels Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, + vsCoil.SpeedRatioReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Heating Coil Recoverable Heat Transfer Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat, + vsCoil.QWasteHeat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); - } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + vsCoil.Name); + } else if (vsCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed) { // air source water heating coil SetupOutputVariable(state, "Cooling Coil Water Heating Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, + vsCoil.Power, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Total Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, + vsCoil.QLoadTotal, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, + vsCoil.QSensible, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent, + vsCoil.QLatent, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Total Water Heating Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate, + vsCoil.TotalHeatingEnergyRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Part Load Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, + vsCoil.PartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Runtime Fraction", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, + vsCoil.RunFrac, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, + vsCoil.AirMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, + vsCoil.InletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + vsCoil.InletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + vsCoil.OutletAirDBTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Humidity Ratio", Constant::Units::kgWater_kgDryAir, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirHumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Water Mass Flow Rate", Constant::Units::kg_s, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + vsCoil.WaterMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Water Inlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp, + vsCoil.InletWaterTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Water Outlet Temperature", Constant::Units::C, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp, + vsCoil.OutletWaterTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, + vsCoil.CrankcaseHeaterPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, + vsCoil.CrankcaseHeaterConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); @@ -3753,32 +3660,32 @@ namespace VariableSpeedCoils { SetupOutputVariable(state, "Cooling Coil Upper Speed Level", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, + vsCoil.SpeedNumReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Neighboring Speed Levels Ratio", Constant::Units::None, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, + vsCoil.SpeedRatioReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Water Heating Pump Electricity Rate", Constant::Units::W, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower, + vsCoil.HPWHCondPumpElecNomPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + vsCoil.Name); SetupOutputVariable(state, "Cooling Coil Water Heating Pump Electricity Energy", Constant::Units::J, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption, + vsCoil.EvapCondPumpElecConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Heating); @@ -3833,7 +3740,8 @@ namespace VariableSpeedCoils { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName = "InitVarSpeedCoil"; - int AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; + + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); if (state.dataVariableSpeedCoils->MyOneTimeFlag) { // initialize the environment and sizing flags @@ -3850,7 +3758,7 @@ namespace VariableSpeedCoils { // member from DXcoils.cc is added to VarSpeedCoil object // variable-speed heat pump water heating, begin - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed && + if (vsCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed && state.dataVariableSpeedCoils->MySizeFlag(DXCoilNum)) { ErrorsFound = false; @@ -3866,21 +3774,21 @@ namespace VariableSpeedCoils { // variable-speed heat pump water heating, end // water source - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit)) { // fix coil type + if ((vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) || + (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit)) { // fix coil type if (state.dataVariableSpeedCoils->MyPlantScanFlag(DXCoilNum) && allocated(state.dataPlnt->PlantLoop)) { // switch from coil type numbers in DataHVACGlobals, to coil type numbers in plant. DataPlant::PlantEquipmentType CoilVSWAHPType(DataPlant::PlantEquipmentType::Invalid); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) { + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { CoilVSWAHPType = DataPlant::PlantEquipmentType::CoilVSWAHPCoolingEquationFit; - } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { + } else if (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { CoilVSWAHPType = DataPlant::PlantEquipmentType::CoilVSWAHPHeatingEquationFit; } ErrorsFound = false; PlantUtilities::ScanPlantLoopsForObject(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + vsCoil.Name, CoilVSWAHPType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc, + vsCoil.plantLoc, ErrorsFound, _, _, @@ -3908,24 +3816,24 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->MySizeFlag(DXCoilNum) = false; // Multispeed Cooling - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { - for (int Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal <= 0.0) break; + if ((vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) || + (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed)) { + for (int Mode = 1; Mode <= vsCoil.NumOfSpeeds; ++Mode) { + if (vsCoil.RatedCapCoolTotal <= 0.0) break; // Check for zero capacity or zero max flow rate - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) { + if (vsCoil.MSRatedTotCap(Mode) <= 0.0) { ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity at speed {}", - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + HVAC::coilTypeNames[(int)vsCoil.coilType], + vsCoil.Name, Mode)); ErrorsFound = true; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) <= 0.0) { + if (vsCoil.MSRatedAirVolFlowRate(Mode) <= 0.0) { ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate at speed {}", - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + HVAC::coilTypeNames[(int)vsCoil.coilType], + vsCoil.Name, Mode)); ErrorsFound = true; } @@ -3933,23 +3841,17 @@ namespace VariableSpeedCoils { ShowFatalError(state, "Preceding condition causes termination."); } // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = vsCoil.MSRatedAirVolFlowRate(Mode) / vsCoil.MSRatedTotCap(Mode); } // call coil model with everything set at rating point - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTemp; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = + vsCoil.InletAirDBTemp = RatedInletAirTemp; + vsCoil.InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedInletAirTemp, RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy = - Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure = DataEnvironment::StdPressureSeaLevel; + vsCoil.InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, vsCoil.InletAirHumRat); + vsCoil.InletAirPressure = DataEnvironment::StdPressureSeaLevel; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * - Psychrometrics::PsyRhoAirFnPbTdbW(state, - DataEnvironment::StdPressureSeaLevel, - RatedInletAirTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); + vsCoil.AirMassFlowRate = vsCoil.RatedAirVolFlowRate * + Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::StdPressureSeaLevel, RatedInletAirTemp, vsCoil.InletAirHumRat); // store environment data fill back in after rating point calc is over Real64 holdOutDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; Real64 holdOutHumRat = state.dataEnvrn->OutHumRat; @@ -3962,41 +3864,26 @@ namespace VariableSpeedCoils { state.dataEnvrn->OutBaroPress = DataEnvironment::StdPressureSeaLevel; // assume rating is for sea level. state.dataEnvrn->OutHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedAmbAirTemp, ratedOutdoorAirWetBulb, DataEnvironment::StdPressureSeaLevel, RoutineName); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum > 0) { - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp = RatedAmbAirTemp; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat = - state.dataEnvrn->OutHumRat; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press = - DataEnvironment::StdPressureSeaLevel; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb = - ratedOutdoorAirWetBulb; + if (vsCoil.CondenserInletNodeNum > 0) { + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Temp = RatedAmbAirTemp; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).HumRat = state.dataEnvrn->OutHumRat; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Press = DataEnvironment::StdPressureSeaLevel; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).OutAirWetBulb = ratedOutdoorAirWetBulb; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == - HVAC::Coil_CoolingWaterToAirHPVSEquationFit) { // need to set water info for WSHP - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTemp; // 85 F cooling mode - Real64 CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit) { // need to set water info for WSHP + vsCoil.WaterMassFlowRate = vsCoil.MSRatedWaterMassFlowRate(vsCoil.NumOfSpeeds); + vsCoil.InletWaterTemp = RatedInletWaterTemp; // 85 F cooling mode + Real64 CpSource = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineName); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; + vsCoil.InletWaterEnthalpy = vsCoil.InletWaterTemp * CpSource; } // calculate coil model at rating point - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + vsCoil.RunFrac = 1.0; + vsCoil.DesignAirMassFlowRate = vsCoil.MSRatedAirMassFlowRate(vsCoil.NumOfSpeeds); + vsCoil.DesignAirVolFlowRate = vsCoil.MSRatedAirVolFlowRate(vsCoil.NumOfSpeeds); + vsCoil.DesignWaterMassFlowRate = vsCoil.MSRatedWaterMassFlowRate(vsCoil.NumOfSpeeds); + vsCoil.DesignWaterVolFlowRate = vsCoil.MSRatedWaterVolFlowRate(vsCoil.NumOfSpeeds); CalcVarSpeedCoilCooling(state, DXCoilNum, @@ -4007,31 +3894,30 @@ namespace VariableSpeedCoils { 1.0, 1.0, 1.0, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + vsCoil.NumOfSpeeds); // coil outlets Real64 RatedOutletWetBulb(0.0); RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirDBTemp, + vsCoil.OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions( state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, // this is the report variable - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, // this is the report variable - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + vsCoil.Name, + vsCoil.coilType, + vsCoil.QLoadTotal, // this is the report variable + vsCoil.QSensible, // this is the report variable + vsCoil.AirMassFlowRate, + vsCoil.InletAirDBTemp, + vsCoil.InletAirHumRat, RatedInletWetBulbTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirDBTemp, + vsCoil.OutletAirHumRat, RatedOutletWetBulb, RatedAmbAirTemp, ratedOutdoorAirWetBulb, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds), + vsCoil.MSRatedCBF(vsCoil.NumOfSpeeds), -999.0); // coil effectiveness not define for DX // now replace the outdoor air conditions set above for one time rating point calc @@ -4042,34 +3928,31 @@ namespace VariableSpeedCoils { } // Multispeed Heating - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { + if ((vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) || + (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed)) { RatedHeatPumpIndoorAirTemp = 21.11; // 21.11C or 70F RatedHeatPumpIndoorHumRat = 0.00881; // Humidity ratio corresponding to 70F dry bulb/60F wet bulb - for (int Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (int Mode = 1; Mode <= vsCoil.NumOfSpeeds; ++Mode) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * + vsCoil.MSRatedAirMassFlowRate(Mode) = vsCoil.MSRatedAirVolFlowRate(Mode) * Psychrometrics::PsyRhoAirFnPbTdbW( state, state.dataEnvrn->OutBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = vsCoil.MSRatedAirVolFlowRate(Mode) / vsCoil.MSRatedTotCap(Mode); } // call coil model with everthing set at rating point - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTempHeat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = + vsCoil.InletAirDBTemp = RatedInletAirTempHeat; + vsCoil.InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedInletAirTempHeat, RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy = - Psychrometrics::PsyHFnTdbW(RatedInletAirTempHeat, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure = DataEnvironment::StdPressureSeaLevel; + vsCoil.InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTempHeat, vsCoil.InletAirHumRat); + vsCoil.InletAirPressure = DataEnvironment::StdPressureSeaLevel; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * + vsCoil.AirMassFlowRate = + vsCoil.RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::StdPressureSeaLevel, RatedInletAirTempHeat, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); + vsCoil.InletAirHumRat); // store environment data fill back in after rating point calc is over Real64 holdOutDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; Real64 holdOutHumRat = state.dataEnvrn->OutHumRat; @@ -4081,42 +3964,28 @@ namespace VariableSpeedCoils { state.dataEnvrn->OutBaroPress = DataEnvironment::StdPressureSeaLevel; // assume rating is for sea level. state.dataEnvrn->OutHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedAmbAirTempHeat, RatedAmbAirWBHeat, DataEnvironment::StdPressureSeaLevel, RoutineName); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum > 0) { - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp = RatedAmbAirTempHeat; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat = - state.dataEnvrn->OutHumRat; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press = - DataEnvironment::StdPressureSeaLevel; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb = - RatedAmbAirWBHeat; + if (vsCoil.CondenserInletNodeNum > 0) { + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Temp = RatedAmbAirTempHeat; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).HumRat = state.dataEnvrn->OutHumRat; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Press = DataEnvironment::StdPressureSeaLevel; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).OutAirWetBulb = RatedAmbAirWBHeat; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == - HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { // need to set water info for WSHP - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTempHeat; // 21.11C or 70F, heating mode - Real64 CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + if (vsCoil.coilType == + HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { // need to set water info for WSHP + vsCoil.WaterMassFlowRate = vsCoil.MSRatedWaterMassFlowRate(vsCoil.NumOfSpeeds); + vsCoil.InletWaterTemp = RatedInletWaterTempHeat; // 21.11C or 70F, heating mode + Real64 CpSource = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineName); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; + vsCoil.InletWaterEnthalpy = vsCoil.InletWaterTemp * CpSource; } // calculate coil model at rating point - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + vsCoil.RunFrac = 1.0; + vsCoil.DesignAirMassFlowRate = vsCoil.MSRatedAirMassFlowRate(vsCoil.NumOfSpeeds); + vsCoil.DesignAirVolFlowRate = vsCoil.MSRatedAirVolFlowRate(vsCoil.NumOfSpeeds); + vsCoil.DesignWaterMassFlowRate = vsCoil.MSRatedWaterMassFlowRate(vsCoil.NumOfSpeeds); + vsCoil.DesignWaterVolFlowRate = vsCoil.MSRatedWaterVolFlowRate(vsCoil.NumOfSpeeds); CalcVarSpeedCoilHeating(state, DXCoilNum, HVAC::FanOp::Continuous, @@ -4125,31 +3994,30 @@ namespace VariableSpeedCoils { 1.0, 1.0, 1.0, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + vsCoil.NumOfSpeeds); // coil outlets Real64 RatedOutletWetBulb(0.0); RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirDBTemp, + vsCoil.OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions( state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, // this is the report variable - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, // this is the report variable - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + vsCoil.Name, + vsCoil.coilType, + vsCoil.QLoadTotal, // this is the report variable + vsCoil.QSensible, // this is the report variable + vsCoil.AirMassFlowRate, + vsCoil.InletAirDBTemp, + vsCoil.InletAirHumRat, RatedInletWetBulbTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, + vsCoil.OutletAirDBTemp, + vsCoil.OutletAirHumRat, RatedOutletWetBulb, RatedAmbAirTempHeat, RatedAmbAirWBHeat, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds), + vsCoil.MSRatedCBF(vsCoil.NumOfSpeeds), -999.0); // coil effectiveness not define for DX // now replace the outdoor air conditions set above for one time rating point calc @@ -4160,47 +4028,43 @@ namespace VariableSpeedCoils { } // store fan info for coil - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex > 0) { + if (vsCoil.SupplyFanIndex > 0) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanName, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).supplyFanType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex); + vsCoil.Name, + vsCoil.coilType, + vsCoil.SupplyFanName, + vsCoil.supplyFanType, + vsCoil.SupplyFanIndex); } } - if (SpeedNum > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - SpeedCal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (SpeedNum > vsCoil.NumOfSpeeds) { + SpeedCal = vsCoil.NumOfSpeeds; } else if (SpeedNum < 1) { SpeedCal = 1; } else { SpeedCal = SpeedNum; } - if ((SpeedNum <= 1) || (SpeedNum > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal); + if ((SpeedNum <= 1) || (SpeedNum > vsCoil.NumOfSpeeds)) { + vsCoil.DesignAirMassFlowRate = vsCoil.MSRatedAirMassFlowRate(SpeedCal); + vsCoil.DesignAirVolFlowRate = vsCoil.MSRatedAirVolFlowRate(SpeedCal); + vsCoil.DesignWaterMassFlowRate = vsCoil.MSRatedWaterMassFlowRate(SpeedCal); + vsCoil.DesignWaterVolFlowRate = vsCoil.MSRatedWaterVolFlowRate(SpeedCal); } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal - 1); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal - 1); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal - 1); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal - 1); + vsCoil.DesignAirMassFlowRate = + vsCoil.MSRatedAirMassFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSRatedAirMassFlowRate(SpeedCal - 1); + vsCoil.DesignAirVolFlowRate = + vsCoil.MSRatedAirVolFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSRatedAirVolFlowRate(SpeedCal - 1); + vsCoil.DesignWaterMassFlowRate = + vsCoil.MSRatedWaterMassFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSRatedWaterMassFlowRate(SpeedCal - 1); + vsCoil.DesignWaterVolFlowRate = + vsCoil.MSRatedWaterVolFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSRatedWaterVolFlowRate(SpeedCal - 1); } // Do the Begin Environment initializations @@ -4209,38 +4073,38 @@ namespace VariableSpeedCoils { // Do the initializations to start simulation // Initialize all report variables to a known state at beginning of simulation - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowRate = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = 0.0; - - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit)) { - WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - - rho = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + vsCoil.AirVolFlowRate = 0.0; + vsCoil.InletAirDBTemp = 0.0; + vsCoil.InletAirHumRat = 0.0; + vsCoil.OutletAirDBTemp = 0.0; + vsCoil.OutletAirHumRat = 0.0; + vsCoil.WaterVolFlowRate = 0.0; + vsCoil.WaterMassFlowRate = 0.0; + vsCoil.InletWaterTemp = 0.0; + vsCoil.InletWaterEnthalpy = 0.0; + vsCoil.OutletWaterEnthalpy = 0.0; + vsCoil.OutletWaterTemp = 0.0; + vsCoil.Power = 0.0; + vsCoil.QLoadTotal = 0.0; + vsCoil.QSensible = 0.0; + vsCoil.QLatent = 0.0; + vsCoil.QSource = 0.0; + vsCoil.Energy = 0.0; + vsCoil.EnergyLoadTotal = 0.0; + vsCoil.EnergySensible = 0.0; + vsCoil.EnergyLatent = 0.0; + vsCoil.EnergySource = 0.0; + vsCoil.COP = 0.0; + vsCoil.RunFrac = 0.0; + vsCoil.PartLoadRatio = 0.0; + + if ((vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) || + (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit)) { + WaterInletNode = vsCoil.WaterInletNodeNum; + + rho = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineNameSimpleWatertoAirHP); - Cp = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + Cp = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineNameSimpleWatertoAirHP); // VarSpeedCoil(DXCoilNum)%DesignWaterMassFlowRate= & @@ -4248,9 +4112,9 @@ namespace VariableSpeedCoils { PlantUtilities::InitComponentNodes(state, 0.0, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum); + vsCoil.DesignWaterMassFlowRate, + vsCoil.WaterInletNodeNum, + vsCoil.WaterOutletNodeNum); state.dataLoopNodes->Node(WaterInletNode).Temp = 5.0; state.dataLoopNodes->Node(WaterInletNode).Enthalpy = Cp * state.dataLoopNodes->Node(WaterInletNode).Temp; @@ -4258,15 +4122,14 @@ namespace VariableSpeedCoils { state.dataLoopNodes->Node(WaterInletNode).Press = 0.0; state.dataLoopNodes->Node(WaterInletNode).HumRat = 0.0; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Temp = 5.0; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Enthalpy = - Cp * state.dataLoopNodes->Node(WaterInletNode).Temp; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Quality = 0.0; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Press = 0.0; - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).HumRat = 0.0; + state.dataLoopNodes->Node(vsCoil.WaterOutletNodeNum).Temp = 5.0; + state.dataLoopNodes->Node(vsCoil.WaterOutletNodeNum).Enthalpy = Cp * state.dataLoopNodes->Node(WaterInletNode).Temp; + state.dataLoopNodes->Node(vsCoil.WaterOutletNodeNum).Quality = 0.0; + state.dataLoopNodes->Node(vsCoil.WaterOutletNodeNum).Press = 0.0; + state.dataLoopNodes->Node(vsCoil.WaterOutletNodeNum).HumRat = 0.0; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; + vsCoil.SimFlag = true; state.dataHeatBal->HeatReclaimVS_DXCoil(DXCoilNum).AvailCapacity = 0.0; state.dataVariableSpeedCoils->MyEnvrnFlag(DXCoilNum) = false; @@ -4283,118 +4146,112 @@ namespace VariableSpeedCoils { // Set water and air inlet nodes - WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; + WaterInletNode = vsCoil.WaterInletNodeNum; - if ((SensLoad != 0.0 || LatentLoad != 0.0) && (state.dataLoopNodes->Node(AirInletNode).MassFlowRate > 0.0)) { + if ((SensLoad != 0.0 || LatentLoad != 0.0) && (state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).MassFlowRate > 0.0)) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel) > 0.0) { - WaterFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate * WaterFlowScale; + if (vsCoil.MSRatedWaterMassFlowRate(vsCoil.NormSpedLevel) > 0.0) { + WaterFlowScale = vsCoil.RatedWaterMassFlowRate / vsCoil.MSRatedWaterMassFlowRate(vsCoil.NormSpedLevel); + vsCoil.WaterMassFlowRate = vsCoil.DesignWaterMassFlowRate * WaterFlowScale; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; + vsCoil.WaterMassFlowRate = 0.0; } if (fanOp == HVAC::FanOp::Continuous) { // continuous fan, cycling compressor - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate; + vsCoil.AirMassFlowRate = state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).MassFlowRate; // VarSpeedCoil(DXCoilNum)%AirMassFlowRate = VarSpeedCoil(DXCoilNum)%DesignAirVolFlowRate* & // PsyRhoAirFnPbTdbW(state, OutBaroPress,Node(AirInletNode)%Temp,Node(AirInletNode)%HumRat) // If air flow is less than 25% rated flow. Then set air flow to the 25% of rated conditions - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate < - 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * + if (vsCoil.AirMassFlowRate < + 0.25 * vsCoil.DesignAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, - state.dataLoopNodes->Node(AirInletNode).Temp, - state.dataLoopNodes->Node(AirInletNode).HumRat)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = - 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * + state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).Temp, + state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).HumRat)) { + vsCoil.AirMassFlowRate = + 0.25 * vsCoil.DesignAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, - state.dataLoopNodes->Node(AirInletNode).Temp, - state.dataLoopNodes->Node(AirInletNode).HumRat); + state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).Temp, + state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).HumRat); } } else { // CYCLIC FAN, NOT CORRECTION, WILL BE PROCESSED IN THE FOLLOWING SUBROUTINES - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate; + vsCoil.AirMassFlowRate = state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).MassFlowRate; } } else { // heat pump is off - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = 0.0; + vsCoil.WaterMassFlowRate = 0.0; + vsCoil.AirMassFlowRate = 0.0; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) || - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit)) { + if ((vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) || + (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit)) { PlantUtilities::SetComponentFlowRate(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc); + vsCoil.WaterMassFlowRate, + vsCoil.WaterInletNodeNum, + vsCoil.WaterOutletNodeNum, + vsCoil.plantLoc); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = state.dataLoopNodes->Node(WaterInletNode).Temp; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataLoopNodes->Node(WaterInletNode).Enthalpy; + vsCoil.InletWaterTemp = state.dataLoopNodes->Node(WaterInletNode).Temp; + vsCoil.InletWaterEnthalpy = state.dataLoopNodes->Node(WaterInletNode).Enthalpy; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = 0.0; + vsCoil.InletWaterTemp = 0.0; + vsCoil.InletWaterEnthalpy = 0.0; } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = state.dataLoopNodes->Node(WaterInletNode).Temp; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataLoopNodes->Node(WaterInletNode).Enthalpy; + if (vsCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed) { + vsCoil.InletWaterTemp = state.dataLoopNodes->Node(WaterInletNode).Temp; + vsCoil.InletWaterEnthalpy = state.dataLoopNodes->Node(WaterInletNode).Enthalpy; }; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = state.dataLoopNodes->Node(AirInletNode).Temp; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = state.dataLoopNodes->Node(AirInletNode).HumRat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy = state.dataLoopNodes->Node(AirInletNode).Enthalpy; + vsCoil.InletAirDBTemp = state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).Temp; + vsCoil.InletAirHumRat = state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).HumRat; + vsCoil.InletAirEnthalpy = state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).Enthalpy; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure = state.dataEnvrn->OutBaroPress; // temporary + vsCoil.InletAirPressure = state.dataEnvrn->OutBaroPress; // temporary // Outlet variables - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; - - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; + vsCoil.Power = 0.0; + vsCoil.QLoadTotal = 0.0; + vsCoil.QSensible = 0.0; + vsCoil.QLatent = 0.0; + vsCoil.QSource = 0.0; + vsCoil.QWasteHeat = 0.0; + vsCoil.Energy = 0.0; + vsCoil.EnergyLoadTotal = 0.0; + vsCoil.EnergySensible = 0.0; + vsCoil.EnergyLatent = 0.0; + vsCoil.EnergySource = 0.0; + vsCoil.COP = 0.0; + + vsCoil.OutletAirDBTemp = 0.0; + vsCoil.OutletWaterTemp = 0.0; + vsCoil.OutletAirHumRat = 0.0; + vsCoil.OutletAirEnthalpy = 0.0; + vsCoil.OutletWaterEnthalpy = 0.0; // bug fix, must set zeros to the variables below, otherwise can't pass switch DD test - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostConsumption = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVol = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; + vsCoil.CrankcaseHeaterConsumption = 0.0; + vsCoil.EvapWaterConsump = 0.0; + vsCoil.BasinHeaterConsumption = 0.0; + vsCoil.EvapCondPumpElecConsumption = 0.0; + vsCoil.CrankcaseHeaterPower = 0.0; + vsCoil.DefrostPower = 0.0; + vsCoil.DefrostConsumption = 0.0; + vsCoil.CondensateVdot = 0.0; + vsCoil.CondensateVol = 0.0; + vsCoil.QWasteHeat = 0.0; // clear zeros to HPWH variables - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ElecWaterHeatingPower = - 0.0; // Total electric power consumed by compressor and condenser pump [W] - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ElecWaterHeatingConsumption = - 0.0; // Total electric consumption by compressor and condenser pump [J] - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergy = 0.0; // total water heating energy - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; // total WH energy rate - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = 0.0; // power power + vsCoil.ElecWaterHeatingPower = 0.0; // Total electric power consumed by compressor and condenser pump [W] + vsCoil.ElecWaterHeatingConsumption = 0.0; // Total electric consumption by compressor and condenser pump [J] + vsCoil.TotalHeatingEnergy = 0.0; // total water heating energy + vsCoil.TotalHeatingEnergyRate = 0.0; // total WH energy rate + vsCoil.HPWHCondPumpElecNomPower = 0.0; // power power state.dataVariableSpeedCoils->VSHPWHHeatingCapacity = 0.0; // Used by Heat Pump:Water Heater object as total water heating capacity [W] state.dataVariableSpeedCoils->VSHPWHHeatingCOP = 0.0; // Used by Heat Pump:Water Heater object as water heating COP [W/W] - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; + vsCoil.OutletWaterTemp = vsCoil.InletWaterTemp; state.dataHeatBal->HeatReclaimVS_DXCoil(DXCoilNum).AvailCapacity = 0.0; } @@ -4422,7 +4279,7 @@ namespace VariableSpeedCoils { static constexpr std::string_view RoutineName("SizeVarSpeedCoil"); static constexpr std::string_view RoutineNameAlt("SizeHVACWaterToAir"); - auto &varSpeedCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); + auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 rhoair = state.dataEnvrn->StdRhoAir; @@ -4464,8 +4321,8 @@ namespace VariableSpeedCoils { Real64 HPInletAirHumRat; // Rated inlet air humidity ratio for heat pump water heater [kgWater/kgDryAir] Real64 HPWHCoolCapacity; // estimate cooling capacity in HPWH - int UpperSpeed = varSpeedCoil.NumOfSpeeds; - int NormSpeed = varSpeedCoil.NormSpedLevel; + int UpperSpeed = vsCoil.NumOfSpeeds; + int NormSpeed = vsCoil.NormSpedLevel; int PltSizNum = 0; bool RatedAirFlowAutoSized = false; bool RatedWaterFlowAutoSized = false; @@ -4502,55 +4359,55 @@ namespace VariableSpeedCoils { Real64 DefrostCapacityDes = 0.0; Real64 DefrostCapacityUser = 0.0; - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { CurrentObjSubfix = ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"; - } else if (varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + } else if (vsCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed) { CurrentObjSubfix = ":WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED"; } else { CurrentObjSubfix = ":DX:VARIABLESPEED"; } - if (varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { - if (varSpeedCoil.RatedAirVolFlowRate == Constant::AutoCalculate) { - varSpeedCoil.RatedAirVolFlowRate = - varSpeedCoil.RatedCapWH * varSpeedCoil.MSRatedAirVolFlowRate(NormSpeed) / varSpeedCoil.MSRatedTotCap(NormSpeed); // 0.00005035; - varSpeedCoil.AirVolFlowAutoSized = true; + if (vsCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed) { + if (vsCoil.RatedAirVolFlowRate == Constant::AutoCalculate) { + vsCoil.RatedAirVolFlowRate = + vsCoil.RatedCapWH * vsCoil.MSRatedAirVolFlowRate(NormSpeed) / vsCoil.MSRatedTotCap(NormSpeed); // 0.00005035; + vsCoil.AirVolFlowAutoSized = true; } state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow( - state, varSpeedCoil.Name, varSpeedCoil.VarSpeedCoilType, varSpeedCoil.RatedAirVolFlowRate, varSpeedCoil.AirVolFlowAutoSized); + state, vsCoil.Name, vsCoil.coilType, vsCoil.RatedAirVolFlowRate, vsCoil.AirVolFlowAutoSized); - if (varSpeedCoil.RatedWaterVolFlowRate == Constant::AutoCalculate) { - varSpeedCoil.RatedHPWHCondWaterFlow = varSpeedCoil.RatedCapWH * varSpeedCoil.MSRatedWaterVolFlowRate(NormSpeed) / - varSpeedCoil.MSRatedTotCap(NormSpeed); // 0.00000004487; - varSpeedCoil.RatedWaterVolFlowRate = varSpeedCoil.RatedHPWHCondWaterFlow; - varSpeedCoil.WaterVolFlowAutoSized = true; + if (vsCoil.RatedWaterVolFlowRate == Constant::AutoCalculate) { + vsCoil.RatedHPWHCondWaterFlow = vsCoil.RatedCapWH * vsCoil.MSRatedWaterVolFlowRate(NormSpeed) / + vsCoil.MSRatedTotCap(NormSpeed); // 0.00000004487; + vsCoil.RatedWaterVolFlowRate = vsCoil.RatedHPWHCondWaterFlow; + vsCoil.WaterVolFlowAutoSized = true; } state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterFlowPltSizNum(state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.RatedWaterVolFlowRate, - varSpeedCoil.WaterVolFlowAutoSized, + vsCoil.Name, + vsCoil.coilType, + vsCoil.RatedWaterVolFlowRate, + vsCoil.WaterVolFlowAutoSized, -999, - varSpeedCoil.plantLoc.loopNum); + vsCoil.plantLoc.loopNum); } - if (varSpeedCoil.RatedAirVolFlowRate == DataSizing::AutoSize) { + if (vsCoil.RatedAirVolFlowRate == DataSizing::AutoSize) { RatedAirFlowAutoSized = true; } if (state.dataSize->CurSysNum > 0) { if (!RatedAirFlowAutoSized && !SizingDesRunThisAirSys) { // Simulation continue HardSizeNoDesRunAirFlow = true; - if (varSpeedCoil.RatedAirVolFlowRate > 0.0) { + if (vsCoil.RatedAirVolFlowRate > 0.0) { BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "User-Specified Rated Air Flow Rate [m3/s]", - varSpeedCoil.RatedAirVolFlowRate); + vsCoil.RatedAirVolFlowRate); } } else { - CheckSysSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); + CheckSysSizing(state, format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), vsCoil.Name); if (state.dataSize->CurOASysNum > 0 && state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum > -1) { auto const &thisAirloopDOAS = state.dataAirLoopHVACDOAS->airloopDOAS[state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum]; @@ -4568,15 +4425,15 @@ namespace VariableSpeedCoils { if (state.dataSize->CurZoneEqNum > 0) { if (!RatedAirFlowAutoSized && !SizingDesRunThisZone) { // Simulation continue HardSizeNoDesRunAirFlow = true; - if (varSpeedCoil.RatedAirVolFlowRate > 0.0) { + if (vsCoil.RatedAirVolFlowRate > 0.0) { BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "User-Specified Rated Air Flow Rate [m3/s]", - varSpeedCoil.RatedAirVolFlowRate); + vsCoil.RatedAirVolFlowRate); } } else { - CheckZoneSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); + CheckZoneSizing(state, format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), vsCoil.Name); RatedAirVolFlowRateDes = max(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow, state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow); if (RatedAirVolFlowRateDes < HVAC::SmallAirVolFlow) { @@ -4585,54 +4442,54 @@ namespace VariableSpeedCoils { } } - if (RatedAirFlowAutoSized) varSpeedCoil.RatedAirVolFlowRate = RatedAirVolFlowRateDes; + if (RatedAirFlowAutoSized) vsCoil.RatedAirVolFlowRate = RatedAirVolFlowRateDes; RatedCapCoolTotalAutoSized = false; RatedCapCoolSensAutoSized = false; // size rated total cooling capacity IsAutoSize = false; - if (varSpeedCoil.RatedCapCoolTotal == DataSizing::AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { + if (vsCoil.RatedCapCoolTotal == DataSizing::AutoSize && (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed)) { RatedCapCoolTotalAutoSized = true; } if (SizingDesRunThisZone || SizingDesRunThisAirSys) HardSizeNoDesRun = false; if (state.dataSize->CurSysNum > 0) { if (!RatedCapCoolTotalAutoSized && !SizingDesRunThisAirSys) { // Simulation continue HardSizeNoDesRun = true; - if (varSpeedCoil.RatedCapCoolTotal > 0.0) { + if (vsCoil.RatedCapCoolTotal > 0.0) { BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "User-Specified Rated Total Cooling Capacity [W]", - varSpeedCoil.RatedCapCoolTotal); + vsCoil.RatedCapCoolTotal); } } else { - CheckSysSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); + CheckSysSizing(state, format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), vsCoil.Name); if (state.dataSize->CurOASysNum > 0 && state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum > -1) { auto const &thisAirloopDOAS = state.dataAirLoopHVACDOAS->airloopDOAS[state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum]; - VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; + VolFlowRate = vsCoil.RatedAirVolFlowRate; MixTemp = thisAirloopDOAS.SizingCoolOATemp; SupTemp = thisAirloopDOAS.PrecoolTemp; MixHumRat = thisAirloopDOAS.SizingCoolOAHumRat; SupHumRat = thisAirloopDOAS.PrecoolHumRat; RatedCapCoolTotalDes = VolFlowRate * state.dataEnvrn->StdRhoAir * (Psychrometrics::PsyHFnTdbW(MixTemp, MixHumRat) - Psychrometrics::PsyHFnTdbW(SupTemp, SupHumRat)); - if (varSpeedCoil.MSCCapFTemp(varSpeedCoil.NormSpedLevel) > 0) { + if (vsCoil.MSCCapFTemp(vsCoil.NormSpedLevel) > 0) { MixWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName); - if (varSpeedCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { + if (vsCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { RatedSourceTempCool = thisAirloopDOAS.SizingCoolOATemp; } else { RatedSourceTempCool = GetVSCoilRatedSourceTemp(state, DXCoilNum); } TotCapTempModFac = - Curve::CurveValue(state, varSpeedCoil.MSCCapFTemp(varSpeedCoil.NormSpedLevel), MixWetBulb, RatedSourceTempCool); + Curve::CurveValue(state, vsCoil.MSCCapFTemp(vsCoil.NormSpedLevel), MixWetBulb, RatedSourceTempCool); RatedCapCoolTotalDes /= TotCapTempModFac; } } else { auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); - VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; + VolFlowRate = vsCoil.RatedAirVolFlowRate; if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream MixTemp = finalSysSizing.OutTempAtCoolPeak; @@ -4671,13 +4528,13 @@ namespace VariableSpeedCoils { SupTemp -= FanCoolLoad / (CpAir * rhoair * VolFlowRate); } MixWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName); - if (varSpeedCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { + if (vsCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { RatedSourceTempCool = OutTemp; } else { RatedSourceTempCool = GetVSCoilRatedSourceTemp(state, DXCoilNum); } TotCapTempModFac = - Curve::CurveValue(state, varSpeedCoil.MSCCapFTemp(varSpeedCoil.NormSpedLevel), MixWetBulb, RatedSourceTempCool); + Curve::CurveValue(state, vsCoil.MSCCapFTemp(vsCoil.NormSpedLevel), MixWetBulb, RatedSourceTempCool); // The mixed air temp for zone equipment without an OA mixer is 0. // This test avoids a negative capacity until a solution can be found. @@ -4701,17 +4558,17 @@ namespace VariableSpeedCoils { } else if (state.dataSize->CurZoneEqNum > 0) { if (!RatedCapCoolTotalAutoSized && !SizingDesRunThisZone) { // Simulation continue HardSizeNoDesRun = true; - if (varSpeedCoil.RatedCapCoolTotal > 0.0) { + if (vsCoil.RatedCapCoolTotal > 0.0) { BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "User-Specified Rated Total Cooling Capacity [W]", - varSpeedCoil.RatedCapCoolTotal); + vsCoil.RatedCapCoolTotal); } } else { - CheckZoneSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); + CheckZoneSizing(state, format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), vsCoil.Name); auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum); - VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; + VolFlowRate = vsCoil.RatedAirVolFlowRate; if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->ZoneEqDXCoil) { if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { @@ -4749,13 +4606,13 @@ namespace VariableSpeedCoils { } MixWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName); - if (varSpeedCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { + if (vsCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) { RatedSourceTempCool = OutTemp; } else { RatedSourceTempCool = GetVSCoilRatedSourceTemp(state, DXCoilNum); } TotCapTempModFac = - Curve::CurveValue(state, varSpeedCoil.MSCCapFTemp(varSpeedCoil.NormSpedLevel), MixWetBulb, RatedSourceTempCool); + Curve::CurveValue(state, vsCoil.MSCCapFTemp(vsCoil.NormSpedLevel), MixWetBulb, RatedSourceTempCool); // The mixed air temp for zone equipment without an OA mixer is 0. // This test avoids a negative capacity until a solution can be found. @@ -4780,39 +4637,39 @@ namespace VariableSpeedCoils { } if (!HardSizeNoDesRun) { if (RatedCapCoolTotalAutoSized) { - varSpeedCoil.RatedCapCoolTotal = RatedCapCoolTotalDes; + vsCoil.RatedCapCoolTotal = RatedCapCoolTotalDes; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Total Cooling Capacity [W]", - varSpeedCoil.RatedCapCoolTotal); + vsCoil.RatedCapCoolTotal); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCoolCoilTotCap, varSpeedCoil.Name, varSpeedCoil.RatedCapCoolTotal); + state, state.dataOutRptPredefined->pdchCoolCoilTotCap, vsCoil.Name, vsCoil.RatedCapCoolTotal); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilLatCap, - varSpeedCoil.Name, - varSpeedCoil.RatedCapCoolTotal - varSpeedCoil.RatedCapCoolSens); - if (varSpeedCoil.RatedCapCoolTotal != 0.0) { + vsCoil.Name, + vsCoil.RatedCapCoolTotal - vsCoil.RatedCapCoolSens); + if (vsCoil.RatedCapCoolTotal != 0.0) { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, - varSpeedCoil.Name, - varSpeedCoil.RatedCapCoolSens / varSpeedCoil.RatedCapCoolTotal); + vsCoil.Name, + vsCoil.RatedCapCoolSens / vsCoil.RatedCapCoolTotal); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCoolCoilNomEff, varSpeedCoil.Name, varSpeedCoil.MSRatedCOP(NormSpeed)); + state, state.dataOutRptPredefined->pdchCoolCoilNomEff, vsCoil.Name, vsCoil.MSRatedCOP(NormSpeed)); } else { - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, varSpeedCoil.Name, 0.0); - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, varSpeedCoil.Name, 0.0); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, vsCoil.Name, 0.0); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, vsCoil.Name, 0.0); } OutputReportPredefined::addFootNoteSubTable( state, state.dataOutRptPredefined->pdstCoolCoil, "Nominal values are gross at rated conditions, i.e., the supply air fan heat and electric power NOT accounted for."); } else { - if (varSpeedCoil.RatedCapCoolTotal > 0.0 && RatedCapCoolTotalDes > 0.0) { - RatedCapCoolTotalUser = varSpeedCoil.RatedCapCoolTotal; + if (vsCoil.RatedCapCoolTotal > 0.0 && RatedCapCoolTotalDes > 0.0) { + RatedCapCoolTotalUser = vsCoil.RatedCapCoolTotal; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Total Cooling Capacity [W]", RatedCapCoolTotalDes, "User-Specified Rated Total Cooling Capacity [W]", @@ -4822,9 +4679,9 @@ namespace VariableSpeedCoils { state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", - varSpeedCoil.CoolHeatType, + vsCoil.CoolHeatType, CurrentObjSubfix)); - ShowContinueError(state, format("Coil Name = {}", varSpeedCoil.Name)); + ShowContinueError(state, format("Coil Name = {}", vsCoil.Name)); ShowContinueError(state, format("User-Specified Rated Total Cooling Capacity of {:.2R} [W]", RatedCapCoolTotalUser)); ShowContinueError(state, format("differs from Design Size Rated Total Cooling Capacity of {:.2R} [W]", RatedCapCoolTotalDes)); @@ -4835,47 +4692,44 @@ namespace VariableSpeedCoils { } } - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp( - state, varSpeedCoil.Name, varSpeedCoil.VarSpeedCoilType, MixTemp, state.dataSize->CurSysNum, state.dataSize->CurZoneEqNum); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat( - state, varSpeedCoil.Name, varSpeedCoil.VarSpeedCoilType, MixHumRat); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, varSpeedCoil.Name, varSpeedCoil.VarSpeedCoilType, SupTemp); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat( - state, varSpeedCoil.Name, varSpeedCoil.VarSpeedCoilType, SupHumRat); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow( - state, varSpeedCoil.Name, varSpeedCoil.VarSpeedCoilType, varSpeedCoil.RatedAirVolFlowRate, RatedAirFlowAutoSized); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilCoolingCapacity(state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, - RatedCapCoolTotalDes, - RatedCapCoolTotalAutoSized, - state.dataSize->CurSysNum, - state.dataSize->CurZoneEqNum, - state.dataSize->CurOASysNum, - 0.0, // no fan load included in sizing - TotCapTempModFac, - -999.0, - -999.0); // VS model doesn't limit, double check + auto &coilReport = state.dataRptCoilSelection->coilSelectionReportObj; + coilReport->setCoilEntAirTemp(state, vsCoil.Name, vsCoil.coilType, MixTemp, state.dataSize->CurSysNum, state.dataSize->CurZoneEqNum); + coilReport->setCoilEntAirHumRat(state, vsCoil.Name, vsCoil.coilType, MixHumRat); + coilReport->setCoilLvgAirTemp(state, vsCoil.Name, vsCoil.coilType, SupTemp); + coilReport->setCoilLvgAirHumRat(state, vsCoil.Name, vsCoil.coilType, SupHumRat); + coilReport->setCoilAirFlow(state, vsCoil.Name, vsCoil.coilType, vsCoil.RatedAirVolFlowRate, RatedAirFlowAutoSized); + coilReport->setCoilCoolingCapacity(state, + vsCoil.Name, + vsCoil.coilType, + RatedCapCoolTotalDes, + RatedCapCoolTotalAutoSized, + state.dataSize->CurSysNum, + state.dataSize->CurZoneEqNum, + state.dataSize->CurOASysNum, + 0.0, // no fan load included in sizing + TotCapTempModFac, + -999.0, + -999.0); // VS model doesn't limit, double check } // Set the global DX cooling coil capacity variable for use by other objects - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - state.dataSize->DXCoolCap = varSpeedCoil.RatedCapCoolTotal; + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + state.dataSize->DXCoolCap = vsCoil.RatedCapCoolTotal; } // size rated heating capacity - if (varSpeedCoil.RatedCapHeat == DataSizing::AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { + if (vsCoil.RatedCapHeat == DataSizing::AutoSize && (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed)) { RatedCapHeatAutoSized = true; } // simply set heating capacity equal to the cooling capacity // VarSpeedCoil(DXCoilNum)%RatedCapHeat = DXCoolCap - if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { - if (varSpeedCoil.CompanionCoolingCoilNum > 0) { - RatedCapHeatDes = state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).RatedCapCoolTotal; - varSpeedCoil.RatedCapCoolTotal = RatedCapHeatDes; // AVOID BEING ZERO + if (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + if (vsCoil.CompanionCoolingCoilNum > 0) { + RatedCapHeatDes = state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).RatedCapCoolTotal; + vsCoil.RatedCapCoolTotal = RatedCapHeatDes; // AVOID BEING ZERO } else { RatedCapHeatDes = state.dataSize->DXCoolCap; // previous code, can be risky } @@ -4883,7 +4737,7 @@ namespace VariableSpeedCoils { if (RatedCapHeatAutoSized) { if (RatedCapHeatDes == DataSizing::AutoSize) { ShowWarningError( - state, format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", varSpeedCoil.CoolHeatType, varSpeedCoil.Name)); + state, format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", vsCoil.CoolHeatType, vsCoil.Name)); ShowContinueError(state, format("{}: Heating coil could not be autosized since cooling coil was not previously sized.", RoutineName)); ShowContinueError(state, "... Cooling coil must be upstream of heating coil."); @@ -4893,44 +4747,46 @@ namespace VariableSpeedCoils { if (RatedCapHeatDes < HVAC::SmallLoad) { RatedCapHeatDes = 0.0; } - state.dataRptCoilSelection->coilSelectionReportObj->setCoilHeatingCapacity(state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, - RatedCapHeatDes, - RatedCapHeatAutoSized, - state.dataSize->CurSysNum, - state.dataSize->CurZoneEqNum, - state.dataSize->CurOASysNum, - 0.0, - 1.0, - -999.0, - -999.0); + + auto &coilReport = state.dataRptCoilSelection->coilSelectionReportObj; + coilReport->setCoilHeatingCapacity(state, + vsCoil.Name, + vsCoil.coilType, + RatedCapHeatDes, + RatedCapHeatAutoSized, + state.dataSize->CurSysNum, + state.dataSize->CurZoneEqNum, + state.dataSize->CurOASysNum, + 0.0, + 1.0, + -999.0, + -999.0); } if (RatedCapHeatAutoSized) { - varSpeedCoil.RatedCapHeat = RatedCapHeatDes; + vsCoil.RatedCapHeat = RatedCapHeatDes; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Nominal Heating Capacity [W]", RatedCapHeatDes); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchHeatCoilNomCap, varSpeedCoil.Name, varSpeedCoil.RatedCapHeat); - if (varSpeedCoil.RatedCapHeat != 0.0) { + state, state.dataOutRptPredefined->pdchHeatCoilNomCap, vsCoil.Name, vsCoil.RatedCapHeat); + if (vsCoil.RatedCapHeat != 0.0) { OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchHeatCoilNomEff, varSpeedCoil.Name, varSpeedCoil.MSRatedCOP(NormSpeed)); + state, state.dataOutRptPredefined->pdchHeatCoilNomEff, vsCoil.Name, vsCoil.MSRatedCOP(NormSpeed)); } else { - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, varSpeedCoil.Name, 0.0); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, vsCoil.Name, 0.0); } OutputReportPredefined::addFootNoteSubTable( state, state.dataOutRptPredefined->pdstHeatCoil, "Nominal values are gross at rated conditions, i.e., the supply air fan heat and electric power NOT accounted for."); } else { - if (varSpeedCoil.RatedCapHeat > 0.0 && RatedCapHeatDes > 0.0) { - RatedCapHeatUser = varSpeedCoil.RatedCapHeat; + if (vsCoil.RatedCapHeat > 0.0 && RatedCapHeatDes > 0.0) { + RatedCapHeatUser = vsCoil.RatedCapHeat; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Nominal Heating Capacity [W]", RatedCapHeatDes, "User-Specified Nominal Heating Capacity [W]", @@ -4939,8 +4795,8 @@ namespace VariableSpeedCoils { if ((std::abs(RatedCapHeatDes - RatedCapHeatUser) / RatedCapHeatUser) > state.dataSize->AutoVsHardSizingThreshold) { ShowMessage( state, - format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", varSpeedCoil.CoolHeatType, CurrentObjSubfix)); - ShowContinueError(state, format("Coil Name = {}", varSpeedCoil.Name)); + format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", vsCoil.CoolHeatType, CurrentObjSubfix)); + ShowContinueError(state, format("Coil Name = {}", vsCoil.Name)); ShowContinueError(state, format("User-Specified Rated Total Heating Capacity of {:.2R} [W]", RatedCapHeatUser)); ShowContinueError(state, format("differs from Design Size Rated Total Heating Capacity of {:.2R} [W]", RatedCapHeatDes)); ShowContinueError(state, "This may, or may not, indicate mismatched component sizes."); @@ -4953,25 +4809,25 @@ namespace VariableSpeedCoils { // FORCE BACK TO THE RATED AIR FLOW RATE WITH THE SAME RATIO DEFINED BY THE CATALOG DATA if (!HardSizeNoDesRunAirFlow) { if ((RatedCapCoolTotalAutoSized) && (RatedAirFlowAutoSized)) { - RatedAirVolFlowRateDes = varSpeedCoil.RatedCapCoolTotal * varSpeedCoil.MSRatedAirVolFlowPerRatedTotCap(NormSpeed); + RatedAirVolFlowRateDes = vsCoil.RatedCapCoolTotal * vsCoil.MSRatedAirVolFlowPerRatedTotCap(NormSpeed); } else if ((RatedCapHeatAutoSized) && (RatedAirFlowAutoSized)) { - RatedAirVolFlowRateDes = varSpeedCoil.RatedCapHeat * varSpeedCoil.MSRatedAirVolFlowPerRatedTotCap(NormSpeed); + RatedAirVolFlowRateDes = vsCoil.RatedCapHeat * vsCoil.MSRatedAirVolFlowPerRatedTotCap(NormSpeed); } // write the air flow sizing output if (RatedAirFlowAutoSized) { - varSpeedCoil.RatedAirVolFlowRate = RatedAirVolFlowRateDes; + vsCoil.RatedAirVolFlowRate = RatedAirVolFlowRateDes; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Air Flow Rate [m3/s]", RatedAirVolFlowRateDes); } else { - if (varSpeedCoil.RatedAirVolFlowRate > 0.0 && RatedAirVolFlowRateDes > 0.0) { - RatedAirVolFlowRateUser = varSpeedCoil.RatedAirVolFlowRate; + if (vsCoil.RatedAirVolFlowRate > 0.0 && RatedAirVolFlowRateDes > 0.0) { + RatedAirVolFlowRateUser = vsCoil.RatedAirVolFlowRate; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Air Flow Rate [m3/s]", RatedAirVolFlowRateDes, "User-Specified Rated Air Flow Rate [m3/s]", @@ -4981,9 +4837,9 @@ namespace VariableSpeedCoils { state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", - varSpeedCoil.CoolHeatType, + vsCoil.CoolHeatType, CurrentObjSubfix)); - ShowContinueError(state, format("Coil Name = {}", varSpeedCoil.Name)); + ShowContinueError(state, format("Coil Name = {}", vsCoil.Name)); ShowContinueError(state, format("User-Specified Rated Air Flow Rate of {:.5R} [m3/s]", RatedAirVolFlowRateUser)); ShowContinueError(state, format("differs from Design Size Rated Air Flow Rate of {:.5R} [m3/s]", RatedAirVolFlowRateDes)); ShowContinueError(state, "This may, or may not, indicate mismatched component sizes."); @@ -4992,262 +4848,262 @@ namespace VariableSpeedCoils { } } } - state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow( - state, varSpeedCoil.Name, varSpeedCoil.VarSpeedCoilType, RatedAirVolFlowRateDes, RatedAirFlowAutoSized); + coilReport->setCoilAirFlow(state, vsCoil.Name, vsCoil.coilType, RatedAirVolFlowRateDes, RatedAirFlowAutoSized); } // Check that heat pump heating capacity is within 20% of cooling capacity. Check only for heating coil and report both. - if ((varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) && - varSpeedCoil.CompanionCoolingCoilNum > 0) { + if ((vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) && + vsCoil.CompanionCoolingCoilNum > 0) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).RatedCapCoolTotal > 0.0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).RatedCapCoolTotal > 0.0) { - if (std::abs(state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).RatedCapCoolTotal - - varSpeedCoil.RatedCapHeat) / - state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).RatedCapCoolTotal > + if (std::abs(state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).RatedCapCoolTotal - + vsCoil.RatedCapHeat) / + state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).RatedCapCoolTotal > 0.2) { ShowWarningError( - state, format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", varSpeedCoil.CoolHeatType, varSpeedCoil.Name)); + state, format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", vsCoil.CoolHeatType, vsCoil.Name)); ShowContinueError(state, format("...used with COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", - state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).CoolHeatType, - state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).Name)); + state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).CoolHeatType, + state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).Name)); ShowContinueError(state, "...heating capacity is disproportionate (> 20% different) to total cooling capacity"); - ShowContinueError(state, format("...heating capacity = {:.3T} W", varSpeedCoil.RatedCapHeat)); + ShowContinueError(state, format("...heating capacity = {:.3T} W", vsCoil.RatedCapHeat)); ShowContinueError(state, format("...cooling capacity = {:.3T} W", - state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).RatedCapCoolTotal)); + state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).RatedCapCoolTotal)); } } } // ASSIGN CAPACITY - switch (varSpeedCoil.VSCoilType) { - case HVAC::Coil_CoolingWaterToAirHPVSEquationFit: - case HVAC::Coil_CoolingAirToAirVariableSpeed: { - varSpeedCoil.MSRatedTotCap(UpperSpeed) = varSpeedCoil.RatedCapCoolTotal / varSpeedCoil.MSRatedPercentTotCap(NormSpeed); + switch (vsCoil.coilType) { + case HVAC::CoilType::CoolingWaterToAirHPVSEquationFit: + case HVAC::CoilType::CoolingAirToAirVariableSpeed: { + vsCoil.MSRatedTotCap(UpperSpeed) = vsCoil.RatedCapCoolTotal / vsCoil.MSRatedPercentTotCap(NormSpeed); } break; - case HVAC::Coil_HeatingWaterToAirHPVSEquationFit: - case HVAC::Coil_HeatingAirToAirVariableSpeed: { - varSpeedCoil.MSRatedTotCap(UpperSpeed) = varSpeedCoil.RatedCapHeat / varSpeedCoil.MSRatedPercentTotCap(NormSpeed); + case HVAC::CoilType::HeatingWaterToAirHPVSEquationFit: + case HVAC::CoilType::HeatingAirToAirVariableSpeed: { + vsCoil.MSRatedTotCap(UpperSpeed) = vsCoil.RatedCapHeat / vsCoil.MSRatedPercentTotCap(NormSpeed); } break; - case HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed: { - varSpeedCoil.MSRatedTotCap(UpperSpeed) = varSpeedCoil.RatedCapWH / varSpeedCoil.MSRatedPercentTotCap(NormSpeed); + case HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed: { + vsCoil.MSRatedTotCap(UpperSpeed) = vsCoil.RatedCapWH / vsCoil.MSRatedPercentTotCap(NormSpeed); } break; } - if (varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed) { HPInletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb( - state, varSpeedCoil.WHRatedInletDBTemp, varSpeedCoil.WHRatedInletWBTemp, state.dataEnvrn->StdBaroPress, RoutineName); + state, vsCoil.WHRatedInletDBTemp, vsCoil.WHRatedInletWBTemp, state.dataEnvrn->StdBaroPress, RoutineName); - for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { - varSpeedCoil.MSRatedTotCap(Mode) = varSpeedCoil.MSRatedTotCap(UpperSpeed) * varSpeedCoil.MSRatedPercentTotCap(Mode); - varSpeedCoil.MSRatedAirVolFlowRate(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); - varSpeedCoil.MSRatedAirMassFlowRate(Mode) = varSpeedCoil.MSRatedAirVolFlowRate(Mode) * rhoair; + for (Mode = vsCoil.NumOfSpeeds; Mode >= 1; --Mode) { + vsCoil.MSRatedTotCap(Mode) = vsCoil.MSRatedTotCap(UpperSpeed) * vsCoil.MSRatedPercentTotCap(Mode); + vsCoil.MSRatedAirVolFlowRate(Mode) = vsCoil.MSRatedTotCap(Mode) * vsCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); + vsCoil.MSRatedAirMassFlowRate(Mode) = vsCoil.MSRatedAirVolFlowRate(Mode) * rhoair; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - varSpeedCoil.EvapCondAirFlow(Mode) = 0.0; + vsCoil.EvapCondAirFlow(Mode) = 0.0; } } else { // HPWH, the mass flow rate will be updated by a revised entering air density - if (varSpeedCoil.MSHPDesignSpecIndex > -1 && state.dataUnitarySystems->designSpecMSHP.size() > 0) { - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (state.dataUnitarySystems->designSpecMSHP[varSpeedCoil.MSHPDesignSpecIndex].numOfSpeedCooling != varSpeedCoil.NumOfSpeeds) { + if (vsCoil.MSHPDesignSpecIndex > -1 && state.dataUnitarySystems->designSpecMSHP.size() > 0) { + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + if (state.dataUnitarySystems->designSpecMSHP[vsCoil.MSHPDesignSpecIndex].numOfSpeedCooling != vsCoil.NumOfSpeeds) { ShowFatalError(state, format("COIL:{} = {}{} number of speeds not equal to number of speed specified in " "UnitarySystemPerformance:Multispeed object.", - varSpeedCoil.CoolHeatType, + vsCoil.CoolHeatType, CurrentObjSubfix, - varSpeedCoil.Name)); + vsCoil.Name)); } else { - for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { - varSpeedCoil.MSRatedAirVolFlowRate(Mode) = - varSpeedCoil.RatedAirVolFlowRate * - state.dataUnitarySystems->designSpecMSHP[varSpeedCoil.MSHPDesignSpecIndex].coolingVolFlowRatio[Mode - 1]; - varSpeedCoil.MSRatedTotCap(Mode) = - varSpeedCoil.MSRatedAirVolFlowRate(Mode) / varSpeedCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); - varSpeedCoil.MSRatedAirMassFlowRate(Mode) = varSpeedCoil.MSRatedAirVolFlowRate(Mode) * rhoair; + for (Mode = vsCoil.NumOfSpeeds; Mode >= 1; --Mode) { + vsCoil.MSRatedAirVolFlowRate(Mode) = + vsCoil.RatedAirVolFlowRate * + state.dataUnitarySystems->designSpecMSHP[vsCoil.MSHPDesignSpecIndex].coolingVolFlowRatio[Mode - 1]; + vsCoil.MSRatedTotCap(Mode) = + vsCoil.MSRatedAirVolFlowRate(Mode) / vsCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); + vsCoil.MSRatedAirMassFlowRate(Mode) = vsCoil.MSRatedAirVolFlowRate(Mode) * rhoair; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - varSpeedCoil.EvapCondAirFlow(Mode) = - varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedEvapCondVolFlowPerRatedTotCap(Mode); + vsCoil.EvapCondAirFlow(Mode) = + vsCoil.MSRatedTotCap(Mode) * vsCoil.MSRatedEvapCondVolFlowPerRatedTotCap(Mode); } } - } else if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { - if (state.dataUnitarySystems->designSpecMSHP[varSpeedCoil.MSHPDesignSpecIndex].numOfSpeedHeating != varSpeedCoil.NumOfSpeeds) { + } else if (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + if (state.dataUnitarySystems->designSpecMSHP[vsCoil.MSHPDesignSpecIndex].numOfSpeedHeating != vsCoil.NumOfSpeeds) { ShowFatalError(state, format("COIL:{}{} = \"{}\" number of speeds not equal to number of speed specified in " "UnitarySystemPerformance:Multispeed object.", - varSpeedCoil.CoolHeatType, + vsCoil.CoolHeatType, CurrentObjSubfix, - varSpeedCoil.Name)); + vsCoil.Name)); } else { - for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { - varSpeedCoil.MSRatedAirVolFlowRate(Mode) = - varSpeedCoil.RatedAirVolFlowRate * - state.dataUnitarySystems->designSpecMSHP[varSpeedCoil.MSHPDesignSpecIndex].heatingVolFlowRatio[Mode - 1]; - varSpeedCoil.MSRatedTotCap(Mode) = - varSpeedCoil.MSRatedAirVolFlowRate(Mode) / varSpeedCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); - varSpeedCoil.MSRatedAirMassFlowRate(Mode) = varSpeedCoil.MSRatedAirVolFlowRate(Mode) * rhoair; + for (Mode = vsCoil.NumOfSpeeds; Mode >= 1; --Mode) { + vsCoil.MSRatedAirVolFlowRate(Mode) = + vsCoil.RatedAirVolFlowRate * + state.dataUnitarySystems->designSpecMSHP[vsCoil.MSHPDesignSpecIndex].heatingVolFlowRatio[Mode - 1]; + vsCoil.MSRatedTotCap(Mode) = + vsCoil.MSRatedAirVolFlowRate(Mode) / vsCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); + vsCoil.MSRatedAirMassFlowRate(Mode) = vsCoil.MSRatedAirVolFlowRate(Mode) * rhoair; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - varSpeedCoil.EvapCondAirFlow(Mode) = - varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedEvapCondVolFlowPerRatedTotCap(Mode); + vsCoil.EvapCondAirFlow(Mode) = + vsCoil.MSRatedTotCap(Mode) * vsCoil.MSRatedEvapCondVolFlowPerRatedTotCap(Mode); } } } } else { - for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { - varSpeedCoil.MSRatedTotCap(Mode) = varSpeedCoil.MSRatedTotCap(UpperSpeed) * varSpeedCoil.MSRatedPercentTotCap(Mode); - varSpeedCoil.MSRatedAirVolFlowRate(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); - varSpeedCoil.MSRatedAirMassFlowRate(Mode) = varSpeedCoil.MSRatedAirVolFlowRate(Mode) * rhoair; + for (Mode = vsCoil.NumOfSpeeds; Mode >= 1; --Mode) { + vsCoil.MSRatedTotCap(Mode) = vsCoil.MSRatedTotCap(UpperSpeed) * vsCoil.MSRatedPercentTotCap(Mode); + vsCoil.MSRatedAirVolFlowRate(Mode) = vsCoil.MSRatedTotCap(Mode) * vsCoil.MSRatedAirVolFlowPerRatedTotCap(Mode); + vsCoil.MSRatedAirMassFlowRate(Mode) = vsCoil.MSRatedAirVolFlowRate(Mode) * rhoair; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - varSpeedCoil.EvapCondAirFlow(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedEvapCondVolFlowPerRatedTotCap(Mode); + vsCoil.EvapCondAirFlow(Mode) = vsCoil.MSRatedTotCap(Mode) * vsCoil.MSRatedEvapCondVolFlowPerRatedTotCap(Mode); } } } // size rated power - switch (varSpeedCoil.VSCoilType) { - case HVAC::Coil_CoolingWaterToAirHPVSEquationFit: - case HVAC::Coil_CoolingAirToAirVariableSpeed: { - varSpeedCoil.RatedCOPCool = varSpeedCoil.MSRatedCOP(varSpeedCoil.NormSpedLevel); - varSpeedCoil.RatedPowerCool = varSpeedCoil.RatedCapCoolTotal / varSpeedCoil.RatedCOPCool; + switch (vsCoil.coilType) { + case HVAC::CoilType::CoolingWaterToAirHPVSEquationFit: + case HVAC::CoilType::CoolingAirToAirVariableSpeed: { + vsCoil.RatedCOPCool = vsCoil.MSRatedCOP(vsCoil.NormSpedLevel); + vsCoil.RatedPowerCool = vsCoil.RatedCapCoolTotal / vsCoil.RatedCOPCool; } break; - case HVAC::Coil_HeatingWaterToAirHPVSEquationFit: - case HVAC::Coil_HeatingAirToAirVariableSpeed: { - varSpeedCoil.RatedCOPHeat = varSpeedCoil.MSRatedCOP(varSpeedCoil.NormSpedLevel); - varSpeedCoil.RatedPowerHeat = varSpeedCoil.RatedCapHeat / varSpeedCoil.RatedCOPHeat; - varSpeedCoil.RatedCapCoolTotal = varSpeedCoil.RatedCapHeat; + case HVAC::CoilType::HeatingWaterToAirHPVSEquationFit: + case HVAC::CoilType::HeatingAirToAirVariableSpeed: { + vsCoil.RatedCOPHeat = vsCoil.MSRatedCOP(vsCoil.NormSpedLevel); + vsCoil.RatedPowerHeat = vsCoil.RatedCapHeat / vsCoil.RatedCOPHeat; + vsCoil.RatedCapCoolTotal = vsCoil.RatedCapHeat; } break; - case HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed: { - varSpeedCoil.RatedCOPHeat = varSpeedCoil.MSRatedCOP(varSpeedCoil.NormSpedLevel); - varSpeedCoil.RatedPowerHeat = varSpeedCoil.RatedCapWH / varSpeedCoil.RatedCOPHeat; - varSpeedCoil.RatedCapCoolTotal = varSpeedCoil.RatedCapWH * (1.0 - 1.0 / varSpeedCoil.RatedCOPHeat); + case HVAC::CoilType::DXHeatPumpWaterHeaterVariableSpeed: { + vsCoil.RatedCOPHeat = vsCoil.MSRatedCOP(vsCoil.NormSpedLevel); + vsCoil.RatedPowerHeat = vsCoil.RatedCapWH / vsCoil.RatedCOPHeat; + vsCoil.RatedCapCoolTotal = vsCoil.RatedCapWH * (1.0 - 1.0 / vsCoil.RatedCOPHeat); } break; } // Size water volumetric flow rate - if ((varSpeedCoil.RatedWaterVolFlowRate == DataSizing::AutoSize) && - (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit)) { + if ((vsCoil.RatedWaterVolFlowRate == DataSizing::AutoSize) && + (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit)) { RatedWaterFlowAutoSized = true; } // WSHP condenser can be on either a plant loop or condenser loop. Test each to find plant sizing number. // first check to see if coil is connected to a plant loop, no warning on this CALL if (RatedWaterFlowAutoSized) { - if (varSpeedCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Water) + if (vsCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Water) PltSizNum = PlantUtilities::MyPlantSizingIndex(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, - varSpeedCoil.WaterInletNodeNum, - varSpeedCoil.WaterOutletNodeNum, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, + vsCoil.WaterInletNodeNum, + vsCoil.WaterOutletNodeNum, ErrorsFound, false); if (PltSizNum > 0) { - rho = state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum) + rho = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getDensity(state, state.dataSize->PlantSizData(PltSizNum).ExitTemp, RoutineNameAlt); - cp = state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum) + cp = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizNum).ExitTemp, RoutineNameAlt); - if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { - RatedWaterVolFlowRateDes = varSpeedCoil.RatedCapHeat / (state.dataSize->PlantSizData(PltSizNum).DeltaT * cp * rho); + RatedWaterVolFlowRateDes = vsCoil.RatedCapHeat / (state.dataSize->PlantSizData(PltSizNum).DeltaT * cp * rho); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgWaterTemp( + coilReport->setCoilLvgWaterTemp( state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, + vsCoil.Name, + vsCoil.coilType, state.dataSize->PlantSizData(PltSizNum).ExitTemp + state.dataSize->PlantSizData(PltSizNum).DeltaT); // TRACE 3D Plus coil selection report - } else if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + } else if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // use companion heating coil capacity to calculate volumetric flow rate - if (varSpeedCoil.CompanionCoolingCoilNum > 0) { - SystemCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(varSpeedCoil.CompanionCoolingCoilNum).RatedCapHeat; + if (vsCoil.CompanionCoolingCoilNum > 0) { + SystemCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(vsCoil.CompanionCoolingCoilNum).RatedCapHeat; } else { - SystemCapacity = varSpeedCoil.RatedCapCoolTotal; + SystemCapacity = vsCoil.RatedCapCoolTotal; } RatedWaterVolFlowRateDes = SystemCapacity / (state.dataSize->PlantSizData(PltSizNum).DeltaT * cp * rho); - state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgWaterTemp( + coilReport->setCoilLvgWaterTemp( state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, + vsCoil.Name, + vsCoil.coilType, state.dataSize->PlantSizData(PltSizNum).ExitTemp - state.dataSize->PlantSizData(PltSizNum).DeltaT); // TRACE 3D Plus coil selection report } - state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntWaterTemp( + coilReport->setCoilEntWaterTemp( state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, + vsCoil.Name, + vsCoil.coilType, state.dataSize->PlantSizData(PltSizNum).ExitTemp); // TRACE 3D Plus coil selection report - state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterDeltaT( + coilReport->setCoilWaterDeltaT( state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, + vsCoil.Name, + vsCoil.coilType, state.dataSize->PlantSizData(PltSizNum).DeltaT); // TRACE 3D Plus coil selection report } else { ShowSevereError(state, "Autosizing of water flow requires a loop Sizing:Plant object"); ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop."); - ShowContinueError(state, format("Occurs in COIL:{}{} Object = {}", varSpeedCoil.CoolHeatType, CurrentObjSubfix, varSpeedCoil.Name)); + ShowContinueError(state, format("Occurs in COIL:{}{} Object = {}", vsCoil.CoolHeatType, CurrentObjSubfix, vsCoil.Name)); ErrorsFound = true; } // WRITE THE WATER SIZING OUTPUT // FORCE BACK TO THE RATED WATER FLOW RATE WITH THE SAME RATIO DEFINED BY THE CATLOG DATA if (RatedCapCoolTotalAutoSized) { - RatedWaterVolFlowRateDes = varSpeedCoil.RatedCapCoolTotal * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); + RatedWaterVolFlowRateDes = vsCoil.RatedCapCoolTotal * vsCoil.MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); } else if (RatedCapHeatAutoSized) { - RatedWaterVolFlowRateDes = varSpeedCoil.RatedCapHeat * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); - } - state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterFlowNodeNums(state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, - RatedWaterVolFlowRateDes, - RatedWaterFlowAutoSized, - varSpeedCoil.WaterInletNodeNum, - varSpeedCoil.WaterOutletNodeNum, - varSpeedCoil.plantLoc.loopNum); - varSpeedCoil.RatedWaterVolFlowRate = RatedWaterVolFlowRateDes; + RatedWaterVolFlowRateDes = vsCoil.RatedCapHeat * vsCoil.MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); + } + auto &coilReport = state.dataRptCoilSelection->coilSelectionReportObj; + coilReport->setCoilWaterFlowNodeNums(state, + vsCoil.Name, + vsCoil.VarSpeedCoilType, + RatedWaterVolFlowRateDes, + RatedWaterFlowAutoSized, + vsCoil.WaterInletNodeNum, + vsCoil.WaterOutletNodeNum, + vsCoil.plantLoc.loopNum); + vsCoil.RatedWaterVolFlowRate = RatedWaterVolFlowRateDes; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Water Flow Rate [m3/s]", RatedWaterVolFlowRateDes); // Ensure water flow rate at lower speed must be lower or // equal to the flow rate at higher speed. Otherwise, a severe error is isssued. - for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds - 1; ++Mode) { - if (varSpeedCoil.MSRatedWaterVolFlowRate(Mode) > varSpeedCoil.MSRatedWaterVolFlowRate(Mode + 1) * 1.05) { + for (Mode = 1; Mode <= vsCoil.NumOfSpeeds - 1; ++Mode) { + if (vsCoil.MSRatedWaterVolFlowRate(Mode) > vsCoil.MSRatedWaterVolFlowRate(Mode + 1) * 1.05) { ShowWarningError( state, format("SizeDXCoil: {} {}, Speed {} Rated Air Flow Rate must be less than or equal to Speed {} Rated Air Flow Rate.", - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, + vsCoil.VarSpeedCoilType, + vsCoil.Name, Mode, Mode + 1)); ShowContinueError( state, - format("Instead, {:.2R} > {:.2R}", varSpeedCoil.MSRatedAirVolFlowRate(Mode), varSpeedCoil.MSRatedAirVolFlowRate(Mode + 1))); + format("Instead, {:.2R} > {:.2R}", vsCoil.MSRatedAirVolFlowRate(Mode), vsCoil.MSRatedAirVolFlowRate(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } } else { - if (varSpeedCoil.RatedWaterVolFlowRate > 0.0 && RatedWaterVolFlowRateDes > 0.0) { - RatedWaterVolFlowRateUser = varSpeedCoil.RatedWaterVolFlowRate; + if (vsCoil.RatedWaterVolFlowRate > 0.0 && RatedWaterVolFlowRateDes > 0.0) { + RatedWaterVolFlowRateUser = vsCoil.RatedWaterVolFlowRate; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Water Flow Rate [m3/s]", RatedWaterVolFlowRateDes, "User-Specified Rated Water Flow Rate [m3/s]", @@ -5257,8 +5113,8 @@ namespace VariableSpeedCoils { state.dataSize->AutoVsHardSizingThreshold) { ShowMessage( state, - format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", varSpeedCoil.CoolHeatType, CurrentObjSubfix)); - ShowContinueError(state, format("Coil Name = {}", varSpeedCoil.Name)); + format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", vsCoil.CoolHeatType, CurrentObjSubfix)); + ShowContinueError(state, format("Coil Name = {}", vsCoil.Name)); ShowContinueError(state, format("User-Specified Rated Water Flow Rate of {:.5R} [m3/s]", RatedWaterVolFlowRateUser)); ShowContinueError(state, format("differs from Design Size Rated Water Flow Rate of {:.5R} [m3/s]", RatedWaterVolFlowRateDes)); ShowContinueError(state, "This may, or may not, indicate mismatched component sizes."); @@ -5269,154 +5125,154 @@ namespace VariableSpeedCoils { } // Save component design water volumetric flow rate. - if (varSpeedCoil.RatedWaterVolFlowRate > 0.0 && varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { - PlantUtilities::RegisterPlantCompDesignFlow(state, varSpeedCoil.WaterInletNodeNum, varSpeedCoil.RatedWaterVolFlowRate); + if (vsCoil.RatedWaterVolFlowRate > 0.0 && vsCoil.coilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + PlantUtilities::RegisterPlantCompDesignFlow(state, vsCoil.WaterInletNodeNum, vsCoil.RatedWaterVolFlowRate); } // Use 1/2 flow since both cooling and heating coil will save flow yet only 1 will operate at a time - else if (varSpeedCoil.RatedWaterVolFlowRate > 0.0) { - PlantUtilities::RegisterPlantCompDesignFlow(state, varSpeedCoil.WaterInletNodeNum, 0.5 * varSpeedCoil.RatedWaterVolFlowRate); + else if (vsCoil.RatedWaterVolFlowRate > 0.0) { + PlantUtilities::RegisterPlantCompDesignFlow(state, vsCoil.WaterInletNodeNum, 0.5 * vsCoil.RatedWaterVolFlowRate); } RatedSourceTempCool = GetVSCoilRatedSourceTemp(state, DXCoilNum); - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { if (PltSizNum > 0) { rhoW = rho; } else { - rhoW = state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).glycol->getDensity(state, RatedSourceTempCool, RoutineName); + rhoW = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum).glycol->getDensity(state, RatedSourceTempCool, RoutineName); } - varSpeedCoil.RatedWaterMassFlowRate = varSpeedCoil.RatedWaterVolFlowRate * rhoW; - for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { - varSpeedCoil.MSRatedWaterVolFlowRate(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(Mode); - varSpeedCoil.MSRatedWaterMassFlowRate(Mode) = varSpeedCoil.MSRatedWaterVolFlowRate(Mode) * rhoW; + vsCoil.RatedWaterMassFlowRate = vsCoil.RatedWaterVolFlowRate * rhoW; + for (Mode = vsCoil.NumOfSpeeds; Mode >= 1; --Mode) { + vsCoil.MSRatedWaterVolFlowRate(Mode) = vsCoil.MSRatedTotCap(Mode) * vsCoil.MSRatedWaterVolFlowPerRatedTotCap(Mode); + vsCoil.MSRatedWaterMassFlowRate(Mode) = vsCoil.MSRatedWaterVolFlowRate(Mode) * rhoW; } - } else if (varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + } else if (vsCoil.coilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { rhoW = Psychrometrics::RhoH2O(RatedSourceTempCool); - varSpeedCoil.RatedWaterMassFlowRate = varSpeedCoil.RatedWaterVolFlowRate * rhoW; - for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { - varSpeedCoil.MSRatedWaterVolFlowRate(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(Mode); - varSpeedCoil.MSWHPumpPower(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSWHPumpPowerPerRatedTotCap(Mode); - varSpeedCoil.MSRatedWaterMassFlowRate(Mode) = varSpeedCoil.MSRatedWaterVolFlowRate(Mode) * rhoW; + vsCoil.RatedWaterMassFlowRate = vsCoil.RatedWaterVolFlowRate * rhoW; + for (Mode = vsCoil.NumOfSpeeds; Mode >= 1; --Mode) { + vsCoil.MSRatedWaterVolFlowRate(Mode) = vsCoil.MSRatedTotCap(Mode) * vsCoil.MSRatedWaterVolFlowPerRatedTotCap(Mode); + vsCoil.MSWHPumpPower(Mode) = vsCoil.MSRatedTotCap(Mode) * vsCoil.MSWHPumpPowerPerRatedTotCap(Mode); + vsCoil.MSRatedWaterMassFlowRate(Mode) = vsCoil.MSRatedWaterVolFlowRate(Mode) * rhoW; } } // Ensure air flow rate at lower speed must be lower or // equal to the flow rate at higher speed. Otherwise, a severe error is issued. - for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds - 1; ++Mode) { - if (varSpeedCoil.MSRatedAirVolFlowRate(Mode) > varSpeedCoil.MSRatedAirVolFlowRate(Mode + 1)) { + for (Mode = 1; Mode <= vsCoil.NumOfSpeeds - 1; ++Mode) { + if (vsCoil.MSRatedAirVolFlowRate(Mode) > vsCoil.MSRatedAirVolFlowRate(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Air Flow Rate must be less than or equal to Speed {} Rated Air Flow Rate.", - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, + vsCoil.VarSpeedCoilType, + vsCoil.Name, Mode, Mode + 1)); ShowContinueError( state, - format("Instead, {:.2R} > {:.2R}", varSpeedCoil.MSRatedAirVolFlowRate(Mode), varSpeedCoil.MSRatedAirVolFlowRate(Mode + 1))); + format("Instead, {:.2R} > {:.2R}", vsCoil.MSRatedAirVolFlowRate(Mode), vsCoil.MSRatedAirVolFlowRate(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } // Ensure capacity at lower speed must be lower or equal to the capacity at higher speed. - for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds - 1; ++Mode) { - if (varSpeedCoil.MSRatedTotCap(Mode) > varSpeedCoil.MSRatedTotCap(Mode + 1)) { + for (Mode = 1; Mode <= vsCoil.NumOfSpeeds - 1; ++Mode) { + if (vsCoil.MSRatedTotCap(Mode) > vsCoil.MSRatedTotCap(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Total Cooling Capacity must be less than or equal to Speed {} Rated Total " "Cooling Capacity.", - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, + vsCoil.VarSpeedCoilType, + vsCoil.Name, Mode, Mode + 1)); - ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", varSpeedCoil.MSRatedTotCap(Mode), varSpeedCoil.MSRatedTotCap(Mode + 1))); + ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", vsCoil.MSRatedTotCap(Mode), vsCoil.MSRatedTotCap(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } // convert SHR to rated Bypass factor and effective air side surface area - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds; ++Mode) { - varSpeedCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + for (Mode = 1; Mode <= vsCoil.NumOfSpeeds; ++Mode) { + vsCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, + vsCoil.VarSpeedCoilType, + vsCoil.Name, RatedInletAirTemp, RatedInletAirHumRat, - varSpeedCoil.MSRatedTotCap(Mode), - varSpeedCoil.MSRatedAirVolFlowRate(Mode), - varSpeedCoil.MSRatedSHR(Mode), + vsCoil.MSRatedTotCap(Mode), + vsCoil.MSRatedAirVolFlowRate(Mode), + vsCoil.MSRatedSHR(Mode), true); - if (varSpeedCoil.MSRatedCBF(Mode) > 0.0) { - varSpeedCoil.MSEffectiveAo(Mode) = -std::log(varSpeedCoil.MSRatedCBF(Mode)) * varSpeedCoil.MSRatedAirMassFlowRate(Mode); + if (vsCoil.MSRatedCBF(Mode) > 0.0) { + vsCoil.MSEffectiveAo(Mode) = -std::log(vsCoil.MSRatedCBF(Mode)) * vsCoil.MSRatedAirMassFlowRate(Mode); } else { - varSpeedCoil.MSEffectiveAo(Mode) = 0.0; + vsCoil.MSEffectiveAo(Mode) = 0.0; } } - } else if (varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { - state.dataHVACGlobal->HPWHInletDBTemp = varSpeedCoil.WHRatedInletDBTemp; - state.dataHVACGlobal->HPWHInletWBTemp = varSpeedCoil.WHRatedInletWBTemp; + } else if (vsCoil.coilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + state.dataHVACGlobal->HPWHInletDBTemp = vsCoil.WHRatedInletDBTemp; + state.dataHVACGlobal->HPWHInletWBTemp = vsCoil.WHRatedInletWBTemp; - for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds; ++Mode) { - varSpeedCoil.MSRatedAirMassFlowRate(Mode) = varSpeedCoil.MSRatedAirVolFlowRate(Mode) * rhoair; + for (Mode = 1; Mode <= vsCoil.NumOfSpeeds; ++Mode) { + vsCoil.MSRatedAirMassFlowRate(Mode) = vsCoil.MSRatedAirVolFlowRate(Mode) * rhoair; } - for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds; ++Mode) { + for (Mode = 1; Mode <= vsCoil.NumOfSpeeds; ++Mode) { // get cooling capacity, without fan power, i.e. total coil cooling - if (varSpeedCoil.CondPumpPowerInCOP) - HPWHCoolCapacity = varSpeedCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / varSpeedCoil.MSRatedCOP(Mode)) + - varSpeedCoil.MSWHPumpPower(Mode) - varSpeedCoil.MSWHPumpPower(Mode) * varSpeedCoil.HPWHCondPumpFracToWater; + if (vsCoil.CondPumpPowerInCOP) + HPWHCoolCapacity = vsCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / vsCoil.MSRatedCOP(Mode)) + + vsCoil.MSWHPumpPower(Mode) - vsCoil.MSWHPumpPower(Mode) * vsCoil.HPWHCondPumpFracToWater; else - HPWHCoolCapacity = varSpeedCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / varSpeedCoil.MSRatedCOP(Mode)) - - varSpeedCoil.MSWHPumpPower(Mode) * varSpeedCoil.HPWHCondPumpFracToWater; + HPWHCoolCapacity = vsCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / vsCoil.MSRatedCOP(Mode)) - + vsCoil.MSWHPumpPower(Mode) * vsCoil.HPWHCondPumpFracToWater; - varSpeedCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, + vsCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, + vsCoil.VarSpeedCoilType, + vsCoil.Name, state.dataHVACGlobal->HPWHInletDBTemp, HPInletAirHumRat, HPWHCoolCapacity, - varSpeedCoil.MSRatedAirVolFlowRate(Mode), - varSpeedCoil.MSRatedSHR(Mode), + vsCoil.MSRatedAirVolFlowRate(Mode), + vsCoil.MSRatedSHR(Mode), true); - if (varSpeedCoil.MSRatedCBF(Mode) > 0.0) { - varSpeedCoil.MSEffectiveAo(Mode) = -std::log(varSpeedCoil.MSRatedCBF(Mode)) * varSpeedCoil.MSRatedAirMassFlowRate(Mode); + if (vsCoil.MSRatedCBF(Mode) > 0.0) { + vsCoil.MSEffectiveAo(Mode) = -std::log(vsCoil.MSRatedCBF(Mode)) * vsCoil.MSRatedAirMassFlowRate(Mode); } else { - varSpeedCoil.MSEffectiveAo(Mode) = 0.0; + vsCoil.MSEffectiveAo(Mode) = 0.0; } } // update VarSpeedCoil(DXCoilNum).RatedCapCoolTotal - Mode = varSpeedCoil.NormSpedLevel; - if (varSpeedCoil.CondPumpPowerInCOP) { - varSpeedCoil.RatedCapCoolTotal = varSpeedCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / varSpeedCoil.MSRatedCOP(Mode)) + - varSpeedCoil.MSWHPumpPower(Mode) - - varSpeedCoil.MSWHPumpPower(Mode) * varSpeedCoil.HPWHCondPumpFracToWater; + Mode = vsCoil.NormSpedLevel; + if (vsCoil.CondPumpPowerInCOP) { + vsCoil.RatedCapCoolTotal = vsCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / vsCoil.MSRatedCOP(Mode)) + + vsCoil.MSWHPumpPower(Mode) - + vsCoil.MSWHPumpPower(Mode) * vsCoil.HPWHCondPumpFracToWater; } else { - varSpeedCoil.RatedCapCoolTotal = varSpeedCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / varSpeedCoil.MSRatedCOP(Mode)) - - varSpeedCoil.MSWHPumpPower(Mode) * varSpeedCoil.HPWHCondPumpFracToWater; + vsCoil.RatedCapCoolTotal = vsCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / vsCoil.MSRatedCOP(Mode)) - + vsCoil.MSWHPumpPower(Mode) * vsCoil.HPWHCondPumpFracToWater; } } // size rated sensible cooling capacity RatedCapCoolSensAutoSized = true; // always do that - if (varSpeedCoil.RatedAirVolFlowRate >= HVAC::SmallAirVolFlow && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { + if (vsCoil.RatedAirVolFlowRate >= HVAC::SmallAirVolFlow && (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed)) { RatedAirMassFlowRate = - varSpeedCoil.RatedAirVolFlowRate * + vsCoil.RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); RatedInletEnth = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, RatedInletAirHumRat); - CBFRated = DXCoils::AdjustCBF(varSpeedCoil.MSRatedCBF(NormSpeed), varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); + CBFRated = DXCoils::AdjustCBF(vsCoil.MSRatedCBF(NormSpeed), vsCoil.MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); if (CBFRated > 0.999) CBFRated = 0.999; - if (varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed) > 1.0e-10) { - AirMassFlowRatio = RatedAirMassFlowRate / varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed); + if (vsCoil.MSRatedAirMassFlowRate(NormSpeed) > 1.0e-10) { + AirMassFlowRatio = RatedAirMassFlowRate / vsCoil.MSRatedAirMassFlowRate(NormSpeed); } else { AirMassFlowRatio = 1.0; } - if (varSpeedCoil.MSRatedWaterVolFlowRate(NormSpeed) > 1.0e-10) { - WaterMassFlowRatio = varSpeedCoil.RatedWaterVolFlowRate / varSpeedCoil.MSRatedWaterVolFlowRate(NormSpeed); + if (vsCoil.MSRatedWaterVolFlowRate(NormSpeed) > 1.0e-10) { + WaterMassFlowRatio = vsCoil.RatedWaterVolFlowRate / vsCoil.MSRatedWaterVolFlowRate(NormSpeed); } else { WaterMassFlowRatio = 1.0; } @@ -5431,10 +5287,10 @@ namespace VariableSpeedCoils { WaterMassFlowRatio, RatedAirMassFlowRate, CBFRated, - varSpeedCoil.MSRatedTotCap(NormSpeed), - varSpeedCoil.MSCCapFTemp(NormSpeed), - varSpeedCoil.MSCCapAirFFlow(NormSpeed), - varSpeedCoil.MSCCapWaterFFlow(NormSpeed), + vsCoil.MSRatedTotCap(NormSpeed), + vsCoil.MSCCapFTemp(NormSpeed), + vsCoil.MSCCapAirFFlow(NormSpeed), + vsCoil.MSCCapWaterFFlow(NormSpeed), 0.0, 0, 0, @@ -5447,13 +5303,13 @@ namespace VariableSpeedCoils { state.dataEnvrn->StdBaroPress, 0.0, 1, - varSpeedCoil.capModFacTotal); + vsCoil.capModFacTotal); - RatedCapCoolSensDes = varSpeedCoil.RatedCapCoolTotal * SHR; - } else if (varSpeedCoil.RatedAirVolFlowRate >= HVAC::SmallAirVolFlow && - varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { - SHR = varSpeedCoil.MSRatedSHR(NormSpeed); - RatedCapCoolSensDes = varSpeedCoil.RatedCapCoolTotal * SHR; + RatedCapCoolSensDes = vsCoil.RatedCapCoolTotal * SHR; + } else if (vsCoil.RatedAirVolFlowRate >= HVAC::SmallAirVolFlow && + vsCoil.coilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { + SHR = vsCoil.MSRatedSHR(NormSpeed); + RatedCapCoolSensDes = vsCoil.RatedCapCoolTotal * SHR; } else { RatedCapCoolSensDes = 0.0; } @@ -5462,45 +5318,45 @@ namespace VariableSpeedCoils { RatedCapCoolSensDes = 0.0; } - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { // always report for cooling mode + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // always report for cooling mode if (RatedCapCoolTotalAutoSized) { - varSpeedCoil.RatedCapCoolSens = RatedCapCoolSensDes; + vsCoil.RatedCapCoolSens = RatedCapCoolSensDes; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Sensible Cooling Capacity [W]", - varSpeedCoil.RatedCapCoolSens); + vsCoil.RatedCapCoolSens); } else { // sensible capacity does not have an input field if (RatedCapCoolSensDes > 0.0) { - varSpeedCoil.RatedCapCoolSens = RatedCapCoolSensDes; + vsCoil.RatedCapCoolSens = RatedCapCoolSensDes; BaseSizer::reportSizerOutput(state, - format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), - varSpeedCoil.Name, + format("COIL:{}{}", vsCoil.CoolHeatType, CurrentObjSubfix), + vsCoil.Name, "Design Size Rated Sensible Cooling Capacity [W]", RatedCapCoolSensDes); //, & } } OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCoolCoilTotCap, varSpeedCoil.Name, varSpeedCoil.RatedCapCoolTotal); + state, state.dataOutRptPredefined->pdchCoolCoilTotCap, vsCoil.Name, vsCoil.RatedCapCoolTotal); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCoolCoilSensCap, varSpeedCoil.Name, varSpeedCoil.RatedCapCoolSens); + state, state.dataOutRptPredefined->pdchCoolCoilSensCap, vsCoil.Name, vsCoil.RatedCapCoolSens); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilLatCap, - varSpeedCoil.Name, - varSpeedCoil.RatedCapCoolTotal - varSpeedCoil.RatedCapCoolSens); - if (varSpeedCoil.RatedCapCoolTotal != 0.0) { + vsCoil.Name, + vsCoil.RatedCapCoolTotal - vsCoil.RatedCapCoolSens); + if (vsCoil.RatedCapCoolTotal != 0.0) { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, - varSpeedCoil.Name, - varSpeedCoil.RatedCapCoolSens / varSpeedCoil.RatedCapCoolTotal); + vsCoil.Name, + vsCoil.RatedCapCoolSens / vsCoil.RatedCapCoolTotal); } else { - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, varSpeedCoil.Name, 0.0); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, vsCoil.Name, 0.0); } OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCoolCoilNomEff, varSpeedCoil.Name, varSpeedCoil.MSRatedCOP(varSpeedCoil.NormSpedLevel)); + state, state.dataOutRptPredefined->pdchCoolCoilNomEff, vsCoil.Name, vsCoil.MSRatedCOP(vsCoil.NormSpedLevel)); OutputReportPredefined::addFootNoteSubTable( state, state.dataOutRptPredefined->pdstCoolCoil, @@ -5509,25 +5365,25 @@ namespace VariableSpeedCoils { // START SIZING EVAP PRECOOLING PUMP POWER IsAutoSize = false; - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (varSpeedCoil.EvapCondPumpElecNomPower == DataSizing::AutoSize) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + if (vsCoil.EvapCondPumpElecNomPower == DataSizing::AutoSize) { IsAutoSize = true; } // Auto size high speed evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) - EvapCondPumpElecNomPowerDes = varSpeedCoil.RatedCapCoolTotal * 0.004266; + EvapCondPumpElecNomPowerDes = vsCoil.RatedCapCoolTotal * 0.004266; if (IsAutoSize) { - varSpeedCoil.EvapCondPumpElecNomPower = EvapCondPumpElecNomPowerDes; + vsCoil.EvapCondPumpElecNomPower = EvapCondPumpElecNomPowerDes; BaseSizer::reportSizerOutput(state, "AS VS COOLING COIL", - varSpeedCoil.Name, + vsCoil.Name, "Design Size Evaporative Condenser Pump Rated Power Consumption [W]", EvapCondPumpElecNomPowerDes); } else { - if (varSpeedCoil.EvapCondPumpElecNomPower > 0.0 && EvapCondPumpElecNomPowerDes > 0.0) { - EvapCondPumpElecNomPowerUser = varSpeedCoil.EvapCondPumpElecNomPower; + if (vsCoil.EvapCondPumpElecNomPower > 0.0 && EvapCondPumpElecNomPowerDes > 0.0) { + EvapCondPumpElecNomPowerUser = vsCoil.EvapCondPumpElecNomPower; BaseSizer::reportSizerOutput(state, "AS VS COOLING COIL", - varSpeedCoil.Name, + vsCoil.Name, "Design Size Evaporative Condenser Pump Rated Power Consumption [W]", EvapCondPumpElecNomPowerDes, "User-Specified Evaporative Condenser Pump Rated Power Consumption [W]", @@ -5537,9 +5393,9 @@ namespace VariableSpeedCoils { state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", - varSpeedCoil.CoolHeatType, + vsCoil.CoolHeatType, CurrentObjSubfix)); - ShowContinueError(state, format("Coil Name = {}", varSpeedCoil.Name)); + ShowContinueError(state, format("Coil Name = {}", vsCoil.Name)); ShowContinueError(state, format("User-Specified Evaporative Condenser Pump Rated Power Consumption of {:.2R} [W]", EvapCondPumpElecNomPowerUser)); @@ -5559,25 +5415,25 @@ namespace VariableSpeedCoils { // Resistive Defrost Heater Capacity = capacity at the first stage IsAutoSize = false; - if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { - if (varSpeedCoil.DefrostCapacity == DataSizing::AutoSize) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + if (vsCoil.DefrostCapacity == DataSizing::AutoSize) { IsAutoSize = true; } - if (varSpeedCoil.DefrostStrategy == Resistive) { - DefrostCapacityDes = varSpeedCoil.RatedCapHeat; + if (vsCoil.DefrostStrategy == Resistive) { + DefrostCapacityDes = vsCoil.RatedCapHeat; } else { DefrostCapacityDes = 0.0; } if (IsAutoSize) { - varSpeedCoil.DefrostCapacity = DefrostCapacityDes; + vsCoil.DefrostCapacity = DefrostCapacityDes; BaseSizer::reportSizerOutput( - state, "AS VS HEATING COIL", varSpeedCoil.Name, "Design Size Resistive Defrost Heater Capacity [W]", DefrostCapacityDes); + state, "AS VS HEATING COIL", vsCoil.Name, "Design Size Resistive Defrost Heater Capacity [W]", DefrostCapacityDes); } else { - if (varSpeedCoil.DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0 && !HardSizeNoDesRun) { - DefrostCapacityUser = varSpeedCoil.DefrostCapacity; + if (vsCoil.DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0 && !HardSizeNoDesRun) { + DefrostCapacityUser = vsCoil.DefrostCapacity; BaseSizer::reportSizerOutput(state, "AS VS HEATING COIL", - varSpeedCoil.Name, + vsCoil.Name, "Design Size Resistive Defrost Heater Capacity [W]", DefrostCapacityDes, "User-Specified Resistive Defrost Heater Capacity [W]", @@ -5586,9 +5442,9 @@ namespace VariableSpeedCoils { if ((std::abs(DefrostCapacityDes - DefrostCapacityUser) / DefrostCapacityUser) > state.dataSize->AutoVsHardSizingThreshold) { ShowMessage(state, format("SizeVarSpeedCoil: Potential issue with equipment sizing for {} {}", - varSpeedCoil.CoolHeatType, + vsCoil.CoolHeatType, CurrentObjSubfix)); - ShowContinueError(state, format("Coil Name = {}", varSpeedCoil.Name)); + ShowContinueError(state, format("Coil Name = {}", vsCoil.Name)); ShowContinueError(state, format("User-Specified Resistive Defrost Heater Capacity of {:.2R} [W]", DefrostCapacityUser)); ShowContinueError(state, format("differs from Design Size Resistive Defrost Heater Capacity of {:.2R} [W]", DefrostCapacityDes)); @@ -5603,13 +5459,13 @@ namespace VariableSpeedCoils { // test autosized sensible and total cooling capacity for total > sensible if (RatedCapCoolSensAutoSized && RatedCapCoolTotalAutoSized) { - if (varSpeedCoil.RatedCapCoolSens > varSpeedCoil.RatedCapCoolTotal) { + if (vsCoil.RatedCapCoolSens > vsCoil.RatedCapCoolTotal) { ShowWarningError(state, - format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", varSpeedCoil.CoolHeatType, varSpeedCoil.Name)); + format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", vsCoil.CoolHeatType, vsCoil.Name)); ShowContinueError(state, format("{}: Rated Sensible Cooling Capacity > Rated Total Cooling Capacity", RoutineName)); ShowContinueError(state, "Each of these capacity inputs have been autosized."); - ShowContinueError(state, format("Rated Sensible Cooling Capacity = {:.2T} W", varSpeedCoil.RatedCapCoolSens)); - ShowContinueError(state, format("Rated Total Cooling Capacity = {:.2T} W", varSpeedCoil.RatedCapCoolTotal)); + ShowContinueError(state, format("Rated Sensible Cooling Capacity = {:.2T} W", vsCoil.RatedCapCoolSens)); + ShowContinueError(state, format("Rated Total Cooling Capacity = {:.2T} W", vsCoil.RatedCapCoolTotal)); ShowContinueError(state, "See eio file for further details."); ShowContinueError(state, "Check Total and Sensible Cooling Capacity Coefficients to ensure they are accurate."); ShowContinueError(state, "Check Zone and System Sizing objects to verify sizing inputs."); @@ -5628,13 +5484,13 @@ namespace VariableSpeedCoils { ShowContinueError(state, "... to ensure they meet the expected manufacturers performance specifications."); } } else if (RatedCapCoolTotalAutoSized) { - if (varSpeedCoil.RatedCapCoolSens > varSpeedCoil.RatedCapCoolTotal) { + if (vsCoil.RatedCapCoolSens > vsCoil.RatedCapCoolTotal) { ShowWarningError(state, - format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", varSpeedCoil.CoolHeatType, varSpeedCoil.Name)); + format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", vsCoil.CoolHeatType, vsCoil.Name)); ShowContinueError(state, format("{}: Rated Sensible Cooling Capacity > Rated Total Cooling Capacity", RoutineName)); ShowContinueError(state, "Only the rated total capacity input is autosized, consider autosizing both inputs."); - ShowContinueError(state, format("Rated Sensible Cooling Capacity = {:.2T} W", varSpeedCoil.RatedCapCoolSens)); - ShowContinueError(state, format("Rated Total Cooling Capacity = {:.2T} W", varSpeedCoil.RatedCapCoolTotal)); + ShowContinueError(state, format("Rated Sensible Cooling Capacity = {:.2T} W", vsCoil.RatedCapCoolSens)); + ShowContinueError(state, format("Rated Total Cooling Capacity = {:.2T} W", vsCoil.RatedCapCoolTotal)); ShowContinueError(state, "See eio file for further details."); ShowContinueError(state, "Check Total and Sensible Cooling Capacity Coefficients to ensure they are accurate."); ShowContinueError(state, "Check Zone and System Sizing objects to verify sizing inputs."); @@ -5652,10 +5508,10 @@ namespace VariableSpeedCoils { Array1D CondenserType; StandardRatings::HPdefrostControl DefrostControl; - switch (varSpeedCoil.VSCoilType) { - case HVAC::Coil_CoolingAirToAirVariableSpeed: - CondenserType.push_back(varSpeedCoil.CondenserType); - switch (varSpeedCoil.DefrostControl) // defrost control; 1=timed, 2=on-demand + switch (vsCoil.coilType) { + case HVAC::CoilType::CoolingAirToAirVariableSpeed: + CondenserType.push_back(vsCoil.CondenserType); + switch (vsCoil.DefrostControl) // defrost control; 1=timed, 2=on-demand { case 2: DefrostControl = StandardRatings::HPdefrostControl::OnDemand; @@ -5665,31 +5521,31 @@ namespace VariableSpeedCoils { DefrostControl = StandardRatings::HPdefrostControl::Timed; break; } - if (varSpeedCoil.RatedCapCoolTotal > 0.0) { + if (vsCoil.RatedCapCoolTotal > 0.0) { StandardRatings::CalcDXCoilStandardRating(state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.VSCoilType, - varSpeedCoil.NumOfSpeeds, - varSpeedCoil.MSRatedTotCap, - varSpeedCoil.MSRatedCOP, - varSpeedCoil.MSCCapAirFFlow, - varSpeedCoil.MSCCapFTemp, - varSpeedCoil.MSEIRAirFFlow, - varSpeedCoil.MSEIRFTemp, - varSpeedCoil.PLFFPLR, - varSpeedCoil.MSRatedAirVolFlowRate, - varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2017, - varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2023, + vsCoil.Name, + vsCoil.VarSpeedCoilType, + vsCoil.coilType, + vsCoil.NumOfSpeeds, + vsCoil.MSRatedTotCap, + vsCoil.MSRatedCOP, + vsCoil.MSCCapAirFFlow, + vsCoil.MSCCapFTemp, + vsCoil.MSEIRAirFFlow, + vsCoil.MSEIRFTemp, + vsCoil.PLFFPLR, + vsCoil.MSRatedAirVolFlowRate, + vsCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2017, + vsCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2023, CondenserType, - 0, // varSpeedCoil.RegionNum, // ?? - varSpeedCoil.MinOATCompressor, - varSpeedCoil.OATempCompressorOn, - false, // varSpeedCoil.OATempCompressorOnOffBlank, // ?? + 0, // vsCoil.RegionNum, // ?? + vsCoil.MinOATCompressor, + vsCoil.OATempCompressorOn, + false, // vsCoil.OATempCompressorOnOffBlank, // ?? DefrostControl, ObjexxFCL::Optional_bool_const(), - varSpeedCoil.RatedCapCoolTotal, - varSpeedCoil.RatedAirVolFlowRate); + vsCoil.RatedCapCoolTotal, + vsCoil.RatedAirVolFlowRate); } break; default: @@ -5801,7 +5657,7 @@ namespace VariableSpeedCoils { state.dataEnvrn->OutBaroPress, RoutineName); - MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + MaxSpeed = vsCoil.NumOfSpeeds; // must be placed inside the loop, otherwise cause bug in release mode, need to be present at two places if (SpeedNum > MaxSpeed) { @@ -5812,26 +5668,26 @@ namespace VariableSpeedCoils { // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) if (!(fanOp == HVAC::FanOp::Continuous) && PartLoadRatio > 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum).MassFlowRate / PartLoadRatio; + vsCoil.AirMassFlowRate = + state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).MassFlowRate / PartLoadRatio; } - Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; - Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; + Twet_Rated = vsCoil.Twet_Rated; + Gamma_Rated = vsCoil.Gamma_Rated; - state.dataVariableSpeedCoils->LoadSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate = vsCoil.AirMassFlowRate; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // Get condenser outdoor node info from DX COOLING Coil - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { + if (vsCoil.CondenserInletNodeNum != 0) { state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Temp; state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).HumRat; state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Press; state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).OutAirWetBulb; } else { state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling = state.dataEnvrn->OutDryBulbTemp; state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling = state.dataEnvrn->OutHumRat; @@ -5845,20 +5701,20 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling); if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { - CondAirMassFlow = RhoSourceAir * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal); + CondAirMassFlow = RhoSourceAir * vsCoil.EvapCondAirFlow(SpeedCal); } else { CondAirMassFlow = - RhoSourceAir * (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal - 1)); + RhoSourceAir * (vsCoil.EvapCondAirFlow(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.EvapCondAirFlow(SpeedCal - 1)); } // AIR COOL OR EVAP COOLED CONDENSER - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) { + if (vsCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) { if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { - EvapCondEffectSped = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal); + EvapCondEffectSped = vsCoil.EvapCondEffect(SpeedCal); } else { - EvapCondEffectSped = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal - 1); + EvapCondEffectSped = vsCoil.EvapCondEffect(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.EvapCondEffect(SpeedCal - 1); } // (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) CondInletTemp = state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling + @@ -5881,55 +5737,55 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideInletTemp = CondInletTemp; state.dataVariableSpeedCoils->SourceSideInletEnth = Psychrometrics::PsyHFnTdbW(CondInletTemp, CondInletHumRat); CpSource = Psychrometrics::PsyCpAirFnW(CondInletHumRat); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondInletTemp = CondInletTemp; + vsCoil.CondInletTemp = CondInletTemp; // If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput) // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil if (state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling < - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { + vsCoil.MaxOATCrankcaseHeater) { state.dataVariableSpeedCoils->CrankcaseHeatingPower_CalcVarSpeedCoilCooling = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex > 0) { + vsCoil.CrankcaseHeaterCapacity; + if (vsCoil.CrankcaseHeaterCapacityCurveIndex > 0) { state.dataVariableSpeedCoils->CrankcaseHeatingPower_CalcVarSpeedCoilCooling *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, + vsCoil.CrankcaseHeaterCapacityCurveIndex, state.dataEnvrn->OutDryBulbTemp); } } else { state.dataVariableSpeedCoils->CrankcaseHeatingPower_CalcVarSpeedCoilCooling = 0.0; } } else { - state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; - state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; - state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; - CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + state.dataVariableSpeedCoils->SourceSideMassFlowRate = vsCoil.WaterMassFlowRate; + state.dataVariableSpeedCoils->SourceSideInletTemp = vsCoil.InletWaterTemp; + state.dataVariableSpeedCoils->SourceSideInletEnth = vsCoil.InletWaterEnthalpy; + CpSource = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. if (state.dataVariableSpeedCoils->SourceSideMassFlowRate <= 0.0 || state.dataVariableSpeedCoils->LoadSideMassFlowRate <= 0.0) { - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) && - (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType == DataHeatBalance::RefrigCondenserType::Air) && + if ((vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) && + (vsCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Air) && (state.dataVariableSpeedCoils->LoadSideMassFlowRate > 0.0)) { // ALLOW SIMULATION IF AIR-COOLED CONDENSER COIL - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; + vsCoil.SimFlag = true; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; + vsCoil.SimFlag = false; return; } } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; + vsCoil.SimFlag = true; } - if (compressorOp == HVAC::CompressorOp::Off || state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal <= 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; + if (compressorOp == HVAC::CompressorOp::Off || vsCoil.RatedCapCoolTotal <= 0.0) { + vsCoil.SimFlag = false; return; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) && - (CondInletTemp < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; + if ((vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) && + (CondInletTemp < vsCoil.MinOATCompressor)) { + vsCoil.SimFlag = false; return; } @@ -5947,17 +5803,17 @@ namespace VariableSpeedCoils { } // Set indoor air conditions to the actual condition - LoadSideInletDBTemp_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; - LoadSideInletHumRat_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; + LoadSideInletDBTemp_Unit = vsCoil.InletAirDBTemp; + LoadSideInletHumRat_Unit = vsCoil.InletAirHumRat; LoadSideInletWBTemp_Unit = Psychrometrics::PsyTwbFnTdbWPb(state, LoadSideInletDBTemp_Unit, LoadSideInletHumRat_Unit, state.dataEnvrn->OutBaroPress, RoutineName); - LoadSideInletEnth_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; + LoadSideInletEnth_Unit = vsCoil.InletAirEnthalpy; CpAir_Unit = Psychrometrics::PsyCpAirFnW(LoadSideInletHumRat_Unit); state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; + vsCoil.RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, vsCoil.PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -5965,13 +5821,13 @@ namespace VariableSpeedCoils { state.dataHVACGlobal->OnOffFanPartLoadFraction = PLF; // save PLF for fan model, don't change fan power for constant fan mode if coil is off // calculate the run time fraction - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + vsCoil.RunFrac = PartLoadRatio / PLF; + vsCoil.PartLoadRatio = PartLoadRatio; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 - } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + if (vsCoil.RunFrac > 1.0) { + vsCoil.RunFrac = 1.0; // Reset coil runtime fraction to 1.0 + } else if (vsCoil.RunFrac < 0.0) { + vsCoil.RunFrac = 0.0; } } @@ -6002,17 +5858,17 @@ namespace VariableSpeedCoils { if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { AirMassFlowRatio = - state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate / vsCoil.DesignAirMassFlowRate; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + vsCoil.DesignWaterMassFlowRate; } - CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + CBFSpeed = DXCoils::AdjustCBF(vsCoil.MSRatedCBF(SpeedCal), + vsCoil.MSRatedAirMassFlowRate(SpeedCal), state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; @@ -6026,10 +5882,10 @@ namespace VariableSpeedCoils { WaterMassFlowRatio, state.dataVariableSpeedCoils->LoadSideMassFlowRate, CBFSpeed, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), + vsCoil.MSRatedTotCap(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), + vsCoil.MSCCapAirFFlow(SpeedCal), + vsCoil.MSCCapWaterFFlow(SpeedCal), 0.0, 0, 0, @@ -6039,30 +5895,30 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->QLoadTotal, SHR, state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + vsCoil.InletAirPressure, 0.0, 1, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); + vsCoil.capModFacTotal); EIRTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); EIRAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * + EIR = (1.0 / vsCoil.MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; - CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + CBFSpeed = DXCoils::AdjustCBF(vsCoil.MSRatedCBF(SpeedCal), + vsCoil.MSRatedAirMassFlowRate(SpeedCal), state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; @@ -6076,10 +5932,10 @@ namespace VariableSpeedCoils { WaterMassFlowRatio, state.dataVariableSpeedCoils->LoadSideMassFlowRate, CBFSpeed, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), + vsCoil.MSRatedTotCap(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), + vsCoil.MSCCapAirFFlow(SpeedCal), + vsCoil.MSCCapWaterFFlow(SpeedCal), 0.0, 0, 0, @@ -6089,36 +5945,36 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->QLoadTotal, SHR, state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + vsCoil.InletAirPressure, 0.0, 1, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); + vsCoil.capModFacTotal); state.dataVariableSpeedCoils->Winput = state.dataVariableSpeedCoils->QLoadTotal * EIR; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { QWasteHeat = 0.0; } else { QWasteHeat = - state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + state.dataVariableSpeedCoils->Winput * vsCoil.MSWasteHeatFrac(SpeedCal); QWasteHeat *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + vsCoil.MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { AirMassFlowRatio = - state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate / vsCoil.DesignAirMassFlowRate; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + vsCoil.DesignWaterMassFlowRate; } - AoEff = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal - 1); + AoEff = vsCoil.MSEffectiveAo(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSEffectiveAo(SpeedCal - 1); CBFSpeed = std::exp(-AoEff / state.dataVariableSpeedCoils->LoadSideMassFlowRate); @@ -6133,78 +5989,78 @@ namespace VariableSpeedCoils { WaterMassFlowRatio, state.dataVariableSpeedCoils->LoadSideMassFlowRate, CBFSpeed, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal - 1), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal - 1), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal - 1), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal - 1), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), + vsCoil.MSRatedTotCap(SpeedCal - 1), + vsCoil.MSCCapFTemp(SpeedCal - 1), + vsCoil.MSCCapAirFFlow(SpeedCal - 1), + vsCoil.MSCCapWaterFFlow(SpeedCal - 1), + vsCoil.MSRatedTotCap(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), + vsCoil.MSCCapAirFFlow(SpeedCal), + vsCoil.MSCCapWaterFFlow(SpeedCal), QLoadTotal1, QLoadTotal2, state.dataVariableSpeedCoils->QLoadTotal, SHR, state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + vsCoil.InletAirPressure, SpeedRatio, 2, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); + vsCoil.capModFacTotal); SpeedCal = SpeedNum - 1; EIRTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); EIRAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * + EIR = (1.0 / vsCoil.MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput1 = QLoadTotal1 * EIR; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { QWasteHeat1 = 0.0; } else { - QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat1 = Winput1 * vsCoil.MSWasteHeatFrac(SpeedCal); QWasteHeat1 *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + vsCoil.MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; EIRTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); EIRAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * + EIR = (1.0 / vsCoil.MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput2 = QLoadTotal2 * EIR; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { QWasteHeat2 = 0.0; } else { - QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat2 = Winput2 * vsCoil.MSWasteHeatFrac(SpeedCal); QWasteHeat2 *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + vsCoil.MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } @@ -6238,7 +6094,7 @@ namespace VariableSpeedCoils { DXCoilNum, SHRss, fanOp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, + vsCoil.RunFrac, state.dataVariableSpeedCoils->QLatRated, state.dataVariableSpeedCoils->QLatActual, state.dataVariableSpeedCoils->LoadSideInletDBTemp, @@ -6256,48 +6112,48 @@ namespace VariableSpeedCoils { LOOP_exit:; // considering hot gas reheat here - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HOTGASREHEATFLG > 0) { + if (vsCoil.HOTGASREHEATFLG > 0) { state.dataVariableSpeedCoils->QLoadTotal -= QWasteHeat; state.dataVariableSpeedCoils->QSensible -= QWasteHeat; SHReff = state.dataVariableSpeedCoils->QSensible / state.dataVariableSpeedCoils->QLoadTotal; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; + vsCoil.BasinHeaterPower = 0.0; + vsCoil.CrankcaseHeaterPower = 0.0; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType == DataHeatBalance::RefrigCondenserType::Evap) { + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + if (vsCoil.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) { //****************** // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** RhoEvapCondWater = Psychrometrics::RhoH2O(state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate = + vsCoil.EvapWaterConsumpRate = (CondInletHumRat - state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling) * CondAirMassFlow / RhoEvapCondWater * - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower * - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; + vsCoil.RunFrac; + vsCoil.EvapCondPumpElecPower = + vsCoil.EvapCondPumpElecNomPower * + vsCoil.RunFrac; // Calculate basin heater power CalcBasinHeaterPower(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower *= - (1.0 - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac); + vsCoil.BasinHeaterPowerFTempDiff, + vsCoil.BasinHeaterSchedulePtr, + vsCoil.BasinHeaterSetPointTemp, + vsCoil.BasinHeaterPower); + vsCoil.BasinHeaterPower *= + (1.0 - vsCoil.RunFrac); } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = + vsCoil.CrankcaseHeaterPower = state.dataVariableSpeedCoils->CrankcaseHeatingPower_CalcVarSpeedCoilCooling * - (1.0 - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac); + (1.0 - vsCoil.RunFrac); // set water system demand request (if needed) - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - state.dataWaterData->WaterStorage(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID) - .VdotRequestDemand(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID) = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate; + if (vsCoil.EvapWaterSupplyMode == WaterSupplyFromTank) { + state.dataWaterData->WaterStorage(vsCoil.EvapWaterSupTankID) + .VdotRequestDemand(vsCoil.EvapWaterTankDemandARRID) = + vsCoil.EvapWaterConsumpRate; } } @@ -6313,7 +6169,7 @@ namespace VariableSpeedCoils { MaxHumRat = Psychrometrics::PsyWFnTdbRhPb(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, 0.9999, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + vsCoil.InletAirPressure, RoutineName); MaxOutletEnth = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); if (state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { @@ -6330,21 +6186,21 @@ namespace VariableSpeedCoils { // Actual outlet conditions are "average" for time step if (fanOp == HVAC::FanOp::Continuous) { // continuous fan, cycling compressor - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = + vsCoil.OutletAirEnthalpy = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletEnth + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletEnth; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = + vsCoil.OutletAirHumRat = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + vsCoil.OutletAirDBTemp = + Psychrometrics::PsyTdbFnHW(vsCoil.OutletAirEnthalpy, + vsCoil.OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; + vsCoil.OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; + vsCoil.OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; + vsCoil.OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate * PartLoadRatio; } @@ -6352,39 +6208,39 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->QLoadTotal *= PartLoadRatio; state.dataVariableSpeedCoils->QSensible *= PartLoadRatio; // count the powr separately - state.dataVariableSpeedCoils->Winput *= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; + state.dataVariableSpeedCoils->Winput *= vsCoil.RunFrac; state.dataVariableSpeedCoils->QSource *= PartLoadRatio; QWasteHeat *= PartLoadRatio; // Update heat pump data structure - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = state.dataVariableSpeedCoils->Winput; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = state.dataVariableSpeedCoils->QSensible; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = + vsCoil.Power = state.dataVariableSpeedCoils->Winput; + vsCoil.QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; + vsCoil.QSensible = state.dataVariableSpeedCoils->QSensible; + vsCoil.QLatent = state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = state.dataVariableSpeedCoils->QSource; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = state.dataVariableSpeedCoils->Winput * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = state.dataVariableSpeedCoils->QSensible * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = + vsCoil.QSource = state.dataVariableSpeedCoils->QSource; + vsCoil.Energy = state.dataVariableSpeedCoils->Winput * TimeStepSysSec; + vsCoil.EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * TimeStepSysSec; + vsCoil.EnergySensible = state.dataVariableSpeedCoils->QSensible * TimeStepSysSec; + vsCoil.EnergyLatent = (state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible) * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = state.dataVariableSpeedCoils->QSource * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower * TimeStepSysSec; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac == 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; + vsCoil.EnergySource = state.dataVariableSpeedCoils->QSource * TimeStepSysSec; + vsCoil.CrankcaseHeaterConsumption = + vsCoil.CrankcaseHeaterPower * TimeStepSysSec; + vsCoil.EvapWaterConsump = + vsCoil.EvapWaterConsumpRate * TimeStepSysSec; + vsCoil.BasinHeaterConsumption = + vsCoil.BasinHeaterPower * TimeStepSysSec; + vsCoil.EvapCondPumpElecConsumption = + vsCoil.EvapCondPumpElecPower * TimeStepSysSec; + if (vsCoil.RunFrac == 0.0) { + vsCoil.COP = 0.0; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = + vsCoil.COP = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->Winput; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; + vsCoil.PartLoadRatio = PartLoadRatio; + vsCoil.AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataVariableSpeedCoils->LoadSideInletDBTemp, @@ -6393,40 +6249,40 @@ namespace VariableSpeedCoils { // This seems wrong, initializing mass flow rate to StdRhoAir or actual air density, // then using that mass flow rate, then back calculating volume using inlet conditions. // Volume should be constant through a fan and air mass flow rate should vary based on inlet conditions. - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; + vsCoil.AirVolFlowRate = + vsCoil.AirMassFlowRate / rhoair; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; + if (vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { + vsCoil.WaterMassFlowRate = 0.0; + vsCoil.OutletWaterTemp = 0.0; + vsCoil.OutletWaterEnthalpy = 0.0; state.dataHeatBal->HeatReclaimVS_DXCoil(DXCoilNum).AvailCapacity = state.dataVariableSpeedCoils->QSource; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = + vsCoil.WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; + vsCoil.OutletWaterTemp = state.dataVariableSpeedCoils->SourceSideInletTemp + state.dataVariableSpeedCoils->QSource / (state.dataVariableSpeedCoils->SourceSideMassFlowRate * CpSource); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = + vsCoil.OutletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth + state.dataVariableSpeedCoils->QSource / state.dataVariableSpeedCoils->SourceSideMassFlowRate; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = QWasteHeat; + vsCoil.QWasteHeat = QWasteHeat; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode == CondensateToTank) { + if (vsCoil.CondensateCollectMode == CondensateToTank) { // calculate and report condensation rates (how much water extracted from the air stream) // water flow of water in m3/s for water system interactions - RhoWater = Psychrometrics::RhoH2O((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp + - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp) / + RhoWater = Psychrometrics::RhoH2O((vsCoil.InletAirDBTemp + + vsCoil.OutletAirDBTemp) / 2.0); // CR9155 Remove specific humidity calculations SpecHumIn = state.dataVariableSpeedCoils->LoadSideInletHumRat; SpecHumOut = state.dataVariableSpeedCoils->LoadSideOutletHumRat; // mdot * del HumRat / rho water - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot = + vsCoil.CondensateVdot = max(0.0, (state.dataVariableSpeedCoils->LoadSideMassFlowRate * (SpecHumIn - SpecHumOut) / RhoWater)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVol = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot * TimeStepSysSec; + vsCoil.CondensateVol = + vsCoil.CondensateVdot * TimeStepSysSec; } } @@ -6509,14 +6365,14 @@ namespace VariableSpeedCoils { // note: load side is the evaporator side, and source side is the condenser side - int CondInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - int CondOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; + int CondInletNode = vsCoil.WaterInletNodeNum; + int CondOutletNode = vsCoil.WaterOutletNodeNum; // If heat pump water heater is OFF, set outlet to inlet and RETURN if (PartLoadRatio == 0.0) { state.dataLoopNodes->Node(CondOutletNode) = state.dataLoopNodes->Node(CondInletNode); return; } else { - EvapInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; + EvapInletNode = vsCoil.AirInletNodeNum; InletWaterTemp = state.dataLoopNodes->Node(CondInletNode).Temp; CondInletMassFlowRate = state.dataLoopNodes->Node(CondInletNode).MassFlowRate; EvapInletMassFlowRate = state.dataLoopNodes->Node(EvapInletNode).MassFlowRate; @@ -6532,11 +6388,11 @@ namespace VariableSpeedCoils { EvapInletMassFlowRate = EvapInletMassFlowRate / PartLoadRatio; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = EvapInletMassFlowRate; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = CondInletMassFlowRate; + vsCoil.AirMassFlowRate = EvapInletMassFlowRate; + vsCoil.WaterMassFlowRate = CondInletMassFlowRate; // determine inlet air temperature type for curve objects - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType == HVAC::OATType::WetBulb) { + if (vsCoil.InletAirTemperatureType == HVAC::OATType::WetBulb) { InletAirTemp = state.dataHVACGlobal->HPWHInletWBTemp; } else { InletAirTemp = state.dataHVACGlobal->HPWHInletDBTemp; @@ -6561,12 +6417,12 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideInletEnth = state.dataEnvrn->OutEnthalpy; // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (state.dataEnvrn->OutDryBulbTemp < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex > 0) { + if (state.dataEnvrn->OutDryBulbTemp < vsCoil.MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = vsCoil.CrankcaseHeaterCapacity; + if (vsCoil.CrankcaseHeaterCapacityCurveIndex > 0) { CrankcaseHeatingPower *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, + vsCoil.CrankcaseHeaterCapacityCurveIndex, state.dataEnvrn->OutDryBulbTemp); } }; @@ -6576,21 +6432,21 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = CondInletMassFlowRate; state.dataVariableSpeedCoils->SourceSideInletTemp = InletWaterTemp; state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataLoopNodes->Node(CondInletNode).Enthalpy; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth; + vsCoil.InletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth; // Check for flows, do not perform simulation if no flow in load side or source side. if ((state.dataVariableSpeedCoils->SourceSideMassFlowRate <= 0.0) || (state.dataVariableSpeedCoils->LoadSideMassFlowRate <= 0.0)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; + vsCoil.SimFlag = false; return; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; + vsCoil.SimFlag = true; } // part-load calculation state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; + vsCoil.RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, vsCoil.PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -6598,17 +6454,17 @@ namespace VariableSpeedCoils { state.dataHVACGlobal->OnOffFanPartLoadFraction = PLF; // save PLF for fan model, don't change fan power for constant fan mode if coil is off // calculate the run time fraction - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + vsCoil.RunFrac = PartLoadRatio / PLF; + vsCoil.PartLoadRatio = PartLoadRatio; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 - } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + if (vsCoil.RunFrac > 1.0) { + vsCoil.RunFrac = 1.0; // Reset coil runtime fraction to 1.0 + } else if (vsCoil.RunFrac < 0.0) { + vsCoil.RunFrac = 0.0; } } - int MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + int MaxSpeed = vsCoil.NumOfSpeeds; // interpolate between speeds // must be placed inside the loop, otherwise cause bug in release mode @@ -6619,134 +6475,134 @@ namespace VariableSpeedCoils { } Real64 locFanElecPower = 0.0; // local for fan electric power - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex > 0) { - locFanElecPower = state.dataFans->fans(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex)->totalPower; + if (vsCoil.SupplyFanIndex > 0) { + locFanElecPower = state.dataFans->fans(vsCoil.SupplyFanIndex)->totalPower; } if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { AirMassFlowRatio = - state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate / vsCoil.DesignAirMassFlowRate; WaterMassFlowRatio = - state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); + state.dataVariableSpeedCoils->SourceSideMassFlowRate / vsCoil.DesignWaterMassFlowRate; + vsCoil.HPWHCondPumpElecNomPower = + vsCoil.MSWHPumpPower(SpeedCal); COPTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); COPAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); COPWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); - COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; + COP = vsCoil.MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; TOTCAPTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); - OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * + OperatingHeatingCapacity = vsCoil.MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; OperatingHeatingCOP = COP; - PumpHeatToWater = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + PumpHeatToWater = vsCoil.HPWHCondPumpElecNomPower * + vsCoil.HPWHCondPumpFracToWater; TankHeatingCOP = OperatingHeatingCOP; // account for pump heat if not included in total water heating capacity - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (vsCoil.CondPumpHeatInCapacity) { TotalTankHeatingCapacity = OperatingHeatingCapacity; } else { TotalTankHeatingCapacity = OperatingHeatingCapacity + PumpHeatToWater; } // calculate evaporator total cooling capacity - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (vsCoil.FanPowerIncludedInCOP) { + if (vsCoil.CondPumpPowerInCOP) { // make sure fan power is full load fan power, it isn't though, - CompressorPower = OperatingHeatingPower - locFanElecPower / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac - - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; + CompressorPower = OperatingHeatingPower - locFanElecPower / vsCoil.RunFrac - + vsCoil.HPWHCondPumpElecNomPower; if (OperatingHeatingPower > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / OperatingHeatingPower; } else { - CompressorPower = OperatingHeatingPower - locFanElecPower / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; - if ((OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + CompressorPower = OperatingHeatingPower - locFanElecPower / vsCoil.RunFrac; + if ((OperatingHeatingPower + vsCoil.HPWHCondPumpElecNomPower) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / - (OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + (OperatingHeatingPower + vsCoil.HPWHCondPumpElecNomPower); } } else { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (vsCoil.CondPumpPowerInCOP) { // make sure fan power is full load fan power - CompressorPower = OperatingHeatingPower - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; - if ((OperatingHeatingPower + locFanElecPower / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac) > 0.0) + CompressorPower = OperatingHeatingPower - vsCoil.HPWHCondPumpElecNomPower; + if ((OperatingHeatingPower + locFanElecPower / vsCoil.RunFrac) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / - (OperatingHeatingPower + locFanElecPower / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac); + (OperatingHeatingPower + locFanElecPower / vsCoil.RunFrac); } else { CompressorPower = OperatingHeatingPower; - if ((OperatingHeatingPower + locFanElecPower / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac + - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + if ((OperatingHeatingPower + locFanElecPower / vsCoil.RunFrac + + vsCoil.HPWHCondPumpElecNomPower) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / - (OperatingHeatingPower + locFanElecPower / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac + - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + (OperatingHeatingPower + locFanElecPower / vsCoil.RunFrac + + vsCoil.HPWHCondPumpElecNomPower); } } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (vsCoil.CondPumpHeatInCapacity) { EvapCoolingCapacity = TotalTankHeatingCapacity - PumpHeatToWater - CompressorPower; } else { EvapCoolingCapacity = TotalTankHeatingCapacity - CompressorPower; } - CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + CBFSpeed = DXCoils::AdjustCBF(vsCoil.MSRatedCBF(SpeedCal), + vsCoil.MSRatedAirMassFlowRate(SpeedCal), state.dataVariableSpeedCoils->LoadSideMassFlowRate); } else { AirMassFlowRatio = - state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate / vsCoil.DesignAirMassFlowRate; WaterMassFlowRatio = - state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; - AoEff = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal - 1); + state.dataVariableSpeedCoils->SourceSideMassFlowRate / vsCoil.DesignWaterMassFlowRate; + AoEff = vsCoil.MSEffectiveAo(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSEffectiveAo(SpeedCal - 1); CBFSpeed = std::exp(-AoEff / state.dataVariableSpeedCoils->LoadSideMassFlowRate); // calculate low speed SpeedCal = SpeedNum - 1; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); + vsCoil.HPWHCondPumpElecNomPower = + vsCoil.MSWHPumpPower(SpeedCal); COPTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); COPAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); COPWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); - COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; + COP = vsCoil.MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; TOTCAPTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); - OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * + OperatingHeatingCapacity = vsCoil.MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; @@ -6756,31 +6612,31 @@ namespace VariableSpeedCoils { // calculate upper speed SpeedCal = SpeedNum; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); + vsCoil.HPWHCondPumpElecNomPower = + vsCoil.MSWHPumpPower(SpeedCal); COPTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); COPAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); COPWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); - COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; + COP = vsCoil.MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; TOTCAPTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); - OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * + OperatingHeatingCapacity = vsCoil.MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; Winput2 = OperatingHeatingCapacity / COP; @@ -6790,53 +6646,53 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; OperatingHeatingCapacity = WHCAP2 * SpeedRatio + (1.0 - SpeedRatio) * WHCAP1; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedNum) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedNum - 1); + vsCoil.HPWHCondPumpElecNomPower = + vsCoil.MSWHPumpPower(SpeedNum) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSWHPumpPower(SpeedNum - 1); OperatingHeatingCOP = OperatingHeatingCapacity / OperatingHeatingPower; TankHeatingCOP = OperatingHeatingCOP; - PumpHeatToWater = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + PumpHeatToWater = vsCoil.HPWHCondPumpElecNomPower * + vsCoil.HPWHCondPumpFracToWater; // account for pump heat if not included in total water heating capacity - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (vsCoil.CondPumpHeatInCapacity) { TotalTankHeatingCapacity = OperatingHeatingCapacity; } else { TotalTankHeatingCapacity = OperatingHeatingCapacity + PumpHeatToWater; } - Real64 HPRTF = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; + Real64 HPRTF = vsCoil.RunFrac; // calculate evaporator total cooling capacity - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP) { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (vsCoil.FanPowerIncludedInCOP) { + if (vsCoil.CondPumpPowerInCOP) { // make sure fan power is full load fan power CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF - - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; + vsCoil.HPWHCondPumpElecNomPower; if (OperatingHeatingPower > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / OperatingHeatingPower; } else { CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF; - if ((OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + if ((OperatingHeatingPower + vsCoil.HPWHCondPumpElecNomPower) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / - (OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + (OperatingHeatingPower + vsCoil.HPWHCondPumpElecNomPower); } } else { - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (vsCoil.CondPumpPowerInCOP) { // make sure fan power is full load fan power - CompressorPower = OperatingHeatingPower - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; + CompressorPower = OperatingHeatingPower - vsCoil.HPWHCondPumpElecNomPower; if ((OperatingHeatingPower + locFanElecPower / HPRTF) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + locFanElecPower / HPRTF); } else { CompressorPower = OperatingHeatingPower; if ((OperatingHeatingPower + locFanElecPower / HPRTF + - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + vsCoil.HPWHCondPumpElecNomPower) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + locFanElecPower / HPRTF + - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + vsCoil.HPWHCondPumpElecNomPower); } } - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (vsCoil.CondPumpHeatInCapacity) { EvapCoolingCapacity = TotalTankHeatingCapacity - PumpHeatToWater - CompressorPower; } else { EvapCoolingCapacity = TotalTankHeatingCapacity - CompressorPower; @@ -6886,16 +6742,16 @@ namespace VariableSpeedCoils { // total heating COP including compressor, fan, and condenser pump state.dataVariableSpeedCoils->VSHPWHHeatingCOP = TankHeatingCOP; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate = TotalTankHeatingCapacity * PartLoadRatio; + vsCoil.TotalHeatingEnergyRate = TotalTankHeatingCapacity * PartLoadRatio; // calculate total compressor plus condenser pump power, fan power reported in fan module - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ElecWaterHeatingPower = - (CompressorPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) * - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; + vsCoil.ElecWaterHeatingPower = + (CompressorPower + vsCoil.HPWHCondPumpElecNomPower) * + vsCoil.RunFrac; // pass the outputs for the cooling coil section - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac); + vsCoil.BasinHeaterPower = 0.0; + vsCoil.CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - vsCoil.RunFrac); // calculate coil outlet state variables state.dataVariableSpeedCoils->LoadSideOutletEnth = @@ -6909,7 +6765,7 @@ namespace VariableSpeedCoils { MaxHumRat = Psychrometrics::PsyWFnTdbRhPb(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, 0.9999, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + vsCoil.InletAirPressure, RoutineName); MaxOutletEnth = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); if (state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { @@ -6924,20 +6780,20 @@ namespace VariableSpeedCoils { // Actual outlet conditions are "average" for time step if (fanOp == HVAC::FanOp::Continuous) { // continuous fan, cycling compressor - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = + vsCoil.OutletAirEnthalpy = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletEnth + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletEnth; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = + vsCoil.OutletAirHumRat = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + vsCoil.OutletAirDBTemp = + Psychrometrics::PsyTdbFnHW(vsCoil.OutletAirEnthalpy, + vsCoil.OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; + vsCoil.OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; + vsCoil.OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; + vsCoil.OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate * PartLoadRatio; } @@ -6946,73 +6802,73 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->QSensible *= PartLoadRatio; // count the powr separately state.dataVariableSpeedCoils->Winput *= - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; //+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower & + vsCoil.RunFrac; //+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower & //+ VarSpeedCoil(DXCoilNum)%BasinHeaterPower + VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower state.dataVariableSpeedCoils->QSource *= PartLoadRatio; // Update heat pump data structure - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; // water heating pump power - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = state.dataVariableSpeedCoils->Winput; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = state.dataVariableSpeedCoils->QSensible; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = + vsCoil.HPWHCondPumpElecNomPower = + vsCoil.HPWHCondPumpElecNomPower * + vsCoil.RunFrac; // water heating pump power + vsCoil.Power = state.dataVariableSpeedCoils->Winput; + vsCoil.QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; + vsCoil.QSensible = state.dataVariableSpeedCoils->QSensible; + vsCoil.QLatent = state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = state.dataVariableSpeedCoils->QSource; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = state.dataVariableSpeedCoils->Winput * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = state.dataVariableSpeedCoils->QSensible * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = + vsCoil.QSource = state.dataVariableSpeedCoils->QSource; + vsCoil.Energy = state.dataVariableSpeedCoils->Winput * TimeStepSysSec; + vsCoil.EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * TimeStepSysSec; + vsCoil.EnergySensible = state.dataVariableSpeedCoils->QSensible * TimeStepSysSec; + vsCoil.EnergyLatent = (state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible) * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = state.dataVariableSpeedCoils->QSource * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = 0.0; + vsCoil.EnergySource = state.dataVariableSpeedCoils->QSource * TimeStepSysSec; + vsCoil.CrankcaseHeaterConsumption = + vsCoil.CrankcaseHeaterPower * TimeStepSysSec; + vsCoil.EvapWaterConsump = 0.0; + vsCoil.BasinHeaterConsumption = 0.0; // re-use EvapCondPumpElecConsumption to store WH pump energy consumption - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * TimeStepSysSec; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac == 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; + vsCoil.EvapCondPumpElecConsumption = + vsCoil.HPWHCondPumpElecNomPower * TimeStepSysSec; + if (vsCoil.RunFrac == 0.0) { + vsCoil.COP = 0.0; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = + vsCoil.COP = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->Winput; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; + vsCoil.PartLoadRatio = PartLoadRatio; + vsCoil.AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletHumRat, RoutineName); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; + vsCoil.AirVolFlowRate = + vsCoil.AirMassFlowRate / rhoair; + vsCoil.WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; RhoWater = Psychrometrics::RhoH2O(InletWaterTemp); // initialize - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate / RhoWater; + vsCoil.WaterVolFlowRate = + vsCoil.WaterMassFlowRate / RhoWater; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = + vsCoil.OutletWaterTemp = state.dataVariableSpeedCoils->SourceSideInletTemp + state.dataVariableSpeedCoils->QSource / (state.dataVariableSpeedCoils->SourceSideMassFlowRate * CpWater); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = + vsCoil.OutletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth + state.dataVariableSpeedCoils->QSource / state.dataVariableSpeedCoils->SourceSideMassFlowRate; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; + vsCoil.QWasteHeat = 0.0; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater) // desuperheater doesn't save power and cooling energy variables + if (vsCoil.bIsDesuperheater) // desuperheater doesn't save power and cooling energy variables { // source side is the water side; load side is the air side - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = 0.0; + vsCoil.Power = 0.0; + vsCoil.QLoadTotal = 0.0; + vsCoil.QSensible = 0.0; + vsCoil.QLatent = 0.0; + vsCoil.Energy = 0.0; + vsCoil.EnergyLoadTotal = 0.0; + vsCoil.EnergySensible = 0.0; + vsCoil.EnergyLatent = 0.0; + vsCoil.CrankcaseHeaterConsumption = 0.0; } } @@ -7077,37 +6933,37 @@ namespace VariableSpeedCoils { Real64 rhoair(0.0); // entering air density // ADDED VARIABLES FOR air source coil - int MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + int MaxSpeed = vsCoil.NumOfSpeeds; // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) if (!(fanOp == HVAC::FanOp::Continuous) && PartLoadRatio > 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum).MassFlowRate / PartLoadRatio; + vsCoil.AirMassFlowRate = + state.dataLoopNodes->Node(vsCoil.AirInletNodeNum).MassFlowRate / PartLoadRatio; } - state.dataVariableSpeedCoils->LoadSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate; - state.dataVariableSpeedCoils->LoadSideInletDBTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; - state.dataVariableSpeedCoils->LoadSideInletHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; + state.dataVariableSpeedCoils->LoadSideMassFlowRate = vsCoil.AirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideInletDBTemp = vsCoil.InletAirDBTemp; + state.dataVariableSpeedCoils->LoadSideInletHumRat = vsCoil.InletAirHumRat; state.dataVariableSpeedCoils->LoadSideInletWBTemp = Psychrometrics::PsyTwbFnTdbWPb(state, state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName); - state.dataVariableSpeedCoils->LoadSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; + state.dataVariableSpeedCoils->LoadSideInletEnth = vsCoil.InletAirEnthalpy; Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); // Specific heat of air [J/kg_C] - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { // Get condenser outdoor node info from DX Heating Coil - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { + if (vsCoil.CondenserInletNodeNum != 0) { state.dataVariableSpeedCoils->OutdoorDryBulb = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Temp; state.dataVariableSpeedCoils->OutdoorHumRat = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).HumRat; state.dataVariableSpeedCoils->OutdoorPressure = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).Press; state.dataVariableSpeedCoils->OutdoorWetBulb = - state.dataLoopNodes->Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb; + state.dataLoopNodes->Node(vsCoil.CondenserInletNodeNum).OutAirWetBulb; } else { state.dataVariableSpeedCoils->OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; state.dataVariableSpeedCoils->OutdoorHumRat = state.dataEnvrn->OutHumRat; @@ -7121,41 +6977,41 @@ namespace VariableSpeedCoils { CpSource = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (state.dataVariableSpeedCoils->OutdoorDryBulb < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { - state.dataVariableSpeedCoils->CrankcaseHeatingPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex > 0) { + if (state.dataVariableSpeedCoils->OutdoorDryBulb < vsCoil.MaxOATCrankcaseHeater) { + state.dataVariableSpeedCoils->CrankcaseHeatingPower = vsCoil.CrankcaseHeaterCapacity; + if (vsCoil.CrankcaseHeaterCapacityCurveIndex > 0) { state.dataVariableSpeedCoils->CrankcaseHeatingPower *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, + vsCoil.CrankcaseHeaterCapacityCurveIndex, state.dataEnvrn->OutDryBulbTemp); } } else { state.dataVariableSpeedCoils->CrankcaseHeatingPower = 0.0; } } else { - state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; - state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; - state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; - CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + state.dataVariableSpeedCoils->SourceSideMassFlowRate = vsCoil.WaterMassFlowRate; + state.dataVariableSpeedCoils->SourceSideInletTemp = vsCoil.InletWaterTemp; + state.dataVariableSpeedCoils->SourceSideInletEnth = vsCoil.InletWaterEnthalpy; + CpSource = state.dataPlnt->PlantLoop(vsCoil.plantLoc.loopNum) .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. if ((state.dataVariableSpeedCoils->SourceSideMassFlowRate <= 0.0) || (state.dataVariableSpeedCoils->LoadSideMassFlowRate <= 0.0)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; + vsCoil.SimFlag = false; return; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; + vsCoil.SimFlag = true; } - if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) && - (state.dataVariableSpeedCoils->OutdoorDryBulb < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; + if ((vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) && + (state.dataVariableSpeedCoils->OutdoorDryBulb < vsCoil.MinOATCompressor)) { + vsCoil.SimFlag = false; return; } if (compressorOp == HVAC::CompressorOp::Off) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; + vsCoil.SimFlag = false; return; } @@ -7165,10 +7021,10 @@ namespace VariableSpeedCoils { SpeedCal = SpeedNum; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; + vsCoil.RunFrac = 1.0; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, vsCoil.PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -7176,174 +7032,174 @@ namespace VariableSpeedCoils { state.dataHVACGlobal->OnOffFanPartLoadFraction = PLF; // save PLF for fan model, don't change fan power for constant fan mode if coil is off // calculate the run time fraction - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + vsCoil.RunFrac = PartLoadRatio / PLF; + vsCoil.PartLoadRatio = PartLoadRatio; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 - } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + if (vsCoil.RunFrac > 1.0) { + vsCoil.RunFrac = 1.0; // Reset coil runtime fraction to 1.0 + } else if (vsCoil.RunFrac < 0.0) { + vsCoil.RunFrac = 0.0; } } if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { AirMassFlowRatio = - state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate / vsCoil.DesignAirMassFlowRate; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + vsCoil.DesignWaterMassFlowRate; } TotCapTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); TotCapAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } - state.dataVariableSpeedCoils->QLoadTotal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * + state.dataVariableSpeedCoils->QLoadTotal = vsCoil.MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal = TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; + vsCoil.capModFacTotal = TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; state.dataVariableSpeedCoils->TotRatedCapacity = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal); // for defrosting power cal + vsCoil.MSRatedTotCap(SpeedCal); // for defrosting power cal EIRTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); EIRAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * + EIR = (1.0 / vsCoil.MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; state.dataVariableSpeedCoils->Winput = state.dataVariableSpeedCoils->QLoadTotal * EIR; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { QWasteHeat = 0.0; } else { - QWasteHeat = state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat = state.dataVariableSpeedCoils->Winput * vsCoil.MSWasteHeatFrac(SpeedCal); QWasteHeat *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + vsCoil.MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { AirMassFlowRatio = - state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate / vsCoil.DesignAirMassFlowRate; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + vsCoil.DesignWaterMassFlowRate; } SpeedCal = SpeedNum - 1; TotCapTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); TotCapAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } - QLoadTotal1 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * + QLoadTotal1 = vsCoil.MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; EIRTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); EIRAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * + EIR = (1.0 / vsCoil.MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput1 = QLoadTotal1 * EIR; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { QWasteHeat1 = 0.0; } else { - QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat1 = Winput1 * vsCoil.MSWasteHeatFrac(SpeedCal); QWasteHeat1 *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + vsCoil.MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; TotCapTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + vsCoil.MSCCapFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); TotCapAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } - QLoadTotal2 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * + QLoadTotal2 = vsCoil.MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; EIRTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + vsCoil.MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); EIRAirFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, vsCoil.MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * + EIR = (1.0 / vsCoil.MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput2 = QLoadTotal2 * EIR; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { QWasteHeat2 = 0.0; } else { - QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat2 = Winput2 * vsCoil.MSWasteHeatFrac(SpeedCal); QWasteHeat2 *= Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + vsCoil.MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } @@ -7352,13 +7208,13 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; QWasteHeat = QWasteHeat2 * SpeedRatio + (1.0 - SpeedRatio) * QWasteHeat1; state.dataVariableSpeedCoils->TotRatedCapacity = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal - 1); + vsCoil.MSRatedTotCap(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * vsCoil.MSRatedTotCap(SpeedCal - 1); } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; // necessary to clear zero for water source coils - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = 0.0; // clear the defrost power - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + vsCoil.CrankcaseHeaterPower = 0.0; // necessary to clear zero for water source coils + vsCoil.DefrostPower = 0.0; // clear the defrost power + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { // Calculating adjustment factors for defrost // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E state.dataVariableSpeedCoils->OutdoorCoilT = 0.82 * state.dataVariableSpeedCoils->OutdoorDryBulb - 8.589; @@ -7373,10 +7229,10 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->FractionalDefrostTime = 0.0; state.dataVariableSpeedCoils->InputPowerMultiplier = 1.0; // Check outdoor temperature to determine of defrost is active - if (state.dataVariableSpeedCoils->OutdoorDryBulb <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATDefrost) { + if (state.dataVariableSpeedCoils->OutdoorDryBulb <= vsCoil.MaxOATDefrost) { // Calculate defrost adjustment factors depending on defrost control type - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl == Timed) { - state.dataVariableSpeedCoils->FractionalDefrostTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostTime; + if (vsCoil.DefrostControl == Timed) { + state.dataVariableSpeedCoils->FractionalDefrostTime = vsCoil.DefrostTime; if (state.dataVariableSpeedCoils->FractionalDefrostTime > 0.0) { state.dataVariableSpeedCoils->HeatingCapacityMultiplier = 0.909 - 107.33 * state.dataVariableSpeedCoils->OutdoorCoildw; state.dataVariableSpeedCoils->InputPowerMultiplier = 0.90 - 36.45 * state.dataVariableSpeedCoils->OutdoorCoildw; @@ -7387,34 +7243,34 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->InputPowerMultiplier = 0.954 * (1.0 - state.dataVariableSpeedCoils->FractionalDefrostTime); } // correction fractional defrost time shorten by runtime fraction - state.dataVariableSpeedCoils->FractionalDefrostTime *= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; + state.dataVariableSpeedCoils->FractionalDefrostTime *= vsCoil.RunFrac; if (state.dataVariableSpeedCoils->FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy == ReverseCycle) { + if (vsCoil.DefrostStrategy == ReverseCycle) { state.dataVariableSpeedCoils->LoadDueToDefrost = (0.01 * state.dataVariableSpeedCoils->FractionalDefrostTime) * (7.222 - state.dataVariableSpeedCoils->OutdoorDryBulb) * (state.dataVariableSpeedCoils->TotRatedCapacity / 1.01667); state.dataVariableSpeedCoils->DefrostEIRTempModFac = Curve::CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, + vsCoil.DefrostEIRFT, max(15.555, state.dataVariableSpeedCoils->LoadSideInletWBTemp), max(15.555, state.dataVariableSpeedCoils->OutdoorDryBulb)); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = + vsCoil.DefrostPower = state.dataVariableSpeedCoils->DefrostEIRTempModFac * (state.dataVariableSpeedCoils->TotRatedCapacity / 1.01667) * state.dataVariableSpeedCoils->FractionalDefrostTime; } else { // Defrost strategy is resistive - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity * + vsCoil.DefrostPower = + vsCoil.DefrostCapacity * state.dataVariableSpeedCoils->FractionalDefrostTime; } } else { // Defrost is not active because (OutDryBulbTemp > VarSpeedCoil(DXCoilNum).MaxOATDefrost) - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = 0.0; + vsCoil.DefrostPower = 0.0; } } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = - state.dataVariableSpeedCoils->CrankcaseHeatingPower * (1.0 - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac); + vsCoil.CrankcaseHeaterPower = + state.dataVariableSpeedCoils->CrankcaseHeatingPower * (1.0 - vsCoil.RunFrac); //! Modify total heating capacity based on defrost heating capacity multiplier //! MaxHeatCap passed from parent object VRF Condenser and is used to limit capacity of TU's to that available from condenser // IF(PRESENT(MaxHeatCap))THEN @@ -7450,21 +7306,21 @@ namespace VariableSpeedCoils { // Actual outlet conditions are "average" for time step if (fanOp == HVAC::FanOp::Continuous) { // continuous fan, cycling compressor - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = + vsCoil.OutletAirEnthalpy = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletEnth + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletEnth; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = + vsCoil.OutletAirHumRat = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + vsCoil.OutletAirDBTemp = + Psychrometrics::PsyTdbFnHW(vsCoil.OutletAirEnthalpy, + vsCoil.OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; + vsCoil.OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; + vsCoil.OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; + vsCoil.OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate * PartLoadRatio; } @@ -7473,55 +7329,55 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->QSensible *= PartLoadRatio; // count the powr separately state.dataVariableSpeedCoils->Winput *= - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; //+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower + vsCoil.RunFrac; //+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower state.dataVariableSpeedCoils->QSource *= PartLoadRatio; QWasteHeat *= PartLoadRatio; // Update heat pump data structure - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = state.dataVariableSpeedCoils->Winput; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = state.dataVariableSpeedCoils->QSensible; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = state.dataVariableSpeedCoils->QSource; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = state.dataVariableSpeedCoils->Winput * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = state.dataVariableSpeedCoils->QSensible * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = state.dataVariableSpeedCoils->QSource * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * TimeStepSysSec; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostConsumption = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower * TimeStepSysSec; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac == 0.0) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; + vsCoil.Power = state.dataVariableSpeedCoils->Winput; + vsCoil.QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; + vsCoil.QSensible = state.dataVariableSpeedCoils->QSensible; + vsCoil.QSource = state.dataVariableSpeedCoils->QSource; + vsCoil.Energy = state.dataVariableSpeedCoils->Winput * TimeStepSysSec; + vsCoil.EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * TimeStepSysSec; + vsCoil.EnergySensible = state.dataVariableSpeedCoils->QSensible * TimeStepSysSec; + vsCoil.EnergyLatent = 0.0; + vsCoil.EnergySource = state.dataVariableSpeedCoils->QSource * TimeStepSysSec; + vsCoil.CrankcaseHeaterConsumption = + vsCoil.CrankcaseHeaterPower * TimeStepSysSec; + vsCoil.DefrostConsumption = + vsCoil.DefrostPower * TimeStepSysSec; + if (vsCoil.RunFrac == 0.0) { + vsCoil.COP = 0.0; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = + vsCoil.COP = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->Winput; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; + vsCoil.PartLoadRatio = PartLoadRatio; + vsCoil.AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletHumRat, RoutineName); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; + vsCoil.AirVolFlowRate = + vsCoil.AirMassFlowRate / rhoair; - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; + if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { + vsCoil.WaterMassFlowRate = 0.0; + vsCoil.OutletWaterTemp = 0.0; + vsCoil.OutletWaterEnthalpy = 0.0; } else { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = + vsCoil.WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; + vsCoil.OutletWaterTemp = state.dataVariableSpeedCoils->SourceSideInletTemp - state.dataVariableSpeedCoils->QSource / (state.dataVariableSpeedCoils->SourceSideMassFlowRate * CpSource); - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = + vsCoil.OutletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth - state.dataVariableSpeedCoils->QSource / state.dataVariableSpeedCoils->SourceSideMassFlowRate; } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = QWasteHeat; + vsCoil.QWasteHeat = QWasteHeat; } Real64 GetCoilCapacityVariableSpeed(EnergyPlusData &state, @@ -7787,6 +7643,19 @@ namespace VariableSpeedCoils { return NodeNumber; } + int GetCoilInletNodeVariableSpeed(EnergyPlusData &state, + std::string const &CoilName, // must match coil names for the coil type + ) + { + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered + GetVarSpeedCoilInput(state); + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; + } + + int WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); + return (WhichCoil == 0) ? 0 : state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).AirInletNodeNum; + } + int GetCoilOutletNodeVariableSpeed(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -7828,6 +7697,20 @@ namespace VariableSpeedCoils { return NodeNumber; } + int GetCoilOutletNodeVariableSpeed(EnergyPlusData &state, + std::string const &CoilName // must match coil names for the coil type + ) + { + // Obtains and Allocates WatertoAirHP related parameters from input file + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered + GetVarSpeedCoilInput(state); + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; + } + + int WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); + return (WhichCoil == 0) ? 0 : state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).AirOutletNodeNum; + } + int GetVSCoilCondenserInletNode(EnergyPlusData &state, std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem @@ -7925,20 +7808,20 @@ namespace VariableSpeedCoils { Real64 GetVSCoilRatedSourceTemp(EnergyPlusData &state, int const CoilIndex) { Real64 RatedSourceTemp = 0.0; - switch (state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).VSCoilType) { - case HVAC::Coil_CoolingWaterToAirHPVSEquationFit: { + switch (state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).coilType) { + case HVAC::CoilType::CoolingWaterToAirHPVSEquationFit: { RatedSourceTemp = RatedInletWaterTemp; } break; - case HVAC::Coil_HeatingWaterToAirHPVSEquationFit: { + case HVAC::CoilType::HeatingWaterToAirHPVSEquationFit: { RatedSourceTemp = RatedInletWaterTempHeat; } break; case HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed: { RatedSourceTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).WHRatedInletWaterTemp; } break; - case HVAC::Coil_CoolingAirToAirVariableSpeed: { + case HVAC::CoilType::CoolingAirToAirVariableSpeed: { RatedSourceTemp = RatedAmbAirTemp; } break; - case HVAC::Coil_HeatingAirToAirVariableSpeed: { + case HVAC::CoilType::HeatingAirToAirVariableSpeed: { RatedSourceTemp = RatedAmbAirTempHeat; } break; default: { @@ -8013,39 +7896,39 @@ namespace VariableSpeedCoils { auto &varSpeedCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); // WatertoAirHP(DXCoilNum)%SimFlag=.FALSE. - if (!varSpeedCoil.SimFlag) { + if (!vsCoil.SimFlag) { // Heatpump is off; just pass through conditions - varSpeedCoil.Power = 0.0; - varSpeedCoil.QLoadTotal = 0.0; - varSpeedCoil.QSensible = 0.0; - varSpeedCoil.QLatent = 0.0; - varSpeedCoil.QSource = 0.0; - varSpeedCoil.Energy = 0.0; - varSpeedCoil.EnergyLoadTotal = 0.0; - varSpeedCoil.EnergySensible = 0.0; - varSpeedCoil.EnergyLatent = 0.0; - varSpeedCoil.EnergySource = 0.0; - varSpeedCoil.COP = 0.0; - varSpeedCoil.RunFrac = 0.0; - varSpeedCoil.PartLoadRatio = 0.0; - - varSpeedCoil.OutletAirDBTemp = varSpeedCoil.InletAirDBTemp; - varSpeedCoil.OutletAirHumRat = varSpeedCoil.InletAirHumRat; - varSpeedCoil.OutletAirEnthalpy = varSpeedCoil.InletAirEnthalpy; - varSpeedCoil.OutletWaterTemp = varSpeedCoil.InletWaterTemp; - varSpeedCoil.OutletWaterEnthalpy = varSpeedCoil.InletWaterEnthalpy; - } - - int AirInletNode = varSpeedCoil.AirInletNodeNum; - int WaterInletNode = varSpeedCoil.WaterInletNodeNum; - int AirOutletNode = varSpeedCoil.AirOutletNodeNum; - int WaterOutletNode = varSpeedCoil.WaterOutletNodeNum; + vsCoil.Power = 0.0; + vsCoil.QLoadTotal = 0.0; + vsCoil.QSensible = 0.0; + vsCoil.QLatent = 0.0; + vsCoil.QSource = 0.0; + vsCoil.Energy = 0.0; + vsCoil.EnergyLoadTotal = 0.0; + vsCoil.EnergySensible = 0.0; + vsCoil.EnergyLatent = 0.0; + vsCoil.EnergySource = 0.0; + vsCoil.COP = 0.0; + vsCoil.RunFrac = 0.0; + vsCoil.PartLoadRatio = 0.0; + + vsCoil.OutletAirDBTemp = vsCoil.InletAirDBTemp; + vsCoil.OutletAirHumRat = vsCoil.InletAirHumRat; + vsCoil.OutletAirEnthalpy = vsCoil.InletAirEnthalpy; + vsCoil.OutletWaterTemp = vsCoil.InletWaterTemp; + vsCoil.OutletWaterEnthalpy = vsCoil.InletWaterEnthalpy; + } + + int AirInletNode = vsCoil.AirInletNodeNum; + int WaterInletNode = vsCoil.WaterInletNodeNum; + int AirOutletNode = vsCoil.AirOutletNodeNum; + int WaterOutletNode = vsCoil.WaterOutletNodeNum; // Set the air outlet nodes of the WatertoAirHPSimple state.dataLoopNodes->Node(AirOutletNode).MassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate; // LoadSideMassFlowRate - state.dataLoopNodes->Node(AirOutletNode).Temp = varSpeedCoil.OutletAirDBTemp; - state.dataLoopNodes->Node(AirOutletNode).HumRat = varSpeedCoil.OutletAirHumRat; - state.dataLoopNodes->Node(AirOutletNode).Enthalpy = varSpeedCoil.OutletAirEnthalpy; + state.dataLoopNodes->Node(AirOutletNode).Temp = vsCoil.OutletAirDBTemp; + state.dataLoopNodes->Node(AirOutletNode).HumRat = vsCoil.OutletAirHumRat; + state.dataLoopNodes->Node(AirOutletNode).Enthalpy = vsCoil.OutletAirEnthalpy; // Set the air outlet nodes for properties that just pass through & not used state.dataLoopNodes->Node(AirOutletNode).Quality = state.dataLoopNodes->Node(AirInletNode).Quality; @@ -8060,15 +7943,15 @@ namespace VariableSpeedCoils { // Set the water outlet nodes for properties that just pass through & not used if (WaterInletNode != 0 && WaterOutletNode != 0) { PlantUtilities::SafeCopyPlantNode(state, WaterInletNode, WaterOutletNode); - state.dataLoopNodes->Node(WaterOutletNode).Temp = varSpeedCoil.OutletWaterTemp; - state.dataLoopNodes->Node(WaterOutletNode).Enthalpy = varSpeedCoil.OutletWaterEnthalpy; + state.dataLoopNodes->Node(WaterOutletNode).Temp = vsCoil.OutletWaterTemp; + state.dataLoopNodes->Node(WaterOutletNode).Enthalpy = vsCoil.OutletWaterEnthalpy; } - varSpeedCoil.Energy = varSpeedCoil.Power * TimeStepSysSec; - varSpeedCoil.EnergyLoadTotal = varSpeedCoil.QLoadTotal * TimeStepSysSec; - varSpeedCoil.EnergySensible = varSpeedCoil.QSensible * TimeStepSysSec; - varSpeedCoil.EnergyLatent = varSpeedCoil.QLatent * TimeStepSysSec; - varSpeedCoil.EnergySource = varSpeedCoil.QSource * TimeStepSysSec; + vsCoil.Energy = vsCoil.Power * TimeStepSysSec; + vsCoil.EnergyLoadTotal = vsCoil.QLoadTotal * TimeStepSysSec; + vsCoil.EnergySensible = vsCoil.QSensible * TimeStepSysSec; + vsCoil.EnergyLatent = vsCoil.QLatent * TimeStepSysSec; + vsCoil.EnergySource = vsCoil.QSource * TimeStepSysSec; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { state.dataLoopNodes->Node(AirOutletNode).CO2 = state.dataLoopNodes->Node(AirInletNode).CO2; @@ -8078,41 +7961,41 @@ namespace VariableSpeedCoils { state.dataLoopNodes->Node(AirOutletNode).GenContam = state.dataLoopNodes->Node(AirInletNode).GenContam; } - if (varSpeedCoil.reportCoilFinalSizes) { + if (vsCoil.reportCoilFinalSizes) { if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) { - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { // cooling coil - state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.RatedCapCoolTotal, - varSpeedCoil.RatedCapCoolSens, - varSpeedCoil.RatedAirVolFlowRate, - varSpeedCoil.RatedWaterMassFlowRate); - } else if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { // heating coil - state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(state, - varSpeedCoil.Name, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.RatedCapHeat, - varSpeedCoil.RatedCapHeat, - varSpeedCoil.RatedAirVolFlowRate, - varSpeedCoil.RatedWaterMassFlowRate); + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // cooling coil + coilReport->setCoilFinalSizes(state, + vsCoil.Name, + vsCoil.VarSpeedCoilType, + vsCoil.RatedCapCoolTotal, + vsCoil.RatedCapCoolSens, + vsCoil.RatedAirVolFlowRate, + vsCoil.RatedWaterMassFlowRate); + } else if (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { // heating coil + coilReport->setCoilFinalSizes(state, + vsCoil.Name, + vsCoil.VarSpeedCoilType, + vsCoil.RatedCapHeat, + vsCoil.RatedCapHeat, + vsCoil.RatedAirVolFlowRate, + vsCoil.RatedWaterMassFlowRate); } - varSpeedCoil.reportCoilFinalSizes = false; + vsCoil.reportCoilFinalSizes = false; } } - if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { + if (vsCoil.coilType == HVAC::CoilType::CoolingWaterToAirHPVSEquationFit || + vsCoil.coilType == HVAC::CoilType::CoolingAirToAirVariableSpeed) { // Add power to global variable so power can be summed by parent object - state.dataHVACGlobal->DXElecCoolingPower = varSpeedCoil.Power; - } else if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { + state.dataHVACGlobal->DXElecCoolingPower = vsCoil.Power; + } else if (vsCoil.coilType == HVAC::CoilType::HeatingWaterToAirHPVSEquationFit) { // Add power to global variable so power can be summed by parent object - state.dataHVACGlobal->DXElecHeatingPower = varSpeedCoil.Power; - } else if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { + state.dataHVACGlobal->DXElecHeatingPower = vsCoil.Power; + } else if (vsCoil.coilType == HVAC::CoilType::HeatingAirToAirVariableSpeed) { // Add power to global variable so power can be summed by parent object - state.dataHVACGlobal->DXElecHeatingPower = varSpeedCoil.Power + varSpeedCoil.CrankcaseHeaterPower; - state.dataHVACGlobal->DefrostElecPower = varSpeedCoil.DefrostPower; + state.dataHVACGlobal->DXElecHeatingPower = vsCoil.Power + vsCoil.CrankcaseHeaterPower; + state.dataHVACGlobal->DefrostElecPower = vsCoil.DefrostPower; } } @@ -8167,11 +8050,11 @@ namespace VariableSpeedCoils { Real64 Error; // Error for iteration (DO) loop Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult - Real64 Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; // [s] - Real64 Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; - Real64 MaxONOFFCyclesperHour = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour; // [cycles/hr] - Real64 LatentCapacityTimeConstant = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant; // [s] - Real64 FanDelayTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime; // [s] + Real64 Twet_Rated = vsCoil.Twet_Rated; // [s] + Real64 Gamma_Rated = vsCoil.Gamma_Rated; + Real64 MaxONOFFCyclesperHour = vsCoil.MaxONOFFCyclesperHour; // [cycles/hr] + Real64 LatentCapacityTimeConstant = vsCoil.LatentCapacityTimeConstant; // [s] + Real64 FanDelayTime = vsCoil.FanDelayTime; // [s] // No moisture evaporation (latent degradation) occurs for runtime fraction of 1.0 // All latent degradation model parameters cause divide by 0.0 if not greater than 0.0 @@ -8394,7 +8277,7 @@ namespace VariableSpeedCoils { Real64 getVarSpeedPartLoadRatio(EnergyPlusData &state, int const DXCoilNum) { - return state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio; + return vsCoil.PartLoadRatio; } } // namespace VariableSpeedCoils diff --git a/src/EnergyPlus/VariableSpeedCoils.hh b/src/EnergyPlus/VariableSpeedCoils.hh index 66cb201ab5f..3b63995426c 100644 --- a/src/EnergyPlus/VariableSpeedCoils.hh +++ b/src/EnergyPlus/VariableSpeedCoils.hh @@ -73,7 +73,7 @@ namespace VariableSpeedCoils { { // Members std::string Name; // Name of the Coil - std::string VarSpeedCoilType; // type of coil + HVAC::CoilType coilType = HVAC::CoilType::Invalid; int NumOfSpeeds; // Number of speeds int NormSpedLevel; // Nominal speed level Real64 RatedWaterVolFlowRate; // Rated/Ref Water Volumetric Flow Rate [m3/s] @@ -90,7 +90,7 @@ namespace VariableSpeedCoils { Real64 LatentCapacityTimeConstant; // Latent capacity time constant [s] int PLFFPLR; // index of part load curve as a function of part load ratio std::string CoolHeatType; // Type of WatertoAirHP ie. Heating or Cooling - int VSCoilType; // type of component in plant + bool SimFlag; // Heat Pump Simulation Flag Real64 DesignWaterMassFlowRate; // design water mass flow rate [kg/s] Real64 DesignWaterVolFlowRate; // design water volumetric flow rate [m3/s] @@ -284,7 +284,7 @@ namespace VariableSpeedCoils { : NumOfSpeeds(2), NormSpedLevel(HVAC::MaxSpeedLevels), RatedWaterVolFlowRate(DataSizing::AutoSize), RatedWaterMassFlowRate(DataSizing::AutoSize), RatedAirVolFlowRate(DataSizing::AutoSize), RatedCapHeat(DataSizing::AutoSize), RatedCapCoolTotal(DataSizing::AutoSize), MaxONOFFCyclesperHour(0.0), Twet_Rated(0.0), Gamma_Rated(0.0), HOTGASREHEATFLG(0), - LatentCapacityTimeConstant(0.0), PLFFPLR(0), VSCoilType(0), SimFlag(false), DesignWaterMassFlowRate(0.0), DesignWaterVolFlowRate(0.0), + LatentCapacityTimeConstant(0.0), PLFFPLR(0), SimFlag(false), DesignWaterMassFlowRate(0.0), DesignWaterVolFlowRate(0.0), DesignAirMassFlowRate(0.0), DesignAirVolFlowRate(0.0), AirVolFlowRate(0.0), AirMassFlowRate(0.0), InletAirPressure(0.0), InletAirDBTemp(0.0), InletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirDBTemp(0.0), OutletAirHumRat(0.0), OutletAirEnthalpy(0.0), WaterVolFlowRate(0.0), WaterMassFlowRate(0.0), InletWaterTemp(0.0), InletWaterEnthalpy(0.0), OutletWaterTemp(0.0), @@ -402,35 +402,59 @@ namespace VariableSpeedCoils { bool &ErrorsFound // set to true if problem ); + Real64 GetCoilCapacityVariableSpeed(EnergyPlusData &state, + int const coilNum + ); + int GetCoilIndexVariableSpeed(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilIndexVariableSpeed(EnergyPlusData &state, + std::string const &CoilName // must match coil names for the coil type + ); + Real64 GetCoilAirFlowRateVariableSpeed(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + Real64 GetCoilAirFlowRateVariableSpeed(EnergyPlusData &state, + int const coilNum + ); + int GetCoilInletNodeVariableSpeed(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilInletNodeVariableSpeed(EnergyPlusData &state, + int const coilNum + ); + int GetCoilOutletNodeVariableSpeed(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilOutletNodeVariableSpeed(EnergyPlusData &state, + int const coilNum + ); + int GetVSCoilCondenserInletNode(EnergyPlusData &state, std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetVSCoilCondenserInletNode(EnergyPlusData &state, + int const coilNum + ); + int GetVSCoilPLFFPLR(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -443,8 +467,7 @@ namespace VariableSpeedCoils { ); Real64 GetVSCoilMinOATCompressor(EnergyPlusData &state, - int const CoilIndex, // index to cooling coil - bool &ErrorsFound // set to true if problem + int const coilNum ); int GetVSCoilNumOfSpeeds(EnergyPlusData &state, @@ -452,6 +475,10 @@ namespace VariableSpeedCoils { bool &ErrorsFound // set to true if problem ); + int GetVSCoilNumOfSpeeds(EnergyPlusData &state, + int const coilNum + ); + Real64 GetVSCoilRatedSourceTemp(EnergyPlusData &state, int const CoilIndex); void SetVarSpeedCoilData(EnergyPlusData &state, diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index 0de9d4b28e3..d5a37f8721c 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -5916,23 +5916,28 @@ int GetWaterCoilIndex(EnergyPlusData &state, return IndexNum; } -int GetCompIndex(EnergyPlusData &state, CoilModel compType, std::string_view const coilName) + +int GetWaterCoilIndex(EnergyPlusData &state, + std::string const &CoilName // must match coil names for the coil type +) { - static constexpr std::array CoilModelNamesUC = { - "COIL:HEATING:WATER", "COIL:COOLING:WATER", "COIL:COOLING:WATER:DETAILED"}; + // FUNCTION INFORMATION: + // AUTHOR B. Nigusse, FSEC + // DATE WRITTEN Feb 2012 + + // PURPOSE OF THIS FUNCTION: + // This function looks up the index for the given coil and returns it. If incorrect coil + // type or name is given, ErrorsFound is returned as true and node number is returned + // as zero. + + // Obtains and allocates WaterCoil related parameters from input file if (state.dataWaterCoils->GetWaterCoilsInputFlag) { GetWaterCoilInput(state); state.dataWaterCoils->GetWaterCoilsInputFlag = false; } - int index = Util::FindItemInList(coilName, state.dataWaterCoils->WaterCoil); - - if (index == 0) { // may not find coil name - ShowSevereError(state, - format("GetWaterCoilIndex: Could not find CoilType = \"{}\" with Name = \"{}\"", CoilModelNamesUC[(int)compType], coilName)); - } - return index; + return Util::FindItemInList(CoilName, state.dataWaterCoils->WaterCoil); } Real64 GetWaterCoilCapacity(EnergyPlusData &state, diff --git a/src/EnergyPlus/WaterCoils.hh b/src/EnergyPlus/WaterCoils.hh index 57e36e40b7c..9fdfd9beb4d 100644 --- a/src/EnergyPlus/WaterCoils.hh +++ b/src/EnergyPlus/WaterCoils.hh @@ -423,30 +423,50 @@ namespace WaterCoils { bool &ErrorsFound // set to true if problem ); + Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state, + int const coilNum + ); + int GetCoilInletNode(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilInletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilOutletNode(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilOutletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilWaterInletNode(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilWaterInletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilWaterOutletNode(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilWaterOutletNode(EnergyPlusData &state, + int const coilNum + ); + void SetCoilDesFlow(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -454,6 +474,11 @@ namespace WaterCoils { bool &ErrorsFound // set to true if problem ); + void SetCoilDesFlow(EnergyPlusData &state, + int const coilNum, + Real64 const CoilDesFlow // coil volumetric air flow rate [m3/s] + ); + Real64 GetWaterCoilDesAirFlow(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -480,12 +505,15 @@ namespace WaterCoils { Real64 EstimateHEXSurfaceArea(EnergyPlusData &state, int const CoilNum); // coil number, [-] + int GetWaterCoilIndex(EnergyPlusData &state, + std::string const &CoilName // must match coil names for the coil type + ); + int GetWaterCoilIndex(EnergyPlusData &state, std::string_view CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - int GetCompIndex(EnergyPlusData &state, CoilModel coilType, std::string_view const coilName); Real64 GetWaterCoilCapacity(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module @@ -493,6 +521,10 @@ namespace WaterCoils { bool &ErrorsFound // set to true if problem ); + Real64 GetWaterCoilCapacity(EnergyPlusData &state, + int const coilNum + ); + void UpdateWaterToAirCoilPlantConnection(EnergyPlusData &state, DataPlant::PlantEquipmentType const CoilType, std::string const &CoilName, diff --git a/src/EnergyPlus/WaterToAirHeatPump.hh b/src/EnergyPlus/WaterToAirHeatPump.hh index e0111dc129b..74860cfe368 100644 --- a/src/EnergyPlus/WaterToAirHeatPump.hh +++ b/src/EnergyPlus/WaterToAirHeatPump.hh @@ -231,24 +231,40 @@ namespace WaterToAirHeatPump { bool &ErrorsFound // set to true if problem ); + int GetCoilIndex(EnergyPlusData &state, + std::string const &CoilName // must match coil names for the coil type + ); + Real64 GetCoilCapacity(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + Real64 GetCoilCapacity(EnergyPlusData &state, + int const coilNum + ); + int GetCoilInletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilInletNode(EnergyPlusData &state, + int const coilNum + ); + int GetCoilOutletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); + int GetCoilOutletNode(EnergyPlusData &state, + int const coilNum + ); + } // namespace WaterToAirHeatPump struct WaterToAirHeatPumpData : BaseGlobalStruct diff --git a/src/EnergyPlus/WaterToAirHeatPumpSimple.hh b/src/EnergyPlus/WaterToAirHeatPumpSimple.hh index 0547d905a09..61565767b0e 100644 --- a/src/EnergyPlus/WaterToAirHeatPumpSimple.hh +++ b/src/EnergyPlus/WaterToAirHeatPumpSimple.hh @@ -231,6 +231,10 @@ namespace WaterToAirHeatPumpSimple { bool &ErrorsFound // set to true if problem ); + int GetCoilIndex(EnergyPlusData &state, + std::string const &CoilName // must match coil names for the coil type + ); + Real64 GetCoilCapacity(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type @@ -255,6 +259,22 @@ namespace WaterToAirHeatPumpSimple { bool &ErrorsFound // set to true if problem ); + Real64 GetCoilCapacity(EnergyPlusData &state, + int const coilNum + ); + + Real64 GetCoilAirFlowRate(EnergyPlusData &state, + int const coilNum + ); + + int GetCoilInletNode(EnergyPlusData &state, + int const coilNum + ); + + int GetCoilOutletNode(EnergyPlusData &state, + int const coilNum + ); + void SetSimpleWSHPData(EnergyPlusData &state, int const SimpleWSHPNum, // Number of OA Controller bool &ErrorsFound, // Set to true if certain errors found From 759f65ebc795829a46453c48d6eafe0e60e6edbc Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Fri, 21 Mar 2025 17:51:43 -0400 Subject: [PATCH 03/12] Fix more unit tests --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 4 ++-- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 84c64f5b02e..b3f6b0110ce 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -12250,8 +12250,8 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & } // minimum airflow rate - if (state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).RatedAirMassFlowRate(Mode) > 0.0) { - FanSpdRatioMin = min(state.dataHVACVarRefFlow->OACompOnMassFlow / state.dataDXCoils->DXCoil(vrfTU.HeatCoilNum).RatedAirMassFlowRate(Mode), 1.0); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) > 0.0) { + FanSpdRatioMin = min(state.dataHVACVarRefFlow->OACompOnMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode), 1.0); } else { // VRF terminal unit is off QCoilAct = 0.0; diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 1717a33e928..0a91d6d6cbb 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -350,6 +350,7 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.compNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).coilType = HVAC::CoilType::CoolingWater; state->dataWaterCoils->WaterCoil(CoilNum).coilPlantType = DataPlant::PlantEquipmentType::CoilWaterCooling; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; @@ -419,6 +420,7 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.compNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).coilPlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).coilType = HVAC::CoilType::HeatingWater; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; From 3868b920ce5fa021fcf251590924380bd1f2ffcd Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Sat, 22 Mar 2025 10:37:46 -0400 Subject: [PATCH 04/12] Fix integration tests --- src/EnergyPlus/AirLoopHVACDOAS.cc | 2 +- src/EnergyPlus/Furnaces.cc | 2 +- src/EnergyPlus/HVACMultiSpeedHeatPump.cc | 16 ++++++++-------- src/EnergyPlus/UnitVentilator.cc | 3 ++- src/EnergyPlus/VentilatedSlab.cc | 11 +++++++---- src/EnergyPlus/WaterThermalTanks.cc | 1 + 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/EnergyPlus/AirLoopHVACDOAS.cc b/src/EnergyPlus/AirLoopHVACDOAS.cc index 91aa42f69b8..2fc92523f70 100644 --- a/src/EnergyPlus/AirLoopHVACDOAS.cc +++ b/src/EnergyPlus/AirLoopHVACDOAS.cc @@ -940,7 +940,7 @@ namespace AirLoopHVACDOAS { } else if (Util::SameString(CompType, "COIL:COOLING:WATER") || Util::SameString(CompType, "COIL:COOLING:WATER:DETAILEDGEOMETRY")) { - WaterCoils::SimulateWaterCoilComponents(state, this->m_CoolCoilNum, FirstHVACIteration); + WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_CoolCoilNum); Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, this->m_CoolCoilNum); rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); PlantUtilities::InitComponentNodes(state, diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index 84e20396f66..037d463781c 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -2287,7 +2287,7 @@ namespace Furnaces { ShowSevereItemNotFound(state, eoh, cAlphaFields(11), furnace.ihpName); ErrorsFound = true; } else { - furnace.CoolCoilName = state.dataIntegratedHP->IntegratedHeatPumps(furnace.CoolCoilNum).SCCoilName; + furnace.CoolCoilName = state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).SCCoilName; furnace.CoolCoilNum = VariableSpeedCoils::GetCoilIndex(state, furnace.CoolCoilName); if (furnace.CoolCoilNum == 0) { ShowSevereItemNotFound(state, eoh, format("{}.SCCoilName", furnace.ihpName), furnace.CoolCoilName); diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc index cb176503d78..e096b6ccc7a 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc @@ -3189,17 +3189,17 @@ namespace HVACMultiSpeedHeatPump { auto &s_node = state.dataLoopNodes; auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); - if (mshp.HeatCoilNum > 0) { - if (state.dataDXCoils->DXCoil(mshp.HeatCoilNum).IsSecondaryDXCoilInZone) { - OutsideDryBulbTemp = - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(mshp.HeatCoilNum).SecZonePtr).ZT; + if (mshp.heatCoilType == HVAC::CoilType::HeatingDXMultiSpeed && mshp.HeatCoilNum > 0) { + auto const &dxCoil = state.dataDXCoils->DXCoil(mshp.HeatCoilNum); + if (dxCoil.IsSecondaryDXCoilInZone) { + OutsideDryBulbTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(dxCoil.SecZonePtr).ZT; } else { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; } - } else if (mshp.CoolCoilNum > 0) { - if (state.dataDXCoils->DXCoil(mshp.CoolCoilNum).IsSecondaryDXCoilInZone) { - OutsideDryBulbTemp = - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataDXCoils->DXCoil(mshp.CoolCoilNum).SecZonePtr).ZT; + } else if (mshp.coolCoilType == HVAC::CoilType::CoolingDXMultiSpeed && mshp.CoolCoilNum > 0) { + auto const &dxCoil = state.dataDXCoils->DXCoil(mshp.CoolCoilNum); + if (dxCoil.IsSecondaryDXCoilInZone) { + OutsideDryBulbTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(dxCoil.SecZonePtr).ZT; } else { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; } diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index 4eff9861637..83cef78da24 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -583,7 +583,8 @@ namespace UnitVentilator { unitVent.MaxVolHotSteamFlow = unitVent.MaxVolHotWaterFlow; } - } else if (unitVent.heatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel) { + } else if (unitVent.heatCoilType == HVAC::CoilType::HeatingElectric || + unitVent.heatCoilType == HVAC::CoilType::HeatingGasOrOtherFuel) { unitVent.HeatCoilNum = HeatingCoils::GetCoilIndex(state, unitVent.HeatCoilName); if (unitVent.HeatCoilNum == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(16), unitVent.HeatCoilName); diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 629d04d5cc6..041e283d65a 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -2296,10 +2296,13 @@ namespace VentilatedSlab { } } - - int coolCoilNum = (ventSlab.coolCoilType == HVAC::CoilType::CoolingDXHXAssisted) ? ventSlab.childCoolCoilNum : ventSlab.coolCoilNum; - WaterCoils::SetCoilDesFlow(state, coolCoilNum, ventSlab.MaxAirVolFlow); - WaterCoils::SetCoilDesFlow(state, ventSlab.heatCoilNum, ventSlab.MaxAirVolFlow); + if (ventSlab.coolCoilPresent) { + int coolCoilNum = (ventSlab.coolCoilType == HVAC::CoilType::CoolingDXHXAssisted) ? ventSlab.childCoolCoilNum : ventSlab.coolCoilNum; + WaterCoils::SetCoilDesFlow(state, coolCoilNum, ventSlab.MaxAirVolFlow); + } + if (ventSlab.heatCoilPresent) { + WaterCoils::SetCoilDesFlow(state, ventSlab.heatCoilNum, ventSlab.MaxAirVolFlow); + } if (CurZoneEqNum > 0) { auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 6b133f9b681..efbe3a54112 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1404,6 +1404,7 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) } // Then IHP } else if ((HPWH.DXCoilNum = IntegratedHeatPump::GetIHPIndex(state, HPWH.DXCoilName)) != 0) { + bIsVScoil = true; // IHPs use variable speed coils HPWH.bIsIHP = true; HPWH.DXCoilType = HVAC::CoilType::IHPAirSource; // Finally VariableSpeedCoil From 18cbba2ad3c44d3cea042b90e4b2ea42188933bb Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Fri, 28 Mar 2025 15:01:41 -0400 Subject: [PATCH 05/12] Fix one regression issue and minor cleanup --- src/EnergyPlus/HVACSingleDuctInduc.cc | 7 +- src/EnergyPlus/SingleDuct.cc | 182 ++++++++++++-------------- src/EnergyPlus/SingleDuct.hh | 24 ---- 3 files changed, 86 insertions(+), 127 deletions(-) diff --git a/src/EnergyPlus/HVACSingleDuctInduc.cc b/src/EnergyPlus/HVACSingleDuctInduc.cc index 580179d03a4..969c4f2ab97 100644 --- a/src/EnergyPlus/HVACSingleDuctInduc.cc +++ b/src/EnergyPlus/HVACSingleDuctInduc.cc @@ -1033,10 +1033,13 @@ namespace HVACSingleDuctInduc { termUnitSizing.DesHeatingLoad = indUnit.DesHeatingLoad; // save the induction ratio for use in subsequent sizing calcs termUnitSizing.InducRat = indUnit.InducRatio; - if (indUnit.heatCoilType == HVAC::CoilType::CoolingWater || - indUnit.heatCoilType == HVAC::CoilType::CoolingWaterDetailed) { + if (indUnit.heatCoilType == HVAC::CoilType::HeatingWater) { WaterCoils::SetCoilDesFlow(state, indUnit.heatCoilNum, termUnitSizing.AirVolFlow); } + if (indUnit.coolCoilType == HVAC::CoilType::CoolingWater || + indUnit.coolCoilType == HVAC::CoilType::CoolingWaterDetailed) { + WaterCoils::SetCoilDesFlow(state, indUnit.coolCoilNum, termUnitSizing.AirVolFlow); + } } } diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index 7d2360dff63..6c3dd41108c 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -2507,9 +2507,12 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) if (this->MaxHeatAirVolFlowRate == AutoSize) { IsAutoSize = true; } + + Real64 UserInputMaxHeatAirVolFlowRate = 0.0; + if (state.dataSize->CurTermUnitSizingNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { // simulation should continue - state.dataSingleDuct->UserInputMaxHeatAirVolFlowRateSS = this->MaxHeatAirVolFlowRate; + UserInputMaxHeatAirVolFlowRate = this->MaxHeatAirVolFlowRate; if (this->MaxHeatAirVolFlowRate > 0.0) { BaseSizer::reportSizerOutput( state, this->sysType, this->SysName, "User-Specified Maximum Heating Air Flow Rate [m3/s]", this->MaxHeatAirVolFlowRate); @@ -2528,13 +2531,13 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) } if (IsAutoSize) { this->MaxHeatAirVolFlowRate = MaxHeatAirVolFlowRateDes; - state.dataSingleDuct->UserInputMaxHeatAirVolFlowRateSS = 0.0; + UserInputMaxHeatAirVolFlowRate = 0.0; BaseSizer::reportSizerOutput( state, this->sysType, this->SysName, "Design Size Maximum Heating Air Flow Rate [m3/s]", MaxHeatAirVolFlowRateDes); } else { // Hard-size with sizing data if (this->MaxHeatAirVolFlowRate > 0.0 && MaxHeatAirVolFlowRateDes > 0.0) { MaxHeatAirVolFlowRateUser = this->MaxHeatAirVolFlowRate; - state.dataSingleDuct->UserInputMaxHeatAirVolFlowRateSS = this->MaxHeatAirVolFlowRate; + UserInputMaxHeatAirVolFlowRate = this->MaxHeatAirVolFlowRate; BaseSizer::reportSizerOutput(state, this->sysType, this->SysName, @@ -3003,7 +3006,7 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) // set air flow rate used to size heating coils, ZoneTurndownMinAirFrac defaults to 1 for those TU types that do not use it if (this->SysType_Num == SysType::SingleDuctVAVReheatVSFan) { TermUnitSizing(state.dataSize->CurTermUnitSizingNum).AirVolFlow = - max(state.dataSingleDuct->UserInputMaxHeatAirVolFlowRateSS, + max(UserInputMaxHeatAirVolFlowRate, state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).NonAirSysDesHeatVolFlow, this->MaxAirVolFlowRate * this->ZoneMinAirFracDes * this->ZoneTurndownMinAirFrac); } else if (this->SysType_Num == SysType::SingleDuctConstVolReheat || this->SysType_Num == SysType::SingleDuctConstVolNoReheat) { @@ -3084,6 +3087,9 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) if (this->MaxReheatWaterVolFlow == AutoSize) { IsAutoSize = true; } + + Real64 DesCoilLoad = 0.0; + if (state.dataSize->CurTermUnitSizingNum > 0) { if (!IsAutoSize && !state.dataSize->ZoneSizingRunDone) { if (this->MaxReheatWaterVolFlow > 0.0) { @@ -3093,35 +3099,29 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) } else { CheckZoneSizing(state, this->sysType, this->SysName); if (this->reheatCoilType == HVAC::CoilType::HeatingWater) { - state.dataSingleDuct->CoilWaterInletNodeSS = WaterCoils::GetCoilWaterInletNode(state, this->ReheatCoilNum); - state.dataSingleDuct->CoilWaterOutletNodeSS = WaterCoils::GetCoilWaterOutletNode(state, this->ReheatCoilNum); + int CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, this->ReheatCoilNum); + int CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, this->ReheatCoilNum); if (IsAutoSize) { PlantSizingErrorsFound = false; PltSizHeatNum = MyPlantSizingIndex(state, "Coil:Heating:Water", this->ReheatCoilName, - state.dataSingleDuct->CoilWaterInletNodeSS, - state.dataSingleDuct->CoilWaterOutletNodeSS, + CoilWaterInletNode, + CoilWaterOutletNode, PlantSizingErrorsFound); if (PlantSizingErrorsFound) { ShowContinueError(state, format("...Occurs in {}:{}", this->sysType, this->SysName)); ErrorsFound = true; } if (PltSizHeatNum > 0) { - state.dataSingleDuct->CoilInTempSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesHeatCoilInTempTU; + Real64 CoilInTemp = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesHeatCoilInTempTU; DesMassFlow = state.dataEnvrn->StdRhoAir * TermUnitSizing(state.dataSize->CurTermUnitSizingNum).AirVolFlow; - state.dataSingleDuct->DesZoneHeatLoadSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).NonAirSysDesHeatLoad; - state.dataSingleDuct->ZoneDesTempSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneTempAtHeatPeak; - state.dataSingleDuct->ZoneDesHumRatSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneHumRatAtHeatPeak; + Real64 DesZoneHeatLoad = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).NonAirSysDesHeatLoad; + Real64 ZoneDesTemp = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneTempAtHeatPeak; + Real64 ZoneDesHumRat = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneHumRatAtHeatPeak; // the coil load is the zone design heating load plus (or minus!) the reheat load - state.dataSingleDuct->DesCoilLoadSS = - state.dataSingleDuct->DesZoneHeatLoadSS + PsyCpAirFnW(state.dataSingleDuct->ZoneDesHumRatSS) * DesMassFlow * - (state.dataSingleDuct->ZoneDesTempSS - state.dataSingleDuct->CoilInTempSS); - if (state.dataSingleDuct->DesCoilLoadSS >= SmallLoad) { + DesCoilLoad = DesZoneHeatLoad + PsyCpAirFnW(ZoneDesHumRat) * DesMassFlow * (ZoneDesTemp - CoilInTemp); + if (DesCoilLoad >= SmallLoad) { rho = state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); @@ -3129,8 +3129,7 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) Cp = state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum) .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); - MaxReheatWaterVolFlowDes = - state.dataSingleDuct->DesCoilLoadSS / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); + MaxReheatWaterVolFlowDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); } else { MaxReheatWaterVolFlowDes = 0.0; } @@ -3205,35 +3204,29 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) CheckZoneSizing(state, this->sysType, this->SysName); if (this->reheatCoilType == HVAC::CoilType::HeatingSteam) { // Why are these state variables? - state.dataSingleDuct->CoilSteamInletNodeSS = SteamCoils::GetCoilSteamInletNode(state, this->ReheatCoilNum); - state.dataSingleDuct->CoilSteamOutletNodeSS = SteamCoils::GetCoilSteamOutletNode(state, this->ReheatCoilNum); + int CoilSteamInletNode = SteamCoils::GetCoilSteamInletNode(state, this->ReheatCoilNum); + int CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, this->ReheatCoilNum); if (IsAutoSize) { PlantSizingErrorsFound = false; PltSizHeatNum = MyPlantSizingIndex(state, HVAC::coilTypeNames[(int)this->reheatCoilType], this->ReheatCoilName, - state.dataSingleDuct->CoilSteamInletNodeSS, - state.dataSingleDuct->CoilSteamOutletNodeSS, + CoilSteamInletNode, + CoilSteamOutletNode, PlantSizingErrorsFound); if (PlantSizingErrorsFound) { ShowContinueError(state, format("...Occurs in {}:{}", this->sysType, this->SysName)); ErrorsFound = true; } if (PltSizHeatNum > 0) { - state.dataSingleDuct->CoilInTempSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesHeatCoilInTempTU; + Real64 CoilInTemp = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesHeatCoilInTempTU; DesMassFlow = state.dataEnvrn->StdRhoAir * TermUnitSizing(state.dataSize->CurTermUnitSizingNum).AirVolFlow; - state.dataSingleDuct->DesZoneHeatLoadSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).NonAirSysDesHeatLoad; - state.dataSingleDuct->ZoneDesTempSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneTempAtHeatPeak; - state.dataSingleDuct->ZoneDesHumRatSS = - state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneHumRatAtHeatPeak; + Real64 DesZoneHeatLoad = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).NonAirSysDesHeatLoad; + Real64 ZoneDesTemp = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneTempAtHeatPeak; + Real64 ZoneDesHumRat = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneHumRatAtHeatPeak; // the coil load is the zone design heating load plus (or minus!) the reheat load - state.dataSingleDuct->DesCoilLoadSS = - state.dataSingleDuct->DesZoneHeatLoadSS + PsyCpAirFnW(state.dataSingleDuct->ZoneDesHumRatSS) * DesMassFlow * - (state.dataSingleDuct->ZoneDesTempSS - state.dataSingleDuct->CoilInTempSS); - if (state.dataSingleDuct->DesCoilLoadSS >= SmallLoad) { + DesCoilLoad = DesZoneHeatLoad + PsyCpAirFnW(ZoneDesHumRat) * DesMassFlow * (ZoneDesTemp - CoilInTemp); + if (DesCoilLoad >= SmallLoad) { TempSteamIn = 100.00; auto *steam = Fluid::GetSteam(state); EnthSteamInDry = steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineNameFull); @@ -3242,7 +3235,7 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) SteamDensity = steam->getSatDensity(state, TempSteamIn, 1.0, RoutineNameFull); Cp = Fluid::GetWater(state)->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp, RoutineName); - MaxReheatSteamVolFlowDes = state.dataSingleDuct->DesCoilLoadSS / + MaxReheatSteamVolFlowDes = DesCoilLoad / (SteamDensity * (LatentHeatSteam + state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp)); } else { MaxReheatSteamVolFlowDes = 0.0; @@ -3293,7 +3286,7 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) TermUnitSizing(state.dataSize->CurTermUnitSizingNum).MinPriFlowFrac = this->ZoneMinAirFracDes * this->ZoneTurndownMinAirFrac; TermUnitSizing(state.dataSize->CurTermUnitSizingNum).MaxHWVolFlow = this->MaxReheatWaterVolFlow; TermUnitSizing(state.dataSize->CurTermUnitSizingNum).MaxSTVolFlow = this->MaxReheatSteamVolFlow; - TermUnitSizing(state.dataSize->CurTermUnitSizingNum).DesHeatingLoad = state.dataSingleDuct->DesCoilLoadSS; // Coil Summary report + TermUnitSizing(state.dataSize->CurTermUnitSizingNum).DesHeatingLoad = DesCoilLoad; // Coil Summary report if (this->reheatCoilType == HVAC::CoilType::HeatingWater) { if (this->DamperHeatingAction == Action::Normal) { WaterCoils::SetCoilDesFlow(state, this->ReheatCoilNum, this->ZoneMinAirFracDes * this->MaxAirVolFlowRate); @@ -5449,55 +5442,46 @@ void CalcATMixer(EnergyPlusData &state, int const SysNum) // Using/Aliasing using Psychrometrics::PsyTdbFnHW; - - state.dataSingleDuct->PriEnthalpyCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).PriInNode).Enthalpy; - state.dataSingleDuct->PriHumRatCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).PriInNode).HumRat; - state.dataSingleDuct->PriTempCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).PriInNode).Temp; - state.dataSingleDuct->PriMassFlowRateCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).PriInNode).MassFlowRate; - - state.dataSingleDuct->SecAirMassFlowRateCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).SecInNode).MassFlowRate; - state.dataSingleDuct->SecAirEnthalpyCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).SecInNode).Enthalpy; - state.dataSingleDuct->SecAirHumRatCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).SecInNode).HumRat; - state.dataSingleDuct->SecAirTempCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).SecInNode).Temp; - - if (state.dataSingleDuct->SysATMixer(SysNum).type == HVAC::MixerType::SupplySide) { - state.dataSingleDuct->MixedAirMassFlowRateCATM = state.dataSingleDuct->SecAirMassFlowRateCATM + state.dataSingleDuct->PriMassFlowRateCATM; + auto &atMixer = state.dataSingleDuct->SysATMixer(SysNum); + auto &priInNode = state.dataLoopNodes->Node(atMixer.PriInNode); + auto &secInNode = state.dataLoopNodes->Node(atMixer.SecInNode); + auto &mixedAirOutNode = state.dataLoopNodes->Node(atMixer.MixedAirOutNode); + + Real64 MixedAirMassFlowRate = 0.0; + Real64 MixedAirEnthalpy = 0.0; + Real64 MixedAirHumRat = 0.0; + Real64 MixedAirTemp = 0.0; + + if (atMixer.type == HVAC::MixerType::SupplySide) { + MixedAirMassFlowRate = secInNode.MassFlowRate + priInNode.MassFlowRate; } else { // for inlet side mixer, the mixed air flow has been set, but we don't know the secondary flow - state.dataSingleDuct->MixedAirMassFlowRateCATM = - state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).MixedAirOutNode).MassFlowRate; - state.dataSingleDuct->SecAirMassFlowRateCATM = - max(state.dataSingleDuct->MixedAirMassFlowRateCATM - state.dataSingleDuct->PriMassFlowRateCATM, 0.0); - state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).SecInNode).MassFlowRate = state.dataSingleDuct->SecAirMassFlowRateCATM; - if (std::abs(state.dataSingleDuct->PriMassFlowRateCATM + state.dataSingleDuct->SecAirMassFlowRateCATM - - state.dataSingleDuct->MixedAirMassFlowRateCATM) > SmallMassFlow) { + MixedAirMassFlowRate = mixedAirOutNode.MassFlowRate; + secInNode.MassFlowRate = max(MixedAirMassFlowRate - priInNode.MassFlowRate, 0.0); + if (std::abs(priInNode.MassFlowRate + secInNode.MassFlowRate - MixedAirMassFlowRate) > SmallMassFlow) { ShowSevereError( state, - format("CalcATMixer: Invalid mass flow rates in AirTerminal:SingleDuct:Mixer={}", state.dataSingleDuct->SysATMixer(SysNum).Name)); + format("CalcATMixer: Invalid mass flow rates in AirTerminal:SingleDuct:Mixer={}", atMixer.Name)); ShowContinueErrorTimeStamp(state, format("Primary mass flow rate={:.6R}Secondary mass flow rate={:.6R}Mixed mass flow rate={:.6R}", - state.dataSingleDuct->PriMassFlowRateCATM, - state.dataSingleDuct->SecAirMassFlowRateCATM, - state.dataSingleDuct->MixedAirMassFlowRateCATM)); + priInNode.MassFlowRate, + secInNode.MassFlowRate, + MixedAirMassFlowRate)); ShowFatalError(state, "Simulation terminates."); } } // now calculate the mixed (outlet) conditions - if (state.dataSingleDuct->MixedAirMassFlowRateCATM > 0.0) { - state.dataSingleDuct->MixedAirEnthalpyCATM = (state.dataSingleDuct->SecAirMassFlowRateCATM * state.dataSingleDuct->SecAirEnthalpyCATM + - state.dataSingleDuct->PriMassFlowRateCATM * state.dataSingleDuct->PriEnthalpyCATM) / - state.dataSingleDuct->MixedAirMassFlowRateCATM; - state.dataSingleDuct->MixedAirHumRatCATM = (state.dataSingleDuct->SecAirMassFlowRateCATM * state.dataSingleDuct->SecAirHumRatCATM + - state.dataSingleDuct->PriMassFlowRateCATM * state.dataSingleDuct->PriHumRatCATM) / - state.dataSingleDuct->MixedAirMassFlowRateCATM; + if (MixedAirMassFlowRate > 0.0) { + MixedAirEnthalpy = (secInNode.MassFlowRate * secInNode.Enthalpy + priInNode.MassFlowRate * priInNode.Enthalpy) / MixedAirMassFlowRate; + MixedAirHumRat = (secInNode.MassFlowRate * secInNode.HumRat + priInNode.MassFlowRate * priInNode.HumRat) / MixedAirMassFlowRate; // Mixed air temperature is calculated from the mixed air enthalpy and humidity ratio. - state.dataSingleDuct->MixedAirTempCATM = PsyTdbFnHW(state.dataSingleDuct->MixedAirEnthalpyCATM, state.dataSingleDuct->MixedAirHumRatCATM); + MixedAirTemp = PsyTdbFnHW(MixedAirEnthalpy, MixedAirHumRat); } - state.dataSingleDuct->SysATMixer(SysNum).MixedAirMassFlowRate = state.dataSingleDuct->MixedAirMassFlowRateCATM; - state.dataSingleDuct->SysATMixer(SysNum).MixedAirEnthalpy = state.dataSingleDuct->MixedAirEnthalpyCATM; - state.dataSingleDuct->SysATMixer(SysNum).MixedAirHumRat = state.dataSingleDuct->MixedAirHumRatCATM; - state.dataSingleDuct->SysATMixer(SysNum).MixedAirTemp = state.dataSingleDuct->MixedAirTempCATM; + atMixer.MixedAirMassFlowRate = MixedAirMassFlowRate; + atMixer.MixedAirEnthalpy = MixedAirEnthalpy; + atMixer.MixedAirHumRat = MixedAirHumRat; + atMixer.MixedAirTemp = MixedAirTemp; } void UpdateATMixer(EnergyPlusData &state, int const SysNum) @@ -5512,45 +5496,41 @@ void UpdateATMixer(EnergyPlusData &state, int const SysNum) // Using/Aliasing using namespace DataLoopNode; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PriInNode = state.dataSingleDuct->SysATMixer(SysNum).PriInNode; - int SecInNode = state.dataSingleDuct->SysATMixer(SysNum).SecInNode; - int MixedAirOutNode = state.dataSingleDuct->SysATMixer(SysNum).MixedAirOutNode; + auto &atMixer = state.dataSingleDuct->SysATMixer(SysNum); + auto &priInNode = state.dataLoopNodes->Node(atMixer.PriInNode); + auto &secInNode = state.dataLoopNodes->Node(atMixer.SecInNode); + auto &mixedAirOutNode = state.dataLoopNodes->Node(atMixer.MixedAirOutNode); // mixed air data - state.dataLoopNodes->Node(MixedAirOutNode).Temp = state.dataSingleDuct->SysATMixer(SysNum).MixedAirTemp; - state.dataLoopNodes->Node(MixedAirOutNode).HumRat = state.dataSingleDuct->SysATMixer(SysNum).MixedAirHumRat; - state.dataLoopNodes->Node(MixedAirOutNode).Enthalpy = state.dataSingleDuct->SysATMixer(SysNum).MixedAirEnthalpy; - state.dataLoopNodes->Node(MixedAirOutNode).Press = state.dataSingleDuct->SysATMixer(SysNum).MixedAirPressure; - state.dataLoopNodes->Node(MixedAirOutNode).MassFlowRate = state.dataSingleDuct->SysATMixer(SysNum).MixedAirMassFlowRate; + mixedAirOutNode.Temp = atMixer.MixedAirTemp; + mixedAirOutNode.HumRat = atMixer.MixedAirHumRat; + mixedAirOutNode.Enthalpy = atMixer.MixedAirEnthalpy; + mixedAirOutNode.Press = atMixer.MixedAirPressure; + mixedAirOutNode.MassFlowRate = atMixer.MixedAirMassFlowRate; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - if (state.dataSingleDuct->SysATMixer(SysNum).MixedAirMassFlowRate <= HVAC::VerySmallMassFlow) { - state.dataLoopNodes->Node(MixedAirOutNode).CO2 = state.dataLoopNodes->Node(PriInNode).CO2; + if (atMixer.MixedAirMassFlowRate <= HVAC::VerySmallMassFlow) { + mixedAirOutNode.CO2 = priInNode.CO2; } else { - state.dataLoopNodes->Node(MixedAirOutNode).CO2 = - (state.dataLoopNodes->Node(SecInNode).MassFlowRate * state.dataLoopNodes->Node(SecInNode).CO2 + - state.dataLoopNodes->Node(PriInNode).MassFlowRate * state.dataLoopNodes->Node(PriInNode).CO2) / - state.dataLoopNodes->Node(MixedAirOutNode).MassFlowRate; + mixedAirOutNode.CO2 = + (secInNode.MassFlowRate * secInNode.CO2 + priInNode.MassFlowRate * priInNode.CO2) / mixedAirOutNode.MassFlowRate; } } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - if (state.dataSingleDuct->SysATMixer(SysNum).MixedAirMassFlowRate <= HVAC::VerySmallMassFlow) { - state.dataLoopNodes->Node(MixedAirOutNode).GenContam = state.dataLoopNodes->Node(PriInNode).GenContam; + if (atMixer.MixedAirMassFlowRate <= HVAC::VerySmallMassFlow) { + mixedAirOutNode.GenContam = priInNode.GenContam; } else { - state.dataLoopNodes->Node(MixedAirOutNode).GenContam = - (state.dataLoopNodes->Node(SecInNode).MassFlowRate * state.dataLoopNodes->Node(SecInNode).GenContam + - state.dataLoopNodes->Node(PriInNode).MassFlowRate * state.dataLoopNodes->Node(PriInNode).GenContam) / - state.dataLoopNodes->Node(MixedAirOutNode).MassFlowRate; + mixedAirOutNode.GenContam = + (secInNode.MassFlowRate * secInNode.GenContam + priInNode.MassFlowRate * priInNode.GenContam) / mixedAirOutNode.MassFlowRate; } } // update ADU flow data - because SimATMixer is called from the various zone equipment so the updates in SimZoneAirLoopEquipment won't work - int aduNum = state.dataSingleDuct->SysATMixer(SysNum).ADUNum; - state.dataDefineEquipment->AirDistUnit(aduNum).MassFlowRateTU = state.dataLoopNodes->Node(PriInNode).MassFlowRate; - state.dataDefineEquipment->AirDistUnit(aduNum).MassFlowRateZSup = state.dataLoopNodes->Node(PriInNode).MassFlowRate; - state.dataDefineEquipment->AirDistUnit(aduNum).MassFlowRateSup = state.dataLoopNodes->Node(PriInNode).MassFlowRate; + int aduNum = atMixer.ADUNum; + state.dataDefineEquipment->AirDistUnit(aduNum).MassFlowRateTU = priInNode.MassFlowRate; + state.dataDefineEquipment->AirDistUnit(aduNum).MassFlowRateZSup = priInNode.MassFlowRate; + state.dataDefineEquipment->AirDistUnit(aduNum).MassFlowRateSup = priInNode.MassFlowRate; } void GetATMixer(EnergyPlusData &state, diff --git a/src/EnergyPlus/SingleDuct.hh b/src/EnergyPlus/SingleDuct.hh index e82b5a3d797..f8272f86a65 100644 --- a/src/EnergyPlus/SingleDuct.hh +++ b/src/EnergyPlus/SingleDuct.hh @@ -369,17 +369,7 @@ struct SingleDuctData : BaseGlobalStruct int MaxNumsGSI = 0; // Maximum number of numeric input fields int MaxAlphasGSI = 0; // Maximum number of alpha input fields int TotalArgsGSI = 0; // Total number of alpha and numeric arguments = max for a - Real64 CoilInTempSS = 0.0; - Real64 DesCoilLoadSS = 0.0; - Real64 DesZoneHeatLoadSS = 0.0; - Real64 ZoneDesTempSS = 0.0; - Real64 ZoneDesHumRatSS = 0.0; - int CoilWaterInletNodeSS = 0; - int CoilWaterOutletNodeSS = 0; - int CoilSteamInletNodeSS = 0; - int CoilSteamOutletNodeSS = 0; Fluid::GlycolProps *water = nullptr; - Real64 UserInputMaxHeatAirVolFlowRateSS = 0.0; // user input for MaxHeatAirVolFlowRate Real64 MinAirMassFlowRevActSVAV = 0.0; // minimum air mass flow rate used in "reverse action" air mass flow rate calculation Real64 MaxAirMassFlowRevActSVAV = 0.0; // maximum air mass flow rate used in "reverse action" air mass flow rate calculation Real64 ZoneTempSCBVAV = 0.0; // zone air temperature [C] @@ -396,20 +386,6 @@ struct SingleDuctData : BaseGlobalStruct Real64 ZoneTempSCV = 0.0; // Zone temperature [C] Real64 QMax2SCV = 0.0; int SysNumSATM = 0; - Real64 PriMassFlowRateCATM = 0.0; - Real64 PriEnthalpyCATM = 0.0; - Real64 PriHumRatCATM = 0.0; - Real64 PriTempCATM = 0.0; - - Real64 SecAirMassFlowRateCATM = 0.0; - Real64 SecAirEnthalpyCATM = 0.0; - Real64 SecAirHumRatCATM = 0.0; - Real64 SecAirTempCATM = 0.0; - - Real64 MixedAirMassFlowRateCATM = 0.0; - Real64 MixedAirEnthalpyCATM = 0.0; - Real64 MixedAirHumRatCATM = 0.0; - Real64 MixedAirTempCATM = 0.0; Real64 ZoneTempSDAT = 0.0; // zone air temperature [C] Real64 MaxHeatTempSDAT = 0.0; // maximum supply air temperature [C] From 7d0558070838ff8f00efa6fb6347de82c3afa03e Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Fri, 28 Mar 2025 17:15:43 -0400 Subject: [PATCH 06/12] Fix another regression issue --- src/EnergyPlus/FanCoilUnits.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index ace23468796..1591d9311e7 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -1854,12 +1854,14 @@ namespace FanCoilUnits { WaterCoils::SetCoilDesFlow(state, fanCoil.CoolCoilNum, state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow); - WaterCoils::SetCoilDesFlow(state, - fanCoil.HeatCoilNum, - state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow); + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SetCoilDesFlow(state, fanCoil.HeatCoilNum, state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow); + } } else { WaterCoils::SetCoilDesFlow(state, fanCoil.CoolCoilNum, fanCoil.MaxAirVolFlow); - WaterCoils::SetCoilDesFlow(state, fanCoil.HeatCoilNum, fanCoil.MaxAirVolFlow); + if (fanCoil.heatCoilType == HVAC::CoilType::HeatingWater) { + WaterCoils::SetCoilDesFlow(state, fanCoil.HeatCoilNum, fanCoil.MaxAirVolFlow); + } } if (state.dataSize->CurZoneEqNum > 0) { zoneEqSizing.MaxHWVolFlow = fanCoil.MaxHotWaterVolFlow; From 12ddab2e06bd92c9db99462ca2ad9d7f377484b9 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 29 Mar 2025 19:25:58 -0400 Subject: [PATCH 07/12] Fix issue with autosized water coil showing User-Specified and crash with IHP --- src/EnergyPlus/WaterCoils.cc | 14 +++++++++++++- src/EnergyPlus/WaterCoils.hh | 1 + src/EnergyPlus/WaterThermalTanks.cc | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index feaafac065e..d087ecc544a 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -719,7 +719,11 @@ void GetWaterCoilInput(EnergyPlusData &state) waterCoil.MaxWaterVolFlowRate = NumArray(1); // Liquid mass flow rate at Design kg/s if (waterCoil.MaxWaterVolFlowRate == DataSizing::AutoSize) waterCoil.RequestingAutoSize = true; waterCoil.DesAirVolFlowRate = NumArray(2); // Dry air mass flow rate at Design (kg/s) - if (waterCoil.DesAirVolFlowRate == DataSizing::AutoSize) waterCoil.RequestingAutoSize = true; + if (waterCoil.DesAirVolFlowRate == DataSizing::AutoSize) { + waterCoil.RequestingAutoSize = true; + } else { + waterCoil.DesAirVolFlowRateIsAutosized = false; + } waterCoil.DesInletWaterTemp = NumArray(3); // Entering water temperature at Design C if (waterCoil.DesInletWaterTemp == DataSizing::AutoSize) waterCoil.RequestingAutoSize = true; waterCoil.DesInletAirTemp = NumArray(4); // Entering air dry bulb temperature at Design(C) @@ -2222,6 +2226,12 @@ void SizeWaterCoil(EnergyPlusData &state, int const CoilNum) } else { bPRINT = true; } + if (waterCoil.DesAirVolFlowRateIsAutosized && waterCoil.DesAirVolFlowRate > 0.0) { + state.dataSize->DataConstantUsedForSizing = 1.0; + state.dataSize->DataFractionUsedForSizing = waterCoil.DesAirVolFlowRate; + waterCoil.DesAirVolFlowRate = DataSizing::AutoSize; + } else { + } TempSize = waterCoil.DesAirVolFlowRate; CoolingAirFlowSizer sizingCoolingAirFlow2; std::string stringOverride = "Design Air Flow Rate [m3/s]"; @@ -2231,6 +2241,8 @@ void SizeWaterCoil(EnergyPlusData &state, int const CoilNum) sizingCoolingAirFlow2.initializeWithinEP(state, HVAC::coilTypeNames[(int)waterCoil.coilType], CompName, bPRINT, RoutineName); waterCoil.DesAirVolFlowRate = sizingCoolingAirFlow2.size(state, TempSize, ErrorsFound); waterCoil.DesAirMassFlowRate = waterCoil.DesAirVolFlowRate * state.dataEnvrn->StdRhoAir; + state.dataSize->DataConstantUsedForSizing = 0.0; + state.dataSize->DataFractionUsedForSizing = 0.0; if (waterCoil.DesAirVolFlowRate <= 0.0) { waterCoil.DesAirVolFlowRate = 0.0; diff --git a/src/EnergyPlus/WaterCoils.hh b/src/EnergyPlus/WaterCoils.hh index b188589aaf5..95c03a719c3 100644 --- a/src/EnergyPlus/WaterCoils.hh +++ b/src/EnergyPlus/WaterCoils.hh @@ -147,6 +147,7 @@ namespace WaterCoils { // Design Input Variables to the Design Detailed Simple inputs model Real64 DesInletWaterTemp; // Entering water temperature at Design(C) Real64 DesAirVolFlowRate; // Entering Air Volume Flow Rate Design( m3/s) + bool DesAirVolFlowRateIsAutosized = true; Real64 DesInletAirTemp; // Entering air dry bulb temperature at Design(C) Real64 DesInletAirHumRat; // Entering air humidity ratio at design conditions Real64 DesTotWaterCoilLoad; // Total heat transfer rate at Design(Watt) diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index efbe3a54112..cd8c02cf131 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -8838,7 +8838,7 @@ void WaterThermalTankData::CalcHeatPumpWaterHeater(EnergyPlusData &state, bool c } // pass node info and simulate crankcase heater if (MaxSpeedNum > 0) { - int VSCoilNum = (HeatPump.bIsIHP) ? state.dataIntegratedHP->IntegratedHeatPumps(VSCoilNum).SCWHCoilNum : HeatPump.DXCoilNum; + int VSCoilNum = (HeatPump.bIsIHP) ? state.dataIntegratedHP->IntegratedHeatPumps(HeatPump.DXCoilNum).SCWHCoilNum : HeatPump.DXCoilNum; // set the SCWH mode Real64 SpeedRatio = 1.0; // speed ratio for interpolating between two speed levels From c9b71200a053c4d7a815abfad89c65f10abd3bb5 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 30 Mar 2025 13:45:48 -0400 Subject: [PATCH 08/12] Fix several diffs --- .../Autosizing/CoolingAirFlowSizing.cc | 24 +++++++++---------- src/EnergyPlus/DXCoils.cc | 6 ++--- src/EnergyPlus/Furnaces.cc | 6 +++-- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 2 +- src/EnergyPlus/WaterCoils.cc | 1 - 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc index b124fd21ed7..13028475cef 100644 --- a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc @@ -355,18 +355,18 @@ Real64 CoolingAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, b this->sizingString = "cooling_supply_air_flow_rate [m3/s]"; } } - if (this->dataScalableSizingON) { - if (this->zoneAirFlowSizMethod == DataSizing::SupplyAirFlowRate || this->zoneAirFlowSizMethod == DataSizing::None) { - this->sizingStringScalable = "(scaled by flow / zone) "; - } else if (this->zoneAirFlowSizMethod == DataSizing::FlowPerFloorArea) { - this->sizingStringScalable = "(scaled by flow / area) "; - } else if (this->zoneAirFlowSizMethod == DataSizing::FractionOfAutosizedCoolingAirflow || - this->zoneAirFlowSizMethod == DataSizing::FractionOfAutosizedHeatingAirflow) { - this->sizingStringScalable = "(scaled by fractional multiplier) "; - } else if (this->zoneAirFlowSizMethod == DataSizing::FlowPerCoolingCapacity || - this->zoneAirFlowSizMethod == DataSizing::FlowPerHeatingCapacity) { - this->sizingStringScalable = "(scaled by flow / capacity) "; - } + } + if (this->dataScalableSizingON) { + if (this->zoneAirFlowSizMethod == DataSizing::SupplyAirFlowRate || this->zoneAirFlowSizMethod == DataSizing::None) { + this->sizingStringScalable = "(scaled by flow / zone) "; + } else if (this->zoneAirFlowSizMethod == DataSizing::FlowPerFloorArea) { + this->sizingStringScalable = "(scaled by flow / area) "; + } else if (this->zoneAirFlowSizMethod == DataSizing::FractionOfAutosizedCoolingAirflow || + this->zoneAirFlowSizMethod == DataSizing::FractionOfAutosizedHeatingAirflow) { + this->sizingStringScalable = "(scaled by fractional multiplier) "; + } else if (this->zoneAirFlowSizMethod == DataSizing::FlowPerCoolingCapacity || + this->zoneAirFlowSizMethod == DataSizing::FlowPerHeatingCapacity) { + this->sizingStringScalable = "(scaled by flow / capacity) "; } } if (this->dataDXCoolsLowSpeedsAutozize) { diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 35e2cf12d6a..a674ee69cc7 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -10498,7 +10498,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - format("{}=\"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", + format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex1, VolFlowperRatedTotCap, @@ -11051,7 +11051,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - format("{}=\"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues...", + format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues...", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex1, VolFlowperRatedTotCap, @@ -13991,7 +13991,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, } ShowRecurringWarningErrorAtEnd( state, - format("{}=\"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues at speed 1...", + format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues at speed 1...", HVAC::coilTypeNames[(int)thisDXCoil.coilType], thisDXCoil.Name), thisDXCoil.ErrIndex1, diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index 037d463781c..d19da6c1e91 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -4743,10 +4743,10 @@ namespace Furnaces { furnace.coolCoilType == HVAC::CoilType::CoolingDXVariableSpeed) { auto const &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.CoolCoilNum); furnace.NumOfSpeedCooling = vsCoil.NumOfSpeeds; - MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); if (furnace.isIHP) { IntegratedHeatPump::SizeIHP(state, furnace.ihpNum); + MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).CoolVolFlowScale = MulSpeedFlowScale; } else { VariableSpeedCoils::SimVariableSpeedCoils(state, @@ -4760,6 +4760,7 @@ namespace Furnaces { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP + MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); } for (Iter = 1; Iter <= furnace.NumOfSpeedCooling; ++Iter) { @@ -4776,10 +4777,10 @@ namespace Furnaces { // IHP object. auto &vsCoil = state.dataVariableSpeedCoils->VarSpeedCoil(furnace.HeatCoilNum); furnace.NumOfSpeedHeating = vsCoil.NumOfSpeeds; - MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); if (furnace.isIHP) { IntegratedHeatPump::SizeIHP(state, furnace.ihpNum); + MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); state.dataIntegratedHP->IntegratedHeatPumps(furnace.ihpNum).HeatVolFlowScale = MulSpeedFlowScale; } else { VariableSpeedCoils::SimVariableSpeedCoils(state, @@ -4793,6 +4794,7 @@ namespace Furnaces { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP + MulSpeedFlowScale = vsCoil.RatedAirVolFlowRate / vsCoil.MSRatedAirVolFlowRate(vsCoil.NormSpedLevel); } for (Iter = 1; Iter <= furnace.NumOfSpeedHeating; ++Iter) { diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index b3f6b0110ce..0d664a4cb74 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -3497,7 +3497,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) DXCoils::SetCoilCondenserType(state, vrfTU.CoolCoilNum, vrfCondenser.CondenserType); DXCoils::SetCoilCondenserInletNode(state, vrfTU.CoolCoilNum, vrfCondenser.CondenserNodeNum); DXCoils::SetCoilMaxOATCrankcaseHeater(state, vrfTU.CoolCoilNum, vrfCondenser.MaxOATCCHeater); - DXCoils::SetCoilOATCoolingInfo(state, vrfTU.CoolCoilNum, vrfCondenser.MinOATCooling, vrfCondenser.MinOATCooling); + DXCoils::SetCoilOATCoolingInfo(state, vrfTU.CoolCoilNum, vrfCondenser.MinOATCooling, vrfCondenser.MaxOATCooling); } } } diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index d087ecc544a..19bcf3cbf1d 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -2230,7 +2230,6 @@ void SizeWaterCoil(EnergyPlusData &state, int const CoilNum) state.dataSize->DataConstantUsedForSizing = 1.0; state.dataSize->DataFractionUsedForSizing = waterCoil.DesAirVolFlowRate; waterCoil.DesAirVolFlowRate = DataSizing::AutoSize; - } else { } TempSize = waterCoil.DesAirVolFlowRate; CoolingAirFlowSizer sizingCoolingAirFlow2; From 7c2af2ee92cd476db2b74278ea5d79615143e0ff Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 30 Mar 2025 18:37:03 -0400 Subject: [PATCH 09/12] Update ATMixer condition only when mass flow > 0 --- src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 2 +- src/EnergyPlus/SingleDuct.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index 014636c5936..5176a3f6c8f 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -996,7 +996,7 @@ namespace HXAssistCoil { ShowContinueErrorTimeStamp(state, ""); } else { ShowRecurringWarningErrorAtEnd(state, - format("{}=\"{}\" -- Exceeded max iterations error continues...", + format("{} \"{}\" -- Exceeded max iterations error continues...", HVAC::coilTypeNames[(int)hxCoil.coilType], hxCoil.Name), hxCoil.MaxIterIndex); diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index 6c3dd41108c..5fdde02d879 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -5476,12 +5476,12 @@ void CalcATMixer(EnergyPlusData &state, int const SysNum) MixedAirHumRat = (secInNode.MassFlowRate * secInNode.HumRat + priInNode.MassFlowRate * priInNode.HumRat) / MixedAirMassFlowRate; // Mixed air temperature is calculated from the mixed air enthalpy and humidity ratio. MixedAirTemp = PsyTdbFnHW(MixedAirEnthalpy, MixedAirHumRat); + atMixer.MixedAirEnthalpy = MixedAirEnthalpy; // <-- move these up inside mass flow > 0 + atMixer.MixedAirHumRat = MixedAirHumRat; // <-- move these up + atMixer.MixedAirTemp = MixedAirTemp; // <-- move these up } atMixer.MixedAirMassFlowRate = MixedAirMassFlowRate; - atMixer.MixedAirEnthalpy = MixedAirEnthalpy; - atMixer.MixedAirHumRat = MixedAirHumRat; - atMixer.MixedAirTemp = MixedAirTemp; } void UpdateATMixer(EnergyPlusData &state, int const SysNum) From 4a722402aea196b6e5ea462a2f42a3630a0373c7 Mon Sep 17 00:00:00 2001 From: rraustad Date: Mon, 31 Mar 2025 11:38:27 -0400 Subject: [PATCH 10/12] Fix HXAssisted control issue with new DX coil model --- src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 2 +- src/EnergyPlus/SingleDuct.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index 5176a3f6c8f..49655d0075c 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -940,8 +940,8 @@ namespace HXAssistCoil { state.dataCoilCoolingDX->coilCoolingDXs[hxCoil.CoolCoilNum].simulate(state, coilMode, // partially implemented for HXAssistedCoil - CoilPLR, // PartLoadRatio, mCoolingSpeedNum, + CoilPLR, fanOp, singleMode); // diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index 5fdde02d879..ee0ec99ff9b 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -5476,9 +5476,9 @@ void CalcATMixer(EnergyPlusData &state, int const SysNum) MixedAirHumRat = (secInNode.MassFlowRate * secInNode.HumRat + priInNode.MassFlowRate * priInNode.HumRat) / MixedAirMassFlowRate; // Mixed air temperature is calculated from the mixed air enthalpy and humidity ratio. MixedAirTemp = PsyTdbFnHW(MixedAirEnthalpy, MixedAirHumRat); - atMixer.MixedAirEnthalpy = MixedAirEnthalpy; // <-- move these up inside mass flow > 0 - atMixer.MixedAirHumRat = MixedAirHumRat; // <-- move these up - atMixer.MixedAirTemp = MixedAirTemp; // <-- move these up + atMixer.MixedAirEnthalpy = MixedAirEnthalpy; + atMixer.MixedAirHumRat = MixedAirHumRat; + atMixer.MixedAirTemp = MixedAirTemp; } atMixer.MixedAirMassFlowRate = MixedAirMassFlowRate; From 660c666750d7e8e064df63253506922853c04b45 Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Thu, 10 Apr 2025 17:24:47 -0400 Subject: [PATCH 11/12] Small changes --- src/EnergyPlus/SingleDuct.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index 5fdde02d879..322a8c28170 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -5453,10 +5453,10 @@ void CalcATMixer(EnergyPlusData &state, int const SysNum) Real64 MixedAirTemp = 0.0; if (atMixer.type == HVAC::MixerType::SupplySide) { - MixedAirMassFlowRate = secInNode.MassFlowRate + priInNode.MassFlowRate; + atMixer.MixedAirMassFlowRate = secInNode.MassFlowRate + priInNode.MassFlowRate; } else { // for inlet side mixer, the mixed air flow has been set, but we don't know the secondary flow - MixedAirMassFlowRate = mixedAirOutNode.MassFlowRate; + atMixer.MixedAirMassFlowRate = mixedAirOutNode.MassFlowRate; secInNode.MassFlowRate = max(MixedAirMassFlowRate - priInNode.MassFlowRate, 0.0); if (std::abs(priInNode.MassFlowRate + secInNode.MassFlowRate - MixedAirMassFlowRate) > SmallMassFlow) { ShowSevereError( @@ -5470,18 +5470,14 @@ void CalcATMixer(EnergyPlusData &state, int const SysNum) ShowFatalError(state, "Simulation terminates."); } } - // now calculate the mixed (outlet) conditions - if (MixedAirMassFlowRate > 0.0) { - MixedAirEnthalpy = (secInNode.MassFlowRate * secInNode.Enthalpy + priInNode.MassFlowRate * priInNode.Enthalpy) / MixedAirMassFlowRate; - MixedAirHumRat = (secInNode.MassFlowRate * secInNode.HumRat + priInNode.MassFlowRate * priInNode.HumRat) / MixedAirMassFlowRate; + + // now calculate the mixed (outlet) conditions, these are updated only if MixedAirMaxFlowRate > 0 + if (atMixer.MixedAirMassFlowRate > 0.0) { + atMixer.MixedAirEnthalpy = (secInNode.MassFlowRate * secInNode.Enthalpy + priInNode.MassFlowRate * priInNode.Enthalpy) / atMixer.MixedAirMassFlowRate; + atMixer.MixedAirHumRat = (secInNode.MassFlowRate * secInNode.HumRat + priInNode.MassFlowRate * priInNode.HumRat) / atMixer.MixedAirMassFlowRate; // Mixed air temperature is calculated from the mixed air enthalpy and humidity ratio. - MixedAirTemp = PsyTdbFnHW(MixedAirEnthalpy, MixedAirHumRat); - atMixer.MixedAirEnthalpy = MixedAirEnthalpy; // <-- move these up inside mass flow > 0 - atMixer.MixedAirHumRat = MixedAirHumRat; // <-- move these up - atMixer.MixedAirTemp = MixedAirTemp; // <-- move these up + atMixer.MixedAirTemp = PsyTdbFnHW(MixedAirEnthalpy, MixedAirHumRat); } - - atMixer.MixedAirMassFlowRate = MixedAirMassFlowRate; } void UpdateATMixer(EnergyPlusData &state, int const SysNum) From 8da63cf0a30f56e46688135106f519567ee3e036 Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Sat, 17 May 2025 19:34:43 -0400 Subject: [PATCH 12/12] Fix one issue, and one hypothetical (by inspection) issue --- src/EnergyPlus/ReportCoilSelection.cc | 6 +----- src/EnergyPlus/UnitVentilator.cc | 2 +- src/EnergyPlus/WaterCoils.cc | 8 +++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/ReportCoilSelection.cc b/src/EnergyPlus/ReportCoilSelection.cc index 3708fe33214..65f52f20de0 100644 --- a/src/EnergyPlus/ReportCoilSelection.cc +++ b/src/EnergyPlus/ReportCoilSelection.cc @@ -1092,11 +1092,7 @@ void setCoilEntAirTemp(EnergyPlusData &state, ) { int index = getReportIndex(state, coilName, coilType); - auto *c = state.dataRptCoilSelection->coils[index]; - c->coilDesEntTemp = entAirDryBulbTemp; - c->airloopNum = curSysNum; - doAirLoopSetup(state, index); - c->zoneEqNum = curZoneEqNum; + setCoilEntAirTemp(state, index, entAirDryBulbTemp, curSysNum, curZoneEqNum); } void setCoilEntAirTemp(EnergyPlusData &state, diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index 83cef78da24..63ba31bccbf 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -2162,7 +2162,7 @@ namespace UnitVentilator { unitVent.coolCoilType == HVAC::CoilType::CoolingWaterDetailed) { WaterCoils::SetCoilDesFlow(state, unitVent.CoolCoilNum, unitVent.MaxAirVolFlow); } else if (unitVent.coolCoilType == HVAC::CoilType::CoolingWaterHXAssisted) { - WaterCoils::SetCoilDesFlow(state, unitVent.CoolCoilNum, unitVent.MaxAirVolFlow); + WaterCoils::SetCoilDesFlow(state, unitVent.ChildCoolCoilNum, unitVent.MaxAirVolFlow); } // No DX coils? } diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index 19bcf3cbf1d..72f5b95334a 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -2226,11 +2226,14 @@ void SizeWaterCoil(EnergyPlusData &state, int const CoilNum) } else { bPRINT = true; } +#ifdef GET_OUT + // Not sure how this snuck in here if (waterCoil.DesAirVolFlowRateIsAutosized && waterCoil.DesAirVolFlowRate > 0.0) { state.dataSize->DataConstantUsedForSizing = 1.0; state.dataSize->DataFractionUsedForSizing = waterCoil.DesAirVolFlowRate; waterCoil.DesAirVolFlowRate = DataSizing::AutoSize; } +#endif // GET_OUT TempSize = waterCoil.DesAirVolFlowRate; CoolingAirFlowSizer sizingCoolingAirFlow2; std::string stringOverride = "Design Air Flow Rate [m3/s]"; @@ -2240,9 +2243,12 @@ void SizeWaterCoil(EnergyPlusData &state, int const CoilNum) sizingCoolingAirFlow2.initializeWithinEP(state, HVAC::coilTypeNames[(int)waterCoil.coilType], CompName, bPRINT, RoutineName); waterCoil.DesAirVolFlowRate = sizingCoolingAirFlow2.size(state, TempSize, ErrorsFound); waterCoil.DesAirMassFlowRate = waterCoil.DesAirVolFlowRate * state.dataEnvrn->StdRhoAir; +#ifdef GET_OUT + // Not sure how this snuck in here state.dataSize->DataConstantUsedForSizing = 0.0; state.dataSize->DataFractionUsedForSizing = 0.0; - +#endif // GET_OUT + if (waterCoil.DesAirVolFlowRate <= 0.0) { waterCoil.DesAirVolFlowRate = 0.0; ShowWarningError(state, format("The design air flow rate is zero for {} = {}", HVAC::coilTypeNames[(int)waterCoil.coilType], CompName));