Skip to content

Commit

Permalink
Return values are int.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Feb 5, 2024
1 parent 6aa0ff1 commit c02652f
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 168 deletions.
86 changes: 43 additions & 43 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4477,14 +4477,14 @@ bool compressorIsRunning(HPWH& hpwh)
}

/// Initializes a preset from the modelName
bool HPWH::initPreset(const std::string& modelName)
int HPWH::initPreset(const std::string& modelName)
{
HPWH::MODELS targetModel;
if (mapNameToPreset(modelName, targetModel))
{
return initPreset(targetModel);
}
return false;
return HPWH_ABORT;
}

// Used to check a few inputs after the initialization of a tank model from a preset or a file.
Expand Down Expand Up @@ -4763,7 +4763,7 @@ int HPWH::checkInputs()
}

#ifndef HPWH_ABRIDGED
bool HPWH::initFromFile(string configFile)
int HPWH::initFromFile(string configFile)
{
setAllDefaults(); // reset all defaults if you're re-initilizing
// sets simHasFailed = true; this gets cleared on successful completion of init
Expand All @@ -4778,7 +4778,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Input file failed to open. \n");
}
return false;
return HPWH_ABORT;
}

// some variables that will be handy
Expand Down Expand Up @@ -4823,7 +4823,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Incorrect units specification for %s. \n", token.c_str());
}
return false;
return HPWH_ABORT;
}
tankVolume_L = tempDouble;
}
Expand All @@ -4836,7 +4836,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Incorrect units specification for %s. \n", token.c_str());
}
return false;
return HPWH_ABORT;
}
tankUA_kJperHrC = tempDouble;
}
Expand All @@ -4857,7 +4857,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper value for %s\n", token.c_str());
}
return false;
return HPWH_ABORT;
}
}
else if (token == "mixOnDraw")
Expand All @@ -4877,7 +4877,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper value for %s\n", token.c_str());
}
return false;
return HPWH_ABORT;
}
}
else if (token == "mixBelowFractionOnDraw")
Expand All @@ -4889,7 +4889,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Out of bounds value for %s. Should be between 0 and 1. \n", token.c_str());
}
return false;
return HPWH_ABORT;
}
mixBelowFractionOnDraw = tempDouble;
}
Expand All @@ -4906,7 +4906,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Incorrect units specification for %s. \n", token.c_str());
}
return false;
return HPWH_ABORT;
}
setpoint_C = tempDouble;
// tank will be set to setpoint at end of function
Expand All @@ -4924,7 +4924,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper value for %s\n", token.c_str());
}
return false;
return HPWH_ABORT;
}
}
else if (token == "initialTankTemp")
Expand All @@ -4940,7 +4940,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Incorrect units specification for %s. \n", token.c_str());
}
return false;
return HPWH_ABORT;
}
initalTankT_C = tempDouble;
hasInitialTankTemp = true;
Expand All @@ -4959,7 +4959,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper value for %s\n", token.c_str());
}
return false;
return HPWH_ABORT;
}
}
else if (token == "heatExchangerEffectiveness")
Expand Down Expand Up @@ -4993,7 +4993,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Incorrect verbosity on input. \n");
}
return false;
return HPWH_ABORT;
}
}

