From d6a75bc9b3d22d14492726ae6063717789a2ad6e Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Mon, 3 Nov 2025 17:55:01 -0700 Subject: [PATCH 01/33] try running cppcheck on DXCoils, RefrigeratedCase, and SolarShading --- .github/workflows/test_code_integrity.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_code_integrity.yml b/.github/workflows/test_code_integrity.yml index 96083a524b2..fed9898e843 100644 --- a/.github/workflows/test_code_integrity.yml +++ b/.github/workflows/test_code_integrity.yml @@ -178,9 +178,9 @@ jobs: --suppress=unusedFunction:src/EnergyPlus/api/state.cc --suppress=unusedFunction:src/EnergyPlus/Psychrometrics.cc --enable=all - -i EnergyPlus/DXCoils.cc - -i EnergyPlus/RefrigeratedCase.cc - -i EnergyPlus/SolarShading.cc +# -i EnergyPlus/DXCoils.cc +# -i EnergyPlus/RefrigeratedCase.cc +# -i EnergyPlus/SolarShading.cc -j $(nproc) --template='[{file}:{line}]:({severity}),[{id}],{message}' --suppress="uninitvar:*" From 61bc36b4a4e39b520e063f6003874160c18deeef Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Mon, 3 Nov 2025 17:57:25 -0700 Subject: [PATCH 02/33] delete comments? --- .github/workflows/test_code_integrity.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test_code_integrity.yml b/.github/workflows/test_code_integrity.yml index fed9898e843..a5a7ba3aa18 100644 --- a/.github/workflows/test_code_integrity.yml +++ b/.github/workflows/test_code_integrity.yml @@ -178,9 +178,6 @@ jobs: --suppress=unusedFunction:src/EnergyPlus/api/state.cc --suppress=unusedFunction:src/EnergyPlus/Psychrometrics.cc --enable=all -# -i EnergyPlus/DXCoils.cc -# -i EnergyPlus/RefrigeratedCase.cc -# -i EnergyPlus/SolarShading.cc -j $(nproc) --template='[{file}:{line}]:({severity}),[{id}],{message}' --suppress="uninitvar:*" From 270103aed099c6b0d82f5850b566eebd4925d427 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Mon, 3 Nov 2025 18:43:13 -0700 Subject: [PATCH 03/33] clamp so cppcheck doesn't throw containerOutOfBounds errors --- src/EnergyPlus/SolarShading.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 251f6e297f7..5348da78d3c 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -2691,8 +2691,9 @@ void AnisoSkyViewFactors(EnergyPlusData &state) break; } } - F1 = max(0.0, F11R[EpsilonBin] + F12R[EpsilonBin] * Delta + F13R[EpsilonBin] * ZenithAng); - F2 = F21R[EpsilonBin] + F22R[EpsilonBin] * Delta + F23R[EpsilonBin] * ZenithAng; + const auto i = std::clamp(EpsilonBin, 0, static_cast(F11R.size() - 1)); + F1 = max(0.0, F11R[i] + F12R[i] * Delta + F13R[i] * ZenithAng); + F2 = F21R[i] + F22R[i] * Delta + F23R[i] * ZenithAng; for (int SurfNum : s_surf->AllExtSolarSurfaceList) { From 8a4e52144857e7fa07b863355f4028c2a383a709 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 4 Nov 2025 15:54:13 -0700 Subject: [PATCH 04/33] cleanup cppcheck warnings --- src/EnergyPlus/Construction.cc | 4 +++- src/EnergyPlus/DataSurfaces.hh | 17 +++++++++-------- src/EnergyPlus/DaylightingManager.cc | 8 +++++--- src/EnergyPlus/VariableSpeedCoils.cc | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/EnergyPlus/Construction.cc b/src/EnergyPlus/Construction.cc index 046eb82cb94..93fbe3487c5 100644 --- a/src/EnergyPlus/Construction.cc +++ b/src/EnergyPlus/Construction.cc @@ -1190,7 +1190,9 @@ void ConstructionProps::calculateExponentialMatrix() // Note With change to row-major arrays "row" here now means "column" - AMatRowNormMax = 0.0; // Start of Step 1 ... + // Start of Step 1 ... + // set to tiny value to avoid log(0) below + AMatRowNormMax = 1e-12; for (i = 1; i <= this->rcmax; ++i) { diff --git a/src/EnergyPlus/DataSurfaces.hh b/src/EnergyPlus/DataSurfaces.hh index 305dc2617f7..29239906491 100644 --- a/src/EnergyPlus/DataSurfaces.hh +++ b/src/EnergyPlus/DataSurfaces.hh @@ -829,14 +829,15 @@ namespace DataSurfaces { // Default Constructor SurfaceData() - : Construction(0), RepresentativeCalcSurfNum(-1), ConstructionStoredInputValue(0), Class(SurfaceClass::None), Shape(SurfaceShape::None), - Sides(0), Area(0.0), GrossArea(0.0), NetAreaShadowCalc(0.0), Perimeter(0.0), Azimuth(0.0), Height(0.0), Reveal(0.0), Tilt(0.0), - Width(0.0), shapeCat(ShapeCat::Invalid), plane(0.0, 0.0, 0.0, 0.0), Centroid(0.0, 0.0, 0.0), lcsx(0.0, 0.0, 0.0), lcsy(0.0, 0.0, 0.0), - lcsz(0.0, 0.0, 0.0), NewellAreaVector(0.0, 0.0, 0.0), NewellSurfaceNormalVector(0.0, 0.0, 0.0), OutNormVec(0.0, 0.0, 0.0), SinAzim(0.0), - CosAzim(0.0), SinTilt(0.0), CosTilt(0.0), IsConvex(true), IsDegenerate(false), VerticesProcessed(false), XShift(0.0), YShift(0.0), - HeatTransSurf(false), HeatTransferAlgorithm(HeatTransferModel::Invalid), BaseSurf(0), NumSubSurfaces(0), Zone(0), spaceNum(0), - ExtBoundCond(0), ExtSolar(false), ExtWind(false), hasIncSolMultiplier(false), IncSolMultiplier(1.0), ViewFactorGround(0.0), - ViewFactorSky(0.0), ViewFactorGroundIR(0.0), ViewFactorSkyIR(0.0), OSCPtr(0), OSCMPtr(0), MirroredSurf(false), IsShadowing(false), + : Construction(0), RepresentativeCalcSurfNum(-1), ConstructionStoredInputValue(0), Class(SurfaceClass::None), OriginalClass(), + Shape(SurfaceShape::None), Sides(0), Area(0.0), GrossArea(0.0), NetAreaShadowCalc(0.0), Perimeter(0.0), Azimuth(0.0), Height(0.0), + Reveal(0.0), Tilt(0.0), Width(0.0), shapeCat(ShapeCat::Invalid), plane(0.0, 0.0, 0.0, 0.0), Centroid(0.0, 0.0, 0.0), + lcsx(0.0, 0.0, 0.0), lcsy(0.0, 0.0, 0.0), lcsz(0.0, 0.0, 0.0), NewellAreaVector(0.0, 0.0, 0.0), + NewellSurfaceNormalVector(0.0, 0.0, 0.0), OutNormVec(0.0, 0.0, 0.0), SinAzim(0.0), CosAzim(0.0), SinTilt(0.0), CosTilt(0.0), + IsConvex(true), IsDegenerate(false), VerticesProcessed(false), XShift(0.0), YShift(0.0), HeatTransSurf(false), + HeatTransferAlgorithm(HeatTransferModel::Invalid), BaseSurf(0), NumSubSurfaces(0), Zone(0), spaceNum(0), ExtBoundCond(0), + ExtSolar(false), ExtWind(false), hasIncSolMultiplier(false), IncSolMultiplier(1.0), ViewFactorGround(0.0), ViewFactorSky(0.0), + ViewFactorGroundIR(0.0), ViewFactorSkyIR(0.0), OSCPtr(0), OSCMPtr(0), MirroredSurf(false), IsShadowing(false), IsShadowPossibleObstruction(false), IsTransparent(false), SchedMinValue(0.0), activeWindowShadingControl(0), HasShadeControl(false), activeShadedConstruction(0), activeShadedConstructionPrev(0), FrameDivider(0), Multiplier(1.0), SolarEnclIndex(0), SolarEnclSurfIndex(0), IsAirBoundarySurf(false), IsSurfPropertyGndSurfacesDefined(false), SurfPropertyGndSurfIndex(0), diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index bab773206cc..8aff0805659 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -5173,7 +5173,9 @@ Real64 DayltgGlare(EnergyPlusData &state, // REFERENCES: // Based on DOE-2.1E subroutine DGLARE. - Real64 GTOT = 0.0; // Glare constant + // Glare constant + // set tiny to avoid log(0) below + Real64 GTOT = 1e-12; auto &dl = state.dataDayltg; @@ -5192,8 +5194,8 @@ Real64 DayltgGlare(EnergyPlusData &state, GTOT += GTOT1 / (GTOT2 + 0.000001); } - // Glare index (adding 0.000001 prevents LOG10 (0)) - return max(0.0, 10.0 * std::log10(GTOT + 0.000001)); + // Glare index + return max(0.0, 10.0 * std::log10(GTOT)); } void DayltgGlareWithIntWins(EnergyPlusData &state, diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index d375be95d93..45012facaa5 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -943,7 +943,7 @@ namespace VariableSpeedCoils { varSpeedCoil.MSRatedCOP(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_rated_air_flow_rate"); varSpeedCoil.MSRatedAirVolFlowRate(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); - fieldName = fieldName = format("2017_speed_{}{}", std::to_string(I), "_rated_evaporator_fan_power_per_volume_flow_rate"); + fieldName = format("2017_speed_{}{}", std::to_string(I), "_rated_evaporator_fan_power_per_volume_flow_rate"); varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2017(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); fieldName = format("2023_speed_{}{}", std::to_string(I), "_rated_evaporator_fan_power_per_volume_flow_rate"); varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2023(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); From c40ef31cecf2890afbff2ec253786bc37b888e90 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 4 Nov 2025 16:40:09 -0700 Subject: [PATCH 05/33] cppcheck performance fixes --- src/EnergyPlus/HeatBalanceKivaManager.hh | 2 -- src/EnergyPlus/UtilityRoutines.cc | 8 ++++---- src/EnergyPlus/UtilityRoutines.hh | 14 +++++++------- tst/EnergyPlus/unit/TranspiredCollector.unit.cc | 2 +- tst/EnergyPlus/unit/VentilatedSlab.unit.cc | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceKivaManager.hh b/src/EnergyPlus/HeatBalanceKivaManager.hh index 7ad5028494d..94a42f2b318 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.hh +++ b/src/EnergyPlus/HeatBalanceKivaManager.hh @@ -55,8 +55,6 @@ // EnergyPlus Headers #include -#include -#include namespace EnergyPlus { diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index fc98fbef427..6103cd21df6 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -393,10 +393,10 @@ namespace Util { void setDesignObjectNameAndPointer(EnergyPlusData &state, std::string &nameToBeSet, int &ptrToBeSet, - std::string const userName, - Array1S_string const listOfNames, - std::string const itemType, - std::string const itemName, + std::string const &userName, + Array1S_string const &listOfNames, + std::string const &itemType, + std::string const &itemName, bool &errorFound) { nameToBeSet = userName; diff --git a/src/EnergyPlus/UtilityRoutines.hh b/src/EnergyPlus/UtilityRoutines.hh index 5c3cf989ac6..a811845b087 100644 --- a/src/EnergyPlus/UtilityRoutines.hh +++ b/src/EnergyPlus/UtilityRoutines.hh @@ -802,13 +802,13 @@ namespace Util { bool IsNameEmpty(EnergyPlusData &state, std::string &NameToVerify, std::string_view StringToDisplay, bool &ErrorFound); void setDesignObjectNameAndPointer(EnergyPlusData &state, - std::string &nameToBeSet, // field that is being set once a match is found - int &ptrToBeSet, // pointer that is being set once a match is found - std::string const userName, // name to be found searching through the list - Array1S_string const listOfNames, // list of names in which the userName must be found - std::string const itemType, // string containing type of base object - std::string const itemName, // string containing name of base object - bool &errorFound); // set to true if an error is found + std::string &nameToBeSet, // field that is being set once a match is found + int &ptrToBeSet, // pointer that is being set once a match is found + std::string const &userName, // name to be found searching through the list + Array1S_string const &listOfNames, // list of names in which the userName must be found + std::string const &itemType, // string containing type of base object + std::string const &itemName, // string containing name of base object + bool &errorFound); // set to true if an error is found // Two structs for case insensitive containers. // Eg: for unordered_map, we need to have a case insensitive hasher and a case insensitive comparator diff --git a/tst/EnergyPlus/unit/TranspiredCollector.unit.cc b/tst/EnergyPlus/unit/TranspiredCollector.unit.cc index 0710ef94e66..223d0c08101 100644 --- a/tst/EnergyPlus/unit/TranspiredCollector.unit.cc +++ b/tst/EnergyPlus/unit/TranspiredCollector.unit.cc @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -62,7 +63,6 @@ #include #include #include -#include #include #include diff --git a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc index 2c808e270db..24c78024ffc 100644 --- a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc +++ b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc @@ -52,13 +52,13 @@ // EnergyPlus Headers #include +#include #include #include #include #include #include #include -#include #include #include #include From 7e98d3065de631cf8924315ed6cb5dc1627b9148 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Sun, 23 Nov 2025 00:24:05 -0700 Subject: [PATCH 06/33] cppcheck style_variableScope --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 2 +- src/EnergyPlus/Autosizing/Base.cc | 2 +- src/EnergyPlus/BaseboardElectric.cc | 4 +- src/EnergyPlus/DXCoils.cc | 78 ++++++------ src/EnergyPlus/DataHeatBalance.cc | 2 +- src/EnergyPlus/DemandManager.cc | 5 +- src/EnergyPlus/DuctLoss.cc | 9 +- src/EnergyPlus/EconomicTariff.cc | 15 +-- src/EnergyPlus/ElectricPowerServiceManager.cc | 9 +- src/EnergyPlus/EvaporativeCoolers.cc | 2 +- src/EnergyPlus/HVACUnitaryBypassVAV.cc | 2 +- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 2 +- src/EnergyPlus/HWBaseboardRadiator.cc | 3 +- src/EnergyPlus/HeatBalanceHAMTManager.cc | 4 +- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 2 +- src/EnergyPlus/HybridModel.cc | 3 +- src/EnergyPlus/ICEngineElectricGenerator.cc | 4 +- src/EnergyPlus/IndoorGreen.cc | 2 +- .../InputProcessing/InputProcessor.cc | 2 +- src/EnergyPlus/MicroCHPElectricGenerator.cc | 3 +- .../MicroturbineElectricGenerator.cc | 3 +- src/EnergyPlus/OutAirNodeManager.cc | 19 ++- src/EnergyPlus/OutdoorAirUnit.cc | 6 +- src/EnergyPlus/OutputReportTabular.cc | 2 +- src/EnergyPlus/OutputReports.cc | 2 +- .../PhotovoltaicThermalCollectors.cc | 10 +- .../PlantHeatExchangerFluidToFluid.cc | 1 + src/EnergyPlus/PlantLoopHeatPumpEIR.cc | 15 ++- src/EnergyPlus/PurchasedAirManager.cc | 5 +- src/EnergyPlus/RefrigeratedCase.cc | 113 ++++++++---------- src/EnergyPlus/RoomAirModelManager.cc | 2 +- src/EnergyPlus/RuntimeLanguageProcessor.cc | 93 ++++++-------- src/EnergyPlus/WaterToAirHeatPump.cc | 4 +- src/EnergyPlus/WindowAC.cc | 2 +- 34 files changed, 186 insertions(+), 246 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 8cc694b81ea..39c986d513e 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -1657,7 +1657,6 @@ namespace AirflowNetwork { int count; bool NodeFound; bool found; - int NumAPL; Array1D_string CompName(2); std::string SimAirNetworkKey; @@ -2030,6 +2029,7 @@ namespace AirflowNetwork { // Check the number of primary air loops if (!simulation_control.DuctLoss) { + int NumAPL; if (distribution_simulated) { NumAPL = m_state.dataInputProcessing->inputProcessor->getNumObjectsFound(m_state, "AirLoopHVAC"); if (NumAPL > 0) { diff --git a/src/EnergyPlus/Autosizing/Base.cc b/src/EnergyPlus/Autosizing/Base.cc index f4a725e9f2f..806d3c15484 100644 --- a/src/EnergyPlus/Autosizing/Base.cc +++ b/src/EnergyPlus/Autosizing/Base.cc @@ -772,11 +772,11 @@ void BaseSizer::calcCoilWaterFlowRates(EnergyPlusData &state, } } auto &plntComps = state.dataPlnt->PlantLoop(loopNum).plantCoilObjectNames; - auto &cmpType = state.dataPlnt->PlantLoop(loopNum).plantCoilObjectTypes; int arrayIndex = -1; // check if component has been added to array if (plntComps.size() > 0) { for (size_t i = 0; i < plntComps.size(); ++i) { + auto &cmpType = state.dataPlnt->PlantLoop(loopNum).plantCoilObjectTypes; if (plntComps[i] == compName && cmpType[i] == static_cast(getEnumValue(DataPlant::PlantEquipTypeNames, compType))) { arrayIndex = i; diff --git a/src/EnergyPlus/BaseboardElectric.cc b/src/EnergyPlus/BaseboardElectric.cc index d37ece2fb94..8cb56193336 100644 --- a/src/EnergyPlus/BaseboardElectric.cc +++ b/src/EnergyPlus/BaseboardElectric.cc @@ -175,8 +175,6 @@ namespace BaseboardElectric { int constexpr iHeatFracOfAutosizedCapacityNumericNum( 3); // get input index to baseboard heating capacity sizing as fraction of autosized heating capacity - auto &s_ipsc = state.dataIPShortCut; - auto &baseboard = state.dataBaseboardElectric; std::string_view cCurrentModuleObject = cCMO_BBRadiator_Electric; @@ -191,7 +189,7 @@ namespace BaseboardElectric { int IOStat = 0; int BaseboardNum = 0; for (int ConvElecBBNum = 1; ConvElecBBNum <= NumConvElecBaseboards; ++ConvElecBBNum) { - + auto &s_ipsc = state.dataIPShortCut; state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, ConvElecBBNum, diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index b0e67944802..83993a2d492 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -393,10 +393,7 @@ void SimDXCoilMultiMode(EnergyPlusData &state, static constexpr std::string_view RoutineName("SimDXCoilMultiMode"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int DXCoilNum; // index of coil being simulated - int PerfMode; // Performance mode for MultiMode DX coil; Always 1 for other coil types - // 1-2=normal mode: 1=stage 1 only, 2=stage 1&2 - // 3-4=enhanced dehumidification mode: 3=stage 1 only, 4=stage 1&2 + int DXCoilNum; // index of coil being simulated Real64 AirMassFlow; // Dry air mass flow rate through coil [kg/s] Real64 S1OutletAirTemp; // Stage 1 Outlet air dry bulb temp [C] @@ -498,6 +495,10 @@ void SimDXCoilMultiMode(EnergyPlusData &state, S12EvapWaterConsumpRate = 0.0; S12EvapCondPumpElecPower = 0.0; + int PerfMode; // Performance mode for MultiMode DX coil; Always 1 for other coil types + // 1-2=normal mode: 1=stage 1 only, 2=stage 1&2 + // 3-4=enhanced dehumidification mode: 3=stage 1 only, 4=stage 1&2 + thisDXCoil.DehumidificationMode = DehumidMode; if ((int)DehumidMode > thisDXCoil.NumDehumidModes) { ShowFatalError(state, @@ -750,7 +751,6 @@ void GetDXCoils(EnergyPlusData &state) int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes int PerfModeNum; // Performance mode index int PerfObjectNum; // Item number for performance object - int AlphaIndex; // Index for current alpha field std::string CurrentModuleObject; // Object type for getting and error messages std::string PerfObjectType; // Performance object type for getting and error messages std::string PerfObjectName; // Performance object name for getting and error messages @@ -1493,7 +1493,8 @@ void GetDXCoils(EnergyPlusData &state) } // Set starting alpha index for coil performance inputs - AlphaIndex = 6; + + int AlphaIndex = 6; // Index for current alpha field // allocate performance modes for numeric field strings used for sizing routine state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate( thisDXCoil.NumDehumidModes * 2 + thisDXCoil.NumCapacityStages * 2); // not sure this math is correct, ask MW @@ -2997,12 +2998,12 @@ void GetDXCoils(EnergyPlusData &state) auto &s_ip = state.dataInputProcessing->inputProcessor; auto const instances_whPumped = s_ip->epJSON.find(CurrentModuleObject); if (instances_whPumped != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_whPumped.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { ++DXCoilNum; + std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); @@ -3524,12 +3525,12 @@ void GetDXCoils(EnergyPlusData &state) CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterWrapped); auto const instances_whWrapped = s_ip->epJSON.find(CurrentModuleObject); if (instances_whWrapped != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_whWrapped.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { ++DXCoilNum; + std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); @@ -6774,13 +6775,8 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur Real64 RatedHeatPumpIndoorHumRat; // Inlet humidity ratio to heat pump evaporator at rated conditions [kgWater/kgDryAir] Real64 RatedVolFlowPerRatedTotCap; // Rated Air Volume Flow Rate divided by Rated Total Capacity [m3/s-W) Real64 HPInletAirHumRat; // Rated inlet air humidity ratio for heat pump water heater [kgWater/kgDryAir] - bool ErrorsFound(false); // TRUE when errors found - int CapacityStageNum; // Loop index for 1,Number of capacity stages - int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes int Mode; // Performance mode for MultiMode DX coil; Always 1 for other coil types - int DXCoilNumTemp; // Counter for crankcase heater report variable DO loop int AirInletNode; // Air inlet node number - int SpeedNum; // Speed number for multispeed coils if (state.dataDXCoils->MyOneTimeFlag) { // initialize the environment and sizing flags @@ -6846,6 +6842,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur state.dataDXCoils->MyEnvrnFlag(DXCoilNum)) { if (thisDXCoil.FuelType != Constant::eFuel::Electricity) { if (thisDXCoil.MSHPHeatRecActive) { + int SpeedNum; // Speed number for multispeed coils for (SpeedNum = 1; SpeedNum <= thisDXCoil.NumOfSpeeds; ++SpeedNum) { if (thisDXCoil.MSWasteHeat(SpeedNum) == 0) { ShowWarningError( @@ -6882,6 +6879,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur if (state.dataDXCoils->CrankcaseHeaterReportVarFlag) { if (state.dataAirLoop->AirLoopInputsFilled) { // Set report variables for DX cooling coils that will have a crankcase heater (all DX coils not used in a HP AC unit) + int DXCoilNumTemp; // Counter for crankcase heater report variable DO loop for (DXCoilNumTemp = 1; DXCoilNumTemp <= state.dataDXCoils->NumDXCoils; ++DXCoilNumTemp) { auto &dXCoil_withCrankCase = state.dataDXCoils->DXCoil(DXCoilNumTemp); if ((dXCoil_withCrankCase.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) || @@ -6917,6 +6915,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur // for each coil, do the sizing once. SizeDXCoil(state, DXCoilNum); state.dataDXCoils->MySizeFlag(DXCoilNum) = false; + bool ErrorsFound(false); // TRUE when errors found if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Cooling || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { @@ -7039,7 +7038,9 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { + int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes for (DehumidModeNum = 0; DehumidModeNum <= thisDXCoil.NumDehumidModes; ++DehumidModeNum) { + int CapacityStageNum; // Loop index for 1,Number of capacity stages for (CapacityStageNum = 1; CapacityStageNum <= thisDXCoil.NumCapacityStages; ++CapacityStageNum) { Mode = DehumidModeNum * 2 + CapacityStageNum; // Check for zero capacity or zero max flow rate @@ -7396,11 +7397,10 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) static constexpr std::string_view RoutineName("SizeDXCoil"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 CoilInTemp; // DX coil inlet temperature - int CapacityStageNum; // Loop index for 1,Number of capacity stages - int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes - int Mode; // Operating mode for MultiMode DX coil; Always 1 for other coil types - int NumOfSpeedCompanion; // Number of speed for a companion cooling coil (Multispeed HO heating coil only + Real64 CoilInTemp; // DX coil inlet temperature + int CapacityStageNum; // Loop index for 1,Number of capacity stages + int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes + int Mode; // Operating mode for MultiMode DX coil; Always 1 for other coil types std::string equipName; Real64 DefrostCapacityDes; // Design defrost heater capacity for reporting Real64 DefrostCapacityUser; // Hard-sized defrost heater capacity for reporting @@ -8496,6 +8496,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) PrintFlag = false; state.dataSize->DataFractionUsedForSizing = 1.0; if (thisDXCoil.CompanionUpstreamDXCoil > 0) { + int NumOfSpeedCompanion; // Number of speed for a companion cooling coil (Multispeed HO heating coil only) NumOfSpeedCompanion = state.dataDXCoils->DXCoil(thisDXCoil.CompanionUpstreamDXCoil).NumOfSpeeds; state.dataSize->DataConstantUsedForSizing = state.dataDXCoils->DXCoil(thisDXCoil.CompanionUpstreamDXCoil).MSRatedTotCapDes(NumOfSpeedCompanion); @@ -11946,16 +11947,14 @@ void CalcBasinHeaterPowerForMultiModeDXCoil(EnergyPlusData &state, // b) Elseif the CondenserType for stage 2 is EvapCooled, then the basin heater power is calculated for // (1-runtimefractionofstage2) of DX coil - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PerfMode; // Performance mode for MultiMode DX coil; Always 1 for other coil types - // 1-2=normal mode: 1=stage 1 only, 2=stage 1&2 - // 3-4=enhanced dehumidification mode: 3=stage 1 only, 4=stage 1&2 - auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); if (thisDXCoil.NumCapacityStages == 1) { thisDXCoil.BasinHeaterPower *= (1.0 - thisDXCoil.CoolingCoilRuntimeFraction); } else { + int PerfMode; // Performance mode for MultiMode DX coil; Always 1 for other coil types + // 1-2=normal mode: 1=stage 1 only, 2=stage 1&2 + // 3-4=enhanced dehumidification mode: 3=stage 1 only, 4=stage 1&2 PerfMode = (int)DehumidMode * 2 + 1; if (thisDXCoil.CondenserType(PerfMode) == DataHeatBalance::RefrigCondenserType::Evap) { thisDXCoil.BasinHeaterPower *= (1.0 - thisDXCoil.CoolingCoilRuntimeFraction); @@ -12059,8 +12058,6 @@ Real64 CalcCBF(EnergyPlusData &state, Real64 OutletAirRH; // relative humidity of the outlet air Real64 Error; // Error term used in given coil bypass factor (CBF) calculations Real64 ErrorLast; // Error term, from previous iteration - int Iter; // Iteration loop counter in CBF calculations - int IterMax(50); // Maximum number of iterations in CBF calculations Real64 ADPTemp; // Apparatus dewpoint temperature used in CBF calculations [C] Real64 ADPHumRat; // Apparatus dewpoint humidity used in CBF calculations [kg/kg] Real64 ADPEnthalpy; // Air enthalpy at apparatus dew point [J/kg] @@ -12207,9 +12204,10 @@ Real64 CalcCBF(EnergyPlusData &state, // Pressure will have to be pass into this subroutine to fix this one ADPTemp = PsyTdpFnWPb(state, OutletAirHumRat, DataEnvironment::StdPressureSeaLevel); + int Iter = 0; // Iteration loop counter in CBF calculations + int IterMax(50); // Maximum number of iterations in CBF calculations Tolerance = 1.0; // initial conditions for iteration ErrorLast = 100.0; - Iter = 0; DeltaADPTemp = 5.0; while ((Iter <= IterMax) && (Tolerance > 0.001)) { // Do for IterMax iterations or until the error gets below .1% @@ -14606,7 +14604,6 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum Real64 EIR_LowSpeed; int FanInletNode; int FanOutletNode; - int Iter; Real64 ExternalStatic; Real64 FanStaticPressureRise; Real64 FanHeatCorrection; @@ -14627,8 +14624,6 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum Real64 RunTimeFraction; Real64 LowerBoundMassFlowRate; int PartLoadTestPoint; - int countStaticInputs; - int index; // Formats static constexpr std::string_view Header( @@ -14667,7 +14662,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum TotCapFlowModFac = CurveValue(state, thisDXCoil.CCapFFlow(1), AirMassFlowRatioRated); TotCapTempModFac = CurveValue(state, thisDXCoil.CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); - for (Iter = 1; Iter <= 4; ++Iter) { // iterative solution in the event that net capacity is near a threshold for external static + for (int Iter = 1; Iter <= 4; ++Iter) { // iterative solution in the event that net capacity is near a threshold for external static // Obtain external static pressure from Table 5 in ANSI/AHRI Std. 340/360-2007 if (NetCoolingCapRated <= 21000.0) { ExternalStatic = 50.0; @@ -14778,13 +14773,12 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum int fanInNode = 0; int fanOutNode = 0; Real64 externalStatic = 0.0; - int fanIndex = 0; if (thisDXCoil.RateWithInternalStaticAndFanObject) { par7 = 0.0; fanInNode = FanInletNode; fanOutNode = FanOutletNode; externalStatic = ExternalStatic; - fanIndex = thisDXCoil.SupplyFanIndex; + int fanIndex = thisDXCoil.SupplyFanIndex; } LowerBoundMassFlowRate = 0.01 * thisDXCoil.RatedAirMassFlowRate(1); @@ -15083,8 +15077,8 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "Supply Air Flow 25% [kg/s]"); // determine footnote content - countStaticInputs = 0; - for (index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { + int countStaticInputs = 0; + for (int index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { auto &dxCoil_temp = state.dataDXCoils->DXCoil(index); if (dxCoil_temp.RateWithInternalStaticAndFanObject && dxCoil_temp.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { ++countStaticInputs; @@ -16427,10 +16421,6 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) Real64 SecCoilFlowFraction; // secondary coil flow fraction, is 1.0 for single speed machine Real64 TotalHeatRemovalRate; // secondary coil total heat removal rate Real64 TotalHeatRejectionRate; // secondary coil total heat rejection rate - int SecCoilSHRFT; // index of the SHR modifier curve for temperature of a secondary DX coil - int SecCoilSHRFF; // index of the sHR modifier curve for flow fraction of a secondary DX coil - int MSSpeedNumLS; // current low speed number of multispeed HP - int MSSpeedNumHS; // current high speed number of multispeed HP Real64 MSSpeedRatio; // current speed ratio of multispeed HP Real64 MSCycRatio; // current cycling ratio of multispeed HP Real64 SHRHighSpeed; // sensible heat ratio at high speed @@ -16443,6 +16433,10 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); // Select the correct unit type + int SecCoilSHRFT; // index of the SHR modifier curve for temperature of a secondary DX coil + int SecCoilSHRFF; // index of the sHR modifier curve for flow fraction of a secondary DX coil + int MSSpeedNumLS; // current low speed number of multispeed HP + int MSSpeedNumHS; // current high speed number of multispeed HP switch (thisDXCoil.DXCoilType_Num) { case HVAC::CoilDX_CoolingSingleSpeed: case HVAC::CoilDX_CoolingTwoSpeed: @@ -16705,8 +16699,6 @@ Real64 CalcSecondaryDXCoilsSHR(EnergyPlusData &state, Real64 wADP; // humidity ratio of air at secondary coil at ADP Real64 HumRatError; // humidity ratio error bool CoilMightBeDry; // TRUE means the secondary DX coil runs dry - int Counter; // iteration counter - bool Converged; // convergence flag Real64 SHR; // current time step sensible heat ratio of secondary coil CoilMightBeDry = false; @@ -16717,8 +16709,8 @@ Real64 CalcSecondaryDXCoilsSHR(EnergyPlusData &state, // find wADP, humidity ratio at apparatus dewpoint and inlet hum rat that would have dry coil DryCoilTestEvapInletHumRat = EvapInletHumRat; DryCoilTestEvapInletWetBulb = EvapInletWetBulb; - Counter = 0; - Converged = false; + int Counter = 0; // iteration counter + bool Converged = false; // convergence flag while (!Converged) { // assumes coil bypass factor (CBF) = 0.0 hADP = EvapInletEnthalpy - (TotalHeatRemovalRate / PartLoadRatio) / EvapAirMassFlow; @@ -17897,7 +17889,6 @@ void CalcVRFCoilCapModFac(EnergyPlusData &state, // A new physics based VRF model applicable for Fluid Temperature Control. // - bool ErrorsFound(false); // Flag for errors int constexpr FlagCoolMode(0); // Flag for cooling mode int constexpr FlagHeatMode(1); // Flag for heating mode Real64 constexpr SH_rate(3); // Super heating at cooling mode, default 3(C) @@ -17917,6 +17908,7 @@ void CalcVRFCoilCapModFac(EnergyPlusData &state, if (present(CoilIndex)) { CoilNum = CoilIndex; } else { + bool ErrorsFound(false); // Flag for errors GetDXCoilIndex(state, CoilName, CoilNum, ErrorsFound, "", true); } diff --git a/src/EnergyPlus/DataHeatBalance.cc b/src/EnergyPlus/DataHeatBalance.cc index 5f1136467c7..3d414f53efb 100644 --- a/src/EnergyPlus/DataHeatBalance.cc +++ b/src/EnergyPlus/DataHeatBalance.cc @@ -806,7 +806,6 @@ int AssignReverseConstructionNumber(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Create reverse layers. Look in current constructions to see if match. If no match, create a new one. - auto &s_mat = state.dataMaterial; // Return value int NewConstrNum; // Reverse Construction Number @@ -864,6 +863,7 @@ int AssignReverseConstructionNumber(EnergyPlusData &state, for (nLayer = 1; nLayer <= Construction::MaxLayersInConstruct; ++nLayer) { state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).LayerPoint(nLayer) = state.dataConstruction->LayerPoint(nLayer); if (state.dataConstruction->LayerPoint(nLayer) != 0) { + auto &s_mat = state.dataMaterial; state.dataHeatBal->NominalRforNominalUCalculation(state.dataHeatBal->TotConstructs) += s_mat->materials(state.dataConstruction->LayerPoint(nLayer))->NominalR; } diff --git a/src/EnergyPlus/DemandManager.cc b/src/EnergyPlus/DemandManager.cc index efac0797c07..eb26e94fce5 100644 --- a/src/EnergyPlus/DemandManager.cc +++ b/src/EnergyPlus/DemandManager.cc @@ -316,7 +316,6 @@ void GetDemandManagerListInput(EnergyPlusData &state) static constexpr std::string_view routineName = "GetDemandManagerListInput"; constexpr std::string_view cCurrentModuleObject = "DemandManagerAssignmentList"; - auto &s_ipsc = state.dataIPShortCut; auto const &s_ip = state.dataInputProcessing->inputProcessor; state.dataDemandManager->NumDemandManagerList = s_ip->getNumObjectsFound(state, cCurrentModuleObject); @@ -332,7 +331,7 @@ void GetDemandManagerListInput(EnergyPlusData &state) for (int ListNum = 1; ListNum <= state.dataDemandManager->NumDemandManagerList; ++ListNum) { auto &thisDemandMgrList = state.dataDemandManager->DemandManagerList(ListNum); - + auto &s_ipsc = state.dataIPShortCut; s_ip->getObjectItem(state, cCurrentModuleObject, ListNum, @@ -544,7 +543,6 @@ void GetDemandManagerInput(EnergyPlusData &state) static constexpr std::string_view routineName = "GetDemandManagerInput"; - auto &s_ipsc = state.dataIPShortCut; auto const &s_ip = state.dataInputProcessing->inputProcessor; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -602,6 +600,7 @@ void GetDemandManagerInput(EnergyPlusData &state) AlphArray.dimension(MaxAlphas, std::string()); NumArray.dimension(MaxNums, 0.0); int IOStat; // IO Status when calling get input subroutine + auto &s_ipsc = state.dataIPShortCut; DemandMgr.allocate(state.dataDemandManager->NumDemandMgr); state.dataDemandManager->UniqueDemandMgrNames.reserve(state.dataDemandManager->NumDemandMgr); diff --git a/src/EnergyPlus/DuctLoss.cc b/src/EnergyPlus/DuctLoss.cc index 8dffbb74bb5..869615b79f0 100644 --- a/src/EnergyPlus/DuctLoss.cc +++ b/src/EnergyPlus/DuctLoss.cc @@ -597,7 +597,6 @@ namespace DuctLoss { Real64 CpAir; int NodeNum1; int NodeNum2; - int NodeNum; NodeNum1 = state.afn->AirflowNetworkLinkageData(this->LinkageNum).NodeNums[0]; NodeNum2 = state.afn->AirflowNetworkLinkageData(this->LinkageNum).NodeNums[1]; @@ -660,7 +659,7 @@ namespace DuctLoss { state.afn->AirflowNetworkNodeSimu(NodeNum2).WZ = Wout; } break; case DuctLossSubType::RetLeakBranch: { - NodeNum = state.afn->DisSysNodeData(NodeNum2).EPlusNodeNum; + int NodeNum = state.afn->DisSysNodeData(NodeNum2).EPlusNodeNum; MassFlowRate = state.dataLoopNodes->Node(NodeNum).MassFlowRate; Tout = state.dataLoopNodes->Node(this->RetLeakZoneNum).Temp * (1.0 - LeakRatio) + state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.afn->AirflowNetworkNodeData(NodeNum1).EPlusZoneNum).MAT * LeakRatio; @@ -718,14 +717,12 @@ namespace DuctLoss { void InitDuctLoss(EnergyPlusData &state) { - bool errorsFound(false); - std::string CurrentModuleObject; - if (state.dataDuctLoss->AirLoopConnectionFlag) { + bool errorsFound(false); for (int DuctLossNum = 1; DuctLossNum <= state.dataDuctLoss->NumOfDuctLosses; DuctLossNum++) { auto &thisDuctLoss(state.dataDuctLoss->ductloss(DuctLossNum)); - + std::string CurrentModuleObject; thisDuctLoss.AirLoopNum = Util::FindItemInList(thisDuctLoss.AirLoopName, state.dataAirSystemsData->PrimaryAirSystems); if (thisDuctLoss.LossType == DuctLossType::Conduction) { CurrentModuleObject = cCMO_DuctLossConduction; diff --git a/src/EnergyPlus/EconomicTariff.cc b/src/EnergyPlus/EconomicTariff.cc index 83ba21e322f..67b427722b5 100644 --- a/src/EnergyPlus/EconomicTariff.cc +++ b/src/EnergyPlus/EconomicTariff.cc @@ -1921,7 +1921,6 @@ void warnIfNativeVarname( // Issue a warning if the variable name (usually the object name) is // one of the names of native variables - auto &s_econ = state.dataEconTariff; bool throwError = false; if (getEnumValue(nativeNamesUC, objName) != -1) { @@ -1931,6 +1930,7 @@ void warnIfNativeVarname( } if (throwError) { + auto &s_econ = state.dataEconTariff; ErrorsFound = true; if (curTariffIndex >= 1 && curTariffIndex <= s_econ->numTariff) { ShowSevereError(state, format("UtilityCost:Tariff=\"{}\" invalid referenced name", s_econ->tariff(curTariffIndex).tariffName)); @@ -1958,10 +1958,10 @@ int AssignVariablePt(EnergyPlusData &state, // the variable using the string as its name. // Return the index of the variable. - auto &s_econ = state.dataEconTariff; int AssignVariablePt; if (flagIfNotNumeric && (len(stringIn) >= 1)) { + auto &s_econ = state.dataEconTariff; std::string inNoSpaces = RemoveSpaces(state, stringIn); int found = 0; if (allocated(s_econ->econVar)) { @@ -2446,9 +2446,9 @@ void addOperand(EnergyPlusData &state, int const varMe, int const varOperand) // relationship in the EconVar array int constexpr sizeIncrement(100); - auto &s_econ = state.dataEconTariff; if (varOperand != 0) { + auto &s_econ = state.dataEconTariff; // increment the numOperand and allocate/reallocate the array // if necessary if (!allocated(s_econ->operands)) { @@ -3865,11 +3865,10 @@ void LEEDtariffReporting(EnergyPlusData &state) DemandWindow distHeatSteamDemWindowUnits; DemandWindow othrDemWindowUnits; - auto &s_orp = state.dataOutRptPredefined; - auto &s_econ = state.dataEconTariff; if (s_econ->numTariff > 0) { + auto &s_orp = state.dataOutRptPredefined; int distCoolFacilMeter = GetMeterIndex(state, "DISTRICTCOOLING:FACILITY"); int distHeatWaterFacilMeter = GetMeterIndex(state, "DISTRICTHEATINGWATER:FACILITY"); int distHeatSteamFacilMeter = GetMeterIndex(state, "DISTRICTHEATINGSTEAM:FACILITY"); @@ -4086,9 +4085,8 @@ void WriteTabularTariffReports(EnergyPlusData &state) } if (s_econ->numTariff > 0) { - auto &econVar = s_econ->econVar; - if (state.dataOutRptTab->displayEconomicResultSummary) { + auto &econVar = s_econ->econVar; DisplayString(state, "Writing Tariff Reports"); showWarningsBasedOnTotal(state); //--------------------------------- @@ -4545,7 +4543,6 @@ void ReportEconomicVariable(EnergyPlusData &state, Real64 curVal; int curIndex; int curCatPt; - int curCategory; int iVar; int jMonth; @@ -4622,7 +4619,7 @@ void ReportEconomicVariable(EnergyPlusData &state, tableBody(14, nCntOfVar) = OutputReportTabular::RealToStr(style.formatReals, maximumVal, 2); if (includeCategory) { // first find category - curCategory = 0; + int curCategory = 0; curIndex = econVar(iVar).index; switch (econVar(iVar).kindOfObj) { diff --git a/src/EnergyPlus/ElectricPowerServiceManager.cc b/src/EnergyPlus/ElectricPowerServiceManager.cc index 8237bd39795..dac77c90289 100644 --- a/src/EnergyPlus/ElectricPowerServiceManager.cc +++ b/src/EnergyPlus/ElectricPowerServiceManager.cc @@ -209,8 +209,6 @@ void ElectricPowerServiceManager::getPowerManagerInput(EnergyPlusData &state) { static constexpr std::string_view routineName = "ElectricPowerServiceManager::getPowerManagerInput "; - auto &s_ipsc = state.dataIPShortCut; - numLoadCenters_ = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ElectricLoadCenter:Distribution"); if (numLoadCenters_ > 0) { @@ -272,6 +270,7 @@ void ElectricPowerServiceManager::getPowerManagerInput(EnergyPlusData &state) int numNums; // Number of elements in the numeric array int iOStat; // IO Status when calling get input subroutine bool foundInFromGridTransformer = false; + auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Transformer"; for (int loopTransformer = 1; loopTransformer <= numTransformers_; ++loopTransformer) { @@ -2072,8 +2071,6 @@ GeneratorController::GeneratorController(EnergyPlusData &state, static constexpr std::string_view routineName = "GeneratorController constructor "; - auto &s_ipsc = state.dataIPShortCut; - ErrorObjectHeader eoh{routineName, objectType, objectName}; name = objectName; @@ -2131,6 +2128,7 @@ GeneratorController::GeneratorController(EnergyPlusData &state, break; } default: { + auto &s_ipsc = state.dataIPShortCut; ShowSevereError(state, format("{}{} invalid entry.", routineName, s_ipsc->cCurrentModuleObject)); ShowContinueError(state, format("Invalid {} associated with generator = {}", objectType, objectName)); break; @@ -2830,8 +2828,6 @@ ACtoDCConverter::ACtoDCConverter(EnergyPlusData &state, std::string const &objec static constexpr std::string_view routineName = "ACtoDCConverter constructor "; - auto &s_ipsc = state.dataIPShortCut; - bool errorsFound = false; // if/when add object class name to input object this can be simplified. for now search all possible types @@ -2841,6 +2837,7 @@ ACtoDCConverter::ACtoDCConverter(EnergyPlusData &state, std::string const &objec int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine + auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Storage:Converter"; state.dataInputProcessing->inputProcessor->getObjectItem(state, diff --git a/src/EnergyPlus/EvaporativeCoolers.cc b/src/EnergyPlus/EvaporativeCoolers.cc index 1a21df9465c..9acc407d221 100644 --- a/src/EnergyPlus/EvaporativeCoolers.cc +++ b/src/EnergyPlus/EvaporativeCoolers.cc @@ -1182,7 +1182,6 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum) bool HardSizeNoDesRun = !((state.dataSize->SysSizingRunDone || state.dataSize->ZoneSizingRunDone)); bool SizingDesRunThisAirSys = false; // true if a particular air system had a Sizing:System object and system sizing done - bool SizingDesRunThisZone = false; // true if a particular zone had a Sizing:Zone object and zone sizing was done if (CurSysNum > 0) { CheckThisAirSystemForSizing(state, CurSysNum, SizingDesRunThisAirSys); @@ -1191,6 +1190,7 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum) } } if (CurZoneEqNum > 0) { + bool SizingDesRunThisZone = false; // true if a particular zone had a Sizing:Zone object and zone sizing was done CheckThisZoneForSizing(state, CurZoneEqNum, SizingDesRunThisZone); // This next check was added during CppCheck corrections. This does not cause diffs // because SizingDesRunThisZone is not used below this point. diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 11960286b72..081b2502763 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -3408,13 +3408,13 @@ namespace HVACUnitaryBypassVAV { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad = 0.0; // Total load in controlled zone [W] - int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); int dayOfSim = state.dataGlobal->DayOfSim; // DayOfSim increments during Warmup when it actually simulates the same day if (state.dataGlobal->WarmupFlag) { // when warmupday increments then reset timer + int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day if (lastDayOfSim != dayOfSim) { cBVAV.changeOverTimer = -1.0; // reset to default (thisTime always > -1) } diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index aca2aa977be..1e89b63b559 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -11183,7 +11183,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c Real64 CoolingPLR; // condenser cooling PLR Real64 HeatingPLR; // condenser heating PLR Real64 CyclingRatio; // cycling ratio of condenser's compressors - int Stage; // used for crankcase heater power calculation Real64 UpperStageCompressorRatio; // used for crankcase heater power calculation Real64 RhoAir; // Density of air [kg/m3] Real64 PartLoadFraction; // Part load fraction from PLFFPLR curve @@ -12368,6 +12367,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c this->CrankCaseHeaterPower = this->CCHeaterPower * (1.0 - VRFRTF); if (this->NumCompressors > 1) { UpperStageCompressorRatio = (1.0 - this->CompressorSizeRatio) / (this->NumCompressors - 1); + int Stage; // used for crankcase heater power calculation for (Stage = 1; Stage <= this->NumCompressors - 2; ++Stage) { if (this->VRFCondPLR < (this->CompressorSizeRatio + Stage * UpperStageCompressorRatio)) { this->CrankCaseHeaterPower += this->CCHeaterPower; diff --git a/src/EnergyPlus/HWBaseboardRadiator.cc b/src/EnergyPlus/HWBaseboardRadiator.cc index 3624c6e36d0..cbe1bb13b06 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.cc +++ b/src/EnergyPlus/HWBaseboardRadiator.cc @@ -990,8 +990,6 @@ namespace HWBaseboardRadiator { auto &hWBaseboard = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); if (state.dataSize->CurZoneEqNum > 0) { auto &zoneEqSizing = state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum); - - std::string CompType = cCMO_BBRadiator_Water; std::string CompName = hWBaseboard.Name; state.dataSize->DataHeatSizeRatio = 1.0; state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0; @@ -1003,6 +1001,7 @@ namespace HWBaseboardRadiator { zoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == DataSizing::HeatingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { + std::string CompType = cCMO_BBRadiator_Water; if (CapSizingMethod == DataSizing::HeatingDesignCapacity) { if (hWBaseboard.ScaledHeatingCapacity == DataSizing::AutoSize) { CheckZoneSizing(state, CompType, CompName); diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index 951cb98dd67..7a2c75a8705 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -183,9 +183,7 @@ namespace HeatBalanceHAMTManager { int NumAlphas; int status; int Numid; - int HAMTitems; - int vtcsid; bool ErrorsFound; @@ -613,7 +611,7 @@ namespace HeatBalanceHAMTManager { cNumericFieldNames); ErrorObjectHeader eoh{routineName, cHAMTObject7, AlphaArray(1)}; - vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); + int vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); if (vtcsid == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index a4a77cbdcb9..ba725567d04 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -9466,7 +9466,6 @@ void CalcOutsideSurfTemp(EnergyPlusData &state, // requires the inside heat balance to be accounted for in the heat balance // while a "slow" surface can used the last time step's value for inside // surface temperature. - auto &s_mat = state.dataMaterial; auto &surface = state.dataSurface->Surface(SurfNum); auto const &construct = state.dataConstruction->Construct(ConstrNum); @@ -9684,6 +9683,7 @@ void CalcOutsideSurfTemp(EnergyPlusData &state, if (construct.SourceSinkPresent) { if (MovInsulPresent) { + auto &s_mat = state.dataMaterial; // Note: if movable insulation is ever added back in correctly, the heat balance equations above must be fixed ShowSevereError(state, "Exterior movable insulation is not valid with embedded sources/sinks"); ShowContinueError(state, format("Construction {} contains an internal source or sink but also uses", construct.Name)); diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 4afd88af167..296e23a9415 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -101,7 +101,6 @@ namespace HybridModel { int NumAlphas = 0; // Number of Alphas for each GetobjectItem call int NumNumbers = 0; // Number of Numbers for each GetobjectItem call int IOStatus = 0; - int ZonePtr = 0; for (int HybridModelNum = 1; HybridModelNum <= state.dataHybridModel->NumOfHybridModelZones; ++HybridModelNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -117,7 +116,7 @@ namespace HybridModel { cAlphaFieldNames, cNumericFieldNames); - ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name + int ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name if (ZonePtr > 0) { auto &hmZone = state.dataHybridModel->hybridModelZones(ZonePtr); hmZone.Name = cAlphaArgs(1); // Zone HybridModel name diff --git a/src/EnergyPlus/ICEngineElectricGenerator.cc b/src/EnergyPlus/ICEngineElectricGenerator.cc index ad0ad33ae69..a64d57f5856 100644 --- a/src/EnergyPlus/ICEngineElectricGenerator.cc +++ b/src/EnergyPlus/ICEngineElectricGenerator.cc @@ -853,15 +853,13 @@ namespace ICEngineElectricGenerator { { static constexpr std::string_view RoutineName("InitICEngineGenerators"); - bool errFlag; - if (this->myFlag) { this->setupOutputVars(state); this->myFlag = false; } if (this->MyPlantScanFlag && allocated(state.dataPlnt->PlantLoop) && this->HeatRecActive) { - errFlag = false; + bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject( state, this->Name, DataPlant::PlantEquipmentType::Generator_ICEngine, this->HRPlantLoc, errFlag, _, _, _, _, _); if (errFlag) { diff --git a/src/EnergyPlus/IndoorGreen.cc b/src/EnergyPlus/IndoorGreen.cc index 98e6127050d..b097c514d87 100644 --- a/src/EnergyPlus/IndoorGreen.cc +++ b/src/EnergyPlus/IndoorGreen.cc @@ -88,9 +88,9 @@ namespace IndoorGreen { auto const &lw = state.dataIndoorGreen; if (lw->getInputFlag) { bool ErrorsFound(false); - const char *RoutineName("IndoorLivingWall: "); // include trailing blank space GetIndoorGreenInput(state, ErrorsFound); if (ErrorsFound) { + const char *RoutineName("IndoorLivingWall: "); // include trailing blank space ShowFatalError(state, format("{}Errors found in input. Program terminates.", RoutineName)); } SetIndoorGreenOutput(state); diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.cc b/src/EnergyPlus/InputProcessing/InputProcessor.cc index 16bbb92d3d9..218ec774ebe 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.cc +++ b/src/EnergyPlus/InputProcessing/InputProcessor.cc @@ -1090,7 +1090,6 @@ void InputProcessor::getObjectItem(EnergyPlusData &state, auto const legacy_idd_extensibles_iter = legacy_idd.find("extensibles"); if (legacy_idd_extensibles_iter != legacy_idd.end()) { - size_t extensible_count = 0; auto const epJSON_extensions_array_itr = obj_val.find(extension_key); if (epJSON_extensions_array_itr != obj_val.end()) { auto const &legacy_idd_extensibles = legacy_idd_extensibles_iter.value(); @@ -1099,6 +1098,7 @@ void InputProcessor::getObjectItem(EnergyPlusData &state, for (auto it = epJSON_extensions_array.begin(); it != epJSON_extensions_array.end(); ++it) { auto const &epJSON_extension_obj = it.value(); + size_t extensible_count = 0; for (size_t i = 0; i < legacy_idd_extensibles.size(); i++, extensible_count++) { std::string const field_name = legacy_idd_extensibles[i].get(); auto const field_info = legacy_idd_field_info.find(field_name); diff --git a/src/EnergyPlus/MicroCHPElectricGenerator.cc b/src/EnergyPlus/MicroCHPElectricGenerator.cc index 0e7b626a5ce..024f6436bf0 100644 --- a/src/EnergyPlus/MicroCHPElectricGenerator.cc +++ b/src/EnergyPlus/MicroCHPElectricGenerator.cc @@ -139,13 +139,12 @@ void GetMicroCHPGeneratorInput(EnergyPlusData &state) Array1D_string AlphArray(25); // character string data Array1D NumArray(200); // numeric data TODO deal with allocatable for extensible - auto &s_ipsc = state.dataIPShortCut; - if (state.dataCHPElectGen->MyOneTimeFlag) { int NumAlphas = 0; // Number of elements in the alpha array int NumNums = 0; // Number of elements in the numeric array int IOStat = 0; // IO Status when calling get input subroutine bool ErrorsFound = false; // error flag + auto &s_ipsc = state.dataIPShortCut; // call to Fuel supply module to set up data there. GeneratorFuelSupply::GetGeneratorFuelSupplyInput(state); diff --git a/src/EnergyPlus/MicroturbineElectricGenerator.cc b/src/EnergyPlus/MicroturbineElectricGenerator.cc index 2b73adc8d15..3bf694bab3d 100644 --- a/src/EnergyPlus/MicroturbineElectricGenerator.cc +++ b/src/EnergyPlus/MicroturbineElectricGenerator.cc @@ -1933,7 +1933,6 @@ void MTGeneratorSpecs::oneTimeInit(EnergyPlusData &state) { std::string const RoutineName("InitMTGenerators"); - bool errFlag; if (this->myFlag) { this->setupOutputVars(state); @@ -1941,7 +1940,7 @@ void MTGeneratorSpecs::oneTimeInit(EnergyPlusData &state) } if (this->MyPlantScanFlag && allocated(state.dataPlnt->PlantLoop) && this->HeatRecActive) { - errFlag = false; + bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject( state, this->Name, DataPlant::PlantEquipmentType::Generator_MicroTurbine, this->HRPlantLoc, errFlag, _, _, _, _, _); if (errFlag) { diff --git a/src/EnergyPlus/OutAirNodeManager.cc b/src/EnergyPlus/OutAirNodeManager.cc index 251e435a50c..23cdd6b6c41 100644 --- a/src/EnergyPlus/OutAirNodeManager.cc +++ b/src/EnergyPlus/OutAirNodeManager.cc @@ -145,13 +145,8 @@ namespace OutAirNodeManager { int NumParams; Array1D_int NodeNums; int NumNodes; - int IOStat; // Status flag from GetObjectItem - int NodeNum; // index into NodeNums - // INTEGER :: OutAirNodeNum ! index into OutAirInletNodeList - int OutAirInletNodeListNum; // OUTSIDE AIR INLET NODE LIST index - int OutsideAirNodeSingleNum; // OUTSIDE AIR NODE index - int AlphaNum; // index into Alphas - std::size_t ListSize; // size of OutAirInletNodeList + int IOStat; // Status flag from GetObjectItem + std::size_t ListSize; // size of OutAirInletNodeList // LOGICAL :: AlreadyInList ! flag used for checking for duplicate input bool ErrorsFound; bool ErrInList; @@ -199,6 +194,7 @@ namespace OutAirNodeManager { if (NumOutAirInletNodeLists > 0) { // Loop over all outside air inlet nodes in the input and count them CurrentModuleObject = "OutdoorAir:NodeList"; + int OutAirInletNodeListNum; // OUTSIDE AIR INLET NODE LIST index for (OutAirInletNodeListNum = 1; OutAirInletNodeListNum <= NumOutAirInletNodeLists; ++OutAirInletNodeListNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -213,6 +209,7 @@ namespace OutAirNodeManager { cAlphaFields, cNumericFields); + int AlphaNum; // index into Alphas for (AlphaNum = 1; AlphaNum <= NumAlphas; ++AlphaNum) { ErrInList = false; // To support HVAC diagram, every outside inlet node must have a unique fluid stream number @@ -236,6 +233,8 @@ namespace OutAirNodeManager { ShowContinueError(state, format("Occurred in {}, {} = {}", CurrentModuleObject, cAlphaFields(AlphaNum), Alphas(AlphaNum))); ErrorsFound = true; } + int NodeNum; // index into NodeNums + // INTEGER :: OutAirNodeNum ! index into OutAirInletNodeList for (NodeNum = 1; NodeNum <= NumNodes; ++NodeNum) { // Duplicates here are not a problem, just ignore if (!any_eq(TmpNums, NodeNums(NodeNum))) { @@ -257,6 +256,7 @@ namespace OutAirNodeManager { if (NumOutsideAirNodeSingles > 0) { // Loop over all single outside air nodes in the input CurrentModuleObject = "OutdoorAir:Node"; + int OutsideAirNodeSingleNum; // OUTSIDE AIR NODE index for (OutsideAirNodeSingleNum = 1; OutsideAirNodeSingleNum <= NumOutsideAirNodeSingles; ++OutsideAirNodeSingleNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -386,11 +386,10 @@ namespace OutAirNodeManager { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int OutsideAirNodeNum; - int NodeNum; // Do the begin time step initialization for (OutsideAirNodeNum = 1; OutsideAirNodeNum <= state.dataOutAirNodeMgr->NumOutsideAirNodes; ++OutsideAirNodeNum) { - NodeNum = state.dataOutAirNodeMgr->OutsideAirNodeList(OutsideAirNodeNum); + int NodeNum = state.dataOutAirNodeMgr->OutsideAirNodeList(OutsideAirNodeNum); SetOANodeValues(state, NodeNum, true); } } @@ -489,7 +488,6 @@ namespace OutAirNodeManager { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D_int TmpNums; - int DummyNumber; if (state.dataOutAirNodeMgr->GetOutAirNodesInputFlag) { // First time subroutine has been entered GetOutAirNodesInput(state); // Get Out Air Nodes data @@ -515,6 +513,7 @@ namespace OutAirNodeManager { state.dataOutAirNodeMgr->OutsideAirNodeList(state.dataOutAirNodeMgr->NumOutsideAirNodes) = NodeNumber; TmpNums = state.dataOutAirNodeMgr->OutsideAirNodeList; bool errFlag(false); + int DummyNumber; // register new node.. GetNodeNums(state, state.dataLoopNodes->NodeID(NodeNumber), diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index 6dc80d81ad8..5912d5bb050 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -1873,9 +1873,6 @@ namespace OutdoorAirUnit { int const InletNodeNum = thisOAEquip.CoilAirInletNode; int const OutletNodeNum = thisOAEquip.CoilAirOutletNode; - int UnitNum = OAUnitNum; - int SimCompNum = EquipNum; - Real64 const CompAirOutTemp = thisOutAirUnit.CompOutSetTemp; Operation const OpMode = thisOutAirUnit.OperatingMode; CompType const EquipTypeNum = thisOAEquip.Type; @@ -1888,6 +1885,9 @@ namespace OutdoorAirUnit { // checking equipment index { + int UnitNum = OAUnitNum; + int SimCompNum = EquipNum; + switch (EquipTypeNum) { // Heat recovery case CompType::HeatXchngrFP: // 'HeatExchanger:AirToAir:FlatPlate', diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index cbd207afc35..3fb525e2c32 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -15983,12 +15983,12 @@ void GetDelaySequences(EnergyPlusData &state, { // static bool initAdjFenDone(false); moved to anonymous namespace for unit testing - auto &ort = state.dataOutRptTab; int const szNumMinus1 = (iSpace == 0) ? zoneIndex - 1 : iSpace - 1; // space or zone num minus 1 for vector // reset to zero surfDelaySeq = 0.0; if (desDaySelected != 0) { + auto &ort = state.dataOutRptTab; auto const &surfCLDay = ort->surfCompLoads[desDaySelected - 1]; auto const &enclCLDay = ort->enclCompLoads[desDaySelected - 1]; auto &szCLDay = szCompLoadLoc[desDaySelected - 1]; diff --git a/src/EnergyPlus/OutputReports.cc b/src/EnergyPlus/OutputReports.cc index d694cf845ce..505e0ca5a9b 100644 --- a/src/EnergyPlus/OutputReports.cc +++ b/src/EnergyPlus/OutputReports.cc @@ -96,7 +96,6 @@ void ReportSurfaces(EnergyPlusData &state) bool SurfVert = false; bool SurfDet = false; bool DXFDone = false; - bool VRMLDone = false; std::string Option1; std::string Option2; bool DoReport; @@ -162,6 +161,7 @@ void ReportSurfaces(EnergyPlusData &state) General::ScanForReports(state, "Surfaces", DoReport, "VRML", Option1, Option2); if (DoReport) { + bool VRMLDone = false; if (!VRMLDone) { VRMLOut(state, Option1, Option2); VRMLDone = true; diff --git a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc index 42fbf903451..32e71773436 100644 --- a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc +++ b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc @@ -197,11 +197,10 @@ namespace PhotovoltaicThermalCollectors { static constexpr std::string_view routineName = "GetPVTSimpleCollectorsInput"; - int Item; // Item to be "gotten" - 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 Item; // Item to be "gotten" + int NumAlphas; // Number of Alphas for each GetObjectItem call + int NumNumbers; // Number of Numbers for each GetObjectItem call + int IOStatus; // Used in GetObjectItem tmpSimplePVTperf.allocate(NumSimplePVTPerform); for (Item = 1; Item <= NumSimplePVTPerform; ++Item) { @@ -228,6 +227,7 @@ namespace PhotovoltaicThermalCollectors { thisTmpSimplePVTperf.ThermEffic = state.dataIPShortCut->rNumericArgs(2); if (thisTmpSimplePVTperf.ThermEfficMode == ThermEfficEnum::SCHEDULED) { + bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); ErrorsFound = true; diff --git a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc index 5a765d75952..b021ac09106 100644 --- a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc +++ b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc @@ -256,6 +256,7 @@ void GetFluidHeatExchangerInput(EnergyPlusData &state) if (state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs > 0) { state.dataPlantHXFluidToFluid->FluidHX.allocate(state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs); + int IOStat; // IO Status when calling get input subroutine for (int CompLoop = 1; CompLoop <= state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs; ++CompLoop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, diff --git a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc index bbaa3610ad0..77f29720147 100644 --- a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc +++ b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc @@ -1159,9 +1159,9 @@ void HeatPumpAirToWater::reportEquipmentSummary(EnergyPlusData &state) if (state.dataPlnt->PlantFinalSizesOkayToReport) { std::string_view const typeName = DataPlant::PlantEquipTypeNames[static_cast(this->EIRHPType)]; std::string objectName = this->name; - std::string modeKeyWord; if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterHeating || this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterCooling) { + std::string modeKeyWord; if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterHeating) { modeKeyWord = "Heating"; } else if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterCooling) { @@ -1243,7 +1243,6 @@ void EIRPlantLoopHeatPump::sizeLoadSide(EnergyPlusData &state) std::string capacityKW = "Nominal Capacity"; std::string flowRateKW = "Load Side Volume Flow Rate"; - std::string flowRateKW_no_v = "Load Side Flow Rate"; if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpAirToWaterCooling) { capacityKW = "Rated Cooling Capacity"; flowRateKW = "Rated Water Volume Flow Rate in Cooling Mode"; @@ -1485,6 +1484,7 @@ void EIRPlantLoopHeatPump::sizeLoadSide(EnergyPlusData &state) } } if (!this->loadSideDesignVolFlowRateWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport) { + std::string flowRateKW_no_v = "Load Side Flow Rate"; BaseSizer::reportSizerOutput( state, typeName, this->name, fmt::format("User-Specified {} [m3/s]", flowRateKW_no_v), this->loadSideDesignVolFlowRate); } @@ -1908,8 +1908,8 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state) EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::subtract}}; bool errorsFound = false; - std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (auto const &classToInput : classesToInput) { + std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; DataLoopNode::ConnectionObjectType objType = static_cast( getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, Util::makeUPPER(cCurrentModuleObject))); @@ -3360,8 +3360,8 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) }; bool errorsFound = false; - std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (auto &classToInput : classesToInput) { + std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; DataLoopNode::ConnectionObjectType objType = static_cast( @@ -3738,7 +3738,6 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) void HeatPumpAirToWater::processInputForEIRPLHP(EnergyPlusData &state) { - std::string routineName = "HeatPumpAirToWater::processInputForEIRPLHP"; struct ClassType { DataPlant::PlantEquipmentType thisType; @@ -3770,7 +3769,6 @@ void HeatPumpAirToWater::processInputForEIRPLHP(EnergyPlusData &state) EIRPlantLoopHeatPumps::HeatPumpAirToWater::subtract}, }; - bool errorsFound = false; std::string cCurrentModuleObject = "HeatPump:AirToWater"; auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject); auto const &schemaProps = state.dataInputProcessing->inputProcessor->getObjectSchemaProps(state, cCurrentModuleObject); @@ -3786,10 +3784,10 @@ void HeatPumpAirToWater::processInputForEIRPLHP(EnergyPlusData &state) auto const &fields = instance.value(); auto const &thisObjectName = instance.key(); state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjectName); - - std::string &cCurrentModuleObjectSingleMode = state.dataIPShortCut->cCurrentModuleObject; for (auto &classToInput : classesToInput) { + std::string &cCurrentModuleObjectSingleMode = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObjectSingleMode = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; + bool errorsFound = false; DataLoopNode::ConnectionObjectType objType = static_cast( getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, Util::makeUPPER(cCurrentModuleObjectSingleMode))); @@ -3798,6 +3796,7 @@ void HeatPumpAirToWater::processInputForEIRPLHP(EnergyPlusData &state) thisAWHP.name = Util::makeUPPER(thisObjectName); thisAWHP.airSource = true; thisAWHP.waterSource = false; + std::string routineName = "HeatPumpAirToWater::processInputForEIRPLHP"; ErrorObjectHeader eoh{routineName, "HeatPump:AirToWater", thisAWHP.name}; thisAWHP.heatPumpMultiplier = state.dataInputProcessing->inputProcessor->getRealFieldValue(fields, schemaProps, "heat_pump_multiplier"); diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index 5da1095ed7a..d82067157fc 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -255,13 +255,12 @@ void GetPurchasedAir(EnergyPlusData &state) int NumNums = 0; int NumAlphas = 0; int purchAirNum = 0; - std::string fieldValue = ""; - std::string cAlphaFieldName = ""; InitUniqueNodeCheck(state, s_ipsc->cCurrentModuleObject); auto const &schemaProps = s_ip->getObjectSchemaProps(state, s_ipsc->cCurrentModuleObject); auto &instancesValue = instances_PurchAir.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - + std::string fieldValue = ""; + std::string cAlphaFieldName = ""; ++purchAirNum; auto const &fields = instance.value(); std::string thisObjectName = instance.key(); diff --git a/src/EnergyPlus/RefrigeratedCase.cc b/src/EnergyPlus/RefrigeratedCase.cc index 033ba3c4883..d3af766a531 100644 --- a/src/EnergyPlus/RefrigeratedCase.cc +++ b/src/EnergyPlus/RefrigeratedCase.cc @@ -341,8 +341,6 @@ void ManageRefrigeratedCaseRacks(EnergyPlusData &state) // Inter-system heat transfer via subcoolers and cascade condensers can be accommodated. // Secondary refrigeration cycles are also available. - auto &RefrigRack = state.dataRefrigCase->RefrigRack; - if (!state.dataRefrigCase->ManageRefrigeration) { return; } @@ -376,6 +374,7 @@ void ManageRefrigeratedCaseRacks(EnergyPlusData &state) if (state.dataRefrigCase->HaveRefrigRacks) { for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) { + auto &RefrigRack = state.dataRefrigCase->RefrigRack; RefrigRack(RackNum).CalcRackSystem(state); RefrigRack(RackNum).ReportRackSystem(state, RackNum); } @@ -480,7 +479,6 @@ void GetRefrigerationInput(EnergyPlusData &state) int NumCases(0); // Number of refrigerated cases for single system int NumNum(0); // Used to cycle through input int NumNumbers(0); // Number of Numbers for each GetObjectItem call - int NumDisplayCases(0); // Counter for refrigerated cases in GetInput do loop int NumWalkIns(0); // Number of walk ins int RefrigSysNum(0); Real64 DeltaHPhaseChange(0.0); // Secondary loop enthalpy change in condenser w overfeed system (J/g) @@ -509,8 +507,6 @@ void GetRefrigerationInput(EnergyPlusData &state) auto &WalkIn = state.dataRefrigCase->WalkIn; auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; - auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; - auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; state.dataRefrigCase->NumSimulationCascadeCondensers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Refrigeration:Condenser:Cascade"); @@ -595,6 +591,7 @@ void GetRefrigerationInput(EnergyPlusData &state) WalkIn.allocate(state.dataRefrigCase->NumSimulationWalkIns); } if ((state.dataRefrigCase->NumSimulationWalkIns > 0) || (state.dataRefrigCase->NumSimulationCases > 0)) { + auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; CaseWIZoneReport.allocate(state.dataGlobal->NumOfZones); } else { state.dataRefrigCase->UseSysTimeStep = true; @@ -606,6 +603,7 @@ void GetRefrigerationInput(EnergyPlusData &state) } if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) { WarehouseCoil.allocate(state.dataRefrigCase->NumSimulationRefrigAirChillers); + auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; CoilSysCredit.allocate(state.dataGlobal->NumOfZones); } if (state.dataRefrigCase->NumSimulationCompressors > 0) { @@ -697,6 +695,7 @@ void GetRefrigerationInput(EnergyPlusData &state) if (state.dataRefrigCase->NumSimulationCases > 0) { CurrentModuleObject = "Refrigeration:Case"; for (int CaseNum = 1; CaseNum <= state.dataRefrigCase->NumSimulationCases; ++CaseNum) { + int NumDisplayCases(0); // Counter for refrigerated cases in GetInput do loop state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, CaseNum, @@ -5271,7 +5270,6 @@ void GetRefrigerationInput(EnergyPlusData &state) System(RefrigSysNum).NumCoils = 0; NumWalkIns = 0; System(RefrigSysNum).NumWalkIns = 0; - int NumSecondary = 0; System(RefrigSysNum).NumSecondarys = 0; System(RefrigSysNum).NumCascadeLoads = 0; System(RefrigSysNum).NumNonCascadeLoads = 0; @@ -5463,6 +5461,7 @@ void GetRefrigerationInput(EnergyPlusData &state) int TransferLoadListNum = 0; int SecondaryNum = 0; int CascadeLoadNum = 0; + int NumSecondary = 0; if (state.dataRefrigCase->NumSimulationTransferLoadLists > 0) { TransferLoadListNum = Util::FindItemInList(Alphas(AlphaNum), TransferLoadList); } @@ -7268,21 +7267,11 @@ void SetupReportInput(EnergyPlusData &state) // Set up the report variables. auto &RefrigCase = state.dataRefrigCase->RefrigCase; - auto &RefrigRack = state.dataRefrigCase->RefrigRack; - auto &System = state.dataRefrigCase->System; - auto &TransSystem = state.dataRefrigCase->TransSystem; - auto &Condenser = state.dataRefrigCase->Condenser; auto &Compressor = state.dataRefrigCase->Compressor; auto &GasCooler = state.dataRefrigCase->GasCooler; - auto &Subcooler = state.dataRefrigCase->Subcooler; - auto &Secondary = state.dataRefrigCase->Secondary; - auto &WalkIn = state.dataRefrigCase->WalkIn; - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; - std::string Walkin_and_zone_name; // concat name for walk-in/zone credit reporting - if (state.dataRefrigCase->NumSimulationCases > 0) { // Setup Report Variables for simulated Refrigerated Case (do not report unused cases) // CurrentModuleObject='Refrigeration:Case' @@ -7554,6 +7543,7 @@ void SetupReportInput(EnergyPlusData &state) // Setup Report Variables for simulated Walk In (do not report unused WalkIns) // CurrentModuleObject='Refrigeration:WalkIn' for (int walkInNum = 1; walkInNum <= state.dataRefrigCase->NumSimulationWalkIns; ++walkInNum) { + auto &WalkIn = state.dataRefrigCase->WalkIn; auto &walkin = WalkIn(walkInNum); if (walkin.NumSysAttach == 1) { // ensure no unuseds reported SetupOutputVariable(state, @@ -7694,7 +7684,7 @@ void SetupReportInput(EnergyPlusData &state) // both the walk-in name and the zone name - see "Walkin_and_zone_name" concatenation // This new variable name is important if using an rvi file! for (int zoneId = 1; zoneId <= walkin.NumZones; ++zoneId) { - + std::string Walkin_and_zone_name; // concat name for walk-in/zone credit reporting Walkin_and_zone_name = walkin.Name + "InZone" + walkin.ZoneName(zoneId); SetupOutputVariable(state, @@ -7760,6 +7750,7 @@ void SetupReportInput(EnergyPlusData &state) // Setup Report Variables for simulated Warehouse coils (do not report unused warehouse coils) // CurrentModuleObject='Refrigeration:AirChiller' for (int coilNum = 1; coilNum <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++coilNum) { + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; auto &coil = WarehouseCoil(coilNum); if (coil.NumSysAttach == 1) { // ensure no unuseds reported SetupOutputVariable(state, @@ -8122,6 +8113,7 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) { // CurrentModuleObject='Refrigeration:SecondarySystem' + auto &Secondary = state.dataRefrigCase->Secondary; for (int secondNum = 1; secondNum <= state.dataRefrigCase->NumSimulationSecondarySystems; ++secondNum) { auto &secondary = Secondary(secondNum); if (secondary.NumSysAttach == 1) { @@ -8326,6 +8318,7 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigeratedRacks > 0) { // CurrentModuleObject='Refrigeration:CompressorRack' for (int rackNum = 1; rackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++rackNum) { + auto &RefrigRack = state.dataRefrigCase->RefrigRack; auto &rack = RefrigRack(rackNum); if (rack.CoilFlag) { // rack serves chillers and is solved on HVAC time step SetupOutputVariable(state, @@ -8693,7 +8686,9 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigSystems > 0) { // CurrentModuleObject='Refrigeration:System' + auto &Condenser = state.dataRefrigCase->Condenser; for (int refrigSysNum = 1; refrigSysNum <= state.dataRefrigCase->NumRefrigSystems; ++refrigSysNum) { + auto &System = state.dataRefrigCase->System; auto &sys = System(refrigSysNum); if (sys.CoilFlag) { // system serves chillers and is solved on HVAC time step if (sys.NumStages == 1) { @@ -9650,6 +9645,7 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumSimulationSubcoolers > 0) { for (int subcoolNum = 1; subcoolNum <= state.dataRefrigCase->NumSimulationSubcoolers; ++subcoolNum) { + auto &Subcooler = state.dataRefrigCase->Subcooler; auto &cooler = Subcooler(subcoolNum); // CurrentModuleObject='Refrigeration:Subcooler' if (cooler.CoilFlag) { // Subcooler serving system with chillers on HVAC time step @@ -9695,6 +9691,7 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumTransRefrigSystems > 0) { // CurrentModuleObject='Refrigeration:TranscriticalSystem' for (int refrigSysNum = 1; refrigSysNum <= state.dataRefrigCase->NumTransRefrigSystems; ++refrigSysNum) { + auto &TransSystem = state.dataRefrigCase->TransSystem; auto &sys = TransSystem(refrigSysNum); // for both SingleStage and TwoStage systems (medium temperature loads present) SetupOutputVariable(state, @@ -10120,13 +10117,9 @@ void InitRefrigeration(EnergyPlusData &state) auto &System = state.dataRefrigCase->System; auto &TransSystem = state.dataRefrigCase->TransSystem; auto &Condenser = state.dataRefrigCase->Condenser; - auto &Compressor = state.dataRefrigCase->Compressor; - auto &GasCooler = state.dataRefrigCase->GasCooler; auto &Secondary = state.dataRefrigCase->Secondary; auto &WalkIn = state.dataRefrigCase->WalkIn; auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; - auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; - auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; // Zero display case, air-coil, and walk-in cooler credits (summed by zone) // to 0 each zone or sys time step @@ -10135,6 +10128,7 @@ void InitRefrigeration(EnergyPlusData &state) // suction piping, and receiver shells to zone if (state.dataGlobal->NumOfZones > 0) { if (state.dataRefrigCase->UseSysTimeStep) { + auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; for (int i = CoilSysCredit.l(), e = CoilSysCredit.u(); i <= e; ++i) { CoilSysCredit(i).reset(); } @@ -10143,7 +10137,7 @@ void InitRefrigeration(EnergyPlusData &state) // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is false if ((!state.dataRefrigCase->UseSysTimeStep) && ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) { - + auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; for (auto &credit : state.dataHeatBal->RefrigCaseCredit) { credit.reset(); } @@ -10203,6 +10197,7 @@ void InitRefrigeration(EnergyPlusData &state) if (state.dataRefrigCase->NumSimulationGasCooler > 0) { // GasCooler ALLOCATED to NumSimulationGasCooler + auto &GasCooler = state.dataRefrigCase->GasCooler; for (int i = GasCooler.l(), e = GasCooler.u(); i <= e; ++i) { GasCooler(i).reset_init(); } @@ -10210,6 +10205,7 @@ void InitRefrigeration(EnergyPlusData &state) if (state.dataRefrigCase->NumSimulationCompressors > 0) { // Compressor ALLOCATED to NumSimulationCompressors + auto &Compressor = state.dataRefrigCase->Compressor; for (int i = Compressor.l(), e = Compressor.u(); i <= e; ++i) { Compressor(i).reset_init(); } @@ -10641,11 +10637,6 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) Real64 BPress; // Barometric pressure at condenser air inlet node [Pa] bool EvapAvail; // Control for evap condenser availability - auto &RefrigCase = state.dataRefrigCase->RefrigCase; - auto &WalkIn = state.dataRefrigCase->WalkIn; - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; - auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; - state.dataRefrigCase->TotalRackDeliveredCapacity = 0.0; state.dataRefrigCase->CompressorCOPactual = 0.0; state.dataRefrigCase->TotalCompressorPower = 0.0; @@ -10674,6 +10665,7 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) // that's why important where init goes, don't want to zero out data should keep if (state.dataRefrigCase->UseSysTimeStep) { for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) { + auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state); } } @@ -10683,6 +10675,7 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) int CoilID = this->CoilNum(CoilIndex); // already CALLed CalculateCoil(CoilID) in CoilSet specified order // increment TotalCoolingLoad for Compressors/condenser on each system + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; state.dataRefrigCase->TotalRackDeliveredCapacity += WarehouseCoil(CoilID).TotalCoolingLoad; // System(SysNum)%TotalCondDefrostCredit=System(SysNum)%TotalCondDefrostCredit + WarehouseCoil(CoilID)%HotDefrostCondCredit } // NumCoils systems @@ -10691,6 +10684,7 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) if (this->NumCases > 0) { for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) { int CaseID = this->CaseNum(caseNum); + auto &RefrigCase = state.dataRefrigCase->RefrigCase; RefrigCase(CaseID).CalculateCase(state); // add evaporator load for all cases connected to rack @@ -10718,6 +10712,7 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) if (this->NumWalkIns > 0) { for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) { + auto &WalkIn = state.dataRefrigCase->WalkIn; int WalkInID = this->WalkInNum(WalkInIndex); WalkIn(WalkInID).CalculateWalkIn(state); state.dataRefrigCase->TotalRackDeliveredCapacity += WalkIn(WalkInID).TotalCoolingLoad; @@ -11790,7 +11785,6 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) auto &Secondary = state.dataRefrigCase->Secondary; auto &WalkIn = state.dataRefrigCase->WalkIn; auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; - auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; @@ -11810,6 +11804,7 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) // that's why important where init goes, don't want to zero out data should keep if (state.dataRefrigCase->UseSysTimeStep) { for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) { + auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state); } } @@ -12055,13 +12050,11 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) thisSys.CalcDetailedSystem(state, SysNum); - bool DeRate; // If true, need to derate aircoils because load can't be met by system - // With air chiller coils, don't use unmet energy, instead reduce capacity on coils to match avail compressor/cond capacity // current loads on compressor, exclusive of unmet loads from prev time steps Real64 CurrentLoads = thisSys.TotalSystemLoad + thisSys.LSHXTrans; // because compressor capacity rated from txv to comp inlet if ((thisSys.CoilFlag) && (CurrentLoads > (thisSys.TotCompCapacity * 1.001))) { - DeRate = true; + bool DeRate = true; // If true, need to derate aircoils because load can't be met by system FinalRateCoils(state, DeRate, SourceType::DetailedSystem, SysNum, CurrentLoads, thisSys.TotCompCapacity); thisSys.TotalCoolingLoad = 0.0; thisSys.TotalCondDefrostCredit = 0.0; @@ -12597,7 +12590,6 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN int CondCreditWarnIndex6; // Used to sum up warning count int CondCreditWarnIndex7; // Used to sum up warning count int Sysloop; // counter over number of systems attached to this condenser - int SystemID; // System number rejecting heat to this condenser bool EvapAvail; // Control for evap condenser availability Real64 AirVolRatio; // Ratio of air volume needed to remove load relative to design load @@ -12659,6 +12651,7 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN // from the previous overall solution iteration. However, solution goes through 3 iterations if // there are any shared condensers, so that's ok. for (Sysloop = 1; Sysloop <= condenser.NumSysAttach; ++Sysloop) { + int SystemID; // System number rejecting heat to this condenser SystemID = condenser.SysNum(Sysloop); TotalCondDefCredfromSysID = System(SystemID).TotalCondDefrostCredit + System(SystemID).SumCascadeCondCredit; TotalCondDefrostCreditLocal += TotalCondDefCredfromSysID; @@ -14028,13 +14021,11 @@ void GetRefrigeratedRackIndex(EnergyPlusData &state, // This subroutine sets an index for a given refrigerated rack or refrigeration condenser // -- issues error message if the rack or condenser is not found. - auto &RefrigRack = state.dataRefrigCase->RefrigRack; - auto &Condenser = state.dataRefrigCase->Condenser; - CheckRefrigerationInput(state); switch (SysType) { case DataHeatBalance::RefrigSystemType::Rack: { + auto &RefrigRack = state.dataRefrigCase->RefrigRack; IndexPtr = Util::FindItemInList(Name, RefrigRack); if (IndexPtr == 0) { if (SuppressWarning) { @@ -14054,6 +14045,7 @@ void GetRefrigeratedRackIndex(EnergyPlusData &state, } } break; case DataHeatBalance::RefrigSystemType::Detailed: { + auto &Condenser = state.dataRefrigCase->Condenser; IndexPtr = Util::FindItemInList(Name, Condenser); if (IndexPtr == 0) { if (SuppressWarning) { @@ -14088,20 +14080,12 @@ void ReportRefrigerationComponents(EnergyPlusData &state) // To report information from the input deck for refrigerated cases and racks to the eio and err file. std::string ChrOut; - std::string ChrOut2; auto &RefrigCase = state.dataRefrigCase->RefrigCase; - auto &RefrigRack = state.dataRefrigCase->RefrigRack; - auto &System = state.dataRefrigCase->System; - auto &TransSystem = state.dataRefrigCase->TransSystem; - auto &Condenser = state.dataRefrigCase->Condenser; auto &Compressor = state.dataRefrigCase->Compressor; - auto &GasCooler = state.dataRefrigCase->GasCooler; - auto &Subcooler = state.dataRefrigCase->Subcooler; auto &Secondary = state.dataRefrigCase->Secondary; auto &WalkIn = state.dataRefrigCase->WalkIn; auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; - auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; static constexpr std::string_view Format_104( "! ,Compressor Rack Name, # Refrigerated Cases Connected,# WalkIn Coolers " @@ -14251,6 +14235,8 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigeratedRacks > 0) { print(state.files.eio, "#Refrigeration Compressor Racks, {}\n", state.dataRefrigCase->NumRefrigeratedRacks); for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) { + std::string ChrOut2; + auto &RefrigRack = state.dataRefrigCase->RefrigRack; if (RefrigRack(RackNum).HeatRejectionLocation == HeatRejLocation::Outdoors) { ChrOut = "Outdoors"; } else { @@ -14338,6 +14324,9 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigSystems > 0) { print(state.files.eio, "#Detailed Refrigeration Systems,{}\n", state.dataRefrigCase->NumRefrigSystems); for (int SystemNum = 1; SystemNum <= state.dataRefrigCase->NumRefrigSystems; ++SystemNum) { + auto &System = state.dataRefrigCase->System; + auto &Condenser = state.dataRefrigCase->Condenser; + auto &Subcooler = state.dataRefrigCase->Subcooler; print(state.files.eio, " Detailed Refrigeration System,{},{},{},{},{},{},{},{},{},{},{},{:.2R},{},{:.1R}\n", System(SystemNum).Name, @@ -14541,6 +14530,8 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumTransRefrigSystems > 0) { print(state.files.eio, "#Detailed Transcritical Refrigeration Systems,{}\n", state.dataRefrigCase->NumTransRefrigSystems); for (int TransSystemNum = 1; TransSystemNum <= state.dataRefrigCase->NumTransRefrigSystems; ++TransSystemNum) { + auto &TransSystem = state.dataRefrigCase->TransSystem; + auto &GasCooler = state.dataRefrigCase->GasCooler; print(state.files.eio, " Detailed Transcritical Refrigeration System,{},{},{},{},{},{},{},{},{:.1R}\n", TransSystem(TransSystemNum).Name, @@ -14777,6 +14768,7 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigChillerSets > 0) { print(state.files.eio, "#ZoneHVAC/Refrigeration Air Chiller Sets,{}\n", state.dataRefrigCase->NumRefrigChillerSets); for (int ChillerSetNum = 1; ChillerSetNum <= state.dataRefrigCase->NumRefrigChillerSets; ++ChillerSetNum) { + auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; print(state.files.eio, "ZoneHVAC/Refrigeration Air Chiller Set,{},{},{},{}\n", AirChillerSet(ChillerSetNum).Name, @@ -15260,7 +15252,6 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco bool AtPartLoad; // Whether or not need to iterate on pump power bool DeRate; // If true, need to derate aircoils because don't carry over unmet energy - int Iter; // loop counter Real64 CpBrine; // Specific heat (W/kg) Real64 DensityBrine; // Density (kg/m3) Real64 DiffTemp; // (C) @@ -15281,10 +15272,6 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco Real64 VarFrac; // Pump power fraction for variable speed pump, dimensionless Real64 VolFlowRate; // Used in dispatching pumps to meet load (m3/s) - auto &RefrigCase = state.dataRefrigCase->RefrigCase; - auto &WalkIn = state.dataRefrigCase->WalkIn; - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; - Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; @@ -15339,6 +15326,7 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco // Sum up all the case and walk-in loads served by the secondary loop if (this->NumCases > 0) { for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) { + auto &RefrigCase = state.dataRefrigCase->RefrigCase; int CaseID = this->CaseNum(caseNum); RefrigCase(CaseID).CalculateCase(state); // increment TotalCoolingLoad Hot gas/brine defrost credits for each secondary loop @@ -15348,6 +15336,7 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco } // NumCases > 0 if (this->NumWalkIns > 0) { for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) { + auto &WalkIn = state.dataRefrigCase->WalkIn; int WalkInID = this->WalkInNum(WalkInIndex); WalkIn(WalkInID).CalculateWalkIn(state); // increment TotalCoolingLoad for each system @@ -15358,6 +15347,7 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco if (this->NumCoils > 0) { for (int CoilIndex = 1; CoilIndex <= this->NumCoils; ++CoilIndex) { + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; int CoilID = this->CoilNum(CoilIndex); // already CALL CalculateCoil(CoilID) for each coil, dispatched in coilset order for each zone // increment TotalCoolingLoad for each system @@ -15401,7 +15391,7 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco // Need an iterative soln for pump energy needed to meet total load // because that total load has to include pump energy if (AtPartLoad) { - for (Iter = 1; Iter <= 10; ++Iter) { + for (int Iter = 1; Iter <= 10; ++Iter) { // loop counter if (TotalLoad <= 0.0) { // Load on secondary loop is zero (or negative). // Set volumetric flow rate and pump power to be zero. @@ -15529,11 +15519,9 @@ void SumZoneImpacts(EnergyPlusData &state) // heat absorbed by suction piping, secondary loop distribution piping, and // secondary receiver shells - auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; - auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; - if (state.dataRefrigCase->UseSysTimeStep) { // air chillers for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; auto &credit = CoilSysCredit(ZoneNum); credit.ReportH2ORemovedKgPerS_FromZoneRate = -credit.LatKgPerS_ToZoneRate; credit.ReportLatCreditToZoneRate = -credit.LatCreditToZoneRate; @@ -15560,6 +15548,7 @@ void SumZoneImpacts(EnergyPlusData &state) if ((!state.dataRefrigCase->UseSysTimeStep) && ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) { for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; auto &report = CaseWIZoneReport(ZoneNum); report.SenCaseCreditToZoneEnergy = state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone * state.dataGlobal->TimeStepZoneSec; // Latent always negative @@ -15774,7 +15763,6 @@ void FinalRateCoils(EnergyPlusData &state, // would still be running at level calculated previously auto &System = state.dataRefrigCase->System; - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; int NumCoils = 0; Real64 DeRateFactor = 0.0; // Ratio of energy available from system or secondary loop @@ -15805,6 +15793,7 @@ void FinalRateCoils(EnergyPlusData &state, Real64 const time_step_sec(state.dataHVACGlobal->TimeStepSysSec); for (int CoilIndex = 1; CoilIndex <= NumCoils; ++CoilIndex) { int CoilID = System(SystemID).CoilNum(CoilIndex); + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; auto &warehouse_coil = WarehouseCoil(CoilID); // need to adjust ice on coil due to reduction in latent load met by coil @@ -16301,18 +16290,12 @@ void FigureRefrigerationZoneGains(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // initialize zone gain terms at begin environment - auto &System = state.dataRefrigCase->System; - auto &TransSystem = state.dataRefrigCase->TransSystem; - auto &RefrigRack = state.dataRefrigCase->RefrigRack; - auto &Secondary = state.dataRefrigCase->Secondary; - auto &WalkIn = state.dataRefrigCase->WalkIn; - auto &RefrigCase = state.dataRefrigCase->RefrigCase; - CheckRefrigerationInput(state); if (state.dataGlobal->BeginEnvrnFlag && state.dataRefrigCase->FigureRefrigerationZoneGainsMyEnvrnFlag) { if (state.dataRefrigCase->NumRefrigSystems > 0) { + auto &System = state.dataRefrigCase->System; for (auto &e : System) { e.PipeHeatLoad = 0.0; e.NetHeatRejectLoad = 0.0; @@ -16320,6 +16303,7 @@ void FigureRefrigerationZoneGains(EnergyPlusData &state) } if (state.dataRefrigCase->NumTransRefrigSystems > 0) { + auto &TransSystem = state.dataRefrigCase->TransSystem; for (auto &e : TransSystem) { e.PipeHeatLoadMT = 0.0; e.PipeHeatLoadLT = 0.0; @@ -16328,6 +16312,7 @@ void FigureRefrigerationZoneGains(EnergyPlusData &state) } if (state.dataRefrigCase->NumRefrigeratedRacks > 0) { + auto &RefrigRack = state.dataRefrigCase->RefrigRack; for (auto &e : RefrigRack) { e.SensZoneCreditHeatRate = 0.0; e.SensHVACCreditHeatRate = 0.0; @@ -16335,6 +16320,7 @@ void FigureRefrigerationZoneGains(EnergyPlusData &state) } if (state.dataRefrigCase->NumSimulationSecondarySystems > 0) { + auto &Secondary = state.dataRefrigCase->Secondary; for (auto &e : Secondary) { e.DistPipeZoneHeatGain = 0.0; e.ReceiverZoneHeatGain = 0.0; @@ -16342,12 +16328,14 @@ void FigureRefrigerationZoneGains(EnergyPlusData &state) } if (state.dataRefrigCase->NumSimulationWalkIns > 0) { + auto &WalkIn = state.dataRefrigCase->WalkIn; for (int loop = 1; loop <= state.dataRefrigCase->NumSimulationWalkIns; ++loop) { WalkIn(loop).SensZoneCreditRate = 0.0; WalkIn(loop).LatZoneCreditRate = 0.0; } } if (state.dataRefrigCase->NumSimulationCases > 0) { + auto &RefrigCase = state.dataRefrigCase->RefrigCase; for (auto &e : RefrigCase) { e.SensZoneCreditRate = 0.0; e.SensHVACCreditRate = 0.0; @@ -16376,15 +16364,13 @@ void ZeroHVACValues(EnergyPlusData &state) // to zero when called on zone timestep. Otherwise, values may be held over when // no HVAC load calls module during that zone time step. - auto &RefrigRack = state.dataRefrigCase->RefrigRack; - auto &Condenser = state.dataRefrigCase->Condenser; - int DemandARRID = 0; // Index to water tank Demand used for evap condenser if (state.dataRefrigCase->HaveRefrigRacks) { // HaveRefrigRacks is TRUE when NumRefrigeratedRAcks > 0 // RefrigRack ALLOCATED to NumRefrigeratedRacks for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) { + auto &RefrigRack = state.dataRefrigCase->RefrigRack; if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Water) { Real64 MassFlowRate = 0.0; PlantUtilities::SetComponentFlowRate( @@ -16403,6 +16389,7 @@ void ZeroHVACValues(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigCondensers > 0) { // Condenser ALLOCATED to DataHeatBalance::NumRefrigCondensers for (int CondID = 1; CondID <= state.dataRefrigCase->NumRefrigCondensers; ++CondID) { + auto &Condenser = state.dataRefrigCase->Condenser; if (Condenser(CondID).CondenserType == DataHeatBalance::RefrigCondenserType::Water) { Real64 MassFlowRate = 0.0; PlantUtilities::SetComponentFlowRate( diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index cb57318167e..3b36771e9ba 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1500,7 +1500,6 @@ namespace RoomAir { ipsc->cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:InternalGains"; TotNumOfRAFNNodeGainsLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); for (int Loop = 1; Loop <= TotNumOfRAFNNodeGainsLists; ++Loop) { - int foundList = false; state.dataInputProcessing->inputProcessor->getObjectItem(state, ipsc->cCurrentModuleObject, Loop, @@ -1526,6 +1525,7 @@ namespace RoomAir { for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); + int foundList = false; // find surface list int RAFNNodeNum = 0; if (roomAFNZoneInfo.NumOfAirNodes > 0) { diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index b8fb00e9eb0..10392f8f83f 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -278,11 +278,9 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatorUsedLoop; - int EMSActuatorVariableNum; int ErlVariableNum; int TrendVarNum; int SensorNum; - int TrendDepth; int loop; bool CycleThisVariable; @@ -345,7 +343,7 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) // reinitialize state of actuators for (ActuatorUsedLoop = 1; ActuatorUsedLoop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; ++ActuatorUsedLoop) { - EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; + int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value.Type = Value::Null; *state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).Actuated = false; @@ -366,7 +364,7 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) // reinitialize trend variables so old data are purged for (TrendVarNum = 1; TrendVarNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendVarNum) { - TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; + int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; state.dataRuntimeLang->TrendVariable(TrendVarNum).TrendValARR({1, TrendDepth}) = 0.0; } @@ -1095,10 +1093,8 @@ void ParseExpression(EnergyPlusData &state, int NumErrors; std::string::size_type Pos; std::string StringToken; - char NextChar; bool PeriodFound; bool MinusFound; - bool PlusFound; bool MultFound; bool DivFound; bool ErrorFlag; @@ -1139,7 +1135,7 @@ void ParseExpression(EnergyPlusData &state, ShowContinueError(state, format("...Failed to process String=\"{}\".", String)); ShowFatalError(state, "...program terminates due to preceding condition."); } - NextChar = String[Pos]; + char NextChar = String[Pos]; if (NextChar == ' ') { ++Pos; continue; @@ -1151,7 +1147,7 @@ void ParseExpression(EnergyPlusData &state, // Get the next token StringToken = ""; PeriodFound = false; - PlusFound = false; + bool PlusFound = false; ErrorFlag = false; LastED = false; if (is_any_of(NextChar, "0123456789.")) { @@ -1506,7 +1502,6 @@ int ProcessTokens( int LastPos; int TokenNum; int NumTokens; - int Depth; int NumSubTokens; int NewNumTokens; int OperatorNum; @@ -1533,7 +1528,7 @@ int ProcessTokens( while ((Pos > 0) && (ParenthWhileCounter < 50)) { ++ParenthWhileCounter; - Depth = 0; + int Depth = 0; for (TokenNum = 1; TokenNum <= NumTokens; ++TokenNum) { if (Token(TokenNum).Type == Token::Parenthesis) { if (Token(TokenNum).Parenthesis == Token::ParenthesisLeft) { @@ -1799,15 +1794,10 @@ ErlValueType EvaluateExpression(EnergyPlusData &state, int const ExpressionNum, // FUNCTION ARGUMENT DEFINITIONS: // FUNCTION LOCAL VARIABLE DECLARATIONS: - int thisTrend; // local temporary - int thisIndex; // local temporary - Real64 thisAverage; // local temporary - int loop; // local temporary - Real64 thisSlope; // local temporary - Real64 thisMax; // local temporary - Real64 thisMin; // local temporary - int OperandNum; - int SeedN; // number of digits in the number used to seed the generator + Real64 thisAverage; // local temporary + Real64 thisSlope; // local temporary + Real64 thisMax; // local temporary + Real64 thisMin; // local temporary Array1D_int SeedIntARR; // local temporary for random seed Real64 tmpRANDU1; // local temporary for uniform random number Real64 tmpRANDU2; // local temporary for uniform random number @@ -1828,7 +1818,7 @@ ErlValueType EvaluateExpression(EnergyPlusData &state, int const ExpressionNum, // is there a way to keep these and not allocate and deallocate all the time? Operand.allocate(thisErlExpression.NumOperands); // Reduce operands down to literals - for (OperandNum = 1; OperandNum <= thisErlExpression.NumOperands; ++OperandNum) { + for (int OperandNum = 1; OperandNum <= thisErlExpression.NumOperands; ++OperandNum) { auto &thisOperand = Operand(OperandNum); thisOperand = thisErlExpression.Operand(OperandNum); if (thisOperand.Type == Value::Expression) { @@ -1859,9 +1849,11 @@ ErlValueType EvaluateExpression(EnergyPlusData &state, int const ExpressionNum, } if (ReturnValue.Type != Value::Error) { + int thisTrend; // local temporary + int thisIndex; // local temporary + int loop; // local temporary // Perform the operation - switch (thisErlExpression.Operator) { case ErlFunc::Literal: @@ -2109,6 +2101,7 @@ ErlValueType EvaluateExpression(EnergyPlusData &state, int const ExpressionNum, case ErlFunc::RandSeed: // convert arg to an integer array for the seed. + int SeedN; // number of digits in the number used to seed the generator RANDOM_SEED(SeedN); // obtains processor's use size as output SeedIntARR.allocate(SeedN); for (loop = 1; loop <= SeedN; ++loop) { @@ -2790,45 +2783,36 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) constexpr std::string_view RoutineName = "GetRuntimeLanguageUserInput: "; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int GlobalNum; - int StackNum; - int ErrorNum; - int NumAlphas; // Number of elements in the alpha array - int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine - bool ErrorsFound(false); - int VariableNum(0); // temporary - int RuntimeReportVarNum; - bool Found; OutputProcessor::TimeStepType sovTimeStepType; // temporary OutputProcessor::StoreType sovStoreType; // temporary - std::string EndUseSubCatString; - int TrendNum; - int NumTrendSteps; - int loop; - int ErlVarLoop; - int CurveIndexNum; - int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs - int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs - int TotalArgs(0); // argument for call to GetObjectDefMaxArgs Array1D_string cAlphaFieldNames; Array1D_string cNumericFieldNames; Array1D_bool lNumericFieldBlanks; Array1D_bool lAlphaFieldBlanks; Array1D_string cAlphaArgs; Array1D rNumericArgs; - std::string cCurrentModuleObject; - int ConstructNum; - bool errFlag; std::string::size_type lbracket; std::string UnitsA; - std::string UnitsB; Constant::Units curUnit(Constant::Units::None); std::string::size_type ptr; if (state.dataRuntimeLangProcessor->GetInput) { // GetInput check is redundant with the InitializeRuntimeLanguage routine state.dataRuntimeLangProcessor->GetInput = false; + int NumAlphas; // Number of elements in the alpha array + int NumNums; // Number of elements in the numeric array + int IOStat; // IO Status when calling get input subroutine + bool ErrorsFound(false); + int VariableNum(0); // temporary + int RuntimeReportVarNum; + bool Found; + int loop; + int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs + int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs + int TotalArgs(0); // argument for call to GetObjectDefMaxArgs + std::string cCurrentModuleObject; + bool errFlag; + std::string UnitsB; cCurrentModuleObject = "EnergyManagementSystem:Sensor"; state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, TotalArgs, NumAlphas, NumNums); @@ -2907,12 +2891,13 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) lNumericFieldBlanks.dimension(MaxNumNumbers, false); cCurrentModuleObject = "EnergyManagementSystem:GlobalVariable"; + int StackNum; if (state.dataRuntimeLang->NumUserGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables > 0) { - for (GlobalNum = 1; + for (int GlobalNum = 1; GlobalNum <= state.dataRuntimeLang->NumUserGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables; @@ -2989,7 +2974,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } // loop over each alpha and register variable named as global Erl variable - for (ErlVarLoop = 1; ErlVarLoop <= NumAlphas; ++ErlVarLoop) { + for (int ErlVarLoop = 1; ErlVarLoop <= NumAlphas; ++ErlVarLoop) { if ((cCurrentModuleObject.compare("ExternalInterface:FunctionalMockupUnitImport:To:Variable") == 0)) { if (ErlVarLoop == 1) { // Only validate first field of object ExternalInterface:FunctionalMockupUnitImport:To:Variable. @@ -3067,7 +3052,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } } - CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name + int CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name if (CurveIndexNum == 0) { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, format("{}{}=\"{} blank field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -3129,7 +3114,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) continue; } - ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); + int ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); if (ConstructNum == 0) { if (lAlphaFieldBlanks(2)) { @@ -3229,7 +3214,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumErlTrendVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumErlTrendVariables > 0) { state.dataRuntimeLang->TrendVariable.allocate(state.dataRuntimeLang->NumErlTrendVariables); - for (TrendNum = 1; TrendNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendNum) { + for (int TrendNum = 1; TrendNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, TrendNum, @@ -3264,7 +3249,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->ErlVariable(VariableNum).Value.initialized = true; // Cannot figure out how to get around needing this, } - NumTrendSteps = std::floor(rNumericArgs(1)); + int NumTrendSteps = std::floor(rNumericArgs(1)); if (NumTrendSteps > 0) { state.dataRuntimeLang->TrendVariable(TrendNum).LogDepth = NumTrendSteps; // setup data arrays using NumTrendSteps @@ -3308,7 +3293,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) ShowSevereError( state, format("Errors found parsing EMS Runtime Language program or subroutine = {}", state.dataRuntimeLang->ErlStack(StackNum).Name)); - for (ErrorNum = 1; ErrorNum <= state.dataRuntimeLang->ErlStack(StackNum).NumErrors; ++ErrorNum) { + for (int ErrorNum = 1; ErrorNum <= state.dataRuntimeLang->ErlStack(StackNum).NumErrors; ++ErrorNum) { ShowContinueError(state, state.dataRuntimeLang->ErlStack(StackNum).Error(ErrorNum)); } ErrorsFound = true; @@ -3718,8 +3703,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } if (!lAlphaFieldBlanks(8)) { - EndUseSubCatString = cAlphaArgs(8); - + std::string EndUseSubCatString = cAlphaArgs(8); SetupOutputVariable(state, cAlphaArgs(1), curUnit, @@ -3778,12 +3762,11 @@ void ReportRuntimeLanguage(EnergyPlusData &state) // Locals // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RuntimeReportVarNum; - int VariableNum; for (RuntimeReportVarNum = 1; RuntimeReportVarNum <= state.dataRuntimeLang->NumEMSOutputVariables + state.dataRuntimeLang->NumEMSMeteredOutputVariables; ++RuntimeReportVarNum) { - VariableNum = state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).VariableNum; + int VariableNum = state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).VariableNum; if (state.dataRuntimeLang->ErlVariable(VariableNum).Value.Type == Value::Number) { state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).Value = state.dataRuntimeLang->ErlVariable(VariableNum).Value.Number; diff --git a/src/EnergyPlus/WaterToAirHeatPump.cc b/src/EnergyPlus/WaterToAirHeatPump.cc index 62fb6378b83..067ba10bf88 100644 --- a/src/EnergyPlus/WaterToAirHeatPump.cc +++ b/src/EnergyPlus/WaterToAirHeatPump.cc @@ -225,10 +225,10 @@ namespace WaterToAirHeatPump { HPNum = 0; if (instances != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { + std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); @@ -465,10 +465,10 @@ namespace WaterToAirHeatPump { auto const instances_h = s_ip->epJSON.find(CurrentModuleObject); if (instances != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_h.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { + std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); diff --git a/src/EnergyPlus/WindowAC.cc b/src/EnergyPlus/WindowAC.cc index 88f0903fcf4..5ddad35cf69 100644 --- a/src/EnergyPlus/WindowAC.cc +++ b/src/EnergyPlus/WindowAC.cc @@ -885,7 +885,6 @@ namespace WindowAC { std::string const CompType = "ZoneHVAC:WindowAirConditioner"; // component name std::string const CompName = windowAC.Name; // component type Real64 TempSize = AutoSize; // autosized value of coil input field - bool PrintFlag = false; // TRUE when sizing information is reported in the eio file state.dataSize->DataFracOfAutosizedCoolingAirflow = 1.0; state.dataSize->DataFracOfAutosizedHeatingAirflow = 1.0; @@ -902,6 +901,7 @@ namespace WindowAC { if (state.dataSize->CurZoneEqNum > 0) { auto &zoneEqSizing = state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum); + bool PrintFlag = false; // TRUE when sizing information is reported in the eio file if (windowAC.HVACSizingIndex > 0) { // N1 , \field Maximum Supply Air Flow Rate From a7f2b513ddae2293130d6ca0e0c427e3c3ae9f6d Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Sun, 23 Nov 2025 01:47:28 -0700 Subject: [PATCH 07/33] fix error --- src/EnergyPlus/DXCoils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 8a05caf76d0..a6091f04b50 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -14775,12 +14775,13 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum int fanInNode = 0; int fanOutNode = 0; Real64 externalStatic = 0.0; + int fanIndex = 0; if (thisDXCoil.RateWithInternalStaticAndFanObject) { par7 = 0.0; fanInNode = FanInletNode; fanOutNode = FanOutletNode; externalStatic = ExternalStatic; - int fanIndex = thisDXCoil.SupplyFanIndex; + fanIndex = thisDXCoil.SupplyFanIndex; } LowerBoundMassFlowRate = 0.01 * thisDXCoil.RatedAirMassFlowRate(1); From 1e3c22b77cd8efa0f0cb46c9463f53c6c5aacbb2 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Sun, 23 Nov 2025 02:00:09 -0700 Subject: [PATCH 08/33] fix error 2 --- src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc index 98caef5843b..3a6a470794c 100644 --- a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc +++ b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc @@ -224,7 +224,6 @@ void GetFluidHeatExchangerInput(EnergyPlusData &state) bool ErrorsFound(false); int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs int TotalArgs(0); // argument for call to GetObjectDefMaxArgs From 78860cc28c6f30f7e41437bf02cd021e1b3d8360 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Sun, 23 Nov 2025 02:10:28 -0700 Subject: [PATCH 09/33] fix error 3 --- src/EnergyPlus/RoomAirModelManager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index d0bde25c9df..b3f1be752ad 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1525,7 +1525,7 @@ namespace RoomAir { for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); - int foundList = false; + bool foundList = false; // find surface list int RAFNNodeNum = 0; if (roomAFNZoneInfo.NumOfAirNodes > 0) { From 907b6e088145bd80a4b59c3b5c2a6289d7b56a92 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Mon, 24 Nov 2025 09:31:02 -0700 Subject: [PATCH 10/33] fix error --- src/EnergyPlus/RoomAirModelManager.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index b3f1be752ad..007708edb7e 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1525,7 +1525,6 @@ namespace RoomAir { for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); - bool foundList = false; // find surface list int RAFNNodeNum = 0; if (roomAFNZoneInfo.NumOfAirNodes > 0) { From 334ab6f2054f20b70ade920c99588d4d8d901e31 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Mon, 1 Dec 2025 15:49:22 -0700 Subject: [PATCH 11/33] style - variableScope 2 --- src/EnergyPlus/SimAirServingZones.cc | 86 +++++-------- src/EnergyPlus/SolarShading.cc | 129 ++++++++----------- src/EnergyPlus/SplitterComponent.cc | 13 +- src/EnergyPlus/SteamBaseboardRadiator.cc | 32 ++--- src/EnergyPlus/SteamCoils.cc | 17 +-- src/EnergyPlus/SurfaceGroundHeatExchanger.cc | 36 +++--- src/EnergyPlus/SwimmingPool.cc | 2 +- src/EnergyPlus/SystemAvailabilityManager.cc | 86 +++++-------- 8 files changed, 158 insertions(+), 243 deletions(-) diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index cab17f051b8..1ec90c9075c 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -333,15 +333,12 @@ void GetAirPathData(EnergyPlusData &state) /////////// hoisted into namespace // static int TestUniqueNodesNum( 0 ); /////////////////////////// - int NumOASysSimpControllers; // number of simple controllers in the OA Sys of an air primary system - int NumOASysControllers; // total number of controllers in the OA Sys - int OASysContListNum; // index of the controller list of the OA Sys - int OASysControllerNum; // index of OA Sys simple controller in the air primary system controller lists - bool NodeNotFound; // true if matching actuator node not found - CompType CompType_Num; // numeric equivalent for component type - std::string CompType; // component type - int WaterCoilNodeNum; // numeric equivalent for water coil node number - int ActuatorNodeNum; // numeric equivalent for controller actuator node number + int OASysControllerNum; // index of OA Sys simple controller in the air primary system controller lists + bool NodeNotFound; // true if matching actuator node not found + CompType CompType_Num; // numeric equivalent for component type + std::string CompType; // component type + int WaterCoilNodeNum; // numeric equivalent for water coil node number + int ActuatorNodeNum; // numeric equivalent for controller actuator node number Array1D_string MatchNodeName(3); struct AirUniqueNodes @@ -418,9 +415,9 @@ void GetAirPathData(EnergyPlusData &state) for (AirSysNum = 1; AirSysNum <= NumPrimaryAirSys; ++AirSysNum) { auto &primaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems(AirSysNum); auto &airLoopZoneInfo = state.dataAirLoop->AirToZoneNodeInfo(AirSysNum); - NumOASysControllers = 0; - NumOASysSimpControllers = 0; - OASysContListNum = 0; + int NumOASysControllers = 0; // total number of controllers in the OA Sys + int NumOASysSimpControllers = 0; // number of simple controllers in the OA Sys of an air primary system + int OASysContListNum = 0; // index of the controller list of the OA Sys PackagedUnit(AirSysNum) = false; primaryAirSystems.OASysExists = false; // init Outside Air system connection data to none primaryAirSystems.isAllOA = false; @@ -2376,7 +2373,6 @@ void ConnectReturnNodes(EnergyPlusData &state) // Check for any air loops that may be connected directly to a zone return node for (int airLoopNum = 1; airLoopNum <= NumPrimaryAirSys; ++airLoopNum) { - bool returnFound = false; if (AirToZoneNodeInfo(airLoopNum).NumReturnNodes > 0) { int zeqReturnNodeNum = AirToZoneNodeInfo(airLoopNum).ZoneEquipReturnNodeNum(1); if (zeqReturnNodeNum > 0) { @@ -2386,6 +2382,7 @@ void ConnectReturnNodes(EnergyPlusData &state) continue; } for (int zoneOutNum = 1; zoneOutNum <= thisZoneEquip.NumReturnNodes; ++zoneOutNum) { + bool returnFound = false; if (thisZoneEquip.ReturnNode(zoneOutNum) == zeqReturnNodeNum) { thisZoneEquip.ReturnNodeAirLoopNum(zoneOutNum) = airLoopNum; returnFound = true; @@ -3744,8 +3741,6 @@ void UpdateBranchConnections(EnergyPlusData &state, // Using/Aliasing using Psychrometrics::PsyTdbFnHW; - int OutletNum; // splitter outlet DO loop index - int InletNum; // mixer inlet DO loop index int InletNodeNum; // node number of splitter inlet node int OutletNodeNum; // node number of a splitter outlet node int RABNodeNum; // splitter outlet RAB node @@ -3770,13 +3765,13 @@ void UpdateBranchConnections(EnergyPlusData &state, OutletGC = 0.0; auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; - auto &AirLoopControlInfo = state.dataAirLoop->AirLoopControlInfo; if (PrimaryAirSystems(AirLoopNum).Splitter.Exists && Update == AfterBranchSim) { // if we are at an inlet branch, pass data through the splitter if (PrimaryAirSystems(AirLoopNum).Splitter.BranchNumIn == BranchNum) { InletNodeNum = PrimaryAirSystems(AirLoopNum).Splitter.NodeNumIn; // Pass node data through the splitter + int OutletNum; // splitter outlet DO loop index for (OutletNum = 1; OutletNum <= PrimaryAirSystems(AirLoopNum).Splitter.TotalOutletNodes; ++OutletNum) { OutletNodeNum = PrimaryAirSystems(AirLoopNum).Splitter.NodeNumOut(OutletNum); state.dataLoopNodes->Node(OutletNodeNum).Temp = state.dataLoopNodes->Node(InletNodeNum).Temp; @@ -3808,6 +3803,7 @@ void UpdateBranchConnections(EnergyPlusData &state, state.dataLoopNodes->Node(OutletNodeNum).MassFlowRateMinAvail = 0.0; } } else { // set the RAB flow rates + auto &AirLoopControlInfo = state.dataAirLoop->AirLoopControlInfo; RABNodeNum = PrimaryAirSystems(AirLoopNum).RABSplitOutNode; NonRABNodeNum = PrimaryAirSystems(AirLoopNum).OtherSplitOutNode; if (AirLoopControlInfo(AirLoopNum).EconoActive) { @@ -3833,6 +3829,7 @@ void UpdateBranchConnections(EnergyPlusData &state, if (PrimaryAirSystems(AirLoopNum).Mixer.BranchNumOut == BranchNum) { OutletNodeNum = PrimaryAirSystems(AirLoopNum).Mixer.NodeNumOut; // get the outlet mass flow rate and the outlet minavail mass flow rate + int InletNum; // mixer inlet DO loop index for (InletNum = 1; InletNum <= PrimaryAirSystems(AirLoopNum).Mixer.TotalInletNodes; ++InletNum) { InletNodeNum = PrimaryAirSystems(AirLoopNum).Mixer.NodeNumIn(InletNum); MassFlowRateOut += state.dataLoopNodes->Node(InletNodeNum).MassFlowRate; @@ -3921,9 +3918,6 @@ void ResolveSysFlow(EnergyPlusData &state, int InletNodeNum; // splitter inlet node number int NodeNum; // a node number int NodeNumNext; // node number of next node on a branch - int InNodeNum; // air system inlet node - int InBranchNum; // air system inlet branch number - int InBranchIndex; // air sys inlet branch DO loop index auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; auto &AirLoopControlInfo = state.dataAirLoop->AirLoopControlInfo; @@ -3991,6 +3985,7 @@ void ResolveSysFlow(EnergyPlusData &state, } // Impose mass balance at splitter + int InBranchNum; // air system inlet branch number if (PrimaryAirSystems(SysNum).Splitter.Exists) { InBranchNum = PrimaryAirSystems(SysNum).Splitter.BranchNumIn; MassFlowRateOutSum = 0.0; @@ -4015,9 +4010,9 @@ void ResolveSysFlow(EnergyPlusData &state, } // Make sure air system inlet nodes have flow consistent with MassFlowRateMaxAvail - for (InBranchIndex = 1; InBranchIndex <= PrimaryAirSystems(SysNum).NumInletBranches; ++InBranchIndex) { + for (int InBranchIndex = 1; InBranchIndex <= PrimaryAirSystems(SysNum).NumInletBranches; ++InBranchIndex) { InBranchNum = PrimaryAirSystems(SysNum).InletBranchNum[InBranchIndex - 1]; - InNodeNum = PrimaryAirSystems(SysNum).Branch(InBranchNum).NodeNumIn; + int InNodeNum = PrimaryAirSystems(SysNum).Branch(InBranchNum).NodeNumIn; // air system inlet node state.dataLoopNodes->Node(InNodeNum).MassFlowRate = min(state.dataLoopNodes->Node(InNodeNum).MassFlowRate, state.dataLoopNodes->Node(InNodeNum).MassFlowRateMaxAvail); } @@ -4075,18 +4070,17 @@ void SizeAirLoopBranches(EnergyPlusData &state, int const AirLoopNum, int const std::string CompName; // Component name std::string CoilName; std::string CoilType; - std::string ScalableSM; // scalable sizing methods label for reporting SimAirServingZones::CompType CompType_Num; // Numeric equivalent for CompType int CompNum; bool ErrorsFound; - auto &FinalSysSizing = state.dataSize->FinalSysSizing; auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; ErrorsFound = false; if (BranchNum == 1) { - + std::string ScalableSM; // scalable sizing methods label for reporting + auto &FinalSysSizing = state.dataSize->FinalSysSizing; if (PrimaryAirSystems(AirLoopNum).DesignVolFlowRate == AutoSize) { CheckSysSizing(state, "AirLoopHVAC", PrimaryAirSystems(AirLoopNum).Name); PrimaryAirSystems(AirLoopNum).DesignVolFlowRate = FinalSysSizing(AirLoopNum).DesMainVolFlow; @@ -5093,10 +5087,6 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int AirLoopNum; // primary air system index - int TimeStepInDay; // zone time step in day - int TimeStepIndex; // zone time step index - int I; // write statement index - int J; // write statement index Real64 SysCoolRetTemp; // system cooling return temperature for a time step [C] Real64 SysHeatRetTemp; // system heating return temperature for a time step [C] Real64 RhoAir; // density of air kg/m3 @@ -5108,15 +5098,6 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn Real64 SysCoolZoneAvgTemp; // system cooling zone average temperature [C] Real64 SysHeatZoneAvgTemp; // system heating zone average temperature [C] Real64 SysHeatCap; // system heating capacity [W] - int HourCounter; // Hour Counter - int TimeStepCounter; // Time Step Counter - int Minutes; // Current Minutes Counter - int HourPrint; // Hour to print (timestamp) - int DDNum; // design day index - int CoolDDNum; // design day index of a peak cooling day - int HeatDDNum; // design day index of a peak cooling day - int CoolTimeStepNum; // time step index (in day) of a cooling peak - int HeatTimeStepNum; // time step index (in day) of a cooling peak Real64 OutAirTemp; // outside air temperature Real64 OutAirHumRat; // outside air humifity ratio Real64 SysCoolMixHumRat; // system cooling mixed air humidity ratio [kg water/kg dry air] @@ -5136,7 +5117,6 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn Real64 SysCoolingEv; // System level ventilation effectiveness for cooling mode Real64 SysHeatingEv; // System level ventilation effectiveness for heating mode Real64 SysHtgPeakAirflow; // Peak heating airflow - int MatchingCooledZoneNum; // temporary variable Real64 termunitsizingtempfrac; // 1.0/(1.0+termunitsizing(ctrlzone)%inducrat) Real64 termunitsizingtemp; // (1.0+termunitsizing(ctrlzone)%inducrat) Real64 VozClg(0.0); // corrected (for ventilation efficiency) zone outside air flow rate [m3/s] @@ -5174,6 +5154,8 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn } switch (CallIndicator) { + int I; // write statement index + int J; // write statement index case Constant::CallIndicator::BeginDay: { // Correct the zone return temperature in ZoneSizing for the case of induction units. The calc in // ZoneEquipmentManager assumes all the air entering the zone goes into the return node. @@ -5273,6 +5255,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn } // End of begin day loop over primary air systems } break; case Constant::CallIndicator::DuringDay: { + int TimeStepInDay; // zone time step in day TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; // calculate current zone time step index @@ -5633,6 +5616,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn SysCoolingEv = 1.0; SysHeatingEv = 1.0; for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { + int MatchingCooledZoneNum; // temporary variable auto &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); int NumZonesCooled = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; int NumZonesHeated = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; @@ -6327,6 +6311,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn case Constant::CallIndicator::EndSysSizingCalc: { // Correct the zone return temperature in FinalZoneSizing for the case of induction units. The calc in // ZoneEquipmentManager assumes all the air entering the zone goes into the return node. + int TimeStepIndex; // zone time step index for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) { continue; @@ -6401,8 +6386,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn // For coincident sizing, loop over design days and pick out the largest central heating amd // cooling flow rates and associated data - - for (DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) { + for (int DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) { // design day index auto const &sysSizing = state.dataSize->SysSizing(DDNum, AirLoopNum); if (sysSizing.SensCoolCap > state.dataSize->SensCoolCapTemp(AirLoopNum)) { state.dataSize->SysSizPeakDDNum(AirLoopNum).SensCoolPeakDD = DDNum; @@ -6525,8 +6509,6 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn SysCoolMixTemp = 0.0; SysSensCoolCap = 0.0; SysTotCoolCap = 0.0; - CoolTimeStepNum = 0; - CoolDDNum = 0; OutAirTemp = 0.0; OutAirHumRat = 0.0; SysCoolMixHumRat = 0.0; @@ -6553,6 +6535,8 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn (1.0 + termUnitSizing.InducRat); SysCoolRetHumRat += state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneHumRatAtCoolPeak * coolMassFlow / (1.0 + termUnitSizing.InducRat); + int CoolDDNum = 0; // design day index of a peak cooling day + int CoolTimeStepNum = 0; // time step index (in day) of a cooling peak CoolDDNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).CoolDDNum; CoolTimeStepNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).TimeStepNumAtCoolMax; if (CoolDDNum == 0) { @@ -6590,12 +6574,12 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn SysTotCoolCap = max(0.0, SysTotCoolCap); } + int HeatDDNum = 0; // design day index of a peak cooling day + int HeatTimeStepNum = 0; // time step index (in day) of a cooling peak SysHeatRetTemp = 0.0; OutAirFrac = 0.0; SysHeatMixTemp = 0.0; SysHeatCap = 0.0; - HeatTimeStepNum = 0; - HeatDDNum = 0; OutAirTemp = 0.0; OutAirHumRat = 0.0; SysHeatMixHumRat = 0.0; @@ -7141,12 +7125,13 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn } print(state.files.ssz, "\n"); // HourFrac = 0.0 - Minutes = 0; + int Minutes = 0; // Current Minutes Counter TimeStepIndex = 0; - for (HourCounter = 1; HourCounter <= 24; ++HourCounter) { - for (TimeStepCounter = 1; TimeStepCounter <= state.dataGlobal->TimeStepsInHour; ++TimeStepCounter) { + for (int HourCounter = 1; HourCounter <= 24; ++HourCounter) { // Hour Counter + for (int TimeStepCounter = 1; TimeStepCounter <= state.dataGlobal->TimeStepsInHour; ++TimeStepCounter) { // Time Step Counter ++TimeStepIndex; Minutes += state.dataGlobal->MinutesInTimeStep; + int HourPrint; // Hour to print (timestamp) if (Minutes == 60) { Minutes = 0; HourPrint = HourCounter; @@ -7246,8 +7231,6 @@ void UpdateSysSizingForScalableInputs(EnergyPlusData &state, int const AirLoopNu Real64 AutosizedCapacity; // autosized heating and cooling capacity auto &FinalSysSizing = state.dataSize->FinalSysSizing; - auto &CalcSysSizing = state.dataSize->CalcSysSizing; - auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; state.dataSize->DataFracOfAutosizedCoolingCapacity = 1.0; state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0; @@ -7256,6 +7239,8 @@ void UpdateSysSizingForScalableInputs(EnergyPlusData &state, int const AirLoopNu TempSize = 0.0; FractionOfAutosize = 1.0; + auto &CalcSysSizing = state.dataSize->CalcSysSizing; + auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; // scalable sizing option for cooling supply air flow rate switch (FinalSysSizing(AirLoopNum).ScaleCoolSAFMethod) { @@ -7480,7 +7465,6 @@ Real64 GetHeatingSATempForSizing(EnergyPlusData &state, int const IndexAirLoop / Real64 ReheatCoilInEnthalpyForSizing; // Enthalpy of the reheat coil inlet air [J/kg] Real64 OutAirFrac; - auto &CalcSysSizing = state.dataSize->CalcSysSizing; auto &FinalSysSizing = state.dataSize->FinalSysSizing; auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; @@ -7488,7 +7472,7 @@ Real64 GetHeatingSATempForSizing(EnergyPlusData &state, int const IndexAirLoop / if (PrimaryAirSystems(IndexAirLoop).CentralHeatCoilExists) { // Case: Central heating coils exist - + auto &CalcSysSizing = state.dataSize->CalcSysSizing; ReheatCoilInTempForSizing = CalcSysSizing(IndexAirLoop).HeatSupTemp; } else if ((PrimaryAirSystems(IndexAirLoop).NumOAHeatCoils > 0) || ((PrimaryAirSystems(IndexAirLoop).NumOAHXs) != 0)) { diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 9ba63632f3d..221ddc5f55f 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -760,14 +760,13 @@ void processShadowingInput(EnergyPlusData &state) } } - int SurfZoneGroup, CurZoneGroup; - int Found = 0; if (state.dataSysVars->DisableGroupSelfShading) { Array1D_int DisableSelfShadingGroups; int NumOfShadingGroups = state.dataSysVars->shadingGroupsNum; if (NumOfShadingGroups > 0) { DisableSelfShadingGroups.allocate(NumOfShadingGroups); for (int i = 1; i <= NumOfShadingGroups; i++) { + int Found = 0; Found = Util::FindItemInList( state.dataSysVars->shadingGroupZoneListNames(i), state.dataHeatBal->ZoneList, state.dataHeatBal->NumOfZoneLists); if (Found != 0) { @@ -776,8 +775,9 @@ void processShadowingInput(EnergyPlusData &state) } for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { + int SurfZoneGroup = 0; + int CurZoneGroup = 0; if (state.dataSurface->Surface(SurfNum).ExtBoundCond == 0) { // Loop through all exterior surfaces - SurfZoneGroup = 0; // Check the shading zone group of each exterior surface for (int ZoneGroupLoop = 1; ZoneGroupLoop <= NumOfShadingGroups; ZoneGroupLoop++) { // Loop through all defined shading groups CurZoneGroup = DisableSelfShadingGroups(ZoneGroupLoop); @@ -2969,9 +2969,6 @@ void CHKSBS(EnergyPlusData &state, int NS2; // Number of the figure doing overlapping int NS3; // Location to place results of overlap - bool inside; - - bool Out; Real64 X1; // ,SX,SY,SZ Real64 Y1; Real64 Z1; @@ -3033,7 +3030,9 @@ void CHKSBS(EnergyPlusData &state, // Print error condition if necessary. if (state.dataSolarShading->OverlapStatus != FirstSurfWithinSecond) { - Out = false; + + bool inside; + bool Out = false; // C COMPUTE COMPONENTS OF VECTOR // C NORMAL TO BASE SURFACE. X1 = s_surf->Surface(GRSNR).Vertex(1).x - s_surf->Surface(GRSNR).Vertex(2).x; // XV(1,GRSNR)-XV(2,GRSNR) @@ -3802,17 +3801,16 @@ void INCLOS(EnergyPlusData &state, // REFERENCES: // BLAST/IBLAST code, original author George Walton - int K; // Vertex number of the overlap - int M; // Side number of figure N2 - int N; // Vertex number of figure N1 - bool CycleMainLoop; // Sets when to cycle main loop + int K; // Vertex number of the overlap + int M; // Side number of figure N2 + int N; // Vertex number of figure N1 Real64 HFunct; NIN = 0; for (N = 1; N <= N1NumVert; ++N) { - CycleMainLoop = false; + bool CycleMainLoop = false; // Sets when to cycle main loop // Eliminate cases where vertex N is to the left of side M. @@ -4563,17 +4561,14 @@ void MULTOL(EnergyPlusData &state, // REFERENCES: // BLAST/IBLAST code, original author George Walton - int I; // Loop Control - int NS1; // Number of the figure being overlapped - int NS2; // Number of the figure doing overlapping - int NS3; // Location to place results of overlap + int I; // Loop Control state.dataSolarShading->maxNumberOfFigures = max(state.dataSolarShading->maxNumberOfFigures, NRFIGS); - NS2 = NNN; for (I = 1; I <= NRFIGS; ++I) { - NS1 = LOC0 + I; - NS3 = state.dataSolarShading->LOCHCA + 1; + int NS1 = LOC0 + I; // Number of the figure being overlapped + int NS2 = NNN; // Number of the figure doing overlapping + int NS3 = state.dataSolarShading->LOCHCA + 1; // Location to place results of overlap DeterminePolygonOverlap(state, NS1, NS2, NS3); // Find overlap of figure NS2 on figure NS1. @@ -4623,16 +4618,12 @@ void ORDER(EnergyPlusData &state, Real64 SAVEY; // Temporary location for exchange of variables Real64 XMIN; // X coordinate of left-most vertex Real64 YXMIN; - int I; // Sort index - int IM1; // Sort control - int J; // Sort index - int M; // Number of slopes to be sorted - int N; // Vertex number - int P; // Location of first slope to be sorted - - auto &s_surf = state.dataSurface; + int M; // Number of slopes to be sorted + int N; // Vertex number + int P; // Location of first slope to be sorted if (state.dataSolarShading->ORDERFirstTimeFlag) { + auto &s_surf = state.dataSurface; state.dataSolarShading->SLOPE.allocate(max(10, s_surf->MaxVerticesPerSurface + 1)); state.dataSolarShading->ORDERFirstTimeFlag = false; } @@ -4686,7 +4677,9 @@ void ORDER(EnergyPlusData &state, // Sequence the temporary arrays in order of decreasing slopes.(bubble sort) if (M != 1) { - + int I; // Sort index + int IM1; // Sort control + int J; // Sort index for (I = 2; I <= M; ++I) { IM1 = I - 1; for (J = 1; J <= IM1; ++J) { @@ -4783,10 +4776,10 @@ void DeterminePolygonOverlap(EnergyPlusData &state, int NV1 = state.dataSolarShading->HCNV(NS1); // Number of vertices of figure NS1 int NV2 = state.dataSolarShading->HCNV(NS2); // Number of vertices of figure NS2 int NV3 = 0; // Number of vertices of figure NS3 (the overlap of NS1 and NS2) - int NIN1 = 0; // Number of vertices of NS1 within NS2 - int NIN2 = 0; // Number of vertices of NS2 within NS1 if (!state.dataSysVars->SutherlandHodgman) { + int NIN1 = 0; // Number of vertices of NS1 within NS2 + int NIN2 = 0; // Number of vertices of NS2 within NS1 INCLOS(state, NS1, NV1, NS2, NV2, NV3, NIN1); // Find vertices of NS1 within NS2. if (NIN1 >= NV1) { @@ -5940,19 +5933,17 @@ void SHDBKS(EnergyPlusData &state, int N; int NVR; int NVT; // Number of vertices of back surface - int BackSurfaceNumber; int NS1; // Number of the figure being overlapped int NS2; // Number of the figure doing overlapping int NS3; // Location to place results of overlap - auto &s_surf = state.dataSurface; - // Tuned Linear indexing assert(equal_dimensions(state.dataSolarShading->HCX, state.dataSolarShading->HCY)); assert(equal_dimensions(state.dataSolarShading->HCX, state.dataSolarShading->HCA)); if (state.dataSolarShading->SHDBKSOneTimeFlag) { + auto &s_surf = state.dataSurface; state.dataSolarShading->XVrtx.allocate(s_surf->MaxVerticesPerSurface + 1); state.dataSolarShading->YVrtx.allocate(s_surf->MaxVerticesPerSurface + 1); state.dataSolarShading->ZVrtx.allocate(s_surf->MaxVerticesPerSurface + 1); @@ -5971,7 +5962,7 @@ void SHDBKS(EnergyPlusData &state, for (I = 1; I <= NBKS; ++I) { // Loop through all back surfaces associated with the receiving surface - BackSurfaceNumber = state.dataShadowComb->ShadowComb(CurSurf).BackSurf(I); + int BackSurfaceNumber = state.dataShadowComb->ShadowComb(CurSurf).BackSurf(I); if (state.dataSolarShading->SurfSunCosTheta(BackSurfaceNumber) > -DataEnvironment::SunIsUpValue) { continue; //-0.001) CYCLE ! go to next back surface since inside of this surface @@ -8985,8 +8976,6 @@ void PerformSolarCalculations(EnergyPlusData &state) Real64 AvgEqOfTime; Real64 AvgSinSolarDeclin; Real64 AvgCosSolarDeclin; - int PerDayOfYear; - int Count; Real64 SinDec; Real64 EqTime; // not used INTEGER SurfNum @@ -9024,10 +9013,10 @@ void PerformSolarCalculations(EnergyPlusData &state) state.dataReportFlag->DisplayPerfSimulationFlag = true; } - PerDayOfYear = state.dataEnvrn->DayOfYear; + int PerDayOfYear = state.dataEnvrn->DayOfYear; SumDec = 0.0; SumET = 0.0; - for (Count = 1; Count <= state.dataSolarShading->ShadowingDaysLeft; ++Count) { + for (int Count = 1; Count <= state.dataSolarShading->ShadowingDaysLeft; ++Count) { SUN3(PerDayOfYear, SinDec, EqTime); SumDec += SinDec; SumET += EqTime; @@ -9092,18 +9081,12 @@ void SHDRVL(EnergyPlusData &state, // REFERENCES: // BLAST/IBLAST code, original author George Walton - int NVS; // Number of vertices - int constexpr None(0); // for use with RevealStatus int constexpr EntireWindowShadedByReveal(1); // for use with RevealStatus int constexpr WindowShadedOnlyByReveal(2); // for use with RevealStatus Real64 A; // Area Real64 R; // Depth of the reveal (m) - int I; // Loop control - int N; // Vertex number - int NS1; // Locations in homogeneous coordinate array - int NS2; // note, below dimensions not changed because subsurface still max 4 Array1D XVT(5); // Projected X coordinates of vertices Array1D YVT(5); // Projected Y coordinates of vertices @@ -9130,7 +9113,8 @@ void SHDRVL(EnergyPlusData &state, state.dataSolarShading->FRVLHC = state.dataSolarShading->LOCHCA + 1; ++state.dataSolarShading->LOCHCA; - NVS = s_surf->Surface(SBSNR).Sides; + int NVS = s_surf->Surface(SBSNR).Sides; // Number of vertices + int N; // Vertex number // Currently (06May02) windows are either rectangles (NVS=4) or triangles (NVS=3) @@ -9194,7 +9178,7 @@ void SHDRVL(EnergyPlusData &state, // Transform to homogeneous coordinates - NS1 = state.dataSolarShading->LOCHCA + 1; + int NS1 = state.dataSolarShading->LOCHCA + 1; // Locations in homogeneous coordinate array state.dataSolarShading->LOCHCA = NS1; HTRANS1(state, NS1, NVS); @@ -9207,7 +9191,7 @@ void SHDRVL(EnergyPlusData &state, // Transform to homogeneous coordinates - NS2 = state.dataSolarShading->LOCHCA + 1; + int NS2 = state.dataSolarShading->LOCHCA + 1; state.dataSolarShading->LOCHCA = NS2; HTRANS1(state, NS2, NVS); state.dataSolarShading->HCT(state.dataSolarShading->FRVLHC) = 1.0; @@ -9249,7 +9233,7 @@ void SHDRVL(EnergyPlusData &state, if (!RevealStatusSet) { // Compute sunlit area. A = state.dataSolarShading->HCAREA(state.dataSolarShading->FRVLHC); - for (I = 2; I <= state.dataSolarShading->NRVLHC; ++I) { + for (int I = 2; I <= state.dataSolarShading->NRVLHC; ++I) { A += state.dataSolarShading->HCAREA(state.dataSolarShading->FRVLHC - 1 + I) * (1.0 - state.dataSolarShading->HCT(state.dataSolarShading->FRVLHC - 1 + I)); } @@ -9296,31 +9280,24 @@ void SHDSBS(EnergyPlusData &state, // REFERENCES: // BLAST/IBLAST code, original author George Walton - Real64 A; // Area - int I; // Loop control - int J; // Loop control - int K; // Window construction number - int N; // Vertex number Real64 SurfArea; // Surface area. For walls, includes all window frame areas. // For windows, includes divider area // REAL(r64) FrameAreaAdd ! Additional frame area sunlit // REAL(r64) DividerAreaAdd ! Additional frame area sunlit - int HTSS; // Heat transfer surface number of the subsurface - int SBSNR; // Subsurface number - - auto &s_surf = state.dataSurface; if (NSBS > 0) { // Action taken only if subsurfaces present state.dataSolarShading->FSBSHC = state.dataSolarShading->LOCHCA + 1; - for (I = 1; I <= NSBS; ++I) { // Do for all subsurfaces (sbs). + for (int I = 1; I <= NSBS; ++I) { // Do for all subsurfaces (sbs). + + auto &s_surf = state.dataSurface; - SBSNR = state.dataShadowComb->ShadowComb(CurSurf).SubSurf(I); + int SBSNR = state.dataShadowComb->ShadowComb(CurSurf).SubSurf(I); // Subsurface number - HTSS = SBSNR; + int HTSS = SBSNR; // Heat transfer surface number of the subsurface - K = s_surf->Surface(SBSNR).Construction; + int K = s_surf->Surface(SBSNR).Construction; // Window construction number if (!state.dataSolarShading->penumbra) { if ((state.dataSolarShading->OverlapStatus != TooManyVertices) && (state.dataSolarShading->OverlapStatus != TooManyFigures) && @@ -9328,7 +9305,7 @@ void SHDSBS(EnergyPlusData &state, // Re-order vertices to clockwise sequential; compute homogeneous coordinates. state.dataSolarShading->NVS = s_surf->Surface(SBSNR).Sides; - for (N = 1; N <= state.dataSolarShading->NVS; ++N) { + for (int N = 1; N <= state.dataSolarShading->NVS; ++N) { // Vertex number state.dataSolarShading->XVS(N) = s_surf->ShadeV(SBSNR).XV(state.dataSolarShading->NVS + 1 - N); state.dataSolarShading->YVS(N) = s_surf->ShadeV(SBSNR).YV(state.dataSolarShading->NVS + 1 - N); } @@ -9380,8 +9357,8 @@ void SHDSBS(EnergyPlusData &state, } else { // Compute area. - A = state.dataSolarShading->HCAREA(state.dataSolarShading->FSBSHC); - for (J = 2; J <= state.dataSolarShading->NSBSHC; ++J) { + Real64 A = state.dataSolarShading->HCAREA(state.dataSolarShading->FSBSHC); // Area + for (int J = 2; J <= state.dataSolarShading->NSBSHC; ++J) { A += state.dataSolarShading->HCAREA(state.dataSolarShading->FSBSHC - 1 + J) * (1.0 - state.dataSolarShading->HCT(state.dataSolarShading->FSBSHC - 1 + J)); } @@ -11644,21 +11621,21 @@ void ReportSurfaceErrors(EnergyPlusData &state) static Array1D_string const MSG(4, {"misses", "", "within", "overlaps"}); - int Loop1; - int Loop2; - int Count; - int TotCount; Array1D_bool SurfErrorReported; Array1D_bool SurfErrorReported2; - auto &s_surf = state.dataSurface; - if (state.dataSolarShading->NumTooManyFigures + state.dataSolarShading->NumTooManyVertices + state.dataSolarShading->NumBaseSubSurround > 0) { + int Loop1; + int Loop2; + int Count; + int TotCount; ShowMessage(state, ""); ShowMessage(state, "===== Recurring Surface Error Summary ====="); ShowMessage(state, "The following surface error messages occurred."); ShowMessage(state, ""); + auto &s_surf = state.dataSurface; + if (state.dataSolarShading->NumBaseSubSurround > 0) { ShowMessage(state, "Base Surface does not surround subsurface errors occurring..."); ShowMessage(state, @@ -11843,15 +11820,13 @@ void ComputeWinShadeAbsorpFactors(EnergyPlusData &state) auto &surf = s_surf->Surface(SurfNum); if (surf.Class == SurfaceClass::Window && surf.HasShadeControl) { int WinShadeCtrlNum = surf.activeWindowShadingControl; // Window shading control number - - int MatNumSh = 0; // Shade layer material number - Real64 AbsorpEff = 0.0; // Effective absorptance of isolated shade layer (fraction of + Real64 AbsorpEff = 0.0; // Effective absorptance of isolated shade layer (fraction of // of incident radiation remaining after reflected portion is // removed that is absorbed if (ANY_SHADE(s_surf->WindowShadingControl(WinShadeCtrlNum).ShadingType)) { int const ConstrNumSh = surf.activeShadedConstruction; // Window construction number with shade int TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; // Total layers in a construction - + int MatNumSh = 0; // Shade layer material number if (s_surf->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::IntShade) { MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); // Interior shade } else if (s_surf->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::ExtShade) { @@ -11914,7 +11889,6 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) Real64 AbsInt; // Tmp var for Inside surface short-wave absorptance Real64 InsideDifAbsorptance; // Inside diffuse solar absorptance of a surface Real64 InsideDifReflectance; // Inside diffuse solar reflectance of a surface - int BlNum; // Blind number Real64 BlAbsDiffBk; // Glass layer back diffuse solar absorptance when blind in place Real64 AbsDiffBkBl; // Blind diffuse back solar absorptance as part of glazing system @@ -12266,7 +12240,7 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) state.dataHeatBal->EnclSolInitialDifSolReflW(enclosureNum) += DifSolarReflW; // [W] // Now calc diffuse solar absorbed by shade/blind itself - BlNum = surfShade.blind.matNum; + int BlNum = surfShade.blind.matNum; // Blind number if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed by shade or screen [W] ShBlDifSolarAbsW = WinDifSolarTrans_Factor * constrSh.AbsDiffBackShade; @@ -12482,7 +12456,6 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, Real64 AbsInt; // Tmp var for Inside surface short-wave absorptance Real64 InsideDifAbsorptance; // Inside diffuse solar absorptance of a surface Real64 InsideDifReflectance; // Inside diffuse solar reflectance of a surface - int BlNum; // Blind number Real64 BlAbsDiffBk; // Glass layer back diffuse solar absorptance when blind in place Real64 AbsDiffBkBl; // Blind diffuse back solar absorptance as part of glazing system @@ -12791,7 +12764,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // ZoneDifSolarDistReflectedTotl += DifSolarReflW; // debug // Now calc diffuse solar absorbed by shade/blind itself - BlNum = surfShade.blind.matNum; + int BlNum = surfShade.blind.matNum; // Blind number if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed by shade or screen [W] ShBlDifSolarAbsW = SolarTrans_ViewFactor * constrSh.AbsDiffBackShade; diff --git a/src/EnergyPlus/SplitterComponent.cc b/src/EnergyPlus/SplitterComponent.cc index e88ce80db4a..83bcf43eb02 100644 --- a/src/EnergyPlus/SplitterComponent.cc +++ b/src/EnergyPlus/SplitterComponent.cc @@ -527,19 +527,15 @@ namespace SplitterComponent { Real64 constexpr FlowRateToler(0.01); // Tolerance for mass flow rate convergence (in kg/s) - int InletNode; - int OutletNode; - int NodeNum; - // Set the inlet node for this splitter to be used throughout subroutine for either case - InletNode = state.dataSplitterComponent->SplitterCond(SplitterNum).InletNode; + int InletNode = state.dataSplitterComponent->SplitterCond(SplitterNum).InletNode; // On the FirstCall the State properties are passed through and the mass flows are not dealt with // except for NO flow conditions if (FirstCall) { // Set the outlet nodes for properties that just pass through & not used - for (NodeNum = 1; NodeNum <= state.dataSplitterComponent->SplitterCond(SplitterNum).NumOutletNodes; ++NodeNum) { - OutletNode = state.dataSplitterComponent->SplitterCond(SplitterNum).OutletNode(NodeNum); + for (int NodeNum = 1; NodeNum <= state.dataSplitterComponent->SplitterCond(SplitterNum).NumOutletNodes; ++NodeNum) { + int OutletNode = state.dataSplitterComponent->SplitterCond(SplitterNum).OutletNode(NodeNum); state.dataLoopNodes->Node(OutletNode).Temp = state.dataSplitterComponent->SplitterCond(SplitterNum).OutletTemp(NodeNum); state.dataLoopNodes->Node(OutletNode).HumRat = state.dataSplitterComponent->SplitterCond(SplitterNum).OutletHumRat(NodeNum); state.dataLoopNodes->Node(OutletNode).Enthalpy = state.dataSplitterComponent->SplitterCond(SplitterNum).OutletEnthalpy(NodeNum); @@ -658,7 +654,6 @@ namespace SplitterComponent { // FUNCTION LOCAL VARIABLE DECLARATIONS: int WhichSplitter; - int i; // Obtains and Allocates AirLoopHVAC:ZoneSplitter related parameters from input file if (state.dataSplitterComponent->GetSplitterInputFlag) { // First time subroutine has been entered @@ -676,7 +671,7 @@ namespace SplitterComponent { SplitterNodeNumbers.allocate(state.dataSplitterComponent->SplitterCond(WhichSplitter).NumOutletNodes + 2); SplitterNodeNumbers(1) = state.dataSplitterComponent->SplitterCond(WhichSplitter).InletNode; SplitterNodeNumbers(2) = state.dataSplitterComponent->SplitterCond(WhichSplitter).NumOutletNodes; - for (i = 1; i <= SplitterNodeNumbers(2); ++i) { + for (int i = 1; i <= SplitterNodeNumbers(2); ++i) { SplitterNodeNumbers(i + 2) = state.dataSplitterComponent->SplitterCond(WhichSplitter).OutletNode(i); } } diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index 31c2495e955..2497c2ec90e 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -909,11 +909,9 @@ namespace SteamBaseboardRadiator { static constexpr std::string_view RoutineName("InitSteamCoil"); - int Loop; int SteamInletNode; Real64 StartEnthSteam; Real64 SteamDensity; - bool errFlag; // Do the one time initializations if (state.dataSteamBaseboardRadiator->MyOneTimeFlag) { @@ -930,7 +928,7 @@ namespace SteamBaseboardRadiator { // Need to check all units to see if they are on ZoneHVAC:EquipmentList or issue warning if (!state.dataSteamBaseboardRadiator->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataSteamBaseboardRadiator->ZoneEquipmentListChecked = true; - for (Loop = 1; Loop <= state.dataSteamBaseboardRadiator->NumSteamBaseboards; ++Loop) { + for (int Loop = 1; Loop <= state.dataSteamBaseboardRadiator->NumSteamBaseboards; ++Loop) { if (CheckZoneEquipmentList(state, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, state.dataSteamBaseboardRadiator->SteamBaseboard(Loop).Name)) { @@ -945,7 +943,7 @@ namespace SteamBaseboardRadiator { if (state.dataSteamBaseboardRadiator->SetLoopIndexFlag(BaseboardNum)) { if (allocated(state.dataPlnt->PlantLoop)) { - errFlag = false; + bool errFlag = false; ScanPlantLoopsForObject(state, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipType, @@ -1073,16 +1071,7 @@ namespace SteamBaseboardRadiator { bool IsAutoSize(false); // Indicator to autosizing steam flow Real64 SteamVolFlowRateMaxDes(0.0); // Design maximum steam volume flow for reporting Real64 SteamVolFlowRateMaxUser(0.0); // User hard-sized maximum steam volume flow for reporting - std::string CompName; // component name - std::string CompType; // component type - std::string SizingString; // input field sizing description (e.g., Nominal Capacity) Real64 TempSize; // autosized value of coil input field - int FieldNum = 1; // IDD numeric field number where input field description is found - int SizingMethod; // Integer representation of sizing method name (HeatingCapacitySizing) - bool PrintFlag; // TRUE when sizing information is reported in the eio file - int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, and FractionOfAutosizedHeatingCapacity ) - - int &CurZoneEqNum = state.dataSize->CurZoneEqNum; SteamBaseboardDesignData SteamBaseboardDesignDataObject{state.dataSteamBaseboardRadiator->SteamBaseboardDesign( state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).DesignObjectPtr)}; // Contains the data for variable flow hydronic systems @@ -1096,7 +1085,7 @@ namespace SteamBaseboardRadiator { if (PltSizSteamNum > 0) { state.dataSize->DataScalableCapSizingON = false; - + int &CurZoneEqNum = state.dataSize->CurZoneEqNum; if (CurZoneEqNum > 0) { if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamVolFlowRateMax == AutoSize) { @@ -1116,14 +1105,17 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); - CompType = state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam; - CompName = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name; + std::string CompName = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name; // component name + std::string CompType = state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam; // component type state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0; state.dataSize->DataZoneNumber = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZonePtr; - SizingMethod = HeatingCapacitySizing; - FieldNum = 1; - PrintFlag = false; - SizingString = state.dataSteamBaseboardRadiator->SteamBaseboardNumericFields(BaseboardNum).FieldNames(FieldNum) + " [W]"; + int SizingMethod = HeatingCapacitySizing; // Integer representation of sizing method name (HeatingCapacitySizing) + int FieldNum = 1; // IDD numeric field number where input field description is found + bool PrintFlag = false; // TRUE when sizing information is reported in the eio file + std::string SizingString = state.dataSteamBaseboardRadiator->SteamBaseboardNumericFields(BaseboardNum).FieldNames(FieldNum) + + " [W]"; // input field sizing description (e.g., Nominal Capacity) + int CapSizingMethod = + 0; // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, and FractionOfAutosizedHeatingCapacity) CapSizingMethod = SteamBaseboardDesignDataObject.HeatingCapMethod; zoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || diff --git a/src/EnergyPlus/SteamCoils.cc b/src/EnergyPlus/SteamCoils.cc index 10d0628044c..4195f84ed9b 100644 --- a/src/EnergyPlus/SteamCoils.cc +++ b/src/EnergyPlus/SteamCoils.cc @@ -481,7 +481,6 @@ namespace SteamCoils { int AirOutletNode; Real64 SteamDensity; Real64 StartEnthSteam; - bool errFlag; if (state.dataSteamCoils->MyOneTimeFlag) { // initialize the environment and sizing flags @@ -493,7 +492,7 @@ namespace SteamCoils { } if (state.dataSteamCoils->MyPlantScanFlag(CoilNum) && allocated(state.dataPlnt->PlantLoop)) { - errFlag = false; + bool errFlag = false; ScanPlantLoopsForObject(state, state.dataSteamCoils->SteamCoil(CoilNum).Name, state.dataSteamCoils->SteamCoil(CoilNum).CoilType, @@ -671,12 +670,7 @@ namespace SteamCoils { Real64 RhoAirStd; // density of air at standard conditions Real64 CpAirStd; // specific heat of air at std conditions Real64 CpWater; // specific heat of water (condensed steam) - - std::string CompName; // component name - std::string CompType; // component type - std::string SizingString; // input field sizing description (e.g., Nominal Capacity) - bool bPRINT = false; // TRUE if sizing is reported to output (eio) - Real64 TempSize; // autosized value + Real64 TempSize; // autosized value ErrorsFound = false; PltSizSteamNum = 0; @@ -693,7 +687,6 @@ namespace SteamCoils { CpAirStd = PsyCpAirFnW(0.0); bool coilWasAutosized(false); // coil report - auto &OASysEqSizing = state.dataSize->OASysEqSizing; auto &TermUnitSizing = state.dataSize->TermUnitSizing; // If this is a steam coil @@ -717,8 +710,12 @@ namespace SteamCoils { if (state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamVolFlowRate == AutoSize) { CheckSysSizing(state, "Coil:Heating:Steam", state.dataSteamCoils->SteamCoil(CoilNum).Name); + std::string CompName; // component name + std::string CompType; // component type + std::string SizingString; // input field sizing description (e.g., Nominal Capacity) + bool bPRINT = false; // TRUE if sizing is reported to output (eio) if (state.dataSteamCoils->SteamCoil(CoilNum).DesiccantRegenerationCoil) { - + auto &OASysEqSizing = state.dataSize->OASysEqSizing; state.dataSize->DataDesicRegCoil = true; state.dataSize->DataDesicDehumNum = state.dataSteamCoils->SteamCoil(CoilNum).DesiccantDehumNum; CompType = state.dataSteamCoils->SteamCoil(CoilNum).SteamCoilType; // this is casting an int to a string diff --git a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc index 06a653fd864..5e4aff487a2 100644 --- a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc +++ b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc @@ -469,19 +469,16 @@ namespace SurfaceGroundHeatExchanger { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 DesignFlow; // Hypothetical design flow rate - int Cons; // construction counter - int LayerNum; // material layer number for bottom Real64 OutDryBulb; // Height Dependent dry bulb. - auto &s_mat = state.dataMaterial; - // get QTF data - only once if (this->InitQTF) { - for (Cons = 1; Cons <= state.dataHeatBal->TotConstructs; ++Cons) { + for (int Cons = 1; Cons <= state.dataHeatBal->TotConstructs; ++Cons) { // construction counter if (Util::SameString(state.dataConstruction->Construct(Cons).Name, this->ConstructionName)) { // some error checking ?? // CTF stuff - LayerNum = state.dataConstruction->Construct(Cons).TotLayers; + int LayerNum = state.dataConstruction->Construct(Cons).TotLayers; // material layer number for bottom + auto &s_mat = state.dataMaterial; this->NumCTFTerms = state.dataConstruction->Construct(Cons).NumCTFTerms; this->CTFin = state.dataConstruction->Construct(Cons).CTFInside; // Z coefficients this->CTFout = state.dataConstruction->Construct(Cons).CTFOutside; // X coefficients @@ -621,21 +618,20 @@ namespace SurfaceGroundHeatExchanger { Real64 PastTempTop; // top surface temp - past value Real64 OldPastFluxTop; // top surface flux - past value used during iteration Real64 OldPastFluxBtm; // bottom surface flux - past value used during iteration - // variables used with current environmental conditions - auto &FluxTop = state.dataSurfaceGroundHeatExchangers->FluxTop; // top surface flux - auto &FluxBtm = state.dataSurfaceGroundHeatExchangers->FluxBtm; // bottom surface flux - auto &TempBtm = state.dataSurfaceGroundHeatExchangers->TempBtm; // bottom surface temp - auto &TempTop = state.dataSurfaceGroundHeatExchangers->TempTop; // top surface temp - Real64 TempT; // top surface temp - used in underrelaxation - Real64 TempB; // bottom surface temp - used in underrelaxation - Real64 OldFluxTop; // top surface flux - value used during iteration - Real64 OldFluxBtm; // bottom surface flux - value used during iteration - Real64 OldSourceFlux; // previous value of source flux - used during iteration - int iter; - int iter1; + Real64 TempT; // top surface temp - used in underrelaxation + Real64 TempB; // bottom surface temp - used in underrelaxation + Real64 OldFluxTop; // top surface flux - value used during iteration + Real64 OldFluxBtm; // bottom surface flux - value used during iteration + Real64 OldSourceFlux; // previous value of source flux - used during iteration // check if we are in very first call for this zone time step if (FirstHVACIteration && !state.dataHVACGlobal->ShortenTimeStepSys && this->firstTimeThrough) { + // variables used with current environmental conditions + auto &FluxTop = state.dataSurfaceGroundHeatExchangers->FluxTop; // top surface flux + auto &FluxBtm = state.dataSurfaceGroundHeatExchangers->FluxBtm; // bottom surface flux + auto &TempBtm = state.dataSurfaceGroundHeatExchangers->TempBtm; // bottom surface temp + auto &TempTop = state.dataSurfaceGroundHeatExchangers->TempTop; // top surface temp + this->firstTimeThrough = false; // calc temps and fluxes with past env. conditions and average source flux state.dataSurfaceGroundHeatExchangers->SourceFlux = this->QSrcAvg; @@ -646,7 +642,7 @@ namespace SurfaceGroundHeatExchanger { OldPastFluxBtm = 1.0e+30; TempB = 0.0; TempT = 0.0; - iter = 0; + int iter = 0; while (true) { // iterate to find surface heat balances // update coefficients @@ -750,7 +746,7 @@ namespace SurfaceGroundHeatExchanger { iter = 0; while (true) { // iterate to find source flux ++iter; - iter1 = 0; + int iter1 = 0; while (true) { // iterate to find surface heat balances ++iter1; // update top coefficients diff --git a/src/EnergyPlus/SwimmingPool.cc b/src/EnergyPlus/SwimmingPool.cc index 26ae5156ca3..31a987fa391 100644 --- a/src/EnergyPlus/SwimmingPool.cc +++ b/src/EnergyPlus/SwimmingPool.cc @@ -813,8 +813,8 @@ void SwimmingPoolData::initSwimmingPoolPlantLoopIndex(EnergyPlusData &state) static constexpr std::string_view RoutineName("InitSwimmingPoolPlantLoopIndex"); if (this->MyPlantScanFlagPool && allocated(state.dataPlnt->PlantLoop)) { - bool errFlag = false; if (this->WaterInletNode > 0) { + bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject( state, this->Name, DataPlant::PlantEquipmentType::SwimmingPool_Indoor, this->HWplantLoc, errFlag, _, _, _, this->WaterInletNode, _); if (errFlag) { diff --git a/src/EnergyPlus/SystemAvailabilityManager.cc b/src/EnergyPlus/SystemAvailabilityManager.cc index e5808b4972f..88324b3e283 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.cc +++ b/src/EnergyPlus/SystemAvailabilityManager.cc @@ -1253,14 +1253,13 @@ namespace Avail { state.dataAvail->GetAvailMgrInputFlag = false; } - bool ErrorsFound = false; std::string const cCurrentModuleObject = "AvailabilityManagerAssignmentList"; auto &ip = state.dataInputProcessing->inputProcessor; state.dataAvail->NumAvailManagerLists = ip->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataAvail->NumAvailManagerLists > 0) { - + bool ErrorsFound = false; state.dataAvail->ListData.allocate(state.dataAvail->NumAvailManagerLists); auto const instances = ip->epJSON.find(cCurrentModuleObject); auto const &objectSchemaProps = ip->getObjectSchemaProps(state, cCurrentModuleObject); @@ -1477,10 +1476,6 @@ namespace Avail { // If not allocated, ZoneComp structure will be allocated to "Total num of zone equip types" and // ZoneCompAvailMgrs structure will be allocated to "Total number of components of the indicated type". - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string AvailabilityListName; // name that should be an Availability Manager List Name - int CompNumAvailManagers; // Number of availability managers associated with a ZoneHVAC:* component - if (state.dataAvail->GetAvailListsInput) { GetSysAvailManagerListInputs(state); state.dataAvail->GetAvailListsInput = false; @@ -1488,17 +1483,17 @@ namespace Avail { auto &zoneComp = state.dataAvail->ZoneComp(ZoneEquipType); auto &availMgr = zoneComp.ZoneCompAvailMgrs(CompNum); - if (availMgr.Input) { // when both air loop and zone eq avail managers are present, zone - // avail mngrs list name has not been read in first time through here - // (see end of if block) - AvailabilityListName = availMgr.AvailManagerListName; + if (availMgr.Input) { // when both air loop and zone eq avail managers are present, zone + // avail mngrs list name has not been read in first time through here + // (see end of if block) + std::string AvailabilityListName = availMgr.AvailManagerListName; // name that should be an Availability Manager List Name int Found = 0; if (state.dataAvail->NumAvailManagerLists > 0) { Found = Util::FindItemInList(AvailabilityListName, state.dataAvail->ListData); } if (Found != 0) { availMgr.NumAvailManagers = state.dataAvail->ListData(Found).NumItems; - CompNumAvailManagers = availMgr.NumAvailManagers; + int CompNumAvailManagers = availMgr.NumAvailManagers; // Number of availability managers associated with a ZoneHVAC:* component availMgr.availStatus = Status::NoAction; availMgr.StartTime = 0; availMgr.StopTime = 0; @@ -1590,9 +1585,6 @@ namespace Avail { using DataZoneEquipment::NumValidSysAvailZoneComponents; - int ZoneListNum; - int ScanZoneListNum; - int ZoneNum; // One time initializations if (state.dataAvail->InitSysAvailManagers_MyOneTimeFlag) { @@ -1600,6 +1592,9 @@ namespace Avail { for (int SysAvailNum = 1; SysAvailNum <= state.dataAvail->NumOptStartSysAvailMgrs; ++SysAvailNum) { auto &optimumStartMgr = state.dataAvail->OptimumStartData(SysAvailNum); if (optimumStartMgr.optimumStartControlType == OptimumStartControlType::MaximumOfZoneList) { + int ZoneListNum; + int ScanZoneListNum; + int ZoneNum; // a zone list ZoneListNum = Util::FindItemInList(optimumStartMgr.ZoneListName, state.dataHeatBal->ZoneList); if (ZoneListNum > 0) { @@ -2296,10 +2291,6 @@ namespace Avail { Array2D DayValues; Array2D DayValuesTmr; - int JDay; - int TmrJDay; - int TmrDayOfWeek; - int ZoneNum; Real64 FanStartTime; Real64 FanStartTimeTmr; Real64 PreStartTime; @@ -2313,7 +2304,6 @@ namespace Avail { bool CycleOnFlag(false); bool OSReportVarFlag(true); int NumPreDays; - int NumOfZonesInList; Real64 AdaTempGradHeat; Real64 AdaTempGradCool; Real64 ATGUpdateTime1(0.0); @@ -2322,11 +2312,9 @@ namespace Avail { Real64 ATGUpdateTemp2(0.0); bool ATGUpdateFlag1(false); bool ATGUpdateFlag2(false); - int ATGCounter; int ATGWCZoneNumHi; int ATGWCZoneNumLo; Real64 NumHoursBeforeOccupancy; // Variable to store the number of hours before occupancy in optimum start period - bool exitLoop; // exit loop on found data Status availStatus = Status::Invalid; @@ -2377,9 +2365,11 @@ namespace Avail { if (state.dataGlobal->KickOffSimulation) { availStatus = Status::NoAction; } else { - JDay = state.dataEnvrn->DayOfYear; - TmrJDay = JDay + 1; - TmrDayOfWeek = state.dataEnvrn->DayOfWeekTomorrow; + int JDay = state.dataEnvrn->DayOfYear; + int TmrJDay = JDay + 1; + int TmrDayOfWeek = state.dataEnvrn->DayOfWeekTomorrow; + int ZoneNum; + int NumOfZonesInList; DayValues.allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); DayValuesTmr.allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); @@ -2411,7 +2401,7 @@ namespace Avail { FanStartTime = 0.0; FanStartTimeTmr = 0.0; - exitLoop = false; + bool exitLoop = false; // exit loop on found data for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { for (int ts = 0; ts <= state.dataGlobal->TimeStepsInHour; ++ts) { if (dayVals[hr * state.dataGlobal->TimeStepsInHour + ts] <= 0.0) { @@ -2840,7 +2830,7 @@ namespace Avail { } break; case ControlAlgorithm::AdaptiveTemperatureGradient: { - + int ATGCounter; if (OptStartMgr.optimumStartControlType == OptimumStartControlType::ControlZone) { ZoneNum = OptStartMgr.ZoneNum; if (!allocated(state.dataHeatBalFanSys->TempTstatAir) || !allocated(state.dataHeatBalFanSys->zoneTstatSetpts)) { @@ -3501,7 +3491,6 @@ namespace Avail { using namespace DataAirLoop; - int ZoneInSysNum; bool TempCheck; // TRUE if one zone's temperature is above the value of the vent temp sched bool DelTCheck; // TRUE if the control zone temperature - outside temperature > VentDelT bool LowLimCheck; // TRUE if one zones's air temperature is below this value @@ -3532,7 +3521,7 @@ namespace Avail { LowLimCheck = true; } } else { - for (ZoneInSysNum = 1; ZoneInSysNum <= state.dataAirLoop->AirToZoneNodeInfo(PriAirSysNum).NumZonesCooled; + for (int ZoneInSysNum = 1; ZoneInSysNum <= state.dataAirLoop->AirToZoneNodeInfo(PriAirSysNum).NumZonesCooled; ++ZoneInSysNum) { // loop over zones in system int ZoneNum = state.dataAirLoop->AirToZoneNodeInfo(PriAirSysNum).CoolCtrlZoneNums(ZoneInSysNum); @@ -4331,17 +4320,11 @@ namespace Avail { static constexpr std::string_view routineName = "InitHybridVentSysAvailMgr"; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int AirLoopNum; // Air loop number - int AirLoopCount; // Air loop name count - int SysAvailIndex; // Hybrid Ventilation Sys Avail Manager index - int ZoneEquipType; - int HybridVentNum; - // One time initializations if (state.dataAvail->MyOneTimeFlag && allocated(state.dataZoneEquip->ZoneEquipConfig) && allocated(state.dataAirSystemsData->PrimaryAirSystems)) { + bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine + int AirLoopNum; // Air loop number // Ensure the controlled zone is listed and defined in an HVAC Air Loop for (int SysAvailNum = 1; SysAvailNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++SysAvailNum) { @@ -4362,10 +4345,10 @@ namespace Avail { } } - bool zoneFound = false; int ControlledZoneNum = hybridVentMgr.ControlledZoneNum; if (hybridVentMgr.HybridVentMgrConnectedToAirLoop) { if (hybridVentMgr.ControlledZoneNum > 0) { + bool zoneFound = false; for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++zoneInNode) { if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNodeAirLoopNum(zoneInNode) == hybridVentMgr.AirLoopNum) { zoneFound = true; @@ -4387,7 +4370,7 @@ namespace Avail { for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++zoneInNode) { if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNodeAirLoopNum(zoneInNode) == hybridVentMgr.AirLoopNum && hybridVentMgr.AirLoopNum > 0) { - for (HybridVentNum = 1; HybridVentNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++HybridVentNum) { + for (int HybridVentNum = 1; HybridVentNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++HybridVentNum) { if (!state.dataAvail->HybridVentData(HybridVentNum).HybridVentMgrConnectedToAirLoop && (HybridVentNum != SysAvailNum)) { if (ControlledZoneNum == state.dataAvail->HybridVentData(HybridVentNum).ControlledZoneNum && @@ -4443,7 +4426,8 @@ namespace Avail { // Ensure an airloop name is not used more than once in the hybrid ventilation control objects for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { // loop over the primary air systems - AirLoopCount = 0; + int AirLoopCount = 0; // Air loop name count + int SysAvailIndex; // Hybrid Ventilation Sys Avail Manager index for (int SysAvailNum = 1; SysAvailNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++SysAvailNum) { if (Util::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Name, state.dataAvail->HybridVentData(SysAvailNum).AirLoopName)) { @@ -4487,7 +4471,7 @@ namespace Avail { } if (allocated(state.dataAvail->ZoneComp)) { - for (ZoneEquipType = 1; ZoneEquipType <= NumValidSysAvailZoneComponents; ++ZoneEquipType) { // loop over the zone equipment types + for (int ZoneEquipType = 1; ZoneEquipType <= NumValidSysAvailZoneComponents; ++ZoneEquipType) { // loop over the zone equipment types if (state.dataAvail->ZoneComp(ZoneEquipType).TotalNumComp > 0) { for (auto &e : state.dataAvail->ZoneComp(ZoneEquipType).ZoneCompAvailMgrs) { e.availStatus = Status::NoAction; @@ -4563,7 +4547,6 @@ namespace Avail { using Psychrometrics::PsyTdpFnWPb; using Psychrometrics::PsyWFnTdbRhPb; - int HStatZoneNum; // Humidity control zone number Real64 ZoneAirEnthalpy; // Zone air enthalpy Real64 ZoneAirDewPoint; // Zone air dew point temperature Real64 ZoneAirRH; // Zone air relative humidity @@ -4572,8 +4555,6 @@ namespace Avail { Real64 WSetPoint; // Humidity ratio setpoint from a given RH setpoint schedule Real64 OASetPoint; // Outdoor air setpoint from a given OA setpoint schedule Real64 ACH; // Zone air change per hour - bool found; // Used for humidistat object - bool HybridVentModeOA; // USed to check whether HybridVentModeOA is allowed Real64 ZoneRHHumidifyingSetPoint; // Zone humidifying setpoint (%) Real64 ZoneRHDehumidifyingSetPoint; // Zone dehumidifying setpoint (%) int SimpleControlType; // Simple control type from a schedule: 0 individual, 1 global @@ -4581,10 +4562,6 @@ namespace Avail { Real64 minAdaTem; // minimum adaptive temperature for adaptive temperature control Real64 maxAdaTem; // maximum adaptive temperature for adaptive temperature control bool KeepStatus; // true, if minimum time operation is needed - int ZoneEquipType; - int ZoneCompNum; - int AirLoopNum; - int Num; Status availStatus; KeepStatus = false; @@ -4650,7 +4627,7 @@ namespace Avail { case VentCtrlType::OA: { OASetPoint = hybridVentMgr.minOASched->getCurrentVal(); ACH = 0.0; - HybridVentModeOA = true; + bool HybridVentModeOA = true; // USed to check whether HybridVentModeOA is allowed if (!hybridVentMgr.HybridVentMgrConnectedToAirLoop) { if (state.afn->simulation_control.type == AirflowNetwork::ControlType::NoMultizoneOrDistribution) { HybridVentModeOA = false; @@ -4708,8 +4685,8 @@ namespace Avail { hybridVentMgr.CO2 = state.dataContaminantBalance->ZoneAirCO2(ZoneNum); if (state.dataContaminantBalance->ZoneAirCO2(ZoneNum) > state.dataContaminantBalance->ZoneCO2SetPoint(ZoneNum)) { if (hybridVentMgr.HybridVentMgrConnectedToAirLoop) { - AirLoopNum = hybridVentMgr.AirLoopNum; - for (Num = 1; Num <= state.dataAirLoop->PriAirSysAvailMgr(hybridVentMgr.AirLoopNum).NumAvailManagers; ++Num) { + int AirLoopNum = hybridVentMgr.AirLoopNum; + for (int Num = 1; Num <= state.dataAirLoop->PriAirSysAvailMgr(hybridVentMgr.AirLoopNum).NumAvailManagers; ++Num) { availStatus = SimSysAvailManager(state, state.dataAirLoop->PriAirSysAvailMgr(AirLoopNum).availManagers(Num).type, state.dataAirLoop->PriAirSysAvailMgr(AirLoopNum).availManagers(Num).Name, @@ -4724,8 +4701,8 @@ namespace Avail { } } else if (hybridVentMgr.SimHybridVentSysAvailMgr) { hybridVentMgr.ctrlStatus = VentCtrlStatus::Open; - for (ZoneEquipType = 1; ZoneEquipType <= NumValidSysAvailZoneComponents; ++ZoneEquipType) { - for (ZoneCompNum = 1; ZoneCompNum <= state.dataAvail->ZoneComp(ZoneEquipType).TotalNumComp; ++ZoneCompNum) { + for (int ZoneEquipType = 1; ZoneEquipType <= NumValidSysAvailZoneComponents; ++ZoneEquipType) { + for (int ZoneCompNum = 1; ZoneCompNum <= state.dataAvail->ZoneComp(ZoneEquipType).TotalNumComp; ++ZoneCompNum) { if (state.dataAvail->ZoneComp(ZoneEquipType).ZoneCompAvailMgrs(ZoneCompNum).availStatus == Status::CycleOn) { hybridVentMgr.ctrlStatus = VentCtrlStatus::Close; break; @@ -4819,8 +4796,9 @@ namespace Avail { double(hybridVentMgr.ctrlType)); } } - found = false; - for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) { + bool found = false; // Used for humidistat object + for (int HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; + ++HStatZoneNum) { // Humidity control zone number if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum == ZoneNum) { found = true; ZoneRHHumidifyingSetPoint = state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).humidifyingSched->getCurrentVal(); From 78decf6420bb8727966d2ae0fc1a9ad438c473a3 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Mon, 1 Dec 2025 17:10:25 -0700 Subject: [PATCH 12/33] remove unused variables --- src/EnergyPlus/SolarShading.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index b616e5202a0..214a05d43a7 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -12239,7 +12239,6 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) state.dataHeatBal->EnclSolInitialDifSolReflW(enclosureNum) += DifSolarReflW; // [W] // Now calc diffuse solar absorbed by shade/blind itself - int BlNum = surfShade.blind.matNum; // Blind number if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed by shade or screen [W] ShBlDifSolarAbsW = WinDifSolarTrans_Factor * constrSh.AbsDiffBackShade; @@ -12763,7 +12762,6 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // ZoneDifSolarDistReflectedTotl += DifSolarReflW; // debug // Now calc diffuse solar absorbed by shade/blind itself - int BlNum = surfShade.blind.matNum; // Blind number if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed by shade or screen [W] ShBlDifSolarAbsW = SolarTrans_ViewFactor * constrSh.AbsDiffBackShade; From 8c5e976c36e9a02e9ac153549b525a2f084a1ab3 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Mon, 1 Dec 2025 23:09:04 -0700 Subject: [PATCH 13/33] remove unused variables 2 --- src/EnergyPlus/SolarShading.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 214a05d43a7..a609379a3f3 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -12705,7 +12705,6 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(HeatTransSurfNum) += (SolarTrans_ViewFactor - DifSolarReflW) / surf.Area; } else { - auto const &surfShade = s_surf->surfShades(HeatTransSurfNum); // Interior, exterior or between-glass shade, screen or blind in place // Init accumulator for transmittance calc below From 4fe2225f9f8b86e94316e00b00498a5f78d783ac Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Fri, 5 Dec 2025 09:31:13 -0700 Subject: [PATCH 14/33] move declarations outside of for loops to prevent recreating on every iteration --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 2 +- src/EnergyPlus/Autosizing/Base.cc | 2 +- src/EnergyPlus/BaseboardElectric.cc | 2 +- src/EnergyPlus/DXCoils.cc | 19 +++--- src/EnergyPlus/DataHeatBalance.cc | 2 +- src/EnergyPlus/DemandManager.cc | 2 +- src/EnergyPlus/DuctLoss.cc | 2 +- src/EnergyPlus/HeatBalanceHAMTManager.cc | 2 +- src/EnergyPlus/HybridModel.cc | 2 +- .../InputProcessing/InputProcessor.cc | 3 +- src/EnergyPlus/OutAirNodeManager.cc | 18 ++---- .../PhotovoltaicThermalCollectors.cc | 10 ++-- src/EnergyPlus/PlantLoopHeatPumpEIR.cc | 10 ++-- src/EnergyPlus/PurchasedAirManager.cc | 4 +- src/EnergyPlus/RefrigeratedCase.cc | 60 +++++++++---------- src/EnergyPlus/RuntimeLanguageProcessor.cc | 22 +++---- 16 files changed, 78 insertions(+), 84 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 8f587e33a88..ae5751eb244 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -2029,7 +2029,7 @@ namespace AirflowNetwork { // Check the number of primary air loops if (!simulation_control.DuctLoss) { - int NumAPL; + int NumAPL = 0; if (distribution_simulated) { NumAPL = m_state.dataInputProcessing->inputProcessor->getNumObjectsFound(m_state, "AirLoopHVAC"); if (NumAPL > 0) { diff --git a/src/EnergyPlus/Autosizing/Base.cc b/src/EnergyPlus/Autosizing/Base.cc index 62d6932873c..1bfed56c2a4 100644 --- a/src/EnergyPlus/Autosizing/Base.cc +++ b/src/EnergyPlus/Autosizing/Base.cc @@ -778,8 +778,8 @@ void BaseSizer::calcCoilWaterFlowRates(EnergyPlusData &state, int arrayIndex = -1; // check if component has been added to array if (!plntComps.empty()) { + auto &cmpType = state.dataPlnt->PlantLoop(loopNum).plantCoilObjectTypes; for (size_t i = 0; i < plntComps.size(); ++i) { - auto &cmpType = state.dataPlnt->PlantLoop(loopNum).plantCoilObjectTypes; if (plntComps[i] == compName && cmpType[i] == static_cast(getEnumValue(DataPlant::PlantEquipTypeNames, compType))) { arrayIndex = i; diff --git a/src/EnergyPlus/BaseboardElectric.cc b/src/EnergyPlus/BaseboardElectric.cc index 8cb56193336..be26e7a3db4 100644 --- a/src/EnergyPlus/BaseboardElectric.cc +++ b/src/EnergyPlus/BaseboardElectric.cc @@ -188,8 +188,8 @@ namespace BaseboardElectric { int NumNums = 0; int IOStat = 0; int BaseboardNum = 0; + auto &s_ipsc = state.dataIPShortCut; for (int ConvElecBBNum = 1; ConvElecBBNum <= NumConvElecBaseboards; ++ConvElecBBNum) { - auto &s_ipsc = state.dataIPShortCut; state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, ConvElecBBNum, diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 018f49a90ad..6ecda6bb2d5 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -1388,6 +1388,7 @@ void GetDXCoils(EnergyPlusData &state) // Loop over the Multimode DX Coils and get & load the data CurrentModuleObject = "Coil:Cooling:DX:TwoStageWithHumidityControlMode"; + int AlphaIndex; // Index for current alpha field for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDXMulModeCoils; ++DXCoilIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1494,7 +1495,7 @@ void GetDXCoils(EnergyPlusData &state) // Set starting alpha index for coil performance inputs - int AlphaIndex = 6; // Index for current alpha field + AlphaIndex = 6; // allocate performance modes for numeric field strings used for sizing routine state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate( thisDXCoil.NumDehumidModes * 2 + thisDXCoil.NumCapacityStages * 2); // not sure this math is correct, ask MW @@ -3000,10 +3001,10 @@ void GetDXCoils(EnergyPlusData &state) if (instances_whPumped != s_ip->epJSON.end()) { auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_whPumped.value(); + std::string cFieldName; for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { ++DXCoilNum; - std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); @@ -3527,10 +3528,10 @@ void GetDXCoils(EnergyPlusData &state) if (instances_whWrapped != s_ip->epJSON.end()) { auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_whWrapped.value(); + std::string cFieldName; for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { ++DXCoilNum; - std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); @@ -6880,7 +6881,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur // CR7308 - Wait for zone and air loop equipment to be simulated, then print out report variables if (state.dataDXCoils->CrankcaseHeaterReportVarFlag) { if (state.dataAirLoop->AirLoopInputsFilled) { - // Set report variables for DX cooling coils that will have a crankcase heater (all DX coils not used in a HP AC unit) + // Set report variables for DX cooling coils that will have a crankcase heater (all DX coils not used in a HP AC unit) int DXCoilNumTemp; // Counter for crankcase heater report variable DO loop for (DXCoilNumTemp = 1; DXCoilNumTemp <= state.dataDXCoils->NumDXCoils; ++DXCoilNumTemp) { auto &dXCoil_withCrankCase = state.dataDXCoils->DXCoil(DXCoilNumTemp); @@ -7040,9 +7041,9 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes + int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes + int CapacityStageNum; // Loop index for 1,Number of capacity stages for (DehumidModeNum = 0; DehumidModeNum <= thisDXCoil.NumDehumidModes; ++DehumidModeNum) { - int CapacityStageNum; // Loop index for 1,Number of capacity stages for (CapacityStageNum = 1; CapacityStageNum <= thisDXCoil.NumCapacityStages; ++CapacityStageNum) { Mode = DehumidModeNum * 2 + CapacityStageNum; // Check for zero capacity or zero max flow rate @@ -14660,7 +14661,8 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum TotCapFlowModFac = CurveValue(state, thisDXCoil.CCapFFlow(1), AirMassFlowRatioRated); TotCapTempModFac = CurveValue(state, thisDXCoil.CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); - for (int Iter = 1; Iter <= 4; ++Iter) { // iterative solution in the event that net capacity is near a threshold for external static + int Iter; + for (Iter = 1; Iter <= 4; ++Iter) { // iterative solution in the event that net capacity is near a threshold for external static // Obtain external static pressure from Table 5 in ANSI/AHRI Std. 340/360-2007 if (NetCoolingCapRated <= 21000.0) { ExternalStatic = 50.0; @@ -15077,7 +15079,8 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum // determine footnote content int countStaticInputs = 0; - for (int index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { + int index; + for (index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { auto &dxCoil_temp = state.dataDXCoils->DXCoil(index); if (dxCoil_temp.RateWithInternalStaticAndFanObject && dxCoil_temp.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { ++countStaticInputs; diff --git a/src/EnergyPlus/DataHeatBalance.cc b/src/EnergyPlus/DataHeatBalance.cc index 3d414f53efb..fcd6d16a56e 100644 --- a/src/EnergyPlus/DataHeatBalance.cc +++ b/src/EnergyPlus/DataHeatBalance.cc @@ -860,10 +860,10 @@ int AssignReverseConstructionNumber(EnergyPlusData &state, // replace others... state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).Name = "iz-" + state.dataConstruction->Construct(ConstrNum).Name; state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; + auto &s_mat = state.dataMaterial; for (nLayer = 1; nLayer <= Construction::MaxLayersInConstruct; ++nLayer) { state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).LayerPoint(nLayer) = state.dataConstruction->LayerPoint(nLayer); if (state.dataConstruction->LayerPoint(nLayer) != 0) { - auto &s_mat = state.dataMaterial; state.dataHeatBal->NominalRforNominalUCalculation(state.dataHeatBal->TotConstructs) += s_mat->materials(state.dataConstruction->LayerPoint(nLayer))->NominalR; } diff --git a/src/EnergyPlus/DemandManager.cc b/src/EnergyPlus/DemandManager.cc index eb26e94fce5..805354c45fa 100644 --- a/src/EnergyPlus/DemandManager.cc +++ b/src/EnergyPlus/DemandManager.cc @@ -325,13 +325,13 @@ void GetDemandManagerListInput(EnergyPlusData &state) int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine bool ErrorsFound = false; + auto &s_ipsc = state.dataIPShortCut; state.dataDemandManager->DemandManagerList.allocate(state.dataDemandManager->NumDemandManagerList); for (int ListNum = 1; ListNum <= state.dataDemandManager->NumDemandManagerList; ++ListNum) { auto &thisDemandMgrList = state.dataDemandManager->DemandManagerList(ListNum); - auto &s_ipsc = state.dataIPShortCut; s_ip->getObjectItem(state, cCurrentModuleObject, ListNum, diff --git a/src/EnergyPlus/DuctLoss.cc b/src/EnergyPlus/DuctLoss.cc index 2cbbc31860b..f19be8da26f 100644 --- a/src/EnergyPlus/DuctLoss.cc +++ b/src/EnergyPlus/DuctLoss.cc @@ -719,10 +719,10 @@ namespace DuctLoss { { if (state.dataDuctLoss->AirLoopConnectionFlag) { bool errorsFound(false); + std::string CurrentModuleObject; for (int DuctLossNum = 1; DuctLossNum <= state.dataDuctLoss->NumOfDuctLosses; DuctLossNum++) { auto &thisDuctLoss(state.dataDuctLoss->ductloss(DuctLossNum)); - std::string CurrentModuleObject; thisDuctLoss.AirLoopNum = Util::FindItemInList(thisDuctLoss.AirLoopName, state.dataAirSystemsData->PrimaryAirSystems); if (thisDuctLoss.LossType == DuctLossType::Conduction) { CurrentModuleObject = cCMO_DuctLossConduction; diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index 7a2c75a8705..062198a7b0c 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -596,6 +596,7 @@ namespace HeatBalanceHAMTManager { // Vapor Transfer coefficients HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject7); // SurfaceProperties:VaporCoefficients + int vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); for (int item = 1; item <= HAMTitems; ++item) { s_ip->getObjectItem(state, cHAMTObject7, @@ -611,7 +612,6 @@ namespace HeatBalanceHAMTManager { cNumericFieldNames); ErrorObjectHeader eoh{routineName, cHAMTObject7, AlphaArray(1)}; - int vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); if (vtcsid == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 296e23a9415..77800af78b9 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -101,6 +101,7 @@ namespace HybridModel { int NumAlphas = 0; // Number of Alphas for each GetobjectItem call int NumNumbers = 0; // Number of Numbers for each GetobjectItem call int IOStatus = 0; + int ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name for (int HybridModelNum = 1; HybridModelNum <= state.dataHybridModel->NumOfHybridModelZones; ++HybridModelNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -116,7 +117,6 @@ namespace HybridModel { cAlphaFieldNames, cNumericFieldNames); - int ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name if (ZonePtr > 0) { auto &hmZone = state.dataHybridModel->hybridModelZones(ZonePtr); hmZone.Name = cAlphaArgs(1); // Zone HybridModel name diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.cc b/src/EnergyPlus/InputProcessing/InputProcessor.cc index 9cda38a2962..30476e53387 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.cc +++ b/src/EnergyPlus/InputProcessing/InputProcessor.cc @@ -1094,10 +1094,9 @@ void InputProcessor::getObjectItem(EnergyPlusData &state, auto const &legacy_idd_extensibles = legacy_idd_extensibles_iter.value(); auto const &epJSON_extensions_array = epJSON_extensions_array_itr.value(); auto const &schema_extension_fields = schema_obj_props[extension_key]["items"]["properties"]; - + size_t extensible_count = 0; for (auto it = epJSON_extensions_array.begin(); it != epJSON_extensions_array.end(); ++it) { auto const &epJSON_extension_obj = it.value(); - size_t extensible_count = 0; for (size_t i = 0; i < legacy_idd_extensibles.size(); i++, extensible_count++) { std::string const field_name = legacy_idd_extensibles[i].get(); auto const field_info = legacy_idd_field_info.find(field_name); diff --git a/src/EnergyPlus/OutAirNodeManager.cc b/src/EnergyPlus/OutAirNodeManager.cc index 23cdd6b6c41..cfb137fa664 100644 --- a/src/EnergyPlus/OutAirNodeManager.cc +++ b/src/EnergyPlus/OutAirNodeManager.cc @@ -194,8 +194,7 @@ namespace OutAirNodeManager { if (NumOutAirInletNodeLists > 0) { // Loop over all outside air inlet nodes in the input and count them CurrentModuleObject = "OutdoorAir:NodeList"; - int OutAirInletNodeListNum; // OUTSIDE AIR INLET NODE LIST index - for (OutAirInletNodeListNum = 1; OutAirInletNodeListNum <= NumOutAirInletNodeLists; ++OutAirInletNodeListNum) { + for (int OutAirInletNodeListNum = 1; OutAirInletNodeListNum <= NumOutAirInletNodeLists; ++OutAirInletNodeListNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, OutAirInletNodeListNum, @@ -209,8 +208,7 @@ namespace OutAirNodeManager { cAlphaFields, cNumericFields); - int AlphaNum; // index into Alphas - for (AlphaNum = 1; AlphaNum <= NumAlphas; ++AlphaNum) { + for (int AlphaNum = 1; AlphaNum <= NumAlphas; ++AlphaNum) { ErrInList = false; // To support HVAC diagram, every outside inlet node must have a unique fluid stream number // GetNodeNums will increment the value across a node list, the starting value must be incremented @@ -233,9 +231,7 @@ namespace OutAirNodeManager { ShowContinueError(state, format("Occurred in {}, {} = {}", CurrentModuleObject, cAlphaFields(AlphaNum), Alphas(AlphaNum))); ErrorsFound = true; } - int NodeNum; // index into NodeNums - // INTEGER :: OutAirNodeNum ! index into OutAirInletNodeList - for (NodeNum = 1; NodeNum <= NumNodes; ++NodeNum) { + for (int NodeNum = 1; NodeNum <= NumNodes; ++NodeNum) { // Duplicates here are not a problem, just ignore if (!any_eq(TmpNums, NodeNums(NodeNum))) { ++ListSize; @@ -256,8 +252,7 @@ namespace OutAirNodeManager { if (NumOutsideAirNodeSingles > 0) { // Loop over all single outside air nodes in the input CurrentModuleObject = "OutdoorAir:Node"; - int OutsideAirNodeSingleNum; // OUTSIDE AIR NODE index - for (OutsideAirNodeSingleNum = 1; OutsideAirNodeSingleNum <= NumOutsideAirNodeSingles; ++OutsideAirNodeSingleNum) { + for (int OutsideAirNodeSingleNum = 1; OutsideAirNodeSingleNum <= NumOutsideAirNodeSingles; ++OutsideAirNodeSingleNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, OutsideAirNodeSingleNum, @@ -384,11 +379,8 @@ namespace OutAirNodeManager { // set the outside air nodes to the outside conditions at the // start of every heat balance time step. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int OutsideAirNodeNum; - // Do the begin time step initialization - for (OutsideAirNodeNum = 1; OutsideAirNodeNum <= state.dataOutAirNodeMgr->NumOutsideAirNodes; ++OutsideAirNodeNum) { + for (int OutsideAirNodeNum = 1; OutsideAirNodeNum <= state.dataOutAirNodeMgr->NumOutsideAirNodes; ++OutsideAirNodeNum) { int NodeNum = state.dataOutAirNodeMgr->OutsideAirNodeList(OutsideAirNodeNum); SetOANodeValues(state, NodeNum, true); } diff --git a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc index 32e71773436..42fbf903451 100644 --- a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc +++ b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc @@ -197,10 +197,11 @@ namespace PhotovoltaicThermalCollectors { static constexpr std::string_view routineName = "GetPVTSimpleCollectorsInput"; - int Item; // Item to be "gotten" - int NumAlphas; // Number of Alphas for each GetObjectItem call - int NumNumbers; // Number of Numbers for each GetObjectItem call - int IOStatus; // Used in GetObjectItem + int Item; // Item to be "gotten" + 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 tmpSimplePVTperf.allocate(NumSimplePVTPerform); for (Item = 1; Item <= NumSimplePVTPerform; ++Item) { @@ -227,7 +228,6 @@ namespace PhotovoltaicThermalCollectors { thisTmpSimplePVTperf.ThermEffic = state.dataIPShortCut->rNumericArgs(2); if (thisTmpSimplePVTperf.ThermEfficMode == ThermEfficEnum::SCHEDULED) { - bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); ErrorsFound = true; diff --git a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc index aada3927471..932b68309d9 100644 --- a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc +++ b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc @@ -1901,8 +1901,8 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state) EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::subtract}}; bool errorsFound = false; + std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (auto const &classToInput : classesToInput) { - std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; DataLoopNode::ConnectionObjectType objType = static_cast( getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, Util::makeUPPER(cCurrentModuleObject))); @@ -3345,8 +3345,8 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) }; bool errorsFound = false; + std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (auto &classToInput : classesToInput) { - std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; DataLoopNode::ConnectionObjectType objType = static_cast( @@ -3765,14 +3765,15 @@ void HeatPumpAirToWater::processInputForEIRPLHP(EnergyPlusData &state) constexpr std::array(ControlType::Num)> AWHPControlTypeUC = {"FIXEDSPEED", "VARIABLESPEED"}; if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) { auto &instancesValue = instances.value(); + std::string &cCurrentModuleObjectSingleMode = state.dataIPShortCut->cCurrentModuleObject; + bool errorsFound = false; + std::string routineName = "HeatPumpAirToWater::processInputForEIRPLHP"; for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); auto const &thisObjectName = instance.key(); state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjectName); for (auto &classToInput : classesToInput) { - std::string &cCurrentModuleObjectSingleMode = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObjectSingleMode = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; - bool errorsFound = false; DataLoopNode::ConnectionObjectType objType = static_cast( getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, Util::makeUPPER(cCurrentModuleObjectSingleMode))); @@ -3781,7 +3782,6 @@ void HeatPumpAirToWater::processInputForEIRPLHP(EnergyPlusData &state) thisAWHP.name = Util::makeUPPER(thisObjectName); thisAWHP.airSource = true; thisAWHP.waterSource = false; - std::string routineName = "HeatPumpAirToWater::processInputForEIRPLHP"; ErrorObjectHeader eoh{routineName, "HeatPump:AirToWater", thisAWHP.name}; thisAWHP.heatPumpMultiplier = state.dataInputProcessing->inputProcessor->getRealFieldValue(fields, schemaProps, "heat_pump_multiplier"); diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index 2d1184efcb2..46fe62746de 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -255,12 +255,12 @@ void GetPurchasedAir(EnergyPlusData &state) int NumNums = 0; int NumAlphas = 0; int purchAirNum = 0; + std::string fieldValue; + std::string cAlphaFieldName; InitUniqueNodeCheck(state, s_ipsc->cCurrentModuleObject); auto const &schemaProps = s_ip->getObjectSchemaProps(state, s_ipsc->cCurrentModuleObject); auto &instancesValue = instances_PurchAir.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - std::string fieldValue; - std::string cAlphaFieldName; ++purchAirNum; auto const &fields = instance.value(); std::string thisObjectName = instance.key(); diff --git a/src/EnergyPlus/RefrigeratedCase.cc b/src/EnergyPlus/RefrigeratedCase.cc index d79060a4b95..a1660d90629 100644 --- a/src/EnergyPlus/RefrigeratedCase.cc +++ b/src/EnergyPlus/RefrigeratedCase.cc @@ -694,8 +694,8 @@ void GetRefrigerationInput(EnergyPlusData &state) // bbb stovall note for future - for all curve entries, see if need fail on type or if can allow table input if (state.dataRefrigCase->NumSimulationCases > 0) { CurrentModuleObject = "Refrigeration:Case"; + int NumDisplayCases(0); // Counter for refrigerated cases in GetInput do loop for (int CaseNum = 1; CaseNum <= state.dataRefrigCase->NumSimulationCases; ++CaseNum) { - int NumDisplayCases(0); // Counter for refrigerated cases in GetInput do loop state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, CaseNum, @@ -7542,8 +7542,9 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumSimulationWalkIns > 0) { // Setup Report Variables for simulated Walk In (do not report unused WalkIns) // CurrentModuleObject='Refrigeration:WalkIn' + auto &WalkIn = state.dataRefrigCase->WalkIn; + std::string Walkin_and_zone_name; // concat name for walk-in/zone credit reporting for (int walkInNum = 1; walkInNum <= state.dataRefrigCase->NumSimulationWalkIns; ++walkInNum) { - auto &WalkIn = state.dataRefrigCase->WalkIn; auto &walkin = WalkIn(walkInNum); if (walkin.NumSysAttach == 1) { // ensure no unuseds reported SetupOutputVariable(state, @@ -7684,7 +7685,6 @@ void SetupReportInput(EnergyPlusData &state) // both the walk-in name and the zone name - see "Walkin_and_zone_name" concatenation // This new variable name is important if using an rvi file! for (int zoneId = 1; zoneId <= walkin.NumZones; ++zoneId) { - std::string Walkin_and_zone_name; // concat name for walk-in/zone credit reporting Walkin_and_zone_name = walkin.Name + "InZone" + walkin.ZoneName(zoneId); SetupOutputVariable(state, @@ -7749,8 +7749,8 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumSimulationRefrigAirChillers > 0) { // Setup Report Variables for simulated Warehouse coils (do not report unused warehouse coils) // CurrentModuleObject='Refrigeration:AirChiller' + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; for (int coilNum = 1; coilNum <= state.dataRefrigCase->NumSimulationRefrigAirChillers; ++coilNum) { - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; auto &coil = WarehouseCoil(coilNum); if (coil.NumSysAttach == 1) { // ensure no unuseds reported SetupOutputVariable(state, @@ -8317,8 +8317,8 @@ void SetupReportInput(EnergyPlusData &state) // Setup Report Variables for Refrigeration Compressor Rack if (state.dataRefrigCase->NumRefrigeratedRacks > 0) { // CurrentModuleObject='Refrigeration:CompressorRack' + auto &RefrigRack = state.dataRefrigCase->RefrigRack; for (int rackNum = 1; rackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++rackNum) { - auto &RefrigRack = state.dataRefrigCase->RefrigRack; auto &rack = RefrigRack(rackNum); if (rack.CoilFlag) { // rack serves chillers and is solved on HVAC time step SetupOutputVariable(state, @@ -8687,8 +8687,8 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigSystems > 0) { // CurrentModuleObject='Refrigeration:System' auto &Condenser = state.dataRefrigCase->Condenser; + auto &System = state.dataRefrigCase->System; for (int refrigSysNum = 1; refrigSysNum <= state.dataRefrigCase->NumRefrigSystems; ++refrigSysNum) { - auto &System = state.dataRefrigCase->System; auto &sys = System(refrigSysNum); if (sys.CoilFlag) { // system serves chillers and is solved on HVAC time step if (sys.NumStages == 1) { @@ -9644,8 +9644,8 @@ void SetupReportInput(EnergyPlusData &state) } // CondNum on DataHeatBalance::NumRefrigCondensers if (state.dataRefrigCase->NumSimulationSubcoolers > 0) { + auto &Subcooler = state.dataRefrigCase->Subcooler; for (int subcoolNum = 1; subcoolNum <= state.dataRefrigCase->NumSimulationSubcoolers; ++subcoolNum) { - auto &Subcooler = state.dataRefrigCase->Subcooler; auto &cooler = Subcooler(subcoolNum); // CurrentModuleObject='Refrigeration:Subcooler' if (cooler.CoilFlag) { // Subcooler serving system with chillers on HVAC time step @@ -9690,8 +9690,8 @@ void SetupReportInput(EnergyPlusData &state) if (state.dataRefrigCase->NumTransRefrigSystems > 0) { // CurrentModuleObject='Refrigeration:TranscriticalSystem' + auto &TransSystem = state.dataRefrigCase->TransSystem; for (int refrigSysNum = 1; refrigSysNum <= state.dataRefrigCase->NumTransRefrigSystems; ++refrigSysNum) { - auto &TransSystem = state.dataRefrigCase->TransSystem; auto &sys = TransSystem(refrigSysNum); // for both SingleStage and TwoStage systems (medium temperature loads present) SetupOutputVariable(state, @@ -10664,27 +10664,27 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) // however, be repeated when the last chiller set is called from ZoneEquipmentManager // that's why important where init goes, don't want to zero out data should keep if (state.dataRefrigCase->UseSysTimeStep) { + auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) { - auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state); } } if (this->NumCoils > 0) { + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; for (int CoilIndex = 1; CoilIndex <= this->NumCoils; ++CoilIndex) { int CoilID = this->CoilNum(CoilIndex); // already CALLed CalculateCoil(CoilID) in CoilSet specified order // increment TotalCoolingLoad for Compressors/condenser on each system - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; state.dataRefrigCase->TotalRackDeliveredCapacity += WarehouseCoil(CoilID).TotalCoolingLoad; // System(SysNum)%TotalCondDefrostCredit=System(SysNum)%TotalCondDefrostCredit + WarehouseCoil(CoilID)%HotDefrostCondCredit } // NumCoils systems } // System(SysNum)%NumCoils > 0 if (this->NumCases > 0) { + auto &RefrigCase = state.dataRefrigCase->RefrigCase; for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) { int CaseID = this->CaseNum(caseNum); - auto &RefrigCase = state.dataRefrigCase->RefrigCase; RefrigCase(CaseID).CalculateCase(state); // add evaporator load for all cases connected to rack @@ -10711,8 +10711,8 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) } // Numcases on rack > 0 if (this->NumWalkIns > 0) { + auto &WalkIn = state.dataRefrigCase->WalkIn; for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) { - auto &WalkIn = state.dataRefrigCase->WalkIn; int WalkInID = this->WalkInNum(WalkInIndex); WalkIn(WalkInID).CalculateWalkIn(state); state.dataRefrigCase->TotalRackDeliveredCapacity += WalkIn(WalkInID).TotalCoolingLoad; @@ -11803,8 +11803,8 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) // however, be repeated when the last chiller set is called from ZoneEquipmentManager // that's why important where init goes, don't want to zero out data should keep if (state.dataRefrigCase->UseSysTimeStep) { + auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) { - auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state); } } @@ -12650,8 +12650,8 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN // The system values will match the last time that system was solved, so some of the values may be // from the previous overall solution iteration. However, solution goes through 3 iterations if // there are any shared condensers, so that's ok. + int SystemID; // System number rejecting heat to this condenser for (Sysloop = 1; Sysloop <= condenser.NumSysAttach; ++Sysloop) { - int SystemID; // System number rejecting heat to this condenser SystemID = condenser.SysNum(Sysloop); TotalCondDefCredfromSysID = System(SystemID).TotalCondDefrostCredit + System(SystemID).SumCascadeCondCredit; TotalCondDefrostCreditLocal += TotalCondDefCredfromSysID; @@ -14233,9 +14233,9 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigeratedRacks > 0) { print(state.files.eio, "#Refrigeration Compressor Racks, {}\n", state.dataRefrigCase->NumRefrigeratedRacks); + std::string ChrOut2; + auto &RefrigRack = state.dataRefrigCase->RefrigRack; for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) { - std::string ChrOut2; - auto &RefrigRack = state.dataRefrigCase->RefrigRack; if (RefrigRack(RackNum).HeatRejectionLocation == HeatRejLocation::Outdoors) { ChrOut = "Outdoors"; } else { @@ -14322,10 +14322,10 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigSystems > 0) { print(state.files.eio, "#Detailed Refrigeration Systems,{}\n", state.dataRefrigCase->NumRefrigSystems); + auto &System = state.dataRefrigCase->System; + auto &Condenser = state.dataRefrigCase->Condenser; + auto &Subcooler = state.dataRefrigCase->Subcooler; for (int SystemNum = 1; SystemNum <= state.dataRefrigCase->NumRefrigSystems; ++SystemNum) { - auto &System = state.dataRefrigCase->System; - auto &Condenser = state.dataRefrigCase->Condenser; - auto &Subcooler = state.dataRefrigCase->Subcooler; print(state.files.eio, " Detailed Refrigeration System,{},{},{},{},{},{},{},{},{},{},{},{:.2R},{},{:.1R}\n", System(SystemNum).Name, @@ -14528,9 +14528,9 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumTransRefrigSystems > 0) { print(state.files.eio, "#Detailed Transcritical Refrigeration Systems,{}\n", state.dataRefrigCase->NumTransRefrigSystems); + auto &TransSystem = state.dataRefrigCase->TransSystem; + auto &GasCooler = state.dataRefrigCase->GasCooler; for (int TransSystemNum = 1; TransSystemNum <= state.dataRefrigCase->NumTransRefrigSystems; ++TransSystemNum) { - auto &TransSystem = state.dataRefrigCase->TransSystem; - auto &GasCooler = state.dataRefrigCase->GasCooler; print(state.files.eio, " Detailed Transcritical Refrigeration System,{},{},{},{},{},{},{},{},{:.1R}\n", TransSystem(TransSystemNum).Name, @@ -14766,8 +14766,8 @@ void ReportRefrigerationComponents(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigChillerSets > 0) { print(state.files.eio, "#ZoneHVAC/Refrigeration Air Chiller Sets,{}\n", state.dataRefrigCase->NumRefrigChillerSets); + auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; for (int ChillerSetNum = 1; ChillerSetNum <= state.dataRefrigCase->NumRefrigChillerSets; ++ChillerSetNum) { - auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; print(state.files.eio, "ZoneHVAC/Refrigeration Air Chiller Set,{},{},{},{}\n", AirChillerSet(ChillerSetNum).Name, @@ -15324,8 +15324,8 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco // Sum up all the case and walk-in loads served by the secondary loop if (this->NumCases > 0) { + auto &RefrigCase = state.dataRefrigCase->RefrigCase; for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) { - auto &RefrigCase = state.dataRefrigCase->RefrigCase; int CaseID = this->CaseNum(caseNum); RefrigCase(CaseID).CalculateCase(state); // increment TotalCoolingLoad Hot gas/brine defrost credits for each secondary loop @@ -15334,8 +15334,8 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco } // CaseNum } // NumCases > 0 if (this->NumWalkIns > 0) { + auto &WalkIn = state.dataRefrigCase->WalkIn; for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) { - auto &WalkIn = state.dataRefrigCase->WalkIn; int WalkInID = this->WalkInNum(WalkInIndex); WalkIn(WalkInID).CalculateWalkIn(state); // increment TotalCoolingLoad for each system @@ -15345,8 +15345,8 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco } // Secondary(SecondaryNum)%NumWalkIns > 0 if (this->NumCoils > 0) { + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; for (int CoilIndex = 1; CoilIndex <= this->NumCoils; ++CoilIndex) { - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; int CoilID = this->CoilNum(CoilIndex); // already CALL CalculateCoil(CoilID) for each coil, dispatched in coilset order for each zone // increment TotalCoolingLoad for each system @@ -15519,8 +15519,8 @@ void SumZoneImpacts(EnergyPlusData &state) // secondary receiver shells if (state.dataRefrigCase->UseSysTimeStep) { // air chillers + auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; auto &credit = CoilSysCredit(ZoneNum); credit.ReportH2ORemovedKgPerS_FromZoneRate = -credit.LatKgPerS_ToZoneRate; credit.ReportLatCreditToZoneRate = -credit.LatCreditToZoneRate; @@ -15546,8 +15546,8 @@ void SumZoneImpacts(EnergyPlusData &state) // Can arrive here when load call to refrigeration looks for cases/walkin systems and usetimestep is .FALSE. if ((!state.dataRefrigCase->UseSysTimeStep) && ((state.dataRefrigCase->NumSimulationCases > 0) || (state.dataRefrigCase->NumSimulationWalkIns > 0))) { + auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - auto &CaseWIZoneReport = state.dataRefrigCase->CaseWIZoneReport; auto &report = CaseWIZoneReport(ZoneNum); report.SenCaseCreditToZoneEnergy = state.dataHeatBal->RefrigCaseCredit(ZoneNum).SenCaseCreditToZone * state.dataGlobal->TimeStepZoneSec; // Latent always negative @@ -15790,9 +15790,9 @@ void FinalRateCoils(EnergyPlusData &state, DeRateFactor = AvailableTotalLoad / InitialTotalLoad; Real64 const time_step_sec(state.dataHVACGlobal->TimeStepSysSec); + auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; for (int CoilIndex = 1; CoilIndex <= NumCoils; ++CoilIndex) { int CoilID = System(SystemID).CoilNum(CoilIndex); - auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; auto &warehouse_coil = WarehouseCoil(CoilID); // need to adjust ice on coil due to reduction in latent load met by coil @@ -16368,8 +16368,8 @@ void ZeroHVACValues(EnergyPlusData &state) if (state.dataRefrigCase->HaveRefrigRacks) { // HaveRefrigRacks is TRUE when NumRefrigeratedRAcks > 0 // RefrigRack ALLOCATED to NumRefrigeratedRacks + auto &RefrigRack = state.dataRefrigCase->RefrigRack; for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) { - auto &RefrigRack = state.dataRefrigCase->RefrigRack; if (RefrigRack(RackNum).CondenserType == DataHeatBalance::RefrigCondenserType::Water) { Real64 MassFlowRate = 0.0; PlantUtilities::SetComponentFlowRate( @@ -16387,8 +16387,8 @@ void ZeroHVACValues(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigCondensers > 0) { // Condenser ALLOCATED to DataHeatBalance::NumRefrigCondensers + auto &Condenser = state.dataRefrigCase->Condenser; for (int CondID = 1; CondID <= state.dataRefrigCase->NumRefrigCondensers; ++CondID) { - auto &Condenser = state.dataRefrigCase->Condenser; if (Condenser(CondID).CondenserType == DataHeatBalance::RefrigCondenserType::Water) { Real64 MassFlowRate = 0.0; PlantUtilities::SetComponentFlowRate( diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 8aa1b3b604f..09f304360cc 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -340,10 +340,10 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) SetErlValueNumber(0.0, state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value); } } + int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; // reinitialize state of actuators for (ActuatorUsedLoop = 1; ActuatorUsedLoop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; ++ActuatorUsedLoop) { - int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value.Type = Value::Null; *state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).Actuated = false; @@ -363,8 +363,8 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } // reinitialize trend variables so old data are purged + int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; for (TrendVarNum = 1; TrendVarNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendVarNum) { - int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; state.dataRuntimeLang->TrendVariable(TrendVarNum).TrendValARR({1, TrendDepth}) = 0.0; } @@ -1123,6 +1123,8 @@ void ParseExpression(EnergyPlusData &state, MinusFound = false; MultFound = false; DivFound = false; + char NextChar = String[Pos]; + bool PlusFound = false; while (Pos < LastPos) { ++CountDoLooping; if (CountDoLooping > MaxDoLoopCounts) { @@ -1131,7 +1133,6 @@ void ParseExpression(EnergyPlusData &state, ShowContinueError(state, format("...Failed to process String=\"{}\".", String)); ShowFatalError(state, "...program terminates due to preceding condition."); } - char NextChar = String[Pos]; if (NextChar == ' ') { ++Pos; continue; @@ -1143,7 +1144,6 @@ void ParseExpression(EnergyPlusData &state, // Get the next token StringToken = ""; PeriodFound = false; - bool PlusFound = false; ErrorFlag = false; LastED = false; if (is_any_of(NextChar, "0123456789.")) { @@ -1519,10 +1519,10 @@ int ProcessTokens( } ParenthWhileCounter = 0; + int Depth = 0; while ((Pos > 0) && (ParenthWhileCounter < 50)) { ++ParenthWhileCounter; - int Depth = 0; for (TokenNum = 1; TokenNum <= NumTokens; ++TokenNum) { if (Token(TokenNum).Type == Token::Parenthesis) { if (Token(TokenNum).Parenthesis == Token::ParenthesisLeft) { @@ -3008,6 +3008,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumEMSCurveIndices = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumEMSCurveIndices > 0) { state.dataRuntimeLangProcessor->CurveIndexVariableNums.dimension(state.dataRuntimeLang->NumEMSCurveIndices, 0); + int CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name for (loop = 1; loop <= state.dataRuntimeLang->NumEMSCurveIndices; ++loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -3044,7 +3045,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } } - int CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name if (CurveIndexNum == 0) { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, format("{}{}=\"{} blank field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -3068,6 +3068,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumEMSConstructionIndices = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumEMSConstructionIndices > 0) { state.dataRuntimeLangProcessor->ConstructionIndexVariableNums.dimension(state.dataRuntimeLang->NumEMSConstructionIndices, 0); + int ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); for (loop = 1; loop <= state.dataRuntimeLang->NumEMSConstructionIndices; ++loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -3106,8 +3107,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) continue; } - int ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); - if (ConstructNum == 0) { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, format("{}{}=\"{} blank field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -3206,6 +3205,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumErlTrendVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumErlTrendVariables > 0) { state.dataRuntimeLang->TrendVariable.allocate(state.dataRuntimeLang->NumErlTrendVariables); + int NumTrendSteps = std::floor(rNumericArgs(1)); for (int TrendNum = 1; TrendNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -3241,7 +3241,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->ErlVariable(VariableNum).Value.initialized = true; // Cannot figure out how to get around needing this, } - int NumTrendSteps = std::floor(rNumericArgs(1)); if (NumTrendSteps > 0) { state.dataRuntimeLang->TrendVariable(TrendNum).LogDepth = NumTrendSteps; // setup data arrays using NumTrendSteps @@ -3473,6 +3472,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) if (state.dataRuntimeLang->NumEMSMeteredOutputVariables > 0) { cCurrentModuleObject = "EnergyManagementSystem:MeteredOutputVariable"; + std::string EndUseSubCatString = cAlphaArgs(8); for (loop = 1; loop <= state.dataRuntimeLang->NumEMSMeteredOutputVariables; ++loop) { RuntimeReportVarNum = state.dataRuntimeLang->NumEMSOutputVariables + loop; state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -3694,7 +3694,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } if (!lAlphaFieldBlanks(8)) { - std::string EndUseSubCatString = cAlphaArgs(8); SetupOutputVariable(state, cAlphaArgs(1), curUnit, @@ -3753,11 +3752,12 @@ void ReportRuntimeLanguage(EnergyPlusData &state) // Locals // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RuntimeReportVarNum; + int VariableNum; for (RuntimeReportVarNum = 1; RuntimeReportVarNum <= state.dataRuntimeLang->NumEMSOutputVariables + state.dataRuntimeLang->NumEMSMeteredOutputVariables; ++RuntimeReportVarNum) { - int VariableNum = state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).VariableNum; + VariableNum = state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).VariableNum; if (state.dataRuntimeLang->ErlVariable(VariableNum).Value.Type == Value::Number) { state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).Value = state.dataRuntimeLang->ErlVariable(VariableNum).Value.Number; From 3e60d15c1c3a1147cd7516ffd67d5cf567405d64 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Fri, 5 Dec 2025 11:43:44 -0700 Subject: [PATCH 15/33] fix-up some local var usages --- src/EnergyPlus/RuntimeLanguageProcessor.cc | 49 ++++++---------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 09f304360cc..21c3c2610b8 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -254,38 +254,11 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // re initialize Erl for new simulation environment period - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using OutputProcessor::SetInternalVariableValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ActuatorUsedLoop; - int ErlVariableNum; - int TrendVarNum; - int SensorNum; - int loop; - bool CycleThisVariable; - // reinitialize state of Erl variable values to zero, this gets sensors and internal variables used - for (ErlVariableNum = 1; ErlVariableNum <= state.dataRuntimeLang->NumErlVariables; ++ErlVariableNum) { + for (int ErlVariableNum = 1; ErlVariableNum <= state.dataRuntimeLang->NumErlVariables; ++ErlVariableNum) { // but skip constant built-in variables so don't overwrite them if (ErlVariableNum == state.dataRuntimeLangProcessor->NullVariableNum) { continue; @@ -316,8 +289,8 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } // need to preserve curve index variables - CycleThisVariable = false; - for (loop = 1; loop <= state.dataRuntimeLang->NumEMSCurveIndices; ++loop) { + bool CycleThisVariable = false; + for (int loop = 1; loop <= state.dataRuntimeLang->NumEMSCurveIndices; ++loop) { if (ErlVariableNum == state.dataRuntimeLangProcessor->CurveIndexVariableNums(loop)) { CycleThisVariable = true; } @@ -326,7 +299,7 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) continue; } CycleThisVariable = false; - for (loop = 1; loop <= state.dataRuntimeLang->NumEMSConstructionIndices; ++loop) { + for (int loop = 1; loop <= state.dataRuntimeLang->NumEMSConstructionIndices; ++loop) { if (ErlVariableNum == state.dataRuntimeLangProcessor->ConstructionIndexVariableNums(loop)) { CycleThisVariable = true; } @@ -340,11 +313,13 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) SetErlValueNumber(0.0, state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value); } } - int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; + // reinitialize state of actuators - for (ActuatorUsedLoop = 1; ActuatorUsedLoop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; + for (int ActuatorUsedLoop = 1; + ActuatorUsedLoop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; ++ActuatorUsedLoop) { - ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; + int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; + int ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value.Type = Value::Null; *state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).Actuated = false; switch (state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).PntrVarTypeUsed) { @@ -363,13 +338,13 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } // reinitialize trend variables so old data are purged - int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; - for (TrendVarNum = 1; TrendVarNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendVarNum) { + for (int TrendVarNum = 1; TrendVarNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendVarNum) { + int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; state.dataRuntimeLang->TrendVariable(TrendVarNum).TrendValARR({1, TrendDepth}) = 0.0; } // reinitialize sensors - for (SensorNum = 1; SensorNum <= state.dataRuntimeLang->NumSensors; ++SensorNum) { + for (int SensorNum = 1; SensorNum <= state.dataRuntimeLang->NumSensors; ++SensorNum) { SetInternalVariableValue( state, state.dataRuntimeLang->Sensor(SensorNum).VariableType, state.dataRuntimeLang->Sensor(SensorNum).Index, 0.0, 0); } From 4d0a1c8ff9d5fb8593f2d986e5c8c111bb057de6 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Sat, 6 Dec 2025 23:11:10 -0700 Subject: [PATCH 16/33] fix error 1 --- src/EnergyPlus/DXCoils.cc | 12 ++++-------- src/EnergyPlus/RuntimeLanguageProcessor.cc | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 6ecda6bb2d5..968acef237d 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -7041,10 +7041,8 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - int DehumidModeNum; // Loop index for 1,Number of enhanced dehumidification modes - int CapacityStageNum; // Loop index for 1,Number of capacity stages - for (DehumidModeNum = 0; DehumidModeNum <= thisDXCoil.NumDehumidModes; ++DehumidModeNum) { - for (CapacityStageNum = 1; CapacityStageNum <= thisDXCoil.NumCapacityStages; ++CapacityStageNum) { + for (int DehumidModeNum = 0; DehumidModeNum <= thisDXCoil.NumDehumidModes; ++DehumidModeNum) { + for (int CapacityStageNum = 1; CapacityStageNum <= thisDXCoil.NumCapacityStages; ++CapacityStageNum) { Mode = DehumidModeNum * 2 + CapacityStageNum; // Check for zero capacity or zero max flow rate if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { @@ -14661,8 +14659,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum TotCapFlowModFac = CurveValue(state, thisDXCoil.CCapFFlow(1), AirMassFlowRatioRated); TotCapTempModFac = CurveValue(state, thisDXCoil.CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); - int Iter; - for (Iter = 1; Iter <= 4; ++Iter) { // iterative solution in the event that net capacity is near a threshold for external static + for (int Iter = 1; Iter <= 4; ++Iter) { // iterative solution in the event that net capacity is near a threshold for external static // Obtain external static pressure from Table 5 in ANSI/AHRI Std. 340/360-2007 if (NetCoolingCapRated <= 21000.0) { ExternalStatic = 50.0; @@ -15079,8 +15076,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum // determine footnote content int countStaticInputs = 0; - int index; - for (index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { + for (int index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { auto &dxCoil_temp = state.dataDXCoils->DXCoil(index); if (dxCoil_temp.RateWithInternalStaticAndFanObject && dxCoil_temp.DXCoilType_Num == HVAC::CoilDX_CoolingTwoSpeed) { ++countStaticInputs; diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 09f304360cc..4712aa09836 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -340,10 +340,10 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) SetErlValueNumber(0.0, state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value); } } - int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; // reinitialize state of actuators for (ActuatorUsedLoop = 1; ActuatorUsedLoop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; ++ActuatorUsedLoop) { + int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value.Type = Value::Null; *state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).Actuated = false; @@ -363,8 +363,8 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } // reinitialize trend variables so old data are purged - int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; for (TrendVarNum = 1; TrendVarNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendVarNum) { + int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; state.dataRuntimeLang->TrendVariable(TrendVarNum).TrendValARR({1, TrendDepth}) = 0.0; } From bb5ae1fc8e082f3738da40f02b3764ad144bc28d Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Wed, 10 Dec 2025 13:27:02 -0700 Subject: [PATCH 17/33] move declaration out of for loop --- src/EnergyPlus/RuntimeLanguageProcessor.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 1ab7068c6fe..0feff809e3e 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -314,11 +314,13 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } } // reinitialize state of actuators + int EMSActuatorVariableNum; + int ErlVariableNum; for (int ActuatorUsedLoop = 1; ActuatorUsedLoop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; ++ActuatorUsedLoop) { - int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; - int ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; + EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; + ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value.Type = Value::Null; *state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).Actuated = false; switch (state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).PntrVarTypeUsed) { @@ -337,8 +339,9 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } // reinitialize trend variables so old data are purged + int TrendDepth; for (int TrendVarNum = 1; TrendVarNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendVarNum) { - int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; + TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; state.dataRuntimeLang->TrendVariable(TrendVarNum).TrendValARR({1, TrendDepth}) = 0.0; } From 99729f6a54334dcc1f905b0d16786bf038dda1c8 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Thu, 11 Dec 2025 11:45:30 -0700 Subject: [PATCH 18/33] fix test errors --- src/EnergyPlus/RuntimeLanguageProcessor.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 0feff809e3e..4adc4c40621 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -257,8 +257,9 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) // Using/Aliasing using OutputProcessor::SetInternalVariableValue; + int ErlVariableNum; // reinitialize state of Erl variable values to zero, this gets sensors and internal variables used - for (int ErlVariableNum = 1; ErlVariableNum <= state.dataRuntimeLang->NumErlVariables; ++ErlVariableNum) { + for (ErlVariableNum = 1; ErlVariableNum <= state.dataRuntimeLang->NumErlVariables; ++ErlVariableNum) { // but skip constant built-in variables so don't overwrite them if (ErlVariableNum == state.dataRuntimeLangProcessor->NullVariableNum) { continue; @@ -314,12 +315,10 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } } // reinitialize state of actuators - int EMSActuatorVariableNum; - int ErlVariableNum; for (int ActuatorUsedLoop = 1; ActuatorUsedLoop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; ++ActuatorUsedLoop) { - EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; + int EMSActuatorVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ActuatorVariableNum; ErlVariableNum = state.dataRuntimeLang->EMSActuatorUsed(ActuatorUsedLoop).ErlVariableNum; state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value.Type = Value::Null; *state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum).Actuated = false; @@ -339,9 +338,8 @@ void BeginEnvrnInitializeRuntimeLanguage(EnergyPlusData &state) } // reinitialize trend variables so old data are purged - int TrendDepth; for (int TrendVarNum = 1; TrendVarNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendVarNum) { - TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; + int TrendDepth = state.dataRuntimeLang->TrendVariable(TrendVarNum).LogDepth; state.dataRuntimeLang->TrendVariable(TrendVarNum).TrendValARR({1, TrendDepth}) = 0.0; } @@ -1066,7 +1064,9 @@ void ParseExpression(EnergyPlusData &state, int NumErrors; std::string::size_type Pos; std::string StringToken; + char NextChar; bool PeriodFound; + bool PlusFound; bool MinusFound; bool MultFound; bool DivFound; @@ -1100,8 +1100,6 @@ void ParseExpression(EnergyPlusData &state, MinusFound = false; MultFound = false; DivFound = false; - char NextChar = String[Pos]; - bool PlusFound = false; while (Pos < LastPos) { ++CountDoLooping; if (CountDoLooping > MaxDoLoopCounts) { @@ -1110,6 +1108,7 @@ void ParseExpression(EnergyPlusData &state, ShowContinueError(state, format("...Failed to process String=\"{}\".", String)); ShowFatalError(state, "...program terminates due to preceding condition."); } + NextChar = String[Pos]; if (NextChar == ' ') { ++Pos; continue; @@ -1121,6 +1120,7 @@ void ParseExpression(EnergyPlusData &state, // Get the next token StringToken = ""; PeriodFound = false; + PlusFound = false; ErrorFlag = false; LastED = false; if (is_any_of(NextChar, "0123456789.")) { @@ -1473,6 +1473,7 @@ int ProcessTokens( int LastPos; int TokenNum; int NumTokens; + int Depth; int NumSubTokens; int NewNumTokens; int OperatorNum; @@ -1496,10 +1497,10 @@ int ProcessTokens( } ParenthWhileCounter = 0; - int Depth = 0; while ((Pos > 0) && (ParenthWhileCounter < 50)) { ++ParenthWhileCounter; + Depth = 0; for (TokenNum = 1; TokenNum <= NumTokens; ++TokenNum) { if (Token(TokenNum).Type == Token::Parenthesis) { if (Token(TokenNum).Parenthesis == Token::ParenthesisLeft) { From 1efa2678b432b1a0785a0263635d71fc90d38cdc Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Thu, 11 Dec 2025 14:08:44 -0700 Subject: [PATCH 19/33] fix errors 2 --- src/EnergyPlus/RuntimeLanguageProcessor.cc | 54 +++++++++++++--------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 4adc4c40621..c976053b101 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -2753,8 +2753,27 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) constexpr std::string_view RoutineName = "GetRuntimeLanguageUserInput: "; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + int GlobalNum; + int StackNum; + int ErrorNum; + int NumAlphas; // Number of elements in the alpha array + int NumNums; // Number of elements in the numeric array + int IOStat; // IO Status when calling get input subroutine + bool ErrorsFound(false); + int VariableNum(0); // temporary + int RuntimeReportVarNum; + bool Found; OutputProcessor::TimeStepType sovTimeStepType; // temporary OutputProcessor::StoreType sovStoreType; // temporary + std::string EndUseSubCatString; + int TrendNum; + int NumTrendSteps; + int loop; + int ErlVarLoop; + int CurveIndexNum; + int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs + int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs + int TotalArgs(0); // argument for call to GetObjectDefMaxArgs Array1D_string cAlphaFieldNames; Array1D_string cNumericFieldNames; @@ -2762,27 +2781,17 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) Array1D_bool lAlphaFieldBlanks; Array1D_string cAlphaArgs; Array1D rNumericArgs; + std::string cCurrentModuleObject; + int ConstructNum; + bool errFlag; std::string::size_type lbracket; std::string UnitsA; + std::string UnitsB; Constant::Units curUnit(Constant::Units::None); std::string::size_type ptr; if (state.dataRuntimeLangProcessor->GetInput) { // GetInput check is redundant with the InitializeRuntimeLanguage routine state.dataRuntimeLangProcessor->GetInput = false; - int NumAlphas; // Number of elements in the alpha array - int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine - bool ErrorsFound(false); - int VariableNum(0); // temporary - int RuntimeReportVarNum; - bool Found; - int loop; - int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs - int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs - int TotalArgs(0); // argument for call to GetObjectDefMaxArgs - std::string cCurrentModuleObject; - bool errFlag; - std::string UnitsB; cCurrentModuleObject = "EnergyManagementSystem:Sensor"; state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, TotalArgs, NumAlphas, NumNums); @@ -2861,13 +2870,12 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) lNumericFieldBlanks.dimension(MaxNumNumbers, false); cCurrentModuleObject = "EnergyManagementSystem:GlobalVariable"; - int StackNum; if (state.dataRuntimeLang->NumUserGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables > 0) { - for (int GlobalNum = 1; + for (GlobalNum = 1; GlobalNum <= state.dataRuntimeLang->NumUserGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables; @@ -2944,7 +2952,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } // loop over each alpha and register variable named as global Erl variable - for (int ErlVarLoop = 1; ErlVarLoop <= NumAlphas; ++ErlVarLoop) { + for (ErlVarLoop = 1; ErlVarLoop <= NumAlphas; ++ErlVarLoop) { if ((cCurrentModuleObject.compare("ExternalInterface:FunctionalMockupUnitImport:To:Variable") == 0)) { if (ErlVarLoop == 1) { // Only validate first field of object ExternalInterface:FunctionalMockupUnitImport:To:Variable. @@ -3023,6 +3031,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } } + CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name if (CurveIndexNum == 0) { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, format("{}{}=\"{} blank field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -3046,7 +3055,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumEMSConstructionIndices = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumEMSConstructionIndices > 0) { state.dataRuntimeLangProcessor->ConstructionIndexVariableNums.dimension(state.dataRuntimeLang->NumEMSConstructionIndices, 0); - int ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); for (loop = 1; loop <= state.dataRuntimeLang->NumEMSConstructionIndices; ++loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -3085,6 +3093,8 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) continue; } + ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); + if (ConstructNum == 0) { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, format("{}{}=\"{} blank field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -3183,8 +3193,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumErlTrendVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumErlTrendVariables > 0) { state.dataRuntimeLang->TrendVariable.allocate(state.dataRuntimeLang->NumErlTrendVariables); - int NumTrendSteps = std::floor(rNumericArgs(1)); - for (int TrendNum = 1; TrendNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendNum) { + for (TrendNum = 1; TrendNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, TrendNum, @@ -3219,6 +3228,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->ErlVariable(VariableNum).Value.initialized = true; // Cannot figure out how to get around needing this, } + NumTrendSteps = std::floor(rNumericArgs(1)); if (NumTrendSteps > 0) { state.dataRuntimeLang->TrendVariable(TrendNum).LogDepth = NumTrendSteps; // setup data arrays using NumTrendSteps @@ -3261,7 +3271,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) ShowSevereError( state, format("Errors found parsing EMS Runtime Language program or subroutine = {}", state.dataRuntimeLang->ErlStack(StackNum).Name)); - for (int ErrorNum = 1; ErrorNum <= state.dataRuntimeLang->ErlStack(StackNum).NumErrors; ++ErrorNum) { + for (ErrorNum = 1; ErrorNum <= state.dataRuntimeLang->ErlStack(StackNum).NumErrors; ++ErrorNum) { ShowContinueError(state, state.dataRuntimeLang->ErlStack(StackNum).Error(ErrorNum)); } ErrorsFound = true; @@ -3450,7 +3460,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) if (state.dataRuntimeLang->NumEMSMeteredOutputVariables > 0) { cCurrentModuleObject = "EnergyManagementSystem:MeteredOutputVariable"; - std::string EndUseSubCatString = cAlphaArgs(8); for (loop = 1; loop <= state.dataRuntimeLang->NumEMSMeteredOutputVariables; ++loop) { RuntimeReportVarNum = state.dataRuntimeLang->NumEMSOutputVariables + loop; state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -3672,6 +3681,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } if (!lAlphaFieldBlanks(8)) { + EndUseSubCatString = cAlphaArgs(8); SetupOutputVariable(state, cAlphaArgs(1), curUnit, From c1f633d76b7e9df72467e8da1c7fcc7a8db90b53 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Thu, 11 Dec 2025 15:36:36 -0700 Subject: [PATCH 20/33] fix errors 3 --- src/EnergyPlus/RuntimeLanguageProcessor.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index c976053b101..c215e1f5bd1 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -2994,7 +2994,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumEMSCurveIndices = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumEMSCurveIndices > 0) { state.dataRuntimeLangProcessor->CurveIndexVariableNums.dimension(state.dataRuntimeLang->NumEMSCurveIndices, 0); - int CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name for (loop = 1; loop <= state.dataRuntimeLang->NumEMSCurveIndices; ++loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, From 18e8325b5f409138d68957d8a3d70057feb85d8b Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Thu, 11 Dec 2025 22:52:38 -0700 Subject: [PATCH 21/33] fix errors 4 --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 2 +- src/EnergyPlus/HybridModel.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index ae5751eb244..6800ed24c2b 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -1657,6 +1657,7 @@ namespace AirflowNetwork { int count; bool NodeFound; bool found; + int NumAPL; Array1D_string CompName(2); std::string SimAirNetworkKey; @@ -2029,7 +2030,6 @@ namespace AirflowNetwork { // Check the number of primary air loops if (!simulation_control.DuctLoss) { - int NumAPL = 0; if (distribution_simulated) { NumAPL = m_state.dataInputProcessing->inputProcessor->getNumObjectsFound(m_state, "AirLoopHVAC"); if (NumAPL > 0) { diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 77800af78b9..4afd88af167 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -101,7 +101,7 @@ namespace HybridModel { int NumAlphas = 0; // Number of Alphas for each GetobjectItem call int NumNumbers = 0; // Number of Numbers for each GetobjectItem call int IOStatus = 0; - int ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name + int ZonePtr = 0; for (int HybridModelNum = 1; HybridModelNum <= state.dataHybridModel->NumOfHybridModelZones; ++HybridModelNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -117,6 +117,7 @@ namespace HybridModel { cAlphaFieldNames, cNumericFieldNames); + ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name if (ZonePtr > 0) { auto &hmZone = state.dataHybridModel->hybridModelZones(ZonePtr); hmZone.Name = cAlphaArgs(1); // Zone HybridModel name From a9dc0370d74810af2bde168c718b0663f8f9fd6d Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Fri, 12 Dec 2025 00:01:12 -0700 Subject: [PATCH 22/33] fix errors 5 --- src/EnergyPlus/HeatBalanceHAMTManager.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index 062198a7b0c..951cb98dd67 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -183,7 +183,9 @@ namespace HeatBalanceHAMTManager { int NumAlphas; int status; int Numid; + int HAMTitems; + int vtcsid; bool ErrorsFound; @@ -596,7 +598,6 @@ namespace HeatBalanceHAMTManager { // Vapor Transfer coefficients HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject7); // SurfaceProperties:VaporCoefficients - int vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); for (int item = 1; item <= HAMTitems; ++item) { s_ip->getObjectItem(state, cHAMTObject7, @@ -612,6 +613,7 @@ namespace HeatBalanceHAMTManager { cNumericFieldNames); ErrorObjectHeader eoh{routineName, cHAMTObject7, AlphaArray(1)}; + vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); if (vtcsid == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); From 6bbb21206db67c5a76288b3d11cd932dd66bf48c Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 17 Dec 2025 09:49:56 -0700 Subject: [PATCH 23/33] suppress a few cppcheck warnings that are throwing false positives --- .github/workflows/test_code_integrity.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_code_integrity.yml b/.github/workflows/test_code_integrity.yml index 00d0fa14c6b..ddcd6e33d28 100644 --- a/.github/workflows/test_code_integrity.yml +++ b/.github/workflows/test_code_integrity.yml @@ -216,6 +216,8 @@ jobs: -j $(nproc) --template='[{file}:{line}]:({severity}),[{id}],{message}' --suppress="uninitvar:*" + --suppress="constParameterReference:*" \ + --suppress="constVariableReference:*" \ ./src 3>&1 1>&2 2>&3 | tee cppcheck.txt From f6bc99e4a9b2d18eda0616675756d27af64bc6ae Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Tue, 6 Jan 2026 10:38:09 -0700 Subject: [PATCH 24/33] remaning variable scopes --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 2 +- src/EnergyPlus/DXCoils.cc | 6 ++---- src/EnergyPlus/DuctLoss.cc | 3 --- src/EnergyPlus/EconomicTariff.cc | 2 +- src/EnergyPlus/HeatBalanceHAMTManager.cc | 2 +- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 2 +- src/EnergyPlus/PlantPipingSystemsManager.cc | 1 - src/EnergyPlus/ScheduleManager.cc | 9 --------- 8 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 6800ed24c2b..8f587e33a88 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -1657,7 +1657,6 @@ namespace AirflowNetwork { int count; bool NodeFound; bool found; - int NumAPL; Array1D_string CompName(2); std::string SimAirNetworkKey; @@ -2030,6 +2029,7 @@ namespace AirflowNetwork { // Check the number of primary air loops if (!simulation_control.DuctLoss) { + int NumAPL; if (distribution_simulated) { NumAPL = m_state.dataInputProcessing->inputProcessor->getNumObjectsFound(m_state, "AirLoopHVAC"); if (NumAPL > 0) { diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 968acef237d..a6977315c5d 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -16429,8 +16429,6 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) // Select the correct unit type int SecCoilSHRFT; // index of the SHR modifier curve for temperature of a secondary DX coil int SecCoilSHRFF; // index of the sHR modifier curve for flow fraction of a secondary DX coil - int MSSpeedNumLS; // current low speed number of multispeed HP - int MSSpeedNumHS; // current high speed number of multispeed HP switch (thisDXCoil.DXCoilType_Num) { case HVAC::CoilDX_CoolingSingleSpeed: case HVAC::CoilDX_CoolingTwoSpeed: @@ -16516,8 +16514,8 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, EvapInletDryBulb, EvapInletHumRat); MSSpeedRatio = thisDXCoil.MSSpeedRatio; MSCycRatio = thisDXCoil.MSCycRatio; - MSSpeedNumHS = thisDXCoil.MSSpeedNumHS; - MSSpeedNumLS = thisDXCoil.MSSpeedNumLS; + int MSSpeedNumHS = thisDXCoil.MSSpeedNumHS; // current high speed number of multispeed HP + int MSSpeedNumLS = thisDXCoil.MSSpeedNumLS; // current low speed number of multispeed HP if (MSSpeedRatio > 0.0) { EvapAirMassFlow = RhoAir * (thisDXCoil.MSSecCoilAirFlow(MSSpeedNumHS) * MSSpeedRatio + thisDXCoil.MSSecCoilAirFlow(MSSpeedNumLS) * (1.0 - MSSpeedRatio)); diff --git a/src/EnergyPlus/DuctLoss.cc b/src/EnergyPlus/DuctLoss.cc index f19be8da26f..b3c056296bd 100644 --- a/src/EnergyPlus/DuctLoss.cc +++ b/src/EnergyPlus/DuctLoss.cc @@ -226,7 +226,6 @@ namespace DuctLoss { auto instances = state.dataInputProcessing->inputProcessor->epJSON.find(CurrentModuleObject); if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) { - std::string cFieldName; int DuctLossCondNum = 0; auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { @@ -291,7 +290,6 @@ namespace DuctLoss { instances = state.dataInputProcessing->inputProcessor->epJSON.find(CurrentModuleObject); if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) { - std::string cFieldName; int DuctLossLeakNum = 0; auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { @@ -328,7 +326,6 @@ namespace DuctLoss { instances = state.dataInputProcessing->inputProcessor->epJSON.find(CurrentModuleObject); if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) { - std::string cFieldName; int DuctLossMakeNum = 0; auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { diff --git a/src/EnergyPlus/EconomicTariff.cc b/src/EnergyPlus/EconomicTariff.cc index ff526371179..9c5f5088cb1 100644 --- a/src/EnergyPlus/EconomicTariff.cc +++ b/src/EnergyPlus/EconomicTariff.cc @@ -4085,7 +4085,6 @@ void WriteTabularTariffReports(EnergyPlusData &state) if (s_econ->numTariff > 0) { if (state.dataOutRptTab->displayEconomicResultSummary) { - auto &econVar = s_econ->econVar; DisplayString(state, "Writing Tariff Reports"); showWarningsBasedOnTotal(state); //--------------------------------- @@ -4250,6 +4249,7 @@ void WriteTabularTariffReports(EnergyPlusData &state) // Tariff Report //--------------------------------- if (state.dataOutRptTab->displayTariffReport) { + auto &econVar = s_econ->econVar; for (auto ¤tStyle : state.dataOutRptTab->tabularReportPasses) { // Clear this for each style pass for (auto &e : econVar) { diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index 951cb98dd67..b49991238f2 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -185,7 +185,6 @@ namespace HeatBalanceHAMTManager { int Numid; int HAMTitems; - int vtcsid; bool ErrorsFound; @@ -598,6 +597,7 @@ namespace HeatBalanceHAMTManager { // Vapor Transfer coefficients HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject7); // SurfaceProperties:VaporCoefficients + int vtcsid; for (int item = 1; item <= HAMTitems; ++item) { s_ip->getObjectItem(state, cHAMTObject7, diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 58f051517e4..933cc1ee293 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -3271,7 +3271,7 @@ void InitSolarHeatGains(EnergyPlusData &state) Real64 ACosTlt = std::abs(Surface(SurfNum).CosTilt); // Absolute value of cosine of surface tilt angle int slatIdxLo = surfShade.blind.slatAngIdxLo; - int slatIdxHi = surfShade.blind.slatAngIdxLo; + int slatIdxHi = surfShade.blind.slatAngIdxHi; Real64 interpFac = surfShade.blind.slatAngInterpFac; auto const &dfAbsSlatLo = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxLo]; auto const &dfAbsSlatHi = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxHi]; diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index c59d0436a7a..62bdff55a14 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -2784,7 +2784,6 @@ namespace PlantPipingSystemsManager { Real64 InterfaceCellWidth(0.008); // Object Data - std::vector PreviousEntries; Segment ThisSegment; //'NOTE: pipe location y values have already been corrected to be measured from the bottom surface diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 97f9d3135ed..a275e9bece3 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -371,9 +371,6 @@ namespace Sched { bool ErrorsFound(false); bool NumErrorFlag; - std::string CFld; // Character field for error message - // CHARACTER(len=20) CFld1 ! Character field for error message - std::array minuteVals; std::array setMinuteVals; @@ -398,11 +395,8 @@ namespace Sched { // REAL(r64) tempval std::string CurrentThrough; std::string LastFor; - std::string errmsg; - // for SCHEDULE:FILE int rowCnt; - std::string subString; int MaxNums1; char ColumnSep; int rowLimitCount; @@ -2892,9 +2886,6 @@ namespace Sched { // representation. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string hHour; - std::string mMinute; - std::string String = stripped(FieldValue); std::string::size_type const Pos = index(String, ':'); bool nonIntegral = false; From 3a0670d734d80c65d4d329e4e6fbc855d13f601a Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Tue, 6 Jan 2026 13:52:03 -0700 Subject: [PATCH 25/33] remaning variable scopes 2 --- src/EnergyPlus/SimAirServingZones.cc | 9 ++-- src/EnergyPlus/SolarShading.cc | 6 +-- src/EnergyPlus/SteamBaseboardRadiator.cc | 2 +- src/EnergyPlus/SteamCoils.cc | 10 ++-- src/EnergyPlus/SystemAvailabilityManager.cc | 4 +- src/EnergyPlus/SystemReports.cc | 18 +++---- src/EnergyPlus/TARCOGArgs.cc | 1 - src/EnergyPlus/ThermalChimney.cc | 6 +-- src/EnergyPlus/ThermalComfort.cc | 53 ++++++++------------ src/EnergyPlus/ThermalEN673Calc.cc | 4 +- src/EnergyPlus/ThermalISO15099Calc.cc | 25 ++++----- src/EnergyPlus/TranspiredCollector.cc | 25 ++++----- src/EnergyPlus/UserDefinedComponents.cc | 4 +- src/EnergyPlus/WaterManager.cc | 27 +++++----- src/EnergyPlus/WaterThermalTanks.cc | 19 +++---- src/EnergyPlus/WeatherManager.cc | 3 -- src/EnergyPlus/WindowComplexManager.cc | 47 ++++++++--------- src/EnergyPlus/ZoneTempPredictorCorrector.cc | 5 +- 18 files changed, 113 insertions(+), 155 deletions(-) diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index 1ec90c9075c..951d0523c1e 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -415,7 +415,6 @@ void GetAirPathData(EnergyPlusData &state) for (AirSysNum = 1; AirSysNum <= NumPrimaryAirSys; ++AirSysNum) { auto &primaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems(AirSysNum); auto &airLoopZoneInfo = state.dataAirLoop->AirToZoneNodeInfo(AirSysNum); - int NumOASysControllers = 0; // total number of controllers in the OA Sys int NumOASysSimpControllers = 0; // number of simple controllers in the OA Sys of an air primary system int OASysContListNum = 0; // index of the controller list of the OA Sys PackagedUnit(AirSysNum) = false; @@ -1076,7 +1075,7 @@ void GetAirPathData(EnergyPlusData &state) } // loop over the OA Sys controllers and move them up to the primary air system controller lists OASysControllerNum = 0; - NumOASysControllers = (NumAlphas - 1) / 2; + int NumOASysControllers = (NumAlphas - 1) / 2; // total number of controllers in the OA Sys for (ControllerNum = 1; ControllerNum <= NumOASysControllers; ++ControllerNum) { ControllerName = Alphas(ControllerNum * 2 + 1); ControllerType = Alphas(ControllerNum * 2); @@ -4079,9 +4078,9 @@ void SizeAirLoopBranches(EnergyPlusData &state, int const AirLoopNum, int const ErrorsFound = false; if (BranchNum == 1) { - std::string ScalableSM; // scalable sizing methods label for reporting auto &FinalSysSizing = state.dataSize->FinalSysSizing; if (PrimaryAirSystems(AirLoopNum).DesignVolFlowRate == AutoSize) { + std::string ScalableSM; // scalable sizing methods label for reporting CheckSysSizing(state, "AirLoopHVAC", PrimaryAirSystems(AirLoopNum).Name); PrimaryAirSystems(AirLoopNum).DesignVolFlowRate = FinalSysSizing(AirLoopNum).DesMainVolFlow; switch (FinalSysSizing(AirLoopNum).ScaleCoolSAFMethod) { @@ -5154,8 +5153,6 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn } switch (CallIndicator) { - int I; // write statement index - int J; // write statement index case Constant::CallIndicator::BeginDay: { // Correct the zone return temperature in ZoneSizing for the case of induction units. The calc in // ZoneEquipmentManager assumes all the air entering the zone goes into the return node. @@ -7091,6 +7088,8 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn // write out the sys design calc results print(state.files.ssz, "Time"); + int I; // write statement index + int J; // write statement index for (I = 1; I <= state.dataHVACGlobal->NumPrimaryAirSys; ++I) { for (J = 1; J <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++J) { constexpr const char *SSizeFmt12("{}{}{}{:2}{}{}{}{}{:2}{}{}{}{}{:2}{}{}{}{}{:2}{}{}{}{}{:2}{}"); diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index a609379a3f3..a231e1dbda8 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -775,9 +775,9 @@ void processShadowingInput(EnergyPlusData &state) } for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { - int SurfZoneGroup = 0; - int CurZoneGroup = 0; if (state.dataSurface->Surface(SurfNum).ExtBoundCond == 0) { // Loop through all exterior surfaces + int SurfZoneGroup = 0; + int CurZoneGroup = 0; // Check the shading zone group of each exterior surface for (int ZoneGroupLoop = 1; ZoneGroupLoop <= NumOfShadingGroups; ZoneGroupLoop++) { // Loop through all defined shading groups CurZoneGroup = DisableSelfShadingGroups(ZoneGroupLoop); @@ -4780,7 +4780,6 @@ void DeterminePolygonOverlap(EnergyPlusData &state, if (!state.dataSysVars->SutherlandHodgman) { int NIN1 = 0; // Number of vertices of NS1 within NS2 - int NIN2 = 0; // Number of vertices of NS2 within NS1 INCLOS(state, NS1, NV1, NS2, NV2, NV3, NIN1); // Find vertices of NS1 within NS2. if (NIN1 >= NV1) { @@ -4789,6 +4788,7 @@ void DeterminePolygonOverlap(EnergyPlusData &state, } else { + int NIN2 = 0; // Number of vertices of NS2 within NS1 INCLOS(state, NS2, NV2, NS1, NV1, NV3, NIN2); // Find vertices of NS2 within NS1. if (NIN2 >= NV2) { diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index 2497c2ec90e..df89b2f6158 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -1111,7 +1111,6 @@ namespace SteamBaseboardRadiator { state.dataSize->DataZoneNumber = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZonePtr; int SizingMethod = HeatingCapacitySizing; // Integer representation of sizing method name (HeatingCapacitySizing) int FieldNum = 1; // IDD numeric field number where input field description is found - bool PrintFlag = false; // TRUE when sizing information is reported in the eio file std::string SizingString = state.dataSteamBaseboardRadiator->SteamBaseboardNumericFields(BaseboardNum).FieldNames(FieldNum) + " [W]"; // input field sizing description (e.g., Nominal Capacity) int CapSizingMethod = @@ -1146,6 +1145,7 @@ namespace SteamBaseboardRadiator { TempSize = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ScaledHeatingCapacity; } bool errorsFound = false; + bool PrintFlag = false; // TRUE when sizing information is reported in the eio file HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); diff --git a/src/EnergyPlus/SteamCoils.cc b/src/EnergyPlus/SteamCoils.cc index 1b31e671491..5f1a261aa2d 100644 --- a/src/EnergyPlus/SteamCoils.cc +++ b/src/EnergyPlus/SteamCoils.cc @@ -710,12 +710,10 @@ namespace SteamCoils { if (state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamVolFlowRate == AutoSize) { CheckSysSizing(state, "Coil:Heating:Steam", state.dataSteamCoils->SteamCoil(CoilNum).Name); - std::string CompName; // component name - std::string CompType; // component type - std::string SizingString; // input field sizing description (e.g., Nominal Capacity) - bool bPRINT = false; // TRUE if sizing is reported to output (eio) + std::string CompName; // component name + std::string CompType; // component type + bool bPRINT = false; // TRUE if sizing is reported to output (eio) if (state.dataSteamCoils->SteamCoil(CoilNum).DesiccantRegenerationCoil) { - auto &OASysEqSizing = state.dataSize->OASysEqSizing; state.dataSize->DataDesicRegCoil = true; state.dataSize->DataDesicDehumNum = state.dataSteamCoils->SteamCoil(CoilNum).DesiccantDehumNum; CompType = state.dataSteamCoils->SteamCoil(CoilNum).SteamCoilType; // this is casting an int to a string @@ -732,6 +730,7 @@ namespace SteamCoils { state.dataSize->DataDesOutletAirTemp = sizerHeatingDesOutletTemp.size(state, DataSizing::AutoSize, ErrorsFound); if (state.dataSize->CurOASysNum > 0) { + auto &OASysEqSizing = state.dataSize->OASysEqSizing; OASysEqSizing(state.dataSize->CurOASysNum).AirFlow = true; OASysEqSizing(state.dataSize->CurOASysNum).AirVolFlow = finalSysSizing.DesOutAirVolFlow; } @@ -760,6 +759,7 @@ namespace SteamCoils { TempSize = AutoSize; bool errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; + std::string SizingString; // input field sizing description (e.g., Nominal Capacity) sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, bPRINT, RoutineName); diff --git a/src/EnergyPlus/SystemAvailabilityManager.cc b/src/EnergyPlus/SystemAvailabilityManager.cc index 7f026b9bb28..3711b6dbcbc 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.cc +++ b/src/EnergyPlus/SystemAvailabilityManager.cc @@ -1595,8 +1595,6 @@ namespace Avail { auto &optimumStartMgr = state.dataAvail->OptimumStartData(SysAvailNum); if (optimumStartMgr.optimumStartControlType == OptimumStartControlType::MaximumOfZoneList) { int ZoneListNum; - int ScanZoneListNum; - int ZoneNum; // a zone list ZoneListNum = Util::FindItemInList(optimumStartMgr.ZoneListName, state.dataHeatBal->ZoneList); if (ZoneListNum > 0) { @@ -1604,6 +1602,8 @@ namespace Avail { if (!allocated(optimumStartMgr.ZonePtrs)) { optimumStartMgr.ZonePtrs.allocate({1, state.dataHeatBal->ZoneList(ZoneListNum).NumOfZones}); } + int ScanZoneListNum; + int ZoneNum; for (ScanZoneListNum = 1; ScanZoneListNum <= state.dataHeatBal->ZoneList(ZoneListNum).NumOfZones; ++ScanZoneListNum) { ZoneNum = state.dataHeatBal->ZoneList(ZoneListNum).Zone(ScanZoneListNum); optimumStartMgr.ZonePtrs(ScanZoneListNum) = ZoneNum; diff --git a/src/EnergyPlus/SystemReports.cc b/src/EnergyPlus/SystemReports.cc index 111e118df67..da0070b86c9 100644 --- a/src/EnergyPlus/SystemReports.cc +++ b/src/EnergyPlus/SystemReports.cc @@ -806,10 +806,10 @@ void InitEnergyReports(EnergyPlusData &state) int LoopType = state.dataAirSystemsData->ZoneCompToPlant(CompNum).PlantLoopType; int LoopNum = state.dataAirSystemsData->ZoneCompToPlant(CompNum).PlantLoopNum; int FirstIndex = ArrayCount + 1; - int LoopCount = 1; bool ConnectionFlag = false; if (LoopType > 0 && LoopNum > 0) { + int LoopCount = 1; FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag); } @@ -827,10 +827,10 @@ void InitEnergyReports(EnergyPlusData &state) int LoopType = state.dataAirSystemsData->ZoneSubCompToPlant(SubCompNum).PlantLoopType; int LoopNum = state.dataAirSystemsData->ZoneSubCompToPlant(SubCompNum).PlantLoopNum; int FirstIndex = ArrayCount + 1; - int LoopCount = 1; bool ConnectionFlag = false; if (LoopType > 0 && LoopNum > 0) { + int LoopCount = 1; FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag); } @@ -848,10 +848,10 @@ void InitEnergyReports(EnergyPlusData &state) int LoopType = state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).PlantLoopType; int LoopNum = state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).PlantLoopNum; int FirstIndex = ArrayCount + 1; - int LoopCount = 1; bool ConnectionFlag = false; if (LoopType > 0 && LoopNum > 0) { + int LoopCount = 1; FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag); } @@ -868,10 +868,10 @@ void InitEnergyReports(EnergyPlusData &state) int LoopType = state.dataAirSystemsData->AirSysCompToPlant(CompNum).PlantLoopType; int LoopNum = state.dataAirSystemsData->AirSysCompToPlant(CompNum).PlantLoopNum; int FirstIndex = ArrayCount + 1; - int LoopCount = 1; bool ConnectionFlag = false; if (LoopType > 0 && LoopNum > 0) { + int LoopCount = 1; FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag); } @@ -889,10 +889,10 @@ void InitEnergyReports(EnergyPlusData &state) int LoopType = state.dataAirSystemsData->AirSysSubCompToPlant(SubCompNum).PlantLoopType; int LoopNum = state.dataAirSystemsData->AirSysSubCompToPlant(SubCompNum).PlantLoopNum; int FirstIndex = ArrayCount + 1; - int LoopCount = 1; bool ConnectionFlag = false; if (LoopType > 0 && LoopNum > 0) { + int LoopCount = 1; FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag); } @@ -910,10 +910,10 @@ void InitEnergyReports(EnergyPlusData &state) int LoopType = state.dataAirSystemsData->AirSysSubSubCompToPlant(SubSubCompNum).PlantLoopType; int LoopNum = state.dataAirSystemsData->AirSysSubSubCompToPlant(SubSubCompNum).PlantLoopNum; int FirstIndex = ArrayCount + 1; - int LoopCount = 1; bool ConnectionFlag = false; if (LoopType > 0 && LoopNum > 0) { + int LoopCount = 1; FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag); } @@ -4204,11 +4204,9 @@ void ReportVentilationLoads(EnergyPlusData &state) int AirLoopNum = thisZoneEquipConfig.InletNodeAirLoopNum(ZoneInNum); int MixedAirNode = 0; int ReturnAirNode = 0; - int AirDistCoolInletNodeNum = 0; - int AirDistHeatInletNodeNum = 0; if (AirLoopNum != 0) { // deal with primary air system - AirDistCoolInletNodeNum = max(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode, 0); - AirDistHeatInletNodeNum = max(thisZoneEquipConfig.AirDistUnitHeat(ZoneInNum).InNode, 0); + int AirDistCoolInletNodeNum = max(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode, 0); + int AirDistHeatInletNodeNum = max(thisZoneEquipConfig.AirDistUnitHeat(ZoneInNum).InNode, 0); // Set for cooling or heating path if (AirDistCoolInletNodeNum > 0 && AirDistHeatInletNodeNum == 0) { ADUCoolFlowrate = max(Node(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode).MassFlowRate, diff --git a/src/EnergyPlus/TARCOGArgs.cc b/src/EnergyPlus/TARCOGArgs.cc index 2b033a3adfa..b5553c75fe9 100644 --- a/src/EnergyPlus/TARCOGArgs.cc +++ b/src/EnergyPlus/TARCOGArgs.cc @@ -580,7 +580,6 @@ void PrepVariablesISO15099(int const nlayer, Real64 Fsky; Real64 Fground; Real64 e0; - std::string a; //! Scalars: ShadeEmisRatioOut = 1.0; diff --git a/src/EnergyPlus/ThermalChimney.cc b/src/EnergyPlus/ThermalChimney.cc index 1f4fde93b60..f4b8bfa92fb 100644 --- a/src/EnergyPlus/ThermalChimney.cc +++ b/src/EnergyPlus/ThermalChimney.cc @@ -115,11 +115,9 @@ namespace ThermalChimney { // This driver manages the calls to all of // the other drivers and simulation algorithms. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool ErrorsFound(false); - // Obtains and Allocates heat balance related parameters from input file if (state.dataThermalChimneys->ThermalChimneyGetInputFlag) { + bool ErrorsFound(false); GetThermalChimney(state, ErrorsFound); state.dataThermalChimneys->ThermalChimneyGetInputFlag = false; } @@ -158,7 +156,6 @@ namespace ThermalChimney { int TCZoneNum1; // Thermal chimney zone counter int IOStat; int Loop; - int Loop1; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; // Following used for reporting @@ -624,6 +621,7 @@ namespace ThermalChimney { // Check to make sure there is only one thermal chimney statement per zone if (state.dataThermalChimneys->TotThermalChimney > 1) { + int Loop1; for (Loop = 1; Loop <= state.dataThermalChimneys->TotThermalChimney; ++Loop) { if (state.dataThermalChimneys->TotThermalChimney >= (Loop + 1)) { diff --git a/src/EnergyPlus/ThermalComfort.cc b/src/EnergyPlus/ThermalComfort.cc index 0c4949b2399..40fb82223ab 100644 --- a/src/EnergyPlus/ThermalComfort.cc +++ b/src/EnergyPlus/ThermalComfort.cc @@ -2318,7 +2318,6 @@ namespace ThermalComfort { bool isComfortableWithSummerClothes; bool isComfortableWithWinterClothes; Real64 allowedHours; - bool showWarning; state.dataThermalComforts->AnyZoneTimeNotSimpleASH55Summer = 0.0; state.dataThermalComforts->AnyZoneTimeNotSimpleASH55Winter = 0.0; @@ -2420,7 +2419,7 @@ namespace ThermalComfort { if (state.dataGlobal->EndDesignDayEnvrnsFlag) { allowedHours = double(state.dataGlobal->NumOfDayInEnvrn) * 24.0 * 0.04; // first check if warning should be printed - showWarning = false; + bool showWarning = false; for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (state.dataThermalComforts->ThermalComfortInASH55(iZone).Enable55Warning) { if (state.dataThermalComforts->ThermalComfortInASH55(iZone).totalTimeNotEither > allowedHours) { @@ -2741,21 +2740,11 @@ namespace ThermalComfort { // SUBROUTINE PARAMETER DEFINITIONS: // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string lineAvg; - std::string epwLine; Real64 dryBulb; Real64 tComf; Real64 numOccupants; - int readStat; - int jStartDay; - int calcStartDay; - int calcStartHr; - int calcEndDay; - int calcEndHr; std::string::size_type pos; - int ind; int i; - int j; bool weathersimulation; Real64 inavgdrybulb; @@ -2774,8 +2763,9 @@ namespace ThermalComfort { const bool statFileExists = FileSystem::fileExists(state.files.inStatFilePath.filePath); const bool epwFileExists = FileSystem::fileExists(state.files.inputWeatherFilePath.filePath); - readStat = 0; + int readStat = 0; if (statFileExists) { + std::string lineAvg; auto statFile = state.files.inStatFilePath.open(state, "CalcThermalComfortAdapctiveASH55"); while (statFile.good()) { auto lineIn = statFile.readLine(); @@ -2802,12 +2792,16 @@ namespace ThermalComfort { } state.dataThermalComforts->DailyAveOutTemp = 0.0; + std::string epwLine; auto epwFile = state.files.inputWeatherFilePath.open(state, "CalcThermalComfortAdaptiveASH55"); for (i = 1; i <= 8; ++i) { // Headers epwLine = epwFile.readLine().data; } - jStartDay = state.dataEnvrn->DayOfYear - 1; - calcStartDay = jStartDay - 30; + int jStartDay = state.dataEnvrn->DayOfYear - 1; + int calcStartDay = jStartDay - 30; + int calcStartHr; + int ind; + int j; if (calcStartDay >= 0) { calcStartHr = 24 * calcStartDay + 1; for (i = 1; i <= calcStartHr - 1; ++i) { @@ -2828,9 +2822,9 @@ namespace ThermalComfort { state.dataThermalComforts->DailyAveOutTemp(i) = state.dataThermalComforts->avgDryBulbASH; } } else { // Do special things for wrapping the epw - calcEndDay = jStartDay; + int calcEndDay = jStartDay; calcStartDay += DaysInYear; - calcEndHr = 24 * calcEndDay; + int calcEndHr = 24 * calcEndDay; calcStartHr = 24 * calcStartDay + 1; for (i = 1; i <= calcEndDay; ++i) { state.dataThermalComforts->avgDryBulbASH = 0.0; @@ -2989,21 +2983,11 @@ namespace ThermalComfort { static constexpr std::array alpha_pow = {0.262144, 0.32768, 0.4096, 0.512, 0.64, 0.8, 1.0}; // alpha^(6-0) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string epwLine; Real64 dryBulb; Real64 tComf; Real64 tComfLow; Real64 numOccupants; - int readStat; - int jStartDay; - int calcStartDay; - int calcStartHr; - int calcEndDay; - int calcEndHr; std::string::size_type pos; - int ind; - int i; - int j; bool weathersimulation; Real64 inavgdrybulb; int constexpr numHeaderRowsInEpw = 8; @@ -3020,7 +3004,7 @@ namespace ThermalComfort { if (initiate && weathersimulation) { const bool epwFileExists = FileSystem::fileExists(state.files.inputWeatherFilePath.filePath); - readStat = 0; + int readStat = 0; if (epwFileExists) { // determine number of days in year int DaysInYear; @@ -3030,12 +3014,17 @@ namespace ThermalComfort { DaysInYear = 365; } + int i; + int j; + std::string epwLine; auto epwFile = state.files.inputWeatherFilePath.open(state, "CalcThermalComfortAdaptiveCEN15251"); for (i = 1; i <= numHeaderRowsInEpw; ++i) { epwFile.readLine(); } - jStartDay = state.dataEnvrn->DayOfYear - 1; - calcStartDay = jStartDay - 7; + int jStartDay = state.dataEnvrn->DayOfYear - 1; + int calcStartDay = jStartDay - 7; + int calcStartHr; + int ind; if (calcStartDay > 0) { calcStartHr = 24 * calcStartDay + 1; for (i = 1; i <= calcStartHr - 1; ++i) { @@ -3057,9 +3046,9 @@ namespace ThermalComfort { state.dataThermalComforts->runningAverageCEN += alpha_pow[i] * state.dataThermalComforts->avgDryBulbCEN; } } else { // Do special things for wrapping the epw - calcEndDay = jStartDay; + int calcEndDay = jStartDay; calcStartDay += DaysInYear; - calcEndHr = 24 * calcEndDay; + int calcEndHr = 24 * calcEndDay; calcStartHr = 24 * calcStartDay + 1; for (i = 1; i <= calcEndDay; ++i) { state.dataThermalComforts->avgDryBulbCEN = 0.0; diff --git a/src/EnergyPlus/ThermalEN673Calc.cc b/src/EnergyPlus/ThermalEN673Calc.cc index 166f07924e6..0ba860d04e9 100644 --- a/src/EnergyPlus/ThermalEN673Calc.cc +++ b/src/EnergyPlus/ThermalEN673Calc.cc @@ -554,8 +554,6 @@ namespace ThermalEN673Calc { EP_SIZE_CHECK(absol, maxlay); // Locals - int i; - int j; Real64 fract; Real64 flowin; @@ -565,6 +563,8 @@ namespace ThermalEN673Calc { // evaluate inward flowing fraction of absorbed radiation: if ((standard == TARCOGGassesParams::Stdrd::EN673) || (standard == TARCOGGassesParams::Stdrd::EN673Design)) { + int i; + int j; if (nlayer == 1) { fract = dir * absol(1) * (rs(1) * rs(3)) / (rs(1) * (rs(1) + rs(3))); } else { diff --git a/src/EnergyPlus/ThermalISO15099Calc.cc b/src/EnergyPlus/ThermalISO15099Calc.cc index 54d04a10342..d42120ac6e6 100644 --- a/src/EnergyPlus/ThermalISO15099Calc.cc +++ b/src/EnergyPlus/ThermalISO15099Calc.cc @@ -331,10 +331,7 @@ void Calc_ISO15099(EnergyPlusData &state, // cbi...Variables for "unshaded" run: - bool NeedUnshadedRun; - int nlayer_NOSD; Real64 AchievedErrorTolerance_NOSD; - int NumOfIter_NOSD; Real64 hin_NOSD; Real64 flux_NOSD; Real64 hcin_NOSD; @@ -356,9 +353,6 @@ void Calc_ISO15099(EnergyPlusData &state, Real64 ShadeHcModifiedOut_NOSD; Real64 ShadeHcModifiedIn_NOSD; - int FirstSpecularLayer; - int LastSpecularLayer; - // cbi...Other variables: Real64 flux; Real64 hint; @@ -366,9 +360,6 @@ void Calc_ISO15099(EnergyPlusData &state, Real64 ebsky; Real64 ebroom; int i; - int j; - int OriginalIndex; - int UnshadedDebug; // Autodesk:Uninit Initialize variables used uninitialized shgc_NOSD = 0.0; // Autodesk:Uninit Force default initialization @@ -745,10 +736,10 @@ void Calc_ISO15099(EnergyPlusData &state, // bi...do an Unshaded run if necessary (Uvalue/Winter conditions): // bi...Prepare variables for UNSHADED (NO SD) run: - NeedUnshadedRun = false; - FirstSpecularLayer = 1; - LastSpecularLayer = nlayer; - nlayer_NOSD = nlayer; + bool NeedUnshadedRun = false; + int FirstSpecularLayer = 1; + int LastSpecularLayer = nlayer; + int nlayer_NOSD = nlayer; if (IsShadingLayer(LayerType(1))) { --nlayer_NOSD; FirstSpecularLayer = 2; @@ -766,6 +757,9 @@ void Calc_ISO15099(EnergyPlusData &state, NeedUnshadedRun = false; // bi...Set outdoor & indoor gas properties: if (NeedUnshadedRun) { + int NumOfIter_NOSD; + int j; + int OriginalIndex; state.dataThermalISO15099Calc->nmix_NOSD(1) = nmix(1); state.dataThermalISO15099Calc->presure_NOSD(1) = presure(1); state.dataThermalISO15099Calc->nmix_NOSD(nlayer_NOSD + 1) = nmix(nlayer + 1); @@ -830,7 +824,7 @@ void Calc_ISO15099(EnergyPlusData &state, hout_NOSD = houtt; // Simon: Removed unshaded debug output for now - UnshadedDebug = 0; + int UnshadedDebug = 0; if (files.WriteDebugOutput && (UnshadedDebug == 1)) { print(files.DebugOutputFile, "\n"); print(files.DebugOutputFile, "UNSHADED RUN:\n"); @@ -2519,7 +2513,6 @@ void filmi(EnergyPlusData &state, gcp.dim(3, maxgas); // Locals - int j; Real64 tiltr; Real64 tmean; Real64 delt; @@ -2550,7 +2543,7 @@ void filmi(EnergyPlusData &state, tmean = tair + 0.25 * (t - tair); delt = std::abs(tair - t); - for (j = 1; j <= nmix(nlayer + 1); ++j) { + for (int j = 1; j <= nmix(nlayer + 1); ++j) { state.dataThermalISO15099Calc->ipropi(j) = iprop(j, nlayer + 1); state.dataThermalISO15099Calc->frcti(j) = frct(j, nlayer + 1); } diff --git a/src/EnergyPlus/TranspiredCollector.cc b/src/EnergyPlus/TranspiredCollector.cc index 11f832c4c23..9fcb3cec530 100644 --- a/src/EnergyPlus/TranspiredCollector.cc +++ b/src/EnergyPlus/TranspiredCollector.cc @@ -182,13 +182,13 @@ namespace TranspiredCollector { // Control point of deciding if transpired collector is active or not. auto &UTSC_CI = state.dataTranspiredCollector->UTSC(CompIndex); - auto &InletNode = UTSC_CI.InletNode; - auto &ControlNode = UTSC_CI.ControlNode; UTSC_CI.IsOn = false; if ((UTSC_CI.availSched->getCurrentVal() > 0.0) && (UTSC_CI.InletMDot > 0.0)) { // availability Schedule | OA system is setting mass flow bool ControlLTSet(false); bool ControlLTSchedule(false); bool ZoneLTSchedule(false); + auto &InletNode = UTSC_CI.InletNode; + auto &ControlNode = UTSC_CI.ControlNode; assert(equal_dimensions(InletNode, ControlNode)); assert(equal_dimensions(InletNode, UTSC_CI.ZoneNode)); for (int i = InletNode.l(), e = InletNode.u(); i <= e; ++i) { @@ -882,13 +882,10 @@ namespace TranspiredCollector { using DataSurfaces::SurfaceData; using EMSManager::CheckIfNodeSetPointManagedByEMS; - int UTSCUnitNum; - int ControlNode; - int SplitBranch; - int thisUTSC; Real64 Tamb; if (state.dataTranspiredCollector->MyOneTimeFlag) { + int thisUTSC; // do various one time setups and pitch adjustments across all UTSC for (thisUTSC = 1; thisUTSC <= state.dataTranspiredCollector->NumUTSC; ++thisUTSC) { if (state.dataTranspiredCollector->UTSC(thisUTSC).Layout == Layout_Triangle) { @@ -923,6 +920,9 @@ namespace TranspiredCollector { // Check that setpoint is active (from test by RJL in HVACEvapComponent) if (!state.dataGlobal->SysSizingCalc && state.dataTranspiredCollector->MySetPointCheckFlag && DoSetPointTest) { + int UTSCUnitNum; + int ControlNode; + int SplitBranch; for (UTSCUnitNum = 1; UTSCUnitNum <= state.dataTranspiredCollector->NumUTSC; ++UTSCUnitNum) { for (SplitBranch = 1; SplitBranch <= state.dataTranspiredCollector->UTSC(UTSCUnitNum).NumOASysAttached; ++SplitBranch) { ControlNode = state.dataTranspiredCollector->UTSC(UTSCUnitNum).ControlNode(SplitBranch); @@ -1462,11 +1462,6 @@ namespace TranspiredCollector { // MODIFIED na // RE-ENGINEERED na - int OutletNode; - int InletNode; - int thisOSCM; - int thisOASys; - // update "last" values in Derived type state.dataTranspiredCollector->UTSC(UTSCNum).TplenLast = state.dataTranspiredCollector->UTSC(UTSCNum).Tplen; state.dataTranspiredCollector->UTSC(UTSCNum).TcollLast = state.dataTranspiredCollector->UTSC(UTSCNum).Tcoll; @@ -1475,14 +1470,14 @@ namespace TranspiredCollector { if (state.dataTranspiredCollector->UTSC(UTSCNum).IsOn) { // Active if (state.dataTranspiredCollector->UTSC(UTSCNum).NumOASysAttached == 1) { - OutletNode = state.dataTranspiredCollector->UTSC(UTSCNum).OutletNode(1); - InletNode = state.dataTranspiredCollector->UTSC(UTSCNum).InletNode(1); + int OutletNode = state.dataTranspiredCollector->UTSC(UTSCNum).OutletNode(1); + int InletNode = state.dataTranspiredCollector->UTSC(UTSCNum).InletNode(1); state.dataLoopNodes->Node(OutletNode).MassFlowRate = state.dataTranspiredCollector->UTSC(UTSCNum).SupOutMassFlow; state.dataLoopNodes->Node(OutletNode).Temp = state.dataTranspiredCollector->UTSC(UTSCNum).SupOutTemp; state.dataLoopNodes->Node(OutletNode).HumRat = state.dataTranspiredCollector->UTSC(UTSCNum).SupOutHumRat; state.dataLoopNodes->Node(OutletNode).Enthalpy = state.dataTranspiredCollector->UTSC(UTSCNum).SupOutEnth; } else if (state.dataTranspiredCollector->UTSC(UTSCNum).NumOASysAttached > 1) { - for (thisOASys = 1; thisOASys <= state.dataTranspiredCollector->UTSC(UTSCNum).NumOASysAttached; ++thisOASys) { + for (int thisOASys = 1; thisOASys <= state.dataTranspiredCollector->UTSC(UTSCNum).NumOASysAttached; ++thisOASys) { state.dataLoopNodes->Node(state.dataTranspiredCollector->UTSC(UTSCNum).OutletNode(thisOASys)).MassFlowRate = state.dataLoopNodes->Node(state.dataTranspiredCollector->UTSC(UTSCNum).InletNode(thisOASys)) .MassFlowRate; // system gets what it asked for at inlet @@ -1514,7 +1509,7 @@ namespace TranspiredCollector { } // update the OtherSideConditionsModel coefficients. - thisOSCM = state.dataTranspiredCollector->UTSC(UTSCNum).OSCMPtr; + int thisOSCM = state.dataTranspiredCollector->UTSC(UTSCNum).OSCMPtr; state.dataSurface->OSCM(thisOSCM).TConv = state.dataTranspiredCollector->UTSC(UTSCNum).Tplen; state.dataSurface->OSCM(thisOSCM).HConv = state.dataTranspiredCollector->UTSC(UTSCNum).HcPlen; diff --git a/src/EnergyPlus/UserDefinedComponents.cc b/src/EnergyPlus/UserDefinedComponents.cc index 643ef22a22d..e9e9215012b 100644 --- a/src/EnergyPlus/UserDefinedComponents.cc +++ b/src/EnergyPlus/UserDefinedComponents.cc @@ -1446,7 +1446,6 @@ namespace UserDefinedComponents { bool ErrorsFound(false); int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine int TotalArgs; // argument for call to GetObjectDefMaxArgs Array1D_string cAlphaFieldNames; Array1D_bool lAlphaFieldBlanks; @@ -1471,6 +1470,7 @@ namespace UserDefinedComponents { if (state.dataUserDefinedComponents->NumUserZoneAir > 0) { state.dataUserDefinedComponents->UserZoneAirHVAC.allocate(state.dataUserDefinedComponents->NumUserZoneAir); state.dataUserDefinedComponents->CheckUserZoneAirName.dimension(state.dataUserDefinedComponents->NumUserZoneAir, true); + int IOStat; // IO Status when calling get input subroutine for (int CompLoop = 1; CompLoop <= state.dataUserDefinedComponents->NumUserZoneAir; ++CompLoop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -1925,7 +1925,6 @@ namespace UserDefinedComponents { bool ErrorsFound(false); int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine int TotalArgs; // argument for call to GetObjectDefMaxArgs Array1D_string cAlphaFieldNames; Array1D_bool lAlphaFieldBlanks; @@ -1952,6 +1951,7 @@ namespace UserDefinedComponents { if (state.dataUserDefinedComponents->NumUserAirTerminals > 0) { state.dataUserDefinedComponents->UserAirTerminal.allocate(state.dataUserDefinedComponents->NumUserAirTerminals); state.dataUserDefinedComponents->CheckUserAirTerminal.dimension(state.dataUserDefinedComponents->NumUserAirTerminals, true); + int IOStat; // IO Status when calling get input subroutine for (int CompLoop = 1; CompLoop <= state.dataUserDefinedComponents->NumUserAirTerminals; ++CompLoop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index dfb3d2acdcb..d8fb3d81417 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -191,16 +191,7 @@ namespace WaterManager { static constexpr std::string_view routineName = "GetWaterManagerInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Item; // Item to be "gotten" - int NumAlphas(0); // Number of Alphas for each GetObjectItem call - int NumNumbers(0); // Number of Numbers for each GetObjectItem call - int IOStatus(0); // Used in GetObjectItem - bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs - int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs - int TotalArgs(0); // argument for call to GetObjectDefMaxArgs - int alphaOffset(0); - std::string objNameMsg; + Array1D_string cAlphaFieldNames; Array1D_string cNumericFieldNames; Array1D_bool lNumericFieldBlanks; @@ -208,10 +199,22 @@ namespace WaterManager { Array1D_string cAlphaArgs; Array1D rNumericArgs; std::string cCurrentModuleObject; - int NumIrrigation; - int Dummy; if ((state.dataWaterManager->MyOneTimeFlag) && (!(state.dataWaterData->WaterSystemGetInputCalled))) { // big block for entire subroutine + + int Item; // Item to be "gotten" + int NumAlphas(0); // Number of Alphas for each GetObjectItem call + int NumNumbers(0); // Number of Numbers for each GetObjectItem call + int IOStatus(0); // Used in GetObjectItem + bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine + int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs + int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs + int TotalArgs(0); // argument for call to GetObjectDefMaxArgs + int alphaOffset(0); + std::string objNameMsg; + int NumIrrigation; + int Dummy; + // initialize rainfall model state.dataWaterData->RainFall.ModeID = RainfallMode::None; diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index bb2770a45ea..148f76d4b01 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1977,10 +1977,10 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) if ((HPWH.InletAirConfiguration == WTTAmbientTemp::TempZone || HPWH.InletAirConfiguration == WTTAmbientTemp::ZoneAndOA) && HPWH.AmbientTempZone > 0) { if (allocated(state.dataZoneEquip->ZoneEquipConfig)) { - bool FoundInletNode = false; - bool FoundOutletNode = false; int ZoneNum = HPWH.AmbientTempZone; if (ZoneNum <= state.dataGlobal->NumOfZones) { + bool FoundOutletNode = false; + bool FoundInletNode = false; for (int SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(ZoneNum).NumInletNodes; ++SupAirIn) { if (HPWH.HeatPumpAirOutletNode != state.dataZoneEquip->ZoneEquipConfig(ZoneNum).InletNode(SupAirIn)) { continue; @@ -6240,8 +6240,6 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA // METHODOLOGY EMPLOYED: // Inlet and outlet nodes are initialized. Scheduled values are retrieved for the current timestep. - auto &ZoneEqSizing = state.dataSize->ZoneEqSizing; - static constexpr std::string_view RoutineName("InitWaterThermalTank"); static constexpr std::string_view GetWaterThermalTankInput("GetWaterThermalTankInput"); static constexpr std::string_view SizeTankForDemand("SizeTankForDemandSide"); @@ -6761,6 +6759,7 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA state.dataWaterThermalTanks->HPWaterHeater(HPNum).OperatingAirMassFlowRate = state.dataWaterThermalTanks->HPWaterHeater(HPNum).OperatingAirFlowRate * state.dataEnvrn->StdRhoAir; if (state.dataSize->CurZoneEqNum > 0) { + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing; ZoneEqSizing(state.dataSize->CurZoneEqNum).CoolingAirFlow = true; ZoneEqSizing(state.dataSize->CurZoneEqNum).CoolingAirVolFlow = state.dataSize->DataNonZoneNonAirloopValue; } @@ -9158,7 +9157,6 @@ void WaterThermalTankData::CalcDesuperheaterWaterHeater(EnergyPlusData &state, b DesupHtr.Mode = TankOperatingMode::Floating; } int SolFla; - std::string IterNum; auto f = [&state, this, desupHtrSetPointTemp, &DesupHtr, MdotWater](Real64 const HPPartLoadRatio) { this->Mode = DesupHtr.SaveWHMode; this->SourceMassFlowRate = MdotWater * HPPartLoadRatio; @@ -9169,7 +9167,7 @@ void WaterThermalTankData::CalcDesuperheaterWaterHeater(EnergyPlusData &state, b }; General::SolveRoot(state, Acc, MaxIte, SolFla, partLoadRatio, f, 0.0, DesupHtr.DXSysPLR); if (SolFla == -1) { - IterNum = fmt::to_string(MaxIte); + std::string IterNum = fmt::to_string(MaxIte); if (!state.dataGlobal->WarmupFlag) { ++DesupHtr.IterLimitExceededNum1; if (DesupHtr.IterLimitExceededNum1 == 1) { @@ -9284,7 +9282,6 @@ void WaterThermalTankData::CalcDesuperheaterWaterHeater(EnergyPlusData &state, b DesupHtr.Mode = TankOperatingMode::Floating; } int SolFla; - std::string IterNum; auto f = [&state, this, desupHtrSetPointTemp, &DesupHtr, MdotWater](Real64 const HPPartLoadRatio) { this->Mode = DesupHtr.SaveWHMode; this->SourceMassFlowRate = MdotWater * HPPartLoadRatio; @@ -9295,7 +9292,7 @@ void WaterThermalTankData::CalcDesuperheaterWaterHeater(EnergyPlusData &state, b }; General::SolveRoot(state, Acc, MaxIte, SolFla, partLoadRatio, f, 0.0, DesupHtr.DXSysPLR); if (SolFla == -1) { - IterNum = fmt::to_string(MaxIte); + std::string IterNum = fmt::to_string(MaxIte); if (!state.dataGlobal->WarmupFlag) { ++DesupHtr.IterLimitExceededNum2; if (DesupHtr.IterLimitExceededNum2 == 1) { @@ -10144,7 +10141,6 @@ void WaterThermalTankData::CalcHeatPumpWaterHeater(EnergyPlusData &state, bool c if (NewTankTemp > HPSetPointTemp) { int SolFla; - std::string IterNum; auto f = [&state, this, SpeedNum, HPWaterInletNode, HPWaterOutletNode, RhoWater, HPSetPointTemp, &HeatPump, FirstHVACIteration]( Real64 const SpeedRatio) { return this->PLRResidualIterSpeed(state, @@ -10161,7 +10157,7 @@ void WaterThermalTankData::CalcHeatPumpWaterHeater(EnergyPlusData &state, bool c General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, f, 1.0e-10, 1.0); if (SolFla == -1) { - IterNum = fmt::to_string(MaxIte); + std::string IterNum = fmt::to_string(MaxIte); if (!state.dataGlobal->WarmupFlag) { ++HeatPump.IterLimitExceededNum1; if (HeatPump.IterLimitExceededNum1 == 1) { @@ -12588,7 +12584,6 @@ void WaterThermalTankData::CalcStandardRatings(EnergyPlusData &state) return; } - bool FirstTimeFlag; // used during HPWH rating procedure bool bIsVSCoil = false; Real64 RecoveryEfficiency; Real64 EnergyFactor; @@ -12611,7 +12606,7 @@ void WaterThermalTankData::CalcStandardRatings(EnergyPlusData &state) Real64 SecInTimeStep = state.dataHVACGlobal->TimeStepSysSec; Real64 DrawMassFlowRate = DrawMass / SecInTimeStep; Real64 FuelEnergy_loc = 0.0; - FirstTimeFlag = true; + bool FirstTimeFlag = true; // used during HPWH rating procedure int TimeStepPerHour = int(1.0 / state.dataHVACGlobal->TimeStepSys); // Simulate 24 hour test diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index 4397077ad4b..9bc15f002ba 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -3508,9 +3508,6 @@ namespace Weather { static constexpr std::string_view WeatherManager("WeatherManager"); static constexpr std::string_view RoutineNameLong("WeatherManager.cc subroutine SetUpDesignDay"); - std::string StringOut; - // For reporting purposes, set year to current system year - struct HourlyWeatherData { // Members diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index 0eb3698e88b..9e5ce5db671 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -478,9 +478,7 @@ namespace WindowComplexManager { // PURPOSE OF THIS SUBROUTINE: // Check if there are new states available for complex fenestration and performs proper initialization - int NumOfStates; // number of states for current surface bool StateFound; // variable to indicate if state has been found - int i; // Local counter int CurrentCFSState; StateFound = false; @@ -491,8 +489,8 @@ namespace WindowComplexManager { // If construction number changed then take new state // First search for existing states. Maybe state is already added in previous timestep - NumOfStates = state.dataSurface->SurfaceWindow(iSurf).ComplexFen.NumStates; - for (i = 1; i <= NumOfStates; ++i) { + int NumOfStates = state.dataSurface->SurfaceWindow(iSurf).ComplexFen.NumStates; // number of states for current surface + for (int i = 1; i <= NumOfStates; ++i) { if (state.dataSurface->Surface(iSurf).Construction == state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(i).Konst) { StateFound = true; CurrentCFSState = i; @@ -747,7 +745,6 @@ namespace WindowComplexManager { using namespace Vectors; int IConst; // State construction number - int I; // general purpose index--Back surface int J; // general purpose index--ray int JRay; // ray index number Real64 Theta; @@ -760,11 +757,9 @@ namespace WindowComplexManager { Real64 Sum1; // general purpose sum Real64 Sum2; // general purpose sum int IBm; // index of beam ray in incoming basis - int BkIncRay; // index of sun dir in back incidence basis bool RegWindFnd; // flag for regular exterior back surf window Array1D_int RegWinIndex; // bk surf nos of reg windows int NRegWin(0); // no reg windows found as back surfaces - int KRegWin(0); // index of reg window as back surface Real64 Refl; // temporary reflectance Array1D Absorb; // temporary layer absorptance @@ -783,7 +778,7 @@ namespace WindowComplexManager { State.WinDirSpecTrans(Hour, TS) = 0.0; State.WinBmFtAbs(Hour, TS, {1, State.NLayers}) = 0.0; } else { - for (I = 1; I <= Window.NBkSurf; ++I) { // Back surface loop + for (int I = 1; I <= Window.NBkSurf; ++I) { // Back surface loop Sum1 = 0.0; for (J = 1; J <= Geom.NSurfInt(I); ++J) { // Ray loop Sum1 += @@ -873,14 +868,14 @@ namespace WindowComplexManager { if (RegWindFnd) { Absorb.allocate(State.NLayers); SunDir = state.dataBSDFWindow->SUNCOSTS(TS, Hour); - BkIncRay = FindInBasis(state, - SunDir, - RayIdentificationType::Back_Incident, - ISurf, - IState, - state.dataBSDFWindow->ComplexWind(ISurf).Geom(IState).Trn, - Theta, - Phi); + int BkIncRay = FindInBasis(state, + SunDir, + RayIdentificationType::Back_Incident, + ISurf, + IState, + state.dataBSDFWindow->ComplexWind(ISurf).Geom(IState).Trn, + Theta, + Phi); // index of sun dir in back incidence basis if (BkIncRay > 0) { // Here calculate the back incidence properties for the solar ray // this does not say whether or not the ray can pass through the @@ -900,7 +895,7 @@ namespace WindowComplexManager { Absorb(L) = 0.0; } } - for (KRegWin = 1; KRegWin <= NRegWin; ++KRegWin) { + for (int KRegWin = 1; KRegWin <= NRegWin; ++KRegWin) { // index of reg window as back surface KBkSurf = RegWinIndex(KRegWin); State.BkSurf(KBkSurf).WinDHBkRefl(Hour, TS) = Refl; for (L = 1; L <= State.NLayers; ++L) { @@ -993,12 +988,7 @@ namespace WindowComplexManager { // PURPOSE OF THIS SUBROUTINE: // Set up a basis from the matrix information pointed to in Construction by ICons - int I(0); // general purpose index - int J(0); // general purpose index int NThetas(0); // Current number of theta values - int NumElem(0); // Number of elements in current basis - int ElemNo(0); // Current basis element number - int MaxNPhis; // Max no of NPhis for any theta Real64 Theta(0.0); // Current theta value Real64 Phi(0.0); // Current phi value Real64 DTheta(0.0); // Increment for theta value (Window6 type input) @@ -1028,6 +1018,9 @@ namespace WindowComplexManager { Basis.SolAng.allocate(state.dataConstruction->Construct(IConst).BSDFInput.NBasis); if (state.dataConstruction->Construct(IConst).BSDFInput.BasisType == DataBSDFWindow::Basis::WINDOW) { // WINDOW6 Basis + int I(0); // general purpose index + int NumElem(0); // Number of elements in current basis + int ElemNo(0); // Current basis element number Basis.BasisType = DataBSDFWindow::Basis::WINDOW; if (state.dataConstruction->Construct(IConst).BSDFInput.BasisSymmetryType == DataBSDFWindow::BasisSymmetry::None) { // No basis symmetry @@ -1044,7 +1037,7 @@ namespace WindowComplexManager { } NumElem += NPhis(I); } - MaxNPhis = maxval(NPhis({1, NThetas})); + int MaxNPhis = maxval(NPhis({1, NThetas})); // Max no of NPhis for any theta Basis.Phis.allocate(NThetas + 1, MaxNPhis + 1); // N+1st Phi point (not basis element) at 2Pi Basis.BasisIndex.allocate(MaxNPhis, NThetas + 1); Basis.Phis = 0.0; // Initialize so undefined elements will contain zero @@ -1088,7 +1081,7 @@ namespace WindowComplexManager { } DTheta = UpperTheta - LowerTheta; Basis.Phis(I, NPhis(I) + 1) = 2.0 * Constant::Pi; // Non-basis-element Phi point for table searching in Phi - for (J = 1; J <= NPhis(I); ++J) { + for (int J = 1; J <= NPhis(I); ++J) { ++ElemNo; Basis.BasisIndex(J, I) = ElemNo; Phi = (J - 1) * DPhi; @@ -2281,11 +2274,8 @@ namespace WindowComplexManager { // INTEGER, INTENT(IN) :: IWind !window index in window list int ITheta; // Table index of Theta - int IPhi; // Table index of Phi, given ITheta int IThDn; // Theta lower table index int IThUp; // Theta upper table index - int IPhDn; // Phi lower table index - int IPhUp; // Phi upper table index Real64 Gamma; // Gamma (tilt) angle of window Real64 Alpha; // Alpha (azimuth) angle of window Real64 DotProd; @@ -2312,6 +2302,9 @@ namespace WindowComplexManager { } if (Basis.BasisSymmetryType == DataBSDFWindow::BasisSymmetry::None) { // Search the basis thetas + int IPhi; // Table index of Phi, given ITheta + int IPhDn; // Phi lower table index + int IPhUp; // Phi upper table index if (Theta <= 0.0) { // Special case, Theta = 0.; this is always the first basis element RayIndex = 1; diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index f861a97a35e..a24a6cf8cb7 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -2368,7 +2368,6 @@ void InitZoneAirSetPoints(EnergyPlusData &state) static constexpr std::string_view RoutineName("InitZoneAirSetpoints: "); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int TRefFlag; // Flag for Reference Temperature process in Zones auto &s_ztpc = state.dataZoneTempPredictorCorrector; auto &s_hbfs = state.dataHeatBalFanSys; @@ -2418,6 +2417,7 @@ void InitZoneAirSetPoints(EnergyPlusData &state) state.dataZoneEnergyDemand->spaceSysMoistureDemand.allocate(state.dataGlobal->numSpaces); } + int TRefFlag; // Flag for Reference Temperature process in Zones for (int zoneNum = 1; zoneNum <= NumOfZones; ++zoneNum) { bool FirstSurfFlag = true; for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { @@ -6300,8 +6300,6 @@ void GetComfortSetPoints(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 PMVResult = 0.0; // Calculated PMV value - auto &s_ztpc = state.dataZoneTempPredictorCorrector; - auto &comfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlNum); Real64 Tmin = comfortControlledZone.TdbMinSetPoint; Real64 Tmax = comfortControlledZone.TdbMaxSetPoint; @@ -6320,6 +6318,7 @@ void GetComfortSetPoints(EnergyPlusData &state, int SolFla = 0; // feed back flag from SolveRoot General::SolveRoot(state, Acc, MaxIter, SolFla, Tset, f, Tmin, Tmax); + auto &s_ztpc = state.dataZoneTempPredictorCorrector; if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { ++s_ztpc->IterLimitExceededNum1; From 26630bf7de9be1c6e1ad58f2c5e9d5fc24082e7c Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 6 Jan 2026 15:25:39 -0700 Subject: [PATCH 26/33] fix build errors --- src/EnergyPlus/ThermalComfort.cc | 2 -- src/EnergyPlus/TranspiredCollector.cc | 1 - 2 files changed, 3 deletions(-) diff --git a/src/EnergyPlus/ThermalComfort.cc b/src/EnergyPlus/ThermalComfort.cc index 40fb82223ab..04b77b4a776 100644 --- a/src/EnergyPlus/ThermalComfort.cc +++ b/src/EnergyPlus/ThermalComfort.cc @@ -2763,7 +2763,6 @@ namespace ThermalComfort { const bool statFileExists = FileSystem::fileExists(state.files.inStatFilePath.filePath); const bool epwFileExists = FileSystem::fileExists(state.files.inputWeatherFilePath.filePath); - int readStat = 0; if (statFileExists) { std::string lineAvg; auto statFile = state.files.inStatFilePath.open(state, "CalcThermalComfortAdapctiveASH55"); @@ -3004,7 +3003,6 @@ namespace ThermalComfort { if (initiate && weathersimulation) { const bool epwFileExists = FileSystem::fileExists(state.files.inputWeatherFilePath.filePath); - int readStat = 0; if (epwFileExists) { // determine number of days in year int DaysInYear; diff --git a/src/EnergyPlus/TranspiredCollector.cc b/src/EnergyPlus/TranspiredCollector.cc index 9fcb3cec530..5af28e1cb0f 100644 --- a/src/EnergyPlus/TranspiredCollector.cc +++ b/src/EnergyPlus/TranspiredCollector.cc @@ -1471,7 +1471,6 @@ namespace TranspiredCollector { if (state.dataTranspiredCollector->UTSC(UTSCNum).IsOn) { // Active if (state.dataTranspiredCollector->UTSC(UTSCNum).NumOASysAttached == 1) { int OutletNode = state.dataTranspiredCollector->UTSC(UTSCNum).OutletNode(1); - int InletNode = state.dataTranspiredCollector->UTSC(UTSCNum).InletNode(1); state.dataLoopNodes->Node(OutletNode).MassFlowRate = state.dataTranspiredCollector->UTSC(UTSCNum).SupOutMassFlow; state.dataLoopNodes->Node(OutletNode).Temp = state.dataTranspiredCollector->UTSC(UTSCNum).SupOutTemp; state.dataLoopNodes->Node(OutletNode).HumRat = state.dataTranspiredCollector->UTSC(UTSCNum).SupOutHumRat; From b312eb3dc80833cafc0e75e7637b541b7198f90b Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 6 Jan 2026 17:12:40 -0700 Subject: [PATCH 27/33] address more cppcheck variableScope warnings --- src/EnergyPlus/DXCoils.cc | 11 +-- src/EnergyPlus/EconomicTariff.cc | 31 ++---- src/EnergyPlus/HeatBalanceHAMTManager.cc | 3 +- src/EnergyPlus/HybridModel.cc | 3 +- .../PhotovoltaicThermalCollectors.cc | 11 +-- src/EnergyPlus/PlantLoopHeatPumpEIR.cc | 7 +- src/EnergyPlus/PurchasedAirManager.cc | 8 +- src/EnergyPlus/RefrigeratedCase.cc | 7 +- src/EnergyPlus/RuntimeLanguageProcessor.cc | 6 +- src/EnergyPlus/WindowComplexManager.cc | 95 +++++++++---------- 10 files changed, 73 insertions(+), 109 deletions(-) diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index a6977315c5d..d404bdd939d 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -1388,7 +1388,6 @@ void GetDXCoils(EnergyPlusData &state) // Loop over the Multimode DX Coils and get & load the data CurrentModuleObject = "Coil:Cooling:DX:TwoStageWithHumidityControlMode"; - int AlphaIndex; // Index for current alpha field for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDXMulModeCoils; ++DXCoilIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1495,7 +1494,7 @@ void GetDXCoils(EnergyPlusData &state) // Set starting alpha index for coil performance inputs - AlphaIndex = 6; + int AlphaIndex = 6; // allocate performance modes for numeric field strings used for sizing routine state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate( thisDXCoil.NumDehumidModes * 2 + thisDXCoil.NumCapacityStages * 2); // not sure this math is correct, ask MW @@ -3001,7 +3000,6 @@ void GetDXCoils(EnergyPlusData &state) if (instances_whPumped != s_ip->epJSON.end()) { auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_whPumped.value(); - std::string cFieldName; for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { ++DXCoilNum; @@ -3040,7 +3038,7 @@ void GetDXCoils(EnergyPlusData &state) ErrorsFound = true; } - cFieldName = "Rated COP"; + std::string cFieldName = "Rated COP"; thisDXCoil.RatedCOP(1) = s_ip->getRealFieldValue(fields, schemaProps, "rated_cop"); // Numbers(2); if (thisDXCoil.RatedCOP(1) <= 0.0) { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); @@ -3528,7 +3526,6 @@ void GetDXCoils(EnergyPlusData &state) if (instances_whWrapped != s_ip->epJSON.end()) { auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_whWrapped.value(); - std::string cFieldName; for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { ++DXCoilNum; @@ -3558,7 +3555,7 @@ void GetDXCoils(EnergyPlusData &state) // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, thisDXCoil.Name, ErrorsFound, CurrentModuleObject + " Name"); - cFieldName = "Rated Heating Capacity"; + std::string cFieldName = "Rated Heating Capacity"; thisDXCoil.RatedTotCap2 = s_ip->getRealFieldValue(fields, schemaProps, "rated_heating_capacity"); // Numbers(1); if (thisDXCoil.RatedTotCap2 <= 0.0) { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); @@ -14770,13 +14767,11 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum int fanInNode = 0; int fanOutNode = 0; Real64 externalStatic = 0.0; - int fanIndex = 0; if (thisDXCoil.RateWithInternalStaticAndFanObject) { par7 = 0.0; fanInNode = FanInletNode; fanOutNode = FanOutletNode; externalStatic = ExternalStatic; - fanIndex = thisDXCoil.SupplyFanIndex; } LowerBoundMassFlowRate = 0.01 * thisDXCoil.RatedAirMassFlowRate(1); diff --git a/src/EnergyPlus/EconomicTariff.cc b/src/EnergyPlus/EconomicTariff.cc index 9c5f5088cb1..780de8c91d3 100644 --- a/src/EnergyPlus/EconomicTariff.cc +++ b/src/EnergyPlus/EconomicTariff.cc @@ -4539,22 +4539,15 @@ void ReportEconomicVariable(EnergyPlusData &state, Array2D_string tableBody; Real64 sumVal; Real64 maximumVal; - Real64 curVal; - int curIndex; - int curCatPt; - - int iVar; - int jMonth; - int cntOfVar; - int nCntOfVar; + int curCatPt = 0; auto const &s_econ = state.dataEconTariff; auto const &econVar = s_econ->econVar; auto const &chargeBlock = s_econ->chargeBlock; auto const &chargeSimple = s_econ->chargeSimple; - cntOfVar = 0; - for (iVar = 1; iVar <= s_econ->numEconVar; ++iVar) { + int cntOfVar = 0; + for (int iVar = 1; iVar <= s_econ->numEconVar; ++iVar) { if (econVar(iVar).activeNow) { ++cntOfVar; } @@ -4588,9 +4581,9 @@ void ReportEconomicVariable(EnergyPlusData &state, if (includeCategory) { columnHead(15) = "Category"; } - nCntOfVar = 0; + int nCntOfVar = 0; // row names - for (iVar = 1; iVar <= s_econ->numEconVar; ++iVar) { + for (int iVar = 1; iVar <= s_econ->numEconVar; ++iVar) { if (econVar(iVar).activeNow) { ++nCntOfVar; if (showCurrencySymbol) { @@ -4602,11 +4595,12 @@ void ReportEconomicVariable(EnergyPlusData &state, } // fill the body nCntOfVar = 0; - for (iVar = 1; iVar <= s_econ->numEconVar; ++iVar) { + for (int iVar = 1; iVar <= s_econ->numEconVar; ++iVar) { if (econVar(iVar).activeNow) { ++nCntOfVar; - for (jMonth = 1; jMonth <= 12; ++jMonth) { // note not all months get printed out if more than 12 are used.- need to fix this later - curVal = econVar(iVar).values(jMonth); + for (int jMonth = 1; jMonth <= 12; ++jMonth) { + // note not all months get printed out if more than 12 are used.- need to fix this later + const Real64 curVal = econVar(iVar).values(jMonth); if ((curVal > 0) && (curVal < 1)) { tableBody(jMonth, nCntOfVar) = OutputReportTabular::RealToStr(style.formatReals, curVal, 4); } else { @@ -4618,8 +4612,7 @@ void ReportEconomicVariable(EnergyPlusData &state, tableBody(14, nCntOfVar) = OutputReportTabular::RealToStr(style.formatReals, maximumVal, 2); if (includeCategory) { // first find category - int curCategory = 0; - curIndex = econVar(iVar).index; + const int curIndex = econVar(iVar).index; switch (econVar(iVar).kindOfObj) { case ObjType::ChargeSimple: @@ -4636,10 +4629,6 @@ void ReportEconomicVariable(EnergyPlusData &state, break; } - if ((curCatPt >= 1) && (curCatPt <= s_econ->numEconVar)) { - curCategory = econVar(curCatPt).specific; - } - // In this specific table, "NotIncluded" is written as "none" so need a special case for that tableBody(15, nCntOfVar) = (econVar(curCatPt).kindOfObj == ObjType::Category) diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index b49991238f2..029143f8732 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -597,7 +597,6 @@ namespace HeatBalanceHAMTManager { // Vapor Transfer coefficients HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject7); // SurfaceProperties:VaporCoefficients - int vtcsid; for (int item = 1; item <= HAMTitems; ++item) { s_ip->getObjectItem(state, cHAMTObject7, @@ -613,7 +612,7 @@ namespace HeatBalanceHAMTManager { cNumericFieldNames); ErrorObjectHeader eoh{routineName, cHAMTObject7, AlphaArray(1)}; - vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); + int vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); if (vtcsid == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 4afd88af167..296e23a9415 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -101,7 +101,6 @@ namespace HybridModel { int NumAlphas = 0; // Number of Alphas for each GetobjectItem call int NumNumbers = 0; // Number of Numbers for each GetobjectItem call int IOStatus = 0; - int ZonePtr = 0; for (int HybridModelNum = 1; HybridModelNum <= state.dataHybridModel->NumOfHybridModelZones; ++HybridModelNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -117,7 +116,7 @@ namespace HybridModel { cAlphaFieldNames, cNumericFieldNames); - ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name + int ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name if (ZonePtr > 0) { auto &hmZone = state.dataHybridModel->hybridModelZones(ZonePtr); hmZone.Name = cAlphaArgs(1); // Zone HybridModel name diff --git a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc index 42fbf903451..b267695ae10 100644 --- a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc +++ b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc @@ -197,11 +197,10 @@ namespace PhotovoltaicThermalCollectors { static constexpr std::string_view routineName = "GetPVTSimpleCollectorsInput"; - int Item; // Item to be "gotten" - 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 Item; // Item to be "gotten" + int NumAlphas; // Number of Alphas for each GetObjectItem call + int NumNumbers; // Number of Numbers for each GetObjectItem call + int IOStatus; // Used in GetObjectItem tmpSimplePVTperf.allocate(NumSimplePVTPerform); for (Item = 1; Item <= NumSimplePVTPerform; ++Item) { @@ -230,10 +229,8 @@ namespace PhotovoltaicThermalCollectors { if (thisTmpSimplePVTperf.ThermEfficMode == ThermEfficEnum::SCHEDULED) { if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); - ErrorsFound = true; } else if ((thisTmpSimplePVTperf.thermEffSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); - ErrorsFound = true; } } thisTmpSimplePVTperf.SurfEmissivity = state.dataIPShortCut->rNumericArgs(3); diff --git a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc index 0628b4f74ce..1e28b173c9e 100644 --- a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc +++ b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc @@ -1902,9 +1902,8 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state) EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::subtract}}; bool errorsFound = false; - std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (auto const &classToInput : classesToInput) { - cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; + auto cCurrentModuleObject = static_cast(DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]); DataLoopNode::ConnectionObjectType objType = static_cast( getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, Util::makeUPPER(cCurrentModuleObject))); int numPLHP = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); @@ -3390,10 +3389,8 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) }; bool errorsFound = false; - std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (auto &classToInput : classesToInput) { - cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; - + auto cCurrentModuleObject = static_cast(DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]); DataLoopNode::ConnectionObjectType objType = static_cast( getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, Util::makeUPPER(cCurrentModuleObject))); diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index 46fe62746de..50204c281a7 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -255,8 +255,6 @@ void GetPurchasedAir(EnergyPlusData &state) int NumNums = 0; int NumAlphas = 0; int purchAirNum = 0; - std::string fieldValue; - std::string cAlphaFieldName; InitUniqueNodeCheck(state, s_ipsc->cCurrentModuleObject); auto const &schemaProps = s_ip->getObjectSchemaProps(state, s_ipsc->cCurrentModuleObject); auto &instancesValue = instances_PurchAir.value(); @@ -286,7 +284,7 @@ void GetPurchasedAir(EnergyPlusData &state) state.dataPurchasedAirMgr->PurchAirNumericFields(purchAirNum).FieldNames = s_ipsc->cNumericFieldNames; Util::IsNameEmpty(state, thisObjectName, s_ipsc->cCurrentModuleObject, ErrorsFound); PurchAir.Name = Util::makeUPPER(thisObjectName); - cAlphaFieldName = "Availability Schedule Name"; + std::string cAlphaFieldName = "Availability Schedule Name"; // get optional availability schedule std::string const availSchedName = s_ip->getAlphaFieldValue(fields, schemaProps, "availability_schedule_name"); if (availSchedName.empty()) { @@ -363,7 +361,7 @@ void GetPurchasedAir(EnergyPlusData &state) PurchAir.MaxHeatSuppAirHumRat = s_ip->getRealFieldValue(fields, schemaProps, "maximum_heating_supply_air_humidity_ratio"); PurchAir.MinCoolSuppAirHumRat = s_ip->getRealFieldValue(fields, schemaProps, "minimum_cooling_supply_air_humidity_ratio"); cAlphaFieldName = "Heating Limit"; - fieldValue = s_ip->getAlphaFieldValue(fields, schemaProps, "heating_limit"); + std::string fieldValue = s_ip->getAlphaFieldValue(fields, schemaProps, "heating_limit"); PurchAir.HeatingLimit = static_cast(getEnumValue(limitTypeNamesUC, Util::makeUPPER(fieldValue))); PurchAir.MaxHeatVolFlowRate = s_ip->getRealFieldValue(fields, schemaProps, "maximum_heating_air_flow_rate"); PurchAir.MaxHeatSensCap = s_ip->getRealFieldValue(fields, schemaProps, "maximum_sensible_heating_capacity"); @@ -413,7 +411,7 @@ void GetPurchasedAir(EnergyPlusData &state) } // If outdoor air specified, then get Outdoor air inlet node and other outdoor air inputs if (PurchAir.OutdoorAir) { - std::string cAlphaFieldName = "Outdoor Air Inlet Node Name"; + cAlphaFieldName = "Outdoor Air Inlet Node Name"; std::string oaInletNodeName = s_ip->getAlphaFieldValue(fields, schemaProps, "outdoor_air_inlet_node_name"); if (oaInletNodeName.empty()) { // If there is outdoor air and outdoor air inlet node is blank, then create one diff --git a/src/EnergyPlus/RefrigeratedCase.cc b/src/EnergyPlus/RefrigeratedCase.cc index a1660d90629..06289c5e246 100644 --- a/src/EnergyPlus/RefrigeratedCase.cc +++ b/src/EnergyPlus/RefrigeratedCase.cc @@ -12589,7 +12589,6 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN int CondCreditWarnIndex5; // Used to sum up warning count int CondCreditWarnIndex6; // Used to sum up warning count int CondCreditWarnIndex7; // Used to sum up warning count - int Sysloop; // counter over number of systems attached to this condenser bool EvapAvail; // Control for evap condenser availability Real64 AirVolRatio; // Ratio of air volume needed to remove load relative to design load @@ -12650,9 +12649,9 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN // The system values will match the last time that system was solved, so some of the values may be // from the previous overall solution iteration. However, solution goes through 3 iterations if // there are any shared condensers, so that's ok. - int SystemID; // System number rejecting heat to this condenser - for (Sysloop = 1; Sysloop <= condenser.NumSysAttach; ++Sysloop) { - SystemID = condenser.SysNum(Sysloop); + for (int Sysloop = 1; Sysloop <= condenser.NumSysAttach; ++Sysloop) { + // System number rejecting heat to this condenser + int SystemID = condenser.SysNum(Sysloop); TotalCondDefCredfromSysID = System(SystemID).TotalCondDefrostCredit + System(SystemID).SumCascadeCondCredit; TotalCondDefrostCreditLocal += TotalCondDefCredfromSysID; // total heat rejection load from a single detailed system [W] diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index c215e1f5bd1..79f41d5ec22 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -53,7 +53,6 @@ #include #include #include -// #include #include #include #include @@ -65,7 +64,6 @@ #include #include #include -#include #include #include #include @@ -1066,7 +1064,6 @@ void ParseExpression(EnergyPlusData &state, std::string StringToken; char NextChar; bool PeriodFound; - bool PlusFound; bool MinusFound; bool MultFound; bool DivFound; @@ -1120,7 +1117,6 @@ void ParseExpression(EnergyPlusData &state, // Get the next token StringToken = ""; PeriodFound = false; - PlusFound = false; ErrorFlag = false; LastED = false; if (is_any_of(NextChar, "0123456789.")) { @@ -1367,7 +1363,7 @@ void ParseExpression(EnergyPlusData &state, state.dataRuntimeLangProcessor->PEToken(NumTokens).Operator = ErlFunc::Add; OperatorProcessing = true; } else { - PlusFound = true; + // PlusFound = true; OperatorProcessing = false; } } else if (StringToken == "-") { diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index 9e5ce5db671..2c5221e97a0 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -540,13 +540,7 @@ namespace WindowComplexManager { // PURPOSE OF THIS SUBROUTINE: // Performs the shading-dependent initialization of the Complex Fenestration data; - // On first call, calls the one-time initializition - - // LOGICAL,SAVE :: Once =.TRUE. !Flag for insuring things happen once - int NumStates; // Number of states for a given complex fen - int ISurf; // Index for sorting thru Surface array - int IState; // Index identifying the window state for a particular window - int IWind; // Index identifying a window in the WindowList + // On first call, calls the one-time initialization if (state.dataWindowComplexManager->NumComplexWind == 0) { return; @@ -560,10 +554,14 @@ namespace WindowComplexManager { // Initialize the geometric quantities - for (IWind = 1; IWind <= state.dataWindowComplexManager->NumComplexWind; ++IWind) { - ISurf = state.dataWindowComplexManager->WindowList(IWind).SurfNo; - NumStates = state.dataBSDFWindow->ComplexWind(ISurf).NumStates; - for (IState = 1; IState <= NumStates; ++IState) { + for (int IWind = 1; IWind <= state.dataWindowComplexManager->NumComplexWind; ++IWind) { + // Index for sorting through Surface array + const int ISurf = state.dataWindowComplexManager->WindowList(IWind).SurfNo; + + // Number of states for a given complex fen + const int NumStates = state.dataBSDFWindow->ComplexWind(ISurf).NumStates; + + for (int IState = 1; IState <= NumStates; ++IState) { CFSShadeAndBeamInitialization(state, ISurf, IState); } // State loop } // window loop @@ -749,8 +747,6 @@ namespace WindowComplexManager { int JRay; // ray index number Real64 Theta; Real64 Phi; - int JSurf; // gen purpose surface no - int BaseSurf; // base surface no int M; // general purpose index--ray int L; // general purpose index--layer int KBkSurf; // general purpose index--back surface @@ -847,8 +843,8 @@ namespace WindowComplexManager { NRegWin = 0.0; RegWinIndex.allocate(Window.NBkSurf); for (KBkSurf = 1; KBkSurf <= Window.NBkSurf; ++KBkSurf) { - BaseSurf = state.dataSurface->Surface(ISurf).BaseSurf; // ShadowComb is organized by base surface - JSurf = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(KBkSurf); + int BaseSurf = state.dataSurface->Surface(ISurf).BaseSurf; // ShadowComb is organized by base surface + int JSurf = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(KBkSurf); if (state.dataSurface->SurfWinWindowModelType(JSurf) == WindowModel::BSDF) { continue; } @@ -1669,19 +1665,17 @@ namespace WindowComplexManager { using namespace Vectors; - int IConst; // Pointer to construction for this fenestration - int I(0); // general purpose index - int J(0); // general purpose index - int JJ(0); // general purpose index--ray - int L(0); // general purpose index--layer - int M(0); // general purpose index--ray - int KBkSurf; // back surface index - int JSurf; // surface number (used for back surface) - int BaseSurf; // base surface number (used for finding back surface) - Real64 Sum1; // general purpose temporary sum - Real64 Sum2; // general purpose temporary sum - Real64 Sum3; // general purpose temporary sum - Real64 Hold; // temp variable + int IConst; // Pointer to construction for this fenestration + int I(0); // general purpose index + int J(0); // general purpose index + int JJ(0); // general purpose index--ray + int L(0); // general purpose index--layer + int M(0); // general purpose index--ray + int KBkSurf; // back surface index + Real64 Sum1; // general purpose temporary sum + Real64 Sum2; // general purpose temporary sum + Real64 Sum3; // general purpose temporary sum + Real64 Hold; // temp variable IConst = state.dataSurface->SurfaceWindow(ISurf).ComplexFen.State(IState).Konst; @@ -1913,9 +1907,12 @@ namespace WindowComplexManager { if (!allocated(State.BkSurf)) { State.BkSurf.allocate(Window.NBkSurf); } - for (KBkSurf = 1; KBkSurf <= Window.NBkSurf; ++KBkSurf) { // back surface loop - BaseSurf = state.dataSurface->Surface(ISurf).BaseSurf; // ShadowComb is organized by base surface - JSurf = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(KBkSurf); + for (KBkSurf = 1; KBkSurf <= Window.NBkSurf; ++KBkSurf) { // back surface loop + // base surface number (used for finding back surface) + int BaseSurf = state.dataSurface->Surface(ISurf).BaseSurf; // ShadowComb is organized by base surface + + // surface number (used for back surface) + int JSurf = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(KBkSurf); if (state.dataSurface->SurfWinWindowModelType(JSurf) != WindowModel::BSDF) { continue; } @@ -2704,24 +2701,23 @@ namespace WindowComplexManager { int LayPtr; // Material number for a layer int IGlass; // glass layer number (1,2,3,...) int IGap; // Gap layer number (1,2,...) - int TotGlassLay; // Total number of glass layers in a construction int k; // Layer counter int SurfNumAdj; // An interzone surface's number in the adjacent zone WinShadingType ShadeFlag; // Flag indicating whether shade or blind is on, and shade/blind position int IMix; - Real64 IncidentSolar; // Solar incident on outside of window (W) + // Real64 IncidentSolar; // Solar incident on outside of window (W) Real64 ConvHeatFlowNatural; // Convective heat flow from gap between glass and interior shade or blind (W) Real64 ShadeArea; // shade/blind area (m2) Real64 sconsh; // shade/blind conductance (W/m2-K) - Real64 CondHeatGainShade; // Conduction through shade/blind, outside to inside (W) + // Real64 CondHeatGainShade; // Conduction through shade/blind, outside to inside (W) Real64 ShGlReflFacIR; // Factor for long-wave inter-reflection between shade/blind and adjacent glass // Real64 RhoGlIR1; // Long-wave reflectance of glass surface facing shade/blind; 1=exterior shade/blind, Real64 RhoGlIR2; // 2=interior shade/blind Real64 RhoShIR1; // Long-wave reflectance of shade/blind surface facing glass; 1=interior shade/blind, - Real64 RhoShIR2; + // Real64 RhoShIR2; // 2=exterior shade/blind Real64 EpsShIR1; // Long-wave emissivity of shade/blind surface facing glass; 1=interior shade/blind, Real64 EpsShIR2; @@ -2733,7 +2729,7 @@ namespace WindowComplexManager { Real64 ConvHeatGainFrZoneSideOfShade; // Convective heat gain to zone from side of interior shade facing zone (W) Real64 ConvHeatGainFrZoneSideOfGlass; // Convective heat gain to zone from side of glass facing zone when // no interior shade/blind is present (W) - Real64 CondHeatGainGlass; // Conduction through inner glass layer, outside to inside (W) + // Real64 CondHeatGainGlass; // Conduction through inner glass layer, outside to inside (W) Real64 TotAirflowGap; // Total volumetric airflow through window gap (m3/s) Real64 TAirflowGapOutlet; // Temperature of air leaving airflow gap between glass panes (K) Real64 TAirflowGapOutletC; // Temperature of air leaving airflow gap between glass panes (C) @@ -2775,7 +2771,6 @@ namespace WindowComplexManager { ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); } - TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; ngllayer = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; nglface = 2 * ngllayer; nglfacep = nglface; @@ -3097,7 +3092,7 @@ namespace WindowComplexManager { heightt = 1.0; width = 1.0; tilt = 90.0; - // Just to make initial quess different from absolute zero + // Just to make initial guess different from absolute zero theta = 273.15; } @@ -3229,7 +3224,9 @@ namespace WindowComplexManager { } ShowContinueError(state, format("construction name = {}", state.dataConstruction->Construct(ConstrNum).Name)); ShowFatalError(state, "halting because of error in tarcog"); - } else if (CalcCondition == DataBSDFWindow::Condition::Winter) { + } + + if (CalcCondition == DataBSDFWindow::Condition::Winter) { state.dataHeatBal->NominalU(ConstrNum) = ufactor; } else if (CalcCondition == DataBSDFWindow::Condition::Summer) { // tempInt = SurfaceWindow(SurfNum)%ComplexFen%CurrentState @@ -3269,7 +3266,7 @@ namespace WindowComplexManager { SurfOutsideTemp = theta(1) - Constant::Kelvin; SurfOutsideEmiss = emis(1); - IncidentSolar = state.dataSurface->Surface(SurfNum).Area * state.dataHeatBal->SurfQRadSWOutIncident(SurfNum); + // IncidentSolar = state.dataSurface->Surface(SurfNum).Area * state.dataHeatBal->SurfQRadSWOutIncident(SurfNum); if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { // Interior shade or blind ConvHeatFlowNatural = -qv(nlayer) * height * width; @@ -3286,12 +3283,12 @@ namespace WindowComplexManager { ShadeArea = state.dataSurface->Surface(SurfNum).Area + state.dataSurface->SurfWinDividerArea(SurfNum); sconsh = scon(ngllayer + 1) / thick(ngllayer + 1); nglfacep = nglface + 2; - CondHeatGainShade = ShadeArea * sconsh * (theta(nglfacep - 1) - theta(nglfacep)); + // CondHeatGainShade = ShadeArea * sconsh * (theta(nglfacep - 1) - theta(nglfacep)); EpsShIR1 = emis(nglface + 1); EpsShIR2 = emis(nglface + 2); TauShIR = tir(nglface + 1); RhoShIR1 = max(0.0, 1.0 - TauShIR - EpsShIR1); - RhoShIR2 = max(0.0, 1.0 - TauShIR - EpsShIR2); + // RhoShIR2 = max(0.0, 1.0 - TauShIR - EpsShIR2); RhoGlIR2 = 1.0 - emis(2 * ngllayer); ShGlReflFacIR = 1.0 - RhoGlIR2 * RhoShIR1; NetIRHeatGainShade = @@ -3308,8 +3305,8 @@ namespace WindowComplexManager { state.dataSurface->SurfWinGainIRShadeToZoneRep(SurfNum) = NetIRHeatGainShade; } else { // Interior shade or blind not present; innermost layer is glass - CondHeatGainGlass = - state.dataSurface->Surface(SurfNum).Area * scon(nlayer) / thick(nlayer) * (theta(2 * nlayer - 1) - theta(2 * nlayer)); + // CondHeatGainGlass = + // state.dataSurface->Surface(SurfNum).Area * scon(nlayer) / thick(nlayer) * (theta(2 * nlayer - 1) - theta(2 * nlayer)); NetIRHeatGainGlass = state.dataSurface->Surface(SurfNum).Area * emis(2 * nlayer) * (state.dataWindowComplexManager->sigma * pow_4(theta(2 * nlayer)) - rmir); ConvHeatGainFrZoneSideOfGlass = state.dataSurface->Surface(SurfNum).Area * hcin * (theta(2 * nlayer) - tind); @@ -3509,17 +3506,14 @@ namespace WindowComplexManager { // Return value int SearchAscTable; - int Ih; // Intex for upper end of interval - int Il; // Index for lower end of interval - int Im; // Index for midpoint of interval Real64 Yh; // Table value for upper end of interval Real64 Yl; // Table value for lower end of interval Real64 Ym; // Table value for midpoint of interval Yh = ytab(n); Yl = ytab(1); - Ih = n; - Il = 1; + int Ih = n; // Index for upper end of interval + int Il = 1; // Index for lower end of interval if (y < Yl) { SearchAscTable = 1; return SearchAscTable; @@ -3532,7 +3526,8 @@ namespace WindowComplexManager { if (Ih - Il <= 1) { break; } - Im = (Ih + Il) / 2; + // Midpoint index + int Im = (Ih + Il) / 2; Ym = ytab(Im); if (y <= Ym) { Yh = Ym; From 3eea010637036e84df9f83f9edcd8c952be98d0b Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Fri, 9 Jan 2026 01:46:38 -0700 Subject: [PATCH 28/33] rest of variable scope fixes --- src/EnergyPlus/RuntimeLanguageProcessor.cc | 70 +++++++++------------ src/EnergyPlus/SolarShading.cc | 9 +-- src/EnergyPlus/SystemAvailabilityManager.cc | 6 +- src/EnergyPlus/TARCOGArgs.cc | 3 +- src/EnergyPlus/TARCOGCommon.cc | 6 +- src/EnergyPlus/TarcogShading.cc | 9 +-- src/EnergyPlus/ThermalChimney.cc | 3 +- src/EnergyPlus/ThermalComfort.cc | 9 +-- src/EnergyPlus/ThermalEN673Calc.cc | 6 +- src/EnergyPlus/ThermalISO15099Calc.cc | 30 +++------ src/EnergyPlus/TranspiredCollector.cc | 6 +- src/EnergyPlus/VariableSpeedCoils.cc | 35 +++++------ src/EnergyPlus/WaterManager.cc | 5 +- src/EnergyPlus/WaterThermalTanks.cc | 6 +- src/EnergyPlus/WaterToAirHeatPumpSimple.cc | 5 +- src/EnergyPlus/WindowComplexManager.cc | 3 +- 16 files changed, 81 insertions(+), 130 deletions(-) diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 2b55a2a0e51..037b54691d2 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -1062,7 +1062,6 @@ void ParseExpression(EnergyPlusData &state, int NumErrors; std::string::size_type Pos; std::string StringToken; - char NextChar; bool PeriodFound; bool MinusFound; bool MultFound; @@ -1098,6 +1097,7 @@ void ParseExpression(EnergyPlusData &state, MultFound = false; DivFound = false; while (Pos < LastPos) { + char NextChar; ++CountDoLooping; if (CountDoLooping > MaxDoLoopCounts) { ShowSevereError(state, format("EMS ParseExpression: Entity={}", state.dataRuntimeLang->ErlStack(StackNum).Name)); @@ -1469,7 +1469,6 @@ int ProcessTokens( int LastPos; int TokenNum; int NumTokens; - int Depth; int NumSubTokens; int NewNumTokens; int OperatorNum; @@ -1496,7 +1495,7 @@ int ProcessTokens( while ((Pos > 0) && (ParenthWhileCounter < 50)) { ++ParenthWhileCounter; - Depth = 0; + int Depth = 0; for (TokenNum = 1; TokenNum <= NumTokens; ++TokenNum) { if (Token(TokenNum).Type == Token::Parenthesis) { if (Token(TokenNum).Parenthesis == Token::ParenthesisLeft) { @@ -2749,27 +2748,8 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) constexpr std::string_view RoutineName = "GetRuntimeLanguageUserInput: "; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int GlobalNum; - int StackNum; - int ErrorNum; - int NumAlphas; // Number of elements in the alpha array - int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine - bool ErrorsFound(false); - int VariableNum(0); // temporary - int RuntimeReportVarNum; - bool Found; OutputProcessor::TimeStepType sovTimeStepType; // temporary OutputProcessor::StoreType sovStoreType; // temporary - std::string EndUseSubCatString; - int TrendNum; - int NumTrendSteps; - int loop; - int ErlVarLoop; - int CurveIndexNum; - int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs - int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs - int TotalArgs(0); // argument for call to GetObjectDefMaxArgs Array1D_string cAlphaFieldNames; Array1D_string cNumericFieldNames; @@ -2777,18 +2757,31 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) Array1D_bool lAlphaFieldBlanks; Array1D_string cAlphaArgs; Array1D rNumericArgs; - std::string cCurrentModuleObject; - int ConstructNum; - bool errFlag; std::string::size_type lbracket; - std::string UnitsA; - std::string UnitsB; Constant::Units curUnit(Constant::Units::None); std::string::size_type ptr; if (state.dataRuntimeLangProcessor->GetInput) { // GetInput check is redundant with the InitializeRuntimeLanguage routine state.dataRuntimeLangProcessor->GetInput = false; + int StackNum; + int NumAlphas; // Number of elements in the alpha array + int NumNums; // Number of elements in the numeric array + int IOStat; // IO Status when calling get input subroutine + int VariableNum(0); // temporary + int RuntimeReportVarNum; + int loop; + int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs + int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs + int TotalArgs(0); // argument for call to GetObjectDefMaxArgs + bool ErrorsFound(false); + bool Found; + bool errFlag; + + std::string cCurrentModuleObject; + std::string UnitsA; + std::string UnitsB; + cCurrentModuleObject = "EnergyManagementSystem:Sensor"; state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, TotalArgs, NumAlphas, NumNums); MaxNumNumbers = NumNums; @@ -2871,7 +2864,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables > 0) { - for (GlobalNum = 1; + for (int GlobalNum = 1; GlobalNum <= state.dataRuntimeLang->NumUserGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitImportGlobalVariables + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitExportGlobalVariables; @@ -2948,7 +2941,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } // loop over each alpha and register variable named as global Erl variable - for (ErlVarLoop = 1; ErlVarLoop <= NumAlphas; ++ErlVarLoop) { + for (int ErlVarLoop = 1; ErlVarLoop <= NumAlphas; ++ErlVarLoop) { if ((cCurrentModuleObject.compare("ExternalInterface:FunctionalMockupUnitImport:To:Variable") == 0)) { if (ErlVarLoop == 1) { // Only validate first field of object ExternalInterface:FunctionalMockupUnitImport:To:Variable. @@ -3026,7 +3019,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } } - CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name + int CurveIndexNum = GetCurveIndex(state, cAlphaArgs(2)); // curve name if (CurveIndexNum == 0) { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, format("{}{}=\"{} blank field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -3088,7 +3081,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) continue; } - ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); + int ConstructNum = Util::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); if (ConstructNum == 0) { if (lAlphaFieldBlanks(2)) { @@ -3188,7 +3181,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->NumErlTrendVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataRuntimeLang->NumErlTrendVariables > 0) { state.dataRuntimeLang->TrendVariable.allocate(state.dataRuntimeLang->NumErlTrendVariables); - for (TrendNum = 1; TrendNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendNum) { + for (int TrendNum = 1; TrendNum <= state.dataRuntimeLang->NumErlTrendVariables; ++TrendNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, TrendNum, @@ -3223,7 +3216,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) state.dataRuntimeLang->ErlVariable(VariableNum).Value.initialized = true; // Cannot figure out how to get around needing this, } - NumTrendSteps = std::floor(rNumericArgs(1)); + int NumTrendSteps = std::floor(rNumericArgs(1)); if (NumTrendSteps > 0) { state.dataRuntimeLang->TrendVariable(TrendNum).LogDepth = NumTrendSteps; // setup data arrays using NumTrendSteps @@ -3266,7 +3259,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) ShowSevereError( state, format("Errors found parsing EMS Runtime Language program or subroutine = {}", state.dataRuntimeLang->ErlStack(StackNum).Name)); - for (ErrorNum = 1; ErrorNum <= state.dataRuntimeLang->ErlStack(StackNum).NumErrors; ++ErrorNum) { + for (int ErrorNum = 1; ErrorNum <= state.dataRuntimeLang->ErlStack(StackNum).NumErrors; ++ErrorNum) { ShowContinueError(state, state.dataRuntimeLang->ErlStack(StackNum).Error(ErrorNum)); } ErrorsFound = true; @@ -3676,7 +3669,7 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state) } if (!lAlphaFieldBlanks(8)) { - EndUseSubCatString = cAlphaArgs(8); + std::string EndUseSubCatString = cAlphaArgs(8); SetupOutputVariable(state, cAlphaArgs(1), curUnit, @@ -3733,14 +3726,11 @@ void ReportRuntimeLanguage(EnergyPlusData &state) // USE STATEMENTS: // Locals - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int RuntimeReportVarNum; - int VariableNum; - for (RuntimeReportVarNum = 1; + for (int RuntimeReportVarNum = 1; RuntimeReportVarNum <= state.dataRuntimeLang->NumEMSOutputVariables + state.dataRuntimeLang->NumEMSMeteredOutputVariables; ++RuntimeReportVarNum) { - VariableNum = state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).VariableNum; + int VariableNum = state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).VariableNum; if (state.dataRuntimeLang->ErlVariable(VariableNum).Value.Type == Value::Number) { state.dataRuntimeLangProcessor->RuntimeReportVar(RuntimeReportVarNum).Value = state.dataRuntimeLang->ErlVariable(VariableNum).Value.Number; diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 131756fa837..dc4c16b9df6 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -4678,12 +4678,9 @@ void ORDER(EnergyPlusData &state, // Sequence the temporary arrays in order of decreasing slopes.(bubble sort) if (M != 1) { - int I; // Sort index - int IM1; // Sort control - int J; // Sort index - for (I = 2; I <= M; ++I) { - IM1 = I - 1; - for (J = 1; J <= IM1; ++J) { + for (int I = 2; I <= M; ++I) { + int IM1 = I - 1; + for (int J = 1; J <= IM1; ++J) { if (state.dataSolarShading->SLOPE(I) <= state.dataSolarShading->SLOPE(J)) { continue; } diff --git a/src/EnergyPlus/SystemAvailabilityManager.cc b/src/EnergyPlus/SystemAvailabilityManager.cc index 56d23646d77..9c4a9638b2b 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.cc +++ b/src/EnergyPlus/SystemAvailabilityManager.cc @@ -1602,10 +1602,8 @@ namespace Avail { if (!allocated(optimumStartMgr.ZonePtrs)) { optimumStartMgr.ZonePtrs.allocate({1, state.dataHeatBal->ZoneList(ZoneListNum).NumOfZones}); } - int ScanZoneListNum; - int ZoneNum; - for (ScanZoneListNum = 1; ScanZoneListNum <= state.dataHeatBal->ZoneList(ZoneListNum).NumOfZones; ++ScanZoneListNum) { - ZoneNum = state.dataHeatBal->ZoneList(ZoneListNum).Zone(ScanZoneListNum); + for (int ScanZoneListNum = 1; ScanZoneListNum <= state.dataHeatBal->ZoneList(ZoneListNum).NumOfZones; ++ScanZoneListNum) { + int ZoneNum = state.dataHeatBal->ZoneList(ZoneListNum).Zone(ScanZoneListNum); optimumStartMgr.ZonePtrs(ScanZoneListNum) = ZoneNum; } } diff --git a/src/EnergyPlus/TARCOGArgs.cc b/src/EnergyPlus/TARCOGArgs.cc index 994bcd40a02..130fb333b0c 100644 --- a/src/EnergyPlus/TARCOGArgs.cc +++ b/src/EnergyPlus/TARCOGArgs.cc @@ -574,7 +574,6 @@ void PrepVariablesISO15099(int const nlayer, EP_SIZE_CHECK(rir, maxlay2); EP_SIZE_CHECK(vfreevent, maxlay1); - int k1; Real64 tiltr; Real64 Rsky; Real64 Fsky; @@ -688,7 +687,7 @@ void PrepVariablesISO15099(int const nlayer, // calculate ir reflectance: for (int k = 1; k <= nlayer; ++k) { - k1 = 2 * k - 1; + int k1 = 2 * k - 1; rir(k1) = 1 - tir(k1) - emis(k1); rir(k1 + 1) = 1 - tir(k1) - emis(k1 + 1); if ((tir(k1) < 0.0) || (tir(k1) > 1.0) || (tir(k1 + 1) < 0.0) || (tir(k1 + 1) > 1.0)) { diff --git a/src/EnergyPlus/TARCOGCommon.cc b/src/EnergyPlus/TARCOGCommon.cc index ca48aad7766..6387fcef36c 100644 --- a/src/EnergyPlus/TARCOGCommon.cc +++ b/src/EnergyPlus/TARCOGCommon.cc @@ -174,7 +174,6 @@ namespace TARCOGCommon { int k; int front; int back; - int vent; for (i = 1; i <= 4 * nlayer; ++i) { b(i) = 0.0; @@ -245,7 +244,7 @@ namespace TARCOGCommon { k = 4 * i - 3; front = 2 * i - 1; back = 2 * i; - vent = i + 1; + int vent = i + 1; b(k) = 0.5 * asol(i) + 0.5 * qv(vent - 1); b(k + 3) = -0.5 * asol(i) - 0.5 * qv(vent); @@ -380,12 +379,11 @@ namespace TARCOGCommon { int i; int ii; int j; - int ll; Real64 sum; ii = 0; for (i = 1; i <= n; ++i) { - ll = indx(i); + int ll = indx(i); sum = b(ll); b(ll) = b(i); if (ii != 0) { diff --git a/src/EnergyPlus/TarcogShading.cc b/src/EnergyPlus/TarcogShading.cc index 03a824074f2..c306e47c7e2 100644 --- a/src/EnergyPlus/TarcogShading.cc +++ b/src/EnergyPlus/TarcogShading.cc @@ -195,9 +195,6 @@ namespace TarcogShading { Real64 qv1; Real64 qv2; - int i; - int j; - int k; int nmix1; int nmix2; @@ -209,8 +206,8 @@ namespace TarcogShading { // hcv = 0.0d0 // main loop: - for (i = 1; i <= nlayer; ++i) { - k = 2 * i + 1; + for (int i = 1; i <= nlayer; ++i) { + int k = 2 * i + 1; // if (LayerType(i).eq.VENETBLIND) then if (IsShadingLayer(LayerType(i))) { // dr.........set Shading device geometry @@ -225,7 +222,7 @@ namespace TarcogShading { nmix2 = nmix(i + 1); press1 = pressure(i); press2 = pressure(i + 1); - for (j = 1; j <= maxgas; ++j) { + for (int j = 1; j <= maxgas; ++j) { state.dataTarcogShading->iprop1(j) = iprop(j, i); state.dataTarcogShading->iprop2(j) = iprop(j, i + 1); state.dataTarcogShading->frct1(j) = frct(j, i); diff --git a/src/EnergyPlus/ThermalChimney.cc b/src/EnergyPlus/ThermalChimney.cc index 0384bb7d2cb..da8795ab8e6 100644 --- a/src/EnergyPlus/ThermalChimney.cc +++ b/src/EnergyPlus/ThermalChimney.cc @@ -1067,7 +1067,6 @@ namespace ThermalChimney { Real64 tempb; Real64 TCvalue; Real64 TCcoefficient; - int pivot; Real64 ThermalChimSum; int ThermChimLoop1; int ThermChimLoop2; @@ -1076,7 +1075,7 @@ namespace ThermalChimney { for (ThermChimLoop1 = 1; ThermChimLoop1 <= NTC; ++ThermChimLoop1) { TCvalue = std::abs(EquaCoef(ThermChimLoop1, ThermChimLoop1)); - pivot = ThermChimLoop1; + int pivot = ThermChimLoop1; for (ThermChimLoop2 = ThermChimLoop1 + 1; ThermChimLoop2 <= NTC; ++ThermChimLoop2) { if (std::abs(EquaCoef(ThermChimLoop1, ThermChimLoop2)) > TCvalue) { TCvalue = std::abs(EquaCoef(ThermChimLoop1, ThermChimLoop2)); diff --git a/src/EnergyPlus/ThermalComfort.cc b/src/EnergyPlus/ThermalComfort.cc index b19addb2386..abafa6f65f9 100644 --- a/src/EnergyPlus/ThermalComfort.cc +++ b/src/EnergyPlus/ThermalComfort.cc @@ -172,13 +172,12 @@ namespace ThermalComfort { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Loop; // DO loop counter - std::string CurrentGroupName; state.dataThermalComforts->ThermalComfortData.allocate(state.dataHeatBal->TotPeople); for (Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) { - CurrentGroupName = state.dataHeatBal->People(Loop).Name; + std::string CurrentGroupName = state.dataHeatBal->People(Loop).Name; // CurrentModuleObject='People' // MJW MRT ToDo: Rename most Zone Thermal Comfort output variables to People Thermal Comfort ('cause they're keyed by People name) @@ -2542,8 +2541,6 @@ namespace ThermalComfort { Real64 SensibleLoadPredictedNoAdj; Real64 deltaT; int iZone; - bool testHeating; - bool testCooling; // Get the load predicted - the sign will indicate if heating or cooling // was called for @@ -2561,8 +2558,8 @@ namespace ThermalComfort { state.dataThermalComforts->ThermalComfortSetPoint(iZone).notMetCoolingOccupied = 0.0; state.dataThermalComforts->ThermalComfortSetPoint(iZone).notMetHeatingOccupied = 0.0; - testHeating = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::SetptType::SingleCool); - testCooling = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::SetptType::SingleHeat); + bool testHeating = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::SetptType::SingleCool); + bool testCooling = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::SetptType::SingleHeat); if (testHeating && (SensibleLoadPredictedNoAdj > 0)) { // heating if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAir::RoomAirModel::Mixing) { diff --git a/src/EnergyPlus/ThermalEN673Calc.cc b/src/EnergyPlus/ThermalEN673Calc.cc index 146bca39b21..32d3413c6e7 100644 --- a/src/EnergyPlus/ThermalEN673Calc.cc +++ b/src/EnergyPlus/ThermalEN673Calc.cc @@ -563,15 +563,13 @@ namespace ThermalEN673Calc { // evaluate inward flowing fraction of absorbed radiation: if ((standard == TARCOGGassesParams::Stdrd::EN673) || (standard == TARCOGGassesParams::Stdrd::EN673Design)) { - int i; - int j; if (nlayer == 1) { fract = dir * absol(1) * (rs(1) * rs(3)) / (rs(1) * (rs(1) + rs(3))); } else { flowin = (rs(1) + 0.5 * rs(2)) / rtot; fract = dir * absol(1) * rs(10); - for (i = 2; i <= nlayer; ++i) { - j = 2 * i; + for (int i = 2; i <= nlayer; ++i) { + int j = 2 * i; flowin += (0.5 * (rs(j - 2) + 0.5 * rs(j)) + rs(j - 1)) / rtot; fract += absol(i) * flowin; } diff --git a/src/EnergyPlus/ThermalISO15099Calc.cc b/src/EnergyPlus/ThermalISO15099Calc.cc index 084ac1cff64..8a29be9411f 100644 --- a/src/EnergyPlus/ThermalISO15099Calc.cc +++ b/src/EnergyPlus/ThermalISO15099Calc.cc @@ -759,7 +759,6 @@ void Calc_ISO15099(EnergyPlusData &state, if (NeedUnshadedRun) { int NumOfIter_NOSD; int j; - int OriginalIndex; state.dataThermalISO15099Calc->nmix_NOSD(1) = nmix(1); state.dataThermalISO15099Calc->presure_NOSD(1) = presure(1); state.dataThermalISO15099Calc->nmix_NOSD(nlayer_NOSD + 1) = nmix(nlayer + 1); @@ -773,7 +772,7 @@ void Calc_ISO15099(EnergyPlusData &state, state.dataThermalISO15099Calc->frct_NOSD(j, nlayer_NOSD + 1) = frct(j, nlayer + 1); } for (i = 1; i <= nlayer_NOSD; ++i) { - OriginalIndex = FirstSpecularLayer + i - 1; + int OriginalIndex = FirstSpecularLayer + i - 1; state.dataThermalISO15099Calc->Atop_NOSD(i) = state.dataThermalISO15099Calc->Atop_eff(OriginalIndex); state.dataThermalISO15099Calc->Abot_NOSD(i) = state.dataThermalISO15099Calc->Abot_eff(OriginalIndex); state.dataThermalISO15099Calc->Al_NOSD(i) = state.dataThermalISO15099Calc->Al_eff(OriginalIndex); @@ -2024,14 +2023,13 @@ void guess(Real64 const tout, Real64 delta; int i; int j; - int k; x(1) = 0.001; x(2) = x(1) + thick(1); for (i = 2; i <= nlayer; ++i) { j = 2 * i - 1; - k = 2 * i; + int k = 2 * i; x(j) = x(j - 1) + gap(i - 1); x(k) = x(k - 1) + thick(i); } @@ -2084,8 +2082,6 @@ void solarISO15099(Real64 const totsol, Real64 const rtot, const Array1D // Locals Real64 flowin; Real64 fract; - int i; - int j; fract = 0.0; flowin = 0.0; @@ -2099,8 +2095,8 @@ void solarISO15099(Real64 const totsol, Real64 const rtot, const Array1D flowin = (rs(1) + 0.5 * rs(2)) / rtot; fract = absol(1) * flowin; - for (i = 2; i <= nlayer; ++i) { - j = 2 * i; + for (int i = 2; i <= nlayer; ++i) { + int j = 2 * i; flowin += (0.5 * (rs(j - 2) + rs(j)) + rs(j - 1)) / rtot; fract += absol(i) * flowin; } @@ -2270,8 +2266,6 @@ void hatter(EnergyPlusData &state, // wa - window azimuth (degrees, clockwise from south) // Locals - int i; - int k; int nface; // evaluate convective/conductive components of gap grashof number, thermal conductivity and their derivatives: @@ -2313,8 +2307,8 @@ void hatter(EnergyPlusData &state, // adjust radiation coefficients // hrgas = 0.0d0 - for (i = 2; i <= nlayer; ++i) { - k = 2 * i - 1; + for (int i = 2; i <= nlayer; ++i) { + int k = 2 * i - 1; // if ((theta(k)-theta(k-1)) == 0) then // theta(k-1) = theta(k-1) + tempCorrection // end if @@ -2681,16 +2675,12 @@ void filmg(EnergyPlusData &state, Real64 ra; Real64 asp; Real64 gnu; - int i; - int j; - int k; - int l; hcgas = 0.0; - for (i = 1; i <= nlayer - 1; ++i) { - j = 2 * i; - k = j + 1; + for (int i = 1; i <= nlayer - 1; ++i) { + int j = 2 * i; + int k = j + 1; // determine the gas properties of each gap: // tmean = (theta(j)+theta(k))/2.0d0 tmean = Tgap(i + 1); // Tgap(1) is exterior environment @@ -2699,7 +2689,7 @@ void filmg(EnergyPlusData &state, if (delt == 0.0) { delt = 1.0e-6; } - for (l = 1; l <= nmix(i + 1); ++l) { + for (int l = 1; l <= nmix(i + 1); ++l) { state.dataThermalISO15099Calc->ipropg(l) = iprop(l, i + 1); state.dataThermalISO15099Calc->frctg(l) = frct(l, i + 1); } diff --git a/src/EnergyPlus/TranspiredCollector.cc b/src/EnergyPlus/TranspiredCollector.cc index 63606acc9f2..3df6bb0f997 100644 --- a/src/EnergyPlus/TranspiredCollector.cc +++ b/src/EnergyPlus/TranspiredCollector.cc @@ -1053,10 +1053,8 @@ namespace TranspiredCollector { Real64 SolAbs; // solar absorptivity of collector Real64 AbsExt; // thermal emittance of collector Real64 TempExt; // collector temperature - int SurfPtr; // index of surface in main surface structure Real64 HMovInsul; // dummy for call to InitExteriorConvectionCoeff Real64 HExt; // dummy for call to InitExteriorConvectionCoeff - int ConstrNum; // index of construction in main construction structure Real64 AbsThermSurf; // thermal emittance of underlying wall. Real64 TsoK; // underlying surface temperature in Kelvin Real64 TscollK; // collector temperature in Kelvin (lagged) @@ -1176,7 +1174,7 @@ namespace TranspiredCollector { AbsExt = state.dataTranspiredCollector->UTSC(UTSCNum).LWEmitt; TempExt = state.dataTranspiredCollector->UTSC(UTSCNum).TcollLast; for (ThisSurf = 1; ThisSurf <= NumSurfs; ++ThisSurf) { - SurfPtr = state.dataTranspiredCollector->UTSC(UTSCNum).SurfPtrs(ThisSurf); + int SurfPtr = state.dataTranspiredCollector->UTSC(UTSCNum).SurfPtrs(ThisSurf); // index of surface in main surface structure // Initializations for this surface HMovInsul = 0.0; HExt = 0.0; @@ -1192,7 +1190,7 @@ namespace TranspiredCollector { HGroundARR(ThisSurf), HAirARR(ThisSurf), HSrdSurfARR(ThisSurf)); - ConstrNum = state.dataSurface->Surface(SurfPtr).Construction; + int ConstrNum = state.dataSurface->Surface(SurfPtr).Construction; // index of construction in main construction structure AbsThermSurf = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->AbsorpThermal; TsoK = state.dataHeatBalSurf->SurfOutsideTempHist(1)(SurfPtr) + Constant::Kelvin; TscollK = state.dataTranspiredCollector->UTSC(UTSCNum).TcollLast + Constant::Kelvin; diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index 679947ffc4e..f67d616ba35 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -253,11 +253,10 @@ namespace VariableSpeedCoils { auto const instances_ccVSEqFit = s_ip->epJSON.find(CurrentModuleObject); if (instances_ccVSEqFit != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_ccVSEqFit.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - + std::string cFieldName; ++DXCoilNum; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); @@ -386,8 +385,8 @@ namespace VariableSpeedCoils { } } - std::string fieldName; for (int I = 1; I <= varSpeedCoil.NumOfSpeeds; ++I) { + std::string fieldName; fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_gross_rated_total_cooling_capacity"); varSpeedCoil.MSRatedTotCap(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_gross_rated_sensible_heat_ratio"); @@ -667,11 +666,10 @@ namespace VariableSpeedCoils { CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed"; // for reporting auto const instances_ccVS = s_ip->epJSON.find(CurrentModuleObject); if (instances_ccVS != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_ccVS.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - + std::string cFieldName; ++DXCoilNum; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); @@ -933,8 +931,8 @@ namespace VariableSpeedCoils { state, eoh, cFieldName, basinHeaterOperSch, "Basin heater will be available to operate throughout the simulation."); } - std::string fieldName; for (int I = 1; I <= varSpeedCoil.NumOfSpeeds; ++I) { + std::string fieldName; fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_gross_rated_total_cooling_capacity"); varSpeedCoil.MSRatedTotCap(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_gross_rated_sensible_heat_ratio"); @@ -1136,11 +1134,10 @@ namespace VariableSpeedCoils { CurrentModuleObject = "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit"; auto const instances_hcVSEqFit = s_ip->epJSON.find(CurrentModuleObject); if (instances_hcVSEqFit != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_hcVSEqFit.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - + std::string cFieldName; ++DXCoilNum; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); @@ -1262,10 +1259,10 @@ namespace VariableSpeedCoils { } } - std::string cFieldName; - std::string fieldName; - std::string fieldValue; for (int I = 1; I <= varSpeedCoil.NumOfSpeeds; ++I) { + std::string cFieldName; + std::string fieldName; + std::string fieldValue; fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_gross_rated_heating_capacity"); varSpeedCoil.MSRatedTotCap(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_gross_rated_heating_cop"); @@ -1534,11 +1531,10 @@ namespace VariableSpeedCoils { CurrentModuleObject = "Coil:Heating:DX:VariableSpeed"; auto const instances_hcVS = s_ip->epJSON.find(CurrentModuleObject); if (instances_hcVS != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_hcVS.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - + std::string cFieldName; ++DXCoilNum; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); @@ -1747,10 +1743,10 @@ namespace VariableSpeedCoils { ShowContinueError(state, format("...{} = 0.0 for defrost strategy = RESISTIVE.", cFieldName)); } - std::string cFieldName; - std::string fieldValue; - std::string fieldName; for (int I = 1; I <= varSpeedCoil.NumOfSpeeds; ++I) { + std::string cFieldName; + std::string fieldValue; + std::string fieldName; fieldName = format("speed_{}{}", std::to_string(I), "_reference_unit_gross_rated_heating_capacity"); varSpeedCoil.MSRatedTotCap(I) = s_ip->getRealFieldValue(fields, schemaProps, fieldName); if (varSpeedCoil.MSRatedTotCap(I) < 1.e-10) { @@ -1941,11 +1937,10 @@ namespace VariableSpeedCoils { CurrentModuleObject = "Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed"; // for reporting auto const instances_whcVS = s_ip->epJSON.find(CurrentModuleObject); if (instances_whcVS != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_whcVS.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - + std::string cFieldName; ++DXCoilNum; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); @@ -2024,7 +2019,7 @@ namespace VariableSpeedCoils { } } - std::string cFieldName = "Evaporator Fan Power Included in Rated COP"; + cFieldName = "Evaporator Fan Power Included in Rated COP"; std::string fieldValue = s_ip->getAlphaFieldValue(fields, schemaProps, "evaporator_fan_power_included_in_rated_cop"); BooleanSwitch fanPowerIncluded = static_cast(getYesNoValue(Util::makeUPPER(fieldValue))); if (fanPowerIncluded != BooleanSwitch::Invalid) { @@ -2198,8 +2193,8 @@ namespace VariableSpeedCoils { } } - std::string jfieldName; for (int I = 1; I <= varSpeedCoil.NumOfSpeeds; ++I) { + std::string jfieldName; jfieldName = format("speed_{}{}", std::to_string(I), "_rated_water_heating_capacity"); varSpeedCoil.MSRatedTotCap(I) = s_ip->getRealFieldValue(fields, schemaProps, jfieldName); jfieldName = format("speed_{}{}", std::to_string(I), "_rated_water_heating_cop"); diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index 64a54f5edf4..7e6651c2e69 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -210,10 +210,8 @@ namespace WaterManager { int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs int TotalArgs(0); // argument for call to GetObjectDefMaxArgs - int alphaOffset(0); std::string objNameMsg; int NumIrrigation; - int Dummy; // initialize rainfall model state.dataWaterData->RainFall.ModeID = RainfallMode::None; @@ -476,7 +474,7 @@ namespace WaterManager { } // number of surfaces is extensible and = NumAlphas - alphaOffset - alphaOffset = 4; // update this if more alphas inserted ahead of extensible surface listing + int alphaOffset = 4; // update this if more alphas inserted ahead of extensible surface listing state.dataWaterData->RainCollector(Item).NumCollectSurfs = NumAlphas - alphaOffset; state.dataWaterData->RainCollector(Item).SurfName.allocate(state.dataWaterData->RainCollector(Item).NumCollectSurfs); state.dataWaterData->RainCollector(Item).SurfID.allocate(state.dataWaterData->RainCollector(Item).NumCollectSurfs); @@ -606,6 +604,7 @@ namespace WaterManager { // setup tanks whose level is controlled by supply from another tank if ((state.dataWaterData->WaterStorage(Item).ControlSupply == ControlSupplyType::OtherTankFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupply == ControlSupplyType::TankMainsBackup)) { + int Dummy; state.dataWaterData->WaterStorage(Item).SupplyTankID = Util::FindItemInList(state.dataWaterData->WaterStorage(Item).SupplyTankName, state.dataWaterData->WaterStorage); if (state.dataWaterData->WaterStorage(Item).SupplyTankID == 0) { diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 42ae377ac0e..c1918a411e3 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1148,8 +1148,6 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) int const NumPumpedCondenser = state.dataInputProcessing->inputProcessor->getNumObjectsFound( state, cHPWHPumpedCondenser); // number of WaterHeater:HeatPump:PumpedCondenser objects - int nAlphaOffset; // the difference of array location between alpha items between pumped and wrapped condensers - int nNumericOffset; // the difference of array location between numeric items between pumped and wrapped condensers int nNumPossibleNumericArgs; // the number of possible numeric arguments in the idd int nNumPossibleAlphaArgs; // the number of possible numeric arguments in the idd @@ -1162,8 +1160,8 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) HeatPumpWaterHeaterData &HPWH = state.dataWaterThermalTanks->HPWaterHeater(HPWaterHeaterNum); // Initialize the offsets to zero - nAlphaOffset = 0; - nNumericOffset = 0; + int nAlphaOffset = 0; // the difference of array location between alpha items between pumped and wrapped condensers + int nNumericOffset = 0; // the difference of array location between numeric items between pumped and wrapped condensers DataLoopNode::ConnectionObjectType objType; diff --git a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc index d8d2c1c1bcf..4600119a5ca 100644 --- a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc +++ b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc @@ -248,10 +248,10 @@ namespace WaterToAirHeatPumpSimple { int HPNum = 0; if (instances != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { + std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); @@ -485,11 +485,10 @@ namespace WaterToAirHeatPumpSimple { auto const instances_heat = s_ip->epJSON.find(CurrentModuleObject); if (instances_heat != s_ip->epJSON.end()) { - std::string cFieldName; auto const &schemaProps = s_ip->getObjectSchemaProps(state, CurrentModuleObject); auto &instancesValue = instances_heat.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - + std::string cFieldName; auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); s_ip->markObjectAsUsed(CurrentModuleObject, thisObjectName); diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index 0fb5259a449..9fe842a3ede 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -2698,7 +2698,6 @@ namespace WindowComplexManager { int TotLay; // Total number of layers in a construction // (sum of solid layers and gap layers) int Lay; // Layer number - int LayPtr; // Material number for a layer int IGlass; // glass layer number (1,2,3,...) int IGap; // Gap layer number (1,2,...) int k; // Layer counter @@ -2907,7 +2906,7 @@ namespace WindowComplexManager { IGlass = 0; IGap = 0; for (Lay = 1; Lay <= TotLay; ++Lay) { - LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); + int LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); // Material number for a layer auto const *mat = s_mat->materials(LayPtr); if ((mat->group == Material::Group::Glass) || (mat->group == Material::Group::GlassSimple)) { From ead059711b7a503ad0080979e8d95a9f6d16f83d Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Fri, 9 Jan 2026 07:52:34 -0700 Subject: [PATCH 29/33] fix build errors, a few more last cleanups --- src/EnergyPlus/SolarShading.cc | 2 +- src/EnergyPlus/TarcogShading.cc | 2 +- src/EnergyPlus/ThermalISO15099Calc.cc | 35 ++++++++------------------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index dc4c16b9df6..6ae5c7fe76e 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -6402,9 +6402,9 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, if (!UseSimpleDistribution) { // Compute overlaps +#ifndef EP_NO_OPENGL std::unordered_map pssas; -#ifndef EP_NO_OPENGL if (state.dataSolarShading->penumbra) { // Add back surfaces to array std::vector pbBackSurfaces; diff --git a/src/EnergyPlus/TarcogShading.cc b/src/EnergyPlus/TarcogShading.cc index c306e47c7e2..f4bf8b9c52c 100644 --- a/src/EnergyPlus/TarcogShading.cc +++ b/src/EnergyPlus/TarcogShading.cc @@ -207,7 +207,7 @@ namespace TarcogShading { // main loop: for (int i = 1; i <= nlayer; ++i) { - int k = 2 * i + 1; + // int k = 2 * i + 1; // if (LayerType(i).eq.VENETBLIND) then if (IsShadingLayer(LayerType(i))) { // dr.........set Shading device geometry diff --git a/src/EnergyPlus/ThermalISO15099Calc.cc b/src/EnergyPlus/ThermalISO15099Calc.cc index 8a29be9411f..6276e21514e 100644 --- a/src/EnergyPlus/ThermalISO15099Calc.cc +++ b/src/EnergyPlus/ThermalISO15099Calc.cc @@ -345,7 +345,6 @@ void Calc_ISO15099(EnergyPlusData &state, Real64 hflux_NOSD; Real64 shgc_NOSD; Real64 hout_NOSD; - // REAL(r64) :: rs_NOSD(maxlay3)!,sol(maxlay) Real64 ShadeEmisRatioOut_NOSD; Real64 ShadeEmisRatioIn_NOSD; Real64 ShadeHcRatioOut_NOSD; @@ -359,7 +358,6 @@ void Calc_ISO15099(EnergyPlusData &state, Real64 houtt; Real64 ebsky; Real64 ebroom; - int i; // Autodesk:Uninit Initialize variables used uninitialized shgc_NOSD = 0.0; // Autodesk:Uninit Force default initialization @@ -572,7 +570,7 @@ void Calc_ISO15099(EnergyPlusData &state, // exit on error: if (nlayer > 1) { - for (i = 1; i <= nlayer - 1; ++i) { + for (int i = 1; i <= nlayer - 1; ++i) { Keff(i) = gap(i) * q(2 * i + 1) / (theta(2 * i + 1) - theta(2 * i)); if (IsShadingLayer(LayerType(i))) { Keff(i) = gap(i) * q(2 * i + 1) / (theta(2 * i + 1) - theta(2 * i)); @@ -601,7 +599,7 @@ void Calc_ISO15099(EnergyPlusData &state, state.dataThermalISO15099Calc->houts = hout; state.dataThermalISO15099Calc->ufactors = ufactor; state.dataThermalISO15099Calc->fluxs = flux; - for (i = 1; i <= nlayer; ++i) { + for (int i = 1; i <= nlayer; ++i) { state.dataThermalISO15099Calc->thetas(2 * i - 1) = theta(2 * i - 1); state.dataThermalISO15099Calc->thetas(2 * i) = theta(2 * i); state.dataThermalISO15099Calc->Ebbs(i) = state.dataThermalISO15099Calc->Ebb(i); @@ -738,7 +736,6 @@ void Calc_ISO15099(EnergyPlusData &state, bool NeedUnshadedRun = false; int FirstSpecularLayer = 1; - int LastSpecularLayer = nlayer; int nlayer_NOSD = nlayer; if (IsShadingLayer(LayerType(1))) { --nlayer_NOSD; @@ -746,10 +743,8 @@ void Calc_ISO15099(EnergyPlusData &state, NeedUnshadedRun = true; } - // if (LayerType(nlayer).eq.VENETBLIND) then if (IsShadingLayer(LayerType(nlayer))) { --nlayer_NOSD; - LastSpecularLayer = nlayer - 1; NeedUnshadedRun = true; } @@ -758,20 +753,19 @@ void Calc_ISO15099(EnergyPlusData &state, // bi...Set outdoor & indoor gas properties: if (NeedUnshadedRun) { int NumOfIter_NOSD; - int j; state.dataThermalISO15099Calc->nmix_NOSD(1) = nmix(1); state.dataThermalISO15099Calc->presure_NOSD(1) = presure(1); state.dataThermalISO15099Calc->nmix_NOSD(nlayer_NOSD + 1) = nmix(nlayer + 1); state.dataThermalISO15099Calc->presure_NOSD(nlayer_NOSD + 1) = presure(nlayer + 1); - for (j = 1; j <= nmix(1); ++j) { + for (int j = 1; j <= nmix(1); ++j) { state.dataThermalISO15099Calc->iprop_NOSD(j, 1) = iprop(j, 1); state.dataThermalISO15099Calc->frct_NOSD(j, 1) = frct(j, 1); } - for (j = 1; j <= nmix(nlayer_NOSD + 1); ++j) { + for (int j = 1; j <= nmix(nlayer_NOSD + 1); ++j) { state.dataThermalISO15099Calc->iprop_NOSD(j, nlayer_NOSD + 1) = iprop(j, nlayer + 1); state.dataThermalISO15099Calc->frct_NOSD(j, nlayer_NOSD + 1) = frct(j, nlayer + 1); } - for (i = 1; i <= nlayer_NOSD; ++i) { + for (int i = 1; i <= nlayer_NOSD; ++i) { int OriginalIndex = FirstSpecularLayer + i - 1; state.dataThermalISO15099Calc->Atop_NOSD(i) = state.dataThermalISO15099Calc->Atop_eff(OriginalIndex); state.dataThermalISO15099Calc->Abot_NOSD(i) = state.dataThermalISO15099Calc->Abot_eff(OriginalIndex); @@ -805,7 +799,7 @@ void Calc_ISO15099(EnergyPlusData &state, if (i < nlayer_NOSD) { state.dataThermalISO15099Calc->nmix_NOSD(i + 1) = nmix(OriginalIndex + 1); state.dataThermalISO15099Calc->presure_NOSD(i + 1) = presure(OriginalIndex + 1); - for (j = 1; j <= state.dataThermalISO15099Calc->nmix_NOSD(i + 1); ++j) { + for (int j = 1; j <= state.dataThermalISO15099Calc->nmix_NOSD(i + 1); ++j) { state.dataThermalISO15099Calc->iprop_NOSD(j, i + 1) = iprop(j, OriginalIndex + 1); state.dataThermalISO15099Calc->frct_NOSD(j, i + 1) = frct(j, OriginalIndex + 1); } @@ -1049,7 +1043,7 @@ void Calc_ISO15099(EnergyPlusData &state, // bi Set T6-related quantities keff, keffc: (using non-solar pass results) if (nlayer > 1) { - for (i = 1; i <= nlayer - 1; ++i) { + for (int i = 1; i <= nlayer - 1; ++i) { Keff(i) = gap(i) * q(2 * i + 1) / (theta(2 * i + 1) - theta(2 * i)); if (IsShadingLayer(LayerType(i))) { Keff(i) = gap(i) * q(2 * i + 1) / (theta(2 * i + 1) - theta(2 * i)); @@ -1086,7 +1080,7 @@ void Calc_ISO15099(EnergyPlusData &state, hrout = state.dataThermalISO15099Calc->hrouts; hout = state.dataThermalISO15099Calc->houts; flux = state.dataThermalISO15099Calc->fluxs; // <--- ??? - for (i = 1; i <= nlayer; ++i) { + for (int i = 1; i <= nlayer; ++i) { theta(2 * i - 1) = state.dataThermalISO15099Calc->thetas(2 * i - 1); theta(2 * i) = state.dataThermalISO15099Calc->thetas(2 * i); state.dataThermalISO15099Calc->Ebb(i) = state.dataThermalISO15099Calc->Ebbs(i); @@ -1319,9 +1313,7 @@ void therm1d(EnergyPlusData &state, Array2D a(4 * nlayer, 4 * nlayer); Array1D b(4 * nlayer); - // REAL(r64) :: hhatv(maxlay3),hcv(maxlay3), Ebgap(maxlay3), Tgap(maxlay1) - // REAL(r64) :: alpha int maxiter; Real64 qr_gap_out; @@ -1332,7 +1324,6 @@ void therm1d(EnergyPlusData &state, // Simon: parameters used in case of JCFN iteration method Array1D FRes({1, 4 * nlayer}); // store function results from current iteration Array1D FResOld({1, 4 * nlayer}); // store function results from previous iteration - Array1D FResDiff({1, 4 * nlayer}); // save difference in results between iterations Array1D Radiation({1, 2 * nlayer}); // radiation on layer surfaces. used as temporary storage during iterations Array1D x({1, 4 * nlayer}); // temporary vector for storing results (theta and Radiation). used for easier handling @@ -1346,19 +1337,16 @@ void therm1d(EnergyPlusData &state, Array1D RightHandSide({1, 4 * nlayer}); // Simon: Keep best achieved convergence - Real64 prevDifference; Real64 Relaxation; Array1D RadiationSave({1, 2 * nlayer}); Array1D thetaSave({1, 2 * nlayer}); int currentTry; - int CSMFlag; int i; int j; int k; Real64 curDifference; int index; - int curTempCorrection; Real64 qc_gap_in; Real64 hc_modified_in; @@ -1376,9 +1364,7 @@ void therm1d(EnergyPlusData &state, // Simon: This is set to zero until it is resolved what to do with modifier ShadeHcModifiedOut = 0.0; - CSMFlag = 0; CalcOutcome = CalculationOutcome::Invalid; - curTempCorrection = 0; AchievedErrorTolerance = 0.0; curDifference = 0.0; currentTry = 0; @@ -1395,7 +1381,6 @@ void therm1d(EnergyPlusData &state, FRes = 0.0; FResOld = 0.0; - FResDiff = 0.0; Radiation = 0.0; Relaxation = RelaxationStart; @@ -1671,7 +1656,7 @@ void therm1d(EnergyPlusData &state, CalculateFuncResults(nlayer, a, b, x, FRes); - FResDiff = FRes - FResOld; + // FResDiff = FRes - FResOld; LeftHandSide = a; RightHandSide = b; @@ -1771,7 +1756,7 @@ void therm1d(EnergyPlusData &state, return; } - prevDifference = curDifference; + // prevDifference = curDifference; if ((index == 0) || (curDifference < AchievedErrorTolerance)) { AchievedErrorTolerance = curDifference; From ece10e4477991aa00bd69fe21d91f8be01682b2b Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 13 Jan 2026 18:09:27 -0700 Subject: [PATCH 30/33] suppress other warnings for now --- .github/workflows/test_code_integrity.yml | 28 ++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_code_integrity.yml b/.github/workflows/test_code_integrity.yml index 0d78b42ee57..2b491e30bcf 100644 --- a/.github/workflows/test_code_integrity.yml +++ b/.github/workflows/test_code_integrity.yml @@ -215,9 +215,35 @@ jobs: --enable=all -j $(nproc) --template='[{file}:{line}]:({severity}),[{id}],{message}' - --suppress="uninitvar:*" + --suppress="uninitvar:*" \ + --suppress="arrayIndexThenCheck:*" \ + --suppress="checkLevelNormal:*" \ + --suppress="constParameterPointer:*" \ --suppress="constParameterReference:*" \ + --suppress="constVariable:*" \ + --suppress="constVariablePointer:*" \ --suppress="constVariableReference:*" \ + --suppress="cstyleCast:*" \ + --suppress="duplicateCondition:*" \ + --suppress="duplicateExpression:*" \ + --suppress="knownConditionTrueFalse:*" \ + --suppress="multiCondition:*" \ + --suppress="noExplicitConstructor:*" \ + --suppress="passedByValueCallback:*" \ + --suppress="redundantAssignment:*" \ + --suppress="redundantCondition:*" \ + --suppress="redundantInitialization:*" \ + --suppress="sameIteratorExpression:*" \ + --suppress="shadowFunction:*" \ + --suppress="shadowVariable:*" \ + --suppress="unassignedVariable:*" \ + --suppress="unmatchedSuppression:*" \ + --suppress="unpreciseMathCall:*" \ + --suppress="unreadVariable:*" \ + --suppress="useInitializationList:*" \ + --suppress="useStlAlgorithm:*" \ + --suppress="uselessAssignmentArg:*" \ + --suppress="uselessCallsSubstr:*" \ ./src 3>&1 1>&2 2>&3 | tee cppcheck.txt From b773b2c2e9242886a6f1630f38941f1120d79187 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 13 Jan 2026 18:32:27 -0700 Subject: [PATCH 31/33] final touchups --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 3 +-- src/EnergyPlus/RefrigeratedCase.cc | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index b0a1bcf8c80..127daa31505 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -12359,8 +12359,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c this->CrankCaseHeaterPower = this->CCHeaterPower * (1.0 - VRFRTF); if (this->NumCompressors > 1) { UpperStageCompressorRatio = (1.0 - this->CompressorSizeRatio) / (this->NumCompressors - 1); - int Stage; // used for crankcase heater power calculation - for (Stage = 1; Stage <= this->NumCompressors - 2; ++Stage) { + for (int Stage = 1; Stage <= this->NumCompressors - 2; ++Stage) { if (this->VRFCondPLR < (this->CompressorSizeRatio + Stage * UpperStageCompressorRatio)) { this->CrankCaseHeaterPower += this->CCHeaterPower; } diff --git a/src/EnergyPlus/RefrigeratedCase.cc b/src/EnergyPlus/RefrigeratedCase.cc index cf9db67715c..ffb18723933 100644 --- a/src/EnergyPlus/RefrigeratedCase.cc +++ b/src/EnergyPlus/RefrigeratedCase.cc @@ -374,9 +374,8 @@ void ManageRefrigeratedCaseRacks(EnergyPlusData &state) if (state.dataRefrigCase->HaveRefrigRacks) { for (int RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) { - auto &RefrigRack = state.dataRefrigCase->RefrigRack; - RefrigRack(RackNum).CalcRackSystem(state); - RefrigRack(RackNum).ReportRackSystem(state, RackNum); + state.dataRefrigCase->RefrigRack(RackNum).CalcRackSystem(state); + state.dataRefrigCase->RefrigRack(RackNum).ReportRackSystem(state, RackNum); } } From 377391cdbfd55a9c6aad55e24f2bd3d6596de9ba Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 20 Jan 2026 17:20:20 -0700 Subject: [PATCH 32/33] fix diffs --- src/EnergyPlus/DaylightingManager.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 75ac5804db3..1521bef129e 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -5171,9 +5171,7 @@ Real64 DayltgGlare(EnergyPlusData &state, // REFERENCES: // Based on DOE-2.1E subroutine DGLARE. - // Glare constant - // set tiny to avoid log(0) below - Real64 GTOT = 1e-12; + Real64 GTOT = 0.0; // Glare constant auto &dl = state.dataDayltg; @@ -5192,8 +5190,8 @@ Real64 DayltgGlare(EnergyPlusData &state, GTOT += GTOT1 / (GTOT2 + 0.000001); } - // Glare index - return max(0.0, 10.0 * std::log10(GTOT)); + // Glare index (adding 0.000001 prevents LOG10 (0)) + return max(0.0, 10.0 * std::log10(GTOT + 0.000001)); } void DayltgGlareWithIntWins(EnergyPlusData &state, From f539a4e5877c5ebb07f66b803e639f7a0857fbea Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 20 Jan 2026 17:54:44 -0700 Subject: [PATCH 33/33] fix diffs --- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 31374ac2606..f60aeb20c13 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -3271,7 +3271,7 @@ void InitSolarHeatGains(EnergyPlusData &state) Real64 ACosTlt = std::abs(Surface(SurfNum).CosTilt); // Absolute value of cosine of surface tilt angle int slatIdxLo = surfShade.blind.slatAngIdxLo; - int slatIdxHi = surfShade.blind.slatAngIdxHi; + int slatIdxHi = surfShade.blind.slatAngIdxLo; Real64 interpFac = surfShade.blind.slatAngInterpFac; auto const &dfAbsSlatLo = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxLo]; auto const &dfAbsSlatHi = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxHi];