From d65de75cbfe6f69ac4d16534dae14e6ea3bc5249 Mon Sep 17 00:00:00 2001 From: Phil Ahrenkiel Date: Tue, 5 Dec 2023 10:31:00 -0700 Subject: [PATCH] Set initial temp from testInfo.txt --- src/HPWHpresets.cc | 3 +++ test/main.cc | 19 ++++++++++++++++--- test/test30/testInfo.txt | 3 ++- test/testUtilityFcts.cc | 3 +++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/HPWHpresets.cc b/src/HPWHpresets.cc index a3fb7910..a7ff066e 100644 --- a/src/HPWHpresets.cc +++ b/src/HPWHpresets.cc @@ -553,6 +553,9 @@ int HPWH::HPWHinit_presets(MODELS presetNum) { setNumNodes(12); setpoint_C = 50; + initialTankT_C = F_TO_C(170.); + hasInitialTankTemp = true; + tankSizeFixed = false; tankVolume_L = 120; tankUA_kJperHrC = 10; //0 to turn off diff --git a/test/main.cc b/test/main.cc index 34817e9e..cba8b985 100644 --- a/test/main.cc +++ b/test/main.cc @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) string testDirectory, fileToOpen, fileToOpen2, scheduleName, var1, input1, input2, input3, inputFile, outputDirectory; string inputVariableName, firstCol; - double testVal, newSetpoint, airTemp, airTemp2, tempDepressThresh, inletH, newTankSize, tot_limit; + double testVal, newSetpoint, airTemp, airTemp2, tempDepressThresh, inletH, newTankSize, tot_limit, initialTankT_C; bool useSoC; int i, outputCode; long minutesToRun; @@ -157,12 +157,14 @@ int main(int argc, char *argv[]) outputCode = 0; minutesToRun = 0; newSetpoint = 0.; + initialTankT_C = 0.; doCondu = 1; doInvMix = 1; inletH = 0.; newTankSize = 0.; tot_limit = 0.; useSoC = false; + bool hasInitialTankTemp = false; cout << "Running: " << input2 << ", " << input1 << ", " << input3 << endl; while(controlFile >> var1 >> testVal) { @@ -190,6 +192,10 @@ int main(int argc, char *argv[]) else if(var1 == "useSoC") { useSoC = (bool)testVal; } + if(var1 == "initialTankT_C") { // Initialize at this temperature instead of setpoint + initialTankT_C = testVal; + hasInitialTankTemp = true; + } else { cout << var1 << " in testInfo.txt is an unrecogized key.\n"; } @@ -223,6 +229,7 @@ int main(int argc, char *argv[]) } } + if (doInvMix == 0) { outputCode += hpwh.setDoInversionMixing(false); } @@ -233,11 +240,17 @@ int main(int argc, char *argv[]) if (newSetpoint > 0) { if (!allSchedules[5].empty()) { hpwh.setSetpoint(allSchedules[5][0]); //expect this to fail sometimes - hpwh.resetTankToSetpoint(); + if (hasInitialTankTemp) + hpwh.setTankToTemperature(initialTankT_C); + else + hpwh.resetTankToSetpoint(); } else { hpwh.setSetpoint(newSetpoint); - hpwh.resetTankToSetpoint(); + if (hasInitialTankTemp) + hpwh.setTankToTemperature(initialTankT_C); + else + hpwh.resetTankToSetpoint(); } } if (inletH > 0) { diff --git a/test/test30/testInfo.txt b/test/test30/testInfo.txt index 2c414b14..afdee5b0 100644 --- a/test/test30/testInfo.txt +++ b/test/test30/testInfo.txt @@ -1,2 +1,3 @@ length_of_test 500 -setpoint 53 \ No newline at end of file +setpoint 53 +initialTankT_C 150 \ No newline at end of file diff --git a/test/testUtilityFcts.cc b/test/testUtilityFcts.cc index e46b797e..ffb4d9c7 100644 --- a/test/testUtilityFcts.cc +++ b/test/testUtilityFcts.cc @@ -297,6 +297,9 @@ HPWH::MODELS mapStringToPreset(string modelName) { else if (modelName == "AWHSTier3Generic80") { hpwhModel = HPWH::MODELS_AWHSTier3Generic80; } + else if (modelName == "BasicIntegrated") { + hpwhModel = HPWH::MODELS_basicIntegrated; + } else { hpwhModel = HPWH::MODELS_basicIntegrated; cout << "Couldn't find model " << modelName << ". Exiting...\n";