Expand All @@ -5012,7 +5012,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("You must specify the number of heatsources before setting their properties. "
"\n");
return false;
return HPWH_ABORT;
}
line_ss >> heatsource >> token;
if (token == "isVIP")
Expand All @@ -5030,7 +5030,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
}
else if (token == "isOn")
Expand All @@ -5048,7 +5048,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
}
else if (token == "minT")
Expand All @@ -5064,7 +5064,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Incorrect units specification for %s. \n", token.c_str());
}
return false;
return HPWH_ABORT;
}
heatSources[heatsource].minT = tempDouble;
}
Expand All @@ -5081,7 +5081,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Incorrect units specification for %s. \n", token.c_str());
}
return false;
return HPWH_ABORT;
}
heatSources[heatsource].maxT = tempDouble;
}
Expand All @@ -5107,7 +5107,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
LOGIC_SIZE + 1);
}
return false;
return HPWH_ABORT;
}
nodeNums.push_back(nodeNum);
line_ss >> nextToken;
Expand Down Expand Up @@ -5140,7 +5140,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
nodeNums.size());
}
return false;
return HPWH_ABORT;
}
if (nextToken != "absolute" && nextToken != "relative")
{
Expand All @@ -5152,7 +5152,7 @@ bool HPWH::initFromFile(string configFile)
heatsource,
token.c_str());
}
return false;
return HPWH_ABORT;
}
bool absolute = (nextToken == "absolute");
std::string compareStr;
Expand All @@ -5172,7 +5172,7 @@ bool HPWH::initFromFile(string configFile)
heatsource,
token.c_str());
}
return false;
return HPWH_ABORT;
}
if (units == "F")
{
Expand All @@ -5195,7 +5195,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
std::vector<NodeWeight> nodeWeights;
for (size_t i = 0; i < nodeNums.size(); i++)
Expand Down Expand Up @@ -5244,7 +5244,7 @@ bool HPWH::initFromFile(string configFile)
heatsource,
token.c_str());
}
return false;
return HPWH_ABORT;
}
line_ss >> tempDouble;
}
Expand Down Expand Up @@ -5274,7 +5274,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
if (tempString == "wholeTank")
{
Expand Down Expand Up @@ -5327,7 +5327,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper %s for heat source %d\n", token.c_str(), heatsource);
}
return false;
return HPWH_ABORT;
}
}
else if (token == "offlogic")
Expand All @@ -5345,7 +5345,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
if (tempString == "topNodeMaxTemp")
{
Expand Down Expand Up @@ -5380,7 +5380,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper %s for heat source %d\n", token.c_str(), heatsource);
}
return false;
return HPWH_ABORT;
}
}
}
Expand All @@ -5401,7 +5401,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper %s for heat source %d\n", token.c_str(), heatsource);
}
return false;
return HPWH_ABORT;
}
}
else if (token == "coilConfig")
Expand All @@ -5425,7 +5425,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper %s for heat source %d\n", token.c_str(), heatsource);
}
return false;
return HPWH_ABORT;
}
}
else if (token == "heatCycle")
Expand All @@ -5445,7 +5445,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper %s for heat source %d\n", token.c_str(), heatsource);
}
return false;
return HPWH_ABORT;
}
}

Expand All @@ -5462,7 +5462,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper %s for heat source %d\n", token.c_str(), heatsource);
}
return false;
return HPWH_ABORT;
}
}
else if (token == "externalOutlet")
Expand All @@ -5478,7 +5478,7 @@ bool HPWH::initFromFile(string configFile)
{
msg("Improper %s for heat source %d\n", token.c_str(), heatsource);
}
return false;
return HPWH_ABORT;
}
}

Expand Down Expand Up @@ -5512,7 +5512,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
else
{
Expand All @@ -5525,7 +5525,7 @@ bool HPWH::initFromFile(string configFile)
maxTemps,
nTemps);
}
return false;
return HPWH_ABORT;
}
}
line_ss >> tempDouble >> units;
Expand All @@ -5543,7 +5543,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
heatSources[heatsource].perfMap[nTemps - 1].T_F = tempDouble;
}
Expand Down Expand Up @@ -5584,7 +5584,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
else
{
Expand All @@ -5597,7 +5597,7 @@ bool HPWH::initFromFile(string configFile)
maxTemps,
nTemps);
}
return false;
return HPWH_ABORT;
}
}
line_ss >> tempDouble;
Expand Down Expand Up @@ -5627,7 +5627,7 @@ bool HPWH::initFromFile(string configFile)
token.c_str(),
heatsource);
}
return false;
return HPWH_ABORT;
}
heatSources[heatsource].hysteresis_dC = tempDouble;
}
Expand Down Expand Up @@ -5658,7 +5658,7 @@ bool HPWH::initFromFile(string configFile)
else
{
msg("Improper keyword: %s \n", token.c_str());
return false;
return HPWH_ABORT;
}

} // end while over lines
Expand Down Expand Up @@ -5689,9 +5689,9 @@ bool HPWH::initFromFile(string configFile)

if (checkInputs() == HPWH_ABORT)
{
return false;
return HPWH_ABORT;
}
simHasFailed = false;
return true;
return 0;
}
#endif
Loading

0 comments on commit c02652f

Please sign in to comment.