Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/EnergyPlus/BranchInputManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2636,6 +2636,7 @@ namespace BranchInputManager {
MatchNode = state.dataBranchInputManager->Branch(Found).Component(1).InletNode;
MatchNodeName = state.dataBranchInputManager->Branch(Found).Component(1).InletNodeName;
BranchInletNodeName = state.dataBranchInputManager->Branch(Found).Component(1).InletNodeName;
CheckBranchEquipInZoneHVACEquipList(state, Found, ErrFound);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Pretty simple check that certain plant components are listed in ZoneHVAC:EquipmentList.

} else {
ShowWarningError(state, std::format("Branch has no components={}", state.dataBranchInputManager->Branch(Found).Name));
}
Expand Down
47 changes: 47 additions & 0 deletions src/EnergyPlus/GeneralRoutines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

// EnergyPlus Headers
#include <EnergyPlus/BaseboardRadiator.hh>
#include <EnergyPlus/BranchInputManager.hh>
#include <EnergyPlus/Construction.hh>
#include <EnergyPlus/ConvectionCoefficients.hh>
#include <EnergyPlus/Data/EnergyPlusData.hh>
Expand Down Expand Up @@ -1686,4 +1687,50 @@ Real64 calcZoneSensibleOutput(Real64 const MassFlow, // air mass flow rate, {kg/
}
return sensibleOutput;
}

void CheckBranchEquipInZoneHVACEquipList(EnergyPlusData &state, int const branchNum, bool &errorsFound)
{
// #4787 only interested in zone equipment connected to plant loop. Assumes other ZoneHVAC equipment types will have less criptic errors.
for (int comp = 1; comp <= state.dataBranchInputManager->Branch(branchNum).NumOfComponents; ++comp) {
bool found = false;
DataZoneEquipment::ZoneEquipType eqType = static_cast<DataZoneEquipment::ZoneEquipType>(
getEnumValue(DataZoneEquipment::zoneEquipTypeNamesUC, state.dataBranchInputManager->Branch(branchNum).Component(comp).CType));
switch (eqType) {
case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater:
case DataZoneEquipment::ZoneEquipType::BaseboardSteam:
case DataZoneEquipment::ZoneEquipType::BaseboardWater:
case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantConstFlow:
case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantVarFlow:
case DataZoneEquipment::ZoneEquipType::CoolingPanel:
for (int eqList = 1; eqList <= static_cast<int>(state.dataZoneEquip->ZoneEquipList.size()); ++eqList) {
for (int eqNum = 1; eqNum <= state.dataZoneEquip->ZoneEquipList(eqList).NumOfEquipTypes; ++eqNum) {
// search name string first as it is more likely to be unique
if (Util::SameString(state.dataBranchInputManager->Branch(branchNum).Component(comp).Name,
state.dataZoneEquip->ZoneEquipList(eqList).EquipName(eqNum))) {
if (Util::SameString(state.dataBranchInputManager->Branch(branchNum).Component(comp).CType,
state.dataZoneEquip->ZoneEquipList(eqList).EquipTypeName(eqNum))) {
found = true;
break;
}
}
}
if (found) {
break;
}
}
if (!found) {
ShowSevereError(state,
std::format("CheckBranchEquipInZoneHVACEquipList: Branch = {}, contains a component of type {} with name = {}",
state.dataBranchInputManager->Branch(branchNum).Name,
state.dataBranchInputManager->Branch(branchNum).Component(comp).CType,
state.dataBranchInputManager->Branch(branchNum).Component(comp).Name));
ShowContinueError(state, "but that component is not listed in any ZoneHVAC:EquipmentList.");
errorsFound = true;
}
break;
default:
continue;
}
}
}
} // namespace EnergyPlus
2 changes: 2 additions & 0 deletions src/EnergyPlus/GeneralRoutines.hh
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ Real64 calcZoneSensibleOutput(Real64 const MassFlow, // air mass flow rate, {kg/
Real64 const TDBZone, // dry-bulb temperature at zone air node {C}
Real64 const WZone);

void CheckBranchEquipInZoneHVACEquipList(EnergyPlusData &state, int const branchNum, bool &errorsFound);

struct GeneralRoutinesData : BaseGlobalStruct
{

Expand Down
50 changes: 50 additions & 0 deletions tst/EnergyPlus/unit/BranchInputManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -611,4 +611,54 @@ TEST_F(EnergyPlusFixture, BranchInputManager_OrphanObjects)
compare_err_stream(expected_error, true);
}

TEST_F(EnergyPlusFixture, BranchInputManager_OrphanBaseboard)
{
// Branch
state->dataBranchInputManager->clear_state();
state->dataErrTracking->TotalSevereErrors = 0;
std::string idf_objects = delimited_string({
"BranchList,",
" Baseboard Heating Branches, !- Name",
" Baseboard Heating Branch; !- Branch 1 Name",

"Branch,",
" Baseboard Heating Branch, !- Name",
" , !- Pressure Drop Curve Name",
" ZoneHVAC:Baseboard:Convective:Water, !- Component 1 Object Type",
" Baseboard Heater, !- Component 1 Name",
" Baseboard Water Inlet Node, !- Component 1 Inlet Node Name",
" Baseboard Water Outlet Node; !- Component 1 Outlet Node Name",

"ZoneHVAC:Baseboard:Convective:Water,",
" Baseboard Heater, !-Name",
" , !-Availability Schedule Name",
" Baseboard Water Inlet Node, !-Inlet Node Name",
" Baseboard Water Outlet Node, !-Outlet Node Name",
" HeatingDesignCapacity, !-Heating Design Capacity Method",
" Autosize, !-Heating Design Capacity{W}",
" , !-Heating Design Capacity Per Floor Area{W/m2}",
" , !-Fraction of Autosized Heating Design Capacity",
" Autosize, !-U - Factor Times Area Value{W/K}",
" Autosize; !-Maximum Water Flow Rate {m3/s}",

});
ASSERT_TRUE(process_idf(idf_objects));
EXPECT_NO_THROW(ManageBranchInput(*state));

std::string expected_error = "";
compare_err_stream(expected_error, true);

bool ErrFound = false;
BranchInputManager::TestBranchIntegrity(*state, ErrFound);

expected_error = delimited_string({
" ************* Testing Individual Branch Integrity",
" ** Severe ** CheckBranchEquipInZoneHVACEquipList: Branch = BASEBOARD HEATING BRANCH, contains a component of type "
"ZONEHVAC:BASEBOARD:CONVECTIVE:WATER with name = BASEBOARD HEATER",
" ** ~~~ ** but that component is not listed in any ZoneHVAC:EquipmentList.",
" ** Severe ** Branch(es) did not pass integrity testing",
});
compare_err_stream(expected_error, true);
}

} // namespace EnergyPlus
Loading