Skip to content

Commit

Permalink
Exclude extra heat from energy balance if off.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Nov 29, 2023
1 parent ffb1439 commit b8abc6e
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2640,19 +2640,21 @@ void HPWH::addExtraHeat(std::vector<double> &nodePowerExtra_W,double tankAmbient
for(int i = 0; i < getNumHeatSources(); i++){
if(heatSources[i].typeOfHeatSource == TYPE_extra) {

// Set up the extra heat source
heatSources[i].setupExtraHeat(nodePowerExtra_W);
if(heatSources[i].isOn) {
// Set up the extra heat source
heatSources[i].setupExtraHeat(nodePowerExtra_W);

// condentropy/shrinkage and lowestNode are now in calcDerivedHeatingValues()
calcDerivedHeatingValues();
// condentropy/shrinkage and lowestNode are now in calcDerivedHeatingValues()
calcDerivedHeatingValues();

// add heat
heatSources[i].addHeat(tankAmbientT_C,minutesPerStep);

// 0 out to ignore features
heatSources[i].perfMap.clear();
heatSources[i].energyInput_kWh = 0.0;
heatSources[i].energyOutput_kWh = 0.0;
// add heat
heatSources[i].addHeat(tankAmbientT_C,minutesPerStep);
} else {
// 0 out to ignore features
heatSources[i].perfMap.clear();
heatSources[i].energyInput_kWh = 0.0;
heatSources[i].energyOutput_kWh = 0.0;
}

break; // Only add extra heat to the first "extra" heat source found.
}
Expand Down Expand Up @@ -3096,17 +3098,17 @@ bool HPWH::isEnergyBalanced(
const double drawVol_L,const double prevHeatContent_kJ,const double fracEnergyTolerance /* = 0.001 */)
{
// Check energy balancing.
double qInElect_kJ = 0;
double qInExternal_kJ = 0;
for (int iHS = 0; iHS < getNumHeatSources(); iHS++) {
qInElect_kJ += getNthHeatSourceEnergyInput(iHS, UNITS_KJ);
qInExternal_kJ += getNthHeatSourceEnergyInput(iHS, UNITS_KJ);
}

double qOutWater_kJ = drawVol_L * (outletTemp_C - member_inletT_C) * DENSITYWATER_kgperL * CPWATER_kJperkgC; // assumes only one inlet
double qInHeatSourceEnviron_kJ = getEnergyRemovedFromEnvironment(UNITS_KJ);
double qOutTankEnviron_kJ = KWH_TO_KJ(standbyLosses_kWh);
double qOutTankContents_kJ = getTankHeatContent_kJ() - prevHeatContent_kJ;
double qBal_kJ =
+ qInElect_kJ // electrical energy delivered to heat sources
+ qInExternal_kJ // external energy delivered to heat sources
+ qInHeatSourceEnviron_kJ // heat extracted from environment by condenser
- qOutTankEnviron_kJ // heat released from tank to environment
- qOutWater_kJ // heat expelled to outlet by water flow
Expand Down

0 comments on commit b8abc6e

Please sign in to comment.