From b0db80055fbb862803a3400098cbaa06ba557f16 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 28 Mar 2024 10:46:56 -0400 Subject: [PATCH 01/21] Upload a fix --- src/EnergyPlus/RoomAirModelManager.cc | 238 +++++++++--------- src/EnergyPlus/RoomAirModelManager.hh | 2 +- .../unit/RoomAirflowNetwork.unit.cc | 160 ++++++++++++ 3 files changed, 280 insertions(+), 120 deletions(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index d7aa8ac9986..4c968a81d1e 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -58,6 +58,7 @@ // EnergyPlus Headers #include +#include #include #include #include @@ -71,19 +72,30 @@ #include #include #include +#include #include #include +#include +#include #include #include #include +#include #include #include +#include #include #include #include #include #include +#include +#include #include +#include +#include +#include +#include #include namespace EnergyPlus { @@ -1635,11 +1647,20 @@ namespace RoomAir { roomAFNNodeHVAC.SupplyFraction = ipsc->rNumericArgs(iEquipArg); roomAFNNodeHVAC.ReturnFraction = ipsc->rNumericArgs(iEquipArg); + // get equipment index + int EquipIndex = 0; + for (int thisZoneEquipNum = 1; thisZoneEquipNum <= state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes; + ++thisZoneEquipNum) { + if (Util::SameString(state.dataZoneEquip->ZoneEquipList(iZone).EquipName(thisZoneEquipNum), roomAFNNodeHVAC.Name)) { + EquipIndex = state.dataZoneEquip->ZoneEquipList(iZone).EquipIndex(thisZoneEquipNum); + break; + } + } IntEquipError = CheckEquipName(state, roomAFNNodeHVAC.Name, roomAFNNodeHVAC.SupplyNodeName, roomAFNNodeHVAC.ReturnNodeName, - TotNumEquip, + EquipIndex, roomAFNNodeHVAC.zoneEquipType); if (!IntEquipError) { @@ -2676,7 +2697,7 @@ namespace RoomAir { std::string const &EquipName, // Equipment Name std::string &SupplyNodeName, // Supply node name std::string &ReturnNodeName, // Return node name - int TotNumEquip, // how many of this equipment type + int EquipIndex, // Equipment index DataZoneEquipment::ZoneEquipType zoneEquipType) { @@ -2693,210 +2714,188 @@ namespace RoomAir { using Fans::GetFanOutletNode; // Return value - bool EquipFind; // True if an error is found + bool EquipFind = false; // if true, equip is found - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int NumAlphas; - int NumNumbers; - int Status; // Used in GetObjectItem - int MaxNums = 0; // Maximum number of numeric input fields - int MaxAlphas = 0; // Maximum number of alpha input fields - int TotalArgs = 0; // Total number of alpha and numeric arguments(max) for a - Array1D_string Alphas; // Alpha input items for object - Array1D Numbers; // Numeric input items for object bool errorfound; - - NumAlphas = 1; - NumNumbers = 1; - EquipFind = false; + int SupplyNodeNum = 0; + int ReturnNodeNum = 0; SupplyNodeName = ""; if (zoneEquipType == DataZoneEquipment::ZoneEquipType::Invalid) return EquipFind; - std::string_view equipTypeName = DataZoneEquipment::zoneEquipTypeNamesUC[(int)zoneEquipType]; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, equipTypeName, TotalArgs, NumAlphas, NumNumbers); - - MaxNums = max(MaxNums, NumNumbers); - MaxAlphas = max(MaxAlphas, NumAlphas); - - if (MaxNums > NumNumbers) { - Numbers.allocate(MaxNums); - Numbers = 0.0; - } else if (!allocated(Numbers)) { - Numbers.allocate(MaxNums); - } - - if (MaxAlphas > NumAlphas) { - Alphas.allocate(MaxAlphas); - Alphas = ""; - } else if (!allocated(Alphas)) { - Alphas.allocate(NumAlphas); - } - - for (int I = 1; I <= TotNumEquip; ++I) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, equipTypeName, I, Alphas, NumAlphas, Numbers, NumNumbers, Status); - if (Util::SameString(Alphas(1), EquipName)) { - EquipFind = true; - break; - } - } - switch (zoneEquipType) { case DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal: { // ZoneHVAC:TerminalUnit : VariableRefrigerantFlow - SupplyNodeName = Alphas(4); - ReturnNodeName = ""; // Zone return node + SupplyNodeNum = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { // ZoneHVAC : EnergyRecoveryVentilator - int nodeNum = GetFanOutletNode(state, "Fan:OnOff", Alphas(4), errorfound); - if (errorfound) { - } - SupplyNodeName = state.dataLoopNodes->NodeID(nodeNum); // ????? - ReturnNodeName = ""; // Zone exhaust node + SupplyNodeNum = GetFanOutletNode(state, "Fan:OnOff", EquipName, errorfound); } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil - SupplyNodeName = Alphas(6); - ReturnNodeName = Alphas(5); + SupplyNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode; + ReturnNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirInNode; } break; case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit - SupplyNodeName = Alphas(13); - ReturnNodeName = Alphas(14); + SupplyNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirOutletNode; + ReturnNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner - SupplyNodeName = Alphas(4); - ReturnNodeName = Alphas(3); + SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); + ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump: { // ZoneHVAC : PackagedTerminalHeatPump - SupplyNodeName = Alphas(4); - ReturnNodeName = Alphas(3); + SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); + ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); } break; case DataZoneEquipment::ZoneEquipType::UnitHeater: { // ZoneHVAC : UnitHeater - SupplyNodeName = Alphas(4); - ReturnNodeName = Alphas(3); + ReturnNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirInNode; + SupplyNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::UnitVentilator: { // ZoneHVAC : UnitVentilator - SupplyNodeName = Alphas(7); - ReturnNodeName = Alphas(6); + ReturnNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirInNode; + SupplyNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::VentilatedSlab: { // ZoneHVAC : VentilatedSlab - SupplyNodeName = Alphas(20); - ReturnNodeName = Alphas(18); + ReturnNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode; + SupplyNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ZoneAirInNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // ZoneHVAC : WaterToAirHeatPump - SupplyNodeName = Alphas(4); - ReturnNodeName = Alphas(3); + SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); + ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); } break; case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // ZoneHVAC : WindowAirConditioner - SupplyNodeName = Alphas(4); - ReturnNodeName = Alphas(3); + ReturnNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirInNode; + SupplyNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::BaseboardElectric: { // ZoneHVAC : Baseboard : RadiantConvective : Electric + // convective equipment without node connection. Will handle later SupplyNodeName = ""; // convection only } break; case DataZoneEquipment::ZoneEquipType::BaseboardWater: { // ZoneHVAC : Baseboard : RadiantConvective : Water + // convective equipment without node connection. Will handle later SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::BaseboardSteam: { // ZoneHVAC : Baseboard : RadiantConvective : Steam + // convective equipment without node connection. Will handle later SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric: { // ZoneHVAC : Baseboard : Convective : Electric + // convective equipment without node connection. Will handle later SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater: { // ZoneHVAC : Baseboard : Convective : Water + // convective equipment without node connection. Will handle later SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant: { // ZoneHVAC : HighTemperatureRadiant + // Radiative equipment without node connection. Will handle later SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::DehumidifierDX: { // ZoneHVAC : Dehumidifier : DX - SupplyNodeName = Alphas(4); - ReturnNodeName = Alphas(3); + ReturnNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirInletNodeNum; + SupplyNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirOutletNodeNum; } break; case DataZoneEquipment::ZoneEquipType::PurchasedAir: { // ZoneHVAC : IdealLoadsAirSystem - SupplyNodeName = Alphas(3); - ReturnNodeName = Alphas(4); + ReturnNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneExhaustAirNodeNum; + SupplyNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneSupplyAirNodeNum; } break; case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet: { // ZoneHVAC : RefrigerationChillerSet - SupplyNodeName = Alphas(5); - ReturnNodeName = Alphas(4); + // May not apply + // SupplyNodeName = Alphas(5); + // ReturnNodeName = Alphas(4); } break; case DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler: { // ZoneHVAC : HybridUnitaryAirConditioners - SupplyNodeName = Alphas(11); - ReturnNodeName = Alphas(9); + ReturnNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).InletNode; + SupplyNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).OutletNode; } break; case DataZoneEquipment::ZoneEquipType::ExhaustFan: { // Fan : ZoneExhaust - SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use + + // SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use } break; case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: { // WaterHeater : HeatPump - SupplyNodeName = Alphas(8); - ReturnNodeName = Alphas(7); + ReturnNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirInletNode; + SupplyNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirOutletNode; // For AirTerminals, find matching return node later } break; case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctConstantVolume: { // AirTerminal : DualDuct : ConstantVolume - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctVAV: { // AirTerminal : DualDuct : VAV - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctConstantVolumeReheat: { // AirTerminal : SingleDuct : ConstantVolume : Reheat - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctConstantVolumeNoReheat: { // AirTerminal : SingleDuct : - // ConstantVolume : NoReheat - SupplyNodeName = Alphas(4); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(4); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVReheat: { // AirTerminal : SingleDuct : VAV : Reheat - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVNoReheat: { // AirTerminal : SingleDuct : VAV : NoReheat - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctSeriesPIUReheat: { // AirTerminal : SingleDuct : SeriesPIU : Reheat - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctParallelPIUReheat: { // AirTerminal : SingleDuct : ParallelPIU : Reheat - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctCAVFourPipeInduction: { // AirTerminal : SingleDuct : - // ConstantVolume : FourPipeInduction - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // ConstantVolume : FourPipeInduction + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVReheatVariableSpeedFan: { // AirTerminal : SingleDuct : VAV - // : Reheat : VariableSpeedFan - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // : Reheat : VariableSpeedFan + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVHeatAndCoolReheat: { // AirTerminal : SingleDuct : VAV : // HeatAndCool : Reheat - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVHeatAndCoolNoReheat: { // AirTerminal : SingleDuct : VAV : // HeatAndCool : NoReheat - SupplyNodeName = Alphas(1); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(1); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctConstantVolumeCooledBeam: { // AirTerminal : SingleDuct : // ConstantVolume : CooledBeam - SupplyNodeName = Alphas(5); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(5); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctVAVOutdoorAir: { // AirTerminal : DualDuct : VAV : OutdoorAir - SupplyNodeName = Alphas(3); - ReturnNodeName = ""; + // Air teminal components are handled later + // SupplyNodeName = Alphas(3); + // ReturnNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::AirLoopHVACReturnAir: { // AirLoopHVACReturnAir - SupplyNodeName = Alphas(4); // - ReturnNodeName = ""; // + // Air teminal components are handled later + // SupplyNodeName = Alphas(4); // + // ReturnNodeName = ""; // } break; default: { assert(false); @@ -2904,14 +2903,15 @@ namespace RoomAir { } // switch - // Need to find a better to handle allocate and deallocate - if (MaxAlphas > NumAlphas) { - Alphas.deallocate(); + if (SupplyNodeNum > 0) { + SupplyNodeName = state.dataLoopNodes->NodeID(SupplyNodeNum); + EquipFind = true; } - if (MaxNums > NumNumbers) { - Numbers.deallocate(); + if (ReturnNodeNum > 0) { + ReturnNodeName = state.dataLoopNodes->NodeID(ReturnNodeNum); + } else { + ReturnNodeName = ""; } - return EquipFind; } diff --git a/src/EnergyPlus/RoomAirModelManager.hh b/src/EnergyPlus/RoomAirModelManager.hh index 3b5f3b9751d..bf030e7fdd0 100644 --- a/src/EnergyPlus/RoomAirModelManager.hh +++ b/src/EnergyPlus/RoomAirModelManager.hh @@ -89,7 +89,7 @@ namespace RoomAir { std::string const &EquipName, // Equipment Name std::string &SupplyNodeName, // Supply node name std::string &ReturnNodeName, // Return node name - int TotNumEquip, // how many of this equipment type + int EquipIndex, // Equipment index DataZoneEquipment::ZoneEquipType zoneEquipType); // equipment type number } // namespace RoomAir diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 17e86e9a5c0..7393e698b6d 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -53,6 +53,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" #include +#include #include #include #include @@ -67,14 +68,34 @@ #include #include #include +#include +#include +#include +#include #include +#include +#include +#include #include #include +#include +#include +#include #include +#include #include #include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -579,3 +600,142 @@ TEST_F(EnergyPlusFixture, RoomAirInternalGains_InternalHeatGains_Check) EXPECT_TRUE(compare_err_stream(error_string, true)); } + +TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) +{ + // Test #6321 + bool check; + std::string const EquipName = "ZoneEquip"; + std::string SupplyNodeName; + std::string ReturnNodeName; + int TotNumEquip = 1; + int EquipIndex = 1; // Equipment index + DataZoneEquipment::ZoneEquipType zoneEquipType; + + state->dataLoopNodes->NodeID.allocate(2); + state->dataLoopNodes->Node.allocate(2); + state->dataLoopNodes->NodeID(1) = "SupplyNode"; + state->dataLoopNodes->NodeID(2) = "ReturnNode"; + + state->dataHVACVarRefFlow->GetVRFInputFlag = false; + state->dataHVACVarRefFlow->VRFTU.allocate(1); + state->dataHVACVarRefFlow->VRFTU(1).VRFTUOutletNodeNum = 1; + + zoneEquipType = DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal; + state->dataHVACVarRefFlow->NumVRFTU = 1; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator; + state->dataFans->GetFanInputFlag = false; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).FanName = EquipName; + state->dataFans->Fan(1).OutletNodeNum = 1; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::FourPipeFanCoil; + state->dataFanCoilUnits->FanCoil.allocate(1); + state->dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode = 1; + state->dataFanCoilUnits->FanCoil(EquipIndex).AirInNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::OutdoorAirUnit; + state->dataOutdoorAirUnit->OutAirUnit.allocate(1); + state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirOutletNode = 1; + state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner; + UnitarySystems::UnitarySys thisUnit; + state->dataUnitarySystems->unitarySys.push_back(thisUnit); + state->dataUnitarySystems->getInputOnceFlag = false; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].Name = EquipName; + state->dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump; + // UnitarySystems::UnitarySys thisUnit; + // state->dataUnitarySystems->unitarySys.push_back(thisUnit); + state->dataUnitarySystems->getInputOnceFlag = false; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].Name = EquipName; + state->dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir; + // UnitarySystems::UnitarySys thisUnit; + // state->dataUnitarySystems->unitarySys.push_back(thisUnit); + state->dataUnitarySystems->getInputOnceFlag = false; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].Name = EquipName; + state->dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; + state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::UnitHeater; + state->dataUnitHeaters->UnitHeat.allocate(1); + state->dataUnitHeaters->UnitHeat(EquipIndex).AirOutNode = 1; + state->dataUnitHeaters->UnitHeat(EquipIndex).AirInNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::UnitVentilator; + state->dataUnitVentilators->UnitVent.allocate(1); + state->dataUnitVentilators->UnitVent(EquipIndex).AirOutNode = 1; + state->dataUnitVentilators->UnitVent(EquipIndex).AirInNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::VentilatedSlab; + state->dataVentilatedSlab->VentSlab.allocate(1); + state->dataVentilatedSlab->VentSlab(EquipIndex).ZoneAirInNode = 1; + state->dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } + + zoneEquipType = DataZoneEquipment::ZoneEquipType::WindowAirConditioner; + state->dataWindowAC->WindAC.allocate(1); + state->dataWindowAC->WindAC(EquipIndex).AirOutNode = 1; + state->dataWindowAC->WindAC(EquipIndex).AirInNode = 2; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("ReturnNode", ReturnNodeName); + } +} From c7628e5035fcafe238083c5b596c57de8ec72821 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 28 Mar 2024 11:27:28 -0400 Subject: [PATCH 02/21] Clang format --- tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 7393e698b6d..c2fa7ba3407 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -72,8 +72,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -89,14 +89,14 @@ #include #include #include -#include #include #include +#include #include #include #include -#include #include +#include #include using namespace EnergyPlus; From 29251076a079f06e841baf55a75ec3ecf35b8219 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 28 Mar 2024 15:00:43 -0400 Subject: [PATCH 03/21] Different node names --- .../unit/RoomAirflowNetwork.unit.cc | 58 +++++++++++++------ 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index c2fa7ba3407..4d789a28e83 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -628,6 +628,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) EXPECT_EQ("SupplyNode", SupplyNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode1"; + state->dataLoopNodes->NodeID(2) = "ReturnNode1"; zoneEquipType = DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator; state->dataFans->GetFanInputFlag = false; state->dataFans->Fan.allocate(1); @@ -635,29 +637,35 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataFans->Fan(1).OutletNodeNum = 1; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); + EXPECT_EQ("SupplyNode1", SupplyNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode2"; + state->dataLoopNodes->NodeID(2) = "ReturnNode2"; zoneEquipType = DataZoneEquipment::ZoneEquipType::FourPipeFanCoil; state->dataFanCoilUnits->FanCoil.allocate(1); state->dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode = 1; state->dataFanCoilUnits->FanCoil(EquipIndex).AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode2", SupplyNodeName); + EXPECT_EQ("ReturnNode2", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode3"; + state->dataLoopNodes->NodeID(2) = "ReturnNode3"; zoneEquipType = DataZoneEquipment::ZoneEquipType::OutdoorAirUnit; state->dataOutdoorAirUnit->OutAirUnit.allocate(1); state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirOutletNode = 1; state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode3", SupplyNodeName); + EXPECT_EQ("ReturnNode3", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode4"; + state->dataLoopNodes->NodeID(2) = "ReturnNode4"; zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner; UnitarySystems::UnitarySys thisUnit; state->dataUnitarySystems->unitarySys.push_back(thisUnit); @@ -668,10 +676,12 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode4", SupplyNodeName); + EXPECT_EQ("ReturnNode4", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode5"; + state->dataLoopNodes->NodeID(2) = "ReturnNode5"; zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump; // UnitarySystems::UnitarySys thisUnit; // state->dataUnitarySystems->unitarySys.push_back(thisUnit); @@ -682,9 +692,11 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode5", SupplyNodeName); + EXPECT_EQ("ReturnNode5", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode6"; + state->dataLoopNodes->NodeID(2) = "ReturnNode6"; zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir; // UnitarySystems::UnitarySys thisUnit; // state->dataUnitarySystems->unitarySys.push_back(thisUnit); @@ -695,47 +707,55 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode6", SupplyNodeName); + EXPECT_EQ("ReturnNode6", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode7"; + state->dataLoopNodes->NodeID(2) = "ReturnNode7"; zoneEquipType = DataZoneEquipment::ZoneEquipType::UnitHeater; state->dataUnitHeaters->UnitHeat.allocate(1); state->dataUnitHeaters->UnitHeat(EquipIndex).AirOutNode = 1; state->dataUnitHeaters->UnitHeat(EquipIndex).AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode7", SupplyNodeName); + EXPECT_EQ("ReturnNode7", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode8"; + state->dataLoopNodes->NodeID(2) = "ReturnNode8"; zoneEquipType = DataZoneEquipment::ZoneEquipType::UnitVentilator; state->dataUnitVentilators->UnitVent.allocate(1); state->dataUnitVentilators->UnitVent(EquipIndex).AirOutNode = 1; state->dataUnitVentilators->UnitVent(EquipIndex).AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode8", SupplyNodeName); + EXPECT_EQ("ReturnNode8", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode9"; + state->dataLoopNodes->NodeID(2) = "ReturnNode9"; zoneEquipType = DataZoneEquipment::ZoneEquipType::VentilatedSlab; state->dataVentilatedSlab->VentSlab.allocate(1); state->dataVentilatedSlab->VentSlab(EquipIndex).ZoneAirInNode = 1; state->dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode9", SupplyNodeName); + EXPECT_EQ("ReturnNode9", ReturnNodeName); } + state->dataLoopNodes->NodeID(1) = "SupplyNode10"; + state->dataLoopNodes->NodeID(2) = "ReturnNode10"; zoneEquipType = DataZoneEquipment::ZoneEquipType::WindowAirConditioner; state->dataWindowAC->WindAC.allocate(1); state->dataWindowAC->WindAC(EquipIndex).AirOutNode = 1; state->dataWindowAC->WindAC(EquipIndex).AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - EXPECT_EQ("ReturnNode", ReturnNodeName); + EXPECT_EQ("SupplyNode10", SupplyNodeName); + EXPECT_EQ("ReturnNode10", ReturnNodeName); } } From ab7cdb48f2ffde91816b3679f8bba72618e5fbcc Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 2 May 2024 15:48:08 -0400 Subject: [PATCH 04/21] Address comments --- src/EnergyPlus/FanCoilUnits.cc | 22 ++++++ src/EnergyPlus/FanCoilUnits.hh | 2 + src/EnergyPlus/PurchasedAirManager.cc | 15 ++++ src/EnergyPlus/PurchasedAirManager.hh | 2 + src/EnergyPlus/RoomAirModelManager.cc | 49 +++++++------ src/EnergyPlus/UnitHeater.cc | 33 +++++++++ src/EnergyPlus/UnitHeater.hh | 3 + src/EnergyPlus/VentilatedSlab.cc | 31 ++++++++ src/EnergyPlus/VentilatedSlab.hh | 4 + src/EnergyPlus/WaterThermalTanks.cc | 30 ++++++++ src/EnergyPlus/WaterThermalTanks.hh | 4 + src/EnergyPlus/ZoneDehumidifier.cc | 30 ++++++++ src/EnergyPlus/ZoneDehumidifier.hh | 4 + .../unit/RoomAirflowNetwork.unit.cc | 73 +++++++++++++++++++ 14 files changed, 278 insertions(+), 24 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index a0aee8a8243..f2895c5f470 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -4221,6 +4221,28 @@ namespace FanCoilUnits { return 0; } + int GetFanCoilAirInNode(EnergyPlusData &state, int const FanCoilNum) + { + + // FUNCTION INFORMATION: + // AUTHOR B Griffith + // DATE WRITTEN Dec 2006 + + // PURPOSE OF THIS FUNCTION: + // lookup function for OA inlet node for ventilation rate reporting + + if (state.dataFanCoilUnits->GetFanCoilInputFlag) { + GetFanCoilUnits(state); + state.dataFanCoilUnits->GetFanCoilInputFlag = false; + } + + if (FanCoilNum > 0 && FanCoilNum <= state.dataFanCoilUnits->NumFanCoils) { + return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirInNode; + } + + return 0; + } + int GetFanCoilOutAirNode(EnergyPlusData &state, int const FanCoilNum) { diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 300a6dd400a..931b397dbe6 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -322,6 +322,8 @@ namespace FanCoilUnits { int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int FanCoilNum); + int GetFanCoilAirInNode(EnergyPlusData &state, int FanCoilNum); + int GetFanCoilOutAirNode(EnergyPlusData &state, int FanCoilNum); int GetFanCoilReturnAirNode(EnergyPlusData &state, int FanCoilNum); diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index 162961ae20f..11788a042cc 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -3327,6 +3327,21 @@ int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int const PurchAirNum) return GetPurchasedAirReturnAirNode; } +int GetPurchasedAirZoneExhaustAirNode(EnergyPlusData &state, int PurchAirNum) +{ + if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { + GetPurchasedAir(state); + state.dataPurchasedAirMgr->GetPurchAirInputFlag = false; + } + + int GetPurchasedAirZoneExhaustAirNode = 0; + if (PurchAirNum > 0 && PurchAirNum <= state.dataPurchasedAirMgr->NumPurchAir) { + GetPurchasedAirZoneExhaustAirNode = state.dataPurchasedAirMgr->PurchAir(PurchAirNum).ZoneExhaustAirNodeNum; + } + + return GetPurchasedAirZoneExhaustAirNode; +} + Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int const PurchAirNum) { diff --git a/src/EnergyPlus/PurchasedAirManager.hh b/src/EnergyPlus/PurchasedAirManager.hh index d2351e18c95..b3ab5c618fc 100644 --- a/src/EnergyPlus/PurchasedAirManager.hh +++ b/src/EnergyPlus/PurchasedAirManager.hh @@ -379,6 +379,8 @@ namespace PurchasedAirManager { int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int PurchAirNum); + int GetPurchasedAirZoneExhaustAirNode(EnergyPlusData &state, int PurchAirNum); + Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int PurchAirNum); Real64 GetPurchasedAirMixedAirHumRat(EnergyPlusData &state, int PurchAirNum); diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 4c968a81d1e..96f459c6e09 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1262,7 +1262,7 @@ namespace RoomAir { int TotNumOfRAFNNodeGainsLists; int TotNumOfRAFNNodeHVACLists; int TotNumEquip; - bool IntEquipError; + bool IntEquipFound; auto &ipsc = state.dataIPShortCut; ipsc->cCurrentModuleObject = "RoomAirSettings:AirflowNetwork"; @@ -1651,19 +1651,20 @@ namespace RoomAir { int EquipIndex = 0; for (int thisZoneEquipNum = 1; thisZoneEquipNum <= state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes; ++thisZoneEquipNum) { - if (Util::SameString(state.dataZoneEquip->ZoneEquipList(iZone).EquipName(thisZoneEquipNum), roomAFNNodeHVAC.Name)) { + if (Util::SameString(state.dataZoneEquip->ZoneEquipList(iZone).EquipName(thisZoneEquipNum), roomAFNNodeHVAC.Name) && + roomAFNNodeHVAC.zoneEquipType == state.dataZoneEquip->ZoneEquipList(iZone).EquipType(thisZoneEquipNum)) { EquipIndex = state.dataZoneEquip->ZoneEquipList(iZone).EquipIndex(thisZoneEquipNum); break; } } - IntEquipError = CheckEquipName(state, + IntEquipFound = CheckEquipName(state, roomAFNNodeHVAC.Name, roomAFNNodeHVAC.SupplyNodeName, roomAFNNodeHVAC.ReturnNodeName, EquipIndex, roomAFNNodeHVAC.zoneEquipType); - if (!IntEquipError) { + if (!IntEquipFound) { ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(3 + (iEquip - 1) * 2), @@ -2732,12 +2733,12 @@ namespace RoomAir { SupplyNodeNum = GetFanOutletNode(state, "Fan:OnOff", EquipName, errorfound); } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil - SupplyNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode; - ReturnNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirInNode; + SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state,EquipIndex); + ReturnNodeNum = FanCoilUnits::GetFanCoilAirInNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit - SupplyNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirOutletNode; - ReturnNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode; + SupplyNodeNum = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(state,EquipIndex); + ReturnNodeNum = OutdoorAirUnit::GetOutdoorAirUnitReturnAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); @@ -2748,24 +2749,24 @@ namespace RoomAir { ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); } break; case DataZoneEquipment::ZoneEquipType::UnitHeater: { // ZoneHVAC : UnitHeater - ReturnNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirInNode; - SupplyNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirOutNode; + ReturnNodeNum = UnitHeater::GetUnitHeaterAirInletNode(state, EquipIndex); + SupplyNodeNum = UnitHeater::GetUnitHeaterAirOutletNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::UnitVentilator: { // ZoneHVAC : UnitVentilator - ReturnNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirInNode; - SupplyNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirOutNode; + ReturnNodeNum = UnitVentilator::GetUnitVentilatorReturnAirNode(state, EquipIndex); + SupplyNodeNum = UnitVentilator::GetUnitVentilatorZoneInletAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::VentilatedSlab: { // ZoneHVAC : VentilatedSlab - ReturnNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode; - SupplyNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ZoneAirInNode; + ReturnNodeNum = VentilatedSlab::GetVentilatedSlabReturnAirNode(state, EquipIndex); + SupplyNodeNum = VentilatedSlab::GetVentilatedSlabZoneAirInNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // ZoneHVAC : WaterToAirHeatPump SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); } break; case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // ZoneHVAC : WindowAirConditioner - ReturnNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirInNode; - SupplyNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirOutNode; + ReturnNodeNum = WindowAC::GetWindowACReturnAirNode(state, EquipIndex); + SupplyNodeNum = WindowAC::GetWindowACZoneInletAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::BaseboardElectric: { // ZoneHVAC : Baseboard : RadiantConvective : Electric // convective equipment without node connection. Will handle later @@ -2792,12 +2793,12 @@ namespace RoomAir { SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::DehumidifierDX: { // ZoneHVAC : Dehumidifier : DX - ReturnNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirInletNodeNum; - SupplyNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirOutletNodeNum; + ReturnNodeNum = ZoneDehumidifier::GetZoneDehumidifierAirInletNodeNum(state, EquipIndex); + SupplyNodeNum = ZoneDehumidifier::GetZoneDehumidifierAirOutletNodeNum(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PurchasedAir: { // ZoneHVAC : IdealLoadsAirSystem - ReturnNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneExhaustAirNodeNum; - SupplyNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneSupplyAirNodeNum; + ReturnNodeNum = PurchasedAirManager::GetPurchasedAirZoneExhaustAirNode(state, EquipIndex); + SupplyNodeNum = PurchasedAirManager::GetPurchasedAirZoneInletAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet: { // ZoneHVAC : RefrigerationChillerSet // May not apply @@ -2805,16 +2806,16 @@ namespace RoomAir { // ReturnNodeName = Alphas(4); } break; case DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler: { // ZoneHVAC : HybridUnitaryAirConditioners - ReturnNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).InletNode; - SupplyNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).OutletNode; + ReturnNodeNum = HybridUnitaryAirConditioners::GetHybridUnitaryACReturnAirNode(state, EquipIndex); + SupplyNodeNum = HybridUnitaryAirConditioners::GetHybridUnitaryACZoneInletNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::ExhaustFan: { // Fan : ZoneExhaust // SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use } break; case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: { // WaterHeater : HeatPump - ReturnNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirInletNode; - SupplyNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirOutletNode; + ReturnNodeNum = WaterThermalTanks::GetHeatPumpWaterHeaterAirInletNodeNum(state, EquipIndex); + SupplyNodeNum = WaterThermalTanks::GetHeatPumpWaterHeaterAirOutletNodeNum(state, EquipIndex); // For AirTerminals, find matching return node later } break; case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctConstantVolume: { // AirTerminal : DualDuct : ConstantVolume diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index 89859c180b3..9407d59945b 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -2023,6 +2023,39 @@ namespace UnitHeater { } } + int GetUnitHeaterAirOutletNode(EnergyPlusData &state, int UnitHeaterNum) + { + // Return value + int GetUnitHeaterAirOutletNode = 0; + + if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { + GetUnitHeaterInput(state); + state.dataUnitHeaters->GetUnitHeaterInputFlag = false; + } + + if (UnitHeaterNum > 0 && UnitHeaterNum <= state.dataUnitHeaters->NumOfUnitHeats) { + GetUnitHeaterAirOutletNode = state.dataUnitHeaters->UnitHeat(UnitHeaterNum).AirOutNode; + } + + return GetUnitHeaterAirOutletNode; + } + + int GetUnitHeaterAirInletNode(EnergyPlusData &state, int UnitHeaterNum) + { + int GetUnitHeaterAirInletNode = 0; + + if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { + GetUnitHeaterInput(state); + state.dataUnitHeaters->GetUnitHeaterInputFlag = false; + } + + if (UnitHeaterNum > 0 && UnitHeaterNum <= state.dataUnitHeaters->NumOfUnitHeats) { + GetUnitHeaterAirInletNode = state.dataUnitHeaters->UnitHeat(UnitHeaterNum).AirInNode; + } + + return GetUnitHeaterAirInletNode; + } + } // namespace UnitHeater } // namespace EnergyPlus diff --git a/src/EnergyPlus/UnitHeater.hh b/src/EnergyPlus/UnitHeater.hh index 33e9950cdf9..f78b2d6f7ae 100644 --- a/src/EnergyPlus/UnitHeater.hh +++ b/src/EnergyPlus/UnitHeater.hh @@ -203,6 +203,9 @@ namespace UnitHeater { void ReportUnitHeater(EnergyPlusData &state, int const UnitHeatNum); // Unit index in unit heater array + int GetUnitHeaterAirOutletNode(EnergyPlusData &state, int OAUnitNum); + + int GetUnitHeaterAirInletNode(EnergyPlusData &state, int OAUnitNum); } // namespace UnitHeater struct UnitHeatersData : BaseGlobalStruct diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 6e50944431f..1954642d413 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -4761,6 +4761,37 @@ namespace VentilatedSlab { } } + int GetVentilatedSlabReturnAirNode(EnergyPlusData &state, int const VentSlabNum) + { + int ReturnAirNode = 0; + if (state.dataVentilatedSlab->GetInputFlag) { + GetVentilatedSlabInput(state); + state.dataVentilatedSlab->GetInputFlag = false; + } + + if (VentSlabNum > 0 && VentSlabNum <= state.dataVentilatedSlab->NumOfVentSlabs) { + ReturnAirNode = state.dataVentilatedSlab->VentSlab(VentSlabNum).ReturnAirNode; + } + + return ReturnAirNode; + } + + int GetVentilatedSlabZoneAirInNode(EnergyPlusData &state, int const VentSlabNum) + { + int ZoneAirInNode = 0; + + if (state.dataVentilatedSlab->GetInputFlag) { + GetVentilatedSlabInput(state); + state.dataVentilatedSlab->GetInputFlag = false; + } + + if (VentSlabNum > 0 && VentSlabNum <= state.dataVentilatedSlab->NumOfVentSlabs) { + ZoneAirInNode = state.dataVentilatedSlab->VentSlab(VentSlabNum).ZoneAirInNode; + } + + return ZoneAirInNode; + } + //***************************************************************************************** } // namespace VentilatedSlab diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index 276d487f058..a889522a110 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -383,6 +383,10 @@ namespace VentilatedSlab { void ReportVentilatedSlab(EnergyPlusData &state, int const Item); // Index for the ventilated slab under consideration within the derived types + int GetVentilatedSlabReturnAirNode(EnergyPlusData &state, int const VentSlabNum); + + int GetVentilatedSlabZoneAirInNode(EnergyPlusData &state, int const VentSlabNum); + //***************************************************************************************** } // namespace VentilatedSlab diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index fd0a2527d4e..019e7411770 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -12625,4 +12625,34 @@ bool GetHeatPumpWaterHeaterNodeNumber(EnergyPlusData &state, int const NodeNumbe return HeatPumpWaterHeaterNodeException; } +int GetHeatPumpWaterHeaterAirInletNodeNum(EnergyPlusData &state, int HPNum) +{ + int HeatPumpWaterHeaterAirInletNodeNum = 0; + if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { + GetWaterThermalTankInput(state); + state.dataWaterThermalTanks->getWaterThermalTankInputFlag = false; + } + + if (HPNum > 0 && HPNum <= state.dataWaterThermalTanks->numHeatPumpWaterHeater) { + HeatPumpWaterHeaterAirInletNodeNum = state.dataWaterThermalTanks->HPWaterHeater(HPNum).HeatPumpAirInletNode; + } + + return HeatPumpWaterHeaterAirInletNodeNum; +} + +int GetHeatPumpWaterHeaterAirOutletNodeNum(EnergyPlusData &state, int HPNum) +{ + int HeatPumpWaterHeaterAirOutletNodeNum = 0; + if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { + GetWaterThermalTankInput(state); + state.dataWaterThermalTanks->getWaterThermalTankInputFlag = false; + } + + if (HPNum > 0 && HPNum <= state.dataWaterThermalTanks->numHeatPumpWaterHeater) { + HeatPumpWaterHeaterAirOutletNodeNum = state.dataWaterThermalTanks->HPWaterHeater(HPNum).HeatPumpAirOutletNode; + } + + return HeatPumpWaterHeaterAirOutletNodeNum; +} + } // namespace EnergyPlus::WaterThermalTanks diff --git a/src/EnergyPlus/WaterThermalTanks.hh b/src/EnergyPlus/WaterThermalTanks.hh index 27a488f56c3..fc7bae1b424 100644 --- a/src/EnergyPlus/WaterThermalTanks.hh +++ b/src/EnergyPlus/WaterThermalTanks.hh @@ -989,6 +989,10 @@ namespace WaterThermalTanks { bool GetHeatPumpWaterHeaterNodeNumber(EnergyPlusData &state, int NodeNumber); + int GetHeatPumpWaterHeaterAirInletNodeNum(EnergyPlusData &state, int HPNum); + + int GetHeatPumpWaterHeaterAirOutletNodeNum(EnergyPlusData &state, int HPNum); + } // namespace WaterThermalTanks struct WaterThermalTanksData : BaseGlobalStruct diff --git a/src/EnergyPlus/ZoneDehumidifier.cc b/src/EnergyPlus/ZoneDehumidifier.cc index 95aa88d1a5a..b2689917565 100644 --- a/src/EnergyPlus/ZoneDehumidifier.cc +++ b/src/EnergyPlus/ZoneDehumidifier.cc @@ -1181,6 +1181,36 @@ namespace ZoneDehumidifier { return FindZoneDehumidifierNodeNumber; } + int GetZoneDehumidifierAirOutletNodeNum(EnergyPlusData &state, int ZoneDehumidNum) + { + int ZoneDehumidifierAirOutletNodeNum = 0; + if (state.dataZoneDehumidifier->GetInputFlag) { + GetZoneDehumidifierInput(state); + state.dataZoneDehumidifier->GetInputFlag = false; + } + + if (ZoneDehumidNum > 0 && ZoneDehumidNum <= (int)state.dataZoneDehumidifier->ZoneDehumid.size()) { + ZoneDehumidifierAirOutletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidNum).AirOutletNodeNum; + } + + return ZoneDehumidifierAirOutletNodeNum; + } + + int GetZoneDehumidifierAirInletNodeNum(EnergyPlusData &state, int ZoneDehumidNum) + { + int ZoneDehumidifierAirInletNodeNum = 0; + if (state.dataZoneDehumidifier->GetInputFlag) { + GetZoneDehumidifierInput(state); + state.dataZoneDehumidifier->GetInputFlag = false; + } + + if (ZoneDehumidNum > 0 && ZoneDehumidNum <= (int)state.dataZoneDehumidifier->ZoneDehumid.size()) { + ZoneDehumidifierAirInletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidNum).AirInletNodeNum; + } + + return ZoneDehumidifierAirInletNodeNum; + } + } // namespace ZoneDehumidifier } // namespace EnergyPlus diff --git a/src/EnergyPlus/ZoneDehumidifier.hh b/src/EnergyPlus/ZoneDehumidifier.hh index 0444b8b91f2..6da985a515f 100644 --- a/src/EnergyPlus/ZoneDehumidifier.hh +++ b/src/EnergyPlus/ZoneDehumidifier.hh @@ -153,6 +153,10 @@ namespace ZoneDehumidifier { bool GetZoneDehumidifierNodeNumber(EnergyPlusData &state, int NodeNumber); // Node being tested + int GetZoneDehumidifierAirOutletNodeNum(EnergyPlusData &state, int ZoneDehumidNum); + + int GetZoneDehumidifierAirInletNodeNum(EnergyPlusData &state, int ZoneDehumidNum); + } // namespace ZoneDehumidifier struct ZoneDehumidifierData : BaseGlobalStruct diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 4d789a28e83..c5feb4ae39c 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -646,6 +647,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataFanCoilUnits->FanCoil.allocate(1); state->dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode = 1; state->dataFanCoilUnits->FanCoil(EquipIndex).AirInNode = 2; + state->dataFanCoilUnits->NumFanCoils = 1; + state->dataFanCoilUnits->GetFanCoilInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode2", SupplyNodeName); @@ -658,6 +661,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataOutdoorAirUnit->OutAirUnit.allocate(1); state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirOutletNode = 1; state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode = 2; + state->dataOutdoorAirUnit->NumOfOAUnits = 1; + state->dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode3", SupplyNodeName); @@ -717,6 +722,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitHeaters->UnitHeat.allocate(1); state->dataUnitHeaters->UnitHeat(EquipIndex).AirOutNode = 1; state->dataUnitHeaters->UnitHeat(EquipIndex).AirInNode = 2; + state->dataUnitHeaters->NumOfUnitHeats = 1; + state->dataUnitHeaters->GetUnitHeaterInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode7", SupplyNodeName); @@ -729,6 +736,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitVentilators->UnitVent.allocate(1); state->dataUnitVentilators->UnitVent(EquipIndex).AirOutNode = 1; state->dataUnitVentilators->UnitVent(EquipIndex).AirInNode = 2; + state->dataUnitVentilators->NumOfUnitVents = 1; + state->dataUnitVentilators->GetUnitVentilatorInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode8", SupplyNodeName); @@ -741,6 +750,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataVentilatedSlab->VentSlab.allocate(1); state->dataVentilatedSlab->VentSlab(EquipIndex).ZoneAirInNode = 1; state->dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode = 2; + state->dataVentilatedSlab->NumOfVentSlabs = 1; + state->dataVentilatedSlab->GetInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode9", SupplyNodeName); @@ -753,9 +764,71 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataWindowAC->WindAC.allocate(1); state->dataWindowAC->WindAC(EquipIndex).AirOutNode = 1; state->dataWindowAC->WindAC(EquipIndex).AirInNode = 2; + state->dataWindowAC->WindAC(EquipIndex).OAMixIndex = 1; + state->dataWindowAC->NumWindAC = 1; + state->dataWindowAC->GetWindowACInputFlag = false; + state->dataMixedAir->NumOAMixers = 1; + state->dataMixedAir->OAMixer.allocate(1); + state->dataMixedAir->OAMixer(1).RetNode = 2; + state->dataMixedAir->GetOAMixerInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode10", SupplyNodeName); EXPECT_EQ("ReturnNode10", ReturnNodeName); } + + state->dataLoopNodes->NodeID(1) = "SupplyNode11"; + state->dataLoopNodes->NodeID(2) = "ReturnNode11"; + zoneEquipType = DataZoneEquipment::ZoneEquipType::DehumidifierDX; + state->dataZoneDehumidifier->ZoneDehumid.allocate(1); + state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirOutletNodeNum = 1; + state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirInletNodeNum = 2; + state->dataZoneDehumidifier->GetInputFlag = false; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode11", SupplyNodeName); + EXPECT_EQ("ReturnNode11", ReturnNodeName); + } + + state->dataLoopNodes->NodeID(1) = "SupplyNode12"; + state->dataLoopNodes->NodeID(2) = "ReturnNode12"; + zoneEquipType = DataZoneEquipment::ZoneEquipType::PurchasedAir; + state->dataPurchasedAirMgr->PurchAir.allocate(1); + state->dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneSupplyAirNodeNum = 1; + state->dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneExhaustAirNodeNum = 2; + state->dataPurchasedAirMgr->NumPurchAir = 1; + state->dataPurchasedAirMgr->GetPurchAirInputFlag = false; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode12", SupplyNodeName); + EXPECT_EQ("ReturnNode12", ReturnNodeName); + } + + state->dataLoopNodes->NodeID(1) = "SupplyNode13"; + state->dataLoopNodes->NodeID(2) = "ReturnNode13"; + zoneEquipType = DataZoneEquipment::ZoneEquipType::PurchasedAir; + state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner.allocate(1); + state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).OutletNode = 1; + state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).InletNode = 2; + state->dataHybridUnitaryAC->NumZoneHybridEvap = 1; + state->dataHybridUnitaryAC->GetInputZoneHybridEvap = false; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode13", SupplyNodeName); + EXPECT_EQ("ReturnNode13", ReturnNodeName); + } + + state->dataLoopNodes->NodeID(1) = "SupplyNode14"; + state->dataLoopNodes->NodeID(2) = "ReturnNode14"; + zoneEquipType = DataZoneEquipment::ZoneEquipType::PurchasedAir; + state->dataWaterThermalTanks->HPWaterHeater.allocate(1); + state->dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirOutletNode = 1; + state->dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirInletNode = 2; + state->dataWaterThermalTanks->numHeatPumpWaterHeater = 1; + state->dataWaterThermalTanks->getWaterThermalTankInputFlag = false; + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + if (check) { + EXPECT_EQ("SupplyNode14", SupplyNodeName); + EXPECT_EQ("ReturnNode14", ReturnNodeName); + } } From b989dc0e4031627fe397f2d7f525abd389477605 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 2 May 2024 16:12:27 -0400 Subject: [PATCH 05/21] Clang format --- src/EnergyPlus/RoomAirModelManager.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 4a5a124a4cf..0ec8890ecc5 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2724,21 +2724,19 @@ namespace RoomAir { if (zoneEquipType == DataZoneEquipment::ZoneEquipType::Invalid) return EquipFind; - ErrorObjectHeader eoh{routineName, equipTypeName, EquipName}; - switch (zoneEquipType) { case DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal: { // ZoneHVAC:TerminalUnit : VariableRefrigerantFlow SupplyNodeNum = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { // ZoneHVAC : EnergyRecoveryVentilator - SupplyNodeNum = GetFanOutletNode(state, "Fan:OnOff", EquipName, errorfound); + //SupplyNodeNum = GetFanOutletNode(state, "Fan:OnOff", EquipName, errorfound); } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil - SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state,EquipIndex); + SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state, EquipIndex); ReturnNodeNum = FanCoilUnits::GetFanCoilAirInNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit - SupplyNodeNum = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(state,EquipIndex); + SupplyNodeNum = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(state, EquipIndex); ReturnNodeNum = OutdoorAirUnit::GetOutdoorAirUnitReturnAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner From 73c79b284dbd11b47519f25d372d99a51a8fa415 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 2 May 2024 16:33:50 -0400 Subject: [PATCH 06/21] Clang format --- src/EnergyPlus/RoomAirModelManager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 0ec8890ecc5..3d75e46788e 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2729,7 +2729,7 @@ namespace RoomAir { SupplyNodeNum = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { // ZoneHVAC : EnergyRecoveryVentilator - //SupplyNodeNum = GetFanOutletNode(state, "Fan:OnOff", EquipName, errorfound); + // SupplyNodeNum = GetFanOutletNode(state, "Fan:OnOff", EquipName, errorfound); } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state, EquipIndex); From 32d7e2641bd1f2d226fcfc4a76247fa149ed245f Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Mon, 6 May 2024 10:14:44 -0400 Subject: [PATCH 07/21] Correct a mistake --- src/EnergyPlus/RoomAirModelManager.cc | 3 ++- tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 3d75e46788e..109683cf620 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -75,6 +75,7 @@ #include #include #include +#include #include #include #include @@ -2729,7 +2730,7 @@ namespace RoomAir { SupplyNodeNum = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { // ZoneHVAC : EnergyRecoveryVentilator - // SupplyNodeNum = GetFanOutletNode(state, "Fan:OnOff", EquipName, errorfound); + SupplyNodeNum = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state, EquipIndex); diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index ae365f29cc5..cfb694c8af9 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -633,10 +634,10 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataLoopNodes->NodeID(1) = "SupplyNode1"; state->dataLoopNodes->NodeID(2) = "ReturnNode1"; zoneEquipType = DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator; - state->dataFans->GetFanInputFlag = false; - state->dataFans->Fan.allocate(1); - state->dataFans->Fan(1).FanName = EquipName; - state->dataFans->Fan(1).OutletNodeNum = 1; + state->dataHVACStandAloneERV->GetERVInputFlag = false; + state->dataHVACStandAloneERV->StandAloneERV.allocate(1); + state->dataHVACStandAloneERV->NumStandAloneERVs = 1; + state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirInletNode = 1; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode1", SupplyNodeName); From 1698d9ba650520fe058549abe22562c29664973b Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Wed, 29 May 2024 10:51:35 -0400 Subject: [PATCH 08/21] Add a test file with FanCoil and change code accordingly --- src/EnergyPlus/FanCoilUnits.cc | 18 ++++++++++++++++-- src/EnergyPlus/FanCoilUnits.hh | 4 ++-- src/EnergyPlus/RoomAirModelManager.cc | 20 ++++++++++---------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index f2b342b35d8..fdc3dd3793b 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -4093,7 +4093,7 @@ namespace FanCoilUnits { } } - int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int const FanCoilNum) + int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName) { // FUNCTION INFORMATION: @@ -4112,10 +4112,17 @@ namespace FanCoilUnits { return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirOutNode; } + if (FanCoilNum == 0 && CompName != "") { + FanCoilNum = Util::FindItemInList(CompName, state.dataFanCoilUnits->FanCoil); + if (FanCoilNum == 0) { + ShowFatalError(state, format("SimFanCoil: Unit not found={}", CompName)); + } + return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirOutNode; + } return 0; } - int GetFanCoilAirInNode(EnergyPlusData &state, int const FanCoilNum) + int GetFanCoilAirInNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName) { // FUNCTION INFORMATION: @@ -4134,6 +4141,13 @@ namespace FanCoilUnits { return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirInNode; } + if (FanCoilNum == 0 && CompName != "") { + FanCoilNum = Util::FindItemInList(CompName, state.dataFanCoilUnits->FanCoil); + if (FanCoilNum == 0) { + ShowFatalError(state, format("SimFanCoil: Unit not found={}", CompName)); + } + return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirInNode; + } return 0; } diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 1936bee3e2f..03091b00f32 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -318,9 +318,9 @@ namespace FanCoilUnits { void ReportFanCoilUnit(EnergyPlusData &state, int FanCoilNum); // number of the current fan coil unit being simulated - int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int FanCoilNum); + int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName = ""); - int GetFanCoilAirInNode(EnergyPlusData &state, int FanCoilNum); + int GetFanCoilAirInNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName = ""); int GetFanCoilOutAirNode(EnergyPlusData &state, int FanCoilNum); diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 109683cf620..fd89474081d 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1577,11 +1577,11 @@ namespace RoomAir { } // loop thru TotNumOfRAFNNodeGainsLists // Get data of HVAC equipment - ipsc->cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:HVACEquipment"; - TotNumOfRAFNNodeHVACLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + std::string const cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:HVACEquipment"; + TotNumOfRAFNNodeHVACLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); for (int Loop = 1; Loop <= TotNumOfRAFNNodeHVACLists; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - ipsc->cCurrentModuleObject, + cCurrentModuleObject, Loop, ipsc->cAlphaArgs, NumAlphas, @@ -1593,10 +1593,10 @@ namespace RoomAir { ipsc->cAlphaFieldNames, ipsc->cNumericFieldNames); - ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, ipsc->cAlphaArgs(1)}; if (mod((NumAlphas + NumNumbers - 1), 4) != 0) { - ShowSevereError(state, format("GetRoomAirflowNetworkData: For {}: {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowSevereError(state, format("GetRoomAirflowNetworkData: For {}: {}", cCurrentModuleObject, ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Extensible field set are not evenly divisable by 4. Number of data entries = {}", fmt::to_string(NumAlphas + NumNumbers - 1))); @@ -1619,8 +1619,8 @@ namespace RoomAir { auto &roomAFNNode = roomAFNZoneInfo.Node(RAFNNodeNum); if (allocated(roomAFNNode.HVAC)) { ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("Duplicate {} name.", ipsc->cCurrentModuleObject)); + ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Duplicate {} name.", cCurrentModuleObject)); ErrorsFound = true; continue; } @@ -1670,7 +1670,7 @@ namespace RoomAir { format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(3 + (iEquip - 1) * 2), ipsc->cAlphaArgs(2 + (iEquip - 1) * 2))); - ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, ipsc->cAlphaArgs(1))); ShowContinueError(state, "Internal gain did not match correctly"); ErrorsFound = true; } @@ -2733,8 +2733,8 @@ namespace RoomAir { SupplyNodeNum = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil - SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state, EquipIndex); - ReturnNodeNum = FanCoilUnits::GetFanCoilAirInNode(state, EquipIndex); + SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state, EquipIndex, EquipName); + ReturnNodeNum = FanCoilUnits::GetFanCoilAirInNode(state, EquipIndex, EquipName); } break; case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit SupplyNodeNum = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(state, EquipIndex); From 1d30477420f985284237b91f8ec3d1927dfa106b Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Wed, 29 May 2024 16:07:21 -0400 Subject: [PATCH 09/21] Get correct index for unitary --- src/EnergyPlus/RoomAirModelManager.cc | 15 +++++++++------ src/EnergyPlus/UnitarySystem.cc | 19 +++++++++++++++++++ src/EnergyPlus/UnitarySystem.hh | 2 ++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index fd89474081d..da3cae900e5 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2741,12 +2741,14 @@ namespace RoomAir { ReturnNodeNum = OutdoorAirUnit::GetOutdoorAirUnitReturnAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner - SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); - ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); + EquipIndex = UnitarySystems::getIndex(state, EquipName, zoneEquipType, errorfound); + SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; + ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump: { // ZoneHVAC : PackagedTerminalHeatPump - SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); - ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); + EquipIndex = UnitarySystems::getIndex(state, EquipName, zoneEquipType, errorfound); + SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; + ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::UnitHeater: { // ZoneHVAC : UnitHeater ReturnNodeNum = UnitHeater::GetUnitHeaterAirInletNode(state, EquipIndex); @@ -2761,8 +2763,9 @@ namespace RoomAir { SupplyNodeNum = VentilatedSlab::GetVentilatedSlabZoneAirInNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // ZoneHVAC : WaterToAirHeatPump - SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); - ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); + EquipIndex = UnitarySystems::getIndex(state, EquipName, zoneEquipType, errorfound); + SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; + ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // ZoneHVAC : WindowAirConditioner ReturnNodeNum = WindowAC::GetWindowACReturnAirNode(state, EquipIndex); diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 4cfd27cdd93..e4ee05808fa 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -16581,6 +16581,25 @@ namespace UnitarySystems { return airNode; } + int + getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag) + { + + int EquipIndex = 0; + for (int UnitarySysNum = 0; UnitarySysNum < state.dataUnitarySystems->numUnitarySystems; ++UnitarySysNum) { + if (Util::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) { + if (zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner || + zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump || + zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir) { + EquipIndex = UnitarySysNum; + break; + } + } + } + if (EquipIndex < 0) errFlag = true; + return EquipIndex; + } + int UnitarySys::getAirOutNode(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum, bool &errFlag) { if (state.dataUnitarySystems->getInputOnceFlag) { diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index c3e906298f6..d602f20dc2e 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -966,6 +966,8 @@ namespace UnitarySystems { void setupAllOutputVars(EnergyPlusData &state, int const numAllSystemTypes); void isWaterCoilHeatRecoveryType(EnergyPlusData const &state, int const waterCoilNodeNum, bool &nodeNotFound); + int getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag); + } // namespace UnitarySystems struct UnitarySystemsData : BaseGlobalStruct { From 097c9ed13d9a9705a04651eed813cebb115de7b5 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 30 May 2024 09:20:48 -0400 Subject: [PATCH 10/21] Address further comments --- src/EnergyPlus/UnitarySystem.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index e4ee05808fa..09155500b4d 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -16581,11 +16581,15 @@ namespace UnitarySystems { return airNode; } - int - getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag) + int getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag) { - int EquipIndex = 0; + if (state.dataUnitarySystems->getInputOnceFlag) { + UnitarySystems::UnitarySys::getUnitarySystemInput(state, UnitarySysName, false, 0); + state.dataUnitarySystems->getInputOnceFlag = false; + } + + int EquipIndex = -1; for (int UnitarySysNum = 0; UnitarySysNum < state.dataUnitarySystems->numUnitarySystems; ++UnitarySysNum) { if (Util::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) { if (zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner || From 214ea1dbb202eb8cc27b3392c7d366abebe6c6db Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 30 May 2024 11:39:15 -0400 Subject: [PATCH 11/21] Add one more optional argument --- src/EnergyPlus/RoomAirModelManager.cc | 6 +++--- src/EnergyPlus/UnitarySystem.cc | 8 +++++--- src/EnergyPlus/UnitarySystem.hh | 6 +++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index da3cae900e5..8850e2d63d3 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2741,12 +2741,12 @@ namespace RoomAir { ReturnNodeNum = OutdoorAirUnit::GetOutdoorAirUnitReturnAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner - EquipIndex = UnitarySystems::getIndex(state, EquipName, zoneEquipType, errorfound); + EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump: { // ZoneHVAC : PackagedTerminalHeatPump - EquipIndex = UnitarySystems::getIndex(state, EquipName, zoneEquipType, errorfound); + EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; @@ -2763,7 +2763,7 @@ namespace RoomAir { SupplyNodeNum = VentilatedSlab::GetVentilatedSlabZoneAirInNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // ZoneHVAC : WaterToAirHeatPump - EquipIndex = UnitarySystems::getIndex(state, EquipName, zoneEquipType, errorfound); + EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 09155500b4d..7cbc5a2b83c 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -16581,11 +16581,12 @@ namespace UnitarySystems { return airNode; } - int getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag) + int getZoneEqIndex( + EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag, int const OAUnitNum) { if (state.dataUnitarySystems->getInputOnceFlag) { - UnitarySystems::UnitarySys::getUnitarySystemInput(state, UnitarySysName, false, 0); + UnitarySystems::UnitarySys::getUnitarySystemInput(state, UnitarySysName, false, OAUnitNum); state.dataUnitarySystems->getInputOnceFlag = false; } @@ -16594,7 +16595,8 @@ namespace UnitarySystems { if (Util::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) { if (zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner || zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump || - zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir) { + zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir || + zoneEquipType == DataZoneEquipment::ZoneEquipType::UnitarySystem) { EquipIndex = UnitarySysNum; break; } diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index d602f20dc2e..474ccb6bf5a 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -966,7 +966,11 @@ namespace UnitarySystems { void setupAllOutputVars(EnergyPlusData &state, int const numAllSystemTypes); void isWaterCoilHeatRecoveryType(EnergyPlusData const &state, int const waterCoilNodeNum, bool &nodeNotFound); - int getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag); + int getZoneEqIndex(EnergyPlusData &state, + std::string const &UnitarySysName, + DataZoneEquipment::ZoneEquipType zoneEquipType, + bool &errFlag, + int const OAUnitNum = 0); } // namespace UnitarySystems struct UnitarySystemsData : BaseGlobalStruct From 0a71ac929e588f35e72f774241dac49e4c1a4e66 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 30 May 2024 14:41:28 -0400 Subject: [PATCH 12/21] GetEqIndex for fan coil --- src/EnergyPlus/FanCoilUnits.cc | 37 +++++++++++++++------------ src/EnergyPlus/FanCoilUnits.hh | 5 ++-- src/EnergyPlus/RoomAirModelManager.cc | 5 ++-- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index ad78b4d7889..62886e1d69c 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -4097,7 +4097,7 @@ namespace FanCoilUnits { } } - int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName) + int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int const FanCoilNum) { // FUNCTION INFORMATION: @@ -4116,17 +4116,10 @@ namespace FanCoilUnits { return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirOutNode; } - if (FanCoilNum == 0 && CompName != "") { - FanCoilNum = Util::FindItemInList(CompName, state.dataFanCoilUnits->FanCoil); - if (FanCoilNum == 0) { - ShowFatalError(state, format("SimFanCoil: Unit not found={}", CompName)); - } - return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirOutNode; - } return 0; } - int GetFanCoilAirInNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName) + int GetFanCoilAirInNode(EnergyPlusData &state, int const FanCoilNum) { // FUNCTION INFORMATION: @@ -4145,13 +4138,6 @@ namespace FanCoilUnits { return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirInNode; } - if (FanCoilNum == 0 && CompName != "") { - FanCoilNum = Util::FindItemInList(CompName, state.dataFanCoilUnits->FanCoil); - if (FanCoilNum == 0) { - ShowFatalError(state, format("SimFanCoil: Unit not found={}", CompName)); - } - return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirInNode; - } return 0; } @@ -4455,6 +4441,25 @@ namespace FanCoilUnits { } } + int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + { + if (state.dataFanCoilUnits->GetFanCoilInputFlag) { + GetFanCoilUnits(state); + state.dataFanCoilUnits->GetFanCoilInputFlag = false; + } + + errFlag = true; + for (int FanCoilIndex = 1; FanCoilIndex <= state.dataFanCoilUnits->Num4PipeFanCoils; ++FanCoilIndex) { + auto &fanCoil = state.dataFanCoilUnits->FanCoil(FanCoilIndex); + if (Util::SameString(fanCoil.Name, CompName)) { + errFlag = false; + return FanCoilIndex; + } + } + + return 0; + } + } // namespace FanCoilUnits } // namespace EnergyPlus diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 87da87cf4aa..5dce466105b 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -319,9 +319,9 @@ namespace FanCoilUnits { void ReportFanCoilUnit(EnergyPlusData &state, int FanCoilNum); // number of the current fan coil unit being simulated - int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName = ""); + int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int const FanCoilNum); - int GetFanCoilAirInNode(EnergyPlusData &state, int &FanCoilNum, std::string_view CompName = ""); + int GetFanCoilAirInNode(EnergyPlusData &state, int const FanCoilNum); int GetFanCoilOutAirNode(EnergyPlusData &state, int FanCoilNum); @@ -382,6 +382,7 @@ namespace FanCoilUnits { int WaterControlNode, Real64 MinWaterFlow); + int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); } // namespace FanCoilUnits struct FanCoilUnitsData : BaseGlobalStruct diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 8850e2d63d3..24e4e921777 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2733,8 +2733,9 @@ namespace RoomAir { SupplyNodeNum = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, EquipIndex); } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil - SupplyNodeNum = FanCoilUnits::GetFanCoilZoneInletAirNode(state, EquipIndex, EquipName); - ReturnNodeNum = FanCoilUnits::GetFanCoilAirInNode(state, EquipIndex, EquipName); + EquipIndex = FanCoilUnits::getEqIndex(state, EquipName, errorfound); + SupplyNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode; + ReturnNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirInNode; } break; case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit SupplyNodeNum = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(state, EquipIndex); From f4a17a5cd64ab9745cb7dd444934a3075aa3fb8f Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 30 May 2024 15:14:47 -0400 Subject: [PATCH 13/21] Solve an error --- src/EnergyPlus/FanCoilUnits.cc | 8 ++++---- src/EnergyPlus/UnitarySystem.cc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 62886e1d69c..0483dbf3467 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -4448,16 +4448,16 @@ namespace FanCoilUnits { state.dataFanCoilUnits->GetFanCoilInputFlag = false; } - errFlag = true; + int EquipIndex = 0; for (int FanCoilIndex = 1; FanCoilIndex <= state.dataFanCoilUnits->Num4PipeFanCoils; ++FanCoilIndex) { auto &fanCoil = state.dataFanCoilUnits->FanCoil(FanCoilIndex); if (Util::SameString(fanCoil.Name, CompName)) { - errFlag = false; - return FanCoilIndex; + EquipIndex = FanCoilIndex; } } - return 0; + if (EquipIndex == 0) errFlag = true; + return EquipIndex; } } // namespace FanCoilUnits diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 7cbc5a2b83c..04d7c31013d 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -16586,7 +16586,7 @@ namespace UnitarySystems { { if (state.dataUnitarySystems->getInputOnceFlag) { - UnitarySystems::UnitarySys::getUnitarySystemInput(state, UnitarySysName, false, OAUnitNum); + UnitarySystems::UnitarySys::getUnitarySystemInput(state, UnitarySysName, true, OAUnitNum); state.dataUnitarySystems->getInputOnceFlag = false; } From 56d97c12c05415f68f733b792bbfab80d647433a Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Wed, 5 Jun 2024 13:47:04 -0400 Subject: [PATCH 14/21] Create getEqIndex functions --- src/EnergyPlus/FanCoilUnits.cc | 2 +- src/EnergyPlus/HVACStandAloneERV.cc | 19 +++++++ src/EnergyPlus/HVACStandAloneERV.hh | 2 + src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 19 +++++++ src/EnergyPlus/HVACVariableRefrigerantFlow.hh | 2 + .../HybridUnitaryAirConditioners.cc | 18 +++++++ .../HybridUnitaryAirConditioners.hh | 2 + src/EnergyPlus/OutdoorAirUnit.cc | 18 +++++++ src/EnergyPlus/OutdoorAirUnit.hh | 2 + src/EnergyPlus/PurchasedAirManager.cc | 18 +++++++ src/EnergyPlus/PurchasedAirManager.hh | 2 + src/EnergyPlus/RoomAirModelManager.cc | 51 +++++++++++-------- src/EnergyPlus/UnitHeater.cc | 17 +++++++ src/EnergyPlus/UnitHeater.hh | 6 ++- src/EnergyPlus/UnitVentilator.cc | 17 +++++++ src/EnergyPlus/UnitVentilator.hh | 2 + src/EnergyPlus/VentilatedSlab.cc | 17 +++++++ src/EnergyPlus/VentilatedSlab.hh | 1 + src/EnergyPlus/WaterThermalTanks.cc | 18 +++++++ src/EnergyPlus/WaterThermalTanks.hh | 2 + src/EnergyPlus/WindowAC.cc | 18 +++++++ src/EnergyPlus/WindowAC.hh | 2 + src/EnergyPlus/ZoneDehumidifier.cc | 18 +++++++ src/EnergyPlus/ZoneDehumidifier.hh | 2 + .../unit/RoomAirflowNetwork.unit.cc | 12 +++++ 25 files changed, 264 insertions(+), 23 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 0483dbf3467..048abf9b95e 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -4449,7 +4449,7 @@ namespace FanCoilUnits { } int EquipIndex = 0; - for (int FanCoilIndex = 1; FanCoilIndex <= state.dataFanCoilUnits->Num4PipeFanCoils; ++FanCoilIndex) { + for (int FanCoilIndex = 1; FanCoilIndex <= state.dataFanCoilUnits->NumFanCoils; ++FanCoilIndex) { auto &fanCoil = state.dataFanCoilUnits->FanCoil(FanCoilIndex); if (Util::SameString(fanCoil.Name, CompName)) { EquipIndex = FanCoilIndex; diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index f4919236616..9ae6958a2f8 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -1686,4 +1686,23 @@ bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int const NodeNumber) return false; } + int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) +{ + if (state.dataHVACStandAloneERV->GetERVInputFlag) { + GetStandAloneERV(state); + state.dataHVACStandAloneERV->GetERVInputFlag = false; + } + + int EqIndex = 0; + errFlag = true; + for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) { + if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) { + EqIndex = StandAloneERVNum; + errFlag = false; + break; + } + } + return EqIndex; +} + } // namespace EnergyPlus::HVACStandAloneERV diff --git a/src/EnergyPlus/HVACStandAloneERV.hh b/src/EnergyPlus/HVACStandAloneERV.hh index 5ee9f82cc5a..4ae1049f1df 100644 --- a/src/EnergyPlus/HVACStandAloneERV.hh +++ b/src/EnergyPlus/HVACStandAloneERV.hh @@ -186,6 +186,8 @@ namespace HVACStandAloneERV { bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int NodeNumber); + int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + } // namespace HVACStandAloneERV struct HVACStandAloneERVData : BaseGlobalStruct diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index dcc34225c5a..aa8926dc591 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -10768,6 +10768,25 @@ int GetVRFTUReturnAirNode(EnergyPlusData &state, int const VRFTUNum) } } +int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName, bool &errFlag) +{ + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { + GetVRFInput(state); + state.dataHVACVarRefFlow->GetVRFInputFlag = false; + } + + int EqIndex = 0; + errFlag = true; + for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; VRFTUNum++) { + if (Util::SameString(VRFTUName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)) { + EqIndex = VRFTUNum; + errFlag = false; + break; + } + } + return EqIndex; +} + void getVRFTUZoneLoad( EnergyPlusData &state, int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag) { diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index b6c0b09796d..bed14c4ea80 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -972,6 +972,8 @@ namespace HVACVariableRefrigerantFlow { Real64 const T_suc // Compressor suction temperature Te' [C] ); + int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName, bool &errFlag); + } // namespace HVACVariableRefrigerantFlow struct HVACVarRefFlowData : BaseGlobalStruct diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.cc b/src/EnergyPlus/HybridUnitaryAirConditioners.cc index 9d9147a0487..50069e27aee 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.cc +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.cc @@ -1366,6 +1366,24 @@ int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int const CompNum) return GetHybridUnitaryACReturnAirNode; } +int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) +{ + if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) { + GetInputZoneHybridUnitaryAirConditioners(state, errFlag); + state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false; + } + + int EquipIndex = 0; + for (int UnitLoop = 1; UnitLoop <= state.dataHybridUnitaryAC->NumZoneHybridEvap; ++UnitLoop) { + if (Util::SameString(state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitLoop).Name, CompName)) { + EquipIndex = UnitLoop; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; +} + //***************************************************************************************** } // namespace EnergyPlus::HybridUnitaryAirConditioners diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.hh b/src/EnergyPlus/HybridUnitaryAirConditioners.hh index 64f0a152e76..c979bd12218 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.hh +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.hh @@ -98,6 +98,8 @@ namespace HybridUnitaryAirConditioners { int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int UnitNum); + int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + } // namespace HybridUnitaryAirConditioners struct HybridUnitaryAirConditionersData : BaseGlobalStruct diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index 2dcc30e4a61..4d993fdde39 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -2471,6 +2471,24 @@ namespace OutdoorAirUnit { return GetOutdoorAirUnitReturnAirNode; } + int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName, bool &errFlag) + { + if (state.dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag) { + OutdoorAirUnit::GetOutdoorAirUnitInputs(state); + state.dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false; + } + + int EquipIndex = 0; + for (int OAUnitNum = 1; OAUnitNum <= state.dataOutdoorAirUnit->NumOfOAUnits; ++OAUnitNum) { + if (Util::SameString(state.dataOutdoorAirUnit->OutAirUnit(OAUnitNum).Name, EquipName)) { + EquipIndex = OAUnitNum; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; + } + } // namespace OutdoorAirUnit } // namespace EnergyPlus diff --git a/src/EnergyPlus/OutdoorAirUnit.hh b/src/EnergyPlus/OutdoorAirUnit.hh index 81eb5084e59..7f166537c91 100644 --- a/src/EnergyPlus/OutdoorAirUnit.hh +++ b/src/EnergyPlus/OutdoorAirUnit.hh @@ -309,6 +309,8 @@ namespace OutdoorAirUnit { int GetOutdoorAirUnitZoneInletNode(EnergyPlusData &state, int OAUnitNum); int GetOutdoorAirUnitReturnAirNode(EnergyPlusData &state, int OAUnitNum); + + int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName, bool &errFlag); } // namespace OutdoorAirUnit struct OutdoorAirUnitData : BaseGlobalStruct diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index b5e8becc3e3..b1552ec305e 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -3333,6 +3333,24 @@ int GetPurchasedAirZoneExhaustAirNode(EnergyPlusData &state, int PurchAirNum) return GetPurchasedAirZoneExhaustAirNode; } +int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName, bool &errFlag) +{ + if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { + GetPurchasedAir(state); + state.dataPurchasedAirMgr->GetPurchAirInputFlag = false; + } + + int EquipIndex = 0; + for (int PurchAirNum = 1; PurchAirNum <= state.dataPurchasedAirMgr->NumPurchAir; ++PurchAirNum) { + if (Util::SameString(state.dataPurchasedAirMgr->PurchAir(PurchAirNum).Name, PurchAirName)) { + EquipIndex = PurchAirNum; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; +} + Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int const PurchAirNum) { diff --git a/src/EnergyPlus/PurchasedAirManager.hh b/src/EnergyPlus/PurchasedAirManager.hh index fb06821efc0..db21045584b 100644 --- a/src/EnergyPlus/PurchasedAirManager.hh +++ b/src/EnergyPlus/PurchasedAirManager.hh @@ -381,6 +381,8 @@ namespace PurchasedAirManager { int GetPurchasedAirZoneExhaustAirNode(EnergyPlusData &state, int PurchAirNum); + int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName, bool &errFlag); + Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int PurchAirNum); Real64 GetPurchasedAirMixedAirHumRat(EnergyPlusData &state, int PurchAirNum); diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 24e4e921777..04e7aa5468e 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2727,10 +2727,12 @@ namespace RoomAir { switch (zoneEquipType) { case DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal: { // ZoneHVAC:TerminalUnit : VariableRefrigerantFlow - SupplyNodeNum = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, EquipIndex); + EquipIndex = HVACVariableRefrigerantFlow::getEqIndex(state, EquipName, errorfound); + SupplyNodeNum = state.dataHVACVarRefFlow->VRFTU(EquipIndex).VRFTUOutletNodeNum; } break; case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { // ZoneHVAC : EnergyRecoveryVentilator - SupplyNodeNum = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, EquipIndex); + EquipIndex = HVACStandAloneERV::getEqIndex(state, EquipName, errorfound); + SupplyNodeNum = state.dataHVACStandAloneERV->StandAloneERV(EquipIndex).SupplyAirInletNode; } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil EquipIndex = FanCoilUnits::getEqIndex(state, EquipName, errorfound); @@ -2738,8 +2740,9 @@ namespace RoomAir { ReturnNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirInNode; } break; case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit - SupplyNodeNum = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(state, EquipIndex); - ReturnNodeNum = OutdoorAirUnit::GetOutdoorAirUnitReturnAirNode(state, EquipIndex); + EquipIndex = OutdoorAirUnit::getOutdoorAirUnitEqIndex(state, EquipName, errorfound); + SupplyNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirOutletNode; + ReturnNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); @@ -2752,16 +2755,19 @@ namespace RoomAir { ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::UnitHeater: { // ZoneHVAC : UnitHeater - ReturnNodeNum = UnitHeater::GetUnitHeaterAirInletNode(state, EquipIndex); - SupplyNodeNum = UnitHeater::GetUnitHeaterAirOutletNode(state, EquipIndex); + EquipIndex = UnitHeater::getUnitHeaterIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirInNode; + SupplyNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::UnitVentilator: { // ZoneHVAC : UnitVentilator - ReturnNodeNum = UnitVentilator::GetUnitVentilatorReturnAirNode(state, EquipIndex); - SupplyNodeNum = UnitVentilator::GetUnitVentilatorZoneInletAirNode(state, EquipIndex); + EquipIndex = UnitVentilator::getUnitVentilatorIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirInNode; + SupplyNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::VentilatedSlab: { // ZoneHVAC : VentilatedSlab - ReturnNodeNum = VentilatedSlab::GetVentilatedSlabReturnAirNode(state, EquipIndex); - SupplyNodeNum = VentilatedSlab::GetVentilatedSlabZoneAirInNode(state, EquipIndex); + EquipIndex = VentilatedSlab::getVentilatedSlabIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode; + SupplyNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ZoneAirInNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // ZoneHVAC : WaterToAirHeatPump EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); @@ -2769,8 +2775,9 @@ namespace RoomAir { ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // ZoneHVAC : WindowAirConditioner - ReturnNodeNum = WindowAC::GetWindowACReturnAirNode(state, EquipIndex); - SupplyNodeNum = WindowAC::GetWindowACZoneInletAirNode(state, EquipIndex); + EquipIndex = WindowAC::getWindowACIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirInNode; + SupplyNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::BaseboardElectric: { // ZoneHVAC : Baseboard : RadiantConvective : Electric // convective equipment without node connection. Will handle later @@ -2797,12 +2804,14 @@ namespace RoomAir { SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::DehumidifierDX: { // ZoneHVAC : Dehumidifier : DX - ReturnNodeNum = ZoneDehumidifier::GetZoneDehumidifierAirInletNodeNum(state, EquipIndex); - SupplyNodeNum = ZoneDehumidifier::GetZoneDehumidifierAirOutletNodeNum(state, EquipIndex); + EquipIndex = ZoneDehumidifier::getZoneDehumidifierIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirInletNodeNum; + SupplyNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirOutletNodeNum; } break; case DataZoneEquipment::ZoneEquipType::PurchasedAir: { // ZoneHVAC : IdealLoadsAirSystem - ReturnNodeNum = PurchasedAirManager::GetPurchasedAirZoneExhaustAirNode(state, EquipIndex); - SupplyNodeNum = PurchasedAirManager::GetPurchasedAirZoneInletAirNode(state, EquipIndex); + EquipIndex = PurchasedAirManager::getPurchasedAirIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneExhaustAirNodeNum; + SupplyNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneSupplyAirNodeNum; } break; case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet: { // ZoneHVAC : RefrigerationChillerSet // May not apply @@ -2810,16 +2819,18 @@ namespace RoomAir { // ReturnNodeName = Alphas(4); } break; case DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler: { // ZoneHVAC : HybridUnitaryAirConditioners - ReturnNodeNum = HybridUnitaryAirConditioners::GetHybridUnitaryACReturnAirNode(state, EquipIndex); - SupplyNodeNum = HybridUnitaryAirConditioners::GetHybridUnitaryACZoneInletNode(state, EquipIndex); + EquipIndex = HybridUnitaryAirConditioners::getHybridUnitaryACIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).InletNode; + SupplyNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).OutletNode; } break; case DataZoneEquipment::ZoneEquipType::ExhaustFan: { // Fan : ZoneExhaust // SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use } break; case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: { // WaterHeater : HeatPump - ReturnNodeNum = WaterThermalTanks::GetHeatPumpWaterHeaterAirInletNodeNum(state, EquipIndex); - SupplyNodeNum = WaterThermalTanks::GetHeatPumpWaterHeaterAirOutletNodeNum(state, EquipIndex); + EquipIndex = WaterThermalTanks::getHeatPumpWaterHeaterIndex(state, EquipName, errorfound); + ReturnNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirInletNode; + SupplyNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirOutletNode; // For AirTerminals, find matching return node later } break; case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctConstantVolume: { // AirTerminal : DualDuct : ConstantVolume diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index 0cabd7e02c8..127fe2079bc 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -1927,6 +1927,23 @@ namespace UnitHeater { return GetUnitHeaterAirInletNode; } + int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + { + if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { + GetUnitHeaterInput(state); + state.dataUnitHeaters->GetUnitHeaterInputFlag = false; + } + int EquipIndex = 0; + for (int UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) { + if (Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, CompName)) { + EquipIndex = UnitHeatNum; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; + } + } // namespace UnitHeater } // namespace EnergyPlus diff --git a/src/EnergyPlus/UnitHeater.hh b/src/EnergyPlus/UnitHeater.hh index 502ec4a4a46..e84f7790d14 100644 --- a/src/EnergyPlus/UnitHeater.hh +++ b/src/EnergyPlus/UnitHeater.hh @@ -202,9 +202,11 @@ namespace UnitHeater { void ReportUnitHeater(EnergyPlusData &state, int const UnitHeatNum); // Unit index in unit heater array - int GetUnitHeaterAirOutletNode(EnergyPlusData &state, int OAUnitNum); + int GetUnitHeaterAirOutletNode(EnergyPlusData &state, int UnitHeatNum); - int GetUnitHeaterAirInletNode(EnergyPlusData &state, int OAUnitNum); + int GetUnitHeaterAirInletNode(EnergyPlusData &state, int UnitHeatNum); + + int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); } // namespace UnitHeater struct UnitHeatersData : BaseGlobalStruct diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index 729cf7a5a24..ea690c1ec45 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -3366,6 +3366,23 @@ namespace UnitVentilator { return GetUnitVentilatorReturnAirNode; } + int getUnitVentilatorIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + { + if (state.dataUnitVentilators->GetUnitVentilatorInputFlag) { + GetUnitVentilatorInput(state); + state.dataUnitVentilators->GetUnitVentilatorInputFlag = false; + } + int EquipIndex = 0; + for (int UnitVentNum = 1; UnitVentNum <= state.dataUnitVentilators->NumOfUnitVents; ++UnitVentNum) { + if (Util::SameString(state.dataUnitVentilators->UnitVent(UnitVentNum).Name, CompName)) { + EquipIndex = UnitVentNum; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; + } + Real64 SetOAMassFlowRateForCoolingVariablePercent(EnergyPlusData &state, int const UnitVentNum, // Unit Ventilator index Real64 const MinOAFrac, // Minimum Outside Air Fraction diff --git a/src/EnergyPlus/UnitVentilator.hh b/src/EnergyPlus/UnitVentilator.hh index ea732cae27d..9354a666e6a 100644 --- a/src/EnergyPlus/UnitVentilator.hh +++ b/src/EnergyPlus/UnitVentilator.hh @@ -262,6 +262,8 @@ namespace UnitVentilator { int GetUnitVentilatorReturnAirNode(EnergyPlusData &state, int const UnitVentNum); + int getUnitVentilatorIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + Real64 SetOAMassFlowRateForCoolingVariablePercent(EnergyPlusData &state, int const UnitVentNum, // Unit Ventilator index number Real64 const MinOAFrac, // Minimum Outside Air Fraction diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 301ec2d1715..f132ee63d8e 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -4766,6 +4766,23 @@ namespace VentilatedSlab { return ZoneAirInNode; } + int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + { + if (state.dataVentilatedSlab->GetInputFlag) { + GetVentilatedSlabInput(state); + state.dataVentilatedSlab->GetInputFlag = false; + } + + int EquipIndex = 0; + for (int VentSlabNum = 1; VentSlabNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++VentSlabNum) { + if (Util::SameString(state.dataVentilatedSlab->VentSlab(VentSlabNum).Name, CompName)) { + EquipIndex = VentSlabNum; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; + } //***************************************************************************************** } // namespace VentilatedSlab diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index 52794f957e9..f20180c8602 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -387,6 +387,7 @@ namespace VentilatedSlab { int GetVentilatedSlabZoneAirInNode(EnergyPlusData &state, int const VentSlabNum); + int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); //***************************************************************************************** } // namespace VentilatedSlab diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 11b6f052499..bdea7fce4c8 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -12495,4 +12495,22 @@ int GetHeatPumpWaterHeaterAirOutletNodeNum(EnergyPlusData &state, int HPNum) return HeatPumpWaterHeaterAirOutletNodeNum; } +int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) +{ + if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { + GetWaterThermalTankInput(state); + state.dataWaterThermalTanks->getWaterThermalTankInputFlag = false; + } + + int EquipIndex = 0; + for (int HPNum = 1; HPNum <= state.dataWaterThermalTanks->numHeatPumpWaterHeater; ++HPNum) { + if (Util::SameString(state.dataWaterThermalTanks->HPWaterHeater(HPNum).Name, CompName)) { + EquipIndex = HPNum; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; +} + } // namespace EnergyPlus::WaterThermalTanks diff --git a/src/EnergyPlus/WaterThermalTanks.hh b/src/EnergyPlus/WaterThermalTanks.hh index 741d5edcd1c..7ff93332d85 100644 --- a/src/EnergyPlus/WaterThermalTanks.hh +++ b/src/EnergyPlus/WaterThermalTanks.hh @@ -992,6 +992,8 @@ namespace WaterThermalTanks { int GetHeatPumpWaterHeaterAirOutletNodeNum(EnergyPlusData &state, int HPNum); + int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + } // namespace WaterThermalTanks struct WaterThermalTanksData : BaseGlobalStruct diff --git a/src/EnergyPlus/WindowAC.cc b/src/EnergyPlus/WindowAC.cc index 6dad593cbcc..9d405e13750 100644 --- a/src/EnergyPlus/WindowAC.cc +++ b/src/EnergyPlus/WindowAC.cc @@ -1619,6 +1619,24 @@ namespace WindowAC { return GetWindowACMixedAirNode; } + int getWindowACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + { + if (state.dataWindowAC->GetWindowACInputFlag) { + GetWindowAC(state); + state.dataWindowAC->GetWindowACInputFlag = false; + } + + int EquipIndex = 0; + for (int WindACIndex = 1; WindACIndex <= state.dataWindowAC->NumWindAC; ++WindACIndex) { + if (Util::SameString(state.dataWindowAC->WindAC(WindACIndex).Name, CompName)) { + EquipIndex = WindACIndex; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; + } + } // namespace WindowAC } // namespace EnergyPlus diff --git a/src/EnergyPlus/WindowAC.hh b/src/EnergyPlus/WindowAC.hh index 53a111e820d..0d2e8014e73 100644 --- a/src/EnergyPlus/WindowAC.hh +++ b/src/EnergyPlus/WindowAC.hh @@ -205,6 +205,8 @@ namespace WindowAC { int GetWindowACMixedAirNode(EnergyPlusData &state, int const WindACNum); + int getWindowACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + } // namespace WindowAC struct WindowACData : BaseGlobalStruct diff --git a/src/EnergyPlus/ZoneDehumidifier.cc b/src/EnergyPlus/ZoneDehumidifier.cc index 74b31945904..e21e5f4c887 100644 --- a/src/EnergyPlus/ZoneDehumidifier.cc +++ b/src/EnergyPlus/ZoneDehumidifier.cc @@ -1209,6 +1209,24 @@ namespace ZoneDehumidifier { return ZoneDehumidifierAirInletNodeNum; } + int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + { + if (state.dataZoneDehumidifier->GetInputFlag) { + GetZoneDehumidifierInput(state); + state.dataZoneDehumidifier->GetInputFlag = false; + } + + int EquipIndex = 0; + for (int ZoneDehumidNum = 1; ZoneDehumidNum <= (int)state.dataZoneDehumidifier->ZoneDehumid.size(); ++ZoneDehumidNum) { + if (Util::SameString(state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidNum).Name, CompName)) { + EquipIndex = ZoneDehumidNum; + } + } + + if (EquipIndex == 0) errFlag = true; + return EquipIndex; + } + } // namespace ZoneDehumidifier } // namespace EnergyPlus diff --git a/src/EnergyPlus/ZoneDehumidifier.hh b/src/EnergyPlus/ZoneDehumidifier.hh index 6da985a515f..57adbfe4d57 100644 --- a/src/EnergyPlus/ZoneDehumidifier.hh +++ b/src/EnergyPlus/ZoneDehumidifier.hh @@ -157,6 +157,8 @@ namespace ZoneDehumidifier { int GetZoneDehumidifierAirInletNodeNum(EnergyPlusData &state, int ZoneDehumidNum); + int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + } // namespace ZoneDehumidifier struct ZoneDehumidifierData : BaseGlobalStruct diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index cfb694c8af9..5555bfcb259 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -626,6 +626,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) zoneEquipType = DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal; state->dataHVACVarRefFlow->NumVRFTU = 1; + state->dataHVACVarRefFlow->VRFTU(1).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode", SupplyNodeName); @@ -638,6 +639,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataHVACStandAloneERV->StandAloneERV.allocate(1); state->dataHVACStandAloneERV->NumStandAloneERVs = 1; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirInletNode = 1; + state->dataHVACStandAloneERV->StandAloneERV(1).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode1", SupplyNodeName); @@ -651,6 +653,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataFanCoilUnits->FanCoil(EquipIndex).AirInNode = 2; state->dataFanCoilUnits->NumFanCoils = 1; state->dataFanCoilUnits->GetFanCoilInputFlag = false; + state->dataFanCoilUnits->FanCoil(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode2", SupplyNodeName); @@ -665,6 +668,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode = 2; state->dataOutdoorAirUnit->NumOfOAUnits = 1; state->dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false; + state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode3", SupplyNodeName); @@ -726,6 +730,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitHeaters->UnitHeat(EquipIndex).AirInNode = 2; state->dataUnitHeaters->NumOfUnitHeats = 1; state->dataUnitHeaters->GetUnitHeaterInputFlag = false; + state->dataUnitHeaters->UnitHeat(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode7", SupplyNodeName); @@ -739,6 +744,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitVentilators->UnitVent(EquipIndex).AirOutNode = 1; state->dataUnitVentilators->UnitVent(EquipIndex).AirInNode = 2; state->dataUnitVentilators->NumOfUnitVents = 1; + state->dataUnitVentilators->UnitVent(EquipIndex).Name = EquipName; state->dataUnitVentilators->GetUnitVentilatorInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { @@ -754,6 +760,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode = 2; state->dataVentilatedSlab->NumOfVentSlabs = 1; state->dataVentilatedSlab->GetInputFlag = false; + state->dataVentilatedSlab->VentSlab(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode9", SupplyNodeName); @@ -772,6 +779,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataMixedAir->NumOAMixers = 1; state->dataMixedAir->OAMixer.allocate(1); state->dataMixedAir->OAMixer(1).RetNode = 2; + state->dataWindowAC->WindAC(EquipIndex).Name = EquipName; state->dataMixedAir->GetOAMixerInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { @@ -785,6 +793,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataZoneDehumidifier->ZoneDehumid.allocate(1); state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirOutletNodeNum = 1; state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirInletNodeNum = 2; + state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).Name = EquipName; state->dataZoneDehumidifier->GetInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { @@ -799,6 +808,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneSupplyAirNodeNum = 1; state->dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneExhaustAirNodeNum = 2; state->dataPurchasedAirMgr->NumPurchAir = 1; + state->dataPurchasedAirMgr->PurchAir(EquipIndex).Name = EquipName; state->dataPurchasedAirMgr->GetPurchAirInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { @@ -813,6 +823,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).OutletNode = 1; state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).InletNode = 2; state->dataHybridUnitaryAC->NumZoneHybridEvap = 1; + state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).Name = EquipName; state->dataHybridUnitaryAC->GetInputZoneHybridEvap = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { @@ -827,6 +838,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirOutletNode = 1; state->dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirInletNode = 2; state->dataWaterThermalTanks->numHeatPumpWaterHeater = 1; + state->dataWaterThermalTanks->HPWaterHeater(EquipIndex).Name = EquipName; state->dataWaterThermalTanks->getWaterThermalTankInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); if (check) { From a66cef820684a1eeae96c31a77892a5ebf1a47fa Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Wed, 5 Jun 2024 15:25:23 -0400 Subject: [PATCH 15/21] Remove errFlag override --- src/EnergyPlus/HVACStandAloneERV.cc | 4 ++-- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index 9ae6958a2f8..574e771fa13 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -1694,14 +1694,14 @@ bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int const NodeNumber) } int EqIndex = 0; - errFlag = true; + for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) { if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) { EqIndex = StandAloneERVNum; - errFlag = false; break; } } + if (EqIndex == 0) errFlag = true; return EqIndex; } diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index aa8926dc591..7344312ac09 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -10776,14 +10776,13 @@ int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName, bool &errFlag) } int EqIndex = 0; - errFlag = true; for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; VRFTUNum++) { if (Util::SameString(VRFTUName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)) { EqIndex = VRFTUNum; - errFlag = false; break; } } + if (EqIndex == 0) errFlag = true; return EqIndex; } From 4a1dc464357dca1ffebd985403a41269e0bb483e Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Wed, 5 Jun 2024 16:45:46 -0400 Subject: [PATCH 16/21] Clang format --- src/EnergyPlus/HVACStandAloneERV.cc | 28 +++++++++++++-------------- src/EnergyPlus/PurchasedAirManager.cc | 22 ++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index 574e771fa13..a991369c301 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -1686,23 +1686,23 @@ bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int const NodeNumber) return false; } - int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) +int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) { - if (state.dataHVACStandAloneERV->GetERVInputFlag) { - GetStandAloneERV(state); - state.dataHVACStandAloneERV->GetERVInputFlag = false; - } + if (state.dataHVACStandAloneERV->GetERVInputFlag) { + GetStandAloneERV(state); + state.dataHVACStandAloneERV->GetERVInputFlag = false; + } - int EqIndex = 0; - - for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) { - if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) { - EqIndex = StandAloneERVNum; - break; - } + int EqIndex = 0; + + for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) { + if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) { + EqIndex = StandAloneERVNum; + break; } - if (EqIndex == 0) errFlag = true; - return EqIndex; + } + if (EqIndex == 0) errFlag = true; + return EqIndex; } } // namespace EnergyPlus::HVACStandAloneERV diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index b1552ec305e..5b1d719f2a2 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -3335,20 +3335,20 @@ int GetPurchasedAirZoneExhaustAirNode(EnergyPlusData &state, int PurchAirNum) int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName, bool &errFlag) { - if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { - GetPurchasedAir(state); - state.dataPurchasedAirMgr->GetPurchAirInputFlag = false; - } + if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { + GetPurchasedAir(state); + state.dataPurchasedAirMgr->GetPurchAirInputFlag = false; + } - int EquipIndex = 0; - for (int PurchAirNum = 1; PurchAirNum <= state.dataPurchasedAirMgr->NumPurchAir; ++PurchAirNum) { - if (Util::SameString(state.dataPurchasedAirMgr->PurchAir(PurchAirNum).Name, PurchAirName)) { - EquipIndex = PurchAirNum; - } + int EquipIndex = 0; + for (int PurchAirNum = 1; PurchAirNum <= state.dataPurchasedAirMgr->NumPurchAir; ++PurchAirNum) { + if (Util::SameString(state.dataPurchasedAirMgr->PurchAir(PurchAirNum).Name, PurchAirName)) { + EquipIndex = PurchAirNum; } + } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + if (EquipIndex == 0) errFlag = true; + return EquipIndex; } Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int const PurchAirNum) From 40dc60176f5e81850298bcf1890c868a822c82f5 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 6 Jun 2024 11:31:28 -0400 Subject: [PATCH 17/21] Cleanup --- src/EnergyPlus/RoomAirModelManager.cc | 10 ++----- src/EnergyPlus/RoomAirModelManager.hh | 1 - .../unit/RoomAirflowNetwork.unit.cc | 30 +++++++++---------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 04e7aa5468e..7b8c40f8ed6 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1658,12 +1658,8 @@ namespace RoomAir { break; } } - IntEquipFound = CheckEquipName(state, - roomAFNNodeHVAC.Name, - roomAFNNodeHVAC.SupplyNodeName, - roomAFNNodeHVAC.ReturnNodeName, - EquipIndex, - roomAFNNodeHVAC.zoneEquipType); + IntEquipFound = CheckEquipName( + state, roomAFNNodeHVAC.Name, roomAFNNodeHVAC.SupplyNodeName, roomAFNNodeHVAC.ReturnNodeName, roomAFNNodeHVAC.zoneEquipType); if (!IntEquipFound) { ShowSevereError(state, @@ -2699,7 +2695,6 @@ namespace RoomAir { std::string const &EquipName, // Equipment Name std::string &SupplyNodeName, // Supply node name std::string &ReturnNodeName, // Return node name - int EquipIndex, // Equipment index DataZoneEquipment::ZoneEquipType zoneEquipType) { @@ -2722,6 +2717,7 @@ namespace RoomAir { int ReturnNodeNum = 0; SupplyNodeName = ""; + int EquipIndex; if (zoneEquipType == DataZoneEquipment::ZoneEquipType::Invalid) return EquipFind; diff --git a/src/EnergyPlus/RoomAirModelManager.hh b/src/EnergyPlus/RoomAirModelManager.hh index bf030e7fdd0..6f2082797fb 100644 --- a/src/EnergyPlus/RoomAirModelManager.hh +++ b/src/EnergyPlus/RoomAirModelManager.hh @@ -89,7 +89,6 @@ namespace RoomAir { std::string const &EquipName, // Equipment Name std::string &SupplyNodeName, // Supply node name std::string &ReturnNodeName, // Return node name - int EquipIndex, // Equipment index DataZoneEquipment::ZoneEquipType zoneEquipType); // equipment type number } // namespace RoomAir diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 5555bfcb259..36709ad80c0 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -627,7 +627,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) zoneEquipType = DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal; state->dataHVACVarRefFlow->NumVRFTU = 1; state->dataHVACVarRefFlow->VRFTU(1).Name = EquipName; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode", SupplyNodeName); } @@ -640,7 +640,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataHVACStandAloneERV->NumStandAloneERVs = 1; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirInletNode = 1; state->dataHVACStandAloneERV->StandAloneERV(1).Name = EquipName; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode1", SupplyNodeName); } @@ -654,7 +654,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataFanCoilUnits->NumFanCoils = 1; state->dataFanCoilUnits->GetFanCoilInputFlag = false; state->dataFanCoilUnits->FanCoil(EquipIndex).Name = EquipName; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode2", SupplyNodeName); EXPECT_EQ("ReturnNode2", ReturnNodeName); @@ -669,7 +669,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataOutdoorAirUnit->NumOfOAUnits = 1; state->dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false; state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).Name = EquipName; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode3", SupplyNodeName); EXPECT_EQ("ReturnNode3", ReturnNodeName); @@ -685,7 +685,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->numUnitarySystems = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode4", SupplyNodeName); EXPECT_EQ("ReturnNode4", ReturnNodeName); @@ -701,7 +701,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->numUnitarySystems = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode5", SupplyNodeName); EXPECT_EQ("ReturnNode5", ReturnNodeName); @@ -716,7 +716,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->numUnitarySystems = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode6", SupplyNodeName); EXPECT_EQ("ReturnNode6", ReturnNodeName); @@ -731,7 +731,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitHeaters->NumOfUnitHeats = 1; state->dataUnitHeaters->GetUnitHeaterInputFlag = false; state->dataUnitHeaters->UnitHeat(EquipIndex).Name = EquipName; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode7", SupplyNodeName); EXPECT_EQ("ReturnNode7", ReturnNodeName); @@ -746,7 +746,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitVentilators->NumOfUnitVents = 1; state->dataUnitVentilators->UnitVent(EquipIndex).Name = EquipName; state->dataUnitVentilators->GetUnitVentilatorInputFlag = false; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode8", SupplyNodeName); EXPECT_EQ("ReturnNode8", ReturnNodeName); @@ -761,7 +761,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataVentilatedSlab->NumOfVentSlabs = 1; state->dataVentilatedSlab->GetInputFlag = false; state->dataVentilatedSlab->VentSlab(EquipIndex).Name = EquipName; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode9", SupplyNodeName); EXPECT_EQ("ReturnNode9", ReturnNodeName); @@ -781,7 +781,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataMixedAir->OAMixer(1).RetNode = 2; state->dataWindowAC->WindAC(EquipIndex).Name = EquipName; state->dataMixedAir->GetOAMixerInputFlag = false; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode10", SupplyNodeName); EXPECT_EQ("ReturnNode10", ReturnNodeName); @@ -795,7 +795,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirInletNodeNum = 2; state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).Name = EquipName; state->dataZoneDehumidifier->GetInputFlag = false; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode11", SupplyNodeName); EXPECT_EQ("ReturnNode11", ReturnNodeName); @@ -810,7 +810,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataPurchasedAirMgr->NumPurchAir = 1; state->dataPurchasedAirMgr->PurchAir(EquipIndex).Name = EquipName; state->dataPurchasedAirMgr->GetPurchAirInputFlag = false; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode12", SupplyNodeName); EXPECT_EQ("ReturnNode12", ReturnNodeName); @@ -825,7 +825,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataHybridUnitaryAC->NumZoneHybridEvap = 1; state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).Name = EquipName; state->dataHybridUnitaryAC->GetInputZoneHybridEvap = false; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode13", SupplyNodeName); EXPECT_EQ("ReturnNode13", ReturnNodeName); @@ -840,7 +840,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataWaterThermalTanks->numHeatPumpWaterHeater = 1; state->dataWaterThermalTanks->HPWaterHeater(EquipIndex).Name = EquipName; state->dataWaterThermalTanks->getWaterThermalTankInputFlag = false; - check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); + check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); if (check) { EXPECT_EQ("SupplyNode14", SupplyNodeName); EXPECT_EQ("ReturnNode14", ReturnNodeName); From 29905bdb3593fa6bdd94a19ae1aed6f982f28411 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Mon, 10 Jun 2024 13:19:29 -0400 Subject: [PATCH 18/21] Update WaterHeater:HeatPump type --- idd/Energy+.idd.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/idd/Energy+.idd.in b/idd/Energy+.idd.in index 466fc0a596b..f37bddeb533 100644 --- a/idd/Energy+.idd.in +++ b/idd/Energy+.idd.in @@ -21172,7 +21172,8 @@ RoomAir:Node:AirflowNetwork:HVACEquipment, \key ZoneHVAC:IdealLoadsAirSystem \key ZoneHVAC:RefrigerationChillerSet \key Fan:ZoneExhaust - \key WaterHeater:HeatPump + \key WaterHeater:HeatPump:PumpedCondenser + \key WaterHeater:HeatPump:WrappedCondenser \key AirTerminal:DualDuct:ConstantVolume \key AirTerminal:DualDuct:VAV \key AirTerminal:SingleDuct:ConstantVolume:Reheat @@ -21222,7 +21223,8 @@ RoomAir:Node:AirflowNetwork:HVACEquipment, \key ZoneHVAC:IdealLoadsAirSystem \key ZoneHVAC:RefrigerationChillerSet \key Fan:ZoneExhaust - \key WaterHeater:HeatPump + \key WaterHeater:HeatPump:PumpedCondenser + \key WaterHeater:HeatPump:WrappedCondenser \key AirTerminal:DualDuct:ConstantVolume \key AirTerminal:DualDuct:VAV \key AirTerminal:SingleDuct:ConstantVolume:Reheat From 01c2a82ab095db4d40d46f191ce68deb02374816 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Wed, 10 Jul 2024 15:37:12 -0400 Subject: [PATCH 19/21] Address comments and cleanup --- src/EnergyPlus/FanCoilUnits.cc | 22 ---- src/EnergyPlus/FanCoilUnits.hh | 2 - src/EnergyPlus/PurchasedAirManager.cc | 15 --- src/EnergyPlus/PurchasedAirManager.hh | 2 - src/EnergyPlus/UnitHeater.cc | 33 ------ src/EnergyPlus/UnitHeater.hh | 4 - src/EnergyPlus/VentilatedSlab.cc | 31 ------ src/EnergyPlus/VentilatedSlab.hh | 4 - src/EnergyPlus/WaterThermalTanks.cc | 30 ------ src/EnergyPlus/WaterThermalTanks.hh | 4 - src/EnergyPlus/ZoneDehumidifier.cc | 30 ------ src/EnergyPlus/ZoneDehumidifier.hh | 4 - .../unit/RoomAirflowNetwork.unit.cc | 102 ++++++++---------- 13 files changed, 44 insertions(+), 239 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 048abf9b95e..1e05e8f7056 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -4119,28 +4119,6 @@ namespace FanCoilUnits { return 0; } - int GetFanCoilAirInNode(EnergyPlusData &state, int const FanCoilNum) - { - - // FUNCTION INFORMATION: - // AUTHOR B Griffith - // DATE WRITTEN Dec 2006 - - // PURPOSE OF THIS FUNCTION: - // lookup function for OA inlet node for ventilation rate reporting - - if (state.dataFanCoilUnits->GetFanCoilInputFlag) { - GetFanCoilUnits(state); - state.dataFanCoilUnits->GetFanCoilInputFlag = false; - } - - if (FanCoilNum > 0 && FanCoilNum <= state.dataFanCoilUnits->NumFanCoils) { - return state.dataFanCoilUnits->FanCoil(FanCoilNum).AirInNode; - } - - return 0; - } - int GetFanCoilOutAirNode(EnergyPlusData &state, int const FanCoilNum) { diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 5dce466105b..6f09a1523fa 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -321,8 +321,6 @@ namespace FanCoilUnits { int GetFanCoilZoneInletAirNode(EnergyPlusData &state, int const FanCoilNum); - int GetFanCoilAirInNode(EnergyPlusData &state, int const FanCoilNum); - int GetFanCoilOutAirNode(EnergyPlusData &state, int FanCoilNum); int GetFanCoilReturnAirNode(EnergyPlusData &state, int FanCoilNum); diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index 5b1d719f2a2..e3b58a930da 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -3318,21 +3318,6 @@ int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int const PurchAirNum) return GetPurchasedAirReturnAirNode; } -int GetPurchasedAirZoneExhaustAirNode(EnergyPlusData &state, int PurchAirNum) -{ - if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { - GetPurchasedAir(state); - state.dataPurchasedAirMgr->GetPurchAirInputFlag = false; - } - - int GetPurchasedAirZoneExhaustAirNode = 0; - if (PurchAirNum > 0 && PurchAirNum <= state.dataPurchasedAirMgr->NumPurchAir) { - GetPurchasedAirZoneExhaustAirNode = state.dataPurchasedAirMgr->PurchAir(PurchAirNum).ZoneExhaustAirNodeNum; - } - - return GetPurchasedAirZoneExhaustAirNode; -} - int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName, bool &errFlag) { if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { diff --git a/src/EnergyPlus/PurchasedAirManager.hh b/src/EnergyPlus/PurchasedAirManager.hh index db21045584b..1058b9953c1 100644 --- a/src/EnergyPlus/PurchasedAirManager.hh +++ b/src/EnergyPlus/PurchasedAirManager.hh @@ -379,8 +379,6 @@ namespace PurchasedAirManager { int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int PurchAirNum); - int GetPurchasedAirZoneExhaustAirNode(EnergyPlusData &state, int PurchAirNum); - int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName, bool &errFlag); Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int PurchAirNum); diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index 127fe2079bc..e1ced26febe 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -1894,39 +1894,6 @@ namespace UnitHeater { } } - int GetUnitHeaterAirOutletNode(EnergyPlusData &state, int UnitHeaterNum) - { - // Return value - int GetUnitHeaterAirOutletNode = 0; - - if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { - GetUnitHeaterInput(state); - state.dataUnitHeaters->GetUnitHeaterInputFlag = false; - } - - if (UnitHeaterNum > 0 && UnitHeaterNum <= state.dataUnitHeaters->NumOfUnitHeats) { - GetUnitHeaterAirOutletNode = state.dataUnitHeaters->UnitHeat(UnitHeaterNum).AirOutNode; - } - - return GetUnitHeaterAirOutletNode; - } - - int GetUnitHeaterAirInletNode(EnergyPlusData &state, int UnitHeaterNum) - { - int GetUnitHeaterAirInletNode = 0; - - if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { - GetUnitHeaterInput(state); - state.dataUnitHeaters->GetUnitHeaterInputFlag = false; - } - - if (UnitHeaterNum > 0 && UnitHeaterNum <= state.dataUnitHeaters->NumOfUnitHeats) { - GetUnitHeaterAirInletNode = state.dataUnitHeaters->UnitHeat(UnitHeaterNum).AirInNode; - } - - return GetUnitHeaterAirInletNode; - } - int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) { if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { diff --git a/src/EnergyPlus/UnitHeater.hh b/src/EnergyPlus/UnitHeater.hh index e84f7790d14..a2158cb8b0e 100644 --- a/src/EnergyPlus/UnitHeater.hh +++ b/src/EnergyPlus/UnitHeater.hh @@ -202,10 +202,6 @@ namespace UnitHeater { void ReportUnitHeater(EnergyPlusData &state, int const UnitHeatNum); // Unit index in unit heater array - int GetUnitHeaterAirOutletNode(EnergyPlusData &state, int UnitHeatNum); - - int GetUnitHeaterAirInletNode(EnergyPlusData &state, int UnitHeatNum); - int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); } // namespace UnitHeater diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index f132ee63d8e..650530ee64b 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -4735,37 +4735,6 @@ namespace VentilatedSlab { } } - int GetVentilatedSlabReturnAirNode(EnergyPlusData &state, int const VentSlabNum) - { - int ReturnAirNode = 0; - if (state.dataVentilatedSlab->GetInputFlag) { - GetVentilatedSlabInput(state); - state.dataVentilatedSlab->GetInputFlag = false; - } - - if (VentSlabNum > 0 && VentSlabNum <= state.dataVentilatedSlab->NumOfVentSlabs) { - ReturnAirNode = state.dataVentilatedSlab->VentSlab(VentSlabNum).ReturnAirNode; - } - - return ReturnAirNode; - } - - int GetVentilatedSlabZoneAirInNode(EnergyPlusData &state, int const VentSlabNum) - { - int ZoneAirInNode = 0; - - if (state.dataVentilatedSlab->GetInputFlag) { - GetVentilatedSlabInput(state); - state.dataVentilatedSlab->GetInputFlag = false; - } - - if (VentSlabNum > 0 && VentSlabNum <= state.dataVentilatedSlab->NumOfVentSlabs) { - ZoneAirInNode = state.dataVentilatedSlab->VentSlab(VentSlabNum).ZoneAirInNode; - } - - return ZoneAirInNode; - } - int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) { if (state.dataVentilatedSlab->GetInputFlag) { diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index f20180c8602..c121528a7f5 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -383,10 +383,6 @@ namespace VentilatedSlab { void ReportVentilatedSlab(EnergyPlusData &state, int const Item); // Index for the ventilated slab under consideration within the derived types - int GetVentilatedSlabReturnAirNode(EnergyPlusData &state, int const VentSlabNum); - - int GetVentilatedSlabZoneAirInNode(EnergyPlusData &state, int const VentSlabNum); - int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); //***************************************************************************************** diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index bdea7fce4c8..02ed3f8d309 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -12465,36 +12465,6 @@ bool GetHeatPumpWaterHeaterNodeNumber(EnergyPlusData &state, int const NodeNumbe return HeatPumpWaterHeaterNodeException; } -int GetHeatPumpWaterHeaterAirInletNodeNum(EnergyPlusData &state, int HPNum) -{ - int HeatPumpWaterHeaterAirInletNodeNum = 0; - if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { - GetWaterThermalTankInput(state); - state.dataWaterThermalTanks->getWaterThermalTankInputFlag = false; - } - - if (HPNum > 0 && HPNum <= state.dataWaterThermalTanks->numHeatPumpWaterHeater) { - HeatPumpWaterHeaterAirInletNodeNum = state.dataWaterThermalTanks->HPWaterHeater(HPNum).HeatPumpAirInletNode; - } - - return HeatPumpWaterHeaterAirInletNodeNum; -} - -int GetHeatPumpWaterHeaterAirOutletNodeNum(EnergyPlusData &state, int HPNum) -{ - int HeatPumpWaterHeaterAirOutletNodeNum = 0; - if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { - GetWaterThermalTankInput(state); - state.dataWaterThermalTanks->getWaterThermalTankInputFlag = false; - } - - if (HPNum > 0 && HPNum <= state.dataWaterThermalTanks->numHeatPumpWaterHeater) { - HeatPumpWaterHeaterAirOutletNodeNum = state.dataWaterThermalTanks->HPWaterHeater(HPNum).HeatPumpAirOutletNode; - } - - return HeatPumpWaterHeaterAirOutletNodeNum; -} - int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) { if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { diff --git a/src/EnergyPlus/WaterThermalTanks.hh b/src/EnergyPlus/WaterThermalTanks.hh index 7ff93332d85..014ba54f05f 100644 --- a/src/EnergyPlus/WaterThermalTanks.hh +++ b/src/EnergyPlus/WaterThermalTanks.hh @@ -988,10 +988,6 @@ namespace WaterThermalTanks { bool GetHeatPumpWaterHeaterNodeNumber(EnergyPlusData &state, int NodeNumber); - int GetHeatPumpWaterHeaterAirInletNodeNum(EnergyPlusData &state, int HPNum); - - int GetHeatPumpWaterHeaterAirOutletNodeNum(EnergyPlusData &state, int HPNum); - int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); } // namespace WaterThermalTanks diff --git a/src/EnergyPlus/ZoneDehumidifier.cc b/src/EnergyPlus/ZoneDehumidifier.cc index e21e5f4c887..0eafa52b1ab 100644 --- a/src/EnergyPlus/ZoneDehumidifier.cc +++ b/src/EnergyPlus/ZoneDehumidifier.cc @@ -1179,36 +1179,6 @@ namespace ZoneDehumidifier { return FindZoneDehumidifierNodeNumber; } - int GetZoneDehumidifierAirOutletNodeNum(EnergyPlusData &state, int ZoneDehumidNum) - { - int ZoneDehumidifierAirOutletNodeNum = 0; - if (state.dataZoneDehumidifier->GetInputFlag) { - GetZoneDehumidifierInput(state); - state.dataZoneDehumidifier->GetInputFlag = false; - } - - if (ZoneDehumidNum > 0 && ZoneDehumidNum <= (int)state.dataZoneDehumidifier->ZoneDehumid.size()) { - ZoneDehumidifierAirOutletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidNum).AirOutletNodeNum; - } - - return ZoneDehumidifierAirOutletNodeNum; - } - - int GetZoneDehumidifierAirInletNodeNum(EnergyPlusData &state, int ZoneDehumidNum) - { - int ZoneDehumidifierAirInletNodeNum = 0; - if (state.dataZoneDehumidifier->GetInputFlag) { - GetZoneDehumidifierInput(state); - state.dataZoneDehumidifier->GetInputFlag = false; - } - - if (ZoneDehumidNum > 0 && ZoneDehumidNum <= (int)state.dataZoneDehumidifier->ZoneDehumid.size()) { - ZoneDehumidifierAirInletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidNum).AirInletNodeNum; - } - - return ZoneDehumidifierAirInletNodeNum; - } - int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) { if (state.dataZoneDehumidifier->GetInputFlag) { diff --git a/src/EnergyPlus/ZoneDehumidifier.hh b/src/EnergyPlus/ZoneDehumidifier.hh index 57adbfe4d57..b4800340a34 100644 --- a/src/EnergyPlus/ZoneDehumidifier.hh +++ b/src/EnergyPlus/ZoneDehumidifier.hh @@ -153,10 +153,6 @@ namespace ZoneDehumidifier { bool GetZoneDehumidifierNodeNumber(EnergyPlusData &state, int NodeNumber); // Node being tested - int GetZoneDehumidifierAirOutletNodeNum(EnergyPlusData &state, int ZoneDehumidNum); - - int GetZoneDehumidifierAirInletNodeNum(EnergyPlusData &state, int ZoneDehumidNum); - int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); } // namespace ZoneDehumidifier diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 36709ad80c0..7522f82eb6a 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -628,9 +628,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataHVACVarRefFlow->NumVRFTU = 1; state->dataHVACVarRefFlow->VRFTU(1).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode", SupplyNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode", SupplyNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode1"; state->dataLoopNodes->NodeID(2) = "ReturnNode1"; @@ -641,9 +640,8 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirInletNode = 1; state->dataHVACStandAloneERV->StandAloneERV(1).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode1", SupplyNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode1", SupplyNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode2"; state->dataLoopNodes->NodeID(2) = "ReturnNode2"; @@ -655,10 +653,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataFanCoilUnits->GetFanCoilInputFlag = false; state->dataFanCoilUnits->FanCoil(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode2", SupplyNodeName); - EXPECT_EQ("ReturnNode2", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode2", SupplyNodeName); + EXPECT_EQ("ReturnNode2", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode3"; state->dataLoopNodes->NodeID(2) = "ReturnNode3"; @@ -670,10 +667,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false; state->dataOutdoorAirUnit->OutAirUnit(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode3", SupplyNodeName); - EXPECT_EQ("ReturnNode3", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode3", SupplyNodeName); + EXPECT_EQ("ReturnNode3", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode4"; state->dataLoopNodes->NodeID(2) = "ReturnNode4"; @@ -686,10 +682,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode4", SupplyNodeName); - EXPECT_EQ("ReturnNode4", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode4", SupplyNodeName); + EXPECT_EQ("ReturnNode4", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode5"; state->dataLoopNodes->NodeID(2) = "ReturnNode5"; @@ -702,10 +697,10 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode5", SupplyNodeName); - EXPECT_EQ("ReturnNode5", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode5", SupplyNodeName); + EXPECT_EQ("ReturnNode5", ReturnNodeName); + state->dataLoopNodes->NodeID(1) = "SupplyNode6"; state->dataLoopNodes->NodeID(2) = "ReturnNode6"; zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir; @@ -717,10 +712,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirOutNode = 1; state->dataUnitarySystems->unitarySys[EquipIndex - 1].AirInNode = 2; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode6", SupplyNodeName); - EXPECT_EQ("ReturnNode6", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode6", SupplyNodeName); + EXPECT_EQ("ReturnNode6", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode7"; state->dataLoopNodes->NodeID(2) = "ReturnNode7"; @@ -732,10 +726,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitHeaters->GetUnitHeaterInputFlag = false; state->dataUnitHeaters->UnitHeat(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode7", SupplyNodeName); - EXPECT_EQ("ReturnNode7", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode7", SupplyNodeName); + EXPECT_EQ("ReturnNode7", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode8"; state->dataLoopNodes->NodeID(2) = "ReturnNode8"; @@ -747,10 +740,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataUnitVentilators->UnitVent(EquipIndex).Name = EquipName; state->dataUnitVentilators->GetUnitVentilatorInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode8", SupplyNodeName); - EXPECT_EQ("ReturnNode8", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode8", SupplyNodeName); + EXPECT_EQ("ReturnNode8", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode9"; state->dataLoopNodes->NodeID(2) = "ReturnNode9"; @@ -762,10 +754,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataVentilatedSlab->GetInputFlag = false; state->dataVentilatedSlab->VentSlab(EquipIndex).Name = EquipName; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode9", SupplyNodeName); - EXPECT_EQ("ReturnNode9", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode9", SupplyNodeName); + EXPECT_EQ("ReturnNode9", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode10"; state->dataLoopNodes->NodeID(2) = "ReturnNode10"; @@ -782,10 +773,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataWindowAC->WindAC(EquipIndex).Name = EquipName; state->dataMixedAir->GetOAMixerInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode10", SupplyNodeName); - EXPECT_EQ("ReturnNode10", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode10", SupplyNodeName); + EXPECT_EQ("ReturnNode10", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode11"; state->dataLoopNodes->NodeID(2) = "ReturnNode11"; @@ -796,10 +786,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataZoneDehumidifier->ZoneDehumid(EquipIndex).Name = EquipName; state->dataZoneDehumidifier->GetInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode11", SupplyNodeName); - EXPECT_EQ("ReturnNode11", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode11", SupplyNodeName); + EXPECT_EQ("ReturnNode11", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode12"; state->dataLoopNodes->NodeID(2) = "ReturnNode12"; @@ -811,10 +800,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataPurchasedAirMgr->PurchAir(EquipIndex).Name = EquipName; state->dataPurchasedAirMgr->GetPurchAirInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode12", SupplyNodeName); - EXPECT_EQ("ReturnNode12", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode12", SupplyNodeName); + EXPECT_EQ("ReturnNode12", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode13"; state->dataLoopNodes->NodeID(2) = "ReturnNode13"; @@ -826,10 +814,9 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).Name = EquipName; state->dataHybridUnitaryAC->GetInputZoneHybridEvap = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode13", SupplyNodeName); - EXPECT_EQ("ReturnNode13", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode13", SupplyNodeName); + EXPECT_EQ("ReturnNode13", ReturnNodeName); state->dataLoopNodes->NodeID(1) = "SupplyNode14"; state->dataLoopNodes->NodeID(2) = "ReturnNode14"; @@ -841,8 +828,7 @@ TEST_F(EnergyPlusFixture, RoomAirflowNetwork_CheckEquipName_Test) state->dataWaterThermalTanks->HPWaterHeater(EquipIndex).Name = EquipName; state->dataWaterThermalTanks->getWaterThermalTankInputFlag = false; check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, zoneEquipType); - if (check) { - EXPECT_EQ("SupplyNode14", SupplyNodeName); - EXPECT_EQ("ReturnNode14", ReturnNodeName); - } + EXPECT_TRUE(check); + EXPECT_EQ("SupplyNode14", SupplyNodeName); + EXPECT_EQ("ReturnNode14", ReturnNodeName); } From 0719aba796923e4253fe7edfa625ff9cbc600308 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Mon, 15 Jul 2024 09:48:19 -0400 Subject: [PATCH 20/21] Revise GetIndex functions --- src/EnergyPlus/FanCoilUnits.cc | 8 ++-- src/EnergyPlus/FanCoilUnits.hh | 2 +- src/EnergyPlus/HVACStandAloneERV.cc | 9 ++-- src/EnergyPlus/HVACStandAloneERV.hh | 2 +- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 9 ++-- src/EnergyPlus/HVACVariableRefrigerantFlow.hh | 2 +- .../HybridUnitaryAirConditioners.cc | 9 ++-- .../HybridUnitaryAirConditioners.hh | 2 +- src/EnergyPlus/OutdoorAirUnit.cc | 8 ++-- src/EnergyPlus/OutdoorAirUnit.hh | 2 +- src/EnergyPlus/PurchasedAirManager.cc | 8 ++-- src/EnergyPlus/PurchasedAirManager.hh | 2 +- src/EnergyPlus/RoomAirModelManager.cc | 45 ++++++++++++------- src/EnergyPlus/UnitHeater.cc | 9 ++-- src/EnergyPlus/UnitHeater.hh | 2 +- src/EnergyPlus/UnitVentilator.cc | 8 ++-- src/EnergyPlus/UnitVentilator.hh | 2 +- src/EnergyPlus/UnitarySystem.cc | 10 ++--- src/EnergyPlus/UnitarySystem.hh | 1 - src/EnergyPlus/VentilatedSlab.cc | 8 ++-- src/EnergyPlus/VentilatedSlab.hh | 2 +- src/EnergyPlus/WaterThermalTanks.cc | 8 ++-- src/EnergyPlus/WaterThermalTanks.hh | 2 +- src/EnergyPlus/WindowAC.cc | 8 ++-- src/EnergyPlus/WindowAC.hh | 2 +- src/EnergyPlus/ZoneDehumidifier.cc | 8 ++-- src/EnergyPlus/ZoneDehumidifier.hh | 2 +- 27 files changed, 83 insertions(+), 97 deletions(-) diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 1e05e8f7056..7c27178d74f 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -4419,23 +4419,21 @@ namespace FanCoilUnits { } } - int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + int getEqIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataFanCoilUnits->GetFanCoilInputFlag) { GetFanCoilUnits(state); state.dataFanCoilUnits->GetFanCoilInputFlag = false; } - int EquipIndex = 0; for (int FanCoilIndex = 1; FanCoilIndex <= state.dataFanCoilUnits->NumFanCoils; ++FanCoilIndex) { auto &fanCoil = state.dataFanCoilUnits->FanCoil(FanCoilIndex); if (Util::SameString(fanCoil.Name, CompName)) { - EquipIndex = FanCoilIndex; + return FanCoilIndex; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } } // namespace FanCoilUnits diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 29027338d5e..68983667875 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -380,7 +380,7 @@ namespace FanCoilUnits { int WaterControlNode, Real64 MinWaterFlow); - int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getEqIndex(EnergyPlusData &state, std::string_view CompName); } // namespace FanCoilUnits struct FanCoilUnitsData : BaseGlobalStruct diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index 70a45717c66..15438f65487 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -1685,23 +1685,20 @@ bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int const NodeNumber) return false; } -int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) +int getEqIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataHVACStandAloneERV->GetERVInputFlag) { GetStandAloneERV(state); state.dataHVACStandAloneERV->GetERVInputFlag = false; } - int EqIndex = 0; - for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) { if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) { - EqIndex = StandAloneERVNum; + return StandAloneERVNum; break; } } - if (EqIndex == 0) errFlag = true; - return EqIndex; + return 0; } } // namespace EnergyPlus::HVACStandAloneERV diff --git a/src/EnergyPlus/HVACStandAloneERV.hh b/src/EnergyPlus/HVACStandAloneERV.hh index 665ae2f00fb..382cbea51bb 100644 --- a/src/EnergyPlus/HVACStandAloneERV.hh +++ b/src/EnergyPlus/HVACStandAloneERV.hh @@ -186,7 +186,7 @@ namespace HVACStandAloneERV { bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int NodeNumber); - int getEqIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getEqIndex(EnergyPlusData &state, std::string_view CompName); } // namespace HVACStandAloneERV diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 9e2dbe24869..6199ffb605a 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -10761,22 +10761,19 @@ int GetVRFTUReturnAirNode(EnergyPlusData &state, int const VRFTUNum) } } -int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName, bool &errFlag) +int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName) { if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - int EqIndex = 0; for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; VRFTUNum++) { if (Util::SameString(VRFTUName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)) { - EqIndex = VRFTUNum; - break; + return VRFTUNum; } } - if (EqIndex == 0) errFlag = true; - return EqIndex; + return 0; } void getVRFTUZoneLoad( diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index bfef04ef8ed..71e60fa8ea7 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -974,7 +974,7 @@ namespace HVACVariableRefrigerantFlow { Real64 const T_suc // Compressor suction temperature Te' [C] ); - int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName, bool &errFlag); + int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName); } // namespace HVACVariableRefrigerantFlow diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.cc b/src/EnergyPlus/HybridUnitaryAirConditioners.cc index 50069e27aee..53b21ca0716 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.cc +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.cc @@ -1366,22 +1366,21 @@ int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int const CompNum) return GetHybridUnitaryACReturnAirNode; } -int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) +int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName) { + bool errFlag = false; if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) { GetInputZoneHybridUnitaryAirConditioners(state, errFlag); state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false; } - int EquipIndex = 0; for (int UnitLoop = 1; UnitLoop <= state.dataHybridUnitaryAC->NumZoneHybridEvap; ++UnitLoop) { if (Util::SameString(state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitLoop).Name, CompName)) { - EquipIndex = UnitLoop; + return UnitLoop; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } //***************************************************************************************** diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.hh b/src/EnergyPlus/HybridUnitaryAirConditioners.hh index 1ba96080b7d..c93210bcff9 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.hh +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.hh @@ -98,7 +98,7 @@ namespace HybridUnitaryAirConditioners { int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int UnitNum); - int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName); } // namespace HybridUnitaryAirConditioners diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index 4d993fdde39..153fa01875b 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -2471,22 +2471,20 @@ namespace OutdoorAirUnit { return GetOutdoorAirUnitReturnAirNode; } - int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName, bool &errFlag) + int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName) { if (state.dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag) { OutdoorAirUnit::GetOutdoorAirUnitInputs(state); state.dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false; } - int EquipIndex = 0; for (int OAUnitNum = 1; OAUnitNum <= state.dataOutdoorAirUnit->NumOfOAUnits; ++OAUnitNum) { if (Util::SameString(state.dataOutdoorAirUnit->OutAirUnit(OAUnitNum).Name, EquipName)) { - EquipIndex = OAUnitNum; + return OAUnitNum; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } } // namespace OutdoorAirUnit diff --git a/src/EnergyPlus/OutdoorAirUnit.hh b/src/EnergyPlus/OutdoorAirUnit.hh index 2115f4c770b..977c9c4f3fc 100644 --- a/src/EnergyPlus/OutdoorAirUnit.hh +++ b/src/EnergyPlus/OutdoorAirUnit.hh @@ -310,7 +310,7 @@ namespace OutdoorAirUnit { int GetOutdoorAirUnitReturnAirNode(EnergyPlusData &state, int OAUnitNum); - int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName, bool &errFlag); + int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName); } // namespace OutdoorAirUnit struct OutdoorAirUnitData : BaseGlobalStruct diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index e3b58a930da..3fd4bf0c89d 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -3318,22 +3318,20 @@ int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int const PurchAirNum) return GetPurchasedAirReturnAirNode; } -int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName, bool &errFlag) +int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName) { if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { GetPurchasedAir(state); state.dataPurchasedAirMgr->GetPurchAirInputFlag = false; } - int EquipIndex = 0; for (int PurchAirNum = 1; PurchAirNum <= state.dataPurchasedAirMgr->NumPurchAir; ++PurchAirNum) { if (Util::SameString(state.dataPurchasedAirMgr->PurchAir(PurchAirNum).Name, PurchAirName)) { - EquipIndex = PurchAirNum; + return PurchAirNum; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int const PurchAirNum) diff --git a/src/EnergyPlus/PurchasedAirManager.hh b/src/EnergyPlus/PurchasedAirManager.hh index a3abb8f515c..d8c7ee1c36d 100644 --- a/src/EnergyPlus/PurchasedAirManager.hh +++ b/src/EnergyPlus/PurchasedAirManager.hh @@ -379,7 +379,7 @@ namespace PurchasedAirManager { int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int PurchAirNum); - int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName, bool &errFlag); + int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName); Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int PurchAirNum); diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 7b8c40f8ed6..8c890593867 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2723,55 +2723,66 @@ namespace RoomAir { switch (zoneEquipType) { case DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal: { // ZoneHVAC:TerminalUnit : VariableRefrigerantFlow - EquipIndex = HVACVariableRefrigerantFlow::getEqIndex(state, EquipName, errorfound); + EquipIndex = HVACVariableRefrigerantFlow::getEqIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; SupplyNodeNum = state.dataHVACVarRefFlow->VRFTU(EquipIndex).VRFTUOutletNodeNum; } break; case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { // ZoneHVAC : EnergyRecoveryVentilator - EquipIndex = HVACStandAloneERV::getEqIndex(state, EquipName, errorfound); + EquipIndex = HVACStandAloneERV::getEqIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; SupplyNodeNum = state.dataHVACStandAloneERV->StandAloneERV(EquipIndex).SupplyAirInletNode; } break; case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil - EquipIndex = FanCoilUnits::getEqIndex(state, EquipName, errorfound); + EquipIndex = FanCoilUnits::getEqIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; SupplyNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode; ReturnNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirInNode; } break; case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit - EquipIndex = OutdoorAirUnit::getOutdoorAirUnitEqIndex(state, EquipName, errorfound); + EquipIndex = OutdoorAirUnit::getOutdoorAirUnitEqIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; SupplyNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirOutletNode; ReturnNodeNum = state.dataOutdoorAirUnit->OutAirUnit(EquipIndex).AirInletNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner - EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); + EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType); + if (EquipIndex == -1) return EquipFind; SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump: { // ZoneHVAC : PackagedTerminalHeatPump - EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); + EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType); + if (EquipIndex == -1) return EquipFind; SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::UnitHeater: { // ZoneHVAC : UnitHeater - EquipIndex = UnitHeater::getUnitHeaterIndex(state, EquipName, errorfound); + EquipIndex = UnitHeater::getUnitHeaterIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirInNode; SupplyNodeNum = state.dataUnitHeaters->UnitHeat(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::UnitVentilator: { // ZoneHVAC : UnitVentilator - EquipIndex = UnitVentilator::getUnitVentilatorIndex(state, EquipName, errorfound); + EquipIndex = UnitVentilator::getUnitVentilatorIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirInNode; SupplyNodeNum = state.dataUnitVentilators->UnitVent(EquipIndex).AirOutNode; } break; case DataZoneEquipment::ZoneEquipType::VentilatedSlab: { // ZoneHVAC : VentilatedSlab - EquipIndex = VentilatedSlab::getVentilatedSlabIndex(state, EquipName, errorfound); + EquipIndex = VentilatedSlab::getVentilatedSlabIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ReturnAirNode; SupplyNodeNum = state.dataVentilatedSlab->VentSlab(EquipIndex).ZoneAirInNode; } break; case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // ZoneHVAC : WaterToAirHeatPump - EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType, errorfound); + EquipIndex = UnitarySystems::getZoneEqIndex(state, EquipName, zoneEquipType); + if (EquipIndex == -1) return EquipFind; SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirOutNode; ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex].AirInNode; } break; case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // ZoneHVAC : WindowAirConditioner - EquipIndex = WindowAC::getWindowACIndex(state, EquipName, errorfound); + EquipIndex = WindowAC::getWindowACIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirInNode; SupplyNodeNum = state.dataWindowAC->WindAC(EquipIndex).AirOutNode; } break; @@ -2800,12 +2811,14 @@ namespace RoomAir { SupplyNodeName = ""; } break; case DataZoneEquipment::ZoneEquipType::DehumidifierDX: { // ZoneHVAC : Dehumidifier : DX - EquipIndex = ZoneDehumidifier::getZoneDehumidifierIndex(state, EquipName, errorfound); + EquipIndex = ZoneDehumidifier::getZoneDehumidifierIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirInletNodeNum; SupplyNodeNum = state.dataZoneDehumidifier->ZoneDehumid(EquipIndex).AirOutletNodeNum; } break; case DataZoneEquipment::ZoneEquipType::PurchasedAir: { // ZoneHVAC : IdealLoadsAirSystem - EquipIndex = PurchasedAirManager::getPurchasedAirIndex(state, EquipName, errorfound); + EquipIndex = PurchasedAirManager::getPurchasedAirIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneExhaustAirNodeNum; SupplyNodeNum = state.dataPurchasedAirMgr->PurchAir(EquipIndex).ZoneSupplyAirNodeNum; } break; @@ -2815,7 +2828,8 @@ namespace RoomAir { // ReturnNodeName = Alphas(4); } break; case DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler: { // ZoneHVAC : HybridUnitaryAirConditioners - EquipIndex = HybridUnitaryAirConditioners::getHybridUnitaryACIndex(state, EquipName, errorfound); + EquipIndex = HybridUnitaryAirConditioners::getHybridUnitaryACIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).InletNode; SupplyNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(EquipIndex).OutletNode; } break; @@ -2824,7 +2838,8 @@ namespace RoomAir { // SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use } break; case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: { // WaterHeater : HeatPump - EquipIndex = WaterThermalTanks::getHeatPumpWaterHeaterIndex(state, EquipName, errorfound); + EquipIndex = WaterThermalTanks::getHeatPumpWaterHeaterIndex(state, EquipName); + if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirInletNode; SupplyNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirOutletNode; // For AirTerminals, find matching return node later diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index e1ced26febe..ab65383c24d 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -1894,21 +1894,20 @@ namespace UnitHeater { } } - int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { GetUnitHeaterInput(state); state.dataUnitHeaters->GetUnitHeaterInputFlag = false; } - int EquipIndex = 0; + for (int UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) { if (Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, CompName)) { - EquipIndex = UnitHeatNum; + return UnitHeatNum; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } } // namespace UnitHeater diff --git a/src/EnergyPlus/UnitHeater.hh b/src/EnergyPlus/UnitHeater.hh index cdba6ccda1e..d0a95f1011e 100644 --- a/src/EnergyPlus/UnitHeater.hh +++ b/src/EnergyPlus/UnitHeater.hh @@ -202,7 +202,7 @@ namespace UnitHeater { void ReportUnitHeater(EnergyPlusData &state, int const UnitHeatNum); // Unit index in unit heater array - int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName); } // namespace UnitHeater struct UnitHeatersData : BaseGlobalStruct diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index e12e922e7a4..3d9352d8a1a 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -3365,21 +3365,19 @@ namespace UnitVentilator { return GetUnitVentilatorReturnAirNode; } - int getUnitVentilatorIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + int getUnitVentilatorIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataUnitVentilators->GetUnitVentilatorInputFlag) { GetUnitVentilatorInput(state); state.dataUnitVentilators->GetUnitVentilatorInputFlag = false; } - int EquipIndex = 0; for (int UnitVentNum = 1; UnitVentNum <= state.dataUnitVentilators->NumOfUnitVents; ++UnitVentNum) { if (Util::SameString(state.dataUnitVentilators->UnitVent(UnitVentNum).Name, CompName)) { - EquipIndex = UnitVentNum; + return UnitVentNum; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } Real64 SetOAMassFlowRateForCoolingVariablePercent(EnergyPlusData &state, diff --git a/src/EnergyPlus/UnitVentilator.hh b/src/EnergyPlus/UnitVentilator.hh index 97822f24d09..2dada2c6b8f 100644 --- a/src/EnergyPlus/UnitVentilator.hh +++ b/src/EnergyPlus/UnitVentilator.hh @@ -262,7 +262,7 @@ namespace UnitVentilator { int GetUnitVentilatorReturnAirNode(EnergyPlusData &state, int const UnitVentNum); - int getUnitVentilatorIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getUnitVentilatorIndex(EnergyPlusData &state, std::string_view CompName); Real64 SetOAMassFlowRateForCoolingVariablePercent(EnergyPlusData &state, int const UnitVentNum, // Unit Ventilator index number diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 3feee353b20..22f8ca3c664 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -16574,8 +16574,7 @@ namespace UnitarySystems { return airNode; } - int getZoneEqIndex( - EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag, int const OAUnitNum) + int getZoneEqIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, int const OAUnitNum) { if (state.dataUnitarySystems->getInputOnceFlag) { @@ -16583,20 +16582,17 @@ namespace UnitarySystems { state.dataUnitarySystems->getInputOnceFlag = false; } - int EquipIndex = -1; for (int UnitarySysNum = 0; UnitarySysNum < state.dataUnitarySystems->numUnitarySystems; ++UnitarySysNum) { if (Util::SameString(UnitarySysName, state.dataUnitarySystems->unitarySys[UnitarySysNum].Name)) { if (zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner || zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump || zoneEquipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir || zoneEquipType == DataZoneEquipment::ZoneEquipType::UnitarySystem) { - EquipIndex = UnitarySysNum; - break; + return UnitarySysNum; } } } - if (EquipIndex < 0) errFlag = true; - return EquipIndex; + return -1; } int UnitarySys::getAirOutNode(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum, bool &errFlag) diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index 7572c556e4b..d1036eef855 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -969,7 +969,6 @@ namespace UnitarySystems { int getZoneEqIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, - bool &errFlag, int const OAUnitNum = 0); } // namespace UnitarySystems diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 1de17f5c2e0..396d604b928 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -4762,22 +4762,20 @@ namespace VentilatedSlab { } } - int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataVentilatedSlab->GetInputFlag) { GetVentilatedSlabInput(state); state.dataVentilatedSlab->GetInputFlag = false; } - int EquipIndex = 0; for (int VentSlabNum = 1; VentSlabNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++VentSlabNum) { if (Util::SameString(state.dataVentilatedSlab->VentSlab(VentSlabNum).Name, CompName)) { - EquipIndex = VentSlabNum; + return VentSlabNum; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } //***************************************************************************************** diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index 43dcf328ba5..7d2437567aa 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -383,7 +383,7 @@ namespace VentilatedSlab { void ReportVentilatedSlab(EnergyPlusData &state, int const Item); // Index for the ventilated slab under consideration within the derived types - int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getVentilatedSlabIndex(EnergyPlusData &state, std::string_view CompName); //***************************************************************************************** } // namespace VentilatedSlab diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index e0b2b075c45..797bf7b5e14 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -12464,22 +12464,20 @@ bool GetHeatPumpWaterHeaterNodeNumber(EnergyPlusData &state, int const NodeNumbe return HeatPumpWaterHeaterNodeException; } -int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) +int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { GetWaterThermalTankInput(state); state.dataWaterThermalTanks->getWaterThermalTankInputFlag = false; } - int EquipIndex = 0; for (int HPNum = 1; HPNum <= state.dataWaterThermalTanks->numHeatPumpWaterHeater; ++HPNum) { if (Util::SameString(state.dataWaterThermalTanks->HPWaterHeater(HPNum).Name, CompName)) { - EquipIndex = HPNum; + return HPNum; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } } // namespace EnergyPlus::WaterThermalTanks diff --git a/src/EnergyPlus/WaterThermalTanks.hh b/src/EnergyPlus/WaterThermalTanks.hh index a64c6c46e16..db9657f0809 100644 --- a/src/EnergyPlus/WaterThermalTanks.hh +++ b/src/EnergyPlus/WaterThermalTanks.hh @@ -991,7 +991,7 @@ namespace WaterThermalTanks { bool GetHeatPumpWaterHeaterNodeNumber(EnergyPlusData &state, int NodeNumber); - int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName); } // namespace WaterThermalTanks diff --git a/src/EnergyPlus/WindowAC.cc b/src/EnergyPlus/WindowAC.cc index 9d405e13750..29d26ebe298 100644 --- a/src/EnergyPlus/WindowAC.cc +++ b/src/EnergyPlus/WindowAC.cc @@ -1619,22 +1619,20 @@ namespace WindowAC { return GetWindowACMixedAirNode; } - int getWindowACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + int getWindowACIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataWindowAC->GetWindowACInputFlag) { GetWindowAC(state); state.dataWindowAC->GetWindowACInputFlag = false; } - int EquipIndex = 0; for (int WindACIndex = 1; WindACIndex <= state.dataWindowAC->NumWindAC; ++WindACIndex) { if (Util::SameString(state.dataWindowAC->WindAC(WindACIndex).Name, CompName)) { - EquipIndex = WindACIndex; + return WindACIndex; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } } // namespace WindowAC diff --git a/src/EnergyPlus/WindowAC.hh b/src/EnergyPlus/WindowAC.hh index 4a61d04e164..81db5207b14 100644 --- a/src/EnergyPlus/WindowAC.hh +++ b/src/EnergyPlus/WindowAC.hh @@ -205,7 +205,7 @@ namespace WindowAC { int GetWindowACMixedAirNode(EnergyPlusData &state, int const WindACNum); - int getWindowACIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getWindowACIndex(EnergyPlusData &state, std::string_view CompName); } // namespace WindowAC diff --git a/src/EnergyPlus/ZoneDehumidifier.cc b/src/EnergyPlus/ZoneDehumidifier.cc index 0eafa52b1ab..95ec5aa25d2 100644 --- a/src/EnergyPlus/ZoneDehumidifier.cc +++ b/src/EnergyPlus/ZoneDehumidifier.cc @@ -1179,22 +1179,20 @@ namespace ZoneDehumidifier { return FindZoneDehumidifierNodeNumber; } - int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) + int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName) { if (state.dataZoneDehumidifier->GetInputFlag) { GetZoneDehumidifierInput(state); state.dataZoneDehumidifier->GetInputFlag = false; } - int EquipIndex = 0; for (int ZoneDehumidNum = 1; ZoneDehumidNum <= (int)state.dataZoneDehumidifier->ZoneDehumid.size(); ++ZoneDehumidNum) { if (Util::SameString(state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidNum).Name, CompName)) { - EquipIndex = ZoneDehumidNum; + return ZoneDehumidNum; } } - if (EquipIndex == 0) errFlag = true; - return EquipIndex; + return 0; } } // namespace ZoneDehumidifier diff --git a/src/EnergyPlus/ZoneDehumidifier.hh b/src/EnergyPlus/ZoneDehumidifier.hh index 7232d040b29..1e62add786d 100644 --- a/src/EnergyPlus/ZoneDehumidifier.hh +++ b/src/EnergyPlus/ZoneDehumidifier.hh @@ -153,7 +153,7 @@ namespace ZoneDehumidifier { bool GetZoneDehumidifierNodeNumber(EnergyPlusData &state, int NodeNumber); // Node being tested - int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag); + int getZoneDehumidifierIndex(EnergyPlusData &state, std::string_view CompName); } // namespace ZoneDehumidifier From 5059ae9cabf2ec07eb8f59111b6a2f5b7b1259c5 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Mon, 15 Jul 2024 10:30:44 -0400 Subject: [PATCH 21/21] Clang format --- src/EnergyPlus/UnitarySystem.hh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index d1036eef855..287bd57cac3 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -966,10 +966,8 @@ namespace UnitarySystems { void setupAllOutputVars(EnergyPlusData &state, int const numAllSystemTypes); void isWaterCoilHeatRecoveryType(EnergyPlusData const &state, int const waterCoilNodeNum, bool &nodeNotFound); - int getZoneEqIndex(EnergyPlusData &state, - std::string const &UnitarySysName, - DataZoneEquipment::ZoneEquipType zoneEquipType, - int const OAUnitNum = 0); + int + getZoneEqIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, int const OAUnitNum = 0); } // namespace UnitarySystems struct UnitarySystemsData : BaseGlobalStruct