Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into VRFFluidFixCooling…
Browse files Browse the repository at this point in the history
…TUCap
  • Loading branch information
Yujie Xu committed Jun 27, 2024
2 parents 867e464 + e2c4305 commit 8f63776
Show file tree
Hide file tree
Showing 5 changed files with 325 additions and 84 deletions.
182 changes: 105 additions & 77 deletions src/EnergyPlus/ReportCoilSelection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -625,45 +625,7 @@ void ReportCoilSelection::doZoneEqSetup(EnergyPlusData &state, int const coilVec
}

if (c->zoneEqNum > 0) {
c->coilLocation = "Unknown";
c->typeHVACname = "Unknown";
c->userNameforHVACsystem = "Unknown";
// now search equiment
if (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes == 1) { // this must be it, fill strings for type and name
c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeName(1);
c->userNameforHVACsystem = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(1);
c->coilLocation = "Zone Equipment";
c->zoneHVACTypeNum = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(1);
c->zoneHVACIndex = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipIndex(1);
} else if (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes > 1) {
bool foundOne(false);
for (int equipLoop = 1; equipLoop <= state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes; ++equipLoop) {
// go with the first ZoneHVAC device in the list
DataZoneEquipment::ZoneEquipType equipType = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop);
if (equipType == DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal ||
equipType == DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator ||
equipType == DataZoneEquipment::ZoneEquipType::FourPipeFanCoil || equipType == DataZoneEquipment::ZoneEquipType::OutdoorAirUnit ||
equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner ||
equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump ||
equipType == DataZoneEquipment::ZoneEquipType::UnitHeater || equipType == DataZoneEquipment::ZoneEquipType::UnitVentilator ||
equipType == DataZoneEquipment::ZoneEquipType::VentilatedSlab ||
equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir ||
equipType == DataZoneEquipment::ZoneEquipType::WindowAirConditioner ||
equipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) {
if (!foundOne) {
c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeName(equipLoop);
c->userNameforHVACsystem = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(equipLoop);
foundOne = true;
c->coilLocation = "Zone Equipment";
c->zoneHVACTypeNum = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop);
c->zoneHVACIndex = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipIndex(equipLoop);
} else { // or may have found another
c->typeHVACname += " or " + state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeName(equipLoop);
c->userNameforHVACsystem += " or " + state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(equipLoop);
}
}
}
}
associateZoneCoilWithParent(state, c);
}
}

Expand All @@ -675,44 +637,8 @@ void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state)
// mine final/hard values from coil models

if (c->zoneEqNum > 0) {
c->coilLocation = "Unknown";
c->typeHVACname = "Unknown";
c->userNameforHVACsystem = "Unknown";
// now search equipment
auto const &zoneEquipList = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum);
if (zoneEquipList.NumOfEquipTypes == 1) { // this must be it, fill strings for type and name
c->typeHVACname = zoneEquipList.EquipTypeName(1);
c->userNameforHVACsystem = zoneEquipList.EquipName(1);
c->coilLocation = "Zone Equipment";
} else if (zoneEquipList.NumOfEquipTypes > 1) {
bool foundOne(false);
for (int equipLoop = 1; equipLoop <= zoneEquipList.NumOfEquipTypes; ++equipLoop) {
// go with the first ZoneHVAC device in the list
DataZoneEquipment::ZoneEquipType equipType = zoneEquipList.EquipType(equipLoop);
if (equipType == DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal ||
equipType == DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator ||
equipType == DataZoneEquipment::ZoneEquipType::FourPipeFanCoil ||
equipType == DataZoneEquipment::ZoneEquipType::OutdoorAirUnit ||
equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner ||
equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump ||
equipType == DataZoneEquipment::ZoneEquipType::UnitHeater || equipType == DataZoneEquipment::ZoneEquipType::UnitVentilator ||
equipType == DataZoneEquipment::ZoneEquipType::VentilatedSlab ||
equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir ||
equipType == DataZoneEquipment::ZoneEquipType::WindowAirConditioner ||
equipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) {
if (!foundOne) {
c->typeHVACname = zoneEquipList.EquipTypeName(equipLoop);
c->userNameforHVACsystem = zoneEquipList.EquipName(equipLoop);
foundOne = true;
c->coilLocation = "Zone Equipment";
} else { // or may have found another
c->typeHVACname += " or " + zoneEquipList.EquipTypeName(equipLoop);
c->userNameforHVACsystem += " or " + zoneEquipList.EquipName(equipLoop);
}
}
} // for (equipLoop)
} // if (zoneEquipList.numOfEquipTypes > 0)
} // if (c->ZoneEqNum > 0)
associateZoneCoilWithParent(state, c);
}

