Skip to content

Commit

Permalink
Correct setupExtraHeat.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Nov 15, 2023
1 parent 0894260 commit 395dda4
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/HPWHHeatSources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,8 @@ void HPWH::HeatSource::addHeat(double externalT_C,double minutesToRun) {
case CONFIG_SUBMERGED:
case CONFIG_WRAPPED:
{
static std::vector<double> heatDistribution(hpwh->getNumNodes());
//clear the heatDistribution vector, since it's static it is still holding the
//distribution from the last go around
heatDistribution.clear();
std::vector<double> heatDistribution;

//calcHeatDist takes care of the swooping for wrapped configurations
calcHeatDist(heatDistribution);

Expand Down Expand Up @@ -989,10 +987,12 @@ void HPWH::HeatSource::setupAsResistiveElement(int node,double Watts) {
}

void HPWH::HeatSource::setupExtraHeat(std::vector<double>* nodePowerExtra_W) {

std::vector<double> tempCondensity(getCondensitySize());
double watts = 0.0;
for(unsigned int i = 0; i < (*nodePowerExtra_W).size(); i++) {
// The size of nodePowerExtra_W is hard-coded as 3 in cse/dhwsolar.cpp.
// Apparently, this refers to a fixed condensity size of 12.
// Suggest specifying the full condensity (scaled by power) instead.
std::vector<double> tempCondensity(CONDENSITY_SIZE);
double watts = 0.;
for(unsigned int i = 0; (i < (*nodePowerExtra_W).size()) && (i < tempCondensity.size()); ++i) {
//get sum of vector
watts += (*nodePowerExtra_W)[i];

Expand All @@ -1011,9 +1011,7 @@ void HPWH::HeatSource::setupExtraHeat(std::vector<double>* nodePowerExtra_W) {
}

// set condensity based on normalized vector
setCondensity({tempCondensity[0],tempCondensity[1],tempCondensity[2],tempCondensity[3],
tempCondensity[4],tempCondensity[5],tempCondensity[6],tempCondensity[7],
tempCondensity[8],tempCondensity[9],tempCondensity[10],tempCondensity[11]});
setCondensity(tempCondensity);

perfMap.clear();
perfMap.reserve(2);
Expand Down

0 comments on commit 395dda4

Please sign in to comment.