From 900107a5009488039243ce716eb56bfcfe89ec56 Mon Sep 17 00:00:00 2001 From: Phil Ahrenkiel Date: Thu, 4 Jan 2024 16:37:21 -0700 Subject: [PATCH] Calc add'l params. --- src/HPWH.cc | 26 ++++++++++++++++---------- test/testCalcUEF.cc | 13 ++++++++----- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/HPWH.cc b/src/HPWH.cc index c61ae2e8..798bd4c0 100644 --- a/src/HPWH.cc +++ b/src/HPWH.cc @@ -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; @@ -5473,6 +5472,8 @@ 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) @@ -5480,10 +5481,10 @@ bool HPWH::runDailyTest(const Usage usage, DailyTestSummary &dailyTestSummary) 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 @@ -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; } @@ -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; diff --git a/test/testCalcUEF.cc b/test/testCalcUEF.cc index 0274a33c..a9e60f99 100644 --- a/test/testCalcUEF.cc +++ b/test/testCalcUEF.cc @@ -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[]) @@ -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; }