Skip to content

Commit

Permalink
Fix HVAC Sizing Summary Min OA flow for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwitte committed Sep 12, 2024
1 parent 2830ccc commit f81a9f9
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 143 deletions.
70 changes: 41 additions & 29 deletions src/EnergyPlus/DataSizing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,13 @@ Real64 ZoneAirDistributionData::calculateEz(EnergyPlusData &state, int const Zon
}

Real64 calcDesignSpecificationOutdoorAir(EnergyPlusData &state,
int const DSOAPtr, // Pointer to DesignSpecification:OutdoorAir object
int const ActualZoneNum, // Zone index
bool const UseOccSchFlag, // Zone occupancy schedule will be used instead of using total zone occupancy
bool const UseMinOASchFlag, // Use min OA schedule in DesignSpecification:OutdoorAir object
bool const PerPersonNotSet, // when calculation should not include occupants (e.g., dual duct)
bool const MaxOAVolFlowFlag // TRUE when calculation uses occupancy schedule (e.g., dual duct)
)
int const DSOAPtr, // Pointer to DesignSpecification:OutdoorAir object
int const ActualZoneNum, // Zone index
bool const UseOccSchFlag, // Zone occupancy schedule will be used instead of using total zone occupancy
bool const UseMinOASchFlag, // Use min OA schedule in DesignSpecification:OutdoorAir object
bool const PerPersonNotSet, // when calculation should not include occupants (e.g., dual duct)
bool const MaxOAVolFlowFlag, // TRUE when calculation uses occupancy schedule (e.g., dual duct)
int const spaceNum)
{
Real64 totOAFlowRate = 0.0;
if (DSOAPtr == 0) return totOAFlowRate;
Expand All @@ -637,26 +637,26 @@ Real64 calcDesignSpecificationOutdoorAir(EnergyPlusData &state,

if (thisDSOA.numDSOA == 0) {
// This is a simple DesignSpecification:OutdoorAir
return thisDSOA.calcOAFlowRate(state, ActualZoneNum, UseOccSchFlag, UseMinOASchFlag, PerPersonNotSet, MaxOAVolFlowFlag);
return thisDSOA.calcOAFlowRate(state, ActualZoneNum, UseOccSchFlag, UseMinOASchFlag, PerPersonNotSet, MaxOAVolFlowFlag, spaceNum);
} else {
// This is a DesignSpecification:OutdoorAir:SpaceList
for (int dsoaCount = 1; dsoaCount <= thisDSOA.numDSOA; ++dsoaCount) {
totOAFlowRate += state.dataSize->OARequirements(thisDSOA.dsoaIndexes(dsoaCount))
.calcOAFlowRate(state,
ActualZoneNum,
UseOccSchFlag,
UseMinOASchFlag,
PerPersonNotSet,
MaxOAVolFlowFlag,
thisDSOA.dsoaSpaceIndexes(dsoaCount));
if ((spaceNum == 0) || ((spaceNum > 0) && (spaceNum == thisDSOA.dsoaSpaceIndexes(dsoaCount)))) {
totOAFlowRate += state.dataSize->OARequirements(thisDSOA.dsoaIndexes(dsoaCount))
.calcOAFlowRate(state,
ActualZoneNum,
UseOccSchFlag,
UseMinOASchFlag,
PerPersonNotSet,
MaxOAVolFlowFlag,
thisDSOA.dsoaSpaceIndexes(dsoaCount));
}
}
return totOAFlowRate;
}
}

Real64 OARequirementsData::desFlowPerZoneArea(EnergyPlusData &state,
int const actualZoneNum // Zone index
)
Real64 OARequirementsData::desFlowPerZoneArea(EnergyPlusData &state, int const zoneNum, int const spaceNum)
{
Real64 desFlowPA = 0.0;
if (this->numDSOA == 0) {
Expand All @@ -668,24 +668,29 @@ Real64 OARequirementsData::desFlowPerZoneArea(EnergyPlusData &state,
} else {
// This is a DesignSpecification:OutdoorAir:SpaceList
Real64 sumAreaOA = 0.0;
Real64 sumArea = 0.0;
for (int dsoaCount = 1; dsoaCount <= this->numDSOA; ++dsoaCount) {
auto const &thisDSOA = state.dataSize->OARequirements(this->dsoaIndexes(dsoaCount));
int const dsoaSpaceNum = this->dsoaSpaceIndexes(dsoaCount);
if (thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerPerson && thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerZone &&
thisDSOA.OAFlowMethod != OAFlowCalcMethod::ACH) {
Real64 spaceArea = state.dataHeatBal->space(this->dsoaSpaceIndexes(dsoaCount)).FloorArea;
sumAreaOA += thisDSOA.OAFlowPerArea * spaceArea;
if ((spaceNum == 0) || (spaceNum == dsoaSpaceNum)) {
Real64 spaceArea = state.dataHeatBal->space(this->dsoaSpaceIndexes(dsoaCount)).FloorArea;
sumArea + -spaceArea;
sumAreaOA += thisDSOA.OAFlowPerArea * spaceArea;
}
}
}
if (state.dataHeatBal->Zone(actualZoneNum).FloorArea) {
desFlowPA = sumAreaOA / state.dataHeatBal->Zone(actualZoneNum).FloorArea;
if ((spaceNum == 0) && (state.dataHeatBal->Zone(zoneNum).FloorArea)) {
desFlowPA = sumAreaOA / state.dataHeatBal->Zone(zoneNum).FloorArea;
} else if (sumArea > 0.0) {
desFlowPA = sumAreaOA / sumArea;
}
}
return desFlowPA;
}

Real64 OARequirementsData::desFlowPerZonePerson(EnergyPlusData &state,
int const actualZoneNum // Zone index
)
Real64 OARequirementsData::desFlowPerZonePerson(EnergyPlusData &state, int const actualZoneNum, int const spaceNum)
{
Real64 desFlowPP = 0.0;
if (this->numDSOA == 0) {
Expand All @@ -697,16 +702,23 @@ Real64 OARequirementsData::desFlowPerZonePerson(EnergyPlusData &state,
} else {
// This is a DesignSpecification:OutdoorAir:SpaceList
Real64 sumPeopleOA = 0.0;
Real64 sumPeople = 0.0;
for (int dsoaCount = 1; dsoaCount <= this->numDSOA; ++dsoaCount) {
auto const &thisDSOA = state.dataSize->OARequirements(this->dsoaIndexes(dsoaCount));
int const dsoaSpaceNum = this->dsoaSpaceIndexes(dsoaCount);
if (thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerArea && thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerZone &&
thisDSOA.OAFlowMethod != OAFlowCalcMethod::ACH) {
Real64 spacePeople = state.dataHeatBal->space(this->dsoaSpaceIndexes(dsoaCount)).TotOccupants;
sumPeopleOA += thisDSOA.OAFlowPerPerson * spacePeople;
if ((spaceNum == 0) || (spaceNum == dsoaSpaceNum)) {
Real64 spacePeople = state.dataHeatBal->space(dsoaSpaceNum).TotOccupants;
sumPeople += spacePeople;
sumPeopleOA += thisDSOA.OAFlowPerPerson * spacePeople;
}
}
}
if (state.dataHeatBal->Zone(actualZoneNum).TotOccupants > 0.0) {
if ((spaceNum == 0) && (state.dataHeatBal->Zone(actualZoneNum).TotOccupants > 0.0)) {
desFlowPP = sumPeopleOA / state.dataHeatBal->Zone(actualZoneNum).TotOccupants;
} else if (sumPeople > 0.0) {
desFlowPP = sumPeopleOA / sumPeople;
}
}
return desFlowPP;
Expand Down
14 changes: 5 additions & 9 deletions src/EnergyPlus/DataSizing.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1130,13 +1130,9 @@ namespace DataSizing {
int CO2GainErrorIndex = 0; // Index for recurring error message when CO2 generation from people is zero for SOAM_ProportionalControlSchOcc
bool myEnvrnFlag = true;

Real64 desFlowPerZoneArea(EnergyPlusData &state,
int const actualZoneNum // Zone index
);
Real64 desFlowPerZoneArea(EnergyPlusData &state, int const zoneNum, int const spaceNum = 0);

Real64 desFlowPerZonePerson(EnergyPlusData &state,
int const actualZoneNum // Zone index
);
Real64 desFlowPerZonePerson(EnergyPlusData &state, int const actualZoneNum, int const spaceNum = 0);

Real64 calcOAFlowRate(EnergyPlusData &state,
int ActualZoneNum, // Zone index
Expand Down Expand Up @@ -1188,9 +1184,9 @@ namespace DataSizing {
int const ActualZoneNum, // Zone index
bool const UseOccSchFlag, // Zone occupancy schedule will be used instead of using total zone occupancy
bool const UseMinOASchFlag, // Use min OA schedule in DesignSpecification:OutdoorAir object
bool const PerPersonNotSet = false, // when calculation should not include occupants (e.g., dual duct)
bool const MaxOAVolFlowFlag = false // TRUE when calculation uses occupancy schedule (e.g., dual duct)
);
bool const PerPersonNotSet = false, // when calculation should not include occupants (e.g., dual duct)
bool const MaxOAVolFlowFlag = false, // TRUE when calculation uses occupancy schedule (e.g., dual duct)
int const spaceNum = 0);

} // namespace DataSizing

Expand Down
Loading

4 comments on commit f81a9f9

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

spaceSizingFixes (mjwitte) - Win64-Windows-10-VisualStudio-16: OK (2900 of 2900 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

spaceSizingFixes (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2922 of 2922 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

spaceSizingFixes (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-RelWithDebInfo: OK (2106 of 2106 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

spaceSizingFixes (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-RelWithDebInfo: OK (799 of 799 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.