Skip to content

Commit

Permalink
Distribute extra power across existing condensity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Nov 16, 2023
1 parent f29bb13 commit 877d3e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
28 changes: 4 additions & 24 deletions src/HPWHHeatSources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -990,34 +990,15 @@ void HPWH::HeatSource::setupAsResistiveElement(int node,double Watts,int condens
}

void HPWH::HeatSource::setupExtraHeat(std::vector<double> &nodePowerExtra_W) {
// The elements of nodePowerExtra_W are assigned to the condensity nodes for
// this heat source. If condensity.size() is larger than nodePowerExtra_W.size,
// the additional elements of condensity are set to zero. If condensity.size() is smaller than nodePowerExtra_W.size,
// the additional elements of nodePowerExtra_W are omitted.
// Suggest specifying nodePowerExtra_W as the full condensity distribution (scaled by power) instead.
for(unsigned int i = 0; i < condensity.size(); ++i) {

//put into vector for normalization
condensity[i] = (i < nodePowerExtra_W.size()) ? nodePowerExtra_W[i] : 0.;
}
normalize(condensity);

if(hpwh->hpwhVerbosity >= VRB_emetic){
hpwh->msg("extra heat condensity: ");
for(unsigned int i = 0; i < condensity.size(); i++) {
hpwh->msg("C[%d]: %f",i,condensity[i]);
}
hpwh->msg("\n ");
}

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

// The total power in nodePowerExtra_W is applied, using the existing condensity.
double watts = 0.;
for(unsigned int i = 0; i < nodePowerExtra_W.size(); ++i) {
watts += nodePowerExtra_W[i];
}

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

perfMap.push_back({
50, // Temperature (T_F)
{watts,0.0,0.0}, // Input Power Coefficients (inputPower_coeffs)
Expand All @@ -1029,7 +1010,6 @@ void HPWH::HeatSource::setupExtraHeat(std::vector<double> &nodePowerExtra_W) {
{watts,0.0,0.0}, // Input Power Coefficients (inputPower_coeffs)
{1.0,0.0,0.0} // COP Coefficients (COP_coeffs)
});

}

void HPWH::HeatSource::addTurnOnLogic(std::shared_ptr<HeatingLogic> logic) {
Expand Down
2 changes: 1 addition & 1 deletion src/HPWHpresets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ int HPWH::HPWHinit_presets(MODELS presetNum) {
extra.addTurnOnLogic(HPWH::topThird_absolute(1));

//initial guess, will get reset based on the input heat vector
extra.setCondensity({1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
extra.setCondensity({1., 0., 0., 0.});

//set everything in its places
heatSources.resize(1);
Expand Down

0 comments on commit 877d3e6

Please sign in to comment.