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

CoilHeatingWaterToAirHeatPumpEquationFit: new Part Load Fraction Correlation Curve field #4955

Closed
wants to merge 7 commits into from
Closed
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
8 changes: 7 additions & 1 deletion resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -20106,10 +20106,16 @@ OS:Coil:Heating:WaterToAirHeatPump:EquationFit,
\required-field
\type object-list
\object-list QuadvariateFunctions
A8; \field Heating Power Consumption Curve Name
A8, \field Heating Power Consumption Curve Name
\required-field
\type object-list
\object-list QuadvariateFunctions
A9; \field Part Load Fraction Correlation Curve
\note quadratic curve = a + b*PLR + c*PLR**2
\note cubic curve = a + b*PLR + c*PLR**2 + d*PLR**3
\note PLR = part load ratio (heat load/steady state capacity)
\type object-list
\object-list UnivariateFunctions

OS:Coil:Heating:DX:MultiSpeed,
\extensible:1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "../../model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp"
#include "../../model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp"
#include "../../model/CurveQuadLinear.hpp"
#include "../../model/Curve.hpp"
#include "../../model/Curve_Impl.hpp"

#include "../../utilities/core/Logger.hpp"
#include "../../utilities/core/Assert.hpp"
Expand Down Expand Up @@ -124,6 +126,13 @@ namespace energyplus {
}
}

// Part Load Fraction Correlation Curve Name
if (auto optCurve = modelObject.partLoadFractionCorrelationCurve()) {
if (auto _curve = translateAndMapModelObject(optCurve.get())) {
idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::PartLoadFractionCorrelationCurveName, _curve->name().get());
}
}

return idfObject;
}

Expand Down
7 changes: 7 additions & 0 deletions src/energyplus/Test/ZoneHVACWaterToAirHeatPump_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "../../model/PortList.hpp"
#include "../../model/Node.hpp"
#include "../../model/PlantLoop.hpp"
#include "../../model/CurveQuadratic.hpp"

#include <utilities/idd/ZoneHVAC_WaterToAirHeatPump_FieldEnums.hxx>
#include <utilities/idd/Coil_Cooling_WaterToAirHeatPump_EquationFit_FieldEnums.hxx>
Expand Down Expand Up @@ -49,6 +50,8 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACWaterToAirHeatPump) {
sch.setName("HP AvailSch");
CoilHeatingWaterToAirHeatPumpEquationFit htg_coil(m);
htg_coil.setName("HP HC");
CurveQuadratic partLoadFractionCorrelationCurve(m);
htg_coil.setPartLoadFractionCorrelationCurve(partLoadFractionCorrelationCurve);
CoilCoolingWaterToAirHeatPumpEquationFit clg_coil(m);
clg_coil.setName("HP CC");
FanOnOff fan(m);
Expand Down Expand Up @@ -294,6 +297,10 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ZoneHVACWaterToAirHeatPump) {
idf_heatingCoil.getTarget(Coil_Heating_WaterToAirHeatPump_EquationFitFields::HeatingPowerConsumptionCurveName));
ASSERT_TRUE(woCurve2);
EXPECT_EQ(woCurve2->iddObject().type(), IddObjectType::Curve_QuadLinear);
boost::optional<WorkspaceObject> woCurve3(
idf_heatingCoil.getTarget(Coil_Heating_WaterToAirHeatPump_EquationFitFields::PartLoadFractionCorrelationCurveName));
ASSERT_TRUE(woCurve3);
EXPECT_EQ(woCurve3->iddObject().type(), IddObjectType::Curve_Quadratic);
}

