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