Skip to content

Commit

Permalink
Merge pull request #139 from EcotopeResearch/NyleCA_MPs_units
Browse files Browse the repository at this point in the history
Add Nyle MP units
  • Loading branch information
chipbarnaby committed Feb 8, 2022
2 parents 8670f6d + 8bd1fa0 commit 745cdca
Show file tree
Hide file tree
Showing 21 changed files with 7,597 additions and 34 deletions.
73 changes: 52 additions & 21 deletions src/HPWH.cc
Expand Up @@ -1667,7 +1667,7 @@ double HPWH::getCompressorCapacity(double airTemp /*=19.722*/, double inletTemp

if (setOfSources[compressorIndex].isExternalMultipass()) {
double averageTemp_C = (outTemp_C + inletTemp_C) / 2.;
setOfSources[compressorIndex].getCapacityMP(airTemp_C, averageTemp_C, inputTemp_BTUperHr, capTemp_BTUperHr, copTemp);
setOfSources[compressorIndex].getCapacityMP(airTemp_C, averageTemp_C, inputTemp_BTUperHr, capTemp_BTUperHr, copTemp);
}
else {
setOfSources[compressorIndex].getCapacity(airTemp_C, inletTemp_C, outTemp_C, inputTemp_BTUperHr, capTemp_BTUperHr, copTemp);
Expand Down Expand Up @@ -2617,7 +2617,7 @@ HPWH::HeatSource::HeatSource(HPWH *parentInput)
:hpwh(parentInput), isOn(false), lockedOut(false), doDefrost(false), backupHeatSource(NULL), companionHeatSource(NULL),
followedByHeatSource(NULL), minT(-273.15), maxT(100), hysteresis_dC(0), airflowFreedom(1.0), maxSetpoint_C(100.),
typeOfHeatSource(TYPE_none), extrapolationMethod(EXTRAP_LINEAR), maxOut_at_LowT{ 100, -273.15 }, standbyLogic(NULL),
isMultipass(true), mpFlowRate_LPS(0.), externalInletHeight(-1), externalOutletHeight(-1)
isMultipass(true), mpFlowRate_LPS(0.), externalInletHeight(-1), externalOutletHeight(-1), expCurveFit(false)
{}

HPWH::HeatSource::HeatSource(const HeatSource &hSource) {
Expand Down Expand Up @@ -2647,6 +2647,7 @@ HPWH::HeatSource::HeatSource(const HeatSource &hSource) {
perfMap = hSource.perfMap;

defrostMap = hSource.defrostMap;
resDefrost = hSource.resDefrost;

//i think vector assignment works correctly here
turnOnLogicSet = hSource.turnOnLogicSet;
Expand All @@ -2666,6 +2667,7 @@ HPWH::HeatSource::HeatSource(const HeatSource &hSource) {
typeOfHeatSource = hSource.typeOfHeatSource;
isMultipass = hSource.isMultipass;
mpFlowRate_LPS = hSource.mpFlowRate_LPS;
expCurveFit = hSource.expCurveFit;

externalInletHeight = hSource.externalInletHeight;
externalOutletHeight = hSource.externalOutletHeight;
Expand Down Expand Up @@ -2711,6 +2713,7 @@ HPWH::HeatSource& HPWH::HeatSource::operator=(const HeatSource &hSource) {
perfMap = hSource.perfMap;

defrostMap = hSource.defrostMap;
resDefrost = hSource.resDefrost;

//i think vector assignment works correctly here
turnOnLogicSet = hSource.turnOnLogicSet;
Expand All @@ -2730,6 +2733,7 @@ HPWH::HeatSource& HPWH::HeatSource::operator=(const HeatSource &hSource) {
typeOfHeatSource = hSource.typeOfHeatSource;
isMultipass = hSource.isMultipass;
mpFlowRate_LPS = hSource.mpFlowRate_LPS;
expCurveFit = hSource.expCurveFit;

externalInletHeight = hSource.externalInletHeight;
externalOutletHeight = hSource.externalOutletHeight;
Expand Down Expand Up @@ -3286,9 +3290,9 @@ void HPWH::HeatSource::getCapacity(double externalT_C, double condenserTemp_C, d
else {
if (i == perfMap.size() - 1) {
extrapolate = true;
i_prev = i - 1;
i_next = i;
break;
i_prev = i - 1;
i_next = i;
break;
}
}
}
Expand Down Expand Up @@ -3328,17 +3332,17 @@ void HPWH::HeatSource::getCapacity(double externalT_C, double condenserTemp_C, d

}
else { //perfMap.size() == 1 or we've got an issue.
if (externalT_F > perfMap[0].T_F) {
extrapolate = true;
if (extrapolationMethod == EXTRAP_NEAREST) {
externalT_F = perfMap[0].T_F;
}
if (externalT_F > perfMap[0].T_F) {
extrapolate = true;
if (extrapolationMethod == EXTRAP_NEAREST) {
externalT_F = perfMap[0].T_F;
}
}

regressedMethod(input_BTUperHr, perfMap[0].inputPower_coeffs, externalT_F, Tout_F, condenserTemp_F);
input_BTUperHr = KWH_TO_BTU(input_BTUperHr);
regressedMethod(input_BTUperHr, perfMap[0].inputPower_coeffs, externalT_F, Tout_F, condenserTemp_F);
input_BTUperHr = KWH_TO_BTU(input_BTUperHr);

regressedMethod(cop, perfMap[0].COP_coeffs, externalT_F, Tout_F, condenserTemp_F);
regressedMethod(cop, perfMap[0].COP_coeffs, externalT_F, Tout_F, condenserTemp_F);
}

if (doDefrost) {
Expand Down Expand Up @@ -3372,30 +3376,42 @@ void HPWH::HeatSource::getCapacity(double externalT_C, double condenserTemp_C, d
}
}



void HPWH::HeatSource::getCapacityMP(double externalT_C, double condenserTemp_C, double &input_BTUperHr, double &cap_BTUperHr, double &cop) {
double externalT_F, condenserTemp_F;

bool resDefrostHeatingOn = false;
// Convert Celsius to Fahrenheit for the curve fits
condenserTemp_F = C_TO_F(condenserTemp_C);
externalT_F = C_TO_F(externalT_C);

// Check if we have resistance elements to turn on for defrost and add the constant lift.
if (resDefrost.inputPwr_kW > 0) {
if (externalT_F < resDefrost.onBelowT_F) {
externalT_F += resDefrost.constTempLift_dF;
resDefrostHeatingOn = true;
}
}

// Get bounding performance map points for interpolation/extrapolation
bool extrapolate = false;

if (externalT_F > perfMap[0].T_F) {
extrapolate = true;
if (extrapolationMethod == EXTRAP_NEAREST) {
externalT_F = perfMap[0].T_F;
}
}
//Const Tair Tin Tair2 Tin2 TairTin
regressedMethodMP(input_BTUperHr, perfMap[0].inputPower_coeffs, externalT_F, condenserTemp_F);

if (expCurveFit) {
regressedExpMP(input_BTUperHr, perfMap[0].inputPower_coeffs, externalT_F, condenserTemp_F);
regressedExpMP(cop, perfMap[0].COP_coeffs, externalT_F, condenserTemp_F);
}
else {
//Const Tair Tin Tair2 Tin2 TairTin
regressedMethodMP(input_BTUperHr, perfMap[0].inputPower_coeffs, externalT_F, condenserTemp_F);
regressedMethodMP(cop, perfMap[0].COP_coeffs, externalT_F, condenserTemp_F);
}
input_BTUperHr = KWH_TO_BTU(input_BTUperHr);

regressedMethodMP(cop, perfMap[0].COP_coeffs, externalT_F, condenserTemp_F);

cout << condenserTemp_F << ", " << externalT_F << ", input_BTUperHr " << input_BTUperHr << ", cop " << cop << "\n";

if (doDefrost) {
//adjust COP by the defrost factor
Expand All @@ -3404,6 +3420,10 @@ void HPWH::HeatSource::getCapacityMP(double externalT_C, double condenserTemp_C,

cap_BTUperHr = cop * input_BTUperHr;

//For accounting add the resistance defrost to the input energy
if (resDefrostHeatingOn){
input_BTUperHr += KW_TO_BTUperH(resDefrost.inputPwr_kW);
}
if (hpwh->hpwhVerbosity >= VRB_emetic) {
hpwh->msg("externalT_F: %.2lf, condenserTemp_F: %.2lf\n", externalT_F, condenserTemp_F);
hpwh->msg("input_BTUperHr: %.2lf , cop: %.2lf, cap_BTUperHr: %.2lf \n", input_BTUperHr, cop, cap_BTUperHr);
Expand Down Expand Up @@ -3468,6 +3488,17 @@ void HPWH::HeatSource::regressedMethodMP(double &ynew, std::vector<double> &coef
coefficents[5] * x1 * x2;
}

void HPWH::HeatSource::regressedExpMP(double &ynew, std::vector<double> &coefficents, double x1, double x2) {
//Const Tair Tin Tair2 Tin2 TairTin
ynew = exp( coefficents[0] +
coefficents[1] * x1 +
coefficents[2] * x2 +
coefficents[3] * log(x1) +
coefficents[4] * log(x2) +
coefficents[5] * log(x1 + x2)
);
}

void HPWH::HeatSource::calcHeatDist(std::vector<double> &heatDistribution) {

// Populate the vector of heat distribution
Expand Down
24 changes: 22 additions & 2 deletions src/HPWH.in.hh
Expand Up @@ -174,13 +174,19 @@ class HPWH {
MODELS_NyleC250A_C_SP = 245, /*< Nyle C250A external heat pump in Single Pass Mode */

// Larger Nyle models in multi pass configuration
MODELS_NyleC25A_MP = 330, /*< Nyle C25A external heat pump in Multi Pass Mode */
//MODELS_NyleC25A_MP = 330, /*< Nyle C25A external heat pump in Multi Pass Mode */
MODELS_NyleC60A_MP = 331, /*< Nyle C60A external heat pump in Multi Pass Mode */
MODELS_NyleC90A_MP = 332, /*< Nyle C90A external heat pump in Multi Pass Mode */
MODELS_NyleC125A_MP = 333, /*< Nyle C125A external heat pump in Multi Pass Mode */
MODELS_NyleC185A_MP = 334, /*< Nyle C185A external heat pump in Multi Pass Mode */
MODELS_NyleC250A_MP = 335, /*< Nyle C250A external heat pump in Multi Pass Mode */

MODELS_NyleC60A_C_MP = 341, /*< Nyle C60A external heat pump in Multi Pass Mode */
MODELS_NyleC90A_C_MP = 342, /*< Nyle C90A external heat pump in Multi Pass Mode */
MODELS_NyleC125A_C_MP = 343, /*< Nyle C125A external heat pump in Multi Pass Mode */
MODELS_NyleC185A_C_MP = 344, /*< Nyle C185A external heat pump in Multi Pass Mode */
MODELS_NyleC250A_C_MP = 345, /*< Nyle C250A external heat pump in Multi Pass Mode */

// Large Rheem multi pass models
MODELS_RHEEM_HPHD60HNU_201_MP = 350,
MODELS_RHEEM_HPHD60VNU_201_MP = 351,
Expand Down Expand Up @@ -914,7 +920,9 @@ class HPWH::HeatSource {
/**< Does a calculation based on the ten term regression equation */
void regressedMethodMP(double &ynew, std::vector<double> &coefficents, double x1, double x2);
/**< Does a calculation based on the five term regression equation for MP split systems */

void regressedExpMP(double &ynew, std::vector<double> &coefficents, double x1, double x2);
/**< Does a calculation based on the five term exponential regression equation for MP split systems */

void setupDefrostMap(double derate35 = 0.8865);
/**< configure the heat source with a default for the defrost derating */
void defrostDerate(double &to_derate, double airT_C);
Expand Down Expand Up @@ -991,6 +999,17 @@ class HPWH::HeatSource {
/** a single logic that checks the bottom point is below a temperature so the system doesn't short cycle*/
HeatingLogic *standbyLogic;

/** some compressors have a resistance element for defrost*/
struct resistanceElementDefrost
{
double inputPwr_kW;
double constTempLift_dF;
double onBelowT_F;
};
resistanceElementDefrost resDefrost;
/** use the expontential curve fit not the standard quadratic */
bool expCurveFit;

struct defrostPoint {
double T_F;
double derate_fraction;
Expand Down Expand Up @@ -1111,6 +1130,7 @@ inline double KWH_TO_BTU(double kwh) { return (3412.14 * kwh); }
inline double KWH_TO_KJ(double kwh) { return (kwh * 3600.0); }
inline double BTU_TO_KWH(double btu) { return (btu / 3412.14); }
inline double BTUperH_TO_KW(double btu) { return (btu / 3412.14); }
inline double KW_TO_BTUperH(double kw) { return (kw * 3412.14); }
inline double KJ_TO_KWH(double kj) { return (kj/3600.0); }
inline double BTU_TO_KJ(double btu) { return (btu * 1.055); }
inline double GAL_TO_L(double gallons) { return (gallons * 3.78541); }
Expand Down
154 changes: 153 additions & 1 deletion src/HPWHpresets.cc
Expand Up @@ -1362,6 +1362,159 @@ int HPWH::HPWHinit_presets(MODELS presetNum) {
});
}

//set everything in its places
setOfSources[0] = compressor;
}
// If Nyle multipass presets
else if (MODELS_NyleC60A_MP <= presetNum && presetNum <= MODELS_NyleC250A_C_MP) {
numNodes = 24;
tankTemps_C = new double[numNodes];
setpoint_C = F_TO_C(135.0);
tankSizeFixed = false;

doTempDepression = false;
tankMixesOnDraw = false;

tankVolume_L = 315; // Gets adjust per model but ratio between vol and UA is important
tankUA_kJperHrC = 7;

numHeatSources = 1;
setOfSources = new HeatSource[numHeatSources];

HeatSource compressor(this);
compressor.isOn = false;
compressor.isVIP = true;
compressor.typeOfHeatSource = TYPE_compressor;
compressor.setCondensity(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0);
compressor.extrapolationMethod = EXTRAP_NEAREST;
compressor.configuration = HeatSource::CONFIG_EXTERNAL;
compressor.perfMap.reserve(1);
compressor.hysteresis_dC = 0;
compressor.externalOutletHeight = 0;
compressor.externalInletHeight = (int)(numNodes / 3.) - 1;

compressor.expCurveFit = true;

//logic conditions//logic conditions
if (MODELS_NyleC60A_MP <= presetNum && presetNum <= MODELS_NyleC250A_MP) {// If not cold weather package
compressor.minT = F_TO_C(40.); // Min air temperature sans Cold Weather Package
}
else {
compressor.minT = F_TO_C(35.);// Min air temperature WITH Cold Weather Package
}
compressor.maxT = F_TO_C(130.0); // Max air temperature
compressor.maxSetpoint_C = 160.;

std::vector<NodeWeight> nodeWeights;
nodeWeights.emplace_back(4);
compressor.addTurnOnLogic(HPWH::HeatingLogic("fourth node", nodeWeights, dF_TO_dC(5.), false));

std::vector<NodeWeight> nodeWeights1;
nodeWeights1.emplace_back(4);
compressor.addShutOffLogic(HPWH::HeatingLogic("fourth node", nodeWeights1, dF_TO_dC(0.), false, std::greater<double>()));
compressor.depressesTemperature = false; //no temp depression

//Defrost Derate
compressor.setupDefrostMap();

if (presetNum == MODELS_NyleC60A_MP || presetNum == MODELS_NyleC60A_C_MP) {
setTankSize_adjustUA(360., UNITS_GAL);
compressor.mpFlowRate_LPS = GPM_TO_LPS(13.);
if (presetNum == MODELS_NyleC60A_C_MP) {
compressor.resDefrost = {
4.5, // inputPwr_kW;
5.0, // constTempLift_dF;
40.0 // onBelowT_F
};
}
compressor.perfMap.push_back({

90, // Temperature (T_F)

{ 0.3793881173, 0.0013646930, 0.0095624019, -0.3747118461, -0.5721938277, 0.8975984433 }, // Input Power Coefficients (inputPower_coeffs)

{ -1.0502345395, 0.0034695832, -0.0139946437, 0.6109688447, 0.4563525324, -0.2830113509 } // COP Coefficients (COP_coeffs),

});


}
else if (presetNum == MODELS_NyleC90A_MP || presetNum == MODELS_NyleC90A_C_MP) {
setTankSize_adjustUA(480., UNITS_GAL);
compressor.mpFlowRate_LPS = GPM_TO_LPS(20.);
if (presetNum == MODELS_NyleC90A_C_MP) {
compressor.resDefrost = {
5.4, // inputPwr_kW;
5.0, // constTempLift_dF;
40.0 // onBelowT_F
};
}
compressor.perfMap.push_back({
90, // Temperature (T_F)

{-3.2646433947, -0.0016202230, 0.0013361350, -0.4032034153, -0.2371026265, 1.6199379267}, // Input Power Coefficients (inputPower_coeffs)

{3.6779857228, 0.0099026252, -0.0053994954, 0.4824806407, 0.0774214624, -0.9914669117} // COP Coefficients (COP_coeffs)
});

}
else if (presetNum == MODELS_NyleC125A_MP || presetNum == MODELS_NyleC125A_C_MP) {
setTankSize_adjustUA(600., UNITS_GAL);
compressor.mpFlowRate_LPS = GPM_TO_LPS(28.);
if (presetNum == MODELS_NyleC125A_C_MP) {
compressor.resDefrost = {
9.0, // inputPwr_kW;
5.0, // constTempLift_dF;
40.0 // onBelowT_F
};
}
compressor.perfMap.push_back({
90, // Temperature (T_F)

{-0.6913111752, -0.0007913536, 0.0100379459, -0.4680839149, -0.7589682016, 1.5200297482}, // Input Power Coefficients (inputPower_coeffs)

{0.2303698770, 0.0044194375, -0.0148484983, 0.6401560061, 0.4960884618, -0.5801541079} // COP Coefficients (COP_coeffs)
});
}
else if (presetNum == MODELS_NyleC185A_MP || presetNum == MODELS_NyleC185A_C_MP) {
setTankSize_adjustUA(960., UNITS_GAL);
compressor.mpFlowRate_LPS = GPM_TO_LPS(40.);
if (presetNum == MODELS_NyleC185A_C_MP) {
compressor.resDefrost = {
7.2, // inputPwr_kW;
5.0, // constTempLift_dF;
40.0 // onBelowTemp_F
};
}
compressor.perfMap.push_back({
90, // Temperature (T_F)

{0.0149026968, 0.0067961831, 0.0039475952, -0.4259970757, 0.6172132575, 0.1962783222}, // Input Power Coefficients (inputPower_coeffs)

{-0.1866072355, -0.0064299798, -0.0075831393, 0.8667773161, -0.8164105581, 0.5163511206} // COP Coefficients (COP_coeffs)
});
}
else if (presetNum == MODELS_NyleC250A_MP || presetNum == MODELS_NyleC250A_C_MP) {
setTankSize_adjustUA(960., UNITS_GAL);
compressor.mpFlowRate_LPS = GPM_TO_LPS(50.);
if (presetNum == MODELS_NyleC250A_C_MP) {
compressor.resDefrost = {
18.0, // inputPwr_kW;
5.0, // constTempLift_dF;
40.0 // onBelowT_F
};
}
compressor.perfMap.push_back({
90, // Temperature (T_F)

{3.7566636881, 0.0038624982, 0.0072192476, 1.4050392489, 1.6566360285, -2.9904530044}, // Input Power Coefficients (inputPower_coeffs)

{-2.7485898141, -0.0024921296, -0.0134007606, -0.4351961253, -1.4067847665, 2.7129793247} // COP Coefficients (COP_coeffs)
});
}



//set everything in its places
setOfSources[0] = compressor;
}
Expand Down Expand Up @@ -3387,7 +3540,6 @@ int HPWH::HPWHinit_presets(MODELS presetNum) {
setOfSources[0].companionHeatSource = &setOfSources[2];
}
else if (presetNum == MODELS_Scalable_MP) {
// compare to nyle c60A later to make sure it's beating it.
numNodes = 24;
tankTemps_C = new double[numNodes];
setpoint_C = F_TO_C(135.0);
Expand Down

0 comments on commit 745cdca

Please sign in to comment.