Skip to content

Commit

Permalink
Merge pull request #95 from EcotopeResearch/consistent_functions
Browse files Browse the repository at this point in the history
Consistent function signatures
  • Loading branch information
pmskintner authored Jan 22, 2021
2 parents e43dfca + 9528e5e commit a86c600
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
39 changes: 29 additions & 10 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ int HPWH::WriteCSVRow(FILE* outFILE, const char* preamble, int nTCouples, int op
}


bool HPWH::isSetpointFixed() {
bool HPWH::isSetpointFixed() const{
return setpointFixed;
}

Expand All @@ -803,8 +803,19 @@ int HPWH::setSetpoint(double newSetpoint, UNITS units /*=UNITS_C*/) {
}
return 0;
}
double HPWH::getSetpoint() {
return setpoint_C;
double HPWH::getSetpoint(UNITS units /*=UNITS_C*/) const{
if (units == UNITS_C) {
return setpoint_C;
}
else if (units == UNITS_F) {
return F_TO_C(setpoint_C);
}
else {
if (hpwhVerbosity >= VRB_reluctant) {
msg("Incorrect unit specification for getSetpoint. \n");
}
return HPWH_ABORT;
}
}


Expand Down Expand Up @@ -880,7 +891,7 @@ int HPWH::setTankSize_adjustUA(double HPWH_size, UNITS units /*=UNITS_L*/) {
return value;
}

double HPWH::getTankSurfaceArea(UNITS units /*=UNITS_FT2*/) {
double HPWH::getTankSurfaceArea(UNITS units /*=UNITS_FT2*/) const {
// returns tank surface area, old defualt was in ft2
// Based off 88 insulated storage tanks currently available on the market from Sanden, AOSmith, HTP, Rheem, and Niles.
// Corresponds to the inner tank with volume tankVolume_L with the assumption that the aspect ratio is the same
Expand Down Expand Up @@ -914,7 +925,7 @@ double HPWH::getTankSurfaceArea(UNITS units /*=UNITS_FT2*/) {
return value;
}

double HPWH::getTankRadius(UNITS units /*=UNITS_FT*/) {
double HPWH::getTankRadius(UNITS units /*=UNITS_FT*/) const{
// returns tank radius, ft for use in calculation of heat loss in the bottom and top of the tank.
// Based off 88 insulated storage tanks currently available on the market from Sanden, AOSmith, HTP, Rheem, and Niles,
// assumes the aspect ratio for the outer measurements is the same is the actual tank.
Expand Down Expand Up @@ -1077,8 +1088,11 @@ int HPWH::setTimerLimitTOT(double limit_min) {
return 0;
}

double HPWH::getTimerLimitTOT_minute() const {
return timerLimitTOT;
}

int HPWH::getInletHeight(int whichInlet) {
int HPWH::getInletHeight(int whichInlet) const {
if (whichInlet == 1) {
return inletHeight;
}
Expand Down Expand Up @@ -1425,11 +1439,17 @@ int HPWH::isNthHeatSourceRunning(int N) const {


HPWH::HEATSOURCE_TYPE HPWH::getNthHeatSourceType(int N) const {
if (N >= numHeatSources || N < 0) {
if (hpwhVerbosity >= VRB_reluctant) {
msg("You have attempted to access the type of a heat source that does not exist. \n");
}
return HEATSOURCE_TYPE(HPWH_ABORT);
}
return setOfSources[N].typeOfHeatSource;
}


double HPWH::getTankSize(UNITS units) const {
double HPWH::getTankSize(UNITS units /*=UNITS_L*/) const {
if (units == UNITS_L) {
return tankVolume_L;
}
Expand All @@ -1446,7 +1466,6 @@ double HPWH::getTankSize(UNITS units) const {


double HPWH::getOutletTemp(UNITS units /*=UNITS_C*/) const {

if (units == UNITS_C) {
return outletTemp_C;
}
Expand Down Expand Up @@ -2099,7 +2118,7 @@ bool HPWH::HeatSource::toLockOrUnlock(double heatSourceAmbientT_C) {
return isLockedOut();
}

bool HPWH::shouldDRLockOut(HEATSOURCE_TYPE hs, DRMODES DR_signal) {
bool HPWH::shouldDRLockOut(HEATSOURCE_TYPE hs, DRMODES DR_signal) const {

if (hs == TYPE_compressor && (DR_signal & DR_LOC) != 0) {
return true;
Expand Down Expand Up @@ -2330,7 +2349,7 @@ void HPWH::HeatSource::normalize(std::vector<double> &distribution) {
}


double HPWH::HeatSource::getCondenserTemp() {
double HPWH::HeatSource::getCondenserTemp() const{
double condenserTemp_C = 0.0;
int tempNodesPerCondensityNode = hpwh->numNodes / CONDENSITY_SIZE;
int j = 0;
Expand Down
18 changes: 10 additions & 8 deletions src/HPWH.in.hh
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@ class HPWH {



bool isSetpointFixed(); /**< is the setpoint allowed to be changed */
bool isSetpointFixed() const; /**< is the setpoint allowed to be changed */
int setSetpoint(double newSetpoint, UNITS units = UNITS_C);/**<default units C*/
/**< a function to change the setpoint - useful for dynamically setting it
The return value is 0 for successful setting, HPWH_ABORT for units failure */
double getSetpoint();
double getSetpoint(UNITS units = UNITS_C) const;
/**< a function to check the setpoint - returns setpoint in celcius */

int resetTankToSetpoint();
Expand All @@ -384,10 +384,10 @@ class HPWH {
/**< This sets the tank size and adjusts the UA the HPWH currently has to have the same U value but a new A.
A is found via getTankSurfaceArea()*/

double getTankSurfaceArea(UNITS units = UNITS_FT2);
double getTankSurfaceArea(UNITS units = UNITS_FT2) const;
static double getTankSurfaceArea(double vol, UNITS volUnits = UNITS_L, UNITS surfAUnits = UNITS_FT2);
/**< Returns the tank surface area based off of real storage tanks*/
double getTankRadius(UNITS units = UNITS_FT);
double getTankRadius(UNITS units = UNITS_FT) const;
static double getTankRadius(double vol, UNITS volUnits = UNITS_L, UNITS radiusUnits = UNITS_FT);
/**< Returns the tank surface radius based off of real storage tanks*/

Expand Down Expand Up @@ -425,8 +425,10 @@ class HPWH {

int setTimerLimitTOT(double limit_min);
/**< Sets the timer limit in minutes for the DR_TOT call. Must be > 0 minutes and < 1440 minutes. */
double getTimerLimitTOT_minute() const;
/**< Returns the timer limit in minutes for the DR_TOT call. */

int getInletHeight(int whichInlet);
int getInletHeight(int whichInlet) const;
/**< returns the water inlet height node number */

int getNumNodes() const;
Expand Down Expand Up @@ -483,10 +485,10 @@ class HPWH {
/**< get the heat content of the tank, relative to zero celsius
* returns using kilojoules */

int getHPWHModel()const;
int getHPWHModel() const;
/**< get the model number of the HPWHsim model number of the hpwh */

bool shouldDRLockOut(HEATSOURCE_TYPE hs, DRMODES DR_signal);
bool shouldDRLockOut(HEATSOURCE_TYPE hs, DRMODES DR_signal) const;
/**< Checks the demand response signal against the different heat source types */

void resetTopOffTimer();
Expand Down Expand Up @@ -860,7 +862,7 @@ class HPWH::HeatSource {
void getCapacity(double externalT_C, double condenserTemp_C, double &input_BTUperHr, double &cap_BTUperHr, double &cop);
void calcHeatDist(std::vector<double> &heatDistribution);

double getCondenserTemp();
double getCondenserTemp() const;
/**< returns the temperature of the condensor - it's a weighted average of the
tank temperature, using the condensity as weights */

Expand Down

0 comments on commit a86c600

Please sign in to comment.