Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap GroundHeatExchangerVertical "Depth of Top of Borehole" field #5325

Merged
merged 19 commits into from
Dec 23, 2024
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
37 changes: 21 additions & 16 deletions resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -17112,8 +17112,8 @@ OS:DistrictHeating:Steam,

OS:GroundHeatExchanger:Vertical,
\extensible:2
\min-fields 22
\max-fields 220
\min-fields 23
\max-fields 221
\memo Variable short time step vertical ground heat exchanger model based on
\memo Yavuztruk, C., J.D.Spitler. 1999. A Short Time Step response Factor Model for
\memo Vertical Ground Loop Heat Exchangers
Expand Down Expand Up @@ -17143,67 +17143,72 @@ OS:GroundHeatExchanger:Vertical,
N2, \field Number of Bore Holes
\type integer
\minimum> 0.0
N3, \field Bore Hole Length
N3, \field Bore Hole Top Depth
\required-field
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved
\type real
\units m
\minimum 0.0
N4, \field Bore Hole Length
\type real
\units m
\minimum> 0.0
N4, \field Bore Hole Radius
N5, \field Bore Hole Radius
\type real
\units m
\minimum> 0.0
N5, \field Ground Thermal Conductivity
N6, \field Ground Thermal Conductivity
\type real
\units W/m-K
\ip-units Btu-in/hr-ft2-R
\minimum> 0.0
N6, \field Ground Thermal Heat Capacity
N7, \field Ground Thermal Heat Capacity
\type real
\units J/m3-K
\minimum> 0.0
N7, \field Ground Temperature
N8, \field Ground Temperature
\type real
\units C
\minimum> 0.0
N8, \field Grout Thermal Conductivity
N9, \field Grout Thermal Conductivity
\type real
\units W/m-K
\ip-units Btu-in/hr-ft2-R
\minimum> 0.0
N9, \field Pipe Thermal Conductivity
N10, \field Pipe Thermal Conductivity
\type real
\units W/m-K
\ip-units Btu-in/hr-ft2-R
\minimum> 0.0
N10, \field Pipe Out Diameter
N11, \field Pipe Out Diameter
\type real
\units m
\minimum> 0.0
\ip-units in
N11, \field U-Tube Distance
N12, \field U-Tube Distance
\type real
\units m
\minimum> 0.0
N12, \field Pipe Thickness
N13, \field Pipe Thickness
\type real
\units m
\minimum> 0.0
\ip-units in
N13, \field Maximum Length of Simulation
N14, \field Maximum Length of Simulation
\type real
\minimum> 0.0
A5, \field Undisturbed Ground Temperature Model
\required-field
\type object-list
\object-list UndisturbedGroundTempModels
N14, \field G-Function Reference Ratio
N15, \field G-Function Reference Ratio
\type real
\units dimensionless
\minimum> 0.0
\default 0.0005
N15, \field G-Function Ln(T/Ts) Value
N16, \field G-Function Ln(T/Ts) Value
\type real
\begin-extensible
N16; \field G-Function G Value
N17; \field G-Function G Value
\type real