if (c->airloopNum > state.dataHVACGlobal->NumPrimaryAirSys && c->oASysNum > 0) {
c->coilLocation = "DOAS AirLoop";
Expand Down Expand Up @@ -979,6 +905,94 @@ int ReportCoilSelection::getIndexForOrCreateDataObjFromCoilName(EnergyPlusData &
return index;
}

void ReportCoilSelection::associateZoneCoilWithParent(EnergyPlusData &state, std::unique_ptr<CoilSelectionData> &c)
{
c->coilLocation = "Unknown";
c->typeHVACname = "Unknown";
c->userNameforHVACsystem = "Unknown";
// now search equipment
auto const &zoneEquipList = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum);
bool coilFound = false;
std::string fanType;
std::string fanName;
auto thisSubCoilLambda = [&c](const DataZoneEquipment::SubEquipmentData &myCoil) { return myCoil.Name == c->coilName_; };
auto thisSubFanLambda = [](const DataZoneEquipment::SubEquipmentData &myFan) { return myFan.TypeOf.rfind("FAN:", 0) == 0; };
auto thisSubSubCoilLambda = [&c](const DataZoneEquipment::SubSubEquipmentData &myCoil) { return myCoil.Name == c->coilName_; };
auto thisSubSubFanLambda = [](const DataZoneEquipment::SubSubEquipmentData &myFan) { return myFan.TypeOf.rfind("FAN:", 0) == 0; };

for (int equipLoop = 1; equipLoop <= zoneEquipList.NumOfEquipTypes; ++equipLoop) {
// coil should be found only once, fan could be found multiple times, reset here
// for each type of equipment (equipLoop) only one coil and fan could be found as a pair
bool fanFound = false;
auto &thisSubEq = zoneEquipList.EquipData(equipLoop).SubEquipData;

// search for coil and fan SubEquipData and return parent type/name and fan type/name for coil reports.
auto const &coilIterator = std::find_if(thisSubEq.begin(), thisSubEq.end(), thisSubCoilLambda);
if (std::find_if(thisSubEq.begin(), thisSubEq.end(), thisSubCoilLambda) != thisSubEq.end()) {
c->typeHVACname = zoneEquipList.EquipTypeName(equipLoop);
c->userNameforHVACsystem = zoneEquipList.EquipName(equipLoop);
c->coilLocation = "Zone Equipment";
int zoneEqListIndex = Util::FindItemInList(zoneEquipList.Name, state.dataZoneEquip->ZoneEquipList);
if (c->zoneNum.empty()) c->zoneNum.resize(1);
c->zoneNum[0] = zoneEqListIndex;
if (c->zoneName.empty()) c->zoneName.resize(1);
c->zoneName[0] = state.dataHeatBal->Zone(zoneEqListIndex).Name;
coilFound = true;
}
auto const &fanIterator = std::find_if(thisSubEq.begin(), thisSubEq.end(), thisSubFanLambda);
if (fanIterator != thisSubEq.end()) {
unsigned int fanIndex = fanIterator - thisSubEq.begin();
// notice the brackets on the Array1D for [fanIndex]
fanType = thisSubEq[fanIndex].TypeOf;
fanName = thisSubEq[fanIndex].Name;
fanFound = true;
}
// if coil not found in SubEquipData then maybe it's HXAssisted and in SubSubEquipData. Fan is usually already found if exists.
if (!coilFound || !fanFound) {
for (int subEq = 1; subEq <= zoneEquipList.EquipData(equipLoop).NumSubEquip; ++subEq) {
auto &thisSubSubEq = zoneEquipList.EquipData(equipLoop).SubEquipData(subEq).SubSubEquipData;
if (!coilFound) {
auto const &coilIterator2 = std::find_if(thisSubSubEq.begin(), thisSubSubEq.end(), thisSubSubCoilLambda);
if (coilIterator2 != thisSubSubEq.end()) {
c->typeHVACname = zoneEquipList.EquipTypeName(equipLoop);
c->userNameforHVACsystem = zoneEquipList.EquipName(equipLoop);
c->coilLocation = "Zone Equipment";
int zoneEqListIndex = Util::FindItemInList(zoneEquipList.Name, state.dataZoneEquip->ZoneEquipList);
if (c->zoneNum.empty()) c->zoneNum.resize(1);
c->zoneNum[0] = zoneEqListIndex;
if (c->zoneName.empty()) c->zoneName.resize(1);
c->zoneName[0] = state.dataHeatBal->Zone(zoneEqListIndex).Name;
coilFound = true;
}
}
if (!fanFound) {
auto const &fanIterator2 = std::find_if(thisSubSubEq.begin(), thisSubSubEq.end(), thisSubSubFanLambda);
if (fanIterator2 != thisSubSubEq.end()) {
unsigned int fanIndex = fanIterator2 - thisSubSubEq.begin();
// notice the brackets on the Array1D for [fanIndex]
fanType = thisSubSubEq[fanIndex].TypeOf;
fanName = thisSubSubEq[fanIndex].Name;
fanFound = true;
}
}
if (coilFound && fanFound) break;
}
}
if (coilFound) {
if (fanFound) {
c->fanTypeName = fanType;
c->fanAssociatedWithCoilName = fanName;
}
break;
}

} // for (equipLoop)

if (c->typeHVACname == "Unknown") {
ShowWarningError(state, format("Parent object not found for zone coil = {}", c->coilName_));
}
}

