Skip to content

Commit

Permalink
Good sequence to add heatSources.
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 71a7715 commit 8113283
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 290 deletions.
69 changes: 6 additions & 63 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,6 @@ HPWH::HPWH(): tankTemps_C(NULL),nextTankTemps_C(NULL),messageCallback(NULL),mess
setAllDefaults();
};


void HPWH::addHeatSources(const std::size_t numHeatSources)
{
setOfSources.resize(numHeatSources);
for (std::size_t i = 0; i< numHeatSources; ++i)
{
setOfSources[i].hpwh = this;
}
}

void HPWH::setAllDefaults() {
tankTemps_C.clear();
nextTankTemps_C.clear();
Expand All @@ -206,59 +196,7 @@ void HPWH::setAllDefaults() {
}

HPWH::HPWH(const HPWH &hpwh) {
simHasFailed = hpwh.simHasFailed;

hpwhVerbosity = hpwh.hpwhVerbosity;

//these should actually be the same pointers
messageCallback = hpwh.messageCallback;
messageCallbackContextPtr = hpwh.messageCallbackContextPtr;

isHeating = hpwh.isHeating;

setOfSources = hpwh.setOfSources;
for(int i = 0; i < getNumHeatSources(); i++) {
setOfSources[i].hpwh = this;
}

tankVolume_L = hpwh.tankVolume_L;
tankUA_kJperHrC = hpwh.tankUA_kJperHrC;
fittingsUA_kJperHrC = hpwh.fittingsUA_kJperHrC;

setpoint_C = hpwh.setpoint_C;
nodeDensity = hpwh.nodeDensity;
tankTemps_C = hpwh.tankTemps_C;
nextTankTemps_C = hpwh.nextTankTemps_C;

inletHeight = hpwh.inletHeight;
inlet2Height = hpwh.inlet2Height;

outletTemp_C = hpwh.outletTemp_C;
condenserInlet_C = hpwh.condenserInlet_C;
condenserOutlet_C = hpwh.condenserOutlet_C;
externalVolumeHeated_L = hpwh.externalVolumeHeated_L;
energyRemovedFromEnvironment_kWh = hpwh.energyRemovedFromEnvironment_kWh;
standbyLosses_kWh = hpwh.standbyLosses_kWh;

tankMixesOnDraw = hpwh.tankMixesOnDraw;
mixBelowFractionOnDraw = hpwh.mixBelowFractionOnDraw;
doTempDepression = hpwh.doTempDepression;

doInversionMixing = hpwh.doInversionMixing;
doConduction = hpwh.doConduction;

locationTemperature_C = hpwh.locationTemperature_C;

prevDRstatus = hpwh.prevDRstatus;
timerLimitTOT = hpwh.timerLimitTOT;

usesSoCLogic = hpwh.usesSoCLogic;

nodeVolume_L = hpwh.nodeVolume_L;
nodeHeight_m = hpwh.nodeHeight_m;
fracAreaTop = hpwh.fracAreaTop;
fracAreaSide = hpwh.fracAreaSide;

*this = hpwh;
}

HPWH & HPWH::operator=(const HPWH &hpwh) {
Expand Down Expand Up @@ -332,6 +270,11 @@ 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
2 changes: 1 addition & 1 deletion src/HPWH.in.hh
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ private:
class HeatSource;

void setAllDefaults(); /**< sets all the defaults default */
void addHeatSources(const std::size_t numHeatSources);
HeatSource &addHeatSource();

void updateTankTemps(double draw,double inletT,double ambientT,double inletVol2_L,double inletT2_L);
void mixTankInversions();
Expand Down
Loading

0 comments on commit 8113283

Please sign in to comment.