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

CppCheck ZoneEquipmentManager #10705

Merged
merged 8 commits into from
Sep 11, 2024
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
77 changes: 34 additions & 43 deletions src/EnergyPlus/ZoneEquipmentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state,
DataSizing::ZoneSizingData &zsCalcSizing,
DataZoneEnergyDemands::ZoneSystemSensibleDemand &zsEnergyDemand,
DataZoneEnergyDemands::ZoneSystemMoistureDemand &zsMoistureDemand,
DataHeatBalance::ZoneData &zoneOrSpace,
DataHeatBalance::ZoneData const &zoneOrSpace,
int zoneNum,
int spaceNum)
{
Expand All @@ -315,8 +315,6 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state,
: state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).NonAirSystemResponse;
auto &sysDepZoneLoads = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).SysDepZoneLoads
: state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).SysDepZoneLoads;
auto &zoneLatentGain = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain
: state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).latentGain;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/ZoneEquipmentManager.cc:318]:(style),[variableScope],The scope of the variable 'zoneLatentGain' can be reduced.

Copy link
Member

Choose a reason for hiding this comment

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

@mjwitte this is 1 thing causing a conflict in this branch. It looks like you did something different with zoneLatentGain maybe? I'm hesitant to smash in a conflict resolution when there may be side effects.

Copy link
Contributor

Choose a reason for hiding this comment

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

This can go all the way at the bottom of the function inside this:

        if (zsCalcSizing.zoneLatentSizing) {
            int ZoneMult = zoneOrSpace.Multiplier * zoneOrSpace.ListMultiplier;
           auto &zoneLatentGain = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector>spaceHeatBalance(spaceNum).latentGain
                                          : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).latentGain;
            zoneLatentGain += (LatOutputProvided * HgAir) / ZoneMult;
        }

