Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/EnergyPlus/HeatBalanceInternalHeatGains.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ void SetupSpaceInternalGain(EnergyPlusData &state,

thisIntGain.device(thisIntGain.numberOfDevices).CompObjectName = UpperCaseObjectName;
thisIntGain.device(thisIntGain.numberOfDevices).CompType = IntGainCompType;

// Tank losses should be distributed across multiplied zones/spaces - adjust the space gain fraction to account for this
if (std::find(AdjustTankLossMultipliers.begin(), AdjustTankLossMultipliers.end(), IntGainCompType) != AdjustTankLossMultipliers.end()) {
const int zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
const int multiplier = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier;
if (multiplier > 1) {
spaceGainFraction /= multiplier;
}
}
thisIntGain.device(thisIntGain.numberOfDevices).spaceGainFrac = spaceGainFraction;

// note pointer assignments in code below!
Expand Down
7 changes: 7 additions & 0 deletions src/EnergyPlus/HeatBalanceInternalHeatGains.hh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ void SetupSpaceInternalGain(EnergyPlusData &state,
int RetNodeNum = 0 // for return air heat gains
);

// Tank losses should be distributed across multiplied zones/spaces - these are the internal gains that need adjust for this
static constexpr std::array<DataHeatBalance::IntGainType, 4> AdjustTankLossMultipliers = {
DataHeatBalance::IntGainType::WaterHeaterMixed,
DataHeatBalance::IntGainType::WaterHeaterStratified,
DataHeatBalance::IntGainType::ThermalStorageChilledWaterMixed,
DataHeatBalance::IntGainType::ThermalStorageChilledWaterStratified};
Comment on lines +87 to +91
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm following this correctly, any gain that comes from HVAC, electrical, refrigeration, etc. (anything other than the zone gains like lights, people, etc) should be included in this list. @shorowit ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it this way so we could easily add/remove other gains as needed, but beyond water heaters I wasn't sure what to add.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is because the tanks have an ambient zone specified, right?

Doing a quick search for "Ambient Temperature Zone Name" in the IDD shows the following components:

Chiller:Electric:ASHRAE205
WaterHeater:Mixed
WaterHeater:Stratified
ThermalStorage:ChilledWater:Mixed
ThermalStorage:ChilledWater:Stratified
ThermalStorage:HotWater:Stratified
Pipe:Indoor

Searching "Ambient Zone Name" shows these:

ZoneHVAC:ForcedAir:UserDefined
AirTerminal:SingleDuct:UserDefined
Coil:UserDefined
PlantComponent:UserDefined
Duct:Loss:Conduction

Do these get handled here too?

Also, we can put a 📌 in this, but we should probably unify these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to test these out and see if any should be added to the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #11365 to address other components with ambient temperature zones

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mitchute , we'd like to prevent this PR from expanding in complexity more than the Issue it was created to resolve, so there's a new issue documenting your concerns so we don't lose track of them. In the meantime, this particular set of changes is ready to finalize.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanaya-mankad that works. Thanks.


struct HeatBalInternalHeatGainsData : BaseGlobalStruct
{

Expand Down
37 changes: 37 additions & 0 deletions tst/EnergyPlus/unit/WaterThermalTanks.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6721,6 +6721,43 @@ TEST_F(EnergyPlusFixture, MixedTank_PVT_Per_VolumeSizing_PerSolarCollectorArea)
EXPECT_DOUBLE_EQ(0.0, Tank.AmbientZoneGain); // Didn't define on/off cycle losses
}

TEST_F(EnergyPlusFixture, WaterThermalTankData_AdjustTankLossMultipliers)
{
constexpr int ZONES = 1;
constexpr int SPACES = 5;
constexpr int FLOOR_AREA = 1000;
constexpr int MULTIPLIER = 10;

state->dataHeatBal->Zone.allocate(ZONES);
state->dataHeatBal->Zone(ZONES).numSpaces = SPACES;
state->dataHeatBal->Zone(ZONES).FloorArea = FLOOR_AREA;
state->dataHeatBal->Zone(ZONES).ListMultiplier = MULTIPLIER;
state->dataHeatBal->Zone(ZONES).Multiplier = MULTIPLIER;
state->dataHeatBal->Zone(ZONES).spaceIndexes.allocate(SPACES);

state->dataHeatBal->space.allocate(SPACES);
state->dataHeatBal->spaceIntGainDevices.allocate(SPACES);

for (int spaceNum = 1; spaceNum <= SPACES; spaceNum++) {
state->dataHeatBal->Zone(ZONES).spaceIndexes(spaceNum) = spaceNum;
state->dataHeatBal->space(spaceNum).FloorArea = static_cast<Real64>(FLOOR_AREA) / SPACES;
state->dataHeatBal->space(spaceNum).zoneNum = ZONES;
}

WaterThermalTanks::WaterThermalTankData tank;
tank.Name = "Water Heater";
tank.WaterThermalTankType = DataPlant::PlantEquipmentType::WtrHeaterMixed;
tank.AmbientTempZone = ZONES;
tank.setupZoneInternalGains(*state);

Real64 spaceGainFracTotal(0);
for (int spaceNum = 1; spaceNum <= SPACES; spaceNum++) {
spaceGainFracTotal += state->dataHeatBal->spaceIntGainDevices(spaceNum).device(1).spaceGainFrac * state->dataHeatBal->Zone(ZONES).Multiplier *
state->dataHeatBal->Zone(ZONES).ListMultiplier;
}
EXPECT_NEAR(spaceGainFracTotal, 1, 0.001);
}

TEST_F(EnergyPlusFixture, thermalStorageTankInputReading_Autocalculate)
{
// Test for #11282
Expand Down
Loading