From f98fc5cf55e7fe3ca94347a0a19aa4f35a5a1140 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 00:12:27 -0400 Subject: [PATCH 01/12] reduce class ref --- src/EnergyPlus/SizingManager.cc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index 0b76cbd122e..56bccde82cf 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -127,7 +127,6 @@ void ManageSizing(EnergyPlusData &state) // Design day simulations are run again with central air systems supplied by // purchased hot and cold water, yielding central heating and cooling capacities. - auto &CalcSysSizing = state.dataSize->CalcSysSizing; auto &SysSizPeakDDNum = state.dataSize->SysSizPeakDDNum; // Using/Aliasing @@ -225,9 +224,6 @@ void ManageSizing(EnergyPlusData &state) if ((state.dataSize->NumZoneSizingInput > 0) && (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing)) { - if (state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim) { - state.dataGlobal->DoOutputReporting = false; - } state.dataGlobal->DoOutputReporting = false; state.dataGlobal->ZoneSizingCalc = true; Available = true; @@ -624,9 +620,10 @@ void ManageSizing(EnergyPlusData &state) if (state.dataSize->SysSizingRunDone) { for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { + auto &calcSysSizing = state.dataSize->CalcSysSizing(AirLoopNum); curName = FinalSysSizing(AirLoopNum).AirPriLoopName; - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcClAir, curName, CalcSysSizing(AirLoopNum).DesCoolVolFlow); - if (std::abs(CalcSysSizing(AirLoopNum).DesCoolVolFlow) <= 1.e-8) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcClAir, curName, calcSysSizing.DesCoolVolFlow); + if (std::abs(calcSysSizing.DesCoolVolFlow) <= 1.e-8) { ShowWarningError(state, format("{}Calculated Cooling Design Air Flow Rate for System={} is zero.", RoutineName, @@ -634,8 +631,8 @@ void ManageSizing(EnergyPlusData &state) ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs."); } PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserClAir, curName, FinalSysSizing(AirLoopNum).DesCoolVolFlow); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcHtAir, curName, CalcSysSizing(AirLoopNum).DesHeatVolFlow); - if (std::abs(CalcSysSizing(AirLoopNum).DesHeatVolFlow) <= 1.e-8) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcHtAir, curName, calcSysSizing.DesHeatVolFlow); + if (std::abs(calcSysSizing.DesHeatVolFlow) <= 1.e-8) { ShowWarningError(state, format("{}Calculated Heating Design Air Flow Rate for System={} is zero.", RoutineName, @@ -670,7 +667,7 @@ void ManageSizing(EnergyPlusData &state) "Cooling", coolPeakLoadKind, coolCap, - CalcSysSizing(AirLoopNum).DesCoolVolFlow, + calcSysSizing.DesCoolVolFlow, FinalSysSizing(AirLoopNum).DesCoolVolFlow, FinalSysSizing(AirLoopNum).CoolDesDay, coolPeakDDDate, @@ -681,7 +678,7 @@ void ManageSizing(EnergyPlusData &state) "Cooling", coolPeakLoadKind, coolCap, - CalcSysSizing(AirLoopNum).DesCoolVolFlow, + calcSysSizing.DesCoolVolFlow, FinalSysSizing(AirLoopNum).DesCoolVolFlow, FinalSysSizing(AirLoopNum).CoolDesDay, coolPeakDDDate, @@ -694,7 +691,7 @@ void ManageSizing(EnergyPlusData &state) "Heating", "Sensible", FinalSysSizing(AirLoopNum).HeatCap, - CalcSysSizing(AirLoopNum).DesHeatVolFlow, + calcSysSizing.DesHeatVolFlow, FinalSysSizing(AirLoopNum).DesHeatVolFlow, FinalSysSizing(AirLoopNum).HeatDesDay, SysSizPeakDDNum(AirLoopNum).cHeatPeakDDDate, @@ -705,7 +702,7 @@ void ManageSizing(EnergyPlusData &state) "Heating", "Sensible", FinalSysSizing(AirLoopNum).HeatCap, - CalcSysSizing(AirLoopNum).DesHeatVolFlow, + calcSysSizing.DesHeatVolFlow, FinalSysSizing(AirLoopNum).DesHeatVolFlow, FinalSysSizing(AirLoopNum).HeatDesDay, SysSizPeakDDNum(AirLoopNum).cHeatPeakDDDate, From d658b677f2554d8b3821db2364352e24b1f8f79e Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 00:21:58 -0400 Subject: [PATCH 02/12] reduce class reference --- src/EnergyPlus/SizingManager.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index 56bccde82cf..da0fce8c791 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -127,8 +127,6 @@ void ManageSizing(EnergyPlusData &state) // Design day simulations are run again with central air systems supplied by // purchased hot and cold water, yielding central heating and cooling capacities. - auto &SysSizPeakDDNum = state.dataSize->SysSizPeakDDNum; - // Using/Aliasing using SimAirServingZones::ManageAirLoops; using SimAirServingZones::UpdateSysSizing; @@ -621,6 +619,8 @@ void ManageSizing(EnergyPlusData &state) if (state.dataSize->SysSizingRunDone) { for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { auto &calcSysSizing = state.dataSize->CalcSysSizing(AirLoopNum); + auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(AirLoopNum); + curName = FinalSysSizing(AirLoopNum).AirPriLoopName; PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcClAir, curName, calcSysSizing.DesCoolVolFlow); if (std::abs(calcSysSizing.DesCoolVolFlow) <= 1.e-8) { @@ -646,20 +646,20 @@ void ManageSizing(EnergyPlusData &state) int timeStepIndexAtPeakCoolLoad = 0; if (FinalSysSizing(AirLoopNum).coolingPeakLoad == DataSizing::PeakLoad::SensibleCooling) { coolPeakLoadKind = "Sensible"; - coolPeakDDDate = SysSizPeakDDNum(AirLoopNum).cSensCoolPeakDDDate; - coolPeakDD = SysSizPeakDDNum(AirLoopNum).SensCoolPeakDD; + coolPeakDDDate = sysSizPeakDDNum.cSensCoolPeakDDDate; + coolPeakDD = sysSizPeakDDNum.SensCoolPeakDD; coolCap = FinalSysSizing(AirLoopNum).SensCoolCap; - if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = SysSizPeakDDNum(AirLoopNum).TimeStepAtSensCoolPk(coolPeakDD); + if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = sysSizPeakDDNum.TimeStepAtSensCoolPk(coolPeakDD); } else if (FinalSysSizing(AirLoopNum).coolingPeakLoad == DataSizing::PeakLoad::TotalCooling) { if (FinalSysSizing(AirLoopNum).loadSizingType == DataSizing::LoadSizing::Latent && state.dataHeatBal->DoLatentSizing) { coolPeakLoadKind = "Total Based on Latent"; } else { coolPeakLoadKind = "Total"; } - coolPeakDDDate = SysSizPeakDDNum(AirLoopNum).cTotCoolPeakDDDate; - coolPeakDD = SysSizPeakDDNum(AirLoopNum).TotCoolPeakDD; + coolPeakDDDate = sysSizPeakDDNum.cTotCoolPeakDDDate; + coolPeakDD = sysSizPeakDDNum.TotCoolPeakDD; coolCap = FinalSysSizing(AirLoopNum).TotCoolCap; - if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = SysSizPeakDDNum(AirLoopNum).TimeStepAtTotCoolPk(coolPeakDD); + if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = sysSizPeakDDNum.TimeStepAtTotCoolPk(coolPeakDD); } if (coolPeakDD > 0) { ReportSysSizing(state, @@ -684,7 +684,7 @@ void ManageSizing(EnergyPlusData &state) coolPeakDDDate, 0); } - int heatPeakDD = SysSizPeakDDNum(AirLoopNum).HeatPeakDD; + int heatPeakDD = sysSizPeakDDNum.HeatPeakDD; if (heatPeakDD > 0) { ReportSysSizing(state, curName, @@ -694,8 +694,8 @@ void ManageSizing(EnergyPlusData &state) calcSysSizing.DesHeatVolFlow, FinalSysSizing(AirLoopNum).DesHeatVolFlow, FinalSysSizing(AirLoopNum).HeatDesDay, - SysSizPeakDDNum(AirLoopNum).cHeatPeakDDDate, - SysSizPeakDDNum(AirLoopNum).TimeStepAtHeatPk(heatPeakDD)); + sysSizPeakDDNum.cHeatPeakDDDate, + sysSizPeakDDNum.TimeStepAtHeatPk(heatPeakDD)); } else { ReportSysSizing(state, curName, @@ -705,7 +705,7 @@ void ManageSizing(EnergyPlusData &state) calcSysSizing.DesHeatVolFlow, FinalSysSizing(AirLoopNum).DesHeatVolFlow, FinalSysSizing(AirLoopNum).HeatDesDay, - SysSizPeakDDNum(AirLoopNum).cHeatPeakDDDate, + sysSizPeakDDNum.cHeatPeakDDDate, 0); } PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserHtAir, curName, FinalSysSizing(AirLoopNum).DesHeatVolFlow); From b327afeeea8f765550bfa30b5b032893c159d45d Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 00:31:21 -0400 Subject: [PATCH 03/12] reduce class reference --- src/EnergyPlus/SizingManager.cc | 50 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index da0fce8c791..f7f096ce3af 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -152,15 +152,11 @@ void ManageSizing(EnergyPlusData &state) int TimeStepInDay(0); // time step number int LastMonth(0); int LastDayOfMonth(0); - int AirLoopNum(0); // air loop index std::string curName; int NumSizingPeriodsPerformed; int numZoneSizeIter; // number of times to repeat zone sizing calcs. 1 normal, 2 load component reporting - int iZoneCalcIter; // index for repeating the zone sizing calcs bool isUserReqCompLoadReport; - auto &FinalSysSizing = state.dataSize->FinalSysSizing; - TimeStepInDay = 0; state.dataSize->SysSizingRunDone = false; state.dataSize->ZoneSizingRunDone = false; @@ -252,7 +248,7 @@ void ManageSizing(EnergyPlusData &state) SetupZoneSizing(state, ErrorsFound); // Should only be done ONCE state.dataGlobal->KickOffSizing = false; - for (iZoneCalcIter = 1; iZoneCalcIter <= numZoneSizeIter; ++iZoneCalcIter) { // normally this is performed once but if load component + for (int iZoneCalcIter = 1; iZoneCalcIter <= numZoneSizeIter; ++iZoneCalcIter) { // normally this is performed once but if load component // report is requested, these are repeated with a pulse in // each zone. @@ -617,26 +613,28 @@ void ManageSizing(EnergyPlusData &state) } if (state.dataSize->SysSizingRunDone) { - for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { + for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { auto &calcSysSizing = state.dataSize->CalcSysSizing(AirLoopNum); auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(AirLoopNum); + auto &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + - curName = FinalSysSizing(AirLoopNum).AirPriLoopName; + curName = finalSysSizing.AirPriLoopName; PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcClAir, curName, calcSysSizing.DesCoolVolFlow); if (std::abs(calcSysSizing.DesCoolVolFlow) <= 1.e-8) { ShowWarningError(state, format("{}Calculated Cooling Design Air Flow Rate for System={} is zero.", RoutineName, - FinalSysSizing(AirLoopNum).AirPriLoopName)); + finalSysSizing.AirPriLoopName)); ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs."); } - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserClAir, curName, FinalSysSizing(AirLoopNum).DesCoolVolFlow); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserClAir, curName, finalSysSizing.DesCoolVolFlow); PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcHtAir, curName, calcSysSizing.DesHeatVolFlow); if (std::abs(calcSysSizing.DesHeatVolFlow) <= 1.e-8) { ShowWarningError(state, format("{}Calculated Heating Design Air Flow Rate for System={} is zero.", RoutineName, - FinalSysSizing(AirLoopNum).AirPriLoopName)); + finalSysSizing.AirPriLoopName)); ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs."); } std::string_view coolPeakLoadKind; @@ -644,21 +642,21 @@ void ManageSizing(EnergyPlusData &state) int coolPeakDD = 0; Real64 coolCap = 0.; int timeStepIndexAtPeakCoolLoad = 0; - if (FinalSysSizing(AirLoopNum).coolingPeakLoad == DataSizing::PeakLoad::SensibleCooling) { + if (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::SensibleCooling) { coolPeakLoadKind = "Sensible"; coolPeakDDDate = sysSizPeakDDNum.cSensCoolPeakDDDate; coolPeakDD = sysSizPeakDDNum.SensCoolPeakDD; - coolCap = FinalSysSizing(AirLoopNum).SensCoolCap; + coolCap = finalSysSizing.SensCoolCap; if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = sysSizPeakDDNum.TimeStepAtSensCoolPk(coolPeakDD); - } else if (FinalSysSizing(AirLoopNum).coolingPeakLoad == DataSizing::PeakLoad::TotalCooling) { - if (FinalSysSizing(AirLoopNum).loadSizingType == DataSizing::LoadSizing::Latent && state.dataHeatBal->DoLatentSizing) { + } else if (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::TotalCooling) { + if (finalSysSizing.loadSizingType == DataSizing::LoadSizing::Latent && state.dataHeatBal->DoLatentSizing) { coolPeakLoadKind = "Total Based on Latent"; } else { coolPeakLoadKind = "Total"; } coolPeakDDDate = sysSizPeakDDNum.cTotCoolPeakDDDate; coolPeakDD = sysSizPeakDDNum.TotCoolPeakDD; - coolCap = FinalSysSizing(AirLoopNum).TotCoolCap; + coolCap = finalSysSizing.TotCoolCap; if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = sysSizPeakDDNum.TimeStepAtTotCoolPk(coolPeakDD); } if (coolPeakDD > 0) { @@ -668,8 +666,8 @@ void ManageSizing(EnergyPlusData &state) coolPeakLoadKind, coolCap, calcSysSizing.DesCoolVolFlow, - FinalSysSizing(AirLoopNum).DesCoolVolFlow, - FinalSysSizing(AirLoopNum).CoolDesDay, + finalSysSizing.DesCoolVolFlow, + finalSysSizing.CoolDesDay, coolPeakDDDate, timeStepIndexAtPeakCoolLoad); } else { @@ -679,8 +677,8 @@ void ManageSizing(EnergyPlusData &state) coolPeakLoadKind, coolCap, calcSysSizing.DesCoolVolFlow, - FinalSysSizing(AirLoopNum).DesCoolVolFlow, - FinalSysSizing(AirLoopNum).CoolDesDay, + finalSysSizing.DesCoolVolFlow, + finalSysSizing.CoolDesDay, coolPeakDDDate, 0); } @@ -690,10 +688,10 @@ void ManageSizing(EnergyPlusData &state) curName, "Heating", "Sensible", - FinalSysSizing(AirLoopNum).HeatCap, + finalSysSizing.HeatCap, calcSysSizing.DesHeatVolFlow, - FinalSysSizing(AirLoopNum).DesHeatVolFlow, - FinalSysSizing(AirLoopNum).HeatDesDay, + finalSysSizing.DesHeatVolFlow, + finalSysSizing.HeatDesDay, sysSizPeakDDNum.cHeatPeakDDDate, sysSizPeakDDNum.TimeStepAtHeatPk(heatPeakDD)); } else { @@ -701,14 +699,14 @@ void ManageSizing(EnergyPlusData &state) curName, "Heating", "Sensible", - FinalSysSizing(AirLoopNum).HeatCap, + finalSysSizing.HeatCap, calcSysSizing.DesHeatVolFlow, - FinalSysSizing(AirLoopNum).DesHeatVolFlow, - FinalSysSizing(AirLoopNum).HeatDesDay, + finalSysSizing.DesHeatVolFlow, + finalSysSizing.HeatDesDay, sysSizPeakDDNum.cHeatPeakDDDate, 0); } - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserHtAir, curName, FinalSysSizing(AirLoopNum).DesHeatVolFlow); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserHtAir, curName, finalSysSizing.DesHeatVolFlow); } // Deallocate arrays no longer needed state.dataSize->SysSizing.deallocate(); From 83bd182efda8172cc6542fb12c4358d8270a3e67 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 01:33:12 -0400 Subject: [PATCH 04/12] reduce class reference --- src/EnergyPlus/SizingManager.cc | 63 +++++++++++++++++---------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index f7f096ce3af..b003248ca38 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -618,23 +618,18 @@ void ManageSizing(EnergyPlusData &state) auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(AirLoopNum); auto &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); - curName = finalSysSizing.AirPriLoopName; PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcClAir, curName, calcSysSizing.DesCoolVolFlow); if (std::abs(calcSysSizing.DesCoolVolFlow) <= 1.e-8) { - ShowWarningError(state, - format("{}Calculated Cooling Design Air Flow Rate for System={} is zero.", - RoutineName, - finalSysSizing.AirPriLoopName)); + ShowWarningError( + state, format("{}Calculated Cooling Design Air Flow Rate for System={} is zero.", RoutineName, finalSysSizing.AirPriLoopName)); ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs."); } PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserClAir, curName, finalSysSizing.DesCoolVolFlow); PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcHtAir, curName, calcSysSizing.DesHeatVolFlow); if (std::abs(calcSysSizing.DesHeatVolFlow) <= 1.e-8) { - ShowWarningError(state, - format("{}Calculated Heating Design Air Flow Rate for System={} is zero.", - RoutineName, - finalSysSizing.AirPriLoopName)); + ShowWarningError( + state, format("{}Calculated Heating Design Air Flow Rate for System={} is zero.", RoutineName, finalSysSizing.AirPriLoopName)); ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs."); } std::string_view coolPeakLoadKind; @@ -773,7 +768,6 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // Also store zone level flow information for Standard 62.1 calculations, Vpz, Vpz_min, Vdz, and Vdz_min for both cooling and heating - auto &AirDistUnit = state.dataDefineEquipment->AirDistUnit; auto &FinalSysSizing = state.dataSize->FinalSysSizing; auto &sd_airterminal = state.dataSingleDuct->sd_airterminal; @@ -795,8 +789,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any single duct systems, store 62.1 values by zone if (allocated(sd_airterminal) && state.dataSingleDuct->NumSDAirTerminal > 0) { for (int singleDuctATUNum = 1; singleDuctATUNum <= state.dataSingleDuct->NumSDAirTerminal; ++singleDuctATUNum) { + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(sd_airterminal(singleDuctATUNum).ADUNum); if (AirLoopNum == sd_airterminal(singleDuctATUNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(sd_airterminal(singleDuctATUNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopMaxFlowRateSum += sd_airterminal(singleDuctATUNum).MaxAirVolFlowRate; state.dataSize->VpzClgByZone(termUnitSizingIndex) = @@ -866,7 +861,8 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) if (allocated(state.dataDualDuct->dd_airterminal) && state.dataDualDuct->NumDDAirTerminal > 0) { for (int dualDuctATUNum = 1; dualDuctATUNum <= state.dataDualDuct->NumDDAirTerminal; ++dualDuctATUNum) { if (AirLoopNum == state.dataDualDuct->dd_airterminal(dualDuctATUNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataDualDuct->dd_airterminal(dualDuctATUNum).ADUNum).TermUnitSizingNum; + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(dualDuctATUNum).ADUNum); + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopMaxFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; state.dataSize->VpzClgByZone(termUnitSizingIndex) = state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value @@ -931,8 +927,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any PIU air terminals if (allocated(state.dataPowerInductionUnits->PIU) && state.dataPowerInductionUnits->NumPIUs > 0) { for (int pIUATUNum = 1; pIUATUNum <= state.dataPowerInductionUnits->NumPIUs; ++pIUATUNum) { + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataPowerInductionUnits->PIU(pIUATUNum).ADUNum); if (AirLoopNum == state.dataPowerInductionUnits->PIU(pIUATUNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataPowerInductionUnits->PIU(pIUATUNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; auto &thisTermUnitFinalZoneSizing = state.dataSize->TermUnitFinalZoneSizing(termUnitSizingIndex); airLoopMaxFlowRateSum += state.dataPowerInductionUnits->PIU(pIUATUNum).MaxPriAirVolFlow; if (state.dataPowerInductionUnits->PIU(pIUATUNum).UnitType_Num == @@ -1022,8 +1019,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // dual path for std 62.1 if (allocated(IndUnit) && (NumIndUnits > 0)) { for (int indUnitNum = 1; indUnitNum <= NumIndUnits; ++indUnitNum) { + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(IndUnit(indUnitNum).ADUNum); if (AirLoopNum == IndUnit(indUnitNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(IndUnit(indUnitNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += IndUnit(indUnitNum).MaxPriAirMassFlow / state.dataEnvrn->StdRhoAir; airLoopHeatingMinimumFlowRateSum += IndUnit(indUnitNum).MaxPriAirMassFlow / state.dataEnvrn->StdRhoAir; airLoopMaxFlowRateSum += IndUnit(indUnitNum).MaxPriAirMassFlow / state.dataEnvrn->StdRhoAir; @@ -1043,8 +1041,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any two pipe constant volume cooled beam terminal units if (allocated(state.dataHVACCooledBeam->CoolBeam) && (state.dataHVACCooledBeam->NumCB > 0)) { for (int coolBeamNum = 1; coolBeamNum <= state.dataHVACCooledBeam->NumCB; ++coolBeamNum) { + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataHVACCooledBeam->CoolBeam(coolBeamNum).ADUNum); if (AirLoopNum == state.dataHVACCooledBeam->CoolBeam(coolBeamNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataHVACCooledBeam->CoolBeam(coolBeamNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += state.dataHVACCooledBeam->CoolBeam(coolBeamNum).MaxAirVolFlow; airLoopHeatingMinimumFlowRateSum += state.dataHVACCooledBeam->CoolBeam(coolBeamNum).MaxAirVolFlow; airLoopMaxFlowRateSum += state.dataHVACCooledBeam->CoolBeam(coolBeamNum).MaxAirVolFlow; @@ -1064,23 +1063,24 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) } // sum up heating and max flows for any four pipe cooled beam terminal units (the only one using the airTerminalPtr at this point) - if (allocated(AirDistUnit) && (int)state.dataDefineEquipment->AirDistUnit.size() > 0) { + if (allocated(state.dataDefineEquipment->AirDistUnit) && (int)state.dataDefineEquipment->AirDistUnit.size() > 0) { for (int aDUNum = 1; aDUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++aDUNum) { - if (AirDistUnit(aDUNum).airTerminalPtr.get() != nullptr) { - if (AirLoopNum == AirDistUnit(aDUNum).airTerminalPtr->getAirLoopNum()) { - airLoopHeatingMaximumFlowRateSum += AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - airLoopHeatingMinimumFlowRateSum += AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - airLoopMaxFlowRateSum += AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(aDUNum); + if (airDistUnit.airTerminalPtr.get() != nullptr) { + if (AirLoopNum == airDistUnit.airTerminalPtr->getAirLoopNum()) { + airLoopHeatingMaximumFlowRateSum += airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + airLoopHeatingMinimumFlowRateSum += airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + airLoopMaxFlowRateSum += airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); // store Std 62.1 values, have no modeling of secondary flow rates for induced flow from beam - int termUnitSizingIndex = AirDistUnit(aDUNum).airTerminalPtr->getTermUnitSizingIndex(); - state.dataSize->VpzClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VpzMinClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VpzHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VpzMinHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzMinHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); + int termUnitSizingIndex = airDistUnit.airTerminalPtr->getTermUnitSizingIndex(); + state.dataSize->VpzClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VpzMinClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VpzHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VpzMinHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzMinHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); } } } @@ -1089,8 +1089,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up flows for any air terminal mixers if (allocated(state.dataSingleDuct->SysATMixer) && (state.dataSingleDuct->NumATMixers > 0)) { for (int aTMixerNum = 1; aTMixerNum <= state.dataSingleDuct->NumATMixers; ++aTMixerNum) { + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->SysATMixer(aTMixerNum).ADUNum); if (AirLoopNum == state.dataSingleDuct->SysATMixer(aTMixerNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataSingleDuct->SysATMixer(aTMixerNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += state.dataSingleDuct->SysATMixer(aTMixerNum).DesignPrimaryAirVolRate; airLoopHeatingMinimumFlowRateSum += state.dataSingleDuct->SysATMixer(aTMixerNum).DesignPrimaryAirVolRate; airLoopMaxFlowRateSum += state.dataSingleDuct->SysATMixer(aTMixerNum).DesignPrimaryAirVolRate; From c8d79d69850891981f3c1edad49643b859b33417 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 01:41:44 -0400 Subject: [PATCH 05/12] reduce class reference --- src/EnergyPlus/SizingManager.cc | 85 ++++++++++++++++----------------- 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index b003248ca38..63244a626b0 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -768,7 +768,6 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // Also store zone level flow information for Standard 62.1 calculations, Vpz, Vpz_min, Vdz, and Vdz_min for both cooling and heating - auto &FinalSysSizing = state.dataSize->FinalSysSizing; auto &sd_airterminal = state.dataSingleDuct->sd_airterminal; if ((state.dataSize->NumSysSizInput > 0) && (state.dataGlobal->DoSystemSizing)) { // only if there is system sizing @@ -781,6 +780,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) state.dataGlobal->BeginEnvrnFlag = false; for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { + auto &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); // Mine data from ATUs to find new design heating flow rates and new maximum flow rates Real64 airLoopMaxFlowRateSum(0.0); Real64 airLoopHeatingMinimumFlowRateSum(0.0); @@ -1109,7 +1109,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) } } - std::string curName = FinalSysSizing(AirLoopNum).AirPriLoopName; + std::string curName = finalSysSizing.AirPriLoopName; BaseSizer::reportSizerOutput( state, "AirLoopHVAC", curName, "Sum of Air Terminal Maximum Heating Flow Rates [m3/s]", airLoopHeatingMaximumFlowRateSum); BaseSizer::reportSizerOutput( @@ -1117,77 +1117,74 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "Sum of Air Terminal Maximum Flow Rates [m3/s]", airLoopMaxFlowRateSum); // Adjust system sizing info - if (allocated(FinalSysSizing)) { + if (allocated(state.dataSize->FinalSysSizing)) { // correct sizing design heating volume flow rate based on finalized air terminal unit operation - if (FinalSysSizing(AirLoopNum).SizingOption == + if (finalSysSizing.SizingOption == DataSizing::SizingConcurrence::NonCoincident) { // If non-coincident sizing method for this air loop, the we can use these sum's // from // air terminals directly - FinalSysSizing(AirLoopNum).DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, FinalSysSizing(AirLoopNum).DesHeatVolFlow); - FinalSysSizing(AirLoopNum).DesMainVolFlow = max(airLoopMaxFlowRateSum, FinalSysSizing(AirLoopNum).DesMainVolFlow); - if (FinalSysSizing(AirLoopNum).sysSizeCoolingDominant) { - FinalSysSizing(AirLoopNum).DesCoolVolFlow = FinalSysSizing(AirLoopNum).DesMainVolFlow; - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; - } else if (FinalSysSizing(AirLoopNum).sysSizeHeatingDominant) { // make sure cooling is at least at minimum. - FinalSysSizing(AirLoopNum).DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesCoolVolFlow); - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + finalSysSizing.DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, finalSysSizing.DesHeatVolFlow); + finalSysSizing.DesMainVolFlow = max(airLoopMaxFlowRateSum, finalSysSizing.DesMainVolFlow); + if (finalSysSizing.sysSizeCoolingDominant) { + finalSysSizing.DesCoolVolFlow = finalSysSizing.DesMainVolFlow; + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + } else if (finalSysSizing.sysSizeHeatingDominant) { // make sure cooling is at least at minimum. + finalSysSizing.DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesCoolVolFlow); + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; } - } else if (FinalSysSizing(AirLoopNum).SizingOption == DataSizing::SizingConcurrence::Coincident) { + } else if (finalSysSizing.SizingOption == DataSizing::SizingConcurrence::Coincident) { - if (FinalSysSizing(AirLoopNum).sysSizeCoolingDominant) { // use minimum heating flow sum from air terminals + if (finalSysSizing.sysSizeCoolingDominant) { // use minimum heating flow sum from air terminals // know that minimum heating flow is a hard minimum regardless of concurrence situation, so make sure that design is at // least that high. - FinalSysSizing(AirLoopNum).DesHeatVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesHeatVolFlow); - FinalSysSizing(AirLoopNum).DesMainVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesMainVolFlow); - FinalSysSizing(AirLoopNum).DesCoolVolFlow = FinalSysSizing(AirLoopNum).DesMainVolFlow; - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; - } else if (FinalSysSizing(AirLoopNum).sysSizeHeatingDominant) { // use maximum heating flow sum from air terminals - FinalSysSizing(AirLoopNum).DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, FinalSysSizing(AirLoopNum).DesHeatVolFlow); - FinalSysSizing(AirLoopNum).DesMainVolFlow = max(airLoopHeatingMaximumFlowRateSum, FinalSysSizing(AirLoopNum).DesMainVolFlow); + finalSysSizing.DesHeatVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesHeatVolFlow); + finalSysSizing.DesMainVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesMainVolFlow); + finalSysSizing.DesCoolVolFlow = finalSysSizing.DesMainVolFlow; + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + } else if (finalSysSizing.sysSizeHeatingDominant) { // use maximum heating flow sum from air terminals + finalSysSizing.DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, finalSysSizing.DesHeatVolFlow); + finalSysSizing.DesMainVolFlow = max(airLoopHeatingMaximumFlowRateSum, finalSysSizing.DesMainVolFlow); // make sure cooling is at least at minimum. - FinalSysSizing(AirLoopNum).DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesCoolVolFlow); - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + finalSysSizing.DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesCoolVolFlow); + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; } } // report out adjusted design flow rates BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Adjusted Heating Design Air Flow Rate [m3/s]", FinalSysSizing(AirLoopNum).DesHeatVolFlow); + state, "AirLoopHVAC", curName, "Adjusted Heating Design Air Flow Rate [m3/s]", finalSysSizing.DesHeatVolFlow); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizAdjustedHtAir, curName, FinalSysSizing(AirLoopNum).DesHeatVolFlow, 4); + state, state.dataOutRptPredefined->pdchSysSizAdjustedHtAir, curName, finalSysSizing.DesHeatVolFlow, 4); BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Adjusted Cooling Design Air Flow Rate [m3/s]", FinalSysSizing(AirLoopNum).DesCoolVolFlow); + state, "AirLoopHVAC", curName, "Adjusted Cooling Design Air Flow Rate [m3/s]", finalSysSizing.DesCoolVolFlow); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizAdjustedClAir, curName, FinalSysSizing(AirLoopNum).DesCoolVolFlow, 4); + state, state.dataOutRptPredefined->pdchSysSizAdjustedClAir, curName, finalSysSizing.DesCoolVolFlow, 4); BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Adjusted Main Design Air Flow Rate [m3/s]", FinalSysSizing(AirLoopNum).DesMainVolFlow); + state, "AirLoopHVAC", curName, "Adjusted Main Design Air Flow Rate [m3/s]", finalSysSizing.DesMainVolFlow); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizAdjustedMainAir, curName, FinalSysSizing(AirLoopNum).DesMainVolFlow, 4); + state, state.dataOutRptPredefined->pdchSysSizAdjustedMainAir, curName, finalSysSizing.DesMainVolFlow, 4); // Autosize central heating min system air flow rate, using corrected design heating flow, using maximum heating flow summation - if (FinalSysSizing(AirLoopNum).SysAirMinFlowRatWasAutoSized) { - if (FinalSysSizing(AirLoopNum).DesMainVolFlow > 0.0) { // protect div by zero - FinalSysSizing(AirLoopNum).SysAirMinFlowRat = - FinalSysSizing(AirLoopNum).DesHeatVolFlow / FinalSysSizing(AirLoopNum).DesMainVolFlow; + if (finalSysSizing.SysAirMinFlowRatWasAutoSized) { + if (finalSysSizing.DesMainVolFlow > 0.0) { // protect div by zero + finalSysSizing.SysAirMinFlowRat = finalSysSizing.DesHeatVolFlow / finalSysSizing.DesMainVolFlow; } else { // big trouble anyway. - FinalSysSizing(AirLoopNum).SysAirMinFlowRat = 1.0; + finalSysSizing.SysAirMinFlowRat = 1.0; } BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Calculated Heating Air Flow Ratio []", FinalSysSizing(AirLoopNum).SysAirMinFlowRat); + state, "AirLoopHVAC", curName, "Calculated Heating Air Flow Ratio []", finalSysSizing.SysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizCalcHeatFlowRatio, curName, FinalSysSizing(AirLoopNum).SysAirMinFlowRat, 4); - BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", FinalSysSizing(AirLoopNum).SysAirMinFlowRat); + state, state.dataOutRptPredefined->pdchSysSizCalcHeatFlowRatio, curName, finalSysSizing.SysAirMinFlowRat, 4); + BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", finalSysSizing.SysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, FinalSysSizing(AirLoopNum).SysAirMinFlowRat, 4); + state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, finalSysSizing.SysAirMinFlowRat, 4); } else { - BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", FinalSysSizing(AirLoopNum).SysAirMinFlowRat); + BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", finalSysSizing.SysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, FinalSysSizing(AirLoopNum).SysAirMinFlowRat, 4); + state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, finalSysSizing.SysAirMinFlowRat, 4); Real64 calcSysAirMinFlowRat(0.0); - if (FinalSysSizing(AirLoopNum).DesMainVolFlow > 0.0) { // protect div by zero - calcSysAirMinFlowRat = FinalSysSizing(AirLoopNum).DesHeatVolFlow / FinalSysSizing(AirLoopNum).DesMainVolFlow; + if (finalSysSizing.DesMainVolFlow > 0.0) { // protect div by zero + calcSysAirMinFlowRat = finalSysSizing.DesHeatVolFlow / finalSysSizing.DesMainVolFlow; } BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "Calculated Heating Air Flow Ratio []", calcSysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( From c44ac2315cc738d10bfba97b08a0fcc8e2cac450 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 02:03:04 -0400 Subject: [PATCH 06/12] reduce --- src/EnergyPlus/SizingManager.cc | 48 ++++++++++++++------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index 63244a626b0..cc9a42c3540 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -2171,11 +2171,9 @@ void GetOARequirements(EnergyPlusData &state) static constexpr std::string_view RoutineName("GetOARequirements: "); // include trailing blank space - int NumAlphas; // Number of Alphas for each GetObjectItem call - int NumNumbers; // Number of Numbers for each GetObjectItem call - int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem - bool ErrorsFound(false); // If errors detected in input + int NumAlphas; // Number of Alphas for each GetObjectItem call + int NumNumbers; // Number of Numbers for each GetObjectItem call + int TotalArgs; // Total number of alpha and numeric arguments (max) for a std::string CurrentModuleObject; // for ease in getting objects Array1D_string Alphas; // Alpha input items for object @@ -2200,6 +2198,8 @@ void GetOARequirements(EnergyPlusData &state) lNumericBlanks.dimension(NumNumbers, true); if (state.dataSize->NumOARequirements > 0) { + int IOStatus; // Used in GetObjectItem + bool ErrorsFound(false); // If errors detected in input state.dataSize->OARequirements.allocate(state.dataSize->NumOARequirements); // Start Loading the System Input @@ -2466,9 +2466,6 @@ void GetZoneAirDistribution(EnergyPlusData &state) int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem - int ZADIndex; - bool ErrorsFound(false); // If errors detected in input std::string CurrentModuleObject; // for ease in getting objects Array1D_string Alphas; // Alpha input items for object @@ -2490,10 +2487,12 @@ void GetZoneAirDistribution(EnergyPlusData &state) lNumericBlanks.dimension(NumNumbers, true); if (state.dataSize->NumZoneAirDistribution > 0) { + int IOStatus; // Used in GetObjectItem + bool ErrorsFound(false); // If errors detected in input state.dataSize->ZoneAirDistribution.allocate(state.dataSize->NumZoneAirDistribution); // Start Loading the zone air distribution input - for (ZADIndex = 1; ZADIndex <= state.dataSize->NumZoneAirDistribution; ++ZADIndex) { + for (int ZADIndex = 1; ZADIndex <= state.dataSize->NumZoneAirDistribution; ++ZADIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -2717,25 +2716,17 @@ void GetZoneSizingInput(EnergyPlusData &state) // Using/Aliasing // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ZoneSizIndex; // loop index int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int NumDesDays; // Number of design days in input int NumSizingZoneStatements; int Item; int Item1; - int ZLItem; bool errFlag; Array1D_string ZoneNames; int NumZones; int NumZoneLists; - int OAIndex; // Index of design specification object - int ObjIndex; // Index of zone air distribution effectiveness object name - bool DesHeatMaxAirFlowPerAreaUsrInp; - bool DesHeatMaxAirFlowUsrInp; - bool DesHeatMaxAirFlowFracUsrInp; struct GlobalMiscObject { @@ -2786,7 +2777,7 @@ void GetZoneSizingInput(EnergyPlusData &state) SizingZoneObjects(Item).Name = state.dataIPShortCut->cAlphaArgs(1); Item1 = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), ZoneNames, NumZones); - ZLItem = 0; + int ZLItem = 0; if (Item1 == 0 && NumZoneLists > 0) ZLItem = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), ZoneListNames); if (Item1 > 0) { SizingZoneObjects(Item).StartPtr = state.dataSize->NumZoneSizingInput + 1; @@ -2818,16 +2809,16 @@ void GetZoneSizingInput(EnergyPlusData &state) } if (state.dataSize->NumZoneSizingInput > 0) { - NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); + int NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); if (NumDesDays == 0 && (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing)) { ShowSevereError(state, "Zone Sizing calculations need SizingPeriod:* input. None found."); ErrorsFound = true; } state.dataSize->ZoneSizingInput.allocate(state.dataSize->NumZoneSizingInput); - ZoneSizIndex = 0; + int ZoneSizIndex = 0; for (Item = 1; Item <= NumSizingZoneStatements; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -3003,7 +2994,8 @@ void GetZoneSizingInput(EnergyPlusData &state) // Getting zone OA parameters from Design Specification object if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - OAIndex = Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).DesignSpecOAObjName, state.dataSize->OARequirements); + int OAIndex = + Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).DesignSpecOAObjName, state.dataSize->OARequirements); if (OAIndex > 0) { state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneDesignSpecOAIndex = OAIndex; } else { @@ -3146,7 +3138,7 @@ void GetZoneSizingInput(EnergyPlusData &state) // \default .002032 // \note default is .40 cfm/ft2 // \note This input is not currently used for autosizing any of the components. - DesHeatMaxAirFlowPerAreaUsrInp = false; + bool DesHeatMaxAirFlowPerAreaUsrInp = false; if (state.dataIPShortCut->lNumericFieldBlanks(14)) { if (state.dataIPShortCut->rNumericArgs(14) <= 0.0) { // in case someone changes the default in the IDD state.dataSize->ZoneSizingInput(ZoneSizIndex).DesHeatMaxAirFlowPerArea = 0.002032; @@ -3171,7 +3163,7 @@ void GetZoneSizingInput(EnergyPlusData &state) // \default .1415762 // \note default is 300 cfm // \note This input is not currently used for autosizing any of the components. - DesHeatMaxAirFlowUsrInp = false; + bool DesHeatMaxAirFlowUsrInp = false; if (state.dataIPShortCut->lNumericFieldBlanks(15)) { if (state.dataIPShortCut->rNumericArgs(15) <= 0.0) { // in case someone changes the default in the IDD state.dataSize->ZoneSizingInput(ZoneSizIndex).DesHeatMaxAirFlow = 0.1415762; @@ -3195,7 +3187,7 @@ void GetZoneSizingInput(EnergyPlusData &state) // \type real // \minimum 0 // \default 0.3 - DesHeatMaxAirFlowFracUsrInp = false; + bool DesHeatMaxAirFlowFracUsrInp = false; if (state.dataIPShortCut->lNumericFieldBlanks(16)) { if (state.dataIPShortCut->rNumericArgs(16) <= 0.0) { // in case someone changes the default in the IDD state.dataSize->ZoneSizingInput(ZoneSizIndex).DesHeatMaxAirFlowFrac = 0.3; @@ -3229,8 +3221,8 @@ void GetZoneSizingInput(EnergyPlusData &state) // A7, \field Zone Air Distribution Object Name and add its inputs if (!state.dataIPShortCut->lAlphaFieldBlanks(7)) { state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneAirDistEffObjName = state.dataIPShortCut->cAlphaArgs(7); - ObjIndex = Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneAirDistEffObjName, - state.dataSize->ZoneAirDistribution); + int ObjIndex = Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneAirDistEffObjName, + state.dataSize->ZoneAirDistribution); if (ObjIndex > 0) { state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneADEffCooling = state.dataSize->ZoneAirDistribution(ObjIndex).ZoneADEffCooling; From 409b251111fc0706610d9f9b709806764d7da3a4 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 02:09:30 -0400 Subject: [PATCH 07/12] reduce --- src/EnergyPlus/SizingManager.cc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index cc9a42c3540..e9ad8de1fb3 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -3517,7 +3517,6 @@ void GetSystemSizingInput(EnergyPlusData &state) int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int NumDesDays; // Number of design days in input auto &SysSizInput = state.dataSize->SysSizInput; @@ -3527,9 +3526,9 @@ void GetSystemSizingInput(EnergyPlusData &state) state.dataSize->NumSysSizInput = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataSize->NumSysSizInput > 0) { - NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); + int NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); if (NumDesDays == 0 && (state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing)) { ShowSevereError(state, "System Sizing calculations need SizingPeriod:* input. None found."); ErrorsFound = true; @@ -4062,15 +4061,14 @@ void GetPlantSizingInput(EnergyPlusData &state) int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int NumDesDays; // Number of design days in input auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Sizing:Plant"; state.dataSize->NumPltSizInput = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataSize->NumPltSizInput > 0) { - NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); + int NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); if (NumDesDays == 0 && state.dataGlobal->DoPlantSizing) { ShowSevereError(state, "Plant Sizing calculations need SizingPeriod:* input"); ErrorsFound = true; @@ -4636,8 +4634,6 @@ void GetZoneHVACSizing(EnergyPlusData &state) int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem - int zSIndex; // index of "DesignSpecification:ZoneHVAC:Sizing" objects bool ErrorsFound(false); // If errors detected in input // REAL(r64) :: CalcAmt @@ -4661,10 +4657,11 @@ void GetZoneHVACSizing(EnergyPlusData &state) lNumericBlanks.dimension(NumNumbers, true); if (state.dataSize->NumZoneHVACSizing > 0) { + int IOStatus; // Used in GetObjectItem state.dataSize->ZoneHVACSizing.allocate(state.dataSize->NumZoneHVACSizing); // Start Loading the System Input - for (zSIndex = 1; zSIndex <= state.dataSize->NumZoneHVACSizing; ++zSIndex) { + for (int zSIndex = 1; zSIndex <= state.dataSize->NumZoneHVACSizing; ++zSIndex) { Alphas = ""; cAlphaFields = ""; @@ -5220,7 +5217,6 @@ void GetAirTerminalSizing(EnergyPlusData &state) int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // If errors detected in input auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "DesignSpecification:AirTerminal:Sizing"; @@ -5228,6 +5224,7 @@ void GetAirTerminalSizing(EnergyPlusData &state) state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); if (state.dataSize->NumAirTerminalSizingSpec > 0) { + int IOStatus; // Used in GetObjectItem state.dataSize->AirTerminalSizingSpec.allocate(state.dataSize->NumAirTerminalSizingSpec); // Start Loading the System Input From 848cde53e59140f483fce7be3eaf5430273c7ec5 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 02:19:36 -0400 Subject: [PATCH 08/12] const --- src/EnergyPlus/SizingManager.cc | 14 +++++++------- src/EnergyPlus/SizingManager.hh | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index e9ad8de1fb3..a54ebf05933 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -734,7 +734,7 @@ void ManageSizing(EnergyPlusData &state) } } -bool CalcdoLoadComponentPulseNow(EnergyPlusData &state, +bool CalcdoLoadComponentPulseNow(EnergyPlusData const &state, bool const isPulseZoneSizing, bool const WarmupFlag, int const HourOfDay, @@ -789,7 +789,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any single duct systems, store 62.1 values by zone if (allocated(sd_airterminal) && state.dataSingleDuct->NumSDAirTerminal > 0) { for (int singleDuctATUNum = 1; singleDuctATUNum <= state.dataSingleDuct->NumSDAirTerminal; ++singleDuctATUNum) { - auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(sd_airterminal(singleDuctATUNum).ADUNum); + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(sd_airterminal(singleDuctATUNum).ADUNum); if (AirLoopNum == sd_airterminal(singleDuctATUNum).AirLoopNum) { int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopMaxFlowRateSum += sd_airterminal(singleDuctATUNum).MaxAirVolFlowRate; @@ -861,7 +861,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) if (allocated(state.dataDualDuct->dd_airterminal) && state.dataDualDuct->NumDDAirTerminal > 0) { for (int dualDuctATUNum = 1; dualDuctATUNum <= state.dataDualDuct->NumDDAirTerminal; ++dualDuctATUNum) { if (AirLoopNum == state.dataDualDuct->dd_airterminal(dualDuctATUNum).AirLoopNum) { - auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(dualDuctATUNum).ADUNum); + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(dualDuctATUNum).ADUNum); int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopMaxFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; state.dataSize->VpzClgByZone(termUnitSizingIndex) = @@ -927,7 +927,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any PIU air terminals if (allocated(state.dataPowerInductionUnits->PIU) && state.dataPowerInductionUnits->NumPIUs > 0) { for (int pIUATUNum = 1; pIUATUNum <= state.dataPowerInductionUnits->NumPIUs; ++pIUATUNum) { - auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataPowerInductionUnits->PIU(pIUATUNum).ADUNum); + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataPowerInductionUnits->PIU(pIUATUNum).ADUNum); if (AirLoopNum == state.dataPowerInductionUnits->PIU(pIUATUNum).AirLoopNum) { int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; auto &thisTermUnitFinalZoneSizing = state.dataSize->TermUnitFinalZoneSizing(termUnitSizingIndex); @@ -1019,7 +1019,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // dual path for std 62.1 if (allocated(IndUnit) && (NumIndUnits > 0)) { for (int indUnitNum = 1; indUnitNum <= NumIndUnits; ++indUnitNum) { - auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(IndUnit(indUnitNum).ADUNum); + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(IndUnit(indUnitNum).ADUNum); if (AirLoopNum == IndUnit(indUnitNum).AirLoopNum) { int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += IndUnit(indUnitNum).MaxPriAirMassFlow / state.dataEnvrn->StdRhoAir; @@ -1041,7 +1041,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any two pipe constant volume cooled beam terminal units if (allocated(state.dataHVACCooledBeam->CoolBeam) && (state.dataHVACCooledBeam->NumCB > 0)) { for (int coolBeamNum = 1; coolBeamNum <= state.dataHVACCooledBeam->NumCB; ++coolBeamNum) { - auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataHVACCooledBeam->CoolBeam(coolBeamNum).ADUNum); + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataHVACCooledBeam->CoolBeam(coolBeamNum).ADUNum); if (AirLoopNum == state.dataHVACCooledBeam->CoolBeam(coolBeamNum).AirLoopNum) { int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += state.dataHVACCooledBeam->CoolBeam(coolBeamNum).MaxAirVolFlow; @@ -1089,7 +1089,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up flows for any air terminal mixers if (allocated(state.dataSingleDuct->SysATMixer) && (state.dataSingleDuct->NumATMixers > 0)) { for (int aTMixerNum = 1; aTMixerNum <= state.dataSingleDuct->NumATMixers; ++aTMixerNum) { - auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->SysATMixer(aTMixerNum).ADUNum); + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->SysATMixer(aTMixerNum).ADUNum); if (AirLoopNum == state.dataSingleDuct->SysATMixer(aTMixerNum).AirLoopNum) { int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += state.dataSingleDuct->SysATMixer(aTMixerNum).DesignPrimaryAirVolRate; diff --git a/src/EnergyPlus/SizingManager.hh b/src/EnergyPlus/SizingManager.hh index edcd461b46d..0d14448a1a6 100644 --- a/src/EnergyPlus/SizingManager.hh +++ b/src/EnergyPlus/SizingManager.hh @@ -81,7 +81,7 @@ namespace SizingManager { void ManageSizing(EnergyPlusData &state); bool CalcdoLoadComponentPulseNow( - EnergyPlusData &state, bool isPulseZoneSizing, bool WarmupFlag, int HourOfDay, int TimeStep, Constant::KindOfSim KindOfSim); + EnergyPlusData const &state, bool isPulseZoneSizing, bool WarmupFlag, int HourOfDay, int TimeStep, Constant::KindOfSim KindOfSim); void ManageSystemSizingAdjustments(EnergyPlusData &state); From e1b13c34e9f596804ea67fbd5531dedf88ea96e3 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 02:31:17 -0400 Subject: [PATCH 09/12] reduce class reference --- src/EnergyPlus/SizingManager.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index a54ebf05933..d1226ca1983 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -2010,7 +2010,6 @@ void ManageSystemVentilationAdjustments(EnergyPlusData &state) void DetermineSystemPopulationDiversity(EnergyPlusData &state) { - auto &FinalSysSizing = state.dataSize->FinalSysSizing; auto &SysSizInput = state.dataSize->SysSizInput; // determine Pz sum, Ps, and D for each air system for standard 62.1 @@ -2018,18 +2017,19 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) // first determine if any airloops use VRP, if not then don't need to march thru year of schedules for performance bool anyVRPinModel(false); for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { - if (FinalSysSizing(AirLoopNum).SystemOAMethod == SysOAMethod::VRP || FinalSysSizing(AirLoopNum).SystemOAMethod == SysOAMethod::SP) { + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + if (finalSysSizing.SystemOAMethod == SysOAMethod::VRP || finalSysSizing.SystemOAMethod == SysOAMethod::SP) { anyVRPinModel = true; break; } } // First get the design (max) level of people in all zones connected to air loop for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { - int SysSizNum = - Util::FindItemInList(FinalSysSizing(AirLoopNum).AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + int SysSizNum = Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable // only retrieve data if the occupant density is set to be autosized - if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (finalSysSizing.OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { auto &pzSumBySys = state.dataSize->PzSumBySys(AirLoopNum); pzSumBySys = 0.0; state.dataSize->PsBySys(AirLoopNum) = 0.0; @@ -2072,10 +2072,11 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) Real64 TSfraction(0.0); if (state.dataGlobal->NumOfTimeStepInHour > 0.0) TSfraction = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { // loop over all the air systems - int SysSizNum = Util::FindItemInList( - FinalSysSizing(AirLoopNum).AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + int SysSizNum = + Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable - if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (finalSysSizing.OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { // Loop over all zones connected to air loop Real64 TotConcurrentPeopleOnSys = 0.0; @@ -2120,8 +2121,8 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) // compute D for standard 62.1 by system for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { - int SysSizNum = - Util::FindItemInList(FinalSysSizing(AirLoopNum).AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + int SysSizNum = Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable // compute D if set to autosize @@ -2144,7 +2145,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) state, format("The {} air loop serves a single zone. The Occupant Diversity was calculated or set to a value less than 1.0. Single-zone air " "loops should have an Occupant Diversity of 1.0. The Occupant Diversity value for that air loop has been reset to 1.0", - FinalSysSizing(AirLoopNum).AirPriLoopName)); + finalSysSizing.AirPriLoopName)); } } } From 32a990f11b951792ecd75e912a31d1098e745da6 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 02:36:03 -0400 Subject: [PATCH 10/12] reduce class reference --- src/EnergyPlus/SizingManager.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index d1226ca1983..c2a9766ca5c 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -2010,8 +2010,6 @@ void ManageSystemVentilationAdjustments(EnergyPlusData &state) void DetermineSystemPopulationDiversity(EnergyPlusData &state) { - auto &SysSizInput = state.dataSize->SysSizInput; - // determine Pz sum, Ps, and D for each air system for standard 62.1 // first determine if any airloops use VRP, if not then don't need to march thru year of schedules for performance @@ -2029,7 +2027,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) int SysSizNum = Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable // only retrieve data if the occupant density is set to be autosized - if (finalSysSizing.OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (finalSysSizing.OAAutoSized && state.dataSize->SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { auto &pzSumBySys = state.dataSize->PzSumBySys(AirLoopNum); pzSumBySys = 0.0; state.dataSize->PsBySys(AirLoopNum) = 0.0; @@ -2076,7 +2074,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) int SysSizNum = Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable - if (finalSysSizing.OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (finalSysSizing.OAAutoSized && state.dataSize->SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { // Loop over all zones connected to air loop Real64 TotConcurrentPeopleOnSys = 0.0; @@ -2126,7 +2124,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable // compute D if set to autosize - if (SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (state.dataSize->SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { if (state.dataSize->PzSumBySys(AirLoopNum) > 0.0) { state.dataSize->DBySys(AirLoopNum) = state.dataSize->PsBySys(AirLoopNum) / state.dataSize->PzSumBySys(AirLoopNum); } else { @@ -2135,7 +2133,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) state.dataSize->DBySys(AirLoopNum) = min(1.0, state.dataSize->DBySys(AirLoopNum)); } else { // set the occupant diversity based on user-specified value - state.dataSize->DBySys(AirLoopNum) = SysSizInput(SysSizNum).OccupantDiversity; + state.dataSize->DBySys(AirLoopNum) = state.dataSize->SysSizInput(SysSizNum).OccupantDiversity; } // For single zone systems, D should be 1.0. From dd3919b00cdd53b8bd1116e1669f840b3d7d1296 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 02:46:27 -0400 Subject: [PATCH 11/12] reduce and const --- src/EnergyPlus/SizingManager.cc | 4 +--- src/EnergyPlus/SizingManager.hh | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index c2a9766ca5c..c040b0f4913 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -3389,9 +3389,7 @@ void GetZoneAndZoneListNames( int NumAlphas; int NumNumbers; int IOStatus; - bool InErrFlag; // Preserve (no current use) the input status of ErrorsFound - InErrFlag = ErrorsFound; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Zone"; NumZones = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); @@ -4544,7 +4542,7 @@ void ReportSysSizing(EnergyPlusData &state, } // convert an index for the timestep of the day into a hour minute string in the format 00:00 -std::string TimeIndexToHrMinString(EnergyPlusData &state, int timeIndex) +std::string TimeIndexToHrMinString(EnergyPlusData const &state, int timeIndex) { int tMinOfDay = timeIndex * state.dataGlobal->MinutesPerTimeStep; int tHr = int(tMinOfDay / 60.); diff --git a/src/EnergyPlus/SizingManager.hh b/src/EnergyPlus/SizingManager.hh index 0d14448a1a6..3a16f84b4bc 100644 --- a/src/EnergyPlus/SizingManager.hh +++ b/src/EnergyPlus/SizingManager.hh @@ -166,7 +166,7 @@ namespace SizingManager { int TimeStepIndex // time step of the peak ); - std::string TimeIndexToHrMinString(EnergyPlusData &state, int timeIndex); + std::string TimeIndexToHrMinString(EnergyPlusData const &state, int timeIndex); void UpdateFacilitySizing(EnergyPlusData &state, Constant::CallIndicator CallIndicator); From f93c075ab829955ba401ea40f398901149e2c0fc Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sun, 20 Oct 2024 03:00:44 -0400 Subject: [PATCH 12/12] cleanup --- src/EnergyPlus/SizingManager.cc | 65 ++++----------------------------- 1 file changed, 7 insertions(+), 58 deletions(-) diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index c040b0f4913..4f5b83f2d5e 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -86,12 +86,9 @@ namespace EnergyPlus::SizingManager { // MODULE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN December 2000 -// MODIFIED na -// RE-ENGINEERED na // PURPOSE OF THIS MODULE: -// This module contains the data and routines relating to managing the sizing -// simulations. +// This module contains the data and routines relating to managing the sizing simulations. // Using/Aliasing using namespace HeatBalanceManager; @@ -2306,8 +2303,6 @@ void ProcessInputOARequirements(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR R. Raustad - FSEC // DATE WRITTEN February 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the OA Requirements object and stores it in @@ -2318,26 +2313,13 @@ void ProcessInputOARequirements(EnergyPlusData &state, // This object requires only a name where the default values are assumed // if subsequent fields are not entered. - // REFERENCES: - // na - using ScheduleManager::CheckScheduleValueMinMax; using ScheduleManager::GetScheduleIndex; using ScheduleManager::GetScheduleMaxValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetOARequirements: "); // include trailing blank space - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - auto &thisOARequirements(state.dataSize->OARequirements(OAIndex)); if (NumAlphas > 1) { @@ -2442,8 +2424,6 @@ void GetZoneAirDistribution(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR T. Hong - LBNL // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the zone air distribution objects and stores it in @@ -2582,8 +2562,6 @@ void GetSizingParams(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN January 2002 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the Sizing Parameters object and stores it in @@ -2592,17 +2570,14 @@ void GetSizingParams(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses InputProcessor "Get" routines to obtain data. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem - int NumSizParams; - int Temp; + auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Sizing:Parameters"; - NumSizParams = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + int NumSizParams = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (NumSizParams == 1) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -2655,7 +2630,7 @@ void GetSizingParams(EnergyPlusData &state) } cCurrentModuleObject = "OutputControl:Sizing:Style"; - Temp = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + int Temp = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (Temp == 0) { state.dataIPShortCut->cAlphaArgs(1) = "Comma"; @@ -2703,17 +2678,11 @@ void GetZoneSizingInput(EnergyPlusData &state) // AUTHOR Fred Buhl // DATE WRITTEN December 2000 // MODIFIED Mangesh Basarkar, 06/2011: Specifying zone outside air based on design specification object - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for zone sizing objects and stores it in // appropriate data structures. - // METHODOLOGY EMPLOYED: - // Uses InputProcessor "Get" routines to obtain data. - - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call @@ -3372,20 +3341,14 @@ void GetZoneAndZoneListNames( // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN October 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Get Zone and ZoneList Names so Sizing:Zone can use global ZoneList. // This is not a full validation of these objects -- only enough to fill // structures for the Sizing:Zone object. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Item; int Found; - int Item1; int NumAlphas; int NumNumbers; int IOStatus; @@ -3395,7 +3358,7 @@ void GetZoneAndZoneListNames( NumZones = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); ZoneNames.allocate(NumZones); - for (Item = 1; Item <= NumZones; ++Item) { + for (int Item = 1; Item <= NumZones; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -3421,7 +3384,7 @@ void GetZoneAndZoneListNames( NumZoneLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); ZoneListNames.allocate(NumZoneLists); - for (Item = 1; Item <= NumZoneLists; ++Item) { + for (int Item = 1; Item <= NumZoneLists; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -3443,7 +3406,7 @@ void GetZoneAndZoneListNames( } ZoneListNames(Item).Zones.allocate(NumAlphas - 1); ZoneListNames(Item).NumOfZones = NumAlphas - 1; - for (Item1 = 2; Item1 <= NumAlphas; ++Item1) { + for (int Item1 = 2; Item1 <= NumAlphas; ++Item1) { Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(Item1), ZoneNames, NumZones); ZoneListNames(Item).Zones(Item1 - 1) = Found; } @@ -3456,8 +3419,6 @@ void GetSystemSizingInput(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN January 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for System Sizing objects and stores it in @@ -3466,8 +3427,6 @@ void GetSystemSizingInput(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses InputProcessor "Get" routines to obtain data. - // Using/Aliasing - // Sizing:System; constexpr int iNameAlphaNum = 1; // A1, \field AirLoop Name constexpr int iLoadTypeSizeAlphaNum = 2; // A2, \field Type of Load to Size On @@ -4040,8 +3999,6 @@ void GetPlantSizingInput(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN October 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for Plant Sizing objects and stores it in @@ -4050,8 +4007,6 @@ void GetPlantSizingInput(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses InputProcessor "Get" routines to obtain data. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PltSizIndex; // loop index int NumAlphas; // Number of Alphas for each GetObjectItem call @@ -4162,8 +4117,6 @@ void SetupZoneSizing(EnergyPlusData &state, bool &ErrorsFound) // SUBROUTINE INFORMATION: // AUTHOR L. Lawrie/F. Buhl // DATE WRITTEN March 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // execute a few (1) time steps of a simulation to facilitate setting up model for zone sizing @@ -4555,8 +4508,6 @@ void GetZoneHVACSizing(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR B. Nigusse - FSEC // DATE WRITTEN July 2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the ZoneHVAC sizing methods object and stores it in @@ -4567,8 +4518,6 @@ void GetZoneHVACSizing(EnergyPlusData &state) // This object requires only a name where the default values are assumed // if subsequent fields are not entered. - // Using/Aliasing - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetZoneHVACSizing: "); // include trailing blank space