Skip to content

Commit

Permalink
Merge pull request #220 from bigladder/constrain-perf-curves-add-lg
Browse files Browse the repository at this point in the history
Constrain performance curves and add 80-gallon LG model
  • Loading branch information
nealkruis authored Dec 11, 2024
2 parents 4ef38fc + bc00fd3 commit ca59085
Show file tree
Hide file tree
Showing 25 changed files with 19,073 additions and 13,477 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,12 @@ jobs:
cxx: cl
experimental: false
- os: macos
os_ver: "12"
os_ver: "13"
config: Release
coverage: false
cc: clang
cxx: clang++
experimental: false
- os: macos
os_ver: "11"
config: Release
coverage: false
cc: clang
cxx: clang++
experimental: true
- os: ubuntu
os_ver: "20.04"
config: Debug
Expand Down
7 changes: 4 additions & 3 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4120,6 +4120,10 @@ void HPWH::checkInputs()
{
model = HPWH::MODELS_LG_APHWC50;
}
else if (modelName == "LG_APHWC80")
{
model = HPWH::MODELS_LG_APHWC80;
}
else
{
model = HPWH::MODELS_basicIntegrated;
Expand Down Expand Up @@ -4929,7 +4933,6 @@ void HPWH::prepForTest(StandardTestOptions& testOptions)
bool isDrawing = false;
bool done = false;
int step = 0;
int time_min = 0;
while (!done)
{
switch (step)
Expand Down Expand Up @@ -4980,8 +4983,6 @@ void HPWH::prepForTest(StandardTestOptions& testOptions)
0., // inlet-2 volume (L)
inletT_C, // inlet-2 Temp (C)
NULL); // no extra heat

++time_min;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/HPWH.hh
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ class HPWH : public Courier::Sender
MODELS_BradfordWhiteAeroThermRE2H65 = 501,
MODELS_BradfordWhiteAeroThermRE2H80 = 502,

MODELS_LG_APHWC50 = 600
MODELS_LG_APHWC50 = 600,
MODELS_LG_APHWC80 = 601
};

/// specifies the modes for writing output
Expand Down
70 changes: 49 additions & 21 deletions src/HPWHpresets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4449,15 +4449,15 @@ void HPWH::initPreset(MODELS presetNum)
compressor->perfMap.reserve(2);

compressor->perfMap.push_back({
50, // Temperature (T_F)
{148, 2.0, 0.0}, // Input Power Coefficients (inputPower_coeffs)
{5.88, -0.024, 0.0} // COP Coefficients (COP_coeffs)
50, // Temperature (T_F)
{120, 2.45, 0.0}, // Input Power Coefficients (inputPower_coeffs)
{6.3, -0.030, 0.0} // COP Coefficients (COP_coeffs)
});

compressor->perfMap.push_back({
70, // Temperature (T_F)
{110, 2.5, 0.0}, // Input Power Coefficients (inputPower_coeffs)
{6.8, -0.0323, 0.0} // COP Coefficients (COP_coeffs)
70, // Temperature (T_F)
{124, 2.45, 0.0}, // Input Power Coefficients (inputPower_coeffs)
{6.8, -0.030, 0.0} // COP Coefficients (COP_coeffs)
});

compressor->minT = F_TO_C(37.0);
Expand All @@ -4480,7 +4480,7 @@ void HPWH::initPreset(MODELS presetNum)

resistiveElementBottom->addShutOffLogic(bottomTwelfthMaxTemp(F_TO_C(86.1)));

compressor->addTurnOnLogic(bottomThird(dF_TO_dC(30)));
compressor->addTurnOnLogic(bottomThird(dF_TO_dC(25)));
compressor->addTurnOnLogic(standby(dF_TO_dC(12.392)));