void ReportCoilSelection::setRatedCoilConditions(EnergyPlusData &state,
std::string const &coilName, // ! user-defined name of the coil
std::string const &coilObjName, // coil object name, e.g., Coil:Cooling:Water
Expand Down Expand Up @@ -1975,6 +1989,20 @@ void ReportCoilSelection::setCoilSupplyFanInfo(EnergyPlusData &state,
if (c->supFanNum == 0) c->supFanNum = Fans::GetFanIndex(state, fanName);
}

void ReportCoilSelection::setCoilEqNum(EnergyPlusData &state,
std::string const &coilName,
std::string const &coilType,
int const curSysNum,
int const curOASysNum,
int const curZoneEqNum)
{
int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
auto &c(coilSelectionDataObjs[index]);
c->airloopNum = curSysNum;
c->oASysNum = curOASysNum;
c->zoneEqNum = curZoneEqNum;
}

std::string ReportCoilSelection::getTimeText(EnergyPlusData &state, int const timeStepAtPeak)
{
std::string returnString = "";
Expand Down
9 changes: 9 additions & 0 deletions src/EnergyPlus/ReportCoilSelection.hh
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,13 @@ public: // methods
HVAC::FanType fanType,
int fanIndex);

void setCoilEqNum(EnergyPlusData &state,
std::string const &coilName,
std::string const &coilType,
int const curSysNum,
int const curOASysNum,
int const curZoneEqNum);

static std::string getTimeText(EnergyPlusData &state, int const timeStepAtPeak);

bool isCompTypeFan(std::string const &compType // string component type, input object class name
Expand Down Expand Up @@ -432,6 +439,8 @@ private: // methods
std::string const &coilType // idf input object class name of coil
);

void associateZoneCoilWithParent(EnergyPlusData &state, std::unique_ptr<CoilSelectionData> &c);

public: // data
int numCoilsReported_;
std::vector<std::unique_ptr<CoilSelectionData>> coilSelectionDataObjs;
Expand Down
Loading

5 comments on commit 8f63776

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

VRFFluidFixCoolingTUCap (Unknown) - Win64-Windows-10-VisualStudio-16: OK (2835 of 2838 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1550
  • Failed: 3

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.

VRFFluidFixCoolingTUCap (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3660 of 3669 tests passed, 0 test warnings)

Messages:\n

  • 6 tests had: Table big diffs.
  • 6 tests had: Table string diffs.
  • 4 tests had: ESO big diffs.
  • 2 tests had: EIO diffs.
  • 2 tests had: MTR big diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1552
  • Failed: 3

regression Test Summary

  • Passed: 803
  • Failed: 6

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.

VRFFluidFixCoolingTUCap (Unknown) - x86_64-MacOS-10.18-clang-15.0.0: OK (3619 of 3628 tests passed, 0 test warnings)

Messages:\n

  • 6 tests had: Table big diffs.
  • 6 tests had: Table string diffs.
  • 4 tests had: ESO big diffs.
  • 2 tests had: EIO diffs.
  • 2 tests had: MTR big diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1552
  • Failed: 3

regression Test Summary

  • Passed: 783
  • Failed: 6

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.

VRFFluidFixCoolingTUCap (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (793 of 793 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

VRFFluidFixCoolingTUCap (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (2045 of 2048 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1552
  • Failed: 3

Build Badge Test Badge Coverage Badge

Please sign in to comment.