Skip to content

Commit

Permalink
Set initial temp from testInfo.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Dec 5, 2023
1 parent abe07ec commit d65de75
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/HPWHpresets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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";
}
Expand Down Expand Up @@ -223,6 +229,7 @@ int main(int argc, char *argv[])
}
}


if (doInvMix == 0) {
outputCode += hpwh.setDoInversionMixing(false);
}
Expand All @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion test/test30/testInfo.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
length_of_test 500
setpoint 53
setpoint 53
initialTankT_C 150
3 changes: 3 additions & 0 deletions test/testUtilityFcts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit d65de75

Please sign in to comment.