Skip to content

Commit

Permalink
Calc add'l params.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Jan 4, 2024
1 parent 5defbd3 commit 900107a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
26 changes: 16 additions & 10 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5464,7 +5464,6 @@ bool HPWH::runDailyTest(const Usage usage, DailyTestSummary &dailyTestSummary)
return false;
}

const double setpointT_C = 51.7; //
const double inletT_C = 14.4; // p. 40433
const double ambientT_C = 19.7; // p. 40435
const double externalT_C = 19.7;
Expand All @@ -5473,17 +5472,19 @@ bool HPWH::runDailyTest(const Usage usage, DailyTestSummary &dailyTestSummary)
double dailyRemovedVolume_L = 0.;
double dailyUsedEnergy_kJ = 0.;

/*
constexpr double setpointT_C = 51.7; //
if (!isSetpointFixed())
{
if (setSetpoint(setpointT_C, UNITS_C) == HPWH_ABORT)
{
return false;
}
}
*/

// first-recovery info
bool isFirstRecoveryPeriod = true;
double recoveryEfficiency = 0.;

double dailyHeatingEnergy_kJ = 0.; // total energy added to water over 24-hr test
double dailyUsedElectricalEnergy_kJ = 0.; // total electrical energy consumed over 24-hr test
Expand Down Expand Up @@ -5565,7 +5566,7 @@ bool HPWH::runDailyTest(const Usage usage, DailyTestSummary &dailyTestSummary)
// find the "Recovery Efficiency" (6.4.2)
if (recoveryUsedEnergy_kJ > 0.)
{
recoveryEfficiency = recoveryHeatingEnergy_kJ / recoveryUsedEnergy_kJ;
dailyTestSummary.recoveryEfficiency = recoveryHeatingEnergy_kJ / recoveryUsedEnergy_kJ;
}
isFirstRecoveryPeriod = false;
}
Expand All @@ -5575,35 +5576,40 @@ bool HPWH::runDailyTest(const Usage usage, DailyTestSummary &dailyTestSummary)
// collect 24-hr test info
dailyRemovedVolume_L += drawnVolume_L;
dailyUsedElectricalEnergy_kJ += recoveryUsedElectricalEnergy_kJ;
dailyUsedFossilFuelEnergy_kJ += recoveryUsedFossilFuelEnergy_kJ;
dailyUsedEnergy_kJ += recoveryUsedEnergy_kJ;
}

// find the "Adjusted Daily Water Heating Energy Consumption" (6.3.6)
if (recoveryEfficiency > 0.)
dailyTestSummary.adjustedDailyWaterHeatingEnergy_kJ = 0.;
if (dailyTestSummary.recoveryEfficiency > 0.)
{
dailyTestSummary.adjustedDailyWaterHeatingEnergy_kJ = dailyHeatingEnergy_kJ / recoveryEfficiency;
dailyTestSummary.adjustedDailyWaterHeatingEnergy_kJ = dailyHeatingEnergy_kJ / dailyTestSummary.recoveryEfficiency;
}

// find the "Uniform Energy Factor" (6.4.4)
const double standardSetpointT_C = 51.7; //
const double standardInletT_C = 14.4; //

double dailyMassRemoved_kg = HPWH::DENSITYWATER_kgperL * dailyRemovedVolume_L;
double dailyHeatCapacity_kJperC = HPWH::CPWATER_kJperkgC * dailyMassRemoved_kg;
double standardDailyHeatingEnergy_kJ = dailyHeatCapacity_kJperC * (setpointT_C - inletT_C);
double standardDailyHeatingEnergy_kJ = dailyHeatCapacity_kJperC * (standardSetpointT_C - standardInletT_C);
dailyTestSummary.UEF = standardDailyHeatingEnergy_kJ / dailyUsedEnergy_kJ;

// find the "Annual Energy Consumption" (6.4.5)
double annualEnergyConsumption_kJ = 0.;
dailyTestSummary.annualEnergyConsumption_kJ = 0.;
if (dailyTestSummary.UEF > 0.)
{
constexpr double day_per_year = 365.;
constexpr double days_per_year = 365.;
const double nominalDifferenceT_C = F_TO_C(67.);
annualEnergyConsumption_kJ = dailyHeatCapacity_kJperC * nominalDifferenceT_C / dailyTestSummary.UEF;
dailyTestSummary.annualEnergyConsumption_kJ = days_per_year * dailyHeatCapacity_kJperC * nominalDifferenceT_C / dailyTestSummary.UEF;
}

// find the "Annual Electrical Energy Consumption" (6.4.6)
dailyTestSummary.annualElectricalEnergyConsumption_kJ = 0.;
if (dailyUsedEnergy_kJ > 0.)
{
dailyTestSummary.annualElectricalEnergyConsumption_kJ = (dailyUsedElectricalEnergy_kJ / dailyUsedEnergy_kJ) * annualEnergyConsumption_kJ;
dailyTestSummary.annualElectricalEnergyConsumption_kJ = (dailyUsedElectricalEnergy_kJ / dailyUsedEnergy_kJ) * dailyTestSummary.annualEnergyConsumption_kJ;
}

return true;
Expand Down
13 changes: 8 additions & 5 deletions test/testCalcUEF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ static bool testCalcUEF(const std::string& sModelName, double& UEF)
}

HPWH::DailyTestSummary dailyTestSummary;
return hpwh.runDailyTest(hpwh.findUsageFromMaximumGPM_Rating(), dailyTestSummary);
bool result = hpwh.runDailyTest(hpwh.findUsageFromMaximumGPM_Rating(), dailyTestSummary);
UEF = dailyTestSummary.UEF;

return result;
}

int main(int argc, char* argv[])
Expand Down Expand Up @@ -51,11 +53,12 @@ int main(int argc, char* argv[])
if (runUnitTests)
{
double UEF;
ASSERTTRUE(testCalcUEF("AOSmithHPTS50", UEF));
ASSERTTRUE(cmpd(UEF, 4.4091));


ASSERTTRUE(testCalcUEF("AquaThermAire", UEF));
ASSERTTRUE(cmpd(UEF, 3.5848));
ASSERTTRUE(cmpd(UEF, 2.8442));

ASSERTTRUE(testCalcUEF("AOSmithHPTS50", UEF));
ASSERTTRUE(cmpd(UEF, 3.4366));

return 0;
}
Expand Down

0 comments on commit 900107a

Please sign in to comment.