{
Expand Down
30 changes: 30 additions & 0 deletions src/model/CoilHeatingWaterToAirHeatPumpEquationFit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "Model.hpp"
#include "CurveQuadLinear.hpp"
#include "CurveQuadLinear_Impl.hpp"
#include "Curve.hpp"
#include "Curve_Impl.hpp"

#include <utilities/idd/OS_Coil_Heating_WaterToAirHeatPump_EquationFit_FieldEnums.hxx>
#include <utilities/idd/IddEnums.hxx>
Expand Down Expand Up @@ -325,6 +327,22 @@ namespace model {
return result;
}

boost::optional<Curve> CoilHeatingWaterToAirHeatPumpEquationFit_Impl::partLoadFractionCorrelationCurve() const {
return getObject<ModelObject>().getModelObjectTarget<Curve>(
OS_Coil_Heating_WaterToAirHeatPump_EquationFitFields::PartLoadFractionCorrelationCurve);
}

bool CoilHeatingWaterToAirHeatPumpEquationFit_Impl::setPartLoadFractionCorrelationCurve(const Curve& curve) {
bool result = setPointer(OS_Coil_Heating_WaterToAirHeatPump_EquationFitFields::PartLoadFractionCorrelationCurve, curve.handle());
OS_ASSERT(result);
return result;
}

void CoilHeatingWaterToAirHeatPumpEquationFit_Impl::resetPartLoadFractionCorrelationCurve() {
bool result = setString(OS_Coil_Heating_WaterToAirHeatPump_EquationFitFields::PartLoadFractionCorrelationCurve, "");
OS_ASSERT(result);
}

boost::optional<double> CoilHeatingWaterToAirHeatPumpEquationFit_Impl::autosizedRatedAirFlowRate() const {
// EPLUS-SQL-INCONSISTENCY
return getAutosizedValue("Design Size Rated Air Flow Rate", "m3/s", "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT");
Expand Down Expand Up @@ -740,6 +758,18 @@ namespace model {
return curve.setCoefficient5z(heatingPowerConsumptionCoefficient5);
}

boost::optional<Curve> CoilHeatingWaterToAirHeatPumpEquationFit::partLoadFractionCorrelationCurve() const {
return getImpl<detail::CoilHeatingWaterToAirHeatPumpEquationFit_Impl>()->partLoadFractionCorrelationCurve();
}

bool CoilHeatingWaterToAirHeatPumpEquationFit::setPartLoadFractionCorrelationCurve(const Curve& curve) {
return getImpl<detail::CoilHeatingWaterToAirHeatPumpEquationFit_Impl>()->setPartLoadFractionCorrelationCurve(curve);
}

void CoilHeatingWaterToAirHeatPumpEquationFit::resetPartLoadFractionCorrelationCurve() {
getImpl<detail::CoilHeatingWaterToAirHeatPumpEquationFit_Impl>()->resetPartLoadFractionCorrelationCurve();
}

/// @endcond

} // namespace model
Expand Down
7 changes: 7 additions & 0 deletions src/model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace openstudio {
namespace model {

class CurveQuadLinear;
class Curve;

namespace detail {

Expand Down Expand Up @@ -94,6 +95,8 @@ namespace model {
OS_DEPRECATED(3, 2, 0) double heatingPowerConsumptionCoefficient4() const;
OS_DEPRECATED(3, 2, 0) double heatingPowerConsumptionCoefficient5() const;

boost::optional<Curve> partLoadFractionCorrelationCurve() const;

//@}
/** @name Setters */
//@{
Expand Down Expand Up @@ -148,6 +151,10 @@ namespace model {
OS_DEPRECATED(3, 2, 0) bool setHeatingPowerConsumptionCoefficient4(double heatingPowerConsumptionCoefficient4);
OS_DEPRECATED(3, 2, 0) bool setHeatingPowerConsumptionCoefficient5(double heatingPowerConsumptionCoefficient5);

bool setPartLoadFractionCorrelationCurve(const Curve& curve);

void resetPartLoadFractionCorrelationCurve();

//@}
/** @name Other */
//@{
Expand Down
7 changes: 7 additions & 0 deletions src/model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace openstudio {
namespace model {

class CurveQuadLinear;
class Curve;

namespace detail {

Expand Down Expand Up @@ -91,6 +92,8 @@ namespace model {

CurveQuadLinear heatingPowerConsumptionCurve() const;

boost::optional<Curve> partLoadFractionCorrelationCurve() const;

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

boost::optional<double> autosizedRatedWaterFlowRate() const;
Expand Down Expand Up @@ -143,6 +146,10 @@ namespace model {

bool setHeatingPowerConsumptionCurve(const CurveQuadLinear& heatingPowerConsumptionCurve);

bool setPartLoadFractionCorrelationCurve(const Curve& curve);

void resetPartLoadFractionCorrelationCurve();

//@}
/** @name Other */
//@{
Expand Down
10 changes: 10 additions & 0 deletions src/model/test/CoilHeatingWaterToAirHeatPumpEquationFit_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "../CoilHeatingWaterToAirHeatPumpEquationFit.hpp"
#include "../CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp"
#include "../CurveQuadratic.hpp"
#include "../CurveQuadratic_Impl.hpp"

using namespace openstudio;
using namespace openstudio::model;
Expand Down Expand Up @@ -79,4 +81,12 @@ TEST_F(ModelFixture, CoilHeatingWaterToAirHeatPumpEquationFit_Test) {
EXPECT_EQ(1.0, coilHeatingWaterToAirHPEquationFit.ratioofRatedHeatingCapacitytoRatedCoolingCapacity());
EXPECT_TRUE(coilHeatingWaterToAirHPEquationFit.setRatioofRatedHeatingCapacitytoRatedCoolingCapacity(1.2));
EXPECT_EQ(1.2, coilHeatingWaterToAirHPEquationFit.ratioofRatedHeatingCapacitytoRatedCoolingCapacity());

// test part load fraction correlation curve
EXPECT_FALSE(coilHeatingWaterToAirHPEquationFit.partLoadFractionCorrelationCurve());
CurveQuadratic partLoadFractionCorrelationCurve(model);
coilHeatingWaterToAirHPEquationFit.setPartLoadFractionCorrelationCurve(partLoadFractionCorrelationCurve);
EXPECT_TRUE(coilHeatingWaterToAirHPEquationFit.partLoadFractionCorrelationCurve());
coilHeatingWaterToAirHPEquationFit.resetPartLoadFractionCorrelationCurve();
EXPECT_FALSE(coilHeatingWaterToAirHPEquationFit.partLoadFractionCorrelationCurve());
}