Skip to content

Commit

Permalink
Merge pull request #10452 from NREL/RAFN-CheckEquipName-Issue
Browse files Browse the repository at this point in the history
Refactor RAFN CheckEquipName for forced air zone equipment
  • Loading branch information
Myoldmopar authored Jul 25, 2024
2 parents 980120d + 5059ae9 commit e85c6ac
Show file tree
Hide file tree
Showing 30 changed files with 655 additions and 146 deletions.
6 changes: 4 additions & 2 deletions idd/Energy+.idd.in
Original file line number Diff line number Diff line change
Expand Up @@ -21309,7 +21309,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
Expand Down Expand Up @@ -21359,7 +21360,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
Expand Down
17 changes: 17 additions & 0 deletions src/EnergyPlus/FanCoilUnits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4419,6 +4419,23 @@ namespace FanCoilUnits {
}
}

int getEqIndex(EnergyPlusData &state, std::string_view CompName)
{
if (state.dataFanCoilUnits->GetFanCoilInputFlag) {
GetFanCoilUnits(state);
state.dataFanCoilUnits->GetFanCoilInputFlag = false;
}

for (int FanCoilIndex = 1; FanCoilIndex <= state.dataFanCoilUnits->NumFanCoils; ++FanCoilIndex) {
auto &fanCoil = state.dataFanCoilUnits->FanCoil(FanCoilIndex);
if (Util::SameString(fanCoil.Name, CompName)) {
return FanCoilIndex;
}
}

return 0;
}

} // namespace FanCoilUnits

} // namespace EnergyPlus
3 changes: 2 additions & 1 deletion src/EnergyPlus/FanCoilUnits.hh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ 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 const FanCoilNum);

int GetFanCoilOutAirNode(EnergyPlusData &state, int FanCoilNum);

Expand Down Expand Up @@ -380,6 +380,7 @@ namespace FanCoilUnits {
int WaterControlNode,
Real64 MinWaterFlow);

int getEqIndex(EnergyPlusData &state, std::string_view CompName);
} // namespace FanCoilUnits

struct FanCoilUnitsData : BaseGlobalStruct
Expand Down
16 changes: 16 additions & 0 deletions src/EnergyPlus/HVACStandAloneERV.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1685,4 +1685,20 @@ bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int const NodeNumber)
return false;
}

int getEqIndex(EnergyPlusData &state, std::string_view CompName)
{
if (state.dataHVACStandAloneERV->GetERVInputFlag) {
GetStandAloneERV(state);
state.dataHVACStandAloneERV->GetERVInputFlag = false;
}

for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) {
if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) {
return StandAloneERVNum;
break;
}
}
return 0;
}

} // namespace EnergyPlus::HVACStandAloneERV
2 changes: 2 additions & 0 deletions src/EnergyPlus/HVACStandAloneERV.hh
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ namespace HVACStandAloneERV {

bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int NodeNumber);

int getEqIndex(EnergyPlusData &state, std::string_view CompName);

} // namespace HVACStandAloneERV

struct HVACStandAloneERVData : BaseGlobalStruct
Expand Down
15 changes: 15 additions & 0 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10757,6 +10757,21 @@ int GetVRFTUReturnAirNode(EnergyPlusData &state, int const VRFTUNum)
}
}

int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName)
{
if (state.dataHVACVarRefFlow->GetVRFInputFlag) {
GetVRFInput(state);
state.dataHVACVarRefFlow->GetVRFInputFlag = false;
}

for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; VRFTUNum++) {
if (Util::SameString(VRFTUName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)) {
return VRFTUNum;
}
}
return 0;
}

void getVRFTUZoneLoad(
EnergyPlusData &state, int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag)
{
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,8 @@ namespace HVACVariableRefrigerantFlow {
Real64 const T_suc // Compressor suction temperature Te' [C]
);

int getEqIndex(EnergyPlusData &state, std::string_view VRFTUName);

} // namespace HVACVariableRefrigerantFlow

struct HVACVarRefFlowData : BaseGlobalStruct
Expand Down
17 changes: 17 additions & 0 deletions src/EnergyPlus/HybridUnitaryAirConditioners.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,23 @@ int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int const CompNum)
return GetHybridUnitaryACReturnAirNode;
}

int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName)
{
bool errFlag = false;
if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) {
GetInputZoneHybridUnitaryAirConditioners(state, errFlag);
state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false;
}

for (int UnitLoop = 1; UnitLoop <= state.dataHybridUnitaryAC->NumZoneHybridEvap; ++UnitLoop) {
if (Util::SameString(state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitLoop).Name, CompName)) {
return UnitLoop;
}
}

return 0;
}

//*****************************************************************************************

} // namespace EnergyPlus::HybridUnitaryAirConditioners
2 changes: 2 additions & 0 deletions src/EnergyPlus/HybridUnitaryAirConditioners.hh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ namespace HybridUnitaryAirConditioners {

int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int UnitNum);

int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName);

} // namespace HybridUnitaryAirConditioners

struct HybridUnitaryAirConditionersData : BaseGlobalStruct
Expand Down
16 changes: 16 additions & 0 deletions src/EnergyPlus/OutdoorAirUnit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,22 @@ namespace OutdoorAirUnit {
return GetOutdoorAirUnitReturnAirNode;
}

int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName)
{
if (state.dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag) {
OutdoorAirUnit::GetOutdoorAirUnitInputs(state);
state.dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false;
}

for (int OAUnitNum = 1; OAUnitNum <= state.dataOutdoorAirUnit->NumOfOAUnits; ++OAUnitNum) {
if (Util::SameString(state.dataOutdoorAirUnit->OutAirUnit(OAUnitNum).Name, EquipName)) {
return OAUnitNum;
}
}

return 0;
}

} // namespace OutdoorAirUnit

} // namespace EnergyPlus
2 changes: 2 additions & 0 deletions src/EnergyPlus/OutdoorAirUnit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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);
} // namespace OutdoorAirUnit

struct OutdoorAirUnitData : BaseGlobalStruct
Expand Down
16 changes: 16 additions & 0 deletions src/EnergyPlus/PurchasedAirManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3318,6 +3318,22 @@ int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int const PurchAirNum)
return GetPurchasedAirReturnAirNode;
}

int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName)
{
if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) {
GetPurchasedAir(state);
state.dataPurchasedAirMgr->GetPurchAirInputFlag = false;
}

for (int PurchAirNum = 1; PurchAirNum <= state.dataPurchasedAirMgr->NumPurchAir; ++PurchAirNum) {
if (Util::SameString(state.dataPurchasedAirMgr->PurchAir(PurchAirNum).Name, PurchAirName)) {
return PurchAirNum;
}
}

return 0;
}

Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int const PurchAirNum)
{

Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/PurchasedAirManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ namespace PurchasedAirManager {

int GetPurchasedAirReturnAirNode(EnergyPlusData &state, int PurchAirNum);

int getPurchasedAirIndex(EnergyPlusData &state, std::string_view PurchAirName);

Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int PurchAirNum);

Real64 GetPurchasedAirMixedAirHumRat(EnergyPlusData &state, int PurchAirNum);
Expand Down
Loading

1 comment on commit e85c6ac

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-MacOS-10.18-clang-15.0.0: OK (2856 of 2856 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.