Skip to content

Commit

Permalink
Merge pull request #8083 from NREL/ReviseCalcZoneSums
Browse files Browse the repository at this point in the history
Revise calc zone sums
  • Loading branch information
Myoldmopar authored Aug 26, 2020
2 parents 9417804 + 44ceed8 commit 77bde52
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 144 deletions.
136 changes: 69 additions & 67 deletions src/EnergyPlus/ZoneTempPredictorCorrector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3563,7 +3563,7 @@ namespace ZoneTempPredictorCorrector {
// Calculate the various heat balance sums

// NOTE: SumSysMCp and SumSysMCpT are not used in the predict step
CalcZoneSums(state.dataZonePlenum, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT);
CalcZoneSums(state.dataZonePlenum, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT, false);

// Sum all convective internal gains except for people: SumIntGainExceptPeople
if (HybridModel::FlagHybridModel_PC) {
Expand Down Expand Up @@ -6076,7 +6076,8 @@ namespace ZoneTempPredictorCorrector {
Real64 &SumMCp, // Zone sum of MassFlowRate*Cp
Real64 &SumMCpT, // Zone sum of MassFlowRate*Cp*T
Real64 &SumSysMCp, // Zone sum of air system MassFlowRate*Cp
Real64 &SumSysMCpT // Zone sum of air system MassFlowRate*Cp*T
Real64 &SumSysMCpT, // Zone sum of air system MassFlowRate*Cp*T
bool const CorrectorFlag
)
{

Expand Down Expand Up @@ -6172,84 +6173,85 @@ namespace ZoneTempPredictorCorrector {
// Sum all system air flow: SumSysMCp, SumSysMCpT
// Check to see if this is a controlled zone
ControlledZoneAirFlag = Zone(ZoneNum).IsControlled;
if (CorrectorFlag) {
// Check to see if this is a plenum zone
ZoneRetPlenumAirFlag = Zone(ZoneNum).IsReturnPlenum;
ZoneSupPlenumAirFlag = Zone(ZoneNum).IsSupplyPlenum;

// Plenum and controlled zones have a different set of inlet nodes which must be calculated.
if (ControlledZoneAirFlag) {
ZoneEquipConfigNum = Zone(ZoneNum).ZoneEqNum;
auto const &zec(ZoneEquipConfig(ZoneEquipConfigNum));
for (int NodeNum = 1, NodeNum_end = zec.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
// this next block is of interest to irratic system loads... maybe nodes are not accurate at time of call?
// how can we tell? predict step must be lagged ? correct step, systems have run.
auto const &node(Node(zec.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

// Check to see if this is a plenum zone
ZoneRetPlenumAirFlag = Zone(ZoneNum).IsReturnPlenum;
ZoneSupPlenumAirFlag = Zone(ZoneNum).IsSupplyPlenum;

// Plenum and controlled zones have a different set of inlet nodes which must be calculated.
if (ControlledZoneAirFlag) {
ZoneEquipConfigNum = Zone(ZoneNum).ZoneEqNum;
auto const &zec(ZoneEquipConfig(ZoneEquipConfigNum));
for (int NodeNum = 1, NodeNum_end = zec.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
// this next block is of interest to irratic system loads... maybe nodes are not accurate at time of call?
// how can we tell? predict step must be lagged ? correct step, systems have run.
auto const &node(Node(zec.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
} // NodeNum

} else if (ZoneRetPlenumAirFlag) {
ZoneRetPlenumNum = Zone(ZoneNum).PlenumCondNum;
auto const &zrpc(dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum));
Real64 const air_hum_rat(ZoneAirHumRat(ZoneNum));
for (int NodeNum = 1, NodeNum_end = zrpc.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
auto const &node(Node(zrpc.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(air_hum_rat);

Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
} // NodeNum
// add in the leaks
for (int ADUListIndex = 1, ADUListIndex_end = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).NumADUs; ADUListIndex <= ADUListIndex_end;
++ADUListIndex) {
ADUNum = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).ADUIndex(ADUListIndex);
if (AirDistUnit(ADUNum).UpStreamLeak) {
ADUInNode = AirDistUnit(ADUNum).InletNodeNum;
NodeTemp = Node(ADUInNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateUpStrLk;
CpAir = PsyCpAirFnW(air_hum_rat);
Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
}
if (AirDistUnit(ADUNum).DownStreamLeak) {
ADUOutNode = AirDistUnit(ADUNum).OutletNodeNum;
NodeTemp = Node(ADUOutNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateDnStrLk;
} // NodeNum

} else if (ZoneRetPlenumAirFlag) {
ZoneRetPlenumNum = Zone(ZoneNum).PlenumCondNum;
auto const &zrpc(dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum));
Real64 const air_hum_rat(ZoneAirHumRat(ZoneNum));
for (int NodeNum = 1, NodeNum_end = zrpc.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
auto const &node(Node(zrpc.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(air_hum_rat);

Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
} // NodeNum
// add in the leaks
for (int ADUListIndex = 1, ADUListIndex_end = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).NumADUs;
ADUListIndex <= ADUListIndex_end;
++ADUListIndex) {
ADUNum = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).ADUIndex(ADUListIndex);
if (AirDistUnit(ADUNum).UpStreamLeak) {
ADUInNode = AirDistUnit(ADUNum).InletNodeNum;
NodeTemp = Node(ADUInNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateUpStrLk;
CpAir = PsyCpAirFnW(air_hum_rat);
Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
}
if (AirDistUnit(ADUNum).DownStreamLeak) {
ADUOutNode = AirDistUnit(ADUNum).OutletNodeNum;
NodeTemp = Node(ADUOutNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateDnStrLk;
CpAir = PsyCpAirFnW(air_hum_rat);
Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
}
}
}

} else if (ZoneSupPlenumAirFlag) {
ZoneSupPlenumNum = Zone(ZoneNum).PlenumCondNum;
// Get node conditions
NodeTemp = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).Temp;
MassFlowRate = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

SumSysMCp += MassFlowRate * CpAir;
SumSysMCpT += MassFlowRate * CpAir * NodeTemp;
}
} else if (ZoneSupPlenumAirFlag) {
ZoneSupPlenumNum = Zone(ZoneNum).PlenumCondNum;
// Get node conditions
NodeTemp = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).Temp;
MassFlowRate = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

ZoneMult = Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier;
SumSysMCp += MassFlowRate * CpAir;
SumSysMCpT += MassFlowRate * CpAir * NodeTemp;
}

SumSysMCp /= ZoneMult;
SumSysMCpT /= ZoneMult;
ZoneMult = Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier;

SumSysMCp /= ZoneMult;
SumSysMCpT /= ZoneMult;
}
// Sum all surface convection: SumHA, SumHATsurf, SumHATref (and additional contributions to SumIntGain)
for (SurfNum = Zone(ZoneNum).SurfaceFirst; SurfNum <= Zone(ZoneNum).SurfaceLast; ++SurfNum) {

Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/ZoneTempPredictorCorrector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ namespace ZoneTempPredictorCorrector {
Real64 &SumMCp, // Zone sum of MassFlowRate*Cp
Real64 &SumMCpT, // Zone sum of MassFlowRate*Cp*T
Real64 &SumSysMCp, // Zone sum of air system MassFlowRate*Cp
Real64 &SumSysMCpT // Zone sum of air system MassFlowRate*Cp*T
Real64 &SumSysMCpT, // Zone sum of air system MassFlowRate*Cp*T
bool const CorrectorFlag = true // Corrector call flag
);

void CalcZoneComponentLoadSums(ZonePlenumData &dataZonePlenum, int const ZoneNum, // Zone number
Expand Down
Loading

7 comments on commit 77bde52

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (13 of 13 tests passed, 0 test warnings)

Build 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

Build 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2228 of 2228 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2208 of 2208 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1490 of 1490 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2183 of 2183 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (721 of 721 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.