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

BoilerHotWater: on cycle name change #4985

Merged
merged 6 commits into from
Sep 27, 2023
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
2 changes: 1 addition & 1 deletion resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -13732,7 +13732,7 @@ OS:Boiler:HotWater,
\units W
\ip-units W
\minimum 0.0
\default 0.0
\required-field
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice.

N9, \field Off Cycle Parasitic Fuel Load
\type real
\units W
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ namespace energyplus {

// OnCycleParasiticElectricLoad

if ((value = modelObject.parasiticElectricLoad())) {
idfObject.setDouble(Boiler_HotWaterFields::OnCycleParasiticElectricLoad, value.get());
}
idfObject.setDouble(Boiler_HotWaterFields::OnCycleParasiticElectricLoad, modelObject.onCycleParasiticElectricLoad());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perfect


// SizingFactor

Expand All @@ -154,9 +152,7 @@ namespace energyplus {

// OffCycleParasiticFuelLoad

if ((value = modelObject.offCycleParasiticFuelLoad())) {
idfObject.setDouble(Boiler_HotWaterFields::OffCycleParasiticFuelLoad, value.get());
}
idfObject.setDouble(Boiler_HotWaterFields::OffCycleParasiticFuelLoad, modelObject.offCycleParasiticFuelLoad());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for catching this one too


return boost::optional<IdfObject>(idfObject);
}
Expand Down
2 changes: 1 addition & 1 deletion src/energyplus/Test/BoilerHotWater_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_BoilerHotWater) {
EXPECT_TRUE(bhw.setOptimumPartLoadRatio(6.0));
EXPECT_TRUE(bhw.setWaterOutletUpperTemperatureLimit(7.0));
EXPECT_TRUE(bhw.setBoilerFlowMode("LeavingSetpointModulated"));
EXPECT_TRUE(bhw.setParasiticElectricLoad(8.0));
EXPECT_TRUE(bhw.setOnCycleParasiticElectricLoad(8.0));
EXPECT_TRUE(bhw.setSizingFactor(9.0));
EXPECT_TRUE(bhw.setEndUseSubcategory("Test"));
EXPECT_TRUE(bhw.setOffCycleParasiticFuelLoad(10.0));
Expand Down
49 changes: 26 additions & 23 deletions src/model/BoilerHotWater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <utilities/idd/OS_Boiler_HotWater_FieldEnums.hxx>
#include <utilities/idd/IddEnums.hxx>

#include "../utilities/core/DeprecatedHelpers.hpp" // For deprecation

namespace openstudio {
namespace model {

Expand Down Expand Up @@ -189,8 +191,10 @@ namespace model {
return isEmpty(OS_Boiler_HotWaterFields::BoilerFlowMode);
}

boost::optional<double> BoilerHotWater_Impl::parasiticElectricLoad() const {
return getDouble(OS_Boiler_HotWaterFields::OnCycleParasiticElectricLoad, true);
double BoilerHotWater_Impl::onCycleParasiticElectricLoad() const {
boost::optional<double> value = getDouble(OS_Boiler_HotWaterFields::OnCycleParasiticElectricLoad, true);
OS_ASSERT(value);
return value.get();
}

double BoilerHotWater_Impl::sizingFactor() const {
Expand Down Expand Up @@ -347,21 +351,11 @@ namespace model {
OS_ASSERT(result);
}

bool BoilerHotWater_Impl::setParasiticElectricLoad(boost::optional<double> parasiticElectricLoad) {
bool result = false;
if (parasiticElectricLoad) {
result = setDouble(OS_Boiler_HotWaterFields::OnCycleParasiticElectricLoad, parasiticElectricLoad.get());
} else {
result = setString(OS_Boiler_HotWaterFields::OnCycleParasiticElectricLoad, "");
}
bool BoilerHotWater_Impl::setOnCycleParasiticElectricLoad(double onCycleParasiticElectricLoad) {
const bool result = setDouble(OS_Boiler_HotWaterFields::OnCycleParasiticElectricLoad, onCycleParasiticElectricLoad);
return result;
}

void BoilerHotWater_Impl::resetParasiticElectricLoad() {
bool result = setString(OS_Boiler_HotWaterFields::OnCycleParasiticElectricLoad, "");
OS_ASSERT(result);
}

bool BoilerHotWater_Impl::setSizingFactor(double sizingFactor) {
bool result = setDouble(OS_Boiler_HotWaterFields::SizingFactor, sizingFactor);
return result;
Expand Down Expand Up @@ -475,15 +469,10 @@ namespace model {
OS_ASSERT(getImpl<detail::BoilerHotWater_Impl>());

setWaterOutletUpperTemperatureLimit(99.0);

setBoilerFlowMode("ConstantFlow");

setParasiticElectricLoad(0.0);

setSizingFactor(1.0);

setEndUseSubcategory("General");

setOnCycleParasiticElectricLoad(0.0);
setOffCycleParasiticFuelLoad(0.0);
}

Expand Down Expand Up @@ -577,8 +566,15 @@ namespace model {
return getImpl<detail::BoilerHotWater_Impl>()->isBoilerFlowModeDefaulted();
}

// DEPRECATED
boost::optional<double> BoilerHotWater::parasiticElectricLoad() const {
return getImpl<detail::BoilerHotWater_Impl>()->parasiticElectricLoad();
DEPRECATED_AT_MSG(3, 7, 0, "Use onCycleParasiticElectricLoad instead.");
boost::optional<double> parasiticElectricLoad = getImpl<detail::BoilerHotWater_Impl>()->onCycleParasiticElectricLoad();
return parasiticElectricLoad;
}

double BoilerHotWater::onCycleParasiticElectricLoad() const {
return getImpl<detail::BoilerHotWater_Impl>()->onCycleParasiticElectricLoad();
}

double BoilerHotWater::sizingFactor() const {
Expand Down Expand Up @@ -681,12 +677,19 @@ namespace model {
getImpl<detail::BoilerHotWater_Impl>()->resetBoilerFlowMode();
}

// DEPRECATED
bool BoilerHotWater::setParasiticElectricLoad(double parasiticElectricLoad) {
return getImpl<detail::BoilerHotWater_Impl>()->setParasiticElectricLoad(parasiticElectricLoad);
DEPRECATED_AT_MSG(3, 7, 0, "Use setOnCycleParasiticElectricLoad instead.");
return getImpl<detail::BoilerHotWater_Impl>()->setOnCycleParasiticElectricLoad(parasiticElectricLoad);
}

bool BoilerHotWater::setOnCycleParasiticElectricLoad(double onCycleParasiticElectricLoad) {
return getImpl<detail::BoilerHotWater_Impl>()->setOnCycleParasiticElectricLoad(onCycleParasiticElectricLoad);
}

// DEPRECATED
void BoilerHotWater::resetParasiticElectricLoad() {
getImpl<detail::BoilerHotWater_Impl>()->resetParasiticElectricLoad();
DEPRECATED_AT_MSG(3, 7, 0, "OnCycleParasiticElectricLoad is now required.");
}

bool BoilerHotWater::setSizingFactor(double sizingFactor) {
Expand Down
11 changes: 8 additions & 3 deletions src/model/BoilerHotWater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "ModelAPI.hpp"
#include "StraightComponent.hpp"
#include "../utilities/core/Deprecated.hpp"

namespace openstudio {

Expand Down Expand Up @@ -87,7 +88,9 @@ namespace model {

bool isBoilerFlowModeDefaulted() const;

boost::optional<double> parasiticElectricLoad() const;
OS_DEPRECATED(3, 7, 0) boost::optional<double> parasiticElectricLoad() const;

double onCycleParasiticElectricLoad() const;

double sizingFactor() const;

Expand Down Expand Up @@ -145,9 +148,11 @@ namespace model {

void resetBoilerFlowMode();

bool setParasiticElectricLoad(double parasiticElectricLoad);
OS_DEPRECATED(3, 7, 0) bool setParasiticElectricLoad(double parasiticElectricLoad);

bool setOnCycleParasiticElectricLoad(double onCyclearasiticElectricLoad);

void resetParasiticElectricLoad();
OS_DEPRECATED(3, 7, 0) void resetParasiticElectricLoad();

bool setSizingFactor(double sizingFactor);

Expand Down
6 changes: 2 additions & 4 deletions src/model/BoilerHotWater_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace model {

bool isBoilerFlowModeDefaulted() const;

boost::optional<double> parasiticElectricLoad() const;
double onCycleParasiticElectricLoad() const;

double sizingFactor() const;

Expand Down Expand Up @@ -160,9 +160,7 @@ namespace model {

void resetBoilerFlowMode();

bool setParasiticElectricLoad(boost::optional<double> parasiticElectricLoad);

void resetParasiticElectricLoad();
bool setOnCycleParasiticElectricLoad(double onCycleParasiticElectricLoad);

bool setSizingFactor(double sizingFactor);

Expand Down
8 changes: 3 additions & 5 deletions src/model/test/BoilerHotWater_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ TEST_F(ModelFixture, BoilerHotWater_BoilerHotWater) {
Model m;
BoilerHotWater boiler(m);

ASSERT_TRUE(boiler.parasiticElectricLoad());
EXPECT_EQ(0.0, boiler.parasiticElectricLoad().get());
EXPECT_EQ(0.0, boiler.onCycleParasiticElectricLoad());
EXPECT_EQ(0.0, boiler.offCycleParasiticFuelLoad());

EXPECT_TRUE(boiler.setParasiticElectricLoad(0.5));
ASSERT_TRUE(boiler.parasiticElectricLoad());
EXPECT_EQ(0.5, boiler.parasiticElectricLoad().get());
EXPECT_TRUE(boiler.setOnCycleParasiticElectricLoad(0.5));
EXPECT_EQ(0.5, boiler.onCycleParasiticElectricLoad());

EXPECT_TRUE(boiler.setOffCycleParasiticFuelLoad(0.8));
EXPECT_EQ(0.8, boiler.offCycleParasiticFuelLoad());
Expand Down
2 changes: 2 additions & 0 deletions src/osversion/VersionTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8623,6 +8623,8 @@ namespace osversion {
}
}

// IDD 3.6.1 had a default of 0.0, so it'll pick that up if empty, and it matches the new Ctor value
newObject.setDouble(15, object.getDouble(15, true).get());
jmarrec marked this conversation as resolved.
Show resolved Hide resolved
newObject.setDouble(16, 0.0);

m_refactored.push_back(RefactoredObjectData(object, newObject));
Expand Down
2 changes: 1 addition & 1 deletion src/sdd/MapHVAC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5729,7 +5729,7 @@ namespace sdd {
boost::optional<double> _parasiticLd = lexicalCastToDouble(parasiticLdElement);

if (_parasiticLd) {
boiler.setParasiticElectricLoad(unitToUnit(_parasiticLd.get(), "Btu/h", "W").get());
boiler.setOnCycleParasiticElectricLoad(unitToUnit(_parasiticLd.get(), "Btu/h", "W").get());
}

if (!autosize()) {
Expand Down