//
Expand All @@ -4490,13 +4490,21 @@ void HPWH::initPreset(MODELS presetNum)
resistiveElementTop->followedByHeatSource = resistiveElementBottom;
resistiveElementBottom->followedByHeatSource = compressor;
}
else if (presetNum == MODELS_LG_APHWC50)
else if ((presetNum == MODELS_LG_APHWC50) || (presetNum == MODELS_LG_APHWC80))
{ //
setNumNodes(12);
setpoint_C = F_TO_C(125.);

tankVolume_L = GAL_TO_L(52.8);
tankUA_kJperHrC = 7.78;
if (presetNum == MODELS_LG_APHWC50)
{
tankVolume_L = GAL_TO_L(52.8);
tankUA_kJperHrC = 7.78;
}
else if (presetNum == MODELS_LG_APHWC80)
{
tankVolume_L = GAL_TO_L(72.0);
tankUA_kJperHrC = 10.83;
}

doTempDepression = false;
tankMixesOnDraw = false;
Expand All @@ -4515,35 +4523,55 @@ void HPWH::initPreset(MODELS presetNum)

compressor->perfMap.reserve(3);

double dPin_dTs = 2.1;
double dcop_dTs = -0.01;
double Ts_op = 124.;

double Pin50_op = 355.8;
double cop50_op = 3.13;
double Pin50_0 = Pin50_op - dPin_dTs * (Ts_op - 0.);
double cop50_0 = cop50_op - dcop_dTs * (Ts_op - 0.);

double Pin67_op = 272;
double cop67_op = 4.25;
double Pin67_0 = Pin67_op - dPin_dTs * (Ts_op - 0.);
double cop67_0 = cop67_op - dcop_dTs * (Ts_op - 0.);

double Pin95_op = 260.5;
double cop95_op = 6.56;
double Pin95_0 = Pin95_op - dPin_dTs * (Ts_op - 0.);
double cop95_0 = cop95_op - dcop_dTs * (Ts_op - 0.);

compressor->perfMap.push_back({
50, // Temperature (F)
{128, 1.7, 0.}, // Input Power Coefficients (kW)
{3.5, 0, 0.} // COP Coefficients
50, // Temperature (F)
{Pin50_0, dPin_dTs, 0.}, // Input Power Coefficients (W)
{cop50_0, dcop_dTs, 0.} // COP Coefficients
});

compressor->perfMap.push_back({
67.5, // Temperature (F)
{26., 1.8, 0.}, // Input Power Coefficients (kW)
{9.5, -0.05, 0.} // COP Coefficients
67.5, // Temperature (F)
{Pin67_0, dPin_dTs, 0.}, // Input Power Coefficients (W)
{cop67_0, dcop_dTs, 0.} // COP Coefficients
});

compressor->perfMap.push_back({
95, // Temperature (F)
{-31.81, 2.309, 0.}, // Input Power Coefficients (kW)
{20.29913, -0.1329, 0.} // COP Coefficients
95, // Temperature (F)
{Pin95_0, dPin_dTs, 0.}, // Input Power Coefficients (W)
{cop95_0, dcop_dTs, 0.} // COP Coefficients
});

compressor->minT = F_TO_C(23);
compressor->maxT = F_TO_C(120.);
compressor->maxSetpoint_C = MAXOUTLET_R134A;
compressor->hysteresis_dC = dF_TO_dC(1);
compressor->configuration = HeatSource::CONFIG_WRAPPED;

compressor->addTurnOnLogic(bottomThird(dF_TO_dC(52.7)));
compressor->addTurnOnLogic(bottomThird(dF_TO_dC(52.9)));
compressor->addTurnOnLogic(standby(dF_TO_dC(9.)));

// top resistor values
resistiveElementTop->setupAsResistiveElement(8, 5000.);
resistiveElementTop->addTurnOnLogic(topThird(dF_TO_dC(34.)));
resistiveElementTop->addTurnOnLogic(topThird(dF_TO_dC(39.)));
resistiveElementTop->isVIP = true;

// bottom resistor values
Expand Down
16 changes: 8 additions & 8 deletions test/BradfordWhiteAeroThermRE2H50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ heatsource 2 condensity 1 0 0

heatsource 2 nTemps 2
heatsource 2 T1 50 F
heatsource 2 inPowT1const 148
heatsource 2 inPowT1lin 2
heatsource 2 inPowT1const 120
heatsource 2 inPowT1lin 2.45
heatsource 2 inPowT1quad 0
heatsource 2 copT1const 5.88
heatsource 2 copT1lin -0.024
heatsource 2 copT1const 6.3
heatsource 2 copT1lin -0.030
heatsource 2 copT1quad 0.0

heatsource 2 T2 70 F
heatsource 2 inPowT2const 110
heatsource 2 inPowT2lin 2.5
heatsource 2 inPowT2const 124
heatsource 2 inPowT2lin 2.45
heatsource 2 inPowT2quad 0
heatsource 2 copT2const 6.8
heatsource 2 copT2lin -0.0323
heatsource 2 copT2lin -0.030
heatsource 2 copT2quad 0.0

heatsource 2 minT 37 F
Expand All @@ -90,7 +90,7 @@ heatsource 0 onlogic fourthSixth 32 F

heatsource 1 offlogic bottomTwelfthMaxTemp 86.1 F

heatsource 2 onlogic bottomThird 30 F
heatsource 2 onlogic bottomThird 25 F
heatsource 2 onlogic standby 12.392 F

#relative
Expand Down
16 changes: 8 additions & 8 deletions test/BradfordWhiteAeroThermRE2H65.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ heatsource 2 condensity 1 0 0

heatsource 2 nTemps 2
heatsource 2 T1 50 F
heatsource 2 inPowT1const 148
heatsource 2 inPowT1lin 2
heatsource 2 inPowT1const 120
heatsource 2 inPowT1lin 2.45
heatsource 2 inPowT1quad 0
heatsource 2 copT1const 5.88
heatsource 2 copT1lin -0.024
heatsource 2 copT1const 6.3
heatsource 2 copT1lin -0.030
heatsource 2 copT1quad 0.0

heatsource 2 T2 70 F
heatsource 2 inPowT2const 110
heatsource 2 inPowT2lin 2.5
heatsource 2 inPowT2const 124
heatsource 2 inPowT2lin 2.45
heatsource 2 inPowT2quad 0
heatsource 2 copT2const 6.8
heatsource 2 copT2lin -0.0323
heatsource 2 copT2lin -0.030
heatsource 2 copT2quad 0.0

heatsource 2 minT 37 F
Expand All @@ -90,7 +90,7 @@ heatsource 0 onlogic fourthSixth 32 F

heatsource 1 offlogic bottomTwelfthMaxTemp 86.1 F

heatsource 2 onlogic bottomThird 30 F
heatsource 2 onlogic bottomThird 25 F
heatsource 2 onlogic standby 12.392 F

#relative
Expand Down
16 changes: 8 additions & 8 deletions test/BradfordWhiteAeroThermRE2H80.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ heatsource 2 condensity 1 0 0

heatsource 2 nTemps 2
heatsource 2 T1 50 F
heatsource 2 inPowT1const 148
heatsource 2 inPowT1lin 2
heatsource 2 inPowT1const 120
heatsource 2 inPowT1lin 2.45
heatsource 2 inPowT1quad 0
heatsource 2 copT1const 5.88
heatsource 2 copT1lin -0.024
heatsource 2 copT1const 6.3
heatsource 2 copT1lin -0.030
heatsource 2 copT1quad 0.0

heatsource 2 T2 70 F
heatsource 2 inPowT2const 110
heatsource 2 inPowT2lin 2.5
heatsource 2 inPowT2const 124
heatsource 2 inPowT2lin 2.45
heatsource 2 inPowT2quad 0
heatsource 2 copT2const 6.8
heatsource 2 copT2lin -0.0323
heatsource 2 copT2lin -0.030
heatsource 2 copT2quad 0.0

heatsource 2 minT 37 F
Expand All @@ -90,7 +90,7 @@ heatsource 0 onlogic fourthSixth 32 F

heatsource 1 offlogic bottomTwelfthMaxTemp 86.1 F

heatsource 2 onlogic bottomThird 30 F
heatsource 2 onlogic bottomThird 25 F
heatsource 2 onlogic standby 12.392 F

#relative
Expand Down
34 changes: 23 additions & 11 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ set(BradfordWhiteAeroThermRE2H80_Tests
)

#
set(LG_APHWC50Dir "LG/LG_APHWC50")
set(LG_APHWC50_Tests
set(LG_Models LG_APHWC50 LG_APHWC80)
set(LG_TestDir "LG/LG_APHWC50")
set(LG_Tests
DOE2014_LGC50_24hr50
DOE2014_LGC50_24hr67
DOE2014_LGC50_24hr95
Expand Down Expand Up @@ -276,11 +277,13 @@ foreach (size ${BradfordWhiteAeroThermRE2HSizes})
endforeach (size)

#Test(s) specifically for LG APHWC50 model
foreach (test ${LG_APHWC50_Tests})
set(fullTestName "${LG_APHWC50Dir}/${test}")
add_model_test(TEST_NAME "${fullTestName}" MODEL_NAME "LG_APHWC50" SPEC_TYPE "Preset")
add_model_test(TEST_NAME "${fullTestName}" MODEL_NAME "LG_APHWC50" SPEC_TYPE "File")
endforeach (test)
foreach(model ${LG_Models})
foreach (test ${LG_Tests})
set(fullTestName "${LG_TestDir}/${test}")
add_model_test(TEST_NAME "${fullTestName}" MODEL_NAME "${model}" SPEC_TYPE "Preset")
add_model_test(TEST_NAME "${fullTestName}" MODEL_NAME "${model}" SPEC_TYPE "File")
endforeach (test)
endforeach (model)

add_plot_test(SPEC_TYPE "Preset" MODEL_NAME "AquaThermAire" TEST_NAME "villara_24hr67" )

Expand Down Expand Up @@ -324,9 +327,11 @@ foreach (size ${BradfordWhiteAeroThermRE2HSizes})
endforeach (size)

#Test(s) for heat-exchange models
foreach (test ${LG_APHWC50Tests})
add_file_test(TEST_NAME "${test}" MODEL_NAME "LG_APHWC50")
endforeach (test)
foreach(model ${LG_Models})
foreach (test ${LG_Tests})
add_file_test(TEST_NAME "${test}" MODEL_NAME "${model}")
endforeach (test)
endforeach (model)

# Tests for regression differences against reference results
function(add_regression_test)
Expand Down Expand Up @@ -367,6 +372,13 @@ foreach (size ${BradfordWhiteAeroThermRE2HSizes})
endforeach (test)
endforeach (size)

#Test(s) specifically for Bradford White AeroTherm model
foreach(model ${LG_Models})
foreach (test ${LG_Tests})
add_regression_test(TEST_NAME "${test}" MODEL_NAME "${model}" SPEC_TYPE "Preset")
endforeach (test)
endforeach (model)

#Test models follow control logic with max temperatures.
foreach (test ${maxTempTests})
foreach (model ${maxTempModels})
Expand Down Expand Up @@ -431,4 +443,4 @@ endforeach (test)
add_test(NAME "RegressionTest.YearRuns" COMMAND ${CMAKE_COMMAND} -E compare_files "${CMAKE_CURRENT_BINARY_DIR}/output/DHW_YRLY.csv" "${CMAKE_CURRENT_SOURCE_DIR}/ref/DHW_YRLY.csv")

# Add unit tests
add_subdirectory(unit_tests)
add_subdirectory(unit_tests)
Loading

0 comments on commit ca59085

Please sign in to comment.