auto &zoneNodeNum =
(spaceNum > 0) ? state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber : state.dataHeatBal->Zone(zoneNum).SystemZoneNodeNumber;
nonAirSystemResponse = 0.0;
Expand Down Expand Up @@ -559,6 +557,8 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state,
nonAirSystemResponse = SysOutputProvided;
if (zsCalcSizing.zoneLatentSizing) {
int zoneMult = zoneOrSpace.Multiplier * zoneOrSpace.ListMultiplier;
auto &zoneLatentGain = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain
: state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).latentGain;
zoneLatentGain += (LatOutputProvided * HgAir) / zoneMult;
}
if (state.dataHeatBal->doSpaceHeatBalance && spaceNum == 0) {
Expand Down Expand Up @@ -588,7 +588,7 @@ void sizeZoneSpaceEquipmentPart2(EnergyPlusData &state,
int zoneNodeNum =
(spaceNum > 0) ? state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber : state.dataHeatBal->Zone(zoneNum).SystemZoneNodeNumber;
Real64 RetTemp = (returnNodeNum > 0) ? state.dataLoopNodes->Node(returnNodeNum).Temp : state.dataLoopNodes->Node(zoneNodeNum).Temp;
auto &zoneTstatSP = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum);
auto const &zoneTstatSP = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum);
if (zsCalcSizing.HeatLoad > 0.0) {
zsCalcSizing.HeatZoneRetTemp = RetTemp;
zsCalcSizing.HeatTstatTemp = (zoneTstatSP > 0.0) ? zoneTstatSP : state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum);
Expand Down Expand Up @@ -996,7 +996,7 @@ void SetUpZoneSizingArrays(EnergyPlusData &state)
// from the specified OA method
for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
auto &thisZone = state.dataHeatBal->Zone(CtrlZoneNum);
auto const &thisZone = state.dataHeatBal->Zone(CtrlZoneNum);
auto &finalZoneSizing = state.dataSize->FinalZoneSizing(CtrlZoneNum);
auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
// Use the max occupancy PEOPLE structure to calculate design min OA for each zone from the outside air flow per person input
Expand All @@ -1008,7 +1008,6 @@ void SetUpZoneSizingArrays(EnergyPlusData &state)
// If this is a DesignSpecification:OutdoorAir:SpaceList check to make sure spaces are valid and belong to this zone
if (thisOAReq.numDSOA > 0) {
for (int spaceCounter = 1; spaceCounter <= thisOAReq.numDSOA; ++spaceCounter) {
std::string thisSpaceName = thisOAReq.dsoaSpaceNames(spaceCounter);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/ZoneEquipmentManager.cc:1007]:(style),[unreadVariable],Variable 'thisSpaceName' is assigned a value that is never used.

int thisSpaceNum = thisOAReq.dsoaSpaceIndexes(spaceCounter);
if (thisSpaceNum > 0) {
if (state.dataHeatBal->space(thisSpaceNum).zoneNum != CtrlZoneNum) {
Expand Down Expand Up @@ -1054,13 +1053,13 @@ void SetUpZoneSizingArrays(EnergyPlusData &state)

// Calculate the design min OA flow rate for this zone
// flag to use occupancy schedule when calculating OA
bool UseOccSchFlag = false;
// flag to use min OA schedule when calculating OA
bool UseMinOASchFlag = false;
state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneDesignSpecOAIndex = DSOAPtr; // store for later use
state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneAirDistributionIndex = finalZoneSizing.ZoneAirDistributionIndex; // store for later use
Real64 OAVolumeFlowRate = 0.0;
if (!dsoaError) {
bool UseOccSchFlag = false;
bool UseMinOASchFlag = false;
OAVolumeFlowRate = DataSizing::calcDesignSpecificationOutdoorAir(state, DSOAPtr, CtrlZoneNum, UseOccSchFlag, UseMinOASchFlag);
}

Expand Down Expand Up @@ -1352,7 +1351,7 @@ void RezeroZoneSizingArrays(EnergyPlusData &state)
}
}
}
void updateZoneSizingBeginDay(EnergyPlusData &state, DataSizing::ZoneSizingData &zsCalcSizing)
void updateZoneSizingBeginDay(EnergyPlusData const &state, DataSizing::ZoneSizingData &zsCalcSizing)
{
zsCalcSizing.CoolDesDay = state.dataEnvrn->EnvironmentName;
zsCalcSizing.HeatDesDay = state.dataEnvrn->EnvironmentName;
Expand Down Expand Up @@ -1762,7 +1761,7 @@ void updateZoneSizingEndDay(DataSizing::ZoneSizingData &zsCalcSizing,
// save heat peak conditions when there is no design heating load or design heating volume flow rate, i.e., when
// zone temperature is always greater than the zone heating thermostat temperature
if (zsCalcFinalSizing.DesHeatLoad == 0) {
bool FirstIteration = true;
bool FirstIteration = true; // declare as static to save for next iteration? but needs to be space/zone specific?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move to struct to get expected result? It seems the intent is to set these sizing data on a first pass but is not working as intended.

[src/EnergyPlus/ZoneEquipmentManager.cc:1791]:(style),[unreadVariable],Variable 'FirstIteration' is assigned a value that is never used.

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 correctly, this is being used locally here to initialize the peak data to the first timestep values, then let the < (or >) comparisons take over for the remaining timesteps in the loop. So, this really is very local, and it is used in the IF, so not sure why cppCheck thinks it isn't used. The name is misleading, could be firstTimeStep or just delete it and put || TimeStepIndex = 1 in the if.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at this again. This is in EndDay calcs so it seems each of these blocks should be executed at least once. That does not appear to be happening for the later blocks where a previous block was executed and the later block doesn't set bool FirstIteration = true;. I think the || TimeStepIndex == 1 is the better approach. I expect diffs so will target this section in a new branch. I have seen hour of peak = 24 (usually a heating design day) in the past so wondering if TimeStepIndex ==1 or numTimeStepInDay (with condition to not overwrite if set on TimeStepIndex < numTimeStepInDay) is better? If there is no load or flow the entire day maybe it doesn't matter so will try with TimeStepIndex ==1 to see what happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, and CppCheck thinks FirstIteration = false; at line 1791 is never used.

for (int TimeStepIndex = 1; TimeStepIndex <= numTimeStepInDay; ++TimeStepIndex) {
if ((zsCalcSizing.HeatZoneTempSeq(TimeStepIndex) < zsCalcSizing.ZoneTempAtHeatPeak) || FirstIteration) {
zsCalcSizing.ZoneTempAtHeatPeak = zsCalcSizing.HeatZoneTempSeq(TimeStepIndex);
Expand Down Expand Up @@ -1957,7 +1956,7 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum

// Other - Initialize to first space values (clear later if not all the same)
int firstSpace = state.dataHeatBal->Zone(zoneNum).spaceIndexes[0];
auto &firstSpaceCFS = state.dataSize->CalcFinalSpaceSizing(firstSpace);
auto const &firstSpaceCFS = state.dataSize->CalcFinalSpaceSizing(firstSpace);
zoneCFS.HeatDesDay = firstSpaceCFS.HeatDesDay;
zoneCFS.HeatDDNum = firstSpaceCFS.HeatDDNum;
zoneCFS.cHeatDDDate = firstSpaceCFS.cHeatDDDate;
Expand Down Expand Up @@ -1990,10 +1989,6 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum
}

int numSpaces = 0; // Track this for averages later
bool heatDDNumAllSame = true;
bool coolDDNumAllSame = true;
int priorHeatDDNum = 0;
int priorCoolDDNum = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/ZoneEquipmentManager.cc:1989]:(style),[unreadVariable],Variable 'heatDDNumAllSame' is assigned a value that is never used.
[src/EnergyPlus/ZoneEquipmentManager.cc:1990]:(style),[unreadVariable],Variable 'coolDDNumAllSame' is assigned a value that is never used.
[src/EnergyPlus/ZoneEquipmentManager.cc:1991]:(style),[unreadVariable],Variable 'priorHeatDDNum' is assigned a value that is never used.
[src/EnergyPlus/ZoneEquipmentManager.cc:1992]:(style),[unreadVariable],Variable 'priorCoolDDNum' is assigned a value that is never used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, oh these were left over from plan A, but changed to plan B. Ok.

for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
auto &spaceCFS = state.dataSize->CalcFinalSpaceSizing(spaceNum);
++numSpaces;
Expand Down Expand Up @@ -2309,7 +2304,7 @@ void updateZoneSizingEndZoneSizingCalc2(EnergyPlusData &state, DataSizing::ZoneS
zsCalcSizing.LatCoolPeakDateHrMin = zsCalcSizing.cLatentCoolDDDate + ' ' + sizingPeakTimeStamp(state, zsCalcSizing.TimeStepNumAtLatentCoolMax);
}

std::string sizingPeakTimeStamp(EnergyPlusData &state, int timeStepIndex)
std::string sizingPeakTimeStamp(EnergyPlusData const &state, int timeStepIndex)
{
int constexpr minToSec = 60;
int hour = 0;
Expand All @@ -2324,7 +2319,7 @@ std::string sizingPeakTimeStamp(EnergyPlusData &state, int timeStepIndex)
void writeZszSpsz(EnergyPlusData &state,
EnergyPlus::InputOutputFile &outputFile,
int const numSpacesOrZones,
Array1D<DataZoneEquipment::EquipConfiguration> const zsEquipConfig,
Array1D<DataZoneEquipment::EquipConfiguration> const &zsEquipConfig,
EPVector<DataSizing::ZoneSizingData> const &zsCalcFinalSizing,
Array2D<DataSizing::ZoneSizingData> const &zsCalcSizing)
{
Expand Down Expand Up @@ -3317,17 +3312,17 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI
for (std::size_t i = 0; i < state.dataSize->ZoneSizing.size(); ++i) {
updateZoneSizingEndZoneSizingCalc4(state.dataSize->ZoneSizing[i], state.dataSize->CalcZoneSizing[i]);
if (state.dataHeatBal->doSpaceHeatBalanceSizing) {
for (std::size_t i = 0; i < state.dataSize->SpaceSizing.size(); ++i) {
updateZoneSizingEndZoneSizingCalc4(state.dataSize->SpaceSizing[i], state.dataSize->CalcSpaceSizing[i]);
for (std::size_t j = 0; j < state.dataSize->SpaceSizing.size(); ++j) {
updateZoneSizingEndZoneSizingCalc4(state.dataSize->SpaceSizing[j], state.dataSize->CalcSpaceSizing[j]);
}
}
}

for (std::size_t i = 0; i < state.dataSize->FinalZoneSizing.size(); ++i) {
updateZoneSizingEndZoneSizingCalc5(state.dataSize->FinalZoneSizing[i], state.dataSize->CalcFinalZoneSizing[i]);
if (state.dataHeatBal->doSpaceHeatBalanceSizing) {
for (std::size_t i = 0; i < state.dataSize->FinalSpaceSizing.size(); ++i) {
updateZoneSizingEndZoneSizingCalc5(state.dataSize->FinalSpaceSizing[i], state.dataSize->CalcFinalSpaceSizing[i]);
for (std::size_t j = 0; j < state.dataSize->FinalSpaceSizing.size(); ++j) {
updateZoneSizingEndZoneSizingCalc5(state.dataSize->FinalSpaceSizing[j], state.dataSize->CalcFinalSpaceSizing[j]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/ZoneEquipmentManager.cc:3324]:(style),[shadowVariable],Local variable 'i' shadows outer variable
[src/EnergyPlus/ZoneEquipmentManager.cc:3333]:(style),[shadowVariable],Local variable 'i' shadows outer variable

}
}
}
Expand Down Expand Up @@ -4042,9 +4037,6 @@ void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum)
// required conditions (heating or cooling).

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int CurEqHeatingPriority; // Used to make sure "optimization features" on compilers don't defeat purpose of this routine
int CurEqCoolingPriority; // Used to make sure "optimization features" on compilers don't defeat purpose of this routine

auto &zeq(state.dataZoneEquip->ZoneEquipList(ControlledZoneNum));
int const NumOfEquipTypes(zeq.NumOfEquipTypes);
for (int EquipTypeNum = 1; EquipTypeNum <= NumOfEquipTypes; ++EquipTypeNum) {
Expand All @@ -4069,8 +4061,8 @@ void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum)
for (int EquipTypeNum = 1; EquipTypeNum <= NumOfEquipTypes; ++EquipTypeNum) {
auto &pso(state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum));

CurEqHeatingPriority = pso.HeatingPriority;
CurEqCoolingPriority = pso.CoolingPriority;
int CurEqHeatingPriority = pso.HeatingPriority;
int CurEqCoolingPriority = pso.CoolingPriority;

for (int ComparedEquipTypeNum = EquipTypeNum; ComparedEquipTypeNum <= NumOfEquipTypes; ++ComparedEquipTypeNum) {
auto &psc(state.dataZoneEquipmentManager->PrioritySimOrder(ComparedEquipTypeNum));
Expand Down Expand Up @@ -4266,8 +4258,8 @@ void distributeOutputRequired(EnergyPlusData &state,
const int &equipNum = state.dataZoneEquipmentManager->PrioritySimOrder(priorityNum).EquipPtr;

// Determine whether we're heating or cooling and choose the appropriate fraction
const Real64 heatLoadRatio = thisZEqList.SequentialHeatingFraction(state, equipNum);
const Real64 coolLoadRatio = thisZEqList.SequentialCoolingFraction(state, equipNum);
heatLoadRatio = thisZEqList.SequentialHeatingFraction(state, equipNum);
coolLoadRatio = thisZEqList.SequentialCoolingFraction(state, equipNum);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/ZoneEquipmentManager.cc:4272]:(style),[shadowVariable],Local variable 'heatLoadRatio' shadows outer variable
[src/EnergyPlus/ZoneEquipmentManager.cc:4273]:(style),[shadowVariable],Local variable 'coolLoadRatio' shadows outer variable

const Real64 loadRatio = (energy.TotalOutputRequired >= 0.0) ? heatLoadRatio : coolLoadRatio;

// Energy loads
Expand Down Expand Up @@ -5004,7 +4996,7 @@ void CalcZoneMassBalance(EnergyPlusData &state, bool const FirstHVACIteration)

for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
auto &thisZoneEquip(state.dataZoneEquip->ZoneEquipConfig(zoneNum));
auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum);
auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum);
if (!thisZoneEquip.IsControlled) continue;
int numRetNodes = thisZoneEquip.NumReturnNodes;
Real64 totalZoneReturnMassFlow = 0.0;
Expand Down Expand Up @@ -5092,8 +5084,8 @@ void CalcZoneMassBalance(EnergyPlusData &state, bool const FirstHVACIteration)
}

void CalcZoneInfiltrationFlows(EnergyPlusData &state,
int const ZoneNum, // current zone index
Real64 &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate
int const ZoneNum, // current zone index
Real64 const &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate
)
{
Real64 constexpr ConvergenceTolerance(0.000010);
Expand Down Expand Up @@ -5230,7 +5222,7 @@ void CalcZoneLeavingConditions(EnergyPlusData &state, bool const FirstHVACIterat

if (state.dataHeatBal->Zone(ZoneNum).HasAirFlowWindowReturn) {
for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
auto &thisSpace = state.dataHeatBal->space(spaceNum);
auto const &thisSpace = state.dataHeatBal->space(spaceNum);
for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0 &&
state.dataSurface->SurfWinAirflowDestination(SurfNum) == DataSurfaces::WindowAirFlowDestination::Return) {
Expand Down Expand Up @@ -5811,20 +5803,20 @@ void CalcAirFlowSimple(EnergyPlusData &state,
Real64 HumRatZN = 0.0; // HumRat of this Zone/Space
Real64 HumRatZM = 0.0; // HumRat of From Zone/Space
if (state.dataHeatBal->doSpaceHeatBalance) {
auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.spaceIndex);
auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.spaceIndex);
TZN = thisSpaceHB.MixingMAT; // Temperature of this Space
HumRatZN = thisSpaceHB.MixingHumRat; // HumRat of this Space
if (thisMixing.fromSpaceIndex == 0) {
auto &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum);
auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum);
TZM = fromZoneHB.MixingMAT; // Temperature of From Zone
HumRatZM = fromZoneHB.MixingHumRat; // HumRat of From Zone
} else {
auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.fromSpaceIndex);
auto const &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.fromSpaceIndex);
TZM = fromSpaceHB.MixingMAT; // Temperature of From Space
HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space
}
} else {
auto &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum);
auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum);
TZN = thisZoneHB.MixingMAT; // Temperature of this zone
TZM = fromZoneHB.MixingMAT; // Temperature of From Zone
HumRatZN = thisZoneHB.MixingHumRat; // HumRat of this zone
Expand All @@ -5841,9 +5833,8 @@ void CalcAirFlowSimple(EnergyPlusData &state,
bool MixingLimitFlag = false;

// Hybrid ventilation global control
int I = 0;
if (thisMixing.HybridControlType == DataHeatBalance::HybridCtrlType::Global && thisMixing.HybridControlMasterNum > 0) {
I = thisMixing.HybridControlMasterNum;
int I = thisMixing.HybridControlMasterNum;
if (!state.dataHeatBal->Ventilation(I).HybridControlMasterStatus) continue;
} else {
// Ensure the minimum indoor temperature <= the maximum indoor temperature
Expand Down Expand Up @@ -6070,14 +6061,14 @@ void CalcAirFlowSimple(EnergyPlusData &state,
Real64 HumRatZN = 0.0; // HumRat of this Zone/Space
Real64 HumRatZM = 0.0; // HumRat of From Zone/Space
if (state.dataHeatBal->doSpaceHeatBalance) {
auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.spaceIndex);
auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.spaceIndex);
TZN = thisSpaceHB.MixingMAT; // Temperature of this Space
HumRatZN = thisSpaceHB.MixingHumRat; // HumRat of this Space
if (thisCrossMixing.fromSpaceIndex == 0) {
TZM = fromZoneHB.MixingMAT; // Temperature of From Zone
HumRatZM = fromZoneHB.MixingHumRat; // HumRat of From Zone
} else {
auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex);
auto const &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex);
TZM = fromSpaceHB.MixingMAT; // Temperature of From Space
HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space
}
Expand Down Expand Up @@ -6191,7 +6182,7 @@ void CalcAirFlowSimple(EnergyPlusData &state,
thisCrossMixing.ReportFlag = true;
}

if ((TD <= 0.0) || ((TD > 0.0) && (TZM - TZN >= TD))) {
if ((TD <= 0.0) || (TZM - TZN >= TD)) {
// SET COEFFICIENTS .
Real64 Tavg = (TZN + TZM) / 2.0;
Real64 Wavg = (HumRatZN + HumRatZM) / 2.0;
Expand Down Expand Up @@ -6268,7 +6259,7 @@ void CalcAirFlowSimple(EnergyPlusData &state,
Real64 TZoneA = zoneAHB.MixingMAT;
Real64 HumRatZoneA = zoneAHB.MixingHumRat;
if ((state.dataHeatBal->doSpaceHeatBalance) && (thisRefDoorMixing.spaceIndex > 0)) {
auto &spaceAHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.spaceIndex);
auto const &spaceAHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.spaceIndex);
TZoneA = spaceAHB.MixingMAT;
HumRatZoneA = spaceAHB.MixingHumRat;
}
Expand All @@ -6281,7 +6272,7 @@ void CalcAirFlowSimple(EnergyPlusData &state,
Real64 HumRatZoneB = zoneBHB.MixingHumRat;
Real64 CpAirZoneB = PsyCpAirFnW(HumRatZoneB);
if ((state.dataHeatBal->doSpaceHeatBalance) && (thisRefDoorMixing.fromSpaceIndex > 0)) {
auto &spaceBHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.fromSpaceIndex);
auto const &spaceBHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.fromSpaceIndex);
TZoneB = spaceBHB.MixingMAT;
HumRatZoneB = spaceBHB.MixingHumRat;
}
Expand Down
Loading