Skip to content

Commit

Permalink
Merge pull request #4985 from NREL/boiler-hot-water2
Browse files Browse the repository at this point in the history
BoilerHotWater: on cycle name change
  • Loading branch information
jmarrec authored Sep 27, 2023
2 parents 29ddbb6 + 0b79413 commit 9b40f51
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 44 deletions.
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
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());

// 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());

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());
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

0 comments on commit 9b40f51

Please sign in to comment.