Skip to content

Commit

Permalink
Get correct index for unitary
Browse files Browse the repository at this point in the history
  • Loading branch information
lgu1234 committed May 29, 2024
1 parent 264dc63 commit 1d30477
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/EnergyPlus/RoomAirModelManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;

This comment has been minimized.

Copy link
@rraustad

rraustad May 29, 2024

Contributor

I don't see AirLoopHVAC:UnitarySystem in this switch/case list of equipment so will need to be updated eventually.

case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // ZoneHVAC : WindowAirConditioner
ReturnNodeNum = WindowAC::GetWindowACReturnAirNode(state, EquipIndex);
Expand Down
19 changes: 19 additions & 0 deletions src/EnergyPlus/UnitarySystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16581,6 +16581,25 @@ namespace UnitarySystems {
return airNode;
}

int
getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag)
{

This comment has been minimized.

Copy link
@rraustad

rraustad May 29, 2024

Contributor

You need to add getInput here:

    if (state.dataUnitarySystems->getInputOnceFlag) {
        getUnitarySystemInput(state, UnitarySysName, false, ZoneOAUnitNum);
        state.dataUnitarySystems->getInputOnceFlag = false;
    }
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) {

This comment has been minimized.

Copy link
@rraustad

rraustad May 29, 2024

Contributor

Why is this function only checking for PTUnits? This should be generic and find any type of equipment managed by UnitarySystem.

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

5 comments on commit 1d30477

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

RAFN-CheckEquipName-Issue (lgu1234) - Win64-Windows-10-VisualStudio-16: OK (2778 of 2778 tests passed, 0 test warnings)

Build Badge Test Badge

@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.

RAFN-CheckEquipName-Issue (lgu1234) - x86_64-MacOS-10.18-clang-15.0.0: OK (3565 of 3566 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: EIO diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 786
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

RAFN-CheckEquipName-Issue (lgu1234) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3606 of 3607 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: EIO diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 806
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

RAFN-CheckEquipName-Issue (lgu1234) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1990 of 1990 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

RAFN-CheckEquipName-Issue (lgu1234) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (791 of 791 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.