Skip to content

Commit

Permalink
reduce reference
Browse files Browse the repository at this point in the history
  • Loading branch information
rraustad committed Aug 28, 2024
1 parent b068023 commit bb50503
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/EnergyPlus/ZonePlenum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1162,26 +1162,23 @@ void UpdateAirZoneSupplyPlenum(EnergyPlusData &state, int const ZonePlenumNum, b
// METHODOLOGY EMPLOYED:
// Similar to the Zone Splitter component but with interactions to the plenum zone.

// Using/Aliasing
// SUBROUTINE PARAMETER DEFINITIONS:
Real64 constexpr FlowRateToler = 0.01; // Tolerance for mass flow rate convergence (in kg/s)

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:

int InletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletNode;
auto &inletNode = state.dataLoopNodes->Node(InletNode);
int ZoneNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneNodeNum;
auto &zoneNode = state.dataLoopNodes->Node(ZoneNode);
auto const &zoneSupPlenCon = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum);
auto &inletNode = state.dataLoopNodes->Node(zoneSupPlenCon.InletNode);
auto &zoneNode = state.dataLoopNodes->Node(zoneSupPlenCon.ZoneNodeNum);

// On the FirstCall the State properties are passed through and the mass flows are not dealt with
if (FirstCall) {
// Set the outlet nodes for properties that just pass through and not used
for (int NodeIndex = 1; NodeIndex <= state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; ++NodeIndex) {
int OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(NodeIndex);
for (int NodeIndex = 1; NodeIndex <= zoneSupPlenCon.NumOutletNodes; ++NodeIndex) {
int OutletNode = zoneSupPlenCon.OutletNode(NodeIndex);
auto &outletNode = state.dataLoopNodes->Node(OutletNode);
outletNode.Temp = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletTemp(NodeIndex);
outletNode.HumRat = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletHumRat(NodeIndex);
outletNode.Enthalpy = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletEnthalpy(NodeIndex);
outletNode.Temp = zoneSupPlenCon.OutletTemp(NodeIndex);
outletNode.HumRat = zoneSupPlenCon.OutletHumRat(NodeIndex);
outletNode.Enthalpy = zoneSupPlenCon.OutletEnthalpy(NodeIndex);
if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
outletNode.CO2 = inletNode.CO2;
}
Expand All @@ -1198,20 +1195,18 @@ void UpdateAirZoneSupplyPlenum(EnergyPlusData &state, int const ZonePlenumNum, b
}

} else {
// The second time through just updates the mass flow conditions back upstream
// to the inlet.

if (std::abs(inletNode.MassFlowRate - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRate) > FlowRateToler) {
// The second time through just updates the mass flow conditions back upstream to the inlet.
if (std::abs(inletNode.MassFlowRate - zoneSupPlenCon.InletMassFlowRate) > FlowRateToler) {
PlenumInletChanged = true;
}

inletNode.MassFlowRate = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRate;
inletNode.MassFlowRateMaxAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMaxAvail;
inletNode.MassFlowRateMinAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMinAvail;
inletNode.MassFlowRate = zoneSupPlenCon.InletMassFlowRate;
inletNode.MassFlowRateMaxAvail = zoneSupPlenCon.InletMassFlowRateMaxAvail;
inletNode.MassFlowRateMinAvail = zoneSupPlenCon.InletMassFlowRateMinAvail;

zoneNode.MassFlowRate = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRate;
zoneNode.MassFlowRateMaxAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMaxAvail;
zoneNode.MassFlowRateMinAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMinAvail;
zoneNode.MassFlowRate = zoneSupPlenCon.InletMassFlowRate;
zoneNode.MassFlowRateMaxAvail = zoneSupPlenCon.InletMassFlowRateMaxAvail;
zoneNode.MassFlowRateMinAvail = zoneSupPlenCon.InletMassFlowRateMinAvail;

} // For FirstCall
}
Expand Down

4 comments on commit bb50503

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

CppCheck-ZonePlenum (rraustad) - Win64-Windows-10-VisualStudio-16: OK (2871 of 2871 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.

CppCheck-ZonePlenum (rraustad) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3706 of 3706 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.

CppCheck-ZonePlenum (rraustad) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (797 of 797 tests passed, 0 test warnings)

Build Badge Test Badge Coverage 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.

CppCheck-ZonePlenum (rraustad) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (2077 of 2077 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.