From b0db80055fbb862803a3400098cbaa06ba557f16 Mon Sep 17 00:00:00 2001 From: Lixing Gu Date: Thu, 28 Mar 2024 10:46:56 -0400 Subject: [PATCH] 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); + } +}