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
8 changes: 7 additions & 1 deletion src/EnergyPlus/SimulationManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,7 @@ namespace SimulationManager {
static constexpr std::string_view Format_723 =
"! <Zone Equipment Component>,<Component Count>,<Component Type>,<Component Name>,<Zone Name>,<Heating "
"Priority>,<Cooling Priority>";
bool nodeConnectionErrorFlag = false;

// Report outside air node names on the Branch-Node Details file
print(state.files.bnd, "{}\n", "! ===============================================================");
Expand Down Expand Up @@ -2256,12 +2257,13 @@ namespace SimulationManager {
"been retrieved.");
state.dataSimulationManager->WarningOut = false;
}
ShowWarningError(
ShowSevereError(
state,
format("Potential Node Connection Error for object {}, name={}", CType, state.dataBranchNodeConnections->CompSets(Count).CName));
ShowContinueError(state, " Node Types are still UNDEFINED -- See Branch/Node Details file for further information");
ShowContinueError(state, format(" Inlet Node : {}", state.dataBranchNodeConnections->CompSets(Count).InletNodeName));
ShowContinueError(state, format(" Outlet Node: {}", state.dataBranchNodeConnections->CompSets(Count).OutletNodeName));
nodeConnectionErrorFlag = true;
++state.dataBranchNodeConnections->NumNodeConnectionErrors;
}
}
Expand Down Expand Up @@ -2723,6 +2725,10 @@ namespace SimulationManager {
}

state.dataErrTracking->AskForConnectionsReport = false;

if (nodeConnectionErrorFlag) {
ShowFatalError(state, "Please see severe error(s) and correct either the branch nodes or the component nodes so that they match.");
}
Copy link
Member

Choose a reason for hiding this comment

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

This is a fine fix, bumping it to a severe makes sense. And adding the separate flag to provide extra error context is a good change.

}

void PostIPProcessing(EnergyPlusData &state)
Expand Down
6 changes: 5 additions & 1 deletion testfiles/ASHRAE901_OfficeSmall_STD2019_Denver.idf
Original file line number Diff line number Diff line change
Expand Up @@ -5257,7 +5257,11 @@
1.205980747, !- On Cycle Loss Coefficient to Ambient Temperature {W/K}
, !- On Cycle Loss Fraction to Zone
4.048e-06, !- Peak Use Flow Rate {m3/s}
BLDG_SWH_SCH; !- Use Flow Rate Fraction Schedule Name
BLDG_SWH_SCH, !- Use Flow Rate Fraction Schedule Name
, !- Cold Water Supply Temperature Schedule Name
SHWSys1 Pump-SHWSys1 Water HeaterNode, !- Use Side Inlet Node Name
SHWSys1 Supply Equipment Outlet Node; !- Use Side Outlet Node Name
Copy link
Member

Choose a reason for hiding this comment

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

And yeah, good stuff getting the test file fixed up.



!- =========== ALL OBJECTS IN CLASS: PLANTLOOP ===========

Expand Down
32 changes: 32 additions & 0 deletions tst/EnergyPlus/unit/SimulationManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

// EnergyPlus Headers
#include "Fixtures/EnergyPlusFixture.hh"
#include <EnergyPlus/DataBranchNodeConnections.hh>
#include <EnergyPlus/DataEnvironment.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/DataReportingFlags.hh>
Expand Down Expand Up @@ -551,3 +552,34 @@ TEST_F(EnergyPlusFixture, Test_SimulationControl_PureLoadCalc)

EXPECT_TRUE(compare_err_stream(error_string, true));
}

TEST_F(EnergyPlusFixture, SimulationManager_ReportLoopConnectionsTest)
{
// Unit Test for Defect #11061: Test Error Message (modified level of message)
state->dataBranchNodeConnections->NumCompSets = 1;
state->dataBranchNodeConnections->CompSets.allocate(1);
state->dataBranchNodeConnections->CompSets(1).ParentObjectType = DataLoopNode::ConnectionObjectType::WaterHeaterMixed;
state->dataBranchNodeConnections->CompSets(1).ComponentObjectType = DataLoopNode::ConnectionObjectType::WaterHeaterMixed;
state->dataBranchNodeConnections->CompSets(1).CName = "WaterHeaterMixed1";
state->dataBranchNodeConnections->CompSets(1).ParentObjectType == DataLoopNode::ConnectionObjectType::Undefined;
state->dataBranchNodeConnections->CompSets(1).InletNodeName = "MixedWaterHeater1Inlet";
state->dataBranchNodeConnections->CompSets(1).OutletNodeName = "MixedWaterHeater1Outlet";
state->dataSimulationManager->WarningOut = false;
state->dataBranchNodeConnections->CompSets(1).Description = "UNDEFINED";

EXPECT_THROW(EnergyPlus::SimulationManager::ReportLoopConnections(*state), std::runtime_error);

std::string const error_string = delimited_string({
" ** Severe ** Potential Node Connection Error for object WATERHEATER:MIXED, name=WaterHeaterMixed1",
" ** ~~~ ** Node Types are still UNDEFINED -- See Branch/Node Details file for further information",
" ** ~~~ ** Inlet Node : MixedWaterHeater1Inlet",
" ** ~~~ ** Outlet Node: MixedWaterHeater1Outlet",
" ************* There was 1 node connection error noted.",
" ** Fatal ** Please see severe error(s) and correct either the branch nodes or the component nodes so that they match.",
" ...Summary of Errors that led to program termination:",
" ..... Reference severe error count=1",
" ..... Last severe error=Potential Node Connection Error for object WATERHEATER:MIXED, name=WaterHeaterMixed1",
});

EXPECT_TRUE(compare_err_stream(error_string, true));
Copy link
Member

Choose a reason for hiding this comment

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

As a quick aside, there is a separate unit test function that you can call that is a bit easier. In this case, we don't care what the exact error output looks like. We just really want to make sure it is reporting the node connection error. Instead of compare_err_stream(), try compare_err_stream_substring(). In that function you could call:

EXPECT_TRUE(compare_err_stream_substring("Potential Node Connection Error", true));

and that should be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Myoldmopar That is very interesting and not something that I realized was an option. I will definitely try to remember that the next time I need to do something like this in a unit test. Thanks!

}
Loading