diff --git a/src/HPWH.cc b/src/HPWH.cc index 62fa3f7d..750fe0a4 100644 --- a/src/HPWH.cc +++ b/src/HPWH.cc @@ -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. @@ -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 @@ -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 @@ -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; } @@ -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; } @@ -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") @@ -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") @@ -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; } @@ -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 @@ -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") @@ -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; @@ -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") @@ -4993,7 +4993,7 @@ bool HPWH::initFromFile(string configFile) { msg("Incorrect verbosity on input. \n"); } - return false; + return HPWH_ABORT; } } @@ -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") @@ -5030,7 +5030,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } } else if (token == "isOn") @@ -5048,7 +5048,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } } else if (token == "minT") @@ -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; } @@ -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; } @@ -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; @@ -5140,7 +5140,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), nodeNums.size()); } - return false; + return HPWH_ABORT; } if (nextToken != "absolute" && nextToken != "relative") { @@ -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; @@ -5172,7 +5172,7 @@ bool HPWH::initFromFile(string configFile) heatsource, token.c_str()); } - return false; + return HPWH_ABORT; } if (units == "F") { @@ -5195,7 +5195,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } std::vector nodeWeights; for (size_t i = 0; i < nodeNums.size(); i++) @@ -5244,7 +5244,7 @@ bool HPWH::initFromFile(string configFile) heatsource, token.c_str()); } - return false; + return HPWH_ABORT; } line_ss >> tempDouble; } @@ -5274,7 +5274,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } if (tempString == "wholeTank") { @@ -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") @@ -5345,7 +5345,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } if (tempString == "topNodeMaxTemp") { @@ -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; } } } @@ -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") @@ -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") @@ -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; } } @@ -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") @@ -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; } } @@ -5512,7 +5512,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } else { @@ -5525,7 +5525,7 @@ bool HPWH::initFromFile(string configFile) maxTemps, nTemps); } - return false; + return HPWH_ABORT; } } line_ss >> tempDouble >> units; @@ -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; } @@ -5584,7 +5584,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } else { @@ -5597,7 +5597,7 @@ bool HPWH::initFromFile(string configFile) maxTemps, nTemps); } - return false; + return HPWH_ABORT; } } line_ss >> tempDouble; @@ -5627,7 +5627,7 @@ bool HPWH::initFromFile(string configFile) token.c_str(), heatsource); } - return false; + return HPWH_ABORT; } heatSources[heatsource].hysteresis_dC = tempDouble; } @@ -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 @@ -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 diff --git a/src/HPWH.hh b/src/HPWH.hh index 6adcffc9..f903770a 100644 --- a/src/HPWH.hh +++ b/src/HPWH.hh @@ -471,11 +471,11 @@ class HPWH static std::string getVersion(); /**< This function returns a string with the current version number */ - bool initResistanceTank(); /**< Default resistance tank, EF 0.95, volume 47.5 */ - bool initResistanceTank(double tankVol_L, - double energyFactor, - double upperPower_W, - double lowerPower_W); + int initResistanceTank(); /**< Default resistance tank, EF 0.95, volume 47.5 */ + int initResistanceTank(double tankVol_L, + double energyFactor, + double upperPower_W, + double lowerPower_W); /**< This function will initialize a HPWH object to be a resistance tank. Since * resistance tanks are so simple, they can be specified with only four variables: * tank volume, energy factor, and the power of the upper and lower elements. Energy @@ -487,10 +487,10 @@ class HPWH * to standard setting, with upper as VIP activating when the top third is too cold. */ - bool initResistanceTankGeneric(double tankVol_L, - double rValue_M2KperW, - double upperPower_W, - double lowerPower_W); + int initResistanceTankGeneric(double tankVol_L, + double rValue_M2KperW, + double upperPower_W, + double lowerPower_W); /**< This function will initialize a HPWH object to be a generic resistance storage water * heater, with a specific R-Value defined at initalization. * @@ -499,7 +499,7 @@ class HPWH * controls for the HPWHinit_resTank() */ - bool initGeneric(double tankVol_L, double energyFactor, double resUse_C); + int initGeneric(double tankVol_L, double energyFactor, double resUse_C); /**< This function will initialize a HPWH object to be a non-specific HPWH model * with an energy factor as specified. Since energy * factor is not strongly correlated with energy use, most settings @@ -508,7 +508,7 @@ class HPWH static bool mapNameToPreset(const std::string& modelName, MODELS& model); - bool initPreset(MODELS presetNum); + int initPreset(MODELS presetNum); /**< This function will reset all member variables to defaults and then * load in a set of parameters that are hardcoded in this function - * which particular set of parameters is selected by presetNum. @@ -519,10 +519,10 @@ class HPWH * The return value is 0 for successful initialization, HPWH_ABORT otherwise */ - bool initPreset(const std::string& modelName); + int initPreset(const std::string& modelName); #ifndef HPWH_ABRIDGED - bool initFromFile(std::string configFile); + int initFromFile(std::string configFile); /**< Loads a HPWH model from a file * The file name is the input - there should be at most one set of parameters per file * This is useful for testing new variations, and for the sort of variability diff --git a/src/HPWHpresets.cc b/src/HPWHpresets.cc index b2920bf2..c7416dca 100644 --- a/src/HPWHpresets.cc +++ b/src/HPWHpresets.cc @@ -7,16 +7,16 @@ File Containing all of the presets available in HPWHsim #include -bool HPWH::initResistanceTank() +int HPWH::initResistanceTank() { // a default resistance tank, nominal 50 gallons, 0.95 EF, standard double 4.5 kW elements return initResistanceTank(GAL_TO_L(47.5), 0.95, 4500, 4500); } -bool HPWH::initResistanceTank(double tankVol_L, - double energyFactor, - double upperPower_W, - double lowerPower_W) +int HPWH::initResistanceTank(double tankVol_L, + double energyFactor, + double upperPower_W, + double lowerPower_W) { setAllDefaults(); // reset all defaults if you're re-initilizing @@ -32,7 +32,7 @@ bool HPWH::initResistanceTank(double tankVol_L, { msg("Resistance tank lower element wattage below 550 W. DOES NOT COMPUTE\n"); } - return false; + return HPWH_ABORT; } if (upperPower_W < 0.) { @@ -40,7 +40,7 @@ bool HPWH::initResistanceTank(double tankVol_L, { msg("Upper resistance tank wattage below 0 W. DOES NOT COMPUTE\n"); } - return false; + return HPWH_ABORT; } if (energyFactor <= 0.) { @@ -48,7 +48,7 @@ bool HPWH::initResistanceTank(double tankVol_L, { msg("Energy Factor less than zero. DOES NOT COMPUTE\n"); } - return false; + return HPWH_ABORT; } setNumNodes(12); @@ -57,7 +57,7 @@ bool HPWH::initResistanceTank(double tankVol_L, tankSizeFixed = false; if (setTankSize(tankVol_L) == HPWH_ABORT) { - return false; + return HPWH_ABORT; } setpoint_C = F_TO_C(127.0); @@ -124,7 +124,7 @@ bool HPWH::initResistanceTank(double tankVol_L, calcDerivedValues(); if (checkInputs() == HPWH_ABORT) - return false; + return HPWH_ABORT; isHeating = false; for (int i = 0; i < getNumHeatSources(); i++) @@ -146,13 +146,13 @@ bool HPWH::initResistanceTank(double tankVol_L, } simHasFailed = false; - return true; // successful init returns true + return 0; // successful init returns 0 } -bool HPWH::initResistanceTankGeneric(double tankVol_L, - double rValue_m2KperW, - double upperPower_W, - double lowerPower_W) +int HPWH::initResistanceTankGeneric(double tankVol_L, + double rValue_m2KperW, + double upperPower_W, + double lowerPower_W) { setAllDefaults(); // reset all defaults if you're re-initilizing @@ -167,7 +167,7 @@ bool HPWH::initResistanceTankGeneric(double tankVol_L, { msg("Lower resistance tank wattage below 0 W. DOES NOT COMPUTE\n"); } - return false; + return HPWH_ABORT; } if (upperPower_W < 0.) { @@ -175,7 +175,7 @@ bool HPWH::initResistanceTankGeneric(double tankVol_L, { msg("Upper resistance tank wattage below 0 W. DOES NOT COMPUTE\n"); } - return false; + return HPWH_ABORT; } if (rValue_m2KperW <= 0.) { @@ -183,7 +183,7 @@ bool HPWH::initResistanceTankGeneric(double tankVol_L, { msg("R-Value is equal to or below 0. DOES NOT COMPUTE\n"); } - return false; + return HPWH_ABORT; } setNumNodes(12); @@ -192,7 +192,7 @@ bool HPWH::initResistanceTankGeneric(double tankVol_L, tankSizeFixed = false; if (setTankSize(tankVol_L) == HPWH_ABORT) { - return false; + return HPWH_ABORT; } canScale = true; @@ -254,7 +254,7 @@ bool HPWH::initResistanceTankGeneric(double tankVol_L, calcDerivedValues(); if (checkInputs() == HPWH_ABORT) - return false; + return HPWH_ABORT; isHeating = false; for (auto& source : heatSources) @@ -276,10 +276,10 @@ bool HPWH::initResistanceTankGeneric(double tankVol_L, } simHasFailed = false; - return true; // successful init returns 0 + return 0; // successful init returns 0 } -bool HPWH::initGeneric(double tankVol_L, double energyFactor, double resUse_C) +int HPWH::initGeneric(double tankVol_L, double energyFactor, double resUse_C) { setAllDefaults(); // reset all defaults if you're re-initilizing @@ -424,7 +424,7 @@ bool HPWH::initGeneric(double tankVol_L, double energyFactor, double resUse_C) if (checkInputs() == HPWH_ABORT) { - return false; + return HPWH_ABORT; } isHeating = false; @@ -447,10 +447,10 @@ bool HPWH::initGeneric(double tankVol_L, double energyFactor, double resUse_C) } simHasFailed = false; - return true; + return 0; } -bool HPWH::initPreset(MODELS presetNum) +int HPWH::initPreset(MODELS presetNum) { setAllDefaults(); // reset all defaults if you're re-initilizing // sets simHasFailed = true; this gets cleared on successful completion of init @@ -4227,7 +4227,7 @@ bool HPWH::initPreset(MODELS presetNum) { msg("Incorrect model specification. \n"); } - return false; + return HPWH_ABORT; } doTempDepression = false; @@ -4580,7 +4580,7 @@ bool HPWH::initPreset(MODELS presetNum) { msg("You have tried to select a preset model which does not exist. \n"); } - return false; + return HPWH_ABORT; } if (hasInitialTankTemp) @@ -4595,7 +4595,7 @@ bool HPWH::initPreset(MODELS presetNum) if (checkInputs() == HPWH_ABORT) { - return false; + return HPWH_ABORT; } isHeating = false; @@ -4618,5 +4618,5 @@ bool HPWH::initPreset(MODELS presetNum) } simHasFailed = false; - return true; // successful init returns true + return 0; // successful init returns 0 } // end HPWHinit_presets diff --git a/test/main.cc b/test/main.cc index 67e4b2ee..c6961f4f 100644 --- a/test/main.cc +++ b/test/main.cc @@ -136,7 +136,7 @@ int main(int argc, char* argv[]) { inputFile = ""; - if (!hpwh.initPreset(input2)) + if (hpwh.initPreset(input2) != 0) { cout << "Error, preset model did not initialize.\n"; exit(1); @@ -152,7 +152,7 @@ int main(int argc, char* argv[]) else if (input1 == "File") { inputFile = input2 + ".txt"; - if (!hpwh.initFromFile(inputFile)) + if (hpwh.initFromFile(inputFile) != 0) { cout << "Error, file model did not initialize.\n"; exit(1); diff --git a/test/unit_tests/compressorFncsTest.cpp b/test/unit_tests/compressorFncsTest.cpp index 815731f2..72cbfbfb 100644 --- a/test/unit_tests/compressorFncsTest.cpp +++ b/test/unit_tests/compressorFncsTest.cpp @@ -47,7 +47,7 @@ TEST_F(CompressorFncsTest, compressorSpecs) { // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(modelSpec.sModelName)) + EXPECT_EQ(hpwh.initPreset(modelSpec.sModelName), 0) << "Could not initialize model " << modelSpec.sModelName; EXPECT_EQ(hpwh.hasACompressor(), modelSpec.hasCompressor) << modelSpec.sModelName; diff --git a/test/unit_tests/energyBalanceTest.cpp b/test/unit_tests/energyBalanceTest.cpp index 8f948eaa..1d900574 100644 --- a/test/unit_tests/energyBalanceTest.cpp +++ b/test/unit_tests/energyBalanceTest.cpp @@ -20,7 +20,7 @@ TEST(EnergyBalanceTest, energyBalance) // get preset model HPWH hpwh; const std::string sModelName = "AOSmithHPTS50"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model."; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model."; const double maxDrawVol_L = 1.; const double ambientT_C = 20.; @@ -56,7 +56,7 @@ TEST(EnergyBalanceTest, energyBalance) // get preset model HPWH hpwh; const std::string sModelName = "StorageTank"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model."; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model."; const double maxDrawVol_L = 1.; const double ambientT_C = 20.; diff --git a/test/unit_tests/fixedTankSizeTest.cpp b/test/unit_tests/fixedTankSizeTest.cpp index c634ba4e..891d1b4d 100644 --- a/test/unit_tests/fixedTankSizeTest.cpp +++ b/test/unit_tests/fixedTankSizeTest.cpp @@ -33,7 +33,7 @@ TEST_F(FixedSizeTest, tankSizeFixed) { // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; // get the initial tank size double intitialTankSize_gal = hpwh.getTankSize(HPWH::UNITS_GAL); diff --git a/test/unit_tests/heatingLogicsTest.cpp b/test/unit_tests/heatingLogicsTest.cpp index 1842e8d0..26bf1c73 100644 --- a/test/unit_tests/heatingLogicsTest.cpp +++ b/test/unit_tests/heatingLogicsTest.cpp @@ -49,7 +49,7 @@ TEST_F(HeatingLogicsTest, highShutOffSP) { // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; { // testHasEnteringWaterShutOff int index = hpwh.getCompressorIndex() == -1 ? 0 : hpwh.getCompressorIndex(); @@ -153,7 +153,7 @@ TEST_F(HeatingLogicsTest, noShutOffMP_external) { // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; { // testDoesNotHaveEnteringWaterShutOff int index = hpwh.getCompressorIndex() == -1 ? 0 : hpwh.getCompressorIndex(); @@ -184,7 +184,7 @@ TEST_F(HeatingLogicsTest, stateOfChargeLogics) { // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; if (!hpwh.isSetpointFixed()) { @@ -301,7 +301,7 @@ TEST_F(HeatingLogicsTest, noHighShutOffIntegrated) { // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; int index = hpwh.getCompressorIndex() == -1 ? 0 : hpwh.getCompressorIndex(); { // testDoesNotHaveEnteringWaterShutOff @@ -325,7 +325,7 @@ TEST(ExtraHeatTest, extraHeat) // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; const double ambientT_C = 20.; const double externalT_C = 20.; diff --git a/test/unit_tests/maxSetpointTest.cpp b/test/unit_tests/maxSetpointTest.cpp index b09a6fe2..11907a44 100644 --- a/test/unit_tests/maxSetpointTest.cpp +++ b/test/unit_tests/maxSetpointTest.cpp @@ -13,7 +13,7 @@ const double expectedRE_maxT_C = 100.; TEST(MaxSetpointTest, resistanceTank) { HPWH hpwh; - EXPECT_TRUE(hpwh.initResistanceTank()) << "Could not initialize resistance tank."; + EXPECT_EQ(hpwh.initResistanceTank(), 0) << "Could not initialize resistance tank."; double num; std::string why; @@ -37,7 +37,7 @@ TEST(MaxSetpointTest, scalableCompressor) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double num; std::string why; @@ -60,7 +60,7 @@ TEST(MaxSetpointTest, NyleC90A_SP) // get preset model HPWH hpwh; const std::string sModelName = "NyleC90A_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double num; std::string why; @@ -85,7 +85,7 @@ TEST(MaxSetpointTest, ColmacCxV_5_SP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxV_5_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double num; std::string why; @@ -110,7 +110,7 @@ TEST(MaxSetpointTest, QAHV_N136TAU_HPB_SP) // get preset model HPWH hpwh; const std::string sModelName = "QAHV_N136TAU_HPB_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double num; std::string why; @@ -142,7 +142,7 @@ TEST(MaxSetpointTest, AOSmithCAHP120) // get preset model HPWH hpwh; const std::string sModelName = "AOSmithCAHP120"; // Hybrid unit with a compressor with R134A - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double num; std::string why; @@ -166,7 +166,7 @@ TEST(MaxSetpointTest, StorageTank) // get preset model HPWH hpwh; const std::string sModelName = "StorageTank"; // Hybrid unit with a compressor with R134A - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; ; double num; @@ -190,7 +190,7 @@ TEST(MaxSetpointTest, Sanden80) // get preset model HPWH hpwh; const std::string sModelName = "Sanden80"; // Fixed setpoint model - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double num, num1; std::string why; @@ -242,7 +242,7 @@ TEST(UtilityTest, setTemperatures) // get preset model HPWH hpwh; const std::string sModelName = "Rheem2020Prem50"; // 12-node model - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; // test 1 { diff --git a/test/unit_tests/performanceMapTest.cpp b/test/unit_tests/performanceMapTest.cpp index 849386ac..4e329a38 100644 --- a/test/unit_tests/performanceMapTest.cpp +++ b/test/unit_tests/performanceMapTest.cpp @@ -58,7 +58,7 @@ TEST_F(PerformanceMapTest, ColmacCxA_15_SP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_15_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double capacity_kW, capacity_BTUperHr; @@ -113,7 +113,7 @@ TEST_F(PerformanceMapTest, ColmacCxA_30_SP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_30_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double capacity_kW, capacity_BTUperHr; @@ -168,7 +168,7 @@ TEST_F(PerformanceMapTest, ColmacCxV_5_MP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxV_5_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -197,7 +197,7 @@ TEST_F(PerformanceMapTest, ColmacCxA_10_MP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_10_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -229,7 +229,7 @@ TEST_F(PerformanceMapTest, ColmacCxA_15_MP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_15_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -261,7 +261,7 @@ TEST_F(PerformanceMapTest, ColmacCxA_20_MP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_20_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -293,7 +293,7 @@ TEST_F(PerformanceMapTest, ColmacCxA_25_MP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_25_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -325,7 +325,7 @@ TEST_F(PerformanceMapTest, ColmacCxA_30_MP) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_30_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -359,7 +359,7 @@ TEST_F(PerformanceMapTest, RheemHPHD60) // get preset model HPWH hpwh; const std::string sModelName = "RheemHPHD60"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -383,7 +383,7 @@ TEST_F(PerformanceMapTest, RheemHPHD135) // MODELS_RHEEM_HPHD135VNU_483_MP HPWH hpwh; const std::string sModelName = "RheemHPHD135"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -405,7 +405,7 @@ TEST_F(PerformanceMapTest, NyleC60A_MP) { HPWH hpwh; const std::string sModelName = "NyleC60A_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -425,7 +425,7 @@ TEST_F(PerformanceMapTest, NyleC90A_MP) { HPWH hpwh; const std::string sModelName = "NyleC90A_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -445,7 +445,7 @@ TEST_F(PerformanceMapTest, NyleC125A_MP) { HPWH hpwh; const std::string sModelName = "NyleC125A_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -465,7 +465,7 @@ TEST_F(PerformanceMapTest, NyleC185A_MP) { HPWH hpwh; const std::string sModelName = "NyleC185A_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -485,7 +485,7 @@ TEST_F(PerformanceMapTest, NyleC250A_MP) { HPWH hpwh; const std::string sModelName = "NyleC250A_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointMP checkPoint; @@ -505,7 +505,7 @@ TEST_F(PerformanceMapTest, QAHV_N136TAU_HPB_SP) { HPWH hpwh; const std::string sModelName = "QAHV_N136TAU_HPB_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointSP checkPoint; // tairF, toutF, tinF, outputW double outputBTUH; @@ -589,7 +589,7 @@ TEST_F(PerformanceMapTest, QAHV_N136TAU_HPB_SP_extrapolation) HPWH hpwh; const std::string sModelName = "QAHV_N136TAU_HPB_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointSP checkPoint; // tairF, toutF, tinF, outputW @@ -676,7 +676,7 @@ TEST_F(PerformanceMapTest, Sanden120) { HPWH hpwh; const std::string sModelName = "Sanden120"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; performancePointSP checkPoint; // tairF, toutF, tinF, outputW double outputBTUH; diff --git a/test/unit_tests/resistanceFncsTest.cpp b/test/unit_tests/resistanceFncsTest.cpp index 2cae6389..ae2c849c 100644 --- a/test/unit_tests/resistanceFncsTest.cpp +++ b/test/unit_tests/resistanceFncsTest.cpp @@ -14,7 +14,7 @@ TEST(ResistanceFunctionsTest, setResistanceCapacityErrorChecks) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_30_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; EXPECT_EQ(hpwh.setResistanceCapacity(100.), HPWH::HPWH_ABORT); // Need's to be scalable } @@ -23,7 +23,7 @@ TEST(ResistanceFunctionsTest, setResistanceCapacityErrorChecks) // get preset model HPWH hpwh; const std::string sModelName = "restankRealistic"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; EXPECT_EQ(hpwh.setResistanceCapacity(-100.), HPWH::HPWH_ABORT); EXPECT_EQ(hpwh.setResistanceCapacity(100., 3), HPWH::HPWH_ABORT); @@ -41,7 +41,7 @@ TEST(ResistanceFunctionsTest, getSetResistanceErrors) HPWH hpwh; double lowerElementPower_W = 1000; double lowerElementPower = lowerElementPower_W / 1000; - EXPECT_TRUE(hpwh.initResistanceTank(100., 0.95, 0., lowerElementPower_W)) + EXPECT_EQ(hpwh.initResistanceTank(100., 0.95, 0., lowerElementPower_W), 0) << "Could not initialize resistance tank."; double returnVal; @@ -64,12 +64,17 @@ TEST(ResistanceFunctionsTest, commercialTankInitErrors) HPWH hpwh; // init model - EXPECT_FALSE(hpwh.initResistanceTankGeneric(-800., 10., 100., 100.)); // negative volume - EXPECT_FALSE(hpwh.initResistanceTankGeneric(800., 10., -100., 100.)); // negative element - EXPECT_FALSE(hpwh.initResistanceTankGeneric(800., 10., 100., -100.)); // negative element - EXPECT_FALSE(hpwh.initResistanceTankGeneric(800., -10., 100., 100.)); // negative r value - EXPECT_FALSE(hpwh.initResistanceTankGeneric(800., 0., 100., 100.)); // 0 r value - EXPECT_FALSE(hpwh.initResistanceTankGeneric(800., 10., 0., 0.)); // Check needs one element + EXPECT_EQ(hpwh.initResistanceTankGeneric(-800., 10., 100., 100.), + HPWH::HPWH_ABORT); // negative volume + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., -100., 100.), + HPWH::HPWH_ABORT); // negative element + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 100., -100.), + HPWH::HPWH_ABORT); // negative element + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., -10., 100., 100.), + HPWH::HPWH_ABORT); // negative r value + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 0., 100., 100.), HPWH::HPWH_ABORT); // 0 r value + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 0., 0.), + HPWH::HPWH_ABORT); // Check needs one element } /* @@ -79,13 +84,13 @@ TEST(ResistanceFunctionsTest, getNumResistanceElements) { HPWH hpwh; - hpwh.initResistanceTankGeneric(800., 10., 0., 1000.); + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 0., 1000.), 0); EXPECT_EQ(hpwh.getNumResistanceElements(), 1); // Check 1 elements - hpwh.initResistanceTankGeneric(800., 10., 1000., 0.); + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 1000., 0.), 0); EXPECT_EQ(hpwh.getNumResistanceElements(), 1); // Check 1 elements - hpwh.initResistanceTankGeneric(800., 10., 1000., 1000.); + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 1000., 1000.), 0); EXPECT_EQ(hpwh.getNumResistanceElements(), 2); // Check 2 elements } @@ -96,17 +101,17 @@ TEST(ResistanceFunctionsTest, getResistancePositionInRE_tank) { HPWH hpwh; - hpwh.initResistanceTankGeneric(800., 10., 0., 1000.); + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 0., 1000.), 0); EXPECT_EQ(hpwh.getResistancePosition(0), 0); // Check lower element is there EXPECT_EQ(hpwh.getResistancePosition(1), HPWH::HPWH_ABORT); // Check no element EXPECT_EQ(hpwh.getResistancePosition(2), HPWH::HPWH_ABORT); // Check no element - hpwh.initResistanceTankGeneric(800., 10., 1000., 0.); + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 1000., 0.), 0); EXPECT_EQ(hpwh.getResistancePosition(0), 8); // Check upper element there EXPECT_EQ(hpwh.getResistancePosition(1), HPWH::HPWH_ABORT); // Check no elements EXPECT_EQ(hpwh.getResistancePosition(2), HPWH::HPWH_ABORT); // Check no elements - hpwh.initResistanceTankGeneric(800., 10., 1000., 1000.); + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 1000., 1000.), 0); EXPECT_EQ(hpwh.getResistancePosition(0), 8); // Check upper element there EXPECT_EQ(hpwh.getResistancePosition(1), 0); // Check lower element is there EXPECT_EQ(hpwh.getResistancePosition(2), HPWH::HPWH_ABORT); // Check 0 elements} @@ -121,7 +126,7 @@ TEST(ResistanceFunctionsTest, getResistancePositionInCompressorTank) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; EXPECT_EQ(hpwh.getResistancePosition(0), 9); // Check top elements EXPECT_EQ(hpwh.getResistancePosition(1), 0); // Check bottom elements @@ -139,7 +144,7 @@ TEST(ResistanceFunctionsTest, commercialTankErrorsWithBottomElement) // init model HPWH hpwh; - EXPECT_TRUE(hpwh.initResistanceTankGeneric(800., 10., 0., elementPower_kW * 1000.)) + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., 0., elementPower_kW * 1000.), 0) << "Could not initialize generic resistance tank."; // Check only lowest setting works @@ -179,7 +184,7 @@ TEST(ResistanceFunctionsTest, commercialTankErrorsWithTopElement) // init model HPWH hpwh; - EXPECT_TRUE(hpwh.initResistanceTankGeneric(800., 10., elementPower_kW * 1000., 0.)) + EXPECT_EQ(hpwh.initResistanceTankGeneric(800., 10., elementPower_kW * 1000., 0.), 0) << "Could not initialize resistance tank."; // Check only bottom setting works @@ -220,10 +225,11 @@ struct InsulationPoint // #define R_TO_RSI(rvalue) rvalue * 0.176110 #define TEST_INIT_RESISTANCE_TANK_GENERIC(point, elementPower_W) \ - EXPECT_TRUE(hpwh.initResistanceTankGeneric(point.volume_L, \ - FT2HFperBTU_TO_M2CperW(point.r_ft2hFperBTU), \ - elementPower_W, \ - elementPower_W)) \ + EXPECT_EQ(hpwh.initResistanceTankGeneric(point.volume_L, \ + FT2HFperBTU_TO_M2CperW(point.r_ft2hFperBTU), \ + elementPower_W, \ + elementPower_W), \ + 0) \ << "Could not initialize generic resistance tank."; /* diff --git a/test/unit_tests/scaleTest.cpp b/test/unit_tests/scaleTest.cpp index 4332192c..18a482db 100644 --- a/test/unit_tests/scaleTest.cpp +++ b/test/unit_tests/scaleTest.cpp @@ -75,7 +75,7 @@ TEST(ScaleTest, noScaleOutOfBounds) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double num = 0; EXPECT_EQ(hpwh.setScaleCapacityCOP(num, 1.), HPWH::HPWH_ABORT); @@ -96,7 +96,7 @@ TEST(ScaleTest, nonScalable) // get preset model HPWH hpwh; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; EXPECT_EQ(hpwh.setScaleCapacityCOP(1., 1.), HPWH::HPWH_ABORT); } @@ -110,7 +110,7 @@ TEST(ScaleTest, scalableScales) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; Performance point0, point1; double num, anotherNum; @@ -213,7 +213,7 @@ TEST(ScaleTest, scalableMP_scales) // get preset model HPWH hpwh; const std::string sModelName = "Scalable_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; Performance point0, point1; double num, anotherNum; @@ -316,7 +316,7 @@ TEST(ScaleTest, getCompressorSP_capacity) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_20_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; Performance point0; @@ -351,7 +351,7 @@ TEST(ScaleTest, getCompressorMP_capacity) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxA_20_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; Performance point0; @@ -384,7 +384,7 @@ TEST(ScaleTest, getCompressorMP_outputCapacity) // get preset model HPWH hpwh; const std::string sModelName = "Scalable_MP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double newCapacity_kW, num; double waterTempC = F_TO_C(44); @@ -424,7 +424,7 @@ TEST(ScaleTest, setCompressorSP_outputCapacity) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double newCapacity_kW, num; double waterTempC = F_TO_C(44); @@ -473,7 +473,7 @@ TEST(ScaleTest, chipsCaseWithIP_units) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; const double waterT_F = 50; const double airT_F = 50; @@ -498,7 +498,7 @@ TEST(ScaleTest, scaleRestank) // get preset model HPWH hpwh; const std::string sModelName = "restankRealistic"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; // Scale COP for restank fails. EXPECT_EQ(hpwh.setScaleCapacityCOP(2., 2.), HPWH::HPWH_ABORT); @@ -512,7 +512,7 @@ TEST(ScaleTest, resistanceScales) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double elementPower = 30.; // KW @@ -548,7 +548,7 @@ TEST(ScaleTest, storageTankErrors) // get preset model HPWH hpwh; const std::string sModelName = "StorageTank"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; EXPECT_EQ(hpwh.setResistanceCapacity(1000.), HPWH::HPWH_ABORT); EXPECT_EQ(hpwh.setScaleCapacityCOP(1., 1.), HPWH::HPWH_ABORT); diff --git a/test/unit_tests/sizingFractionsTest.cpp b/test/unit_tests/sizingFractionsTest.cpp index dd2a49c0..8085cdc1 100644 --- a/test/unit_tests/sizingFractionsTest.cpp +++ b/test/unit_tests/sizingFractionsTest.cpp @@ -17,7 +17,7 @@ TEST(SizingFractionsTest, TamScalable_SP_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; // Just a compressor with R134A - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; const double aquaFrac_answer = 4. / logicSize; @@ -35,7 +35,7 @@ TEST(SizingFractionsTest, Sanden80_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "Sanden80"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; const double aquaFrac_answer = 8. / logicSize; @@ -53,7 +53,7 @@ TEST(SizingFractionsTest, ColmacCxV_5_SP_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxV_5_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; const double aquaFrac_answer = 4. / logicSize; @@ -71,7 +71,7 @@ TEST(SizingFractionsTest, AOSmithHPTU50_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "AOSmithHPTU50"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; const double aquaFrac_answer = (1. + 2. + 3. + 4.) / 4. / logicSize; @@ -89,7 +89,7 @@ TEST(SizingFractionsTest, GE_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "GE"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; const double aquaFrac_answer = (1. + 2. + 3. + 4.) / 4. / logicSize; @@ -107,7 +107,7 @@ TEST(SizingFractionsTest, Stiebel220e_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "Stiebel220e"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; const double aquaFrac_answer = (5. + 6.) / 2. / logicSize; @@ -125,7 +125,7 @@ TEST(SizingFractionsTest, resTankRealistic_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "restankRealistic"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; EXPECT_EQ(hpwh.getSizingFractions(aquaFrac, useableFrac), HPWH::HPWH_ABORT); @@ -139,7 +139,7 @@ TEST(SizingFractionsTest, storageTank_SizingFract) // get preset model HPWH hpwh; const std::string sModelName = "StorageTank"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double aquaFrac, useableFrac; EXPECT_EQ(hpwh.getSizingFractions(aquaFrac, useableFrac), HPWH::HPWH_ABORT); @@ -153,7 +153,7 @@ TEST(SizingFractionsTest, getCompressorMinRuntime) // get preset model HPWH hpwh; const std::string sModelName = "TamScalable_SP"; // Just a compressor with R134A - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; double expectedRunTime_min = 10.; double expectedRunTime_sec = expectedRunTime_min * 60.; diff --git a/test/unit_tests/stateOfChargeFncsTest.cpp b/test/unit_tests/stateOfChargeFncsTest.cpp index 57db6c75..07deae1c 100644 --- a/test/unit_tests/stateOfChargeFncsTest.cpp +++ b/test/unit_tests/stateOfChargeFncsTest.cpp @@ -15,7 +15,7 @@ TEST(StateOfChargeFunctionsTest, getSoC) // get preset model HPWH hpwh; const std::string sModelName = "Sanden80"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; const double mainsT_C = F_TO_C(55.); const double minUsefulT_C = F_TO_C(110.); @@ -60,7 +60,7 @@ TEST(StateOfChargeFunctionsTest, chargeBelowSetpoint) // get preset model HPWH hpwh; const std::string sModelName = "ColmacCxV_5_SP"; - EXPECT_TRUE(hpwh.initPreset(sModelName)) << "Could not initialize model " << sModelName; + EXPECT_EQ(hpwh.initPreset(sModelName), 0) << "Could not initialize model " << sModelName; const double mainsT_C = F_TO_C(60.); double minUsefulT_C = F_TO_C(110.);