Skip to content

Commit

Permalink
Partially merged.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Oct 19, 2023
1 parent 8113283 commit ca7ebcd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 69 deletions.
13 changes: 4 additions & 9 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,6 @@ HPWH & HPWH::operator=(const HPWH &hpwh) {
HPWH::~HPWH() {
}

HPWH::HeatSource &HPWH::addHeatSource()
{
return setOfSources.emplace_back(this);
}

string HPWH::getVersion() {
std::stringstream version;

Expand Down Expand Up @@ -645,25 +640,25 @@ int HPWH::runNSteps(int N,double *inletT_C,double *drawVolume_L,
}

bool first = true;
for (int i = 0; i < 10; ++i)
for (int k = 0; k < 10; ++k)
{
if (first)
first = false;
else
msg(",");

int j = nodeDensity * i;
int j = nodeDensity * k;
msg("%f", tankTemps_C[j]);
}

for (int i = 1; i < 7; ++i)
for (int k = 1; k < 7; ++k)
{
if (first)
first = false;
else
msg(",");

msg("%f", getNthSimTcouple(i,6));
msg("%f", getNthSimTcouple(k,6));
}

msg("\n");
Expand Down
7 changes: 6 additions & 1 deletion src/HPWH.in.hh
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,6 @@ private:
class HeatSource;

void setAllDefaults(); /**< sets all the defaults default */
HeatSource &addHeatSource();

void updateTankTemps(double draw,double inletT,double ambientT,double inletVol2_L,double inletT2_L);
void mixTankInversions();
Expand Down Expand Up @@ -1068,6 +1067,8 @@ public:
/**< adds heat to the hpwh - this is the function that interprets the
various configurations (internal/external, resistance/heat pump) to add heat */

void setCondensity(const std::vector<double> &condensity_in);

void setCondensity(double cnd1,double cnd2,double cnd3,double cnd4,
double cnd5,double cnd6,double cnd7,double cnd8,
double cnd9,double cnd10,double cnd11,double cnd12);
Expand Down Expand Up @@ -1301,6 +1302,10 @@ private:
}; // end of HeatSource class


int resample(std::vector<double> &Y,const std::vector<double> &Yp);
int resampleIntensive(std::vector<double> &Y,const std::vector<double> &Yp);
int resampleExtensive(std::vector<double> &Y,const std::vector<double> &Yp);

// a few extra functions for unit converesion
inline double dF_TO_dC(double temperature) { return (temperature*5.0/9.0); }
inline double F_TO_C(double temperature) { return ((temperature - 32.0)*5.0/9.0); }
Expand Down
66 changes: 7 additions & 59 deletions src/HPWHHeatSources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,64 +20,7 @@ HPWH::HeatSource::HeatSource(HPWH *parentInput)
{}

HPWH::HeatSource::HeatSource(const HeatSource &hSource) {
hpwh = hSource.hpwh;
isOn = hSource.isOn;
lockedOut = hSource.lockedOut;
doDefrost = hSource.doDefrost;

runtime_min = hSource.runtime_min;
energyInput_kWh = hSource.energyInput_kWh;
energyOutput_kWh = hSource.energyOutput_kWh;

isVIP = hSource.isVIP;

if(hSource.backupHeatSource != NULL || hSource.companionHeatSource != NULL || hSource.followedByHeatSource != NULL) {
hpwh->simHasFailed = true;
if(hpwh->hpwhVerbosity >= VRB_reluctant) {
hpwh->msg("HeatSources cannot be copied if they contain pointers to other HeatSources\n");
}
}

condensity = hSource.condensity;

shrinkage = hSource.shrinkage;

perfMap = hSource.perfMap;

perfGrid = hSource.perfGrid;
perfGridValues = hSource.perfGridValues;
perfRGI = hSource.perfRGI;
useBtwxtGrid = hSource.useBtwxtGrid;

defrostMap = hSource.defrostMap;
resDefrost = hSource.resDefrost;

//i think vector assignment works correctly here
turnOnLogicSet = hSource.turnOnLogicSet;
shutOffLogicSet = hSource.shutOffLogicSet;
standbyLogic = hSource.standbyLogic;

minT = hSource.minT;
maxT = hSource.maxT;
maxOut_at_LowT = hSource.maxOut_at_LowT;
hysteresis_dC = hSource.hysteresis_dC;
maxSetpoint_C = hSource.maxSetpoint_C;

depressesTemperature = hSource.depressesTemperature;
airflowFreedom = hSource.airflowFreedom;

configuration = hSource.configuration;
typeOfHeatSource = hSource.typeOfHeatSource;
isMultipass = hSource.isMultipass;
mpFlowRate_LPS = hSource.mpFlowRate_LPS;

externalInletHeight = hSource.externalInletHeight;
externalOutletHeight = hSource.externalOutletHeight;

lowestNode = hSource.lowestNode;

extrapolationMethod = hSource.extrapolationMethod;
secondaryHeatExchanger = hSource.secondaryHeatExchanger;
*this = hSource;
}

HPWH::HeatSource& HPWH::HeatSource::operator=(const HeatSource &hSource) {
Expand Down Expand Up @@ -150,10 +93,15 @@ HPWH::HeatSource& HPWH::HeatSource::operator=(const HeatSource &hSource) {
return *this;
}

void HPWH::HeatSource::setCondensity(const std::vector<double> &condensity_in) {
condensity.resize(CONDENSITY_SIZE);
resampleExtensive(condensity, condensity_in);
}

void HPWH::HeatSource::setCondensity(double cnd1,double cnd2,double cnd3,double cnd4,
double cnd5,double cnd6,double cnd7,double cnd8,
double cnd9,double cnd10,double cnd11,double cnd12) {
condensity ={cnd1, cnd2, cnd3, cnd4, cnd5, cnd6, cnd7, cnd8, cnd9, cnd10, cnd11, cnd12};
setCondensity({cnd1, cnd2, cnd3, cnd4, cnd5, cnd6, cnd7, cnd8, cnd9, cnd10, cnd11, cnd12});
}

int HPWH::HeatSource::findParent() const {
Expand Down

0 comments on commit ca7ebcd

Please sign in to comment.