Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust internal gain subtotals for UFAD and Displacement Ventilation #10419

Merged
merged 7 commits into from
Mar 15, 2024
1 change: 0 additions & 1 deletion src/EnergyPlus/DataHeatBalance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,6 @@ namespace DataHeatBalance {
struct GenericComponentZoneIntGainStruct
{
// Members
std::string CompObjectType; // device object class name
Copy link
Member

Choose a reason for hiding this comment

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

Nice, shouldn't need to hang on to these type strings.

std::string CompObjectName; // device user unique name
IntGainType CompType = IntGainType::Invalid; // type of internal gain device identifier
Real64 spaceGainFrac = 1.0; // Fraction of gain value assigned to this Space (because gain rate might be for an entire zone)
Expand Down
14 changes: 8 additions & 6 deletions src/EnergyPlus/DisplacementVentMgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,6 @@ namespace RoomAir {
Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys;
Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;

using InternalHeatGains::SumInternalConvectionGainsByTypes;
using InternalHeatGains::SumReturnAirConvectionGainsByTypes;
using Psychrometrics::PsyCpAirFnW;
using Psychrometrics::PsyRhoAirFnPbTdbW;
using ScheduleManager::GetCurrentScheduleValue;
Expand Down Expand Up @@ -603,27 +601,31 @@ namespace RoomAir {
}
}

ConvGainsOccupiedSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
ConvGainsOccupiedSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the namespace fixing.


ConvGainsOccupiedSubzone += 0.5 * thisZoneHB.SysDepZoneLoadsLagged;

// Add heat to return air if zonal system (no return air) or cycling system (return air frequently very
// low or zero)
if (zone.NoHeatToReturnAir) {
RetAirGain = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
RetAirGain = InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
ConvGainsOccupiedSubzone += RetAirGain;
}

ConvGainsMixedSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
ConvGainsMixedSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
ConvGainsMixedSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) + state.dataHeatBalFanSys->SumConvPool(ZoneNum) +
0.5 * thisZoneHB.SysDepZoneLoadsLagged;
if (zone.NoHeatToReturnAir) {
RetAirGain = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
RetAirGain = InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
ConvGainsMixedSubzone += RetAirGain;
}

ConvGains = ConvGainsOccupiedSubzone + ConvGainsMixedSubzone;

// Make sure all types of internal gains have been gathered
assert((int)(size(IntGainTypesOccupied) + size(IntGainTypesMixedSubzone) + size(ExcludedIntGainTypes)) ==
(int)DataHeatBalance::IntGainType::Num);
Copy link
Member

Choose a reason for hiding this comment

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

OK, this should be fine.


//=================== Entering air system temperature and flow====================
SumSysMCp = 0.0;
SumSysMCpT = 0.0;
Expand Down
29 changes: 27 additions & 2 deletions src/EnergyPlus/DisplacementVentMgr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace RoomAir {

void CalcDispVent3Node(EnergyPlusData &state, int ZoneNum); // Which Zonenum

static constexpr std::array<DataHeatBalance::IntGainType, 31> IntGainTypesOccupied = {
static constexpr std::array<DataHeatBalance::IntGainType, 51> IntGainTypesOccupied = {
DataHeatBalance::IntGainType::People,
DataHeatBalance::IntGainType::WaterHeaterMixed,
DataHeatBalance::IntGainType::WaterHeaterStratified,
Expand Down Expand Up @@ -109,11 +109,36 @@ namespace RoomAir {
DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe,
DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver,
DataHeatBalance::IntGainType::RefrigerationSecondaryPipe,
DataHeatBalance::IntGainType::RefrigerationWalkIn};
DataHeatBalance::IntGainType::RefrigerationWalkIn,
DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler,
DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT,
DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT,
DataHeatBalance::IntGainType::Pump_VarSpeed,
DataHeatBalance::IntGainType::Pump_ConSpeed,
DataHeatBalance::IntGainType::Pump_Cond,
DataHeatBalance::IntGainType::PumpBank_VarSpeed,
DataHeatBalance::IntGainType::PumpBank_ConSpeed,
DataHeatBalance::IntGainType::PlantComponentUserDefined,
DataHeatBalance::IntGainType::CoilUserDefined,
DataHeatBalance::IntGainType::ZoneHVACForcedAirUserDefined,
DataHeatBalance::IntGainType::AirTerminalUserDefined,
DataHeatBalance::IntGainType::PackagedTESCoilTank,
DataHeatBalance::IntGainType::SecCoolingDXCoilSingleSpeed,
DataHeatBalance::IntGainType::SecHeatingDXCoilSingleSpeed,
DataHeatBalance::IntGainType::SecCoolingDXCoilTwoSpeed,
DataHeatBalance::IntGainType::SecCoolingDXCoilMultiSpeed,
DataHeatBalance::IntGainType::SecHeatingDXCoilMultiSpeed,
DataHeatBalance::IntGainType::ElectricLoadCenterConverter,
DataHeatBalance::IntGainType::FanSystemModel};
Comment on lines +113 to +132
Copy link
Contributor Author

@mjwitte mjwitte Mar 6, 2024

Choose a reason for hiding this comment

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

Hmmm, seems like these end use types should be included in the occupied zone convective gains rather than be ignored? But maybe I don't understand the intent here.
@EnergyArchmage ?

Copy link
Member

Choose a reason for hiding this comment

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

?? I'll accept it as is if everything is running fine, but open to comments/follow-up changes.


static constexpr std::array<DataHeatBalance::IntGainType, 2> IntGainTypesMixedSubzone = {DataHeatBalance::IntGainType::DaylightingDeviceTubular,
DataHeatBalance::IntGainType::Lights};

// Explicitly list internal gains not applicable for Displacement Vent
static constexpr std::array<DataHeatBalance::IntGainType, 2> ExcludedIntGainTypes = {
DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide,
DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam};

} // namespace RoomAir

struct DisplacementVentMgrData : BaseGlobalStruct
Expand Down
11 changes: 4 additions & 7 deletions src/EnergyPlus/HeatBalanceInternalHeatGains.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ void SetupSpaceInternalGain(EnergyPlusData &state,

auto &thisIntGain = state.dataHeatBal->spaceIntGainDevices(spaceNum);
for (int IntGainsNum = 1; IntGainsNum <= thisIntGain.numberOfDevices; ++IntGainsNum) {
if ((thisIntGain.device(IntGainsNum).CompObjectType == DataHeatBalance::IntGainTypeNamesUC[static_cast<int>(IntGainCompType)]) &&
(thisIntGain.device(IntGainsNum).CompType == IntGainCompType)) {
if (thisIntGain.device(IntGainsNum).CompObjectName == UpperCaseObjectName) {
FoundDuplicate = true;
break;
}
if ((thisIntGain.device(IntGainsNum).CompType == IntGainCompType) &&
Copy link
Member

Choose a reason for hiding this comment

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

Yes!

(thisIntGain.device(IntGainsNum).CompObjectName == UpperCaseObjectName)) {
FoundDuplicate = true;
break;
}
}

Expand All @@ -154,7 +152,6 @@ void SetupSpaceInternalGain(EnergyPlusData &state,
}
++thisIntGain.numberOfDevices;

thisIntGain.device(thisIntGain.numberOfDevices).CompObjectType = DataHeatBalance::IntGainTypeNamesUC[static_cast<int>(IntGainCompType)];
thisIntGain.device(thisIntGain.numberOfDevices).CompObjectName = UpperCaseObjectName;
thisIntGain.device(thisIntGain.numberOfDevices).CompType = IntGainCompType;
thisIntGain.device(thisIntGain.numberOfDevices).spaceGainFrac = spaceGainFraction;
Expand Down
16 changes: 12 additions & 4 deletions src/EnergyPlus/InternalHeatGains.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8836,16 +8836,14 @@ namespace InternalHeatGains {
Real64 SumAllInternalConvectionGainsExceptPeople(EnergyPlusData &state, int const ZoneNum)
{
// Return value
Real64 SumConvGainRateExceptPeople(0.0);

std::string str_people = "PEOPLE";
Real64 SumConvGainRateExceptPeople = 0.0;

for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
continue;
}
for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompObjectType != str_people) {
if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType != DataHeatBalance::IntGainType::People) {
SumConvGainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ConvectGainRate;
}
}
Expand Down Expand Up @@ -9370,6 +9368,16 @@ namespace InternalHeatGains {
DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery,
DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple,
DataHeatBalance::IntGainType::ElectricLoadCenterConverter};
// Explicitly list internal gains not gathered here
static constexpr std::array<DataHeatBalance::IntGainType, 3> ExcludedIntGainTypes = {
DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide,
DataHeatBalance::IntGainType::DaylightingDeviceTubular,
DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam};

// Make sure all types of internal gains have been gathered
assert((int)(size(IntGainTypesPeople) + size(IntGainTypesLight) + size(IntGainTypesEquip) + size(IntGainTypesRefrig) +
size(IntGainTypesWaterUse) + size(IntGainTypesHvacLoss) + size(IntGainTypesPowerGen) + size(ExcludedIntGainTypes)) ==
(int)DataHeatBalance::IntGainType::Num);

if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) {
int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep;
Expand Down
44 changes: 36 additions & 8 deletions src/EnergyPlus/UFADManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ namespace RoomAir {
} // END FLOOR
}

static constexpr std::array<DataHeatBalance::IntGainType, 31> IntGainTypesOccupied = {
static constexpr std::array<DataHeatBalance::IntGainType, 51> IntGainTypesOccupied = {
DataHeatBalance::IntGainType::People,
DataHeatBalance::IntGainType::WaterHeaterMixed,
DataHeatBalance::IntGainType::WaterHeaterStratified,
Expand Down Expand Up @@ -705,11 +705,37 @@ namespace RoomAir {
DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe,
DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver,
DataHeatBalance::IntGainType::RefrigerationSecondaryPipe,
DataHeatBalance::IntGainType::RefrigerationWalkIn};
DataHeatBalance::IntGainType::RefrigerationWalkIn,
DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler,
DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT,
DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT,
DataHeatBalance::IntGainType::Pump_VarSpeed,
DataHeatBalance::IntGainType::Pump_ConSpeed,
DataHeatBalance::IntGainType::Pump_Cond,
DataHeatBalance::IntGainType::PumpBank_VarSpeed,
DataHeatBalance::IntGainType::PumpBank_ConSpeed,
DataHeatBalance::IntGainType::PlantComponentUserDefined,
DataHeatBalance::IntGainType::CoilUserDefined,
DataHeatBalance::IntGainType::ZoneHVACForcedAirUserDefined,
DataHeatBalance::IntGainType::AirTerminalUserDefined,
DataHeatBalance::IntGainType::PackagedTESCoilTank,
DataHeatBalance::IntGainType::SecCoolingDXCoilSingleSpeed,
DataHeatBalance::IntGainType::SecHeatingDXCoilSingleSpeed,
DataHeatBalance::IntGainType::SecCoolingDXCoilTwoSpeed,
DataHeatBalance::IntGainType::SecCoolingDXCoilMultiSpeed,
DataHeatBalance::IntGainType::SecHeatingDXCoilMultiSpeed,
DataHeatBalance::IntGainType::ElectricLoadCenterConverter,
DataHeatBalance::IntGainType::FanSystemModel};

static constexpr std::array<DataHeatBalance::IntGainType, 2> IntGainTypesUpSubzone = {DataHeatBalance::IntGainType::DaylightingDeviceTubular,
DataHeatBalance::IntGainType::Lights};

// Explicitly list internal gains not applicable for UFAD
// Explicitly list internal gains not applicable for Displacement Vent
static constexpr std::array<DataHeatBalance::IntGainType, 2> ExcludedIntGainTypes = {
DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide,
DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam};

void CalcUFADInt(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone
{

Expand All @@ -734,8 +760,6 @@ namespace RoomAir {
using Psychrometrics::PsyRhoAirFnPbTdbW;
Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys;
Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
using InternalHeatGains::SumInternalConvectionGainsByTypes;
using InternalHeatGains::SumReturnAirConvectionGainsByTypes;

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:

Expand Down Expand Up @@ -782,25 +806,29 @@ namespace RoomAir {
Real64 PowerPerPlume = zoneU.PowerPerPlume;
// gains from occupants, task lighting, elec equip, gas equip, other equip, hot water equip, steam equip,
// baseboards (nonthermostatic), water heater skin loss
Real64 ConvGainsOccSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
Real64 ConvGainsOccSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);

// Add heat to return air if zonal system (no return air) or cycling system (return air frequently very
// low or zero)
if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) {
ConvGainsOccSubzone += SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
ConvGainsOccSubzone += InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
}

// Add convection from pool cover to occupied region
ConvGainsOccSubzone += state.dataHeatBalFanSys->SumConvPool(ZoneNum);

// gains from lights (ceiling), tubular daylighting devices, high temp radiant heaters

Real64 ConvGainsUpSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone);
Real64 ConvGainsUpSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone);
ConvGainsUpSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum);
if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) {
ConvGainsUpSubzone += SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone);
ConvGainsUpSubzone += InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone);
}

// Make sure all types of internal gains have been gathered
assert((int)(size(IntGainTypesOccupied) + size(IntGainTypesUpSubzone) + size(ExcludedIntGainTypes)) ==
(int)DataHeatBalance::IntGainType::Num);

Real64 ConvGains = ConvGainsOccSubzone + ConvGainsUpSubzone + thisZoneHB.SysDepZoneLoadsLagged;
Real64 ZoneEquipConfigNum = zoneU.ZoneEquipPtr;
if (ZoneEquipConfigNum > 0) {
Expand Down
Loading