Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
9 changes: 3 additions & 6 deletions src/model/BoilerHotWater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,9 @@ namespace model {
}

bool BoilerHotWater_Impl::addToNode(Node& node) {
if (boost::optional<PlantLoop> plant = node.plantLoop()) {
if (plant->supplyComponent(node.handle())) {
if (StraightComponent_Impl::addToNode(node)) {
plant->setFluidType("Water");
return true;
}
if (auto plant = node.plantLoop()) {
if (!plant->demandComponent(node.handle())) {
return StraightComponent_Impl::addToNode(node);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious whether you can use Glycol ones with a BoilerHotWater or not in E+. Have you tried?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have not tried.

}
}

Expand Down
9 changes: 3 additions & 6 deletions src/model/BoilerSteam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,9 @@ namespace model {
}

bool BoilerSteam_Impl::addToNode(Node& node) {
if (boost::optional<PlantLoop> plant = node.plantLoop()) {
if (plant->supplyComponent(node.handle())) {
if (StraightComponent_Impl::addToNode(node)) {
plant->setFluidType("Steam");
return true;
}
if (auto plant = node.plantLoop()) {
if (!plant->demandComponent(node.handle())) {
return StraightComponent_Impl::addToNode(node);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the switch from plant->supplyComponent to !plant->demandComponent?

What happens if you call it with a supply node on plantloop that's another model? It's NOT a demandComponent, so addToNode is called, when you could have avoided doing it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think BoilerSteam is the weird case here FYI, and ultimately, we should refuse to add it with a warning if done on a PlantLoop that's water/glycol and not steam. But probably do that in #5455

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was just following the addToNode method for GroundHeatExchangerHorizontalTrench. Sounds like this PR should just change addToNode for GroundHeatExchangerVertical, and leave BoilerHotWater/BoilerSteam alone.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

}
}

Expand Down
10 changes: 3 additions & 7 deletions src/model/GroundHeatExchangerVertical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,10 @@ namespace model {
return OS_GroundHeatExchanger_VerticalFields::OutletNodeName;
}

// addToNode
bool GroundHeatExchangerVertical_Impl::addToNode(Node& node) {
if (boost::optional<PlantLoop> plant = node.plantLoop()) {
if (plant->supplyComponent(node.handle())) {
if (StraightComponent_Impl::addToNode(node)) {
plant->setFluidType("Water");
return true;
}
if (auto plant = node.plantLoop()) {
if (!plant->demandComponent(node.handle())) {
return StraightComponent_Impl::addToNode(node);
Comment on lines +357 to +359
Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay I guess.

}
}

Expand Down
6 changes: 6 additions & 0 deletions src/model/test/BoilerHotWater_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ TEST_F(ModelFixture, BoilerHotWater_addToNode) {
EXPECT_EQ((unsigned)5, airLoop.demandComponents().size());

PlantLoop plantLoop(m);
EXPECT_TRUE(plantLoop.setFluidType("PropyleneGlycol"));
EXPECT_TRUE(plantLoop.setGlycolConcentration(50));

supplyOutletNode = plantLoop.supplyOutletNode();
EXPECT_TRUE(testObject.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)7, plantLoop.supplyComponents().size());
Expand All @@ -88,6 +91,9 @@ TEST_F(ModelFixture, BoilerHotWater_addToNode) {

EXPECT_TRUE(testObjectClone.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)9, plantLoop.supplyComponents().size());

EXPECT_EQ(plantLoop.fluidType(), "PropyleneGlycol");
EXPECT_EQ(plantLoop.glycolConcentration(), 50);
}

TEST_F(ModelFixture, BoilerHotWater_remove) {
Expand Down
6 changes: 6 additions & 0 deletions src/model/test/BoilerSteam_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ TEST_F(ModelFixture, BoilerSteam_addToNode) {
EXPECT_EQ((unsigned)5, airLoop.demandComponents().size());

PlantLoop plantLoop(m);
EXPECT_TRUE(plantLoop.setFluidType("PropyleneGlycol"));
EXPECT_TRUE(plantLoop.setGlycolConcentration(50));

supplyOutletNode = plantLoop.supplyOutletNode();
EXPECT_TRUE(testObject.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)7, plantLoop.supplyComponents().size());
Expand All @@ -172,4 +175,7 @@ TEST_F(ModelFixture, BoilerSteam_addToNode) {

EXPECT_TRUE(testObjectClone.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)9, plantLoop.supplyComponents().size());

EXPECT_EQ(plantLoop.fluidType(), "PropyleneGlycol");
EXPECT_EQ(plantLoop.glycolConcentration(), 50);
}
43 changes: 43 additions & 0 deletions src/model/test/GroundHeatExchangerHorizontalTrench_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
#include "../SiteGroundTemperatureUndisturbedKusudaAchenbach_Impl.hpp"
#include "../SiteGroundTemperatureUndisturbedXing.hpp"
#include "../SiteGroundTemperatureUndisturbedXing_Impl.hpp"
#include "../AirLoopHVAC.hpp"
#include "../PlantLoop.hpp"
#include "../Node.hpp"
#include "../Node_Impl.hpp"
#include "../AirLoopHVACZoneSplitter.hpp"

using namespace openstudio;
using namespace openstudio::model;
Expand Down Expand Up @@ -244,3 +249,41 @@ TEST_F(ModelFixture, GroundHeatExchangerHorizontalTrench_Clone) {
EXPECT_EQ(1u, m.getConcreteModelObjects<SiteGroundTemperatureUndisturbedXing>().size());
}
}

TEST_F(ModelFixture, GroundHeatExchangerHorizontalTrench_addToNode) {
Model m;
GroundHeatExchangerHorizontalTrench testObject(m);

AirLoopHVAC airLoop(m);

Node supplyOutletNode = airLoop.supplyOutletNode();

EXPECT_FALSE(testObject.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)2, airLoop.supplyComponents().size());

Node inletNode = airLoop.zoneSplitter().lastOutletModelObject()->cast<Node>();

EXPECT_FALSE(testObject.addToNode(inletNode));
EXPECT_EQ((unsigned)5, airLoop.demandComponents().size());

PlantLoop plantLoop(m);
EXPECT_TRUE(plantLoop.setFluidType("PropyleneGlycol"));
EXPECT_TRUE(plantLoop.setGlycolConcentration(50));

supplyOutletNode = plantLoop.supplyOutletNode();
EXPECT_TRUE(testObject.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)7, plantLoop.supplyComponents().size());

Node demandOutletNode = plantLoop.demandOutletNode();
EXPECT_FALSE(testObject.addToNode(demandOutletNode));
EXPECT_EQ((unsigned)5, plantLoop.demandComponents().size());

auto testObjectClone = testObject.clone(m).cast<GroundHeatExchangerHorizontalTrench>();
supplyOutletNode = plantLoop.supplyOutletNode();

EXPECT_TRUE(testObjectClone.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)9, plantLoop.supplyComponents().size());

EXPECT_EQ(plantLoop.fluidType(), "PropyleneGlycol");
EXPECT_EQ(plantLoop.glycolConcentration(), 50);
}
6 changes: 6 additions & 0 deletions src/model/test/GroundHeatExchangerVertical_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ TEST_F(ModelFixture, GroundHeatExchangerVertical_addToNode) {
EXPECT_EQ((unsigned)5, airLoop.demandComponents().size());

PlantLoop plantLoop(m);
EXPECT_TRUE(plantLoop.setFluidType("PropyleneGlycol"));
EXPECT_TRUE(plantLoop.setGlycolConcentration(50));

supplyOutletNode = plantLoop.supplyOutletNode();
EXPECT_TRUE(testObject.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)7, plantLoop.supplyComponents().size());
Expand All @@ -256,6 +259,9 @@ TEST_F(ModelFixture, GroundHeatExchangerVertical_addToNode) {

EXPECT_TRUE(testObjectClone.addToNode(supplyOutletNode));
EXPECT_EQ((unsigned)9, plantLoop.supplyComponents().size());

EXPECT_EQ(plantLoop.fluidType(), "PropyleneGlycol");
EXPECT_EQ(plantLoop.glycolConcentration(), 50);
}

TEST_F(ModelFixture, GroundHeatExchangerVertical_AddRemoveSupplyBranchForComponent) {
Expand Down
Loading