OS:GroundHeatExchanger:HorizontalTrench,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace energyplus {
auto propertiesObjectName = modelObject.nameString() + " Properties";
propertiesIdfObject.setName(propertiesObjectName);

propertiesIdfObject.setDouble(GroundHeatExchanger_Vertical_PropertiesFields::DepthofTopofBorehole, 1);
propertiesIdfObject.setDouble(GroundHeatExchanger_Vertical_PropertiesFields::DepthofTopofBorehole, modelObject.boreHoleTopDepth());
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved

if ((value = modelObject.boreHoleLength())) {
propertiesIdfObject.setDouble(GroundHeatExchanger_Vertical_PropertiesFields::BoreholeLength, value.get());
Expand Down
3 changes: 2 additions & 1 deletion src/energyplus/Test/GroundHeatExchangerVertical_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_GroundHeatExchangerVertical) {

EXPECT_TRUE(ghx.setDesignFlowRate(0.004));
EXPECT_TRUE(ghx.setNumberofBoreHoles(100));
EXPECT_TRUE(ghx.setBoreHoleTopDepth(1.35));
EXPECT_TRUE(ghx.setBoreHoleLength(80.0));
EXPECT_TRUE(ghx.setBoreHoleRadius(0.7E-01));
EXPECT_TRUE(ghx.setGroundThermalConductivity(0.7));
Expand Down Expand Up @@ -108,7 +109,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_GroundHeatExchangerVertical) {
EXPECT_EQ(100, response.getDouble(GroundHeatExchanger_ResponseFactorsFields::NumberofBoreholes).get());
EXPECT_EQ(0.001, response.getDouble(GroundHeatExchanger_ResponseFactorsFields::GFunctionReferenceRatio).get());

EXPECT_EQ(1, properties.getDouble(GroundHeatExchanger_Vertical_PropertiesFields::DepthofTopofBorehole).get());
EXPECT_EQ(1.35, properties.getDouble(GroundHeatExchanger_Vertical_PropertiesFields::DepthofTopofBorehole).get());
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved
EXPECT_EQ(80.0, properties.getDouble(GroundHeatExchanger_Vertical_PropertiesFields::BoreholeLength).get());
EXPECT_EQ(0.7E-01 * 2, properties.getDouble(GroundHeatExchanger_Vertical_PropertiesFields::BoreholeDiameter).get());
EXPECT_EQ(0.7, properties.getDouble(GroundHeatExchanger_Vertical_PropertiesFields::GroutThermalConductivity).get());
Expand Down
21 changes: 21 additions & 0 deletions src/model/GroundHeatExchangerVertical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ namespace model {
return getInt(OS_GroundHeatExchanger_VerticalFields::NumberofBoreHoles, true);
}

double GroundHeatExchangerVertical_Impl::boreHoleTopDepth() const {
boost::optional<double> value = getDouble(OS_GroundHeatExchanger_VerticalFields::BoreHoleTopDepth, true);
OS_ASSERT(value);
return value.get();
}

boost::optional<double> GroundHeatExchangerVertical_Impl::boreHoleLength() const {
return getDouble(OS_GroundHeatExchanger_VerticalFields::BoreHoleLength, true);
}
Expand Down Expand Up @@ -139,6 +145,11 @@ namespace model {
OS_ASSERT(result);
}

bool GroundHeatExchangerVertical_Impl::setBoreHoleTopDepth(double boreHoleTopDepth) {
bool result = setDouble(OS_GroundHeatExchanger_VerticalFields::BoreHoleTopDepth, boreHoleTopDepth);
return result;
}

bool GroundHeatExchangerVertical_Impl::setBoreHoleLength(boost::optional<double> boreHoleLength) {
bool result(false);
if (boreHoleLength) {
Expand Down Expand Up @@ -443,6 +454,7 @@ namespace model {
OS_ASSERT(getImpl<detail::GroundHeatExchangerVertical_Impl>());

setNumberofBoreHoles(120);
setBoreHoleTopDepth(1);
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved
setBoreHoleLength(76.2);
setBoreHoleRadius(0.635080E-01);
setGroundThermalConductivity(0.692626);
Expand Down Expand Up @@ -513,6 +525,7 @@ namespace model {
<< undisturbedGroundTemperatureModel.briefDescription() << ".");
}
setNumberofBoreHoles(120);
setBoreHoleTopDepth(1);
setBoreHoleLength(76.2);
setBoreHoleRadius(0.635080E-01);
setGroundThermalConductivity(0.692626);
Expand Down Expand Up @@ -596,6 +609,10 @@ namespace model {
return getImpl<detail::GroundHeatExchangerVertical_Impl>()->numberofBoreHoles();
}

double GroundHeatExchangerVertical::boreHoleTopDepth() const {
return getImpl<detail::GroundHeatExchangerVertical_Impl>()->boreHoleTopDepth();
}

boost::optional<double> GroundHeatExchangerVertical::boreHoleLength() const {
return getImpl<detail::GroundHeatExchangerVertical_Impl>()->boreHoleLength();
}
Expand Down Expand Up @@ -664,6 +681,10 @@ namespace model {
getImpl<detail::GroundHeatExchangerVertical_Impl>()->resetNumberofBoreHoles();
}

bool GroundHeatExchangerVertical::setBoreHoleTopDepth(double boreHoleTopDepth) {
return getImpl<detail::GroundHeatExchangerVertical_Impl>()->setBoreHoleTopDepth(boreHoleTopDepth);
}

bool GroundHeatExchangerVertical::setBoreHoleLength(double boreHoleLength) {
return getImpl<detail::GroundHeatExchangerVertical_Impl>()->setBoreHoleLength(boreHoleLength);
}
Expand Down
4 changes: 4 additions & 0 deletions src/model/GroundHeatExchangerVertical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ namespace model {

boost::optional<int> numberofBoreHoles() const;

double boreHoleTopDepth() const;

boost::optional<double> boreHoleLength() const;

boost::optional<double> boreHoleRadius() const;
Expand Down Expand Up @@ -108,6 +110,8 @@ namespace model {

void resetNumberofBoreHoles();

bool setBoreHoleTopDepth(double boreHoleTopDepth);

bool setBoreHoleLength(double boreHoleLength);

void resetBoreHoleLength();
Expand Down
4 changes: 4 additions & 0 deletions src/model/GroundHeatExchangerVertical_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace model {

boost::optional<int> numberofBoreHoles() const;

double boreHoleTopDepth() const;

boost::optional<double> boreHoleLength() const;

boost::optional<double> boreHoleRadius() const;
Expand Down Expand Up @@ -94,6 +96,8 @@ namespace model {

void resetNumberofBoreHoles();

bool setBoreHoleTopDepth(double boreHoleTopDepth);

bool setBoreHoleLength(boost::optional<double> boreHoleLength);

void resetBoreHoleLength();
Expand Down
5 changes: 5 additions & 0 deletions src/model/test/GroundHeatExchangerVertical_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ TEST_F(ModelFixture, GroundHeatExchangerVertical_GroundHeatExchangerVertical) {
EXPECT_EQ(0.0033, gh.designFlowRate().get());
ASSERT_TRUE(gh.numberofBoreHoles());
EXPECT_EQ(120, gh.numberofBoreHoles().get());
EXPECT_EQ(1.0, gh.boreHoleTopDepth());
ASSERT_TRUE(gh.boreHoleLength());
EXPECT_EQ(76.2, gh.boreHoleLength().get());
ASSERT_TRUE(gh.boreHoleRadius());
Expand Down Expand Up @@ -79,6 +80,7 @@ TEST_F(ModelFixture, GroundHeatExchangerVertical_GroundHeatExchangerVertical) {
EXPECT_EQ(0.0033, gh.designFlowRate().get());
ASSERT_TRUE(gh.numberofBoreHoles());
EXPECT_EQ(120, gh.numberofBoreHoles().get());
EXPECT_EQ(1.0, gh.boreHoleTopDepth());
ASSERT_TRUE(gh.boreHoleLength());
EXPECT_EQ(76.2, gh.boreHoleLength().get());
ASSERT_TRUE(gh.boreHoleRadius());
Expand Down Expand Up @@ -117,6 +119,7 @@ TEST_F(ModelFixture, GroundHeatExchangerVertical_SetGetFields) {

EXPECT_TRUE(gh.setDesignFlowRate(0.004));
EXPECT_TRUE(gh.setNumberofBoreHoles(100));
EXPECT_TRUE(gh.setBoreHoleTopDepth(1.25));
EXPECT_TRUE(gh.setBoreHoleLength(80.0));
EXPECT_TRUE(gh.setBoreHoleRadius(0.7E-01));
EXPECT_TRUE(gh.setGroundThermalConductivity(0.7));
Expand All @@ -137,6 +140,7 @@ TEST_F(ModelFixture, GroundHeatExchangerVertical_SetGetFields) {
EXPECT_EQ(0.004, gh.designFlowRate().get());
ASSERT_TRUE(gh.numberofBoreHoles());
EXPECT_EQ(100, gh.numberofBoreHoles().get());
EXPECT_EQ(1.25, gh.boreHoleTopDepth());
ASSERT_TRUE(gh.boreHoleLength());
EXPECT_EQ(80.0, gh.boreHoleLength().get());
ASSERT_TRUE(gh.boreHoleRadius());
Expand Down Expand Up @@ -174,6 +178,7 @@ TEST_F(ModelFixture, GroundHeatExchangerVertical_SetGetFields) {
EXPECT_EQ(0.004, gh.designFlowRate().get());
ASSERT_TRUE(gh.numberofBoreHoles());
EXPECT_EQ(100, gh.numberofBoreHoles().get());
EXPECT_EQ(1.25, gh.boreHoleTopDepth());
ASSERT_TRUE(gh.boreHoleLength());
EXPECT_EQ(80.0, gh.boreHoleLength().get());
ASSERT_TRUE(gh.boreHoleRadius());
Expand Down
24 changes: 24 additions & 0 deletions src/osversion/VersionTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9670,6 +9670,30 @@ namespace osversion {
ss << newObject;
m_refactored.emplace_back(std::move(object), std::move(newObject));

} else if (iddname == "OS:GroundHeatExchanger:Vertical") {

// 1 Field has been inserted from 3.9.0 to 3.9.1:
// ----------------------------------------------
// * Bore Hole Top Depth * 6

auto iddObject = idd_3_9_1.getObject(iddname);
IdfObject newObject(iddObject.get());

for (size_t i = 0; i < object.numFields(); ++i) {
if ((value = object.getString(i))) {
if (i < 6) {
newObject.setString(i, value.get());
} else {
newObject.setString(i + 1, value.get());
}
}
}

newObject.setDouble(6, 1.0); // this value of 1 is what we previously had hardcoded in FT
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved

ss << newObject;
m_refactored.emplace_back(std::move(object), std::move(newObject));

// No-op
} else {
ss << object;
Expand Down
Loading
Loading