From 67ea60150b918b1ccb1fd15025c80ee9e7d659c8 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 21:42:57 -0400 Subject: [PATCH 001/108] Reduce scope --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 070dd4939fe..3d883fc1adc 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -14865,8 +14865,6 @@ void VRFCondenserEquipment::VRFOU_PipeLossC( using General::SolveRoot; int TUListNum; // index to TU List - int TUIndex; // Index to terminal unit - int CoilIndex; // index to coil in terminal unit int NumTUInList; // number of terminal units is list int NumIUActivated; // number of the used indoor units [-] @@ -14904,8 +14902,8 @@ void VRFCondenserEquipment::VRFOU_PipeLossC( Pipe_T_room = 0; NumIUActivated = 0; for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + int CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; if (state.dataDXCoils->DXCoil(CoilIndex).TotalCoolingEnergyRate > 0.0) { Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp; @@ -14994,8 +14992,6 @@ void VRFCondenserEquipment::VRFOU_PipeLossH( using General::SolveRoot; int TUListNum; // index to TU List - int TUIndex; // Index to terminal unit - int CoilIndex; // index to coil in terminal unit int NumTUInList; // number of terminal units is list int NumIUActivated; // number of the used indoor units [-] @@ -15045,8 +15041,8 @@ void VRFCondenserEquipment::VRFOU_PipeLossH( Pipe_T_room = 0; NumIUActivated = 0; for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; + int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + int CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; if (state.dataDXCoils->DXCoil(CoilIndex).TotalHeatingEnergyRate > 0.0) { Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp; @@ -15120,7 +15116,6 @@ void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state, Real64 constexpr Acc(1.e-3); // Accuracy of solver result // local variable declaration: - int SolFla; // Flag of solver, num iterations if >0, else error index Real64 SuppHeatCoilLoad; // load passed to supplemental heating coil (W) Real64 QActual; // actual coil output (W) Real64 PartLoadFrac; // temporary PLR variable @@ -15152,6 +15147,7 @@ void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state, WaterCoils::SimulateWaterCoilComponents( state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, QActual, this->fanOp, PartLoadRatio); if (QActual > SuppHeatCoilLoad) { + int SolFla; // Flag of solver, num iterations if >0, else error index auto f = [&state, VRFTUNum, FirstHVACIteration, SuppHeatCoilLoad](Real64 const PartLoadFrac) { Real64 QActual = 0.0; // actual heating load delivered [W] Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac; From c67cb127bbab8e124c5edb3394dc45cadb926fc9 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 21:43:19 -0400 Subject: [PATCH 002/108] Shadow variable --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 3d883fc1adc..ddce1d08d8d 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -14655,7 +14655,6 @@ void VRFCondenserEquipment::VRFHR_OU_HR_Mode(EnergyPlusData &state, Real64 Ncomp_new; Real64 Q_c_tot_temp; Real64 Q_c_OU_temp; - Real64 Tsuction_new; Real64 Tsuction_LB = state.dataEnvrn->OutDryBulbTemp - this->DiffOUTeTo; Real64 Tsuction_HB = Tsuction; From fafe1e7979de5559189bad2b04842b755833f4c2 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 21:45:09 -0400 Subject: [PATCH 003/108] Unused var --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index ddce1d08d8d..a1b8b3b6c0d 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -13810,7 +13810,6 @@ void VRFCondenserEquipment::VRFOU_CompCap( int CompSpdLB; // index for Compressor speed low bound [-] int CompSpdUB; // index for Compressor speed up bound [-] int NumOfCompSpdInput; // Number of compressor speed input by the user [-] - int NumTUInList; // number of terminal units is list int TUListNum; // index to TU List Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-] Real64 P_suction; // Compressor suction pressure Pe' [Pa] @@ -13826,7 +13825,6 @@ void VRFCondenserEquipment::VRFOU_CompCap( // variable initializations: component index TUListNum = this->ZoneTUListPtr; - NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; RefPLow = this->refrig->PsLowPresValue; RefPHigh = this->refrig->PsHighPresValue; From 2e63ecffa3a8f8a5a70dc331f76f101e31abc235 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 22:11:19 -0400 Subject: [PATCH 004/108] Unused and const --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index a1b8b3b6c0d..5e9c347aa97 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -4346,7 +4346,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) vrfTU.DesignSpecMultispeedHPType = cAlphaArgs(20); vrfTU.DesignSpecMultispeedHPName = cAlphaArgs(21); vrfTU.DesignSpecMSHPIndex = UnitarySystems::getDesignSpecMSHPIndex(state, cAlphaArgs(21)); - auto &designSpecFan = state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex]; + auto const &designSpecFan = state.dataUnitarySystems->designSpecMSHP[vrfTU.DesignSpecMSHPIndex]; if (vrfTU.DXCoolCoilType_Num == HVAC::CoilVRF_Cooling) { int NumSpeeds = designSpecFan.numOfSpeedCooling; vrfTU.NumOfSpeedCooling = NumSpeeds; @@ -5256,7 +5256,7 @@ void CheckVRFTUNodeConnections(EnergyPlusData &state, int const VRFTUNum, bool & { constexpr static std::string_view cTerminalUnitType("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow"); - auto &nodeID = state.dataLoopNodes->NodeID; + auto const &nodeID = state.dataLoopNodes->NodeID; auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); std::string const cTUName(vrfTU.Name); bool const CoolingCoilPresent = vrfTU.CoolingCoilPresent; @@ -9153,7 +9153,7 @@ void VRFTerminalUnitEquipment::ControlVRFToLoad(EnergyPlusData &state, // set supplemental heating coil calculation if the condition requires if (this->SuppHeatingCoilPresent) { if (this->isSetPointControlled) { - auto &thisSuppHeatCoilAirInletNode = state.dataLoopNodes->Node(this->SuppHeatCoilAirInletNode); + auto const &thisSuppHeatCoilAirInletNode = state.dataLoopNodes->Node(this->SuppHeatCoilAirInletNode); if (this->suppTempSetPoint > thisSuppHeatCoilAirInletNode.Temp) { Real64 mDot = thisSuppHeatCoilAirInletNode.MassFlowRate; Real64 Tin = thisSuppHeatCoilAirInletNode.Temp; @@ -10187,7 +10187,7 @@ void InitializeOperatingMode(EnergyPlusData &state, if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::ThermostatOffsetPriority) { // for TSTATPriority, just check difference between zone temp and thermostat setpoint if (ThisZoneNum > 0) { - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ThisZoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ThisZoneNum); SPTempHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ThisZoneNum); SPTempLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ThisZoneNum); @@ -10844,7 +10844,7 @@ void getVRFTUZoneLoad( bool getVRFTUNodeNumber(EnergyPlusData &state, int const nodeNumber) { for (int vrfTUIndex = 1; vrfTUIndex <= state.dataHVACVarRefFlow->NumVRFTU; ++vrfTUIndex) { - auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(vrfTUIndex); + auto const &vrfTU = state.dataHVACVarRefFlow->VRFTU(vrfTUIndex); bool noVrfTUOutdoorAir = false; if (vrfTU.CoolOutAirVolFlow == 0 && vrfTU.HeatOutAirVolFlow == 0 && vrfTU.NoCoolHeatOutAirVolFlow == 0) { @@ -12493,18 +12493,18 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, if (!DXCoolingCoilOprCtrl) PartLoadRatio = 0.0; this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); if (this->CoolingCoilPresent) { - auto &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->CoolCoilIndex).AirInNode); + auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->CoolCoilIndex).AirInNode); this->coilInNodeT = thisAirInNode.Temp; this->coilInNodeW = thisAirInNode.HumRat; } else { - auto &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->HeatCoilIndex).AirInNode); + auto const &thisAirInNode = state.dataLoopNodes->Node(state.dataDXCoils->DXCoil(this->HeatCoilIndex).AirInNode); this->coilInNodeT = thisAirInNode.Temp; this->coilInNodeW = thisAirInNode.HumRat; } // set supplemental heating coil calculation if the condition requires if (this->SuppHeatingCoilPresent) { - auto &thisSuppHeatCoilAirInletNode = state.dataLoopNodes->Node(this->SuppHeatCoilAirInletNode); + auto const &thisSuppHeatCoilAirInletNode = state.dataLoopNodes->Node(this->SuppHeatCoilAirInletNode); if (((QZnReq > HVAC::SmallLoad && QZnReq > FullOutput) || (((QZnReq - NoCompOutput) > HVAC::SmallLoad) && QZnReq <= 0.0)) || (this->isSetPointControlled && this->suppTempSetPoint > thisSuppHeatCoilAirInletNode.Temp)) { Real64 ZoneLoad = 0.0; @@ -13004,7 +13004,6 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & using SingleDuct::SimATMixer; int constexpr Mode(1); // Performance mode for MultiMode DX coil. Always 1 for other coil types - int OAMixNode; // index to the mix node of OA mixer int VRFCond; // index to VRF condenser int VRFInletNode; // VRF inlet node number Real64 FanSpdRatioBase; // baseline FanSpdRatio for VRFTUAirFlowResidual @@ -13038,7 +13037,7 @@ Real64 VRFTerminalUnitEquipment::CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData & if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { MixedAir::SimOAMixer( state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); - OAMixNode = state.dataMixedAir->OAMixer(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex).MixNode; + int OAMixNode = state.dataMixedAir->OAMixer(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex).MixNode; Tin = state.dataLoopNodes->Node(OAMixNode).Temp; Win = state.dataLoopNodes->Node(OAMixNode).HumRat; } @@ -13668,7 +13667,6 @@ void VRFCondenserEquipment::VRFOU_CompSpd( int CompSpdLB; // index for Compressor speed low bound [-] int CompSpdUB; // index for Compressor speed up bound [-] int NumOfCompSpdInput; // Number of compressor speed input by the user [-] - int NumTUInList; // number of terminal units is list int TUListNum; // index to TU List Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-] Real64 P_suction; // Compressor suction pressure Pe' [Pa] @@ -13685,7 +13683,6 @@ void VRFCondenserEquipment::VRFOU_CompSpd( // variable initializations: component index TUListNum = this->ZoneTUListPtr; - NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; RefPLow = this->refrig->PsLowPresValue; RefPHigh = this->refrig->PsHighPresValue; From d0d4b8522acd97ddf947528f15d56bb3ca0f5df0 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 22:16:59 -0400 Subject: [PATCH 005/108] Unused and reduce scope --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 5e9c347aa97..2ce473122d1 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -12421,10 +12421,8 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, Real64 FullOutput; // unit full output when compressor is operating [W] Real64 TempOutput; // unit output when iteration limit exceeded [W] Real64 NoCompOutput; // output when no active compressor [W] - int SolFla; // Flag of RegulaFalsi solver Real64 TempMinPLR; // min PLR used in Regula Falsi call Real64 TempMaxPLR; // max PLR used in Regula Falsi call - bool ContinueIter; // used when convergence is an issue int VRFCond; // index to VRF condenser int IndexToTUInTUList; // index to TU in specific list for the VRF system int TUListIndex; // index to TU list for this VRF system @@ -12607,6 +12605,7 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, // The coil will not operate at PLR=0 or PLR=1, calculate the operating part-load ratio if ((VRFHeatingMode || HRHeatingMode) || ((VRFCoolingMode && DXCoolingCoilOprCtrl) || HRCoolingMode)) { + int SolFla; // Flag of RegulaFalsi solver auto f = [&state, VRFTUNum, FirstHVACIteration, QZnReq, OnOffAirFlowRatio](Real64 const PartLoadRatio) { Real64 QZnReqTemp = QZnReq; // denominator representing zone load (W) Real64 ActualOutput; // delivered capacity of VRF terminal unit @@ -12636,7 +12635,7 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, if (SolFla == -1) { // Very low loads may not converge quickly. Tighten PLR boundary and try again. TempMaxPLR = -0.1; - ContinueIter = true; + bool ContinueIter = true; while (ContinueIter && TempMaxPLR < 1.0) { TempMaxPLR += 0.1; @@ -13667,7 +13666,6 @@ void VRFCondenserEquipment::VRFOU_CompSpd( int CompSpdLB; // index for Compressor speed low bound [-] int CompSpdUB; // index for Compressor speed up bound [-] int NumOfCompSpdInput; // Number of compressor speed input by the user [-] - int TUListNum; // index to TU List Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-] Real64 P_suction; // Compressor suction pressure Pe' [Pa] Real64 Q_evap_req; // Required evaporative capacity [W] @@ -13682,7 +13680,6 @@ void VRFCondenserEquipment::VRFOU_CompSpd( static constexpr std::string_view RoutineName("VRFOU_CompSpd"); // variable initializations: component index - TUListNum = this->ZoneTUListPtr; RefPLow = this->refrig->PsLowPresValue; RefPHigh = this->refrig->PsHighPresValue; @@ -13807,7 +13804,6 @@ void VRFCondenserEquipment::VRFOU_CompCap( int CompSpdLB; // index for Compressor speed low bound [-] int CompSpdUB; // index for Compressor speed up bound [-] int NumOfCompSpdInput; // Number of compressor speed input by the user [-] - int TUListNum; // index to TU List Real64 C_cap_operation; // Compressor capacity modification algorithm_modified Cap [-] Real64 P_suction; // Compressor suction pressure Pe' [Pa] Real64 Q_evap_sys; // evaporative capacity [W] @@ -13821,7 +13817,6 @@ void VRFCondenserEquipment::VRFOU_CompCap( static constexpr std::string_view RoutineName("VRFOU_CompCap"); // variable initializations: component index - TUListNum = this->ZoneTUListPtr; RefPLow = this->refrig->PsLowPresValue; RefPHigh = this->refrig->PsHighPresValue; From f6b6beee8f43773dcfeae127e2cf3eaf4218cc91 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 22:20:55 -0400 Subject: [PATCH 006/108] Reassigned OK to remove? --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 2ce473122d1..64d9030a993 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -11793,7 +11793,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state) // Evaporator (IU side) operational parameters Pevap = this->refrig->getSatPressure(state, this->IUEvaporatingTemp, RoutineName); Psuction = Pevap; - Tsuction = this->IUEvaporatingTemp; this->EvaporatingTemp = this->IUEvaporatingTemp; // Condenser (OU side) operation ranges From 4e064bbcb750b5824f1f0952a5f6d60ea3a92850 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 22:29:01 -0400 Subject: [PATCH 007/108] Unused/reduce --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 64d9030a993..7e658376d2e 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -174,13 +174,6 @@ void SimulateVRF(EnergyPlusData &state, } CompIndex = VRFTUNum; - // suppress unused warnings temporarily until VRF inherits HVACSystemData - if (OAUnitNum > 0) { - bool tmpFlag = false; - if (OAUCoilOutTemp > 0.0) tmpFlag = true; - if (ZoneEquipment) tmpFlag = true; - } - } else { VRFTUNum = CompIndex; if (VRFTUNum > state.dataHVACVarRefFlow->NumVRFTU || VRFTUNum < 1) { @@ -7593,7 +7586,6 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) EqSizing.OAVolFlow = 0.0; VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; - IsAutoSize = false; MaxCoolAirVolFlowDes = 0.0; MaxCoolAirVolFlowUser = 0.0; MaxHeatAirVolFlowDes = 0.0; From 72604802972ac0510456a7f96c2efc29789876b1 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 22:39:41 -0400 Subject: [PATCH 008/108] Unused and reduce scope --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 7e658376d2e..f97de97cf1e 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -10028,7 +10028,6 @@ void InitializeOperatingMode(EnergyPlusData &state, Real64 SPTempLo; // thermostat setpoint low int NumTU; // loop counter, number of TU's in list int TUIndex; // index to TU - int ThisZoneNum; // index to zone number where TU is located Real64 ZoneLoad; // current zone load (W) Real64 LoadToCoolingSP; // thermostat load to cooling setpoint (W) Real64 LoadToHeatingSP; // thermostat load to heating setpoint (W) @@ -10059,7 +10058,6 @@ void InitializeOperatingMode(EnergyPlusData &state, // make sure TU's have been sized before looping through each one of them to determine operating mode if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TerminalUnitNotSizedYet)) break; TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - ThisZoneNum = state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum; // check to see if coil is present if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTU)) { @@ -10174,6 +10172,7 @@ void InitializeOperatingMode(EnergyPlusData &state, // Constant fan systems are tested for ventilation load to determine if load to be met changes. // more logic may be needed here, what is the OA flow rate, was last mode heating or cooling, what control is used, etc... + int ThisZoneNum = state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum; getVRFTUZoneLoad(state, TUIndex, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, true); if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == ThermostatCtrlType::ThermostatOffsetPriority) { @@ -10936,7 +10935,6 @@ void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(EnergyPlusData &state, int TUListIndex; // index to TU list for this VRF system int VRFNum; // index to VRF that the VRF Terminal Unit serves int VRFInletNode; // VRF inlet node number - int ZoneIndex; // index to zone where the VRF Terminal Unit resides Real64 BFC; // Bypass factor at the cooling mode (-) Real64 BFH; // Bypass factor at the heating mode (-) Real64 C1Tevap; // Coefficient for indoor unit coil evaporating temperature curve (-) @@ -10967,7 +10965,6 @@ void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(EnergyPlusData &state, // Get the equipment/zone index corresponding to the VRFTU CoolCoilNum = this->CoolCoilIndex; HeatCoilNum = this->HeatCoilIndex; - ZoneIndex = this->ZoneNum; VRFNum = this->VRFSysNum; TUListIndex = state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr; IndexToTUInTUList = this->IndexToTUInTUList; From dace1934722d6cdc7ea5ebef4436b6beb95ee15e Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 22:49:46 -0400 Subject: [PATCH 009/108] Assigned value before used --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index f97de97cf1e..9d0d816fae1 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -11340,8 +11340,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state) // Evaporator (IU side) operational parameters Pevap = this->refrig->getSatPressure(state, this->IUEvaporatingTemp, RoutineName); Psuction = Pevap; - Tsuction = this->IUEvaporatingTemp; // GetSatTemperatureRefrig(state, this->RefrigerantName, max( min( Psuction, RefPHigh ), RefPLow ), - // RefrigerantIndex, RoutineName ); this->EvaporatingTemp = this->IUEvaporatingTemp; // GetSatTemperatureRefrig(state, this->RefrigerantName, max( min( Pevap, RefPHigh ), RefPLow // ), RefrigerantIndex, RoutineName ); From 2d95252173577997e4526489dbb759c099852c2f Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 22:56:17 -0400 Subject: [PATCH 010/108] REduce scope HR --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 9d0d816fae1..d936d4abd7d 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -357,9 +357,6 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) static constexpr std::string_view RoutineName("VRFCondenser"); int NumTU; // loop counter - int TUIndex; // Index to terminal unit - int CoolCoilIndex; // index to cooling coil in terminal unit - int HeatCoilIndex; // index to heating coil in terminal unit Real64 TotCoolCapTempModFac; // cooling CAPFT curve output Real64 TotHeatCapTempModFac; // heating CAPFT curve output @@ -376,7 +373,6 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) Real64 CoolOABoundary; // output of cooling boundary curve (outdoor temperature, C) Real64 HeatOABoundary; // output of heating boundary curve (outdoor temperature, C) Real64 EIRFPLRModFac; // EIRFPLR curve output - int Stage; // used for crankcase heater power calculation Real64 UpperStageCompressorRatio; // used for crankcase heater power calculation Real64 RhoAir; // Density of air [kg/m3] Real64 RhoWater; // Density of water [kg/m3] @@ -392,11 +388,9 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) Real64 InputPowerMultiplier; // Multiplier for power when system is in defrost Real64 LoadDueToDefrost; // Additional load due to defrost Real64 DefrostEIRTempModFac; // EIR modifier for defrost (function of entering drybulb, outside wetbulb) - int HRCAPFT; // index to heat recovery CAPFTCool curve Real64 HRCAPFTConst; // stead-state capacity fraction Real64 HRInitialCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode Real64 HRCapTC; // Time constant used to recover from initial degradation in cooling heat recovery - int HREIRFT; // Index to cool EIR as a function of temperature curve for heat recovery Real64 HREIRFTConst; // stead-state EIR fraction Real64 HRInitialEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode Real64 HREIRTC; // Time constant used to recover from initial degradation in cooling heat recovery @@ -549,9 +543,9 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) // loop through TU's and calculate average inlet conditions for active coils for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; - HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; + int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + int CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + int HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; TUParasiticPower += state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticCoolElecPower + state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticHeatElecPower; TUFanPower += state.dataHVACVarRefFlow->VRFTU(TUIndex).FanPower; @@ -948,7 +942,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) } vrf.HRCoolingActive = true; vrf.HRHeatingActive = false; - HRCAPFT = vrf.HRCAPFTCool; // Index to cool capacity as a function of temperature\PLR curve for heat recovery + int HRCAPFT = vrf.HRCAPFTCool; // Index to cool capacity as a function of temperature\PLR curve for heat recovery if (HRCAPFT > 0) { // VRF(VRFCond)%HRCAPFTCoolConst = 0.9d0 ! initialized to 0.9 if (state.dataCurveManager->PerfCurve(vrf.HRCAPFTCool)->numDims == 2) { // Curve type for HRCAPFTCool @@ -961,7 +955,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) HRInitialCapFrac = vrf.HRInitialCoolCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode HRCapTC = vrf.HRCoolCapTC; // Time constant used to recover from initial degradation in cooling heat recovery - HREIRFT = vrf.HREIRFTCool; // Index to cool EIR as a function of temperature curve for heat recovery + int HREIRFT = vrf.HREIRFTCool; // Index to cool EIR as a function of temperature curve for heat recovery if (HREIRFT > 0) { // VRF(VRFCond)%HREIRFTCoolConst = 1.1d0 ! initialized to 1.1 if (state.dataCurveManager->PerfCurve(vrf.HREIRFTCool)->numDims == 2) { // Curve type for HREIRFTCool @@ -979,7 +973,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) } vrf.HRCoolingActive = false; vrf.HRHeatingActive = true; - HRCAPFT = vrf.HRCAPFTHeat; // Index to heat capacity as a function of temperature\PLR curve for heat recovery + int HRCAPFT = vrf.HRCAPFTHeat; // Index to heat capacity as a function of temperature\PLR curve for heat recovery if (HRCAPFT > 0) { // VRF(VRFCond)%HRCAPFTHeatConst = 1.1d0 ! initialized to 1.1 if (state.dataCurveManager->PerfCurve(vrf.HRCAPFTHeat)->numDims == 2) { // Curve type for HRCAPFTCool @@ -1002,7 +996,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) HRInitialCapFrac = vrf.HRInitialHeatCapFrac; // Fractional heating degradation at the start of heat recovery from cooling mode HRCapTC = vrf.HRHeatCapTC; // Time constant used to recover from initial degradation in heating heat recovery - HREIRFT = vrf.HREIRFTHeat; // Index to cool EIR as a function of temperature curve for heat recovery + int HREIRFT = vrf.HREIRFTHeat; // Index to cool EIR as a function of temperature curve for heat recovery if (HREIRFT > 0) { // VRF(VRFCond)%HREIRFTCoolConst = 1.1d0 ! initialized to 1.1 if (state.dataCurveManager->PerfCurve(vrf.HREIRFTHeat)->numDims == 2) { // Curve type for HREIRFTHeat @@ -1210,7 +1204,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) vrf.CrankCaseHeaterPower = vrf.CCHeaterPower * (1.0 - VRFRTF); if (vrf.NumCompressors > 1) { UpperStageCompressorRatio = (1.0 - vrf.CompressorSizeRatio) / (vrf.NumCompressors - 1); - for (Stage = 1; Stage <= vrf.NumCompressors - 2; ++Stage) { + for (int Stage = 1; Stage <= vrf.NumCompressors - 2; ++Stage) { if (vrf.VRFCondPLR < (vrf.CompressorSizeRatio + Stage * UpperStageCompressorRatio)) { vrf.CrankCaseHeaterPower += vrf.CCHeaterPower; } From 19e73164f960ab9f52bbb160212cff8879c1d686 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 23:03:03 -0400 Subject: [PATCH 011/108] Reduce scope and shadow --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index d936d4abd7d..e8d5215b03b 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -356,7 +356,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) static constexpr std::string_view RoutineName("VRFCondenser"); - int NumTU; // loop counter + int NumTU; // loop counter Real64 TotCoolCapTempModFac; // cooling CAPFT curve output Real64 TotHeatCapTempModFac; // heating CAPFT curve output @@ -7542,8 +7542,6 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) // HeatingCapacitySizing, etc.) bool PrintFlag = true; // TRUE when sizing information is reported in the eio file int zoneHVACIndex; // index of zoneHVAC equipment sizing specification - int SAFMethod(0); // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, - // FractionOfAutosizedHeatingAirflow ...) int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and // FractionOfAutosizedHeatingCapacity ) @@ -7662,7 +7660,9 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) SizingMethod = CoolingAirflowSizing; PrintFlag = true; bool errorsFound = false; - SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod; + // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, + // FractionOfAutosizedHeatingAirflow ...) + int SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod; EqSizing.SizingMethod(SizingMethod) = SAFMethod; if (SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || SAFMethod == FractionOfAutosizedCoolingAirflow) { if (SAFMethod == SupplyAirFlowRate) { @@ -7772,7 +7772,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) } else { TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; } - bool errorsFound = false; + errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); @@ -7787,7 +7787,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod == FractionOfAutosizedHeatingCapacity) { state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; } - bool errorsFound = false; + errorsFound = false; HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); @@ -7913,7 +7913,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) } else { TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxNoCoolHeatAirVolFlow; } - bool errorsFound = false; + errorsFound = false; HeatingAirFlowSizer sizingNoHeatingAirFlow; sizingNoHeatingAirFlow.overrideSizingString(SizingString); // sizingNoHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); From e16708491f3af2fe593b3cb7e0357be6a0d44861 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 23:10:11 -0400 Subject: [PATCH 012/108] Reduce scope --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index e8d5215b03b..03d90e48eee 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -3258,8 +3258,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) { // initialize local node number variables - int FanInletNodeNum = 0; - int FanOutletNodeNum = 0; int CCoilInletNodeNum = 0; int CCoilOutletNodeNum = 0; int HCoilInletNodeNum = 0; @@ -3422,8 +3420,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) Real64 FanVolFlowRate = fan->maxAirFlowRate; thisVrfTU.ActualFanVolFlowRate = FanVolFlowRate; - FanInletNodeNum = fan->inletNodeNum; - FanOutletNodeNum = fan->outletNodeNum; + int FanInletNodeNum = fan->inletNodeNum; + int FanOutletNodeNum = fan->outletNodeNum; thisVrfTU.FanAvailSchedPtr = fan->availSchedNum; // Check fan's schedule for cycling fan operation if constant volume fan is used @@ -7497,13 +7495,9 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) static constexpr std::string_view RoutineName("SizeVRF: "); // include trailing blank space auto &CheckVRFCombinationRatio = state.dataHVACVarRefFlow->CheckVRFCombinationRatio; - bool FoundAll; // temporary variable used to check all terminal units - bool errFlag; // temporary variable used for error checking Real64 TUCoolingCapacity; // total terminal unit cooling capacity Real64 TUHeatingCapacity; // total terminal unit heating capacity int VRFCond; // index to VRF condenser - int TUListNum; // index to terminal unit list - int TUIndex; // index to terminal unit int NumTU; // DO Loop index counter Real64 OnOffAirFlowRat; // temporary variable used when sizing coils Real64 DXCoilCap; // capacity of DX cooling coil (W) @@ -8420,10 +8414,11 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) // ZoneEqDXCoil = .FALSE. TUCoolingCapacity = 0.0; TUHeatingCapacity = 0.0; - FoundAll = true; - TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; + bool FoundAll = true; + bool errFlag; // temporary variable used for error checking + int TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; for (NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { - TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex > 0) { DXCoilCap = DXCoils::GetCoilCapacityByIndexType(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex, From be8f7962fbd4c88753b7862f32ea25dc64d56b45 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 23:19:52 -0400 Subject: [PATCH 013/108] Reduce scope --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 03d90e48eee..07ca057fb92 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -7498,7 +7498,6 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) Real64 TUCoolingCapacity; // total terminal unit cooling capacity Real64 TUHeatingCapacity; // total terminal unit heating capacity int VRFCond; // index to VRF condenser - int NumTU; // DO Loop index counter Real64 OnOffAirFlowRat; // temporary variable used when sizing coils Real64 DXCoilCap; // capacity of DX cooling coil (W) bool IsAutoSize; // Indicator to autosize @@ -7532,12 +7531,9 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) std::string SizingString; // input field sizing description (e.g., Nominal Capacity) Real64 TempSize; // autosized value of coil input field int FieldNum = 2; // IDD numeric field number where input field description is found - int SizingMethod; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, - // HeatingCapacitySizing, etc.) - bool PrintFlag = true; // TRUE when sizing information is reported in the eio file - int zoneHVACIndex; // index of zoneHVAC equipment sizing specification - int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and - // FractionOfAutosizedHeatingCapacity ) + int SizingMethod; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, + // HeatingCapacitySizing, etc.) + bool PrintFlag = true; // TRUE when sizing information is reported in the eio file auto &ZoneEqSizing = state.dataSize->ZoneEqSizing; @@ -7649,7 +7645,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) state.dataSize->CurZoneEqNum); } - zoneHVACIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex; + int zoneHVACIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex; SizingMethod = CoolingAirflowSizing; PrintFlag = true; @@ -7926,7 +7922,9 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) // initialize capacity sizing variables: cooling SizingMethod = CoolingCapacitySizing; - CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod; + // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and + // FractionOfAutosizedHeatingCapacity ) + int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod; EqSizing.SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == CoolingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || CapSizingMethod == FractionOfAutosizedCoolingCapacity) { @@ -8417,7 +8415,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) bool FoundAll = true; bool errFlag; // temporary variable used for error checking int TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; - for (NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { + for (int NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex > 0) { DXCoilCap = DXCoils::GetCoilCapacityByIndexType(state, @@ -8877,17 +8875,15 @@ void VRFCondenserEquipment::SizeVRFCondenser(EnergyPlusData &state) static constexpr std::string_view RoutineName("SizeVRFCondenser"); - int PltSizCondNum; // Plant Sizing index for condenser loop Real64 rho; // local fluid density [kg/m3] Real64 Cp; // local fluid specific heat [J/kg-k] Real64 tmpCondVolFlowRate; // local condenser design volume flow rate [m3/s] - bool ErrorsFound; // indicates problem with sizing // save the design water flow rate for use by the water loop sizing algorithms if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Water) { - ErrorsFound = false; - PltSizCondNum = 0; + bool ErrorsFound = false; + int PltSizCondNum = 0; if (this->WaterCondVolFlowRate == DataSizing::AutoSize) { if (this->SourcePlantLoc.loopNum > 0) PltSizCondNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum; @@ -9057,10 +9053,8 @@ void VRFTerminalUnitEquipment::ControlVRFToLoad(EnergyPlusData &state, int VRFCond = this->VRFSysNum; Real64 FullOutput = 0.0; // unit full output when compressor is operating [W] Real64 TempOutput = 0.0; // unit output when iteration limit exceeded [W] - int SolFla = 0; // Flag of RegulaFalsi solver Real64 TempMinPLR = 0.0; // min PLR used in Regula Falsi call Real64 TempMaxPLR = 0.0; // max PLR used in Regula Falsi call - bool ContinueIter; // used when convergence is an issue Real64 NoCompOutput = 0.0; // output when no active compressor [W] bool VRFCoolingMode = state.dataHVACVarRefFlow->CoolingLoad(VRFCond); bool VRFHeatingMode = state.dataHVACVarRefFlow->HeatingLoad(VRFCond); @@ -9248,6 +9242,7 @@ void VRFTerminalUnitEquipment::ControlVRFToLoad(EnergyPlusData &state, if (SpeedNum == 1) { this->SpeedRatio = 0.0; } + int SolFla = 0; // Flag of RegulaFalsi solver auto f = [&state, VRFTUNum, FirstHVACIteration, QZnReq, OnOffAirFlowRatio](Real64 const PartLoadRatio) { Real64 QZnReqTemp = QZnReq; // denominator representing zone load (W) Real64 ActualOutput; // delivered capacity of VRF terminal unit @@ -9290,7 +9285,7 @@ void VRFTerminalUnitEquipment::ControlVRFToLoad(EnergyPlusData &state, if (SolFla == -1) { // Very low loads may not converge quickly. Tighten PLR boundary and try again. TempMaxPLR = -0.1; - ContinueIter = true; + bool ContinueIter = true; while (ContinueIter && TempMaxPLR < 1.0) { TempMaxPLR += 0.1; From def3f7a68b33480c434aebe90aff0cb550dcc695 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 23:24:05 -0400 Subject: [PATCH 014/108] Reduce scope --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 07ca057fb92..18e68fe7515 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -7531,9 +7531,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) std::string SizingString; // input field sizing description (e.g., Nominal Capacity) Real64 TempSize; // autosized value of coil input field int FieldNum = 2; // IDD numeric field number where input field description is found - int SizingMethod; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, - // HeatingCapacitySizing, etc.) - bool PrintFlag = true; // TRUE when sizing information is reported in the eio file + bool PrintFlag = true; // TRUE when sizing information is reported in the eio file auto &ZoneEqSizing = state.dataSize->ZoneEqSizing; @@ -7647,7 +7645,9 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) int zoneHVACIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex; - SizingMethod = CoolingAirflowSizing; + // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, + // HeatingCapacitySizing, etc.) + int SizingMethod = CoolingAirflowSizing; PrintFlag = true; bool errorsFound = false; // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, @@ -8011,7 +8011,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; - SizingMethod = HeatingAirflowSizing; + int SizingMethod = HeatingAirflowSizing; TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; @@ -8364,7 +8364,6 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerWaterHeatingCapacity.size(state, TempSize, ErrorsFound); } } else { - SizingMethod = HVAC::HeatingCapacitySizing; SizingString = "Supplemental Heating Coil Nominal Capacity [W]"; if (TempSize == DataSizing::AutoSize) { IsAutoSize = true; From c6497e78cc4fb66f74f39317367b7056273c4108 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 23:49:31 -0400 Subject: [PATCH 015/108] Reduce scope --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 18e68fe7515..6bb48f857f3 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -7684,7 +7684,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == FlowPerCoolingCapacity) { - SizingMethod = CoolingCapacitySizing; + SizingMethod = CoolingCapacitySizing; // either this isn't needed or needs to be assigned to EqSizing TempSize = AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; @@ -7769,7 +7769,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == FlowPerHeatingCapacity) { - SizingMethod = HeatingCapacitySizing; + SizingMethod = HeatingCapacitySizing; // either this isn't needed or needs to be assigned to EqSizing TempSize = AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; @@ -7783,7 +7783,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataSize->DataAutosizedHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); state.dataSize->DataFlowPerHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - SizingMethod = HeatingAirflowSizing; + SizingMethod = HeatingAirflowSizing; // either this isn't needed or needs to be assigned to EqSizing PrintFlag = true; TempSize = AutoSize; errorsFound = false; @@ -8011,7 +8011,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; - int SizingMethod = HeatingAirflowSizing; + int SizingMethod = HeatingAirflowSizing; // either this isn't needed or needs to be assigned to EqSizing TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; @@ -8366,7 +8366,6 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) } else { SizingString = "Supplemental Heating Coil Nominal Capacity [W]"; if (TempSize == DataSizing::AutoSize) { - IsAutoSize = true; bool errorsFound = false; HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); @@ -8882,9 +8881,8 @@ void VRFCondenserEquipment::SizeVRFCondenser(EnergyPlusData &state) if (this->CondenserType == DataHeatBalance::RefrigCondenserType::Water) { bool ErrorsFound = false; - int PltSizCondNum = 0; - if (this->WaterCondVolFlowRate == DataSizing::AutoSize) { + int PltSizCondNum = 0; if (this->SourcePlantLoc.loopNum > 0) PltSizCondNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum; if (PltSizCondNum > 0) { rho = FluidProperties::GetDensityGlycol(state, @@ -9613,8 +9611,6 @@ void ReportVRFTerminalUnit(EnergyPlusData &state, int const VRFTUNum) // index t using namespace DataSizing; - int DXCoolingCoilIndex; // - index to DX cooling coil - int DXHeatingCoilIndex; // - index to DX heating coil Real64 TotalConditioning; // - sum of sensible and latent rates Real64 SensibleConditioning; // - sensible rate Real64 LatentConditioning; // - latent rate @@ -9625,8 +9621,6 @@ void ReportVRFTerminalUnit(EnergyPlusData &state, int const VRFTUNum) // index t bool HRHeatRequestFlag; // - indicates TU could be in heat mode bool HRCoolRequestFlag; // - indicates TU could be in cool mode - DXCoolingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex; - DXHeatingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex; VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; @@ -10010,7 +10004,6 @@ void InitializeOperatingMode(EnergyPlusData &state, Real64 SPTempHi; // thermostat setpoint high Real64 SPTempLo; // thermostat setpoint low int NumTU; // loop counter, number of TU's in list - int TUIndex; // index to TU Real64 ZoneLoad; // current zone load (W) Real64 LoadToCoolingSP; // thermostat load to cooling setpoint (W) Real64 LoadToHeatingSP; // thermostat load to heating setpoint (W) @@ -10040,7 +10033,7 @@ void InitializeOperatingMode(EnergyPlusData &state, for (NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { // make sure TU's have been sized before looping through each one of them to determine operating mode if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TerminalUnitNotSizedYet)) break; - TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + int TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); // check to see if coil is present if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTU)) { @@ -13990,10 +13983,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, Real64 CondHeat = Q_evap_req * C_cap_operation0 / this->RatedEvapCapacity; // 150130 To be confirmed int CAPFT = this->OUCoolingCAPFT(CounterCompSpdTemp); - // Update Te' (SmallLoadTe) to meet the required evaporator capacity - MinOutdoorUnitTe = 6; P_discharge = this->refrig->getSatPressure(state, T_discharge, RoutineName); - MinRefriPe = this->refrig->getSatPressure(state, -15, RoutineName); MinOutdoorUnitPe = max(P_discharge - this->CompMaxDeltaP, MinRefriPe); MinOutdoorUnitTe = this->refrig->getSatTemperature(state, max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), RoutineName); From ce1bde5de24876b4617b9b2476c84b854d7075e0 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 21 Aug 2024 16:25:08 +0200 Subject: [PATCH 016/108] Don't catch std::exception in Debug mode so we can catch array bounds error in debugger cmake will properly define NDEBUG on msvc as well in release mode cf https://gitlab.kitware.com/cmake/cmake/-/blob/1e35163a/Modules/Platform/Windows-MSVC.cmake#L481-483 --- src/EnergyPlus/api/EnergyPlusPgm.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/EnergyPlus/api/EnergyPlusPgm.cc b/src/EnergyPlus/api/EnergyPlusPgm.cc index 88dae209906..800734bc67e 100644 --- a/src/EnergyPlus/api/EnergyPlusPgm.cc +++ b/src/EnergyPlus/api/EnergyPlusPgm.cc @@ -419,10 +419,13 @@ int RunEnergyPlus(EnergyPlus::EnergyPlusData &state, std::string const &filepath EnergyPlus::SimulationManager::ManageSimulation(state); } catch (const EnergyPlus::FatalError &e) { return EnergyPlus::AbortEnergyPlus(state); +#ifdef NDEBUG } catch (const std::exception &e) { ShowSevereError(state, e.what()); return EnergyPlus::AbortEnergyPlus(state); +#endif } + return wrapUpEnergyPlus(state); } From 8cadfea9544ecdcefe63767139d69c595a0b993a Mon Sep 17 00:00:00 2001 From: LipingWang Date: Wed, 21 Aug 2024 19:40:57 -0400 Subject: [PATCH 017/108] Bug fix + Output Variable Reference --- src/EnergyPlus/IndoorGreen.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/IndoorGreen.cc b/src/EnergyPlus/IndoorGreen.cc index 440e3d398ff..af5b6f1beca 100644 --- a/src/EnergyPlus/IndoorGreen.cc +++ b/src/EnergyPlus/IndoorGreen.cc @@ -580,7 +580,7 @@ namespace IndoorGreen { ZoneNewTemp = Twb; ZoneNewHum = ZoneSatHum; } - HMid = Psychrometrics::PsyHFnTdbW(ZoneNewTemp, ZoneNewHum); + HMid = Psychrometrics::PsyHFnTdbW(ZoneNewTemp, ZonePreHum); ig.SensibleRate = (1 - ig.LEDRadFraction) * ig.LEDActualEleP; // convective heat gain from LED lights when LED is on; heat convection from // plants was considered and counted from plant surface heat balance. ig.LatentRate = ZoneAirVol * rhoair * (HCons - HMid) / Timestep; // unit W From 79dd25d1dccf9c9dacd0fe7cd628cf4f6693c76e Mon Sep 17 00:00:00 2001 From: LipingWang Date: Wed, 21 Aug 2024 19:52:26 -0400 Subject: [PATCH 018/108] Bug fix --- src/EnergyPlus/IndoorGreen.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/IndoorGreen.cc b/src/EnergyPlus/IndoorGreen.cc index af5b6f1beca..2dfae769f0e 100644 --- a/src/EnergyPlus/IndoorGreen.cc +++ b/src/EnergyPlus/IndoorGreen.cc @@ -584,7 +584,8 @@ namespace IndoorGreen { ig.SensibleRate = (1 - ig.LEDRadFraction) * ig.LEDActualEleP; // convective heat gain from LED lights when LED is on; heat convection from // plants was considered and counted from plant surface heat balance. ig.LatentRate = ZoneAirVol * rhoair * (HCons - HMid) / Timestep; // unit W - state.dataHeatBalSurf->SurfQAdditionalHeatSourceInside(ig.SurfPtr) = -1.0 * ig.LambdaET; + state.dataHeatBalSurf->SurfQAdditionalHeatSourceInside(ig.SurfPtr) = + -1.0 * ig.LambdaET+ ig.LEDRadFraction * 0.9 * ig.LEDActualEleP / state.dataSurface->Surface(ig.SurfPtr).Area; //assume the energy from radiation for photosynthesis is only 10%. } } From b5649eeca12b3f9c50f76a0f8a278ed3909c76b1 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 21:15:41 -0400 Subject: [PATCH 019/108] First few logic fixes --- src/EnergyPlus/AirLoopHVACDOAS.cc | 5 +---- src/EnergyPlus/StandardRatings.cc | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/AirLoopHVACDOAS.cc b/src/EnergyPlus/AirLoopHVACDOAS.cc index 2db751c59d2..b382733e760 100644 --- a/src/EnergyPlus/AirLoopHVACDOAS.cc +++ b/src/EnergyPlus/AirLoopHVACDOAS.cc @@ -999,7 +999,6 @@ namespace AirLoopHVACDOAS { state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = sizingMassFlow; } - bool errorsFound = false; if (this->m_FanIndex > 0 && this->m_FanTypeNum == SimAirServingZones::CompType::Fan_ComponentModel) { state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate = sizingMassFlow / state.dataEnvrn->StdRhoAir; state.dataFans->fans(this->m_FanIndex)->minAirFlowRate = 0.0; @@ -1008,9 +1007,7 @@ namespace AirLoopHVACDOAS { state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = sizingMassFlow; } - if (errorsFound) { - ShowFatalError(state, "Preceding sizing errors cause program termination"); - } + state.dataSize->CurSysNum = state.dataHVACGlobal->NumPrimaryAirSys + this->m_AirLoopDOASNum + 1; state.dataSize->CurOASysNum = this->m_OASystemNum; } diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index 2142c6f7e74..5de0d975fe9 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -4508,7 +4508,7 @@ namespace StandardRatings { p_int, q_int, q_low, bl, n, Q_E_Int(spnum), q_full, P_E_Int(spnum), p_full, p_low); speedsUsed.push_back(spnum); goto SpeedLoop3_exit; - } else if (bl < q_full) { + } else { // bl < q_full // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & // full Speed std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2B( @@ -4606,7 +4606,7 @@ namespace StandardRatings { std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2A( p_int, q_int, q_low, bl, n, Q_E_Int(spnum), q_full, P_E_Int(spnum), p_full, p_low); goto SpeedLoop3_exit; - } else if (bl < q_full) { + } else { // bl < q_full // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & // full Speed std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2B( @@ -4647,7 +4647,7 @@ namespace StandardRatings { std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2A( p_int, q_int, q_low, bl, n, Q_E_Int(spnum), q_full, P_E_Int(spnum), p_full, p_low); goto SpeedLoop3_exit; - } else if (bl < q_full) { + } else { // bl < q_full // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & // full Speed std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2B( @@ -4691,7 +4691,7 @@ namespace StandardRatings { std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2A(p_int, q_int, q_low, bl, n, Q_E_Int(1), q_full, P_E_Int(1), p_full, p_low); goto SpeedLoop3_exit; - } else if (bl < q_full) { + } else { // bl < q_full // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & // full Speed std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = @@ -6469,7 +6469,7 @@ namespace StandardRatings { } else if (bl >= q_full) { // CASE 3 : 11.2.2.3.3 AHRI-2023 // Building Load is greater than the capacity of the unit at the Full Compressor Speed, q_full <= bl or (bl >= q_full:) - if (t > (-15) || t <= (-8.33)) { + if (t > (-15) || t <= (-8.33)) { // Logical disjunction always evaluates to true: t > -15 || t <= -8.33 Real64 t_ratio = (t - (-15)) / ((-8.33) - (-15)); // Equation 11.203 AHRI-2023 q_full = q_H4_full + (q_H3_full - q_H4_full) * t_ratio; From 88dad82a9fccc32fae0c9bc2acbda3bf9c79ce17 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 21:25:28 -0400 Subject: [PATCH 020/108] AFN fixes --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 7e794a85453..47ea5d88962 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -470,12 +470,8 @@ namespace AirflowNetwork { Real64 flowRate = fan->maxAirFlowRate; flowRate *= m_state.dataEnvrn->StdRhoAir; - bool nodeErrorsFound{false}; int inletNode = fan->inletNodeNum; int outletNode = fan->outletNodeNum; - if (nodeErrorsFound) { - success = false; - } HVAC::FanType fanType = fan->type; if (fanType != HVAC::FanType::Exhaust) { ShowSevereError(m_state, @@ -4607,7 +4603,7 @@ namespace AirflowNetwork { int compnum = compnum_iter->second; AirflowNetworkLinkageData(count).CompNum = compnum; - auto &surf = m_state.dataSurface->Surface(MultizoneSurfaceData(count).SurfNum); + auto const &surf = m_state.dataSurface->Surface(MultizoneSurfaceData(count).SurfNum); switch (AirflowNetworkLinkageData(count).element->type()) { case ComponentType::DOP: { From a0a57f3043cd82a5ed247bb11acd1b2969e299fb Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 21:33:20 -0400 Subject: [PATCH 021/108] BranchInputManager --- src/EnergyPlus/BranchInputManager.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/EnergyPlus/BranchInputManager.cc b/src/EnergyPlus/BranchInputManager.cc index 73548a5765c..4e7c1508110 100644 --- a/src/EnergyPlus/BranchInputManager.cc +++ b/src/EnergyPlus/BranchInputManager.cc @@ -1026,7 +1026,6 @@ namespace BranchInputManager { int NumNumbers; // Used to retrieve numbers from IDF int NumAlphas; // Used to retrieve names from IDF int NumParams; - bool ErrFound = false; state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "NodeList", NumParams, NumAlphas, NumNumbers); NodeNums.dimension(NumParams, 0); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNumbers); @@ -1063,12 +1062,6 @@ namespace BranchInputManager { cNumericFields.deallocate(); lAlphaBlanks.deallocate(); lNumericBlanks.deallocate(); - if (ErrFound) { - ShowSevereError( - state, - format("{} Invalid {} Input, preceding condition(s) will likely cause termination.", RoutineName, CurrentModuleObject)); - state.dataBranchInputManager->InvalidBranchDefinitions = true; - } TestInletOutletNodes(state); state.dataBranchInputManager->GetBranchInputOneTimeFlag = false; } From 71dca2fe2fb28fd04deba708d738e1734e43e0fd Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 21:48:24 -0400 Subject: [PATCH 022/108] Chillers --- src/EnergyPlus/ChillerElectricEIR.cc | 28 ++++++++++++------------ src/EnergyPlus/ChillerReformulatedEIR.cc | 24 ++++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/EnergyPlus/ChillerElectricEIR.cc b/src/EnergyPlus/ChillerElectricEIR.cc index ec812d8029a..4ffc4585300 100644 --- a/src/EnergyPlus/ChillerElectricEIR.cc +++ b/src/EnergyPlus/ChillerElectricEIR.cc @@ -2403,16 +2403,16 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b } } break; case DataPlant::CondenserFlowControl::ModulatedDeltaTemperature: { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - this->CondInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, + state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, + this->CondInletTemp, + state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, + RoutineName); Real64 condDT = 0.0; if (this->CondDTScheduleNum > 0) { condDT = ScheduleManager::GetCurrentScheduleValue(state, this->CondDTScheduleNum); } - this->CondMassFlowRate = this->QCondenser / (Cp * condDT); + this->CondMassFlowRate = this->QCondenser / (CpCond * condDT); } break; default: { this->CondMassFlowRate = this->CondMassFlowRateMax; @@ -2431,13 +2431,13 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // If Heat Recovery specified for this vapor compression chiller, then Qcondenser will be adjusted by this subroutine if (this->HeatRecActive) this->calcHeatRecovery(state, this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovered); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, + state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, + condInletTemp, + state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, + RoutineName); - this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / Cp + condInletTemp; + this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp; } else { ShowSevereError(state, format("CalcElectricEIRChillerModel: Condenser flow = 0, for ElectricEIRChiller={}", this->Name)); ShowContinueErrorTimeStamp(state, ""); @@ -2457,8 +2457,8 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b if (this->HeatRecActive) this->calcHeatRecovery(state, this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovered); if (CondMassFlowRate > 0.0) { - Cp = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->CondInletNodeNum).HumRat); - CondOutletTemp = CondInletTemp + QCondenser / CondMassFlowRate / Cp; + Real64 CpCond = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->CondInletNodeNum).HumRat); + CondOutletTemp = CondInletTemp + QCondenser / CondMassFlowRate / CpCond; } else { this->CondOutletTemp = condInletTemp; } diff --git a/src/EnergyPlus/ChillerReformulatedEIR.cc b/src/EnergyPlus/ChillerReformulatedEIR.cc index a7e0e01cc23..d1922a404c9 100644 --- a/src/EnergyPlus/ChillerReformulatedEIR.cc +++ b/src/EnergyPlus/ChillerReformulatedEIR.cc @@ -2545,16 +2545,16 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa } } break; case DataPlant::CondenserFlowControl::ModulatedDeltaTemperature: { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - this->CondInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, + state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, + this->CondInletTemp, + state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, + RoutineName); Real64 condDT = 0.0; if (this->CondDTScheduleNum > 0) { condDT = ScheduleManager::GetCurrentScheduleValue(state, this->CondDTScheduleNum); } - this->CondMassFlowRate = this->QCondenser / (Cp * condDT); + this->CondMassFlowRate = this->QCondenser / (CpCond * condDT); } break; default: { this->CondMassFlowRate = this->CondMassFlowRateMax; @@ -2573,12 +2573,12 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // If Heat Recovery specified for this vapor compression chiller, then Qcondenser will be adjusted by this subroutine if (this->HeatRecActive) this->calcHeatRecovery(state, this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovery); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / Cp + condInletTemp; + Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, + state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, + condInletTemp, + state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, + RoutineName); + this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp; } else { ShowSevereError(state, format("ControlReformEIRChillerModel: Condenser flow = 0, for ElecReformEIRChiller={}", this->Name)); ShowContinueErrorTimeStamp(state, ""); From c2e1fc86a67642bc031864ffd58f41dd06d1727d Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 21:57:44 -0400 Subject: [PATCH 023/108] const refs --- src/EnergyPlus/ConvectionCoefficients.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index d4b28755744..dc8d38baddf 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -2053,7 +2053,7 @@ Real64 CalcZoneSupplyAirTemp(EnergyPlusData &state, int const ZoneNum) zoneInletNodeNum = equipData.OutletNodeNums(1); if (zoneInletNodeNum == 0) continue; - auto &zoneInletNode = state.dataLoopNodes->Node(zoneInletNodeNum); + auto const &zoneInletNode = state.dataLoopNodes->Node(zoneInletNodeNum); if (zoneInletNode.MassFlowRate > 0.0) { SumMdotTemp += zoneInletNode.MassFlowRate * zoneInletNode.Temp; SumMdot += zoneInletNode.MassFlowRate; @@ -2315,7 +2315,7 @@ void CalcTrombeWallIntConvCoeff(EnergyPlusData &state, // are assumed to have exactly equal widths AND must have a greater // width than the side surfaces. - auto &zone = state.dataHeatBal->Zone(ZoneNum); + auto const &zone = state.dataHeatBal->Zone(ZoneNum); Real64 H = zone.CeilingHeight; // height of enclosure Real64 minorW = 100000.0; // width of enclosure (narrow dimension) // An impossibly big width Real64 majorW = 0.0; // width of major surface @@ -3049,7 +3049,7 @@ void SetupAdaptiveConvRadiantSurfaceData(EnergyPlusData &state) int activeFloorCount = 0; Real64 activeFloorArea = 0.0; - auto &zone = state.dataHeatBal->Zone(ZoneLoop); + auto const &zone = state.dataHeatBal->Zone(ZoneLoop); for (int spaceNum : zone.spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) { @@ -3985,7 +3985,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu } else { // is controlled, lets see by how and if that means is currently active auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(surface.Zone); - auto &zoneNode = state.dataLoopNodes->Node(zone.SystemZoneNodeNumber); + auto const &zoneNode = state.dataLoopNodes->Node(zone.SystemZoneNodeNumber); if (!(zoneEquipConfig.EquipListIndex > 0) || state.dataGlobal->SysSizingCalc || state.dataGlobal->ZoneSizingCalc || !state.dataZoneEquip->ZoneEquipSimulatedOnce) { @@ -4062,7 +4062,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) { if (!state.dataSurface->surfIntConv(SurfLoop).hasActiveInIt) continue; - auto &surface = state.dataSurface->Surface(SurfLoop); + auto const &surface = state.dataSurface->Surface(SurfLoop); if (surface.Class != SurfaceClass::Floor) continue; Real64 DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - @@ -4688,7 +4688,7 @@ Real64 CalcUserDefinedIntHcModel(EnergyPlusData &state, int const SurfNum, int c } auto &userCurve = state.dataConvect->hcIntUserCurve(UserCurveNum); - auto &surfIntConv = state.dataSurface->surfIntConv(SurfNum); + auto const &surfIntConv = state.dataSurface->surfIntConv(SurfNum); switch (userCurve.refTempType) { case RefTemp::MeanAirTemp: @@ -6544,7 +6544,7 @@ Real64 SurroundingSurfacesRadCoeffAverage(EnergyPlusData &state, int const SurfN // compute exterior surfaces LW radiation transfer coefficient to surrounding surfaces // the surface.SrdSurfTemp is weighed by surrounding surfaces view factor Real64 HSrdSurf = 0.0; - auto &surface = state.dataSurface->Surface(SurfNum); + auto const &surface = state.dataSurface->Surface(SurfNum); Real64 SrdSurfsTK = surface.SrdSurfTemp + Constant::Kelvin; if (TSurfK != SrdSurfsTK) { HSrdSurf = Constant::StefanBoltzmann * AbsExt * surface.ViewFactorSrdSurfs * (pow_4(TSurfK) - pow_4(SrdSurfsTK)) / (TSurfK - SrdSurfsTK); From 70a3730f0a0f2efcb95cc0cd54d937555b0de990 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 22:15:02 -0400 Subject: [PATCH 024/108] Shadow vars --- src/EnergyPlus/ConvectionCoefficients.cc | 50 ++++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index dc8d38baddf..7c33104830f 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -4056,18 +4056,18 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu case DataZoneEquipment::ZoneEquipType::VentilatedSlab: case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiant: { if (zoneEquipConfig.InFloorActiveElement) { - for (int spaceNum : zone.spaceIndexes) { - auto const &thisSpace = state.dataHeatBal->space(spaceNum); + for (int spaceNumLoop : zone.spaceIndexes) { + auto const &thisSpace = state.dataHeatBal->space(spaceNumLoop); for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) { if (!state.dataSurface->surfIntConv(SurfLoop).hasActiveInIt) continue; - auto const &surface = state.dataSurface->Surface(SurfLoop); - if (surface.Class != SurfaceClass::Floor) continue; + auto const &surfaceLoop = state.dataSurface->Surface(SurfLoop); + if (surfaceLoop.Class != SurfaceClass::Floor) continue; - Real64 DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; - if (DeltaTemp > ActiveDelTempThreshold) { // assume heating with floor + Real64 DeltaTempLoop = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - + state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNumLoop).MAT; + if (DeltaTempLoop > ActiveDelTempThreshold) { // assume heating with floor // system ON is not enough because floor surfaces can continue to heat because of thermal capacity EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); FlowRegimeStack[EquipOnCount] = InConvFlowRegime::A1; @@ -4076,43 +4076,43 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu break; } // if (DeltaTemp) } // for (SurfLoop) - } // for (spaceNum) + } // for (spaceNumLoop) } // if (InFloorActiveElement) if (zoneEquipConfig.InCeilingActiveElement) { - for (int spaceNum : zone.spaceIndexes) { - auto const &thisSpace = state.dataHeatBal->space(spaceNum); + for (int spaceNumLoop : zone.spaceIndexes) { + auto const &thisSpace = state.dataHeatBal->space(spaceNumLoop); for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) { if (!state.dataSurface->surfIntConv(SurfLoop).hasActiveInIt) continue; - auto const &surface = state.dataSurface->Surface(SurfLoop); - if (surface.Class != SurfaceClass::Roof) continue; + auto const &surfaceLoop = state.dataSurface->Surface(SurfLoop); + if (surfaceLoop.Class != SurfaceClass::Roof) continue; - Real64 DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; - if (DeltaTemp < ActiveDelTempThreshold) { // assume cooling with ceiling + Real64 DeltaTempLoop = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - + state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNumLoop).MAT; + if (DeltaTempLoop < ActiveDelTempThreshold) { // assume cooling with ceiling // system ON is not enough because surfaces can continue to cool because of thermal capacity EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); FlowRegimeStack[EquipOnCount] = InConvFlowRegime::A1; HeatingPriorityStack[EquipOnCount] = zoneEquipList.HeatingPriority(EquipNum); CoolingPriorityStack[EquipOnCount] = zoneEquipList.CoolingPriority(EquipNum); break; - } // if (DeltaTemp) + } // if (DeltaTempLoop) } // for (SurfLoop) - } // for (spaceNum) + } // for (spaceNumLoop) } // if (InCeilingActiveElement) if (zoneEquipConfig.InWallActiveElement) { - for (int spaceNum : zone.spaceIndexes) { - auto const &thisSpace = state.dataHeatBal->space(spaceNum); + for (int spaceNumLoop : zone.spaceIndexes) { + auto const &thisSpace = state.dataHeatBal->space(spaceNumLoop); for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) { if (!state.dataSurface->surfIntConv(SurfLoop).hasActiveInIt) continue; - auto const &surface = state.dataSurface->Surface(SurfLoop); - if (surface.Class != SurfaceClass::Wall && surface.Class != SurfaceClass::Door) continue; + auto const &surface_test = state.dataSurface->Surface(SurfLoop); + if (surface_test.Class != SurfaceClass::Wall && surface_test.Class != SurfaceClass::Door) continue; DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; + state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNumLoop).MAT; if (DeltaTemp > ActiveDelTempThreshold) { // assume heating with wall panel // system ON is not enough because surfaces can continue to heat because of thermal capacity EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); @@ -4126,7 +4126,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu CoolingPriorityStack[EquipOnCount] = zoneEquipList.CoolingPriority(EquipNum); } // else (DeltaTemp) } // for (SurfLoop) - } // for (spaceNum) + } // for (spaceNumLoop) } // if (InWallActiveElement) } break; default:; // nothing @@ -4167,8 +4167,8 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu auto const &zoneNode = state.dataLoopNodes->Node(zone.SystemZoneNodeNumber); // Calculate Grashof, Reynolds, and Richardson numbers for the zone // Grashof for zone air based on largest delta T between surfaces and zone height - for (int spaceNum : zone.spaceIndexes) { - auto const &thisSpace = state.dataHeatBal->space(spaceNum); + for (int spaceNumLoop : zone.spaceIndexes) { + auto const &thisSpace = state.dataHeatBal->space(spaceNumLoop); for (int surfNum = thisSpace.HTSurfaceFirst; surfNum <= thisSpace.HTSurfaceLast; ++surfNum) { Real64 SurfTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(surfNum); if (SurfTemp < Tmin) From dfc62d973ccaab337714aad06243312eef8ccfd3 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 22:20:18 -0400 Subject: [PATCH 025/108] Const vars --- src/EnergyPlus/DataSurfaces.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index c5114717f9e..070b22cb218 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -238,10 +238,10 @@ Real64 SurfaceData::getInsideAirTemperature(EnergyPlusData &state, const int t_S // determine supply air conditions Real64 SumSysMCp = 0; Real64 SumSysMCpT = 0; - auto &inletNodes = (state.dataHeatBal->doSpaceHeatBalance) ? state.dataZoneEquip->spaceEquipConfig(this->spaceNum).InletNode + auto const &inletNodes = (state.dataHeatBal->doSpaceHeatBalance) ? state.dataZoneEquip->spaceEquipConfig(this->spaceNum).InletNode : state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode; for (int nodeNum : inletNodes) { - auto &inNode = state.dataLoopNodes->Node(nodeNum); + auto const &inNode = state.dataLoopNodes->Node(nodeNum); Real64 CpAir = PsyCpAirFnW(thisSpaceHB.airHumRat); SumSysMCp += inNode.MassFlowRate * CpAir; SumSysMCpT += inNode.MassFlowRate * CpAir * inNode.Temp; From 48e468f39c6a01fe2505188c268fc9c874fcfe8d Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 22:26:59 -0400 Subject: [PATCH 026/108] Unused var --- src/EnergyPlus/DataZoneEquipment.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EnergyPlus/DataZoneEquipment.cc b/src/EnergyPlus/DataZoneEquipment.cc index 56e0952aac1..20d7b7729a8 100644 --- a/src/EnergyPlus/DataZoneEquipment.cc +++ b/src/EnergyPlus/DataZoneEquipment.cc @@ -751,10 +751,8 @@ void processZoneEquipmentInput(EnergyPlusData &state, Array1D_int &NodeNums) { static constexpr std::string_view RoutineName("processZoneEquipmentInput: "); // include trailing blank space - std::string_view zsString = "Zone"; int spaceFieldShift = 0; if (isSpace) { - zsString = "Space"; spaceFieldShift = -1; } From 5f5ef50f2d1d52a9df7491f092699b6b442d56c0 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 22:37:53 -0400 Subject: [PATCH 027/108] Const and shadow vars --- src/EnergyPlus/DataZoneEquipment.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/DataZoneEquipment.cc b/src/EnergyPlus/DataZoneEquipment.cc index 20d7b7729a8..869dfd51857 100644 --- a/src/EnergyPlus/DataZoneEquipment.cc +++ b/src/EnergyPlus/DataZoneEquipment.cc @@ -1386,7 +1386,7 @@ void processZoneEquipMixerInput(EnergyPlusData &state, NodeInputManager::CompFluidStream::Primary, objectIsParent); // Check space exhaust nodes - bool found = false; + found = false; auto &thisSpaceEquipConfig = state.dataZoneEquip->spaceEquipConfig(thisZeqSpace.spaceIndex); for (int exhNodeNum : thisSpaceEquipConfig.ExhaustNode) { if (thisZeqSpace.spaceNodeNum == exhNodeNum) { @@ -1478,7 +1478,7 @@ void processZoneReturnMixerInput(EnergyPlusData &state, NodeInputManager::CompFluidStream::Primary, objectIsParent); // Check space return nodes - bool found = false; + found = false; auto &thisSpaceEquipConfig = state.dataZoneEquip->spaceEquipConfig(thisZeqSpace.spaceIndex); for (int retNodeNum : thisSpaceEquipConfig.ReturnNode) { if (thisZeqSpace.spaceNodeNum == retNodeNum) { @@ -1828,7 +1828,7 @@ void scaleInletFlows(EnergyPlusData &state, int const zoneNodeNum, int const spa { assert(zoneNodeNum > 0); assert(spaceNodeNum > 0); - auto &zoneNode = state.dataLoopNodes->Node(zoneNodeNum); + auto const &zoneNode = state.dataLoopNodes->Node(zoneNodeNum); auto &spaceNode = state.dataLoopNodes->Node(spaceNodeNum); spaceNode.MassFlowRate = zoneNode.MassFlowRate * frac; spaceNode.MassFlowRateMax = zoneNode.MassFlowRateMax * frac; @@ -1942,7 +1942,7 @@ void ZoneMixer::setOutletConditions(EnergyPlusData &state) Real64 sumFractions = 0.0; auto &outletNode = state.dataLoopNodes->Node(this->outletNodeNum); for (auto &mixerSpace : this->spaces) { - auto &spaceOutletNode = state.dataLoopNodes->Node(mixerSpace.spaceNodeNum); + auto const &spaceOutletNode = state.dataLoopNodes->Node(mixerSpace.spaceNodeNum); sumEnthalpy += spaceOutletNode.Enthalpy * mixerSpace.fraction; sumHumRat += spaceOutletNode.HumRat * mixerSpace.fraction; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { @@ -1977,7 +1977,7 @@ void ZoneReturnMixer::setInletConditions(EnergyPlusData &state) for (auto &mixerSpace : this->spaces) { auto &spaceOutletNode = state.dataLoopNodes->Node(mixerSpace.spaceNodeNum); int spaceZoneNodeNum = state.dataZoneEquip->spaceEquipConfig(mixerSpace.spaceIndex).ZoneNode; - auto &spaceNode = state.dataLoopNodes->Node(spaceZoneNodeNum); + auto const &spaceNode = state.dataLoopNodes->Node(spaceZoneNodeNum); spaceOutletNode.Temp = spaceNode.Temp; spaceOutletNode.HumRat = spaceNode.HumRat; spaceOutletNode.Enthalpy = spaceNode.Enthalpy; @@ -2116,7 +2116,7 @@ void ZoneEquipmentSplitter::distributeOutput(EnergyPlusData &state, Real64 spaceFraction = splitterSpace.fraction; if (this->tstatControl == DataZoneEquipment::ZoneEquipTstatControl::Ideal) { // Proportion output by sensible space load / zone load (varies every timestep, overrides outputFraction) - auto &thisZoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum); + auto const &thisZoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum); if (thisZoneSysEnergyDemand.RemainingOutputRequired != 0.0) { spaceFraction = state.dataZoneEnergyDemand->spaceSysEnergyDemand(splitterSpace.spaceIndex).RemainingOutputRequired / thisZoneSysEnergyDemand.RemainingOutputRequired; @@ -2127,7 +2127,7 @@ void ZoneEquipmentSplitter::distributeOutput(EnergyPlusData &state, Real64 spaceLatOutputProvided = latOutputProvided * spaceFraction; state.dataZoneTempPredictorCorrector->spaceHeatBalance(splitterSpace.spaceIndex).NonAirSystemResponse += nonAirSysOutput * spaceFraction; if (this->zoneEquipOutletNodeNum > 0 && splitterSpace.spaceNodeNum > 0) { - auto &equipOutletNode = state.dataLoopNodes->Node(this->zoneEquipOutletNodeNum); + auto const &equipOutletNode = state.dataLoopNodes->Node(this->zoneEquipOutletNodeNum); auto &spaceInletNode = state.dataLoopNodes->Node(splitterSpace.spaceNodeNum); spaceInletNode.MassFlowRate = equipOutletNode.MassFlowRate * spaceFraction; spaceInletNode.MassFlowRateMaxAvail = equipOutletNode.MassFlowRateMaxAvail * spaceFraction; @@ -2272,7 +2272,7 @@ void EquipConfiguration::calcReturnFlows(EnergyPlusData &state, // Establish corresponding airloop inlet(s) mass flow rate and set return node max/min/maxavail Real64 inletMassFlow = 0.0; int maxMinNodeNum = 0; - auto &thisAirLoopFlow(state.dataAirLoop->AirLoopFlow(airLoop)); + auto const &thisAirLoopFlow(state.dataAirLoop->AirLoopFlow(airLoop)); if (ADUNum > 0) { // Zone return node could carry supply flow to zone without leaks plus any induced flow from plenum (but don't include other // secondary flows from exhaust nodes) From 9e1edaf4aa04a323d9cb2b5aa0ff9b0fe67a7e5e Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 22:44:11 -0400 Subject: [PATCH 028/108] eoh shadow --- src/EnergyPlus/DesiccantDehumidifiers.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/DesiccantDehumidifiers.cc b/src/EnergyPlus/DesiccantDehumidifiers.cc index 6825198c6a7..5b26d322892 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.cc +++ b/src/EnergyPlus/DesiccantDehumidifiers.cc @@ -808,7 +808,6 @@ namespace DesiccantDehumidifiers { ErrorsFound2 = false; desicDehum.RegenFanIndex = Fans::GetFanIndex(state, desicDehum.RegenFanName); if (desicDehum.RegenFanIndex == 0) { - ErrorObjectHeader eoh{routineName, CurrentModuleObject, desicDehum.Name}; ShowSevereItemNotFound(state, eoh, cAlphaFields(7), desicDehum.RegenFanName); ErrorsFoundGeneric = true; } else { From 90cda87c7488726737a150740f8208bff8dfeaad Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 22:47:51 -0400 Subject: [PATCH 029/108] Shadow var Ctd --- src/EnergyPlus/DisplacementVentMgr.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/DisplacementVentMgr.cc b/src/EnergyPlus/DisplacementVentMgr.cc index 8452743a5c7..3c687532b1d 100644 --- a/src/EnergyPlus/DisplacementVentMgr.cc +++ b/src/EnergyPlus/DisplacementVentMgr.cc @@ -530,7 +530,6 @@ namespace RoomAir { Real64 ZTAveraged; Real64 TempDiffCritRep; // Minimum temperature difference between mixed and occupied subzones for reporting bool MIXFLAG; - int Ctd; Real64 MinFlow; Real64 NumPLPP; // Number of plumes per person Real64 MTGAUX; @@ -656,7 +655,7 @@ namespace RoomAir { if (state.dataHeatBal->TotPeople > 0) { int NumberOfOccupants = 0; NumberOfPlumes = 0.0; - for (Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) { + for (int Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) { if (state.dataHeatBal->People(Ctd).ZonePtr == ZoneNum) { NumberOfOccupants += state.dataHeatBal->People(Ctd).NumberOfPeople; // *GetCurrentScheduleValue(state, People(Ctd)%NumberOfPeoplePtr) @@ -727,7 +726,7 @@ namespace RoomAir { } else { Real64 const plume_fac(NumberOfPlumes * std::pow(PowerPerPlume, OneThird)); HeightFrac = min(24.55 * std::pow(MCp_Total * 0.000833 / plume_fac, 0.6) / CeilingHeight, 1.0); - for (Ctd = 1; Ctd <= 4; ++Ctd) { + for (int Ctd = 1; Ctd <= 4; ++Ctd) { HcDispVent3Node(state, ZoneNum, HeightFrac); // HeightFrac = min( 24.55 * std::pow( MCp_Total * 0.000833 / ( NumberOfPlumes * std::pow( PowerPerPlume, OneThird ) ), 0.6 ) / // CeilingHeight, 1.0 ); //Tuned This does not vary in loop EPTeam-replaces above (cause diffs) HeightFrac = @@ -893,7 +892,7 @@ namespace RoomAir { Real64 AirCap = thisZoneHB.AirPowerCap; TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + OneThird * thisZoneHB.ZTM[2]); - for (Ctd = 1; Ctd <= 3; ++Ctd) { + for (int Ctd = 1; Ctd <= 3; ++Ctd) { TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total; TempIndCoef = ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total; From b8809419466c2f00387b6f6f7b51310b075c5278 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 22:58:04 -0400 Subject: [PATCH 030/108] unused and unused outer shadow --- src/EnergyPlus/EconomicTariff.cc | 3 --- src/EnergyPlus/EvaporativeCoolers.cc | 8 -------- 2 files changed, 11 deletions(-) diff --git a/src/EnergyPlus/EconomicTariff.cc b/src/EnergyPlus/EconomicTariff.cc index dd19831efe9..cb2ec0a5f6a 100644 --- a/src/EnergyPlus/EconomicTariff.cc +++ b/src/EnergyPlus/EconomicTariff.cc @@ -3879,9 +3879,6 @@ void LEEDtariffReporting(EnergyPlusData &state) Real64 distHeatWaterTotalCost; Real64 distHeatSteamTotalCost; Real64 allTotalCost; - std::string distCoolTariffNames; - std::string distHeatWaterTariffNames; - std::string distHeatSteamTariffNames; EconConv elecUnits; EconConv gasUnits; EconConv distCoolUnits; diff --git a/src/EnergyPlus/EvaporativeCoolers.cc b/src/EnergyPlus/EvaporativeCoolers.cc index 7ba25e28ab2..ae2801a861e 100644 --- a/src/EnergyPlus/EvaporativeCoolers.cc +++ b/src/EnergyPlus/EvaporativeCoolers.cc @@ -3370,7 +3370,6 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) int NumNumbers; // Number of Numbers for each GetObjectItem call int NumFields; // Total number of fields in object bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - Real64 FanVolFlow; auto &EvapCond(state.dataEvapCoolers->EvapCond); auto &ZoneEvapUnit(state.dataEvapCoolers->ZoneEvapUnit); @@ -3468,7 +3467,6 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) } thisZoneEvapUnit.FanName = Alphas(8); - bool errFlag = false; thisZoneEvapUnit.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(7))); assert(thisZoneEvapUnit.fanType != HVAC::FanType::Invalid); @@ -3490,12 +3488,6 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) // with used for ZONECOOLINGLOADVARIABLESPEEDFAN Cooler Unit Control Method thisZoneEvapUnit.fanOp = HVAC::FanOp::Cycling; - FanVolFlow = 0.0; - if (errFlag) { - ShowContinueError(state, format("specified in {} = {}", CurrentModuleObject, thisZoneEvapUnit.Name)); - ErrorsFound = true; - } - thisZoneEvapUnit.DesignAirVolumeFlowRate = Numbers(1); thisZoneEvapUnit.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(9))); From 59a7fccc48d0e70aab0a45fb9e00e0df1d5efd3e Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 23:02:03 -0400 Subject: [PATCH 031/108] Shadow var and unused --- src/EnergyPlus/Fans.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/Fans.cc b/src/EnergyPlus/Fans.cc index e406c30b18c..6252888f20e 100644 --- a/src/EnergyPlus/Fans.cc +++ b/src/EnergyPlus/Fans.cc @@ -846,7 +846,7 @@ void GetFanInput(EnergyPlusData &state) } // end Number of Component Model FAN Loop for (int SystemFanNum = 1; SystemFanNum <= NumSystemModelFan; ++SystemFanNum) { - constexpr std::string_view cCurrentModuleObject = "Fan:SystemModel"; + cCurrentModuleObject = "Fan:SystemModel"; ip->getObjectItem(state, cCurrentModuleObject, @@ -1343,8 +1343,7 @@ void FanComponent::set_size(EnergyPlusData &state) static constexpr std::string_view routineName = "FanComponent::set_size()"; // include trailing blank space // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool _bPRINT = true; // TRUE if sizing is reported to output (eio) - int NumFansSized = 0; // counter used to deallocate temporary string array after all fans have been sized + bool _bPRINT = true; // TRUE if sizing is reported to output (eio) std::string SizingString = sizingPrefix + " [m3/s]"; From 9f5ecf875639bec10a59aa16701b150ce9226b50 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 23:10:06 -0400 Subject: [PATCH 032/108] const vars --- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 02ac21f63f6..10e2ed3df8a 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -8467,7 +8467,7 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, // REFERENCES: // (I)BLAST legacy routine HBSRF - auto &Surface = state.dataSurface->Surface; + auto const &Surface = state.dataSurface->Surface; constexpr std::string_view Inside("Inside"); @@ -8652,7 +8652,7 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, // Loop over non-window surfaces for (int zoneNum = FirstZone; zoneNum <= LastZone; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); int const firstNonWinSurf = thisSpace.OpaqOrIntMassSurfaceFirst; int const lastNonWinSurf = thisSpace.OpaqOrIntMassSurfaceLast; Real64 const iterDampConstant = DataHeatBalSurface::IterDampConst; // local for vectorization @@ -9056,7 +9056,7 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, void sumSurfQdotRadHVAC(EnergyPlusData &state) { for (int surfNum : state.dataSurface->allGetsRadiantHeatSurfaceList) { - auto &thisSurfQRadFromHVAC = state.dataHeatBalFanSys->surfQRadFromHVAC(surfNum); + auto const &thisSurfQRadFromHVAC = state.dataHeatBalFanSys->surfQRadFromHVAC(surfNum); state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(surfNum) = thisSurfQRadFromHVAC.HTRadSys + thisSurfQRadFromHVAC.HWBaseboard + thisSurfQRadFromHVAC.SteamBaseboard + thisSurfQRadFromHVAC.ElecBaseboard + thisSurfQRadFromHVAC.CoolingPanel; From 8a1be36e08ad81c8d3cbf31c45cbcc763b597798 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 23:19:23 -0400 Subject: [PATCH 033/108] Const and shadow --- src/EnergyPlus/HighTempRadiantSystem.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 6f473477adc..245b5ea1acd 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -811,7 +811,7 @@ namespace HighTempRadiantSystem { // Determine the current setpoint temperature and the temperature at which the unit should be completely off Real64 SetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SetptSchedPtr); Real64 OffTemp = SetPtTemp + 0.5 * thisHTR.ThrottlRange; - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); Real64 OpTemp = (thisZoneHB.MAT + thisZoneHB.MRT) / 2.0; // Approximate the "operative" temperature // Determine the fraction of maximum power to the unit (limiting the fraction range from zero to unity) @@ -904,7 +904,7 @@ namespace HighTempRadiantSystem { // First determine whether or not the unit should be on // Determine the proper temperature on which to control - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); switch (thisHTR.ControlType) { case RadControlType::MATSPControl: { ZoneTemp = thisZoneHB.MAT; @@ -950,16 +950,16 @@ namespace HighTempRadiantSystem { HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); // Redetermine the current value of the controlling temperature - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto &thisZoneHBMod = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); switch (thisHTR.ControlType) { case RadControlType::MATControl: { - ZoneTemp = thisZoneHB.MAT; + ZoneTemp = thisZoneHBMod.MAT; } break; case RadControlType::MRTControl: { - ZoneTemp = thisZoneHB.MRT; + ZoneTemp = thisZoneHBMod.MRT; } break; case RadControlType::OperativeControl: { - ZoneTemp = 0.5 * (thisZoneHB.MAT + thisZoneHB.MRT); + ZoneTemp = 0.5 * (thisZoneHBMod.MAT + thisZoneHBMod.MRT); } break; default: break; From ae23d5ebe44331e6bb6defa6f525a5cdcf58416e Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Aug 2024 23:23:27 -0400 Subject: [PATCH 034/108] all scope vars --- src/EnergyPlus/Humidifiers.cc | 50 +++++++++++++++-------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/src/EnergyPlus/Humidifiers.cc b/src/EnergyPlus/Humidifiers.cc index a6a788bac32..b17a2764e66 100644 --- a/src/EnergyPlus/Humidifiers.cc +++ b/src/EnergyPlus/Humidifiers.cc @@ -129,7 +129,6 @@ namespace Humidifiers { auto &Humidifier = state.dataHumidifiers->Humidifier; int NumHumidifiers = state.dataHumidifiers->NumHumidifiers; - auto &CheckEquipName = state.dataHumidifiers->CheckEquipName; if (state.dataHumidifiers->GetInputFlag) { GetHumidifierInput(state); @@ -150,6 +149,7 @@ namespace Humidifiers { state, format("SimHumidifier: Invalid CompIndex passed={}, Number of Units={}, Entered Unit name={}", HumNum, NumHumidifiers, CompName)); } + auto &CheckEquipName = state.dataHumidifiers->CheckEquipName; if (CheckEquipName(HumNum)) { if (CompName != Humidifier(HumNum).Name) { ShowFatalError(state, @@ -742,31 +742,27 @@ namespace Humidifiers { // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string ModuleObjectType; // for ease in getting objects - int RefrigerantIndex; // refrigerant index - int WaterIndex; // fluid type index - Real64 NominalPower; // Nominal power input to humidifier, W - Real64 WaterSpecHeatAvg; // specific heat of water, J/kgK - Real64 SteamSatEnthalpy; // enthalpy of saturated steam at 100C, J/kg - Real64 WaterSatEnthalpy; // enthalpy of saturated water at 100C, J/kg - bool IsAutoSize; // Indicator to autosize - bool HardSizeNoDesRun; // Indicator to a hard-sized field with no design sizing data - bool ErrorsFound(false); // TRUE if errors detected in input - Real64 NomPowerDes; // Autosized nominal power for reporting - Real64 NomPowerUser; // Hardsized nominal power for reporting - Real64 MassFlowDes; // Design air mass flow rate - Real64 InletHumRatDes; // Design inlet humidity ratio - Real64 OutletHumRatDes; // Design outlet humidity ratio - Real64 NomCapVolDes; // Autosized Nominal capacity volume for reporting - Real64 NomCapVolUser; // HardSized nominal capacity volume for reporting - Real64 AirVolFlow; // Design air volume flow rate - Real64 AirDensity; // Density of air + Real64 NominalPower; // Nominal power input to humidifier, W + Real64 WaterSpecHeatAvg; // specific heat of water, J/kgK + Real64 SteamSatEnthalpy; // enthalpy of saturated steam at 100C, J/kg + Real64 WaterSatEnthalpy; // enthalpy of saturated water at 100C, J/kg + bool ErrorsFound(false); // TRUE if errors detected in input + Real64 NomPowerDes; // Autosized nominal power for reporting + Real64 NomPowerUser; // Hardsized nominal power for reporting + Real64 MassFlowDes; // Design air mass flow rate + Real64 InletHumRatDes; // Design inlet humidity ratio + Real64 OutletHumRatDes; // Design outlet humidity ratio + Real64 NomCapVolDes; // Autosized Nominal capacity volume for reporting + Real64 NomCapVolUser; // HardSized nominal capacity volume for reporting + Real64 AirVolFlow; // Design air volume flow rate + Real64 AirDensity; // Density of air if (HumType == HumidType::Electric || HumType == HumidType::Gas) { - IsAutoSize = false; - HardSizeNoDesRun = false; + bool IsAutoSize = false; + bool HardSizeNoDesRun = false; NomPowerDes = 0.0; NomPowerUser = 0.0; + std::string ModuleObjectType; // for ease in getting objects if (HumType == HumidType::Electric) { ModuleObjectType = "electric"; @@ -878,8 +874,8 @@ namespace Humidifiers { } NomCap = RhoH2O(Constant::InitConvTemp) * NomCapVol; - RefrigerantIndex = FluidProperties::GetRefrigNum(state, format(fluidNameSteam)); - WaterIndex = FluidProperties::GetGlycolNum(state, format(fluidNameWater)); + int RefrigerantIndex = FluidProperties::GetRefrigNum(state, format(fluidNameSteam)); + int WaterIndex = FluidProperties::GetGlycolNum(state, format(fluidNameWater)); SteamSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 1.0, RefrigerantIndex, CalledFrom); WaterSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 0.0, RefrigerantIndex, CalledFrom); WaterSpecHeatAvg = 0.5 * (GetSpecificHeatGlycol(state, format(fluidNameWater), TSteam, WaterIndex, CalledFrom) + @@ -1189,8 +1185,6 @@ namespace Humidifiers { Real64 SteamSatEnthalpy; // enthalpy of saturated steam at 100C [J/kg] Real64 WaterSatEnthalpy; // enthalpy of saturated water at 100C [J/kg] Real64 Tref; // humidifier entering water temperature [C] - int RefrigerantIndex; // refiferant index - int WaterIndex; // fluid type index HumRatSatIn = PsyWFnTdbRhPb(state, AirInTemp, 1.0, state.dataEnvrn->OutBaroPress, RoutineName); HumRatSatOut = 0.0; @@ -1252,8 +1246,8 @@ namespace Humidifiers { CurMakeupWaterTemp = state.dataEnvrn->WaterMainsTemp; } Tref = CurMakeupWaterTemp; - RefrigerantIndex = FluidProperties::GetRefrigNum(state, format(fluidNameSteam)); - WaterIndex = FluidProperties::GetGlycolNum(state, format(fluidNameWater)); + int RefrigerantIndex = FluidProperties::GetRefrigNum(state, format(fluidNameSteam)); + int WaterIndex = FluidProperties::GetGlycolNum(state, format(fluidNameWater)); SteamSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 1.0, RefrigerantIndex, RoutineName); WaterSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 0.0, RefrigerantIndex, RoutineName); WaterSpecHeatAvg = 0.5 * (GetSpecificHeatGlycol(state, format(fluidNameWater), TSteam, WaterIndex, RoutineName) + From cd341d64351b696beea4427d928af3e08f7c9c8d Mon Sep 17 00:00:00 2001 From: LipingWang Date: Thu, 22 Aug 2024 11:52:17 -0400 Subject: [PATCH 035/108] Update IO reference. --- ...oup-internal-gains-people-lights-other.tex | 45 ++++++++++++++++++- src/EnergyPlus/IndoorGreen.cc | 4 +- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/doc/input-output-reference/src/overview/group-internal-gains-people-lights-other.tex b/doc/input-output-reference/src/overview/group-internal-gains-people-lights-other.tex index b28a226c678..526a1be444f 100644 --- a/doc/input-output-reference/src/overview/group-internal-gains-people-lights-other.tex +++ b/doc/input-output-reference/src/overview/group-internal-gains-people-lights-other.tex @@ -2431,7 +2431,7 @@ \subsubsection{Outputs}\label{outputs-indoorlivingwall} \item Zone,Average,Indoor Living Wall Evapotranspiration Rate {[}\si{\evapotranspirationRate}{]} \item - Zone,Average,Indoor Living Wall Energy Required For Evapotranspiration Per Unit Area {[}\si{\watt\per\area}{]} + Zone,Average,Indoor Living Wall Energy Rate Required For Evapotranspiration Per Unit Area {[}\si{\watt\per\area}{]} \item Zone,Average,Indoor Living Wall LED Operational PPFD {[}\si{\umolperAreaperSecond}{]} \item @@ -2446,7 +2446,50 @@ \subsubsection{Outputs}\label{outputs-indoorlivingwall} Zone,Sum,Indoor Living Wall LED Electricity Energy {[}J{]} \end{itemize} +\paragraph{Indoor Living Wall Plant Surface Temperature {[}C{]}}\label{indoor-living-wall-plant-surface-temperature-c} +This output is the plant surface temperature in C. Plant surface temperature is determined using surface heat balance of indoor living walls. + +\paragraph{Indoor Living Wall Sensible Heat Gain Rate {[}W{]}}\label{indoor-living-wall-sensible-heat-gain-rate-w} + +This output is the sensible heat gain rate from indoor living walls in W and determined by surface heat balance. Positive sign represents heat loss from plants or heat gain to indoor space; negative sign represents heat gain to plants or heat loss from indoor space. + +\paragraph{Indoor Living Wall Latent Heat Gain Rate {[}W{]}}\label{indoor-living-wall-latent-heat-gain-rate-w} + +This output is the latent heat gain rate from indoor living walls in W. Latent heat gain is determined based on the increase of enthalpy due to the increase of absolute humidity (or humidity ratio) from plant evapotranspiration. + +\paragraph{Indoor Living Wall Evapotranspiration Rate {[}\si{\evapotranspirationRate}{]}}\label{indoor-living-wall-evapotranspiration-rate} + +This output is evapotranspiration (ET) rate of indoor living walls in \si{\evapotranspirationRate}. The ET rate is directly calculated by ET models(Penman-Monteith model, Stanghellini model or ET model from users). + +\paragraph{Indoor Living Wall Energy Rate Required For Evapotranspiration Per Unit Area {[}\si{\watt\per\area}{]}}\label{indoor-living-wall-evapotranspiration-per-unit-area} + +This output is energy rate per unit area required for plant evapotranspiration (ET) of indoor living walls in \si{\watt\per\area}. The energy rate per unit area for ET is determined by latent heat of vaporization for total ET over time period and surface area. + +\paragraph{Indoor Living Wall LED Operational PPFD {[}\si{\umolperAreaperSecond}{]}}\label{indoor-living-wall-led-operational-ppfd} + +This output is operational photosynthetic photon flux density (PPFD) of LED light in \si{\umolperAreaperSecond}. The operational PPFD of LED light is determined based on lighting method. If lighting method is Daylight, the operational LED PPFD is zero. If lighting method is LED, the operational LED PPFD is nominal LED PPFD. If lighting method is LED-Daylight, the operational LED PPFD is calculated based on targeted PPFD and daylighting level with the consideration of nominal LED PPFD. + +\paragraph{Indoor Living Wall PPFD {[}\si{\umolperAreaperSecond}{]}}\label{indoor-living-wall-ppfd} + +This output is the actual PPFD including LED and/or daylight for indoor living walls in \si{\umolperAreaperSecond}. + +\paragraph{Indoor Living Wall Vapor Pressure Deficit {[}Pa{]}}\label{indoor-living-wall-vpd-pa} + +This output is the vapor pressure deficit in Pa. The output represents the difference between saturated vapor pressure and vapor pressure of the moist air of current condition. + +\paragraph{Indoor Living Wall LED Sensible Heat Gain Rate {[}W{]}}\label{indoor-living-wall-led-sensible-heat-gain-rate-w} + +This output is the LED sensible heat gain rate for indoor living walls in W. The output determines convective heat gain from LED lights when LED lights are on. + +\paragraph{Indoor Living Wall LED Operational Power {[}W{]}}\label{indoor-living-wall-led-operational-power-w} + +This output is LED operational power for indoor living walls in W. The LED operational power is determined by LED nominal power in proportion to the ratio of LED operational PPFD to LED nominal PPFD. + +\paragraph{Indoor Living Wall LED Electricity Energy {[}J{]}}\label{indoor-living-wall-led-electricity-energy-j} + +This output is LED electricity energy for indoor living walls in J. The LED electricity energy is calculated by LED operational power multiplied by time period. + \subsection{ElectricEquipment:ITE:AirCooled}\label{electricequipmentiteaircooled} This object describes air-cooled electric information technology equipment (ITE) which has variable power consumption as a function of loading and temperature. diff --git a/src/EnergyPlus/IndoorGreen.cc b/src/EnergyPlus/IndoorGreen.cc index 2dfae769f0e..8a7ed266283 100644 --- a/src/EnergyPlus/IndoorGreen.cc +++ b/src/EnergyPlus/IndoorGreen.cc @@ -381,7 +381,7 @@ namespace IndoorGreen { state, "Indoor Living Wall Sensible Heat Gain Rate", Constant::Units::W, - state.dataHeatBalSurf->SurfQConvInRep(ig.SurfPtr), // positive sign: heat loss from plants; negative sign: heat gain from plants + state.dataHeatBalSurf->SurfQConvInRep(ig.SurfPtr), // positive sign: heat loss from plants; negative sign: heat gain to plants OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, ig.Name); @@ -400,7 +400,7 @@ namespace IndoorGreen { OutputProcessor::StoreType::Average, ig.Name); SetupOutputVariable(state, - "Indoor Living Wall Energy Required For Evapotranspiration Per Unit Area", + "Indoor Living Wall Energy Rate Required For Evapotranspiration Per Unit Area", Constant::Units::W_m2, ig.LambdaET, OutputProcessor::TimeStepType::Zone, From 19b94b8bda9f9fb15edc61c125dd25b3abb8f671 Mon Sep 17 00:00:00 2001 From: LipingWang Date: Thu, 22 Aug 2024 12:26:30 -0400 Subject: [PATCH 036/108] format update --- src/EnergyPlus/IndoorGreen.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/IndoorGreen.cc b/src/EnergyPlus/IndoorGreen.cc index 8a7ed266283..19d73bd4366 100644 --- a/src/EnergyPlus/IndoorGreen.cc +++ b/src/EnergyPlus/IndoorGreen.cc @@ -585,7 +585,9 @@ namespace IndoorGreen { // plants was considered and counted from plant surface heat balance. ig.LatentRate = ZoneAirVol * rhoair * (HCons - HMid) / Timestep; // unit W state.dataHeatBalSurf->SurfQAdditionalHeatSourceInside(ig.SurfPtr) = - -1.0 * ig.LambdaET+ ig.LEDRadFraction * 0.9 * ig.LEDActualEleP / state.dataSurface->Surface(ig.SurfPtr).Area; //assume the energy from radiation for photosynthesis is only 10%. + -1.0 * ig.LambdaET + + ig.LEDRadFraction * 0.9 * ig.LEDActualEleP / + state.dataSurface->Surface(ig.SurfPtr).Area; // assume the energy from radiation for photosynthesis is only 10%. } } From b58fc29f7769b49fd39d8ca93ea68590f6fe1c19 Mon Sep 17 00:00:00 2001 From: LipingWang Date: Thu, 22 Aug 2024 13:13:48 -0400 Subject: [PATCH 037/108] output variable name --- testfiles/IndoorLivingWall.idf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testfiles/IndoorLivingWall.idf b/testfiles/IndoorLivingWall.idf index caf233196ca..a55b2132e1b 100644 --- a/testfiles/IndoorLivingWall.idf +++ b/testfiles/IndoorLivingWall.idf @@ -3118,7 +3118,7 @@ Output:Variable, Output:Variable, *, !- Key Value - Indoor Living Wall Energy Required For Evapotranspiration Per Unit Are, !- Variable Name + Indoor Living Wall Energy Rate Required For Evapotranspiration Per Unit Area, !- Variable Name Timestep; !- Reporting Frequency Output:Variable, From b74c1c42fbcceb2b63eaf5526130304b144bf322 Mon Sep 17 00:00:00 2001 From: LipingWang Date: Thu, 22 Aug 2024 13:19:42 -0400 Subject: [PATCH 038/108] update the csv & remove meters output --- testfiles/IndoorLivingWall.idf | 86 +--------------------------------- 1 file changed, 2 insertions(+), 84 deletions(-) diff --git a/testfiles/IndoorLivingWall.idf b/testfiles/IndoorLivingWall.idf index a55b2132e1b..5959aee9571 100644 --- a/testfiles/IndoorLivingWall.idf +++ b/testfiles/IndoorLivingWall.idf @@ -2911,6 +2911,8 @@ Output:Table:SummaryReports, OutputControl:Table:Style, HTML; !- Column Separator +OutputControl:Files, + Yes; !- Output CSV !- =========== ALL OBJECTS IN CLASS: OUTPUT:VARIABLE =========== @@ -3211,90 +3213,6 @@ Output:Variable, Indoor Living Wall LED Electricity Energy , !- Variable Name Timestep; !- Reporting Frequency - -!- =========== ALL OBJECTS IN CLASS: OUTPUT:METER:METERFILEONLY =========== - -Output:Meter:MeterFileOnly, - Electricity:Facility, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - Electricity:Building, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - InteriorLights:Electricity, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - Electricity:HVAC, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - Electricity:Plant, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - NaturalGas:Facility, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - NaturalGas:Plant, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - Electricity:Facility, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - Electricity:Building, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - InteriorLights:Electricity, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - Electricity:HVAC, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - Electricity:Plant, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - NaturalGas:Facility, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - NaturalGas:Plant, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - MyGeneralLights, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - MyGeneralLights, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - MyBuildingElectric, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - MyBuildingElectric, !- Key Name - runperiod; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - MyBuildingOther, !- Key Name - monthly; !- Reporting Frequency - -Output:Meter:MeterFileOnly, - MyBuildingOther, !- Key Name - runperiod; !- Reporting Frequency - - !- =========== ALL OBJECTS IN CLASS: METER:CUSTOM =========== ! The following custom meters are set up to illustrate the capabilities From 07785492d8295bb3179cdb76dd828e2d0eb948bd Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 22 Aug 2024 12:36:52 -0500 Subject: [PATCH 039/108] Output variable transition and warning cleanup --- .../Report Variables 24-1-0 to 24-2-0.csv | 5 +- testfiles/IndoorLivingWall.idf | 284 +----------------- 2 files changed, 9 insertions(+), 280 deletions(-) diff --git a/src/Transition/SupportFiles/Report Variables 24-1-0 to 24-2-0.csv b/src/Transition/SupportFiles/Report Variables 24-1-0 to 24-2-0.csv index cf61cdd9aca..38fb29be621 100644 --- a/src/Transition/SupportFiles/Report Variables 24-1-0 to 24-2-0.csv +++ b/src/Transition/SupportFiles/Report Variables 24-1-0 to 24-2-0.csv @@ -1,5 +1,5 @@ 24.1.0,24.2.0,Transition notes - some of these are EMS variable names -10,10,These numbers should be the number of report variables in the following list (including deletes). Two columns/numbers. +11,11,These numbers should be the number of report variables in the following list (including deletes). Two columns/numbers. Zone Windows Total Transmitted Solar Radiation Rate,Enclosure Windows Total Transmitted Solar Radiation Rate, Zone Exterior Windows Total Transmitted Beam Solar Radiation Rate,Enclosure Exterior Windows Total Transmitted Beam Solar Radiation Rate, Zone Interior Windows Total Transmitted Beam Solar Radiation Rate,Enclosure Interior Windows Total Transmitted Beam Solar Radiation Rate, @@ -10,4 +10,5 @@ Zone Exterior Windows Total Transmitted Beam Solar Radiation Energy,Enclosure Ex Zone Interior Windows Total Transmitted Beam Solar Radiation Energy,Enclosure Interior Windows Total Transmitted Beam Solar Radiation Energy, Zone Exterior Windows Total Transmitted Diffuse Solar Radiation Energy,Enclosure Exterior Windows Total Transmitted Diffuse Solar Radiation Energy, Zone Interior Windows Total Transmitted Diffuse Solar Radiation Energy,Enclosure Interior Windows Total Transmitted Diffuse Solar Radiation Energy, -old variable name,new variable name,-- add variable names (before this line) and leave off units -- to delete \ No newline at end of file +Indoor Living Wall Energy Required For Evapotranspiration Per Unit Area,Indoor Living Wall Energy Rate Required For Evapotranspiration Per Unit Area, +old variable name,new variable name,-- add variable names (before this line) and leave off units -- to delete diff --git a/testfiles/IndoorLivingWall.idf b/testfiles/IndoorLivingWall.idf index 5959aee9571..880c107dcec 100644 --- a/testfiles/IndoorLivingWall.idf +++ b/testfiles/IndoorLivingWall.idf @@ -111,9 +111,9 @@ Version, !- =========== ALL OBJECTS IN CLASS: SIMULATIONCONTROL =========== SimulationControl, - Yes, !- Do Zone Sizing Calculation - Yes, !- Do System Sizing Calculation - Yes, !- Do Plant Sizing Calculation + No, !- Do Zone Sizing Calculation + No, !- Do System Sizing Calculation + No, !- Do Plant Sizing Calculation No, !- Run Simulation for Sizing Periods Yes, !- Run Simulation for Weather File Run Periods No, !- Do HVAC Sizing Simulation for Sizing Periods @@ -308,14 +308,6 @@ ScheduleTypeLimits, !- =========== ALL OBJECTS IN CLASS: SCHEDULE:COMPACT =========== -Schedule:Compact, - AlwaysOff, !- Name - Fraction, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 0; !- Field 4 - Schedule:Compact, AlwaysOn, !- Name Fraction, !- Schedule Type Limits Name @@ -429,241 +421,6 @@ Schedule:Compact, Until: 24:00, !- Field 3 117.239997864; !- Field 4 -Schedule:Compact, - ShadeTransSch, !- Name - Fraction, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 0.0; !- Field 4 - -Schedule:Compact, - Htg-SetP-Sch, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: SummerDesignDay, !- Field 2 - Until: 24:00, !- Field 3 - 16.7, !- Field 4 - For: WinterDesignDay, !- Field 5 - Until: 24:00, !- Field 6 - 22.2, !- Field 7 - For: WeekDays, !- Field 8 - Until: 6:00, !- Field 9 - 16.7, !- Field 10 - Until: 20:00, !- Field 11 - 22.2, !- Field 12 - Until: 24:00, !- Field 13 - 16.7, !- Field 14 - For: WeekEnds Holiday, !- Field 15 - Until: 24:00, !- Field 16 - 16.7, !- Field 17 - For: AllOtherDays, !- Field 18 - Until: 24:00, !- Field 19 - 16.7; !- Field 20 - -Schedule:Compact, - PlenumHtg-SetP-Sch, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 12.8; !- Field 4 - -Schedule:Compact, - Clg-SetP-Sch, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: SummerDesignDay, !- Field 2 - Until: 24:00, !- Field 3 - 23.9, !- Field 4 - For: WinterDesignDay, !- Field 5 - Until: 24:00, !- Field 6 - 29.4, !- Field 7 - For: WeekDays, !- Field 8 - Until: 6:00, !- Field 9 - 29.4, !- Field 10 - Until: 20:00, !- Field 11 - 23.9, !- Field 12 - Until: 24:00, !- Field 13 - 29.4, !- Field 14 - For: WeekEnds Holiday, !- Field 15 - Until: 24:00, !- Field 16 - 29.4, !- Field 17 - For: AllOtherDays, !- Field 18 - Until: 24:00, !- Field 19 - 29.4; !- Field 20 - -Schedule:Compact, - PlenumClg-SetP-Sch, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 40.0; !- Field 4 - -Schedule:Compact, - Zone Control Type Sched, !- Name - Control Type, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: SummerDesignDay, !- Field 2 - Until: 24:00, !- Field 3 - 2, !- Field 4 - For: WinterDesignDay, !- Field 5 - Until: 24:00, !- Field 6 - 1, !- Field 7 - For: AllOtherDays, !- Field 8 - Until: 24:00, !- Field 9 - 4; !- Field 10 - -Schedule:Compact, - Min OA Sched, !- Name - Fraction, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: Weekdays, !- Field 2 - Until: 6:00, !- Field 3 - 0.02, !- Field 4 - Until: 20:00, !- Field 5 - 1.0, !- Field 6 - Until: 24:00, !- Field 7 - 0.02, !- Field 8 - For: AllOtherDays, !- Field 9 - Until: 24:00, !- Field 10 - 0.02; !- Field 11 - -Schedule:Compact, - FanAvailSched, !- Name - Fraction, !- Schedule Type Limits Name - Through: 3/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 1.0, !- Field 4 - Through: 9/30, !- Field 5 - For: WeekDays, !- Field 6 - Until: 6:00, !- Field 7 - 0.0, !- Field 8 - Until: 20:00, !- Field 9 - 1.0, !- Field 10 - Until: 24:00, !- Field 11 - 0.0, !- Field 12 - For: SummerDesignDay WinterDesignDay, !- Field 13 - Until: 24:00, !- Field 14 - 1.0, !- Field 15 - For: AllOtherDays, !- Field 16 - Until: 24:00, !- Field 17 - 0.0, !- Field 18 - Through: 12/31, !- Field 19 - For: AllDays, !- Field 20 - Until: 24:00, !- Field 21 - 1.0; !- Field 22 - -Schedule:Compact, - CoolingCoilAvailSched, !- Name - Fraction, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: WeekDays, !- Field 2 - Until: 6:00, !- Field 3 - 0.0, !- Field 4 - Until: 20:00, !- Field 5 - 1.0, !- Field 6 - Until: 24:00, !- Field 7 - 0.0, !- Field 8 - For: SummerDesignDay WinterDesignDay, !- Field 9 - Until: 24:00, !- Field 10 - 1.0, !- Field 11 - For: AllOtherDays, !- Field 12 - Until: 24:00, !- Field 13 - 0.0; !- Field 14 - -Schedule:Compact, - CoolingPumpAvailSched, !- Name - Fraction, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 1.0; !- Field 4 - -Schedule:Compact, - ReheatCoilAvailSched, !- Name - Fraction, !- Schedule Type Limits Name - Through: 3/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 1.0, !- Field 4 - Through: 9/30, !- Field 5 - For: WeekDays, !- Field 6 - Until: 6:00, !- Field 7 - 0.0, !- Field 8 - Until: 20:00, !- Field 9 - 1.0, !- Field 10 - Until: 24:00, !- Field 11 - 0.0, !- Field 12 - For: SummerDesignDay WinterDesignDay, !- Field 13 - Until: 24:00, !- Field 14 - 1.0, !- Field 15 - For: AllOtherDays, !- Field 16 - Until: 24:00, !- Field 17 - 0.0, !- Field 18 - Through: 12/31, !- Field 19 - For: AllDays, !- Field 20 - Until: 24:00, !- Field 21 - 1.0; !- Field 22 - -Schedule:Compact, - CW Loop Temp Schedule, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 7.22; !- Field 4 - -Schedule:Compact, - HW Loop Temp Schedule, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 82; !- Field 4 - -Schedule:Compact, - PlantOnSched, !- Name - Fraction, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 1.0; !- Field 4 - -Schedule:Compact, - Seasonal Reset Supply Air Temp Sch, !- Name - Temperature, !- Schedule Type Limits Name - Through: 3/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 16.0, !- Field 4 - Through: 9/30, !- Field 5 - For: AllDays, !- Field 6 - Until: 24:00, !- Field 7 - 13.0, !- Field 8 - Through: 12/31, !- Field 9 - For: AllDays, !- Field 10 - Until: 24:00, !- Field 11 - 16.0; !- Field 12 - -Schedule:Compact, - OA Cooling Supply Air Temp Sch, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 11.5; !- Field 4 - -Schedule:Compact, - OA Heating Supply Air Temp Sch, !- Name - Temperature, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, !- Field 3 - 4.5; !- Field 4 - Schedule:Compact, LightingTarget, !- Name Any Number, !- Schedule Type Limits Name @@ -2414,7 +2171,7 @@ Daylighting:Controls, 1, !- Probability Lighting will be Reset When Needed in Manual Stepped Control , !- Glare Calculation Daylighting Reference Point Name , !- Glare Calculation Azimuth Angle of View Direction Clockwise from Zone y-Axis {deg} - 22, !- Maximum Allowable Discomfort Glare Index + , !- Maximum Allowable Discomfort Glare Index , !- DElight Gridding Resolution {m2} ReferenceSouthPartition, !- Daylighting Reference Point 1 Name 1, !- Fraction of Lights Controlled by Reference Point 1 @@ -2865,17 +2622,6 @@ ZoneHVAC:EquipmentConnections, SPACE5-1 Return Outlet; !- Zone Return Air Node or NodeList Name -!- =========== ALL OBJECTS IN CLASS: CURVE:QUADRATIC =========== - -Curve:Quadratic, - BoilerEfficiency, !- Name - 1.0, !- Coefficient1 Constant - 0.0, !- Coefficient2 x - 0.0, !- Coefficient3 x**2 - 0, !- Minimum Value of x - 1; !- Maximum Value of x - - !- =========== ALL OBJECTS IN CLASS: OUTPUT:VARIABLEDICTIONARY =========== Output:VariableDictionary, @@ -2903,7 +2649,7 @@ Output:Surfaces:Drawing, !- =========== ALL OBJECTS IN CLASS: OUTPUT:TABLE:SUMMARYREPORTS =========== Output:Table:SummaryReports, - AllSummaryAndSizingPeriod; !- Report 1 Name + AllSummary; !- Report 1 Name !- =========== ALL OBJECTS IN CLASS: OUTPUTCONTROL:TABLE:STYLE =========== @@ -2911,9 +2657,6 @@ Output:Table:SummaryReports, OutputControl:Table:Style, HTML; !- Column Separator -OutputControl:Files, - Yes; !- Output CSV - !- =========== ALL OBJECTS IN CLASS: OUTPUT:VARIABLE =========== Output:Variable, @@ -3143,21 +2886,6 @@ Output:Variable, Zone Air System Sensible Heating Rate, !- Variable Name Timestep; !- Reporting Frequency -Output:Variable, - *, !- Key Value - Heating Coil Heating Rate, !- Variable Name - Timestep; !- Reporting Frequency - -Output:Variable, - *, !- Key Value - Cooling Coil Total Cooling Rate, !- Variable Name - Timestep; !- Reporting Frequency - -Output:Variable, - *, !- Key Value - Cooling Coil Sensible Cooling Rate, !- Variable Name - Timestep; !- Reporting Frequency - Output:Variable, *, !- Key Value Indoor Living Wall Plant Surface Temperature , !- Variable Name @@ -3195,7 +2923,7 @@ Output:Variable, Output:Variable, *, !- Key Value - Indoor Living Wall VPD , !- Variable Name + Indoor Living Wall Vapor Pressure Deficit , !- Variable Name Timestep; !- Reporting Frequency Output:Variable, From c01f087333f78b1a69083190b909dcb0c206109d Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 21:12:46 -0400 Subject: [PATCH 040/108] Clean up some array references --- src/EnergyPlus/Humidifiers.cc | 290 ++++++++++++++++------------------ 1 file changed, 139 insertions(+), 151 deletions(-) diff --git a/src/EnergyPlus/Humidifiers.cc b/src/EnergyPlus/Humidifiers.cc index b17a2764e66..e59b1dd8ec6 100644 --- a/src/EnergyPlus/Humidifiers.cc +++ b/src/EnergyPlus/Humidifiers.cc @@ -127,9 +127,6 @@ namespace Humidifiers { int HumNum; // index of humidifier unit being simulated Real64 WaterAddNeeded; // output in kg/s needed from humidifier to meet humidity setpoint - auto &Humidifier = state.dataHumidifiers->Humidifier; - int NumHumidifiers = state.dataHumidifiers->NumHumidifiers; - if (state.dataHumidifiers->GetInputFlag) { GetHumidifierInput(state); state.dataHumidifiers->GetInputFlag = false; @@ -137,35 +134,36 @@ namespace Humidifiers { // Get the humidifier unit index if (CompIndex == 0) { - HumNum = Util::FindItemInList(CompName, Humidifier); + HumNum = Util::FindItemInList(CompName, state.dataHumidifiers->Humidifier); if (HumNum == 0) { ShowFatalError(state, format("SimHumidifier: Unit not found={}", CompName)); } CompIndex = HumNum; } else { HumNum = CompIndex; - if (HumNum > NumHumidifiers || HumNum < 1) { - ShowFatalError( - state, - format("SimHumidifier: Invalid CompIndex passed={}, Number of Units={}, Entered Unit name={}", HumNum, NumHumidifiers, CompName)); + if (HumNum > state.dataHumidifiers->NumHumidifiers || HumNum < 1) { + ShowFatalError(state, + format("SimHumidifier: Invalid CompIndex passed={}, Number of Units={}, Entered Unit name={}", + HumNum, + state.dataHumidifiers->NumHumidifiers, + CompName)); } - auto &CheckEquipName = state.dataHumidifiers->CheckEquipName; - if (CheckEquipName(HumNum)) { - if (CompName != Humidifier(HumNum).Name) { + if (state.dataHumidifiers->CheckEquipName(HumNum)) { + if (CompName != state.dataHumidifiers->Humidifier(HumNum).Name) { ShowFatalError(state, format("SimHumidifier: Invalid CompIndex passed={}, Unit name={}, stored Unit Name for that index={}", HumNum, CompName, - Humidifier(HumNum).Name)); + state.dataHumidifiers->Humidifier(HumNum).Name)); } - CheckEquipName(HumNum) = false; + state.dataHumidifiers->CheckEquipName(HumNum) = false; } } if (HumNum <= 0) { ShowFatalError(state, format("SimHumidifier: Unit not found={}", CompName)); } - auto &thisHum(Humidifier(HumNum)); + auto &thisHum = state.dataHumidifiers->Humidifier(HumNum); thisHum.InitHumidifier(state); @@ -235,11 +233,6 @@ namespace Humidifiers { Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a - // certain object in the input file - - auto &Humidifier = state.dataHumidifiers->Humidifier; - auto &HumidifierUniqueNames = state.dataHumidifiers->HumidifierUniqueNames; - auto &CheckEquipName = state.dataHumidifiers->CheckEquipName; // Update Nums in state and make local convenience copies CurrentModuleObject = "Humidifier:Steam:Electric"; @@ -257,9 +250,9 @@ namespace Humidifiers { MaxAlphas = max(MaxAlphas, NumAlphas); // allocate the data array - Humidifier.allocate(NumHumidifiers); - HumidifierUniqueNames.reserve(static_cast(NumHumidifiers)); - CheckEquipName.dimension(NumHumidifiers, true); + state.dataHumidifiers->Humidifier.allocate(NumHumidifiers); + state.dataHumidifiers->HumidifierUniqueNames.reserve(static_cast(NumHumidifiers)); + state.dataHumidifiers->CheckEquipName.dimension(NumHumidifiers, true); Alphas.allocate(MaxAlphas); cAlphaFields.allocate(MaxAlphas); @@ -284,16 +277,17 @@ namespace Humidifiers { cAlphaFields, cNumericFields); HumNum = HumidifierIndex; - GlobalNames::VerifyUniqueInterObjectName(state, HumidifierUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - Humidifier(HumNum).Name = Alphas(1); - // Humidifier(HumNum)%HumType = TRIM(CurrentModuleObject) - Humidifier(HumNum).HumType = HumidType::Electric; - Humidifier(HumNum).Sched = Alphas(2); + auto &Humidifier = state.dataHumidifiers->Humidifier(HumNum); + GlobalNames::VerifyUniqueInterObjectName( + state, state.dataHumidifiers->HumidifierUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); + Humidifier.Name = Alphas(1); + Humidifier.HumType = HumidType::Electric; + Humidifier.Sched = Alphas(2); if (lAlphaBlanks(2)) { - Humidifier(HumNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Humidifier.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - Humidifier(HumNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (Humidifier(HumNum).SchedPtr == 0) { + Humidifier.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (Humidifier.SchedPtr == 0) { ShowSevereError(state, format("{}{}: invalid {} entered ={} for {}={}", RoutineName, @@ -305,42 +299,37 @@ namespace Humidifiers { ErrorsFound = true; } } - Humidifier(HumNum).NomCapVol = Numbers(1); - Humidifier(HumNum).NomPower = Numbers(2); - Humidifier(HumNum).FanPower = Numbers(3); - Humidifier(HumNum).StandbyPower = Numbers(4); - Humidifier(HumNum).AirInNode = GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::HumidifierSteamElectric, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - Humidifier(HumNum).AirOutNode = GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::HumidifierSteamElectric, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + Humidifier.NomCapVol = Numbers(1); + Humidifier.NomPower = Numbers(2); + Humidifier.FanPower = Numbers(3); + Humidifier.StandbyPower = Numbers(4); + Humidifier.AirInNode = GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::HumidifierSteamElectric, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent); + Humidifier.AirOutNode = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::HumidifierSteamElectric, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); // A5; \field Name of Water Storage Tank if (lAlphaBlanks(5)) { - Humidifier(HumNum).SuppliedByWaterSystem = false; + Humidifier.SuppliedByWaterSystem = false; } else { // water from storage tank - SetupTankDemandComponent(state, - Alphas(1), - CurrentModuleObject, - Alphas(5), - ErrorsFound, - Humidifier(HumNum).WaterTankID, - Humidifier(HumNum).WaterTankDemandARRID); - Humidifier(HumNum).SuppliedByWaterSystem = true; + SetupTankDemandComponent( + state, Alphas(1), CurrentModuleObject, Alphas(5), ErrorsFound, Humidifier.WaterTankID, Humidifier.WaterTankDemandARRID); + Humidifier.SuppliedByWaterSystem = true; } } @@ -360,15 +349,17 @@ namespace Humidifiers { cAlphaFields, cNumericFields); HumNum = NumElecSteamHums + HumidifierIndex; - GlobalNames::VerifyUniqueInterObjectName(state, HumidifierUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - Humidifier(HumNum).Name = Alphas(1); - Humidifier(HumNum).HumType = HumidType::Gas; - Humidifier(HumNum).Sched = Alphas(2); + auto &Humidifier = state.dataHumidifiers->Humidifier(HumNum); + GlobalNames::VerifyUniqueInterObjectName( + state, state.dataHumidifiers->HumidifierUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); + Humidifier.Name = Alphas(1); + Humidifier.HumType = HumidType::Gas; + Humidifier.Sched = Alphas(2); if (lAlphaBlanks(2)) { - Humidifier(HumNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Humidifier.SchedPtr = ScheduleManager::ScheduleAlwaysOn; } else { - Humidifier(HumNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (Humidifier(HumNum).SchedPtr == 0) { + Humidifier.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (Humidifier.SchedPtr == 0) { ShowSevereError(state, format("{}{}: invalid {} entered ={} for {}={}", RoutineName, @@ -380,40 +371,40 @@ namespace Humidifiers { ErrorsFound = true; } } - Humidifier(HumNum).NomCapVol = Numbers(1); - Humidifier(HumNum).NomPower = Numbers(2); // nominal gas use rate for gas fired steam humidifier - Humidifier(HumNum).ThermalEffRated = Numbers(3); - Humidifier(HumNum).FanPower = Numbers(4); - Humidifier(HumNum).StandbyPower = Numbers(5); - Humidifier(HumNum).AirInNode = GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::HumidifierSteamGas, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - Humidifier(HumNum).AirOutNode = GetOnlySingleNode(state, - Alphas(5), - ErrorsFound, - DataLoopNode::ConnectionObjectType::HumidifierSteamGas, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + Humidifier.NomCapVol = Numbers(1); + Humidifier.NomPower = Numbers(2); // nominal gas use rate for gas fired steam humidifier + Humidifier.ThermalEffRated = Numbers(3); + Humidifier.FanPower = Numbers(4); + Humidifier.StandbyPower = Numbers(5); + Humidifier.AirInNode = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::HumidifierSteamGas, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent); + Humidifier.AirOutNode = GetOnlySingleNode(state, + Alphas(5), + ErrorsFound, + DataLoopNode::ConnectionObjectType::HumidifierSteamGas, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(4), Alphas(5), "Air Nodes"); - Humidifier(HumNum).EfficiencyCurvePtr = GetCurveIndex(state, Alphas(3)); - if (Humidifier(HumNum).EfficiencyCurvePtr > 0) { + Humidifier.EfficiencyCurvePtr = GetCurveIndex(state, Alphas(3)); + if (Humidifier.EfficiencyCurvePtr > 0) { ErrorsFound |= Curve::CheckCurveDims(state, - Humidifier(HumNum).EfficiencyCurvePtr, // Curve index - {1}, // Valid dimensions - RoutineName, // Routine name - CurrentModuleObject, // Object Type - Humidifier(HumNum).Name, // Object Name - cAlphaFields(3)); // Field Name + Humidifier.EfficiencyCurvePtr, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + Humidifier.Name, // Object Name + cAlphaFields(3)); // Field Name } else if (!lAlphaBlanks(3)) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Invalid {}={}", cAlphaFields(3), Alphas(3))); @@ -423,86 +414,82 @@ namespace Humidifiers { // A6; \field Name of Water Storage Tank if (lAlphaBlanks(6)) { - Humidifier(HumNum).SuppliedByWaterSystem = false; + Humidifier.SuppliedByWaterSystem = false; } else { // water from storage tank - SetupTankDemandComponent(state, - Alphas(1), - CurrentModuleObject, - Alphas(6), - ErrorsFound, - Humidifier(HumNum).WaterTankID, - Humidifier(HumNum).WaterTankDemandARRID); + SetupTankDemandComponent( + state, Alphas(1), CurrentModuleObject, Alphas(6), ErrorsFound, Humidifier.WaterTankID, Humidifier.WaterTankDemandARRID); SetupTankSupplyComponent( - state, Alphas(1), CurrentModuleObject, Alphas(6), ErrorsFound, Humidifier(HumNum).WaterTankID, Humidifier(HumNum).TankSupplyID); - Humidifier(HumNum).SuppliedByWaterSystem = true; + state, Alphas(1), CurrentModuleObject, Alphas(6), ErrorsFound, Humidifier.WaterTankID, Humidifier.TankSupplyID); + Humidifier.SuppliedByWaterSystem = true; } // A7; \field Inlet Water Temperature Option if (lAlphaBlanks(7)) { - Humidifier(HumNum).InletWaterTempOption = InletWaterTemp::Fixed; + Humidifier.InletWaterTempOption = InletWaterTemp::Fixed; } else { // water from storage tank - Humidifier(HumNum).InletWaterTempOption = static_cast(getEnumValue(inletWaterTempsUC, Alphas(7))); + Humidifier.InletWaterTempOption = static_cast(getEnumValue(inletWaterTempsUC, Alphas(7))); } } for (HumNum = 1; HumNum <= NumHumidifiers; ++HumNum) { // Setup Report variables for the Humidifiers - if (Humidifier(HumNum).SuppliedByWaterSystem) { + auto &Humidifier = state.dataHumidifiers->Humidifier(HumNum); + if (Humidifier.SuppliedByWaterSystem) { SetupOutputVariable(state, "Humidifier Water Volume Flow Rate", Constant::Units::m3_s, - Humidifier(HumNum).WaterConsRate, + Humidifier.WaterConsRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier Water Volume", Constant::Units::m3, - Humidifier(HumNum).WaterCons, + Humidifier.WaterCons, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier Storage Tank Water Volume Flow Rate", Constant::Units::m3_s, - Humidifier(HumNum).TankSupplyVdot, + Humidifier.TankSupplyVdot, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier Storage Tank Water Volume", Constant::Units::m3, - Humidifier(HumNum).TankSupplyVol, + Humidifier.TankSupplyVol, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::Water, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); SetupOutputVariable(state, "Humidifier Starved Storage Tank Water Volume Flow Rate", Constant::Units::m3_s, - Humidifier(HumNum).StarvedSupplyVdot, + Humidifier.StarvedSupplyVdot, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier Starved Storage Tank Water Volume", Constant::Units::m3, - Humidifier(HumNum).StarvedSupplyVol, + Humidifier.StarvedSupplyVol, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::Water, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); SetupOutputVariable(state, "Humidifier Mains Water Volume", Constant::Units::m3, - Humidifier(HumNum).StarvedSupplyVol, + Humidifier.StarvedSupplyVol, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::MainsWater, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); @@ -511,88 +498,88 @@ namespace Humidifiers { SetupOutputVariable(state, "Humidifier Water Volume Flow Rate", Constant::Units::m3_s, - Humidifier(HumNum).WaterConsRate, + Humidifier.WaterConsRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier Water Volume", Constant::Units::m3, - Humidifier(HumNum).WaterCons, + Humidifier.WaterCons, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::Water, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); SetupOutputVariable(state, "Humidifier Mains Water Volume", Constant::Units::m3, - Humidifier(HumNum).WaterCons, + Humidifier.WaterCons, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::MainsWater, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); } - if (Humidifier(HumNum).HumType == HumidType::Electric) { + if (Humidifier.HumType == HumidType::Electric) { SetupOutputVariable(state, "Humidifier Electricity Rate", Constant::Units::W, - Humidifier(HumNum).ElecUseRate, + Humidifier.ElecUseRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier Electricity Energy", Constant::Units::J, - Humidifier(HumNum).ElecUseEnergy, + Humidifier.ElecUseEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); - } else if (Humidifier(HumNum).HumType == HumidType::Gas) { + } else if (Humidifier.HumType == HumidType::Gas) { SetupOutputVariable(state, "Humidifier NaturalGas Use Thermal Efficiency", Constant::Units::None, - Humidifier(HumNum).ThermalEff, + Humidifier.ThermalEff, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier NaturalGas Rate", Constant::Units::W, - Humidifier(HumNum).GasUseRate, + Humidifier.GasUseRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier NaturalGas Energy", Constant::Units::J, - Humidifier(HumNum).GasUseEnergy, + Humidifier.GasUseEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::NaturalGas, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); SetupOutputVariable(state, "Humidifier Auxiliary Electricity Rate", Constant::Units::W, - Humidifier(HumNum).AuxElecUseRate, + Humidifier.AuxElecUseRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - Humidifier(HumNum).Name); + Humidifier.Name); SetupOutputVariable(state, "Humidifier Auxiliary Electricity Energy", Constant::Units::J, - Humidifier(HumNum).AuxElecUseEnergy, + Humidifier.AuxElecUseEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - Humidifier(HumNum).Name, + Humidifier.Name, Constant::eResource::Electricity, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Humidification); @@ -749,14 +736,15 @@ namespace Humidifiers { bool ErrorsFound(false); // TRUE if errors detected in input Real64 NomPowerDes; // Autosized nominal power for reporting Real64 NomPowerUser; // Hardsized nominal power for reporting - Real64 MassFlowDes; // Design air mass flow rate - Real64 InletHumRatDes; // Design inlet humidity ratio - Real64 OutletHumRatDes; // Design outlet humidity ratio Real64 NomCapVolDes; // Autosized Nominal capacity volume for reporting Real64 NomCapVolUser; // HardSized nominal capacity volume for reporting Real64 AirVolFlow; // Design air volume flow rate Real64 AirDensity; // Density of air + Real64 MassFlowDes = 0.0; // Design air mass flow rate + Real64 InletHumRatDes = 0.0; // Design inlet humidity ratio + Real64 OutletHumRatDes = 0.0; // Design outlet humidity ratio + if (HumType == HumidType::Electric || HumType == HumidType::Gas) { bool IsAutoSize = false; bool HardSizeNoDesRun = false; From f3ae53bb1caa90ff9a097098a8282f131f8833a0 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 21:38:17 -0400 Subject: [PATCH 041/108] Value never used --- src/EnergyPlus/HybridModel.cc | 60 ++++++++++------------------------- 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index b3e80bcfcb1..0ddd07b6fa1 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -97,32 +97,13 @@ namespace HybridModel { int NumNumbers; // Number of Numbers for each GetobjectItem call int IOStatus; int ZonePtr; // Pointer to the zone - int ZoneListPtr; // Pointer to the zone list std::string CurrentModuleObject; // to assist in getting input Array1D_string cAlphaArgs(16); // Alpha input items for object Array1D_string cAlphaFieldNames(16); Array1D_string cNumericFieldNames(16); Array1D rNumericArgs(4); // Numeric input items for object - int HybridModelStartMonth(0); // Hybrid model start month - int HybridModelStartDate(0); // Hybrid model start date of month - int HybridModelEndMonth(0); // Hybrid model end month - int HybridModelEndDate(0); // Hybrid model end date of month - int HMStartDay(0); - int HMEndDay(0); - - int TemperatureSchPtr(0); // Temperature schedule pointer - int HumidityRatioSchPtr(0); // Humidity ratio schedule pointer - int CO2ConcentrationSchPtr(0); // CO2 concentration schedule pointer - - int PeopleActivityLevelSchPtr(0); // People activity level schedule pointer - int PeopleSensibleFractionSchPtr(0); // People sensible heat portion schedule pointer - int PeopleRadiantFractionSchPtr(0); // People radiant heat portion (of sensible heat) schedule pointer - int PeopleCO2GenRateSchPtr(0); // People CO2 generation rate schedule pointer - - int SupplyAirTemperatureSchPtr(0); - int SupplyAirMassFlowRateSchPtr(0); - int SupplyAirHumidityRatioSchPtr(0); - int SupplyAirCO2ConcentrationSchPtr(0); + int HMStartDay = 0; + int HMEndDay = 0; // Read hybrid model input CurrentModuleObject = "HybridModel:Zone"; @@ -145,10 +126,7 @@ namespace HybridModel { cAlphaFieldNames, cNumericFieldNames); - ZoneListPtr = 0; ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name - if (ZonePtr == 0 && state.dataHeatBal->NumOfZoneLists > 0) - ZoneListPtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); if (ZonePtr > 0) { state.dataHybridModel->HybridModelZone(ZonePtr).Name = cAlphaArgs(1); // Zone HybridModel name state.dataHybridModel->FlagHybridModel_TM = Util::SameString(cAlphaArgs(3), "Yes"); // Calculate thermal mass option @@ -157,21 +135,21 @@ namespace HybridModel { // Pointers used to help decide which unknown parameter to solve // Zone Air Infiltration Rate and Zone Internal Thermal Mass calculations cannot be performed simultaneously - TemperatureSchPtr = GetScheduleIndex(state, cAlphaArgs(6)); - HumidityRatioSchPtr = GetScheduleIndex(state, cAlphaArgs(7)); - CO2ConcentrationSchPtr = GetScheduleIndex(state, cAlphaArgs(8)); + int TemperatureSchPtr = GetScheduleIndex(state, cAlphaArgs(6)); + int HumidityRatioSchPtr = GetScheduleIndex(state, cAlphaArgs(7)); + int CO2ConcentrationSchPtr = GetScheduleIndex(state, cAlphaArgs(8)); // Not used for now - PeopleActivityLevelSchPtr = GetScheduleIndex(state, cAlphaArgs(9)); - PeopleSensibleFractionSchPtr = GetScheduleIndex(state, cAlphaArgs(10)); - PeopleRadiantFractionSchPtr = GetScheduleIndex(state, cAlphaArgs(11)); - PeopleCO2GenRateSchPtr = GetScheduleIndex(state, cAlphaArgs(12)); + int PeopleActivityLevelSchPtr = GetScheduleIndex(state, cAlphaArgs(9)); + int PeopleSensibleFractionSchPtr = GetScheduleIndex(state, cAlphaArgs(10)); + int PeopleRadiantFractionSchPtr = GetScheduleIndex(state, cAlphaArgs(11)); + int PeopleCO2GenRateSchPtr = GetScheduleIndex(state, cAlphaArgs(12)); // Pointers used to help decide wheather to include system supply terms in the inverse algorithms - SupplyAirTemperatureSchPtr = GetScheduleIndex(state, cAlphaArgs(13)); - SupplyAirMassFlowRateSchPtr = GetScheduleIndex(state, cAlphaArgs(14)); - SupplyAirHumidityRatioSchPtr = GetScheduleIndex(state, cAlphaArgs(15)); - SupplyAirCO2ConcentrationSchPtr = GetScheduleIndex(state, cAlphaArgs(16)); + int SupplyAirTemperatureSchPtr = GetScheduleIndex(state, cAlphaArgs(13)); + int SupplyAirMassFlowRateSchPtr = GetScheduleIndex(state, cAlphaArgs(14)); + int SupplyAirHumidityRatioSchPtr = GetScheduleIndex(state, cAlphaArgs(15)); + int SupplyAirCO2ConcentrationSchPtr = GetScheduleIndex(state, cAlphaArgs(16)); // Note: Internal thermal mass can be calculated only with measured temperature. // Air infiltration rate can be calculated with either measured temperature, humifity ratio, or CO2 @@ -420,21 +398,17 @@ namespace HybridModel { { int HMDayArr[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; - HybridModelStartMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartMonth; - HybridModelStartDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartDate; - HybridModelEndMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndMonth; - HybridModelEndDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndDate; + int HybridModelStartMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartMonth; + int HybridModelStartDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartDate; + int HybridModelEndMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndMonth; + int HybridModelEndDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndDate; if (HybridModelStartMonth >= 1 && HybridModelStartMonth <= 12) { HMStartDay = HMDayArr[HybridModelStartMonth - 1]; - } else { - HMStartDay = 0; } if (HybridModelEndMonth >= 1 && HybridModelEndMonth <= 12) { HMEndDay = HMDayArr[HybridModelEndMonth - 1]; - } else { - HMEndDay = 0; } state.dataHybridModel->HybridModelZone(ZonePtr).HybridStartDayOfYear = HMStartDay + HybridModelStartDate; From 1683eb2d83e508912d6d27e5d1979de801733ce6 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 21:48:00 -0400 Subject: [PATCH 042/108] scope --- src/EnergyPlus/HybridModel.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 0ddd07b6fa1..6406bb53ca1 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -90,20 +90,13 @@ namespace HybridModel { using ScheduleManager::GetScheduleIndex; - bool ErrorsFound(false); // If errors detected in input Array1D_bool lAlphaFieldBlanks(16, false); Array1D_bool lNumericFieldBlanks(4, false); - int NumAlphas; // Number of Alphas for each GetobjectItem call - int NumNumbers; // Number of Numbers for each GetobjectItem call - int IOStatus; - int ZonePtr; // Pointer to the zone std::string CurrentModuleObject; // to assist in getting input Array1D_string cAlphaArgs(16); // Alpha input items for object Array1D_string cAlphaFieldNames(16); Array1D_string cNumericFieldNames(16); Array1D rNumericArgs(4); // Numeric input items for object - int HMStartDay = 0; - int HMEndDay = 0; // Read hybrid model input CurrentModuleObject = "HybridModel:Zone"; @@ -111,6 +104,11 @@ namespace HybridModel { if (state.dataHybridModel->NumOfHybridModelZones > 0) { state.dataHybridModel->HybridModelZone.allocate(state.dataGlobal->NumOfZones); + bool ErrorsFound = false; // If errors detected in input + 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, @@ -396,13 +394,15 @@ namespace HybridModel { state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndMonth = rNumericArgs(3); state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndDate = rNumericArgs(4); { - int HMDayArr[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + int const HMDayArr[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; int HybridModelStartMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartMonth; int HybridModelStartDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartDate; int HybridModelEndMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndMonth; int HybridModelEndDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndDate; + int HMStartDay = 0; + int HMEndDay = 0; if (HybridModelStartMonth >= 1 && HybridModelStartMonth <= 12) { HMStartDay = HMDayArr[HybridModelStartMonth - 1]; } From f99cc7bd77a90c4226b01a344fcf44f52226beb5 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 21:53:46 -0400 Subject: [PATCH 043/108] reduce scope --- src/EnergyPlus/HybridModel.cc | 4 ++-- src/EnergyPlus/HybridUnitaryAirConditioners.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 6406bb53ca1..7e8cfdbb583 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -105,8 +105,8 @@ namespace HybridModel { if (state.dataHybridModel->NumOfHybridModelZones > 0) { state.dataHybridModel->HybridModelZone.allocate(state.dataGlobal->NumOfZones); bool ErrorsFound = false; // If errors detected in input - int NumAlphas = 0; // Number of Alphas for each GetobjectItem call - int NumNumbers = 0; // Number of Numbers for each GetobjectItem call + 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) { diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.cc b/src/EnergyPlus/HybridUnitaryAirConditioners.cc index 53b21ca0716..cad94b26ab5 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.cc +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.cc @@ -1317,8 +1317,8 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error } int GetHybridUnitaryACOutAirNode(EnergyPlusData &state, int const CompNum) { - bool errorsfound = false; if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) { + bool errorsfound = false; GetInputZoneHybridUnitaryAirConditioners(state, errorsfound); state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false; } @@ -1334,8 +1334,8 @@ int GetHybridUnitaryACOutAirNode(EnergyPlusData &state, int const CompNum) int GetHybridUnitaryACZoneInletNode(EnergyPlusData &state, int const CompNum) { - bool errorsfound = false; if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) { + bool errorsfound = false; GetInputZoneHybridUnitaryAirConditioners(state, errorsfound); state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false; } @@ -1351,8 +1351,8 @@ int GetHybridUnitaryACZoneInletNode(EnergyPlusData &state, int const CompNum) int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int const CompNum) { - bool errorsfound = false; if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) { + bool errorsfound = false; GetInputZoneHybridUnitaryAirConditioners(state, errorsfound); state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false; } @@ -1368,8 +1368,8 @@ int GetHybridUnitaryACReturnAirNode(EnergyPlusData &state, int const CompNum) int getHybridUnitaryACIndex(EnergyPlusData &state, std::string_view CompName) { - bool errFlag = false; if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) { + bool errFlag = false; GetInputZoneHybridUnitaryAirConditioners(state, errFlag); state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false; } From 0ecb602f2629266b5884b9721e0d22db37127df5 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 22:02:39 -0400 Subject: [PATCH 044/108] Scope reduction --- .../HybridUnitaryAirConditioners.cc | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.cc b/src/EnergyPlus/HybridUnitaryAirConditioners.cc index cad94b26ab5..26f24c4997d 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.cc +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.cc @@ -90,8 +90,8 @@ void SimZoneHybridUnitaryAirConditioners(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int CompNum; - bool errorsfound = false; if (state.dataHybridUnitaryAC->GetInputZoneHybridEvap) { + bool errorsfound = false; GetInputZoneHybridUnitaryAirConditioners(state, errorsfound); state.dataHybridUnitaryAC->GetInputZoneHybridEvap = false; } @@ -184,7 +184,6 @@ void InitZoneHybridUnitaryAirConditioners(EnergyPlusData &state, using DataZoneEquipment::CheckZoneEquipmentList; // Locals - int Loop; int InletNode; if (state.dataHybridUnitaryAC->HybridCoolOneTimeFlag) { @@ -231,7 +230,7 @@ void InitZoneHybridUnitaryAirConditioners(EnergyPlusData &state, // need to check all zone outdoor air control units to see if they are on Zone Equipment List or issue warning if (!state.dataHybridUnitaryAC->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataHybridUnitaryAC->ZoneEquipmentListChecked = true; - for (Loop = 1; Loop <= state.dataHybridUnitaryAC->NumZoneHybridEvap; ++Loop) { + for (int Loop = 1; Loop <= state.dataHybridUnitaryAC->NumZoneHybridEvap; ++Loop) { if (CheckZoneEquipmentList(state, "ZoneHVAC:HybridUnitaryHVAC", state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(Loop).Name)) { state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(Loop).ZoneNodeNum = state.dataZoneEquip->ZoneEquipConfig(ZoneNum).ZoneNode; } else { @@ -394,10 +393,6 @@ void ReportZoneHybridUnitaryAirConditioners(EnergyPlusData &state, int const Uni using namespace DataLoopNode; using namespace Psychrometrics; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ZoneNodeNum; - ZoneNodeNum = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).ZoneNodeNum; - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).PrimaryMode = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).PrimaryMode; @@ -462,10 +457,7 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int NumFields; // Total number of fields in object - int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - bool IsNotOK; // Flag to verify name - bool IsBlank; // Flag for blank name int UnitLoop; // SUBROUTINE PARAMETER DEFINITIONS: @@ -482,12 +474,11 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error cNumericFields.allocate(MaxNumbers); lAlphaBlanks.dimension(MaxAlphas, true); lNumericBlanks.dimension(MaxNumbers, true); - std::vector test; - std::vector blanks; if (state.dataHybridUnitaryAC->NumZoneHybridEvap > 0) { state.dataHybridUnitaryAC->CheckZoneHybridEvapName.dimension(state.dataHybridUnitaryAC->NumZoneHybridEvap, true); state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner.allocate(state.dataHybridUnitaryAC->NumZoneHybridEvap); + int IOStatus = 0; for (UnitLoop = 1; UnitLoop <= state.dataHybridUnitaryAC->NumZoneHybridEvap; ++UnitLoop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -503,8 +494,8 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error cAlphaFields, cNumericFields); - IsNotOK = false; - IsBlank = false; + bool IsNotOK = false; + bool IsBlank = false; Util::VerifyName(state, Alphas(1), state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner, From 2d12a87187f2260c1157fc45b92fcbfc3ccecb69 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 22:08:40 -0400 Subject: [PATCH 045/108] Scope reduction --- src/EnergyPlus/IceThermalStorage.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/IceThermalStorage.cc b/src/EnergyPlus/IceThermalStorage.cc index 7b1aed106ae..a6d19af28d0 100644 --- a/src/EnergyPlus/IceThermalStorage.cc +++ b/src/EnergyPlus/IceThermalStorage.cc @@ -1301,8 +1301,6 @@ namespace IceThermalStorage { // METHODOLOGY EMPLOYED: // Initializes parameters based on current status flag values. - int CompNum; // local do loop index - if (this->MyPlantScanFlag) { bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, this->Name, DataPlant::PlantEquipmentType::TS_IceDetailed, this->plantLoc, errFlag); @@ -1334,10 +1332,10 @@ namespace IceThermalStorage { if ((state.dataPlnt->PlantLoop(this->plantLoc.loopNum).CommonPipeType == DataPlant::CommonPipeType::TwoWay) && (this->plantLoc.loopSideNum == DataPlant::LoopSideLocation::Supply)) { // up flow priority of other components on the same branch as the Ice tank - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(this->plantLoc.loopNum) - .LoopSide(DataPlant::LoopSideLocation::Supply) - .Branch(this->plantLoc.branchNum) - .TotalComponents; + for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .LoopSide(DataPlant::LoopSideLocation::Supply) + .Branch(this->plantLoc.branchNum) + .TotalComponents; ++CompNum) { state.dataPlnt->PlantLoop(this->plantLoc.loopNum) .LoopSide(DataPlant::LoopSideLocation::Supply) @@ -1369,11 +1367,9 @@ namespace IceThermalStorage { void SimpleIceStorageData::oneTimeInit(EnergyPlusData &state) { - bool errFlag; - if (this->MyPlantScanFlag) { // Locate the storage on the plant loops for later usage - errFlag = false; + bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject( state, this->Name, DataPlant::PlantEquipmentType::TS_IceSimple, this->plantLoc, errFlag, _, _, _, _, _); if (errFlag) { From d9101264fc94420eb50681dcb483117dcea9ec1f Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 22:11:20 -0400 Subject: [PATCH 046/108] const --- src/EnergyPlus/IntegratedHeatPump.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/IntegratedHeatPump.cc b/src/EnergyPlus/IntegratedHeatPump.cc index 07ea78cd452..f3042a3f289 100644 --- a/src/EnergyPlus/IntegratedHeatPump.cc +++ b/src/EnergyPlus/IntegratedHeatPump.cc @@ -1961,7 +1961,7 @@ int GetLowSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum) state.dataIntegratedHP->IntegratedHeatPumps.size())); } - auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum); + auto const &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum); switch (ihp.CurMode) { case IHPOperationMode::Idle: @@ -2164,7 +2164,7 @@ Real64 GetWaterVolFlowRateIHP(EnergyPlusData &state, int const DXCoilNum, int co state.dataIntegratedHP->IntegratedHeatPumps.size())); } - auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum); + auto const &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum); if (!ihp.IHPCoilsSized) SizeIHP(state, DXCoilNum); From ae97d03506cbe88bdc21e1e7093b86fddaf42ae6 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 22:14:45 -0400 Subject: [PATCH 047/108] scope --- src/EnergyPlus/IntegratedHeatPump.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/IntegratedHeatPump.cc b/src/EnergyPlus/IntegratedHeatPump.cc index f3042a3f289..ad03d24b80e 100644 --- a/src/EnergyPlus/IntegratedHeatPump.cc +++ b/src/EnergyPlus/IntegratedHeatPump.cc @@ -416,8 +416,6 @@ void GetIHPInput(EnergyPlusData &state) int NumParams; // Total number of input fields int MaxNums(0); // Maximum number of numeric input fields int MaxAlphas(0); // Maximum number of alpha input fields - std::string InNodeName; // Name of coil inlet node - std::string OutNodeName; // Name of coil outlet node std::string CurrentModuleObject; // for ease in getting objects std::string sIHPType; // specify IHP type Array1D_string AlphArray; // Alpha input items for object @@ -431,9 +429,6 @@ void GetIHPInput(EnergyPlusData &state) bool IsNotOK; // Flag to verify name bool errFlag; int IOStat; - int InNode(0); // inlet air or water node - int OutNode(0); // outlet air or water node - int ChildCoilIndex(0); // refer to a child coil int NumASIHPs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE"); @@ -647,11 +642,11 @@ void GetIHPInput(EnergyPlusData &state) // using OverrideNodeConnectionType // cooling coil air node connections - ChildCoilIndex = ihp.SCCoilIndex; - InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum; - OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; - InNodeName = state.dataLoopNodes->NodeID(InNode); - OutNodeName = state.dataLoopNodes->NodeID(OutNode); + int ChildCoilIndex = ihp.SCCoilIndex; + int InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum; + int OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; + std::string InNodeName = state.dataLoopNodes->NodeID(InNode); + std::string OutNodeName = state.dataLoopNodes->NodeID(OutNode); ihp.AirCoolInletNodeNum = InNode; ihp.AirHeatInletNodeNum = OutNode; From 691d370958ec15a2207166bd5ab06b9a7a1bc414 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Aug 2024 22:18:40 -0400 Subject: [PATCH 048/108] unused string --- src/EnergyPlus/IntegratedHeatPump.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EnergyPlus/IntegratedHeatPump.cc b/src/EnergyPlus/IntegratedHeatPump.cc index ad03d24b80e..d96201cfbee 100644 --- a/src/EnergyPlus/IntegratedHeatPump.cc +++ b/src/EnergyPlus/IntegratedHeatPump.cc @@ -417,7 +417,6 @@ void GetIHPInput(EnergyPlusData &state) int MaxNums(0); // Maximum number of numeric input fields int MaxAlphas(0); // Maximum number of alpha input fields std::string CurrentModuleObject; // for ease in getting objects - std::string sIHPType; // specify IHP type Array1D_string AlphArray; // Alpha input items for object Array1D_string cAlphaFields; // Alpha field names Array1D_string cNumericFields; // Numeric field names @@ -451,7 +450,6 @@ void GetIHPInput(EnergyPlusData &state) // Get the data for air-source IHPs CurrentModuleObject = "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE"; // for reporting - sIHPType = "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE"; // for checking for (int CoilCounter = 1; CoilCounter <= NumASIHPs; ++CoilCounter) { From cc84626c6a1133be73f343abc3a5e151d83abf8c Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 20:54:23 -0400 Subject: [PATCH 049/108] scope --- src/EnergyPlus/MatrixDataManager.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/MatrixDataManager.cc b/src/EnergyPlus/MatrixDataManager.cc index bc43562ef61..f6b706190da 100644 --- a/src/EnergyPlus/MatrixDataManager.cc +++ b/src/EnergyPlus/MatrixDataManager.cc @@ -126,9 +126,6 @@ namespace MatrixDataManager { 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 NumRows; - int NumCols; - int NumElements; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Matrix:TwoDimension"; @@ -156,9 +153,9 @@ namespace MatrixDataManager { Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); state.dataMatrixDataManager->MatData(MatNum).Name = state.dataIPShortCut->cAlphaArgs(1); - NumRows = std::floor(state.dataIPShortCut->rNumericArgs(1)); - NumCols = std::floor(state.dataIPShortCut->rNumericArgs(2)); - NumElements = NumRows * NumCols; + int NumRows = std::floor(state.dataIPShortCut->rNumericArgs(1)); + int NumCols = std::floor(state.dataIPShortCut->rNumericArgs(2)); + int NumElements = NumRows * NumCols; // test if (NumElements < 1) { From 6a80fc933a9f012a063159a58337dbef2e8b706a Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 21:15:10 -0400 Subject: [PATCH 050/108] scope --- src/EnergyPlus/MicroCHPElectricGenerator.cc | 25 +++++++-------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/EnergyPlus/MicroCHPElectricGenerator.cc b/src/EnergyPlus/MicroCHPElectricGenerator.cc index 409b3df0f3c..8694908e136 100644 --- a/src/EnergyPlus/MicroCHPElectricGenerator.cc +++ b/src/EnergyPlus/MicroCHPElectricGenerator.cc @@ -135,14 +135,14 @@ void GetMicroCHPGeneratorInput(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // EnergyPlus input processor - 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 Array1D_string AlphArray(25); // character string data Array1D NumArray(200); // numeric data TODO deal with allocatable for extensible - bool ErrorsFound(false); // error flag 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 // call to Fuel supply module to set up data there. GeneratorFuelSupply::GetGeneratorFuelSupplyInput(state); @@ -845,10 +845,10 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s static constexpr std::string_view RoutineName("CalcMicroCHPNoNormalizeGeneratorModel"); DataGenerators::OperatingMode CurrentOpMode = DataGenerators::OperatingMode::Invalid; + Real64 NdotFuel; Real64 AllowedLoad = 0.0; Real64 PLRforSubtimestepStartUp(1.0); Real64 PLRforSubtimestepShutDown(0.0); - bool RunFlag(false); GeneratorDynamicsManager::ManageGeneratorControlState(state, this->DynamicsControlID, @@ -861,8 +861,6 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s PLRforSubtimestepStartUp, PLRforSubtimestepShutDown); - if (RunFlagElectCenter || RunFlagPlant) RunFlag = true; - Real64 Teng = this->A42Model.Teng; Real64 TcwOut = this->A42Model.TcwOut; @@ -876,7 +874,6 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s Real64 Pnetss = 0.0; Real64 Pstandby = 0.0; // power draw during standby, positive here means negative production Real64 Pcooler = 0.0; // power draw during cool down, positive here means negative production - Real64 NdotFuel = 0.0; Real64 ElecEff = 0.0; Real64 MdotAir = 0.0; Real64 Qgenss = 0.0; @@ -890,8 +887,7 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s case DataGenerators::OperatingMode::Off: { // same as standby in model spec but no Pnet standby electicity losses. Qgenss = 0.0; - MdotCW = state.dataLoopNodes->Node(this->PlantInletNodeID).MassFlowRate; // kg/s - TcwIn = state.dataLoopNodes->Node(this->PlantInletNodeID).Temp; // C + TcwIn = state.dataLoopNodes->Node(this->PlantInletNodeID).Temp; // C Pnetss = 0.0; Pstandby = 0.0; Pcooler = this->A42Model.PcoolDown * PLRforSubtimestepShutDown; @@ -908,8 +904,7 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s } break; case DataGenerators::OperatingMode::Standby: { Qgenss = 0.0; - MdotCW = state.dataLoopNodes->Node(this->PlantInletNodeID).MassFlowRate; // kg/s - TcwIn = state.dataLoopNodes->Node(this->PlantInletNodeID).Temp; // C + TcwIn = state.dataLoopNodes->Node(this->PlantInletNodeID).Temp; // C Pnetss = 0.0; Pstandby = this->A42Model.Pstandby * (1.0 - PLRforSubtimestepShutDown); Pcooler = this->A42Model.PcoolDown * PLRforSubtimestepShutDown; @@ -1027,7 +1022,6 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s ThermEff = Curve::CurveValue(state, this->A42Model.ThermalEffCurveID, Pmax, MdotCW, TcwIn); Qgenss = ThermEff * Qgross; // W } - NdotFuel = MdotFuel / state.dataGenerator->FuelSupply(this->FuelSupplyID).KmolPerSecToKgPerSec; } break; case DataGenerators::OperatingMode::Normal: { if (PLRforSubtimestepStartUp < 1.0) { @@ -1463,9 +1457,6 @@ void MicroCHPDataStruct::UpdateMicroCHPGeneratorRecords(EnergyPlusData &state) / } void MicroCHPDataStruct::oneTimeInit(EnergyPlusData &state) { - - bool errFlag; - if (this->myFlag) { this->setupOutputVars(state); this->myFlag = false; @@ -1473,7 +1464,7 @@ void MicroCHPDataStruct::oneTimeInit(EnergyPlusData &state) if (this->MyPlantScanFlag) { if (allocated(state.dataPlnt->PlantLoop)) { - errFlag = false; + bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject( state, this->Name, DataPlant::PlantEquipmentType::Generator_MicroCHP, this->CWPlantLoc, errFlag, _, _, _, _, _); From 09ec83795aa3f8d7b160935151192aed39715c4f Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 21:35:31 -0400 Subject: [PATCH 051/108] const, scope --- src/EnergyPlus/MixedAir.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 143579da4b2..6eb44b2ad7d 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -3398,7 +3398,7 @@ void OAControllerProps::CalcOAController(EnergyPlusData &state, int const AirLoo Real64 OutAirMinFrac = 0.0; // Local variable used to calculate min OA fraction if (AirLoopNum > 0) { - auto &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); + auto const &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); if (curAirLoopFlow.DesSupply >= HVAC::SmallAirVolFlow) { OutAirMinFrac = this->MinOAMassFlowRate / curAirLoopFlow.DesSupply; } @@ -3418,8 +3418,8 @@ void OAControllerProps::CalcOAController(EnergyPlusData &state, int const AirLoo // Get outside air mass flow rate calculated by mechanical ventilation object [kg/s] Real64 MechVentOutsideAirMinFrac = 0.0; // fraction of OA specified by mechanical ventilation object if (AirLoopNum > 0 && this->VentMechObjectNum != 0) { - auto &curAirLoopControlInfo(state.dataAirLoop->AirLoopControlInfo(AirLoopNum)); - auto &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); + auto const &curAirLoopControlInfo(state.dataAirLoop->AirLoopControlInfo(AirLoopNum)); + auto const &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); // Get system supply air flow rate Real64 SysSA = 0.0; // System supply air mass flow rate [kg/s] @@ -4255,7 +4255,6 @@ void OAControllerProps::CalcOAEconomizer(EnergyPlusData &state, Real64 EconomizerAirFlowScheduleValue; // value of economizer operation schedule (push-button type control schedule) Real64 MaximumOAFracBySetPoint; // The maximum OA fraction due to freezing cooling coil check Real64 OutAirSignal; // Used to set OA mass flow rate - int SolFla; // Flag of solver Real64 minOAFrac; if (AirLoopNum > 0) { @@ -4270,7 +4269,6 @@ void OAControllerProps::CalcOAEconomizer(EnergyPlusData &state, // this->OAMassFlow = AirLoopFlow( AirLoopNum ).MinOutAir; // AirLoopFlow( AirLoopNum ).OAFrac = this->OAMassFlow / this->MixMassFlow; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoLockout = true; - EconomizerOperationFlag = false; } else { state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconomizerFlowLocked = false; this->HRHeatingCoilActive = 0; @@ -4427,6 +4425,7 @@ void OAControllerProps::CalcOAEconomizer(EnergyPlusData &state, // accurate result using a full mass, enthalpy and moisture balance and iteration. if (OutAirSignal > OutAirMinFrac && OutAirSignal < 1.0 && this->MixMassFlow > HVAC::VerySmallMassFlow && this->ControllerType == MixedAirControllerType::ControllerOutsideAir && !AirLoopNightVent) { + int SolFla; // Flag of solver if (AirLoopNum > 0) { @@ -4710,9 +4709,6 @@ void OAControllerProps::SizeOAController(EnergyPlusData &state) static std::string_view const &CurrentModuleObject(CurrentModuleObjects[static_cast(CMO::OAController)]); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string CoilName; - std::string CoilType; - bool ErrorsFound = false; if (this->MaxOA == AutoSize) { @@ -4802,6 +4798,9 @@ void OAControllerProps::SizeOAController(EnergyPlusData &state) std::string const &CompName = state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).ComponentName(CompNum); if (Util::SameString(CompType, "COIL:COOLING:WATER:DETAILEDGEOMETRY") || Util::SameString(CompType, "COIL:HEATING:WATER") || Util::SameString(CompType, "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED")) { + std::string CoilName; + std::string CoilType; + if (Util::SameString(CompType, "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED")) { CoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, CompType, CompName, ErrorsFound); CoilType = HVACHXAssistedCoolingCoil::GetHXCoilType(state, CompType, CompName, ErrorsFound); @@ -5390,7 +5389,6 @@ void CheckControllerLists(EnergyPlusData &state, bool &ErrFound) int NumAlphas; int NumNumbers; int IOStat; - int Count; if (state.dataMixedAir->GetOASysInputFlag) { GetOutsideAirSysInputs(state); @@ -5406,7 +5404,7 @@ void CheckControllerLists(EnergyPlusData &state, bool &ErrFound) state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Item, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNumbers, IOStat); std::string const ControllerListName = state.dataIPShortCut->cAlphaArgs(1); - Count = 0; + int Count = 0; // Check AirLoopHVAC -- brute force, get each AirLoopHVAC From d9585a59699db08dcdf7c5075956e501fb7438d5 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 21:42:46 -0400 Subject: [PATCH 052/108] scope --- src/EnergyPlus/MixedAir.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 6eb44b2ad7d..8677aea9112 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -1871,7 +1871,6 @@ void GetOAMixerInputs(EnergyPlusData &state) int NumNums; // Number of REAL(r64) numbers returned by GetObjectItem int NumAlphas; // Number of alphanumerics returned by GetObjectItem int NumArg; // Number of arguments from GetObjectDefMaxArgs call - int IOStat; Array1D NumArray; // array that holds numeric input values Array1D_string AlphArray; // array that holds alpha input values Array1D_string cAlphaFields; // Alpha field names @@ -1899,6 +1898,7 @@ void GetOAMixerInputs(EnergyPlusData &state) if (state.dataMixedAir->NumOAMixers > 0) { state.dataMixedAir->OAMixer.allocate(state.dataMixedAir->NumOAMixers); + int IOStat; for (int OutAirNum = 1; OutAirNum <= state.dataMixedAir->NumOAMixers; ++OutAirNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -2460,7 +2460,6 @@ void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool con // PURPOSE OF THIS SUBROUTINE // Initialize the OAController data structure with input node data - std::string airloopName; // Temporary equipment name bool ErrorsFound = false; auto &thisOAController(state.dataMixedAir->OAController(OAControllerNum)); @@ -2827,7 +2826,7 @@ void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool con bool FoundAreaZone = false; bool FoundPeopleZone = false; for (int NumMechVentZone = 1; NumMechVentZone <= vent_mech.NumofVentMechZones; ++NumMechVentZone) { - auto &thisMechVentZone = vent_mech.VentMechZone(NumMechVentZone); + auto const &thisMechVentZone = vent_mech.VentMechZone(NumMechVentZone); int ZoneNum = thisMechVentZone.zoneNum; if (ZoneNum == NumZone) { FoundAreaZone = true; @@ -2906,6 +2905,7 @@ void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool con if (AirLoopNum > 0) { // Added code to report (TH, 10/20/2008): // air economizer status (1 = on, 0 = off or does not exist), and actual and minimum outside air fraction (0 to 1) + std::string airloopName; // Temporary equipment name for (int OAControllerLoop = 1; OAControllerLoop <= state.dataMixedAir->NumOAControllers; ++OAControllerLoop) { auto &loopOAController(state.dataMixedAir->OAController(OAControllerLoop)); From bf9ac5c2414918f2e70594ea17b2f8a26ab14212 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 21:47:38 -0400 Subject: [PATCH 053/108] reduce --- src/EnergyPlus/MixedAir.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 8677aea9112..9e48d6cc051 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -871,7 +871,6 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) bool ErrorsFound(false); int NumNums; // Number of real numbers returned by GetObjectItem int NumAlphas; // Number of alphanumerics returned by GetObjectItem - int AlphaNum; int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a int IOStat; Array1D NumArray; @@ -928,7 +927,7 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) thisControllerList.NumControllers = (NumAlphas - 1) / 2; thisControllerList.ControllerType.dimension(thisControllerList.NumControllers, ControllerKind::Invalid); thisControllerList.ControllerName.allocate(thisControllerList.NumControllers); - AlphaNum = 2; + int AlphaNum = 2; for (int CompNum = 1; CompNum <= thisControllerList.NumControllers; ++CompNum) { // Json will catch any object types that are not the correct key choice of Controller:OutdoorAir or Controller:WaterCoil thisControllerList.ControllerType(CompNum) = From 7ff9fa1ccf9b1e25eecc0e14fbbd925c6bbd46a4 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 21:55:16 -0400 Subject: [PATCH 054/108] reduce scope --- src/EnergyPlus/MixedAir.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 9e48d6cc051..890f28cd7c1 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -459,13 +459,12 @@ void SimOAComponent(EnergyPlusData &state, OACoolingCoil = false; OAHX = false; HVAC::FanOp fanOp; - bool HeatingActive = false; - bool CoolingActive = false; Real64 sensOut = 0.0; - Real64 latOut = 0.0; int constexpr zoneOAUnitNum = -1; Real64 constexpr OAUCoilOutTemp = 0.0; bool constexpr ZoneEquipFlag = false; + bool HeatingActive = false; // why isn't this returning that a coil is active? + bool CoolingActive = false; switch (CompTypeNum) { case SimAirServingZones::CompType::OAMixer_Num: { // OutdoorAir:Mixer @@ -597,6 +596,7 @@ void SimOAComponent(EnergyPlusData &state, case SimAirServingZones::CompType::CoilSystemWater: // CoilSystem:Cooling:Water case SimAirServingZones::CompType::UnitarySystemModel: { // AirloopHVAC:UnitarySystem if (Sim) { + Real64 latOut = 0.0; // does the air loop not need to know what the latent capacity is? int compNum = CompIndex; // use local so return value of compNum from simulate call does not overwrite CompIndex state.dataAirLoop->OutsideAirSys(OASysNum).compPointer[compNum]->simulate(state, CompName, @@ -702,8 +702,6 @@ void SimOAComponent(EnergyPlusData &state, case SimAirServingZones::CompType::ZoneVRFasAirLoopEquip: { // ZoneHVAC:TerminalUnit:VariableRefrigerantFlow if (Sim) { int ControlledZoneNum = 0; - bool HeatingActive = false; - bool CoolingActive = false; int constexpr OAUnitNum = 0; Real64 constexpr OAUCoilOutTemp = 0.0; bool constexpr ZoneEquipment = false; @@ -789,10 +787,10 @@ void SimOAController(EnergyPlusData &state, std::string const &CtrlName, int &Ct // check that the economizer staging operation EconomizerFirst is only used with an sensible load-based controlled AirLoopHVAC:UnitarySystem if (AirLoopNum > 0) { auto &primaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum); - bool sensLoadCtrlUnitarySystemFound = false; if (primaryAirSystems.EconomizerStagingCheckFlag == false) { OAControllerNum = Util::FindItemInList(CtrlName, state.dataMixedAir->OAController); if (state.dataMixedAir->OAController(OAControllerNum).EconomizerStagingType == HVAC::EconomizerStagingType::EconomizerFirst) { + bool sensLoadCtrlUnitarySystemFound = false; for (int BranchNum = 1; BranchNum <= primaryAirSystems.NumBranches; ++BranchNum) { for (int CompNum = 1; CompNum <= primaryAirSystems.Branch(BranchNum).TotalComponents; ++CompNum) { if (primaryAirSystems.Branch(BranchNum).Comp(CompNum).CompType_Num == SimAirServingZones::CompType::UnitarySystemModel) { @@ -869,8 +867,8 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFound(false); - int NumNums; // Number of real numbers returned by GetObjectItem - int NumAlphas; // Number of alphanumerics returned by GetObjectItem + int NumNums; // Number of real numbers returned by GetObjectItem + int NumAlphas; // Number of alphanumerics returned by GetObjectItem int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a int IOStat; Array1D NumArray; @@ -1867,9 +1865,9 @@ void GetOAMixerInputs(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumNums; // Number of REAL(r64) numbers returned by GetObjectItem - int NumAlphas; // Number of alphanumerics returned by GetObjectItem - int NumArg; // Number of arguments from GetObjectDefMaxArgs call + int NumNums; // Number of REAL(r64) numbers returned by GetObjectItem + int NumAlphas; // Number of alphanumerics returned by GetObjectItem + int NumArg; // Number of arguments from GetObjectDefMaxArgs call Array1D NumArray; // array that holds numeric input values Array1D_string AlphArray; // array that holds alpha input values Array1D_string cAlphaFields; // Alpha field names From 6b4224fd80f74f2d6970468ad9b92f31d012b985 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 22:02:12 -0400 Subject: [PATCH 055/108] scope --- src/EnergyPlus/MixedAir.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 890f28cd7c1..25c94ded744 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -350,10 +350,6 @@ void SimOutsideAirSys(EnergyPlusData &state, int const OASysNum, bool const Firs // Simulate the controllers and components in the outside air system. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int OAMixerNum; - int OAControllerNum; // OA controller index in OAController - auto &CompType = state.dataMixedAir->CompType; // Tuned Made static - auto &CompName = state.dataMixedAir->CompName; // Tuned Made static bool FatalErrorFlag(false); state.dataSize->CurOASysNum = OASysNum; @@ -370,11 +366,11 @@ void SimOutsideAirSys(EnergyPlusData &state, int const OASysNum, bool const Firs format("AirLoopHVAC:OutdoorAirSystem {} has more than 1 outside air controller; only the 1st will be used", CurrentOASystem.Name)); } for (int CompNum = 1; CompNum <= CurrentOASystem.NumComponents; ++CompNum) { - CompType = CurrentOASystem.ComponentType(CompNum); - CompName = CurrentOASystem.ComponentName(CompNum); + auto &CompType = CurrentOASystem.ComponentType(CompNum); + auto &CompName = CurrentOASystem.ComponentName(CompNum); if (Util::SameString(CompType, "OutdoorAir:Mixer")) { - OAMixerNum = Util::FindItemInList(CompName, state.dataMixedAir->OAMixer); - OAControllerNum = CurrentOASystem.OAControllerIndex; + int OAMixerNum = Util::FindItemInList(CompName, state.dataMixedAir->OAMixer); + int OAControllerNum = CurrentOASystem.OAControllerIndex; if (state.dataMixedAir->OAController(OAControllerNum).MixNode != state.dataMixedAir->OAMixer(OAMixerNum).MixNode) { ShowSevereError( state, format("The mixed air node of Controller:OutdoorAir=\"{}\"", state.dataMixedAir->OAController(OAControllerNum).Name)); From 344e00608637da6d0b53592240080f607c0c12cb Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 22:05:24 -0400 Subject: [PATCH 056/108] scope --- src/EnergyPlus/MixedAir.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 25c94ded744..d10119a85d4 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -350,8 +350,6 @@ void SimOutsideAirSys(EnergyPlusData &state, int const OASysNum, bool const Firs // Simulate the controllers and components in the outside air system. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool FatalErrorFlag(false); - state.dataSize->CurOASysNum = OASysNum; auto &CurrentOASystem(state.dataAirLoop->OutsideAirSys(OASysNum)); if (state.dataAirLoop->OutsideAirSys(OASysNum).AirLoopDOASNum == -1) { @@ -360,6 +358,7 @@ void SimOutsideAirSys(EnergyPlusData &state, int const OASysNum, bool const Firs SimOASysComponents(state, OASysNum, FirstHVACIteration, AirLoopNum); if (state.dataMixedAir->MyOneTimeErrorFlag(OASysNum)) { + bool FatalErrorFlag(false); if (CurrentOASystem.NumControllers - CurrentOASystem.NumSimpleControllers > 1) { ShowWarningError( state, From c7de41127a0f2e0f4835185c236191000d1ae3f0 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 22:08:18 -0400 Subject: [PATCH 057/108] reduce --- src/EnergyPlus/MixerComponent.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EnergyPlus/MixerComponent.cc b/src/EnergyPlus/MixerComponent.cc index e01258b3fef..028bbc11175 100644 --- a/src/EnergyPlus/MixerComponent.cc +++ b/src/EnergyPlus/MixerComponent.cc @@ -355,7 +355,6 @@ void InitAirMixer(EnergyPlusData &state, int const MixerNum) // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int InletNode; int NodeNum; // Do the following initializations (every time step): This should be the info from @@ -364,7 +363,7 @@ void InitAirMixer(EnergyPlusData &state, int const MixerNum) // Transfer the node data to MixerCond data structure for (NodeNum = 1; NodeNum <= state.dataMixerComponent->MixerCond(MixerNum).NumInletNodes; ++NodeNum) { - InletNode = state.dataMixerComponent->MixerCond(MixerNum).InletNode(NodeNum); + int InletNode = state.dataMixerComponent->MixerCond(MixerNum).InletNode(NodeNum); // Set all of the inlet mass flow variables from the nodes state.dataMixerComponent->MixerCond(MixerNum).InletMassFlowRate(NodeNum) = state.dataLoopNodes->Node(InletNode).MassFlowRate; state.dataMixerComponent->MixerCond(MixerNum).InletMassFlowRateMaxAvail(NodeNum) = state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail; From 6daaf7a7bbc07ddb7e11be0aa50dcaecd3d86132 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 22:18:58 -0400 Subject: [PATCH 058/108] backup correct build error --- src/EnergyPlus/MoistureBalanceEMPDManager.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index 2930c76a51c..8fedf8b208b 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -351,7 +351,6 @@ void InitMoistureBalanceEMPD(EnergyPlusData &state) using Psychrometrics::PsyRhovFnTdbWPb_fast; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ZoneNum; int SurfNum; if (state.dataMoistureBalEMPD->InitEnvrnFlag) { @@ -366,8 +365,8 @@ void InitMoistureBalanceEMPD(EnergyPlusData &state) state.dataMstBalEMPD->RVwall.allocate(state.dataSurface->TotSurfaces); } - for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - ZoneNum = state.dataSurface->Surface(SurfNum).Zone; + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + int ZoneNum = state.dataSurface->Surface(SurfNum).Zone; if (!state.dataSurface->Surface(SurfNum).HeatTransSurf) continue; Real64 const rv_air_in_initval = min(PsyRhovFnTdbWPb_fast(state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT, @@ -387,7 +386,7 @@ void InitMoistureBalanceEMPD(EnergyPlusData &state) GetMoistureBalanceEMPDInput(state); - for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { if (!state.dataSurface->Surface(SurfNum).HeatTransSurf) continue; if (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::Window) continue; EMPDReportVarsData &rvd = state.dataMoistureBalEMPD->EMPDReportVars(SurfNum); @@ -493,7 +492,6 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, static constexpr std::string_view RoutineName("CalcMoistureEMPD"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NOFITR; // Number of iterations int MatNum; // Material number at interior layer int ConstrNum; // Construction number Real64 hm_deep_layer; // Overall deep-layer transfer coefficient @@ -503,7 +501,6 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, Real64 RHaver; // Average zone relative humidity {0-1} between current time and previous time Real64 RVaver; // Average zone vapor density Real64 dU_dRH; - int Flag; // Convergence flag (0 - converged) Real64 PVsurf; // Surface vapor pressure Real64 PV_surf_layer; // Vapor pressure of surface layer Real64 PV_deep_layer; @@ -546,8 +543,6 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, auto &heat_flux_latent(state.dataMstBalEMPD->HeatFluxLatent(SurfNum)); // output heat_flux_latent = 0.0; - Flag = 1; - NOFITR = 0; if (!surface.HeatTransSurf) { return; } From d6e5bef5727178af5f7a1422f0c6b28b8239364f Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 22:31:10 -0400 Subject: [PATCH 059/108] scope --- src/EnergyPlus/MoistureBalanceEMPDManager.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index 8fedf8b208b..9339e129961 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -350,9 +350,6 @@ void InitMoistureBalanceEMPD(EnergyPlusData &state) using Psychrometrics::PsyRhovFnTdbRh; using Psychrometrics::PsyRhovFnTdbWPb_fast; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int SurfNum; - if (state.dataMoistureBalEMPD->InitEnvrnFlag) { state.dataMstBalEMPD->RVSurfaceOld.allocate(state.dataSurface->TotSurfaces); state.dataMstBalEMPD->RVSurface.allocate(state.dataSurface->TotSurfaces); From 9c6f33a1d5905987238aa9492668364a4d873cc5 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 22:42:58 -0400 Subject: [PATCH 060/108] reduce --- src/EnergyPlus/MoistureBalanceEMPDManager.cc | 3 +-- src/EnergyPlus/MundtSimMgr.cc | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index 9339e129961..7599fb9c328 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -157,7 +157,6 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; // IO Status when calling get input subroutine Array1D_string MaterialNames(3); // Number of Material Alpha names defined - int MaterNum; // Counter to keep track of the material number int MaterialNumAlpha; // Number of material alpha names being passed int MaterialNumProp; // Number of material properties being passed Array1D MaterialProps(9); // Temporary array to transfer material properties @@ -199,7 +198,7 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state) state.dataIPShortCut->cNumericFieldNames); // Load the material derived type from the input data. - MaterNum = Util::FindItemInPtrList(MaterialNames(1), state.dataMaterial->Material); + int MaterNum = Util::FindItemInPtrList(MaterialNames(1), state.dataMaterial->Material); if (MaterNum == 0) { ShowSevereError(state, format("{}: invalid {} entered={}, must match to a valid Material name.", diff --git a/src/EnergyPlus/MundtSimMgr.cc b/src/EnergyPlus/MundtSimMgr.cc index 7daab626aad..197b308a1eb 100644 --- a/src/EnergyPlus/MundtSimMgr.cc +++ b/src/EnergyPlus/MundtSimMgr.cc @@ -461,7 +461,6 @@ namespace RoomAir { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NodeNum; // index for air nodes - int SurfNum; // index for surfaces // set up air node ID state.dataMundtSimMgr->NumRoomNodes = 0; @@ -507,7 +506,7 @@ namespace RoomAir { e.Area = 0.0; } // get floor surface data - for (SurfNum = 1; SurfNum <= state.dataMundtSimMgr->NumFloorSurfs; ++SurfNum) { + for (int SurfNum = 1; SurfNum <= state.dataMundtSimMgr->NumFloorSurfs; ++SurfNum) { state.dataMundtSimMgr->FloorSurf(SurfNum).Temp = state.dataMundtSimMgr->MundtAirSurf(state.dataMundtSimMgr->FloorSurfSetIDs(SurfNum), state.dataMundtSimMgr->MundtZoneNum).Temp; state.dataMundtSimMgr->FloorSurf(SurfNum).Hc = @@ -728,7 +727,6 @@ namespace RoomAir { // map data from air domain back to surface domain for each particular zone // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ZoneNodeNum; // index number of the zone node Real64 DeltaTemp; // dummy variable for temperature difference // get surface info @@ -753,7 +751,7 @@ namespace RoomAir { // TRoomAverage = ( LineNode( MundtCeilAirID, MundtZoneNum ).Temp + LineNode( MundtFootAirID, MundtZoneNum ).Temp ) / 2; // ZT(ZoneNum) = TRoomAverage // c) Leaving-zone air temperature -> Node(ZoneNode)%Temp - ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; + int ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataMundtSimMgr->LineNode(state.dataMundtSimMgr->ReturnNodeID, state.dataMundtSimMgr->MundtZoneNum).Temp; // d) Thermostat air temperature -> TempTstatAir(ZoneNum) @@ -777,7 +775,7 @@ namespace RoomAir { // DeltaTemp = TRoomAverage - LineNode( TstatNodeID, MundtZoneNum ).Temp; // ZT(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum) + DeltaTemp // c) Leaving-zone air temperature -> Node(ZoneNode)%Temp - ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; + int ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; DeltaTemp = state.dataMundtSimMgr->LineNode(state.dataMundtSimMgr->ReturnNodeID, state.dataMundtSimMgr->MundtZoneNum).Temp - state.dataMundtSimMgr->LineNode(state.dataMundtSimMgr->TstatNodeID, state.dataMundtSimMgr->MundtZoneNum).Temp; state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + DeltaTemp; From 178e74a6486cf347b0319413f67c7163071beef1 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 22:49:55 -0400 Subject: [PATCH 061/108] scope --- src/EnergyPlus/MundtSimMgr.cc | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/EnergyPlus/MundtSimMgr.cc b/src/EnergyPlus/MundtSimMgr.cc index 197b308a1eb..372cc81b9b2 100644 --- a/src/EnergyPlus/MundtSimMgr.cc +++ b/src/EnergyPlus/MundtSimMgr.cc @@ -95,11 +95,9 @@ namespace RoomAir { // Data // MODULE PARAMETER DEFINITIONS: - Real64 constexpr CpAir(1005.0); // Specific heat of air - Real64 constexpr MinSlope(0.001); // Bound on result from Mundt model - Real64 constexpr MaxSlope(5.0); // Bound on result from Mundt Model - - // MODULE VARIABLE DECLARATIONS: + Real64 constexpr CpAir = 1005.0; // Specific heat of air + Real64 constexpr MinSlope = 0.001; // Bound on result from Mundt model + Real64 constexpr MaxSlope = 5.0; // Bound on result from Mundt Model void ManageDispVent1Node(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone { @@ -110,11 +108,6 @@ namespace RoomAir { // MODIFIED February 2004, fix allocate-deallocate problem (CC) // RE-ENGINEERED na - // PURPOSE OF THIS SUBROUTINE: - // manage the Mundt model - - bool ErrorsFound; - // initialize Mundt model data if (state.dataHeatBal->MundtFirstTimeFlag) { InitDispVent1Node(state); @@ -131,7 +124,7 @@ namespace RoomAir { if ((state.dataMundtSimMgr->SupplyAirVolumeRate > 0.0001) && (state.dataMundtSimMgr->QsysCoolTot > 0.0001)) { // setup Mundt model - ErrorsFound = false; + bool ErrorsFound = false; SetupDispVent1Node(state, ZoneNum, ErrorsFound); if (ErrorsFound) ShowFatalError(state, "ManageMundtModel: Errors in setting up Mundt Model. Preceding condition(s) cause termination."); @@ -189,14 +182,14 @@ namespace RoomAir { MaxNumOfRoomNodes = 0; ErrorsFound = false; for (ZoneIndex = 1; ZoneIndex <= state.dataGlobal->NumOfZones; ++ZoneIndex) { - auto &thisZone = state.dataHeatBal->Zone(ZoneIndex); + auto const &thisZone = state.dataHeatBal->Zone(ZoneIndex); if (state.dataRoomAir->AirModel(ZoneIndex).AirModel == RoomAir::RoomAirModel::DispVent1Node) { // find number of zones using the Mundt model ++NumOfMundtZones; // find maximum number of surfaces in zones using the Mundt model int NumOfSurfs = 0; for (int spaceNum : thisZone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int surfNum = thisSpace.HTSurfaceFirst; surfNum <= thisSpace.HTSurfaceLast; ++surfNum) { state.dataMundtSimMgr->ZoneData(ZoneIndex).HBsurfaceIndexes.emplace_back(surfNum); ++NumOfSurfs; @@ -335,7 +328,6 @@ namespace RoomAir { using Psychrometrics::PsyWFnTdpPb; Real64 CpAir; // specific heat - int NodeNum; // index for air nodes Real64 SumSysMCp; // zone sum of air system MassFlowRate*Cp Real64 SumSysMCpT; // zone sum of air system MassFlowRate*Cp*T Real64 MassFlowRate; // mass flowrate @@ -346,7 +338,7 @@ namespace RoomAir { Real64 ZoneMult; // total zone multiplier Real64 RetAirConvGain; - auto &Zone(state.dataHeatBal->Zone); + auto const &Zone(state.dataHeatBal->Zone); // determine ZoneEquipConfigNum for this zone ZoneEquipConfigNum = ZoneNum; @@ -378,7 +370,7 @@ namespace RoomAir { // determine supply air conditions SumSysMCp = 0.0; SumSysMCpT = 0.0; - for (NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { + for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); From 18438ebae9b2651a4eeb85c0b8675d5c5cd73514 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 23:17:24 -0400 Subject: [PATCH 062/108] reference --- src/EnergyPlus/NodeInputManager.cc | 142 +++++++++++++++-------------- 1 file changed, 73 insertions(+), 69 deletions(-) diff --git a/src/EnergyPlus/NodeInputManager.cc b/src/EnergyPlus/NodeInputManager.cc index 51032f8fe45..be11ddaf8b3 100644 --- a/src/EnergyPlus/NodeInputManager.cc +++ b/src/EnergyPlus/NodeInputManager.cc @@ -203,121 +203,121 @@ void SetupNodeVarsForReporting(EnergyPlusData &state) // Nodes have been found (TOTAL NODE NUMBER) or when HVAC warmup is // complete, whichever condition is reached first. - auto &Node = state.dataLoopNodes->Node; - auto &NodeID = state.dataLoopNodes->NodeID; - if (!state.dataNodeInputMgr->NodeVarsSetup) { if (!state.dataErrTracking->AbortProcessing) { state.dataLoopNodes->MoreNodeInfo.allocate(state.dataNodeInputMgr->NumOfUniqueNodeNames); for (int NumNode = 1; NumNode <= state.dataNodeInputMgr->NumOfUniqueNodeNames; ++NumNode) { + auto &Node = state.dataLoopNodes->Node(NumNode); + auto &NodeID = state.dataLoopNodes->NodeID(NumNode); + // Setup Report variables for the Nodes for HVAC Reporting, CurrentModuleObject='Node Name' SetupOutputVariable(state, "System Node Temperature", Constant::Units::C, - state.dataLoopNodes->Node(NumNode).Temp, + Node.Temp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Mass Flow Rate", Constant::Units::kg_s, - Node(NumNode).MassFlowRate, + Node.MassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Humidity Ratio", Constant::Units::kgWater_kgDryAir, - Node(NumNode).HumRat, + Node.HumRat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Setpoint Temperature", Constant::Units::C, - Node(NumNode).TempSetPoint, + Node.TempSetPoint, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Setpoint High Temperature", Constant::Units::C, - Node(NumNode).TempSetPointHi, + Node.TempSetPointHi, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Setpoint Low Temperature", Constant::Units::C, - Node(NumNode).TempSetPointLo, + Node.TempSetPointLo, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Setpoint Humidity Ratio", Constant::Units::kgWater_kgDryAir, - Node(NumNode).HumRatSetPoint, + Node.HumRatSetPoint, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Setpoint Minimum Humidity Ratio", Constant::Units::kgWater_kgDryAir, - Node(NumNode).HumRatMin, + Node.HumRatMin, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Setpoint Maximum Humidity Ratio", Constant::Units::kgWater_kgDryAir, - Node(NumNode).HumRatMax, + Node.HumRatMax, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Relative Humidity", Constant::Units::Perc, state.dataLoopNodes->MoreNodeInfo(NumNode).RelHumidity, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Pressure", Constant::Units::Pa, - Node(NumNode).Press, + Node.Press, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Standard Density Volume Flow Rate", Constant::Units::m3_s, state.dataLoopNodes->MoreNodeInfo(NumNode).VolFlowRateStdRho, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); - if (Node(NumNode).FluidType == DataLoopNode::NodeFluidType::Air || - Node(NumNode).FluidType == DataLoopNode::NodeFluidType::Water) { // setup volume flow rate report for actual/current density + NodeID); + if (Node.FluidType == DataLoopNode::NodeFluidType::Air || + Node.FluidType == DataLoopNode::NodeFluidType::Water) { // setup volume flow rate report for actual/current density SetupOutputVariable(state, "System Node Current Density Volume Flow Rate", Constant::Units::m3_s, state.dataLoopNodes->MoreNodeInfo(NumNode).VolFlowRateCrntRho, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Current Density", Constant::Units::kg_m3, state.dataLoopNodes->MoreNodeInfo(NumNode).Density, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Specific Heat", Constant::Units::J_kgK, state.dataLoopNodes->MoreNodeInfo(NumNode).SpecificHeat, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); } SetupOutputVariable(state, @@ -326,138 +326,138 @@ void SetupNodeVarsForReporting(EnergyPlusData &state) state.dataLoopNodes->MoreNodeInfo(NumNode).ReportEnthalpy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Wetbulb Temperature", Constant::Units::C, state.dataLoopNodes->MoreNodeInfo(NumNode).WetBulbTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Dewpoint Temperature", Constant::Units::C, state.dataLoopNodes->MoreNodeInfo(NumNode).AirDewPointTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Wind Speed", Constant::Units::m_s, - Node(NumNode).OutAirWindSpeed, + Node.OutAirWindSpeed, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Wind Direction", Constant::Units::deg, - Node(NumNode).OutAirWindDir, + Node.OutAirWindDir, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Quality", Constant::Units::None, - Node(NumNode).Quality, + Node.Quality, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Height", Constant::Units::m, - Node(NumNode).Height, + Node.Height, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); if (state.dataGlobal->DisplayAdvancedReportVariables) { SetupOutputVariable(state, "System Node Minimum Temperature", Constant::Units::C, - Node(NumNode).TempMin, + Node.TempMin, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Maximum Temperature", Constant::Units::C, - Node(NumNode).TempMax, + Node.TempMax, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Minimum Limit Mass Flow Rate", Constant::Units::kg_s, - Node(NumNode).MassFlowRateMin, + Node.MassFlowRateMin, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Maximum Limit Mass Flow Rate", Constant::Units::kg_s, - Node(NumNode).MassFlowRateMax, + Node.MassFlowRateMax, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Minimum Available Mass Flow Rate", Constant::Units::kg_s, - Node(NumNode).MassFlowRateMinAvail, + Node.MassFlowRateMinAvail, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Maximum Available Mass Flow Rate", Constant::Units::kg_s, - Node(NumNode).MassFlowRateMaxAvail, + Node.MassFlowRateMaxAvail, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Setpoint Mass Flow Rate", Constant::Units::kg_s, - Node(NumNode).MassFlowRateSetPoint, + Node.MassFlowRateSetPoint, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Requested Mass Flow Rate", Constant::Units::kg_s, - Node(NumNode).MassFlowRateRequest, + Node.MassFlowRateRequest, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Last Timestep Temperature", Constant::Units::C, - Node(NumNode).TempLastTimestep, + Node.TempLastTimestep, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); SetupOutputVariable(state, "System Node Last Timestep Enthalpy", Constant::Units::J_kg, - Node(NumNode).EnthalpyLastTimestep, + Node.EnthalpyLastTimestep, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); } if (state.dataContaminantBalance->Contaminant.CO2Simulation) { SetupOutputVariable(state, "System Node CO2 Concentration", Constant::Units::ppm, - Node(NumNode).CO2, + Node.CO2, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { SetupOutputVariable(state, "System Node Generic Air Contaminant Concentration", Constant::Units::ppm, - Node(NumNode).GenContam, + Node.GenContam, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - NodeID(NumNode)); + NodeID); } } } @@ -482,11 +482,13 @@ void SetupNodeVarsForReporting(EnergyPlusData &state) } int Count0 = 0; for (int NumNode = 1; NumNode <= state.dataNodeInputMgr->NumOfUniqueNodeNames; ++NumNode) { + auto &Node = state.dataLoopNodes->Node(NumNode); + auto &NodeID = state.dataLoopNodes->NodeID(NumNode); print(state.files.bnd, " Node,{},{},{},{}\n", NumNode, - NodeID(NumNode), - DataLoopNode::NodeFluidTypeNames[static_cast(Node(NumNode).FluidType)], + NodeID, + DataLoopNode::NodeFluidTypeNames[static_cast(Node.FluidType)], state.dataNodeInputMgr->NodeRef(NumNode)); if (state.dataNodeInputMgr->NodeRef(NumNode) == 0) ++Count0; } @@ -499,12 +501,14 @@ void SetupNodeVarsForReporting(EnergyPlusData &state) "! ,,,,<# Times Node Referenced After Definition>"); print(state.files.bnd, "{}\n", Format_703); for (int NumNode = 1; NumNode <= state.dataNodeInputMgr->NumOfUniqueNodeNames; ++NumNode) { + auto &Node = state.dataLoopNodes->Node(NumNode); + auto &NodeID = state.dataLoopNodes->NodeID(NumNode); if (state.dataNodeInputMgr->NodeRef(NumNode) > 0) continue; print(state.files.bnd, " Suspicious Node,{},{},{},{}\n", NumNode, - NodeID(NumNode), - DataLoopNode::NodeFluidTypeNames[static_cast(Node(NumNode).FluidType)], + NodeID, + DataLoopNode::NodeFluidTypeNames[static_cast(Node.FluidType)], state.dataNodeInputMgr->NodeRef(NumNode)); } } From 649be3f576a8d90521b9b4932cb1bbd0be77b128 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 23:22:58 -0400 Subject: [PATCH 063/108] scope --- src/EnergyPlus/NodeInputManager.cc | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/EnergyPlus/NodeInputManager.cc b/src/EnergyPlus/NodeInputManager.cc index be11ddaf8b3..4ee2d486e2f 100644 --- a/src/EnergyPlus/NodeInputManager.cc +++ b/src/EnergyPlus/NodeInputManager.cc @@ -812,12 +812,10 @@ void InitUniqueNodeCheck(EnergyPlusData &state, std::string const &ContextName) // This subroutine begins a process of checking for unique node names // in a sequence of nodes. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool errFlag(false); - // Begin set up of Uniqueness context if (state.dataNodeInputMgr->GetNodeInputFlag) { + bool errFlag(false); GetNodeListsInput(state, errFlag); state.dataNodeInputMgr->GetNodeInputFlag = false; } @@ -862,11 +860,8 @@ void CheckUniqueNodeNames( // METHODOLOGY EMPLOYED: // checks the current list of items for this (again) - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Found; - if (!CheckName.empty()) { - Found = Util::FindItemInList(CheckName, state.dataNodeInputMgr->UniqueNodeNames, state.dataNodeInputMgr->NumCheckNodes); + int Found = Util::FindItemInList(CheckName, state.dataNodeInputMgr->UniqueNodeNames, state.dataNodeInputMgr->NumCheckNodes); if (Found != 0) { ShowSevereError(state, format("{}=\"{}\", duplicate node names found.", state.dataNodeInputMgr->CurCheckContextName, ObjectName)); ShowContinueError(state, format("...for Node Type(s)={}, duplicate node name=\"{}\".", NodeTypes, CheckName)); @@ -905,11 +900,8 @@ void CheckUniqueNodeNumbers( // METHODOLOGY EMPLOYED: // checks the current list of items for this (again) - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Found; - if (CheckNumber != 0) { - Found = Util::FindItemInList( + int Found = Util::FindItemInList( state.dataLoopNodes->NodeID(CheckNumber), state.dataNodeInputMgr->UniqueNodeNames, state.dataNodeInputMgr->NumCheckNodes); if (Found != 0) { ShowSevereError(state, format("{}=\"{}\", duplicate node names found.", state.dataNodeInputMgr->CurCheckContextName, ObjectName)); @@ -1000,10 +992,6 @@ void CalcMoreNodeInfo(EnergyPlusData &state) auto &NodeSpecificHeatSchedPtr = state.dataNodeInputMgr->NodeSpecificHeatSchedPtr; auto &nodeReportingStrings = state.dataNodeInputMgr->nodeReportingStrings; auto &nodeFluidNames = state.dataNodeInputMgr->nodeFluidNames; - bool ReportWetBulb; - bool ReportRelHumidity; - bool ReportDewPoint; - bool ReportSpecificHeat; Real64 SteamDensity; Real64 EnthSteamInDry; Real64 RhoAirCurrent; // temporary value for current air density f(baro, db , W) @@ -1075,10 +1063,10 @@ void CalcMoreNodeInfo(EnergyPlusData &state) } for (int iNode = 1; iNode <= state.dataLoopNodes->NumOfNodes; ++iNode) { - ReportWetBulb = false; - ReportRelHumidity = false; - ReportDewPoint = false; - ReportSpecificHeat = false; + bool ReportWetBulb = false; + bool ReportRelHumidity = false; + bool ReportDewPoint = false; + bool ReportSpecificHeat = false; if (state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) && NodeWetBulbSchedPtr(iNode) > 0) { ReportWetBulb = (GetCurrentScheduleValue(state, NodeWetBulbSchedPtr(iNode)) > 0.0); } else if (state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) && NodeWetBulbSchedPtr(iNode) == 0) { From 5107f8e5e7528dc1655b90bb4f793957a267d34f Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 23 Aug 2024 23:27:27 -0400 Subject: [PATCH 064/108] scope --- src/EnergyPlus/NodeInputManager.cc | 9 ++++----- src/EnergyPlus/NonZoneEquipmentManager.cc | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/NodeInputManager.cc b/src/EnergyPlus/NodeInputManager.cc index 4ee2d486e2f..2d39a19384a 100644 --- a/src/EnergyPlus/NodeInputManager.cc +++ b/src/EnergyPlus/NodeInputManager.cc @@ -675,9 +675,8 @@ int AssignNodeNumber(EnergyPlusData &state, ShowFatalError(state, "AssignNodeNumber: Preceding issue causes termination."); } - int NumNode = 0; if (state.dataNodeInputMgr->NumOfUniqueNodeNames > 0) { - NumNode = Util::FindItemInList( + int NumNode = Util::FindItemInList( Name, state.dataLoopNodes->NodeID({1, state.dataNodeInputMgr->NumOfUniqueNodeNames}), state.dataNodeInputMgr->NumOfUniqueNodeNames); if (NumNode > 0) { AssignNodeNumber = NumNode; @@ -758,13 +757,13 @@ int GetOnlySingleNode(EnergyPlusData &state, static constexpr std::string_view RoutineName("GetOnlySingleNode: "); int NumNodes; - int NumParams; - int NumAlphas; - int NumNums; std::string_view const objTypeStr = BranchNodeConnections::ConnectionObjectTypeNames[static_cast(NodeObjectType)]; if (state.dataNodeInputMgr->GetOnlySingleNodeFirstTime) { + int NumParams; + int NumAlphas; + int NumNums; state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "NodeList", NumParams, NumAlphas, NumNums); state.dataNodeInputMgr->GetOnlySingleNodeNodeNums.dimension(NumParams, 0); state.dataNodeInputMgr->GetOnlySingleNodeFirstTime = false; diff --git a/src/EnergyPlus/NonZoneEquipmentManager.cc b/src/EnergyPlus/NonZoneEquipmentManager.cc index a8f71fb168c..2d8594036af 100644 --- a/src/EnergyPlus/NonZoneEquipmentManager.cc +++ b/src/EnergyPlus/NonZoneEquipmentManager.cc @@ -109,7 +109,6 @@ namespace NonZoneEquipmentManager { using WaterUse::SimulateWaterUse; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int WaterHeaterNum; // Water heater object number auto &CountNonZoneEquip = state.dataGlobal->CountNonZoneEquip; if (CountNonZoneEquip) { @@ -121,7 +120,7 @@ namespace NonZoneEquipmentManager { SimulateWaterUse(state, FirstHVACIteration); // simulate non-plant loop water use. if (!state.dataGlobal->ZoneSizingCalc) { - for (WaterHeaterNum = 1; WaterHeaterNum <= state.dataGlobal->NumOfWaterHeater; ++WaterHeaterNum) { + for (int WaterHeaterNum = 1; WaterHeaterNum <= state.dataGlobal->NumOfWaterHeater; ++WaterHeaterNum) { SimulateWaterHeaterStandAlone(state, WaterHeaterNum, FirstHVACIteration); } } From 2edd8390e03100df9987c2913f5d8ce4b86cc2e2 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 10:12:45 -0400 Subject: [PATCH 065/108] Run linux debug CI --- src/EnergyPlus/MatrixDataManager.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EnergyPlus/MatrixDataManager.cc b/src/EnergyPlus/MatrixDataManager.cc index f6b706190da..f7fb608268d 100644 --- a/src/EnergyPlus/MatrixDataManager.cc +++ b/src/EnergyPlus/MatrixDataManager.cc @@ -67,8 +67,6 @@ namespace MatrixDataManager { // MODULE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN June 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // Process user input for Matrix: input data objects From bf40dc3583ab7559253d25655a3ce8845904c7d8 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 10:15:20 -0400 Subject: [PATCH 066/108] Run Windows CI again --- src/EnergyPlus/HybridModel.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 7e8cfdbb583..48e06543b2a 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -79,10 +79,6 @@ namespace HybridModel { // Using/Aliasing using namespace DataHeatBalance; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - - // Object Data - // Functions void GetHybridModelZone(EnergyPlusData &state) From 0582be14367ec26948fa4494d01fc7f6c6499112 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 11:51:15 -0400 Subject: [PATCH 067/108] Clang format --- src/EnergyPlus/DataSurfaces.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index 070b22cb218..2517ea0271a 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -239,7 +239,7 @@ Real64 SurfaceData::getInsideAirTemperature(EnergyPlusData &state, const int t_S Real64 SumSysMCp = 0; Real64 SumSysMCpT = 0; auto const &inletNodes = (state.dataHeatBal->doSpaceHeatBalance) ? state.dataZoneEquip->spaceEquipConfig(this->spaceNum).InletNode - : state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode; + : state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode; for (int nodeNum : inletNodes) { auto const &inNode = state.dataLoopNodes->Node(nodeNum); Real64 CpAir = PsyCpAirFnW(thisSpaceHB.airHumRat); From 4eae4832b627f2824f7cebd61680f797808be294 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 15:05:14 -0400 Subject: [PATCH 068/108] conditionals and scope --- src/EnergyPlus/StandardRatings.cc | 143 ++++++++++++++---------------- 1 file changed, 65 insertions(+), 78 deletions(-) diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index 5de0d975fe9..adeacc2e8bd 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -1538,8 +1538,6 @@ namespace StandardRatings { Real64 EER(0.0); Real64 NetCoolingCapRated(0.0); - int ns = 2; - StandardRatingsResult = TwoSpeedDXCoilStandardRatings(state, DXCoilName, DXCoilType, @@ -2652,20 +2650,20 @@ namespace StandardRatings { Array1D speedsForA; Array1D speedsForB; - int smallerThanSpeedB(0); - int largerThanSpeedB(0); Array1D speedsForC; - int smallerThanSpeedC(0); - int largerThanSpeedC(0); Array1D speedsForD; - int smallerThanSpeedD(0); - int largerThanSpeedD(0); - bool bFound = false; - bool cFound = false; - bool dFound = false; Array1D ratioArray; if (nsp > 4) { + int smallerThanSpeedB = 0; + int largerThanSpeedB = 0; + int smallerThanSpeedC = 0; + int largerThanSpeedC = 0; + int smallerThanSpeedD = 0; + int largerThanSpeedD = 0; + bool bFound = false; + bool cFound = false; + bool dFound = false; for (int i = 1; i <= nsp; ++i) { Real64 ratioAtithSpeed = (RatedTotalCapacity(i) / _100PercentCoolCap) * 100; ratioArray.push_back(ratioAtithSpeed); @@ -3094,19 +3092,19 @@ namespace StandardRatings { RedCapNum = speedsForB(i); OutdoorUnitInletAirDryBulbTempReduced = GetOutdoorUnitInletAirDryBulbTempReduced(0.75, CondenserType(RedCapNum)); - Real64 EER = CalculateInterMediateEER(state, - QAFull, - OutdoorUnitInletAirDryBulbTempReduced, - CapFTempCurveIndex(RedCapNum), - CoolingCoilInletAirWetBulbTempRated, - RatedTotalCapacity(RedCapNum), - TotCapFlowModFac(RedCapNum), - FanPowerPerEvapAirFlowRate_2023(RedCapNum), - RatedAirVolFlowRate(RedCapNum), - EIRFTempCurveIndex(RedCapNum), - RatedCOP(RedCapNum), - EIRFlowModFac(RedCapNum), - ReducedPLRIEER[2]); + EER = CalculateInterMediateEER(state, + QAFull, + OutdoorUnitInletAirDryBulbTempReduced, + CapFTempCurveIndex(RedCapNum), + CoolingCoilInletAirWetBulbTempRated, + RatedTotalCapacity(RedCapNum), + TotCapFlowModFac(RedCapNum), + FanPowerPerEvapAirFlowRate_2023(RedCapNum), + RatedAirVolFlowRate(RedCapNum), + EIRFTempCurveIndex(RedCapNum), + RatedCOP(RedCapNum), + EIRFlowModFac(RedCapNum), + ReducedPLRIEER[2]); if (i == 1) EER_BLow = EER; // ?? Check first is low or high @@ -3127,19 +3125,19 @@ namespace StandardRatings { RedCapNum = speedsForC(i); OutdoorUnitInletAirDryBulbTempReduced = GetOutdoorUnitInletAirDryBulbTempReduced(0.50, CondenserType(RedCapNum)); - Real64 EER = CalculateInterMediateEER(state, - QAFull, - OutdoorUnitInletAirDryBulbTempReduced, - CapFTempCurveIndex(RedCapNum), - CoolingCoilInletAirWetBulbTempRated, - RatedTotalCapacity(RedCapNum), - TotCapFlowModFac(RedCapNum), - FanPowerPerEvapAirFlowRate_2023(RedCapNum), - RatedAirVolFlowRate(RedCapNum), - EIRFTempCurveIndex(RedCapNum), - RatedCOP(RedCapNum), - EIRFlowModFac(RedCapNum), - ReducedPLRIEER[1]); + EER = CalculateInterMediateEER(state, + QAFull, + OutdoorUnitInletAirDryBulbTempReduced, + CapFTempCurveIndex(RedCapNum), + CoolingCoilInletAirWetBulbTempRated, + RatedTotalCapacity(RedCapNum), + TotCapFlowModFac(RedCapNum), + FanPowerPerEvapAirFlowRate_2023(RedCapNum), + RatedAirVolFlowRate(RedCapNum), + EIRFTempCurveIndex(RedCapNum), + RatedCOP(RedCapNum), + EIRFlowModFac(RedCapNum), + ReducedPLRIEER[1]); if (i == 1) EER_CLow = EER; // ?? Check first is low or high @@ -3851,9 +3849,6 @@ namespace StandardRatings { Real64 TWBIndoor; // indoor air dry bulb temperature Real64 TDBOutdoor; // outdor air dry bulb temperature - int ClassNum; // class number (Class I, II, II, IV) - int TestNum; // test number (Test A, B, C, D) - int Num; // text number counter if (FanPowerPerEvapAirFlowRateFromInput <= 0.0) { FanPowerPerEvapAirFlowRate = DefaultFanPowerPerEvapAirFlowRate; @@ -3861,13 +3856,14 @@ namespace StandardRatings { FanPowerPerEvapAirFlowRate = FanPowerPerEvapAirFlowRateFromInput; } if (RatedTotalCapacity > 0.0) { + int Num; // text number counter - for (ClassNum = 1; ClassNum <= 4; ++ClassNum) { + for (int ClassNum = 1; ClassNum <= 4; ++ClassNum) { TWBIndoor = PsyTwbFnTdbWPb(state, IndoorDBTempClassI2IV[ClassNum - 1], PsyWFnTdpPb(state, IndoorTDPA2D, state.dataEnvrn->StdBaroPress), state.dataEnvrn->StdBaroPress); - for (TestNum = 1; TestNum <= 4; ++TestNum) { + for (int TestNum = 1; TestNum <= 4; ++TestNum) { TDBOutdoor = OutdoorDBTempAllClassA2D[TestNum - 1]; Num = (ClassNum - 1) * 4 + TestNum; // Standard Rating Net Cooling Capacity at Test A: @@ -3935,7 +3931,6 @@ namespace StandardRatings { Real64 LoadFactor(0.0); // "on" time for last stage at the desired reduced capacity, (dimensionless) int BinNum; // bin number counter - int spnum; // compressor speed number Array1D NetCoolingCapRated(nsp); // net cooling capacity at each speed Array1D TotCapFlowModFac(nsp); // Total capacity modifier f(actual flow vs rated flow) for each speed [-] Array1D EIRFlowModFac(nsp); // EIR modifier f(actual supply air flow vs rated flow) for each speed [-] @@ -3967,7 +3962,7 @@ namespace StandardRatings { } // Calculate the capacity and power for each speed - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { TotCapFlowModFac(spnum) = Curve::CurveValue(state, static_cast(CapFFlowCurveIndex(spnum)), AirMassFlowRatioRated); TotCoolCapTestA2(spnum) = RatedTotalCapacity(spnum) * @@ -4045,7 +4040,7 @@ namespace StandardRatings { (OutdoorCoilInletAirDryBulbTempTestA2 - OutdoorCoilInletAirDryBulbTempTestB2)) * (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestB2); - for (spnum = 1; spnum <= nsp - 1; ++spnum) { + for (int spnum = 1; spnum <= nsp - 1; ++spnum) { CoolingCapacityLS = TotCoolCapTestF1(spnum) + ((TotCoolCapTestB1(spnum) - TotCoolCapTestF1(spnum)) / (OutdoorCoilInletAirDryBulbTempTestB1 - OutdoorCoilInletAirDryBulbTempTestF1)) * (OutdoorBinTemperatureSEER[BinNum] - OutdoorCoilInletAirDryBulbTempTestF1); @@ -4454,7 +4449,6 @@ namespace StandardRatings { (OutdoorBinTemperatureSEER[BN] - OutdoorCoilInletAirDryBulbTempTestB2); Real64 q(0.0); Real64 e(0.0); - bool skipSpeed = false; // # Intermediate Capacity Real64 q_A_full = Q_A_Full(nsp); @@ -4556,7 +4550,7 @@ namespace StandardRatings { IntermediateCapacityAndPowerSEER2Case1(state, bl, q_low, n, p_low, PLFFPLRCurveIndex(spnum)); // This is the case and speed we're looking for now we exit and try calculating against the next bin goto SpeedLoop3_exit; - } else if (bl > q_low && bl < q_full && (spnum == 2 || spnum == 3)) { + } else if (bl < q_full && (spnum == 2 || spnum == 3)) { // bl > q_low // Case 2A: if (bl < q_int) { @@ -4565,7 +4559,7 @@ namespace StandardRatings { std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2A( p_int, q_int, q_low, bl, n, Q_E_Int(spnum), q_full, P_E_Int(spnum), p_full, p_low); goto SpeedLoop3_exit; - } else if (bl < q_full) { + } else { // bl < q_full // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & // full Speed std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = IntermediateCapacityAndPowerSEER2Case2B( @@ -4598,7 +4592,7 @@ namespace StandardRatings { IntermediateCapacityAndPowerSEER2Case1(state, bl, q_low, n, p_low, PLFFPLRCurveIndex(spnum)); // This is the case and speed we're looking for now we exit and try calculating against the next bin goto SpeedLoop3_exit; - } else if (bl > q_low && bl < q_full) { + } else if (bl < q_full) { // bl > q_low // Case 2A: if (bl < q_int) { // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & full @@ -4613,7 +4607,7 @@ namespace StandardRatings { p_int, bl, q_int, n, Q_E_Int(spnum), P_E_Int(spnum), q_low, p_low, q_full, p_full); goto SpeedLoop3_exit; } - } else if (bl >= q_full) { + } else { // bl >= q_full // Case 3: // Section 11.2.1.3.3 CASE 3 - Building load is equal to or greater than unit capacity at full stage std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = @@ -4639,7 +4633,7 @@ namespace StandardRatings { IntermediateCapacityAndPowerSEER2Case1(state, bl, q_low, n, p_low, PLFFPLRCurveIndex(spnum)); // This is the case and speed we're looking for now we exit and try calculating against the next bin goto SpeedLoop3_exit; - } else if (bl > q_low && bl < q_full) { + } else if (bl < q_full) { // bl > q_low // Case 2A: if (bl < q_int) { // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & full @@ -4654,7 +4648,7 @@ namespace StandardRatings { p_int, bl, q_int, n, Q_E_Int(spnum), P_E_Int(spnum), q_low, p_low, q_full, p_full); goto SpeedLoop3_exit; } - } else if (bl >= q_full && spnum == nsp) { + } else if (spnum == nsp) { // bl >= q_full // Case 3: // Section 11.2.1.3.3 CASE 3 - Building load is equal to or greater than unit capacity at full stage std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = @@ -4760,7 +4754,6 @@ namespace StandardRatings { Real64 NetTotCoolCapBinned_2023(0.0); // Net tot cooling cap corresponding to an outdoor bin temperature [W] Real64 TotCoolElecPowerBinned_2023(0.0); // Total cooling electric power corresponding to an outdoor bin temperature [W] - int spnum; Array1D TotCapFlowModFac(nsp); // Total capacity modifier f(actual flow vs rated flow) for each speed [-] Array1D EIRFlowModFac(nsp); // EIR modifier f(actual supply air flow vs rated flow) for each speed [-] Array1D NetCoolingCapRated_2023(nsp); // net cooling capacity at each speed @@ -5099,7 +5092,6 @@ namespace StandardRatings { Real64 NetTotCoolCapBinned_2023(0.0); // Net tot cooling cap corresponding to an outdoor bin temperature [W] Real64 TotCoolElecPowerBinned_2023(0.0); // Total cooling electric power corresponding to an outdoor bin temperature [W] - int spnum; // compressor speed number Array1D TotCapFlowModFac(nsp); // Total capacity modifier f(actual flow vs rated flow) for each speed [-] Array1D EIRFlowModFac(nsp); // EIR modifier f(actual supply air flow vs rated flow) for each speed [-] Array1D NetCoolingCapRated_2023(nsp); // net cooling capacity at each speed @@ -5133,7 +5125,7 @@ namespace StandardRatings { } // Calculate the capacity and power for each speed - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { TotCapFlowModFac(spnum) = Curve::CurveValue(state, CapFFlowCurveIndex(spnum), AirMassFlowRatioRated); Q_A_Full(spnum) = @@ -5253,7 +5245,7 @@ namespace StandardRatings { Real64 t = OutdoorBinTemperatureSEER[BN]; Real64 n = CoolFracBinHoursAtOutdoorBinTemp[BN]; Real64 bl = BuildingCoolingLoad_2023; - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { // # Intermediate Capacity Real64 q_A_full = Q_A_Full(spnum); Real64 q_B_full = Q_B_Full(spnum); @@ -5304,20 +5296,15 @@ namespace StandardRatings { goto SpeedLoop3_exit; } else { // if we're here then all the speeds (apart form max speed ?? ) failed to staisfy the case 2B - // max speed shoudl include in cases 1,2A,2B or not ?? TBD: - if (bl >= q_full) { // bl >= q_full - - if (spnum == nsp - 1) { - // Case 4 if applicable for nsp-1 then we're skipping it to nsp( max speed ) - } else { - // Section 11.2.1.3.3 CASE 3 - Building load is equal to or greater than unit capacity at full stage - std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = - IntermediateCapacityAndPowerSEER2Case3( - q_full, p_full, CoolingCapacityMax_2023, CoolingElecPowerMax_2023, n); - goto SpeedLoop3_exit; - } + // max speed should include in cases 1,2A,2B or not ?? TBD: + + if (spnum == nsp - 1) { + // Case 4 if applicable for nsp-1 then we're skipping it to nsp( max speed ) } else { - // << ",, BIN NUMBER, " << BN + 1 << ", NO CASES MATCHED, " << spnum << std::endl; + // Section 11.2.1.3.3 CASE 3 - Building load is equal to or greater than unit capacity at full stage + std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = + IntermediateCapacityAndPowerSEER2Case3(q_full, p_full, CoolingCapacityMax_2023, CoolingElecPowerMax_2023, n); + goto SpeedLoop3_exit; } } } @@ -6302,10 +6289,10 @@ namespace StandardRatings { if (t >= t_ob) { q_full = Q_H3_Full(nsp) + (Q_H1_Full(nsp) - Q_H3_Full(nsp)) * ((t - (-8.33)) / (8.33 - (-8.33))); // Equation 11.112 AHRI-2023 p_full = P_H3_Full(nsp) + (P_H1_Full(nsp) - P_H3_Full(nsp)) * ((t - (-8.33)) / (8.33 - (-8.33))); // Equation 11.117 AHRI-2023 - } else if (t >= (-8.33) && t < t_ob) { - q_full = Q_H3_Full(nsp) + (Q_H2_Full(nsp) - Q_H3_Full(nsp)) * ((t - (-8.33)) / (1.66 - (-8.33))); // Equation 11.113 AHRI-2023 - p_full = P_H3_Full(nsp) + (P_H2_Full(nsp) - P_H3_Full(nsp)) * ((t - (-8.33)) / (1.66 - (-8.33))); // Equation 11.118 AHRI-2023 - } else if (t < (-8.33)) { // if(t<(-8.33)) + } else if (t >= (-8.33)) { + q_full = Q_H3_Full(nsp) + (Q_H2_Full(nsp) - Q_H3_Full(nsp)) * ((t - (-8.33)) / (1.66 - (-8.33))); // Equation 11.113 AHRI-2023 + p_full = P_H3_Full(nsp) + (P_H2_Full(nsp) - P_H3_Full(nsp)) * ((t - (-8.33)) / (1.66 - (-8.33))); // Equation 11.118 AHRI-2023 + } else { q_full = Q_H4_Full(nsp) + (Q_H3_Full(nsp) - Q_H4_Full(nsp)) * ((t - (-8.33)) / ((-8.33) - (-15))); // Equation 11.114 AHRI-2023 p_full = P_H4_Full(nsp) + (P_H3_Full(nsp) - P_H4_Full(nsp)) * ((t - (-8.33)) / ((-8.33) - (-15))); // Equation 11.119 AHRI-2023 } @@ -6369,9 +6356,9 @@ namespace StandardRatings { // Note: this is strange that there is no defrost cut in the low speed and doesn't use H2 or H3 low // Equation 11.177 AHRI-2023 - Real64 q_low = q_H1_low + (q_H0_low - q_H1_low) * ((t - (8.33)) / (16.66 - (8.33))); + Real64 q_low; // = q_H1_low + (q_H0_low - q_H1_low) * ((t - (8.33)) / (16.66 - (8.33))); // Equation 11.178 AHRI-2023 - Real64 p_low = p_H1_low + (p_H0_low - p_H1_low) * ((t - (8.33)) / (16.66 - (8.33))); + Real64 p_low; // = p_H1_low + (p_H0_low - p_H1_low) * ((t - (8.33)) / (16.66 - (8.33))); Real64 q_hs(0.0); Real64 p_hs(0.0); // Low Speed @@ -6437,7 +6424,7 @@ namespace StandardRatings { e = (hlf_low / plf_low) * p_low * delta_low * n; rh = bl * (1.0 - delta_low) * n; // Equation 11.154 AHRI-2023 goto HeatSpeedLoop4_exit; - } else if (bl > q_low && bl < q_hs) { + } else if (bl < q_hs) { // bl > q_low // (bl > q_low && bl < q_full) { // CASE 2 : 11.2.2.3.2 AHRI-2023 // Building load can be matched by modulating the compressor speed between low speed and full speed, q_low < bl < q_full @@ -6453,7 +6440,7 @@ namespace StandardRatings { if (!OATempCompressorOnOffBlank) { if (t <= t_Off) { delta_int_bin = 0.0; - } else if (t > t_Off && t <= t_On) { + } else if (t <= t_On) { // t > t_Off delta_int_bin = 0.5; } else { delta_int_bin = 1.0; @@ -6501,7 +6488,7 @@ namespace StandardRatings { if (!OATempCompressorOnOffBlank && p_full > 0.0) { if ((t <= OATempCompressorOff) || (q_full / p_full < 1.0)) { delta_full = 0.0; - } else if ((t > OATempCompressorOff && t <= OATempCompressorOn) && (q_full / p_full > 1.0)) { + } else if ((t <= OATempCompressorOn) && (q_full / p_full > 1.0)) { // t > OATempCompressorOff delta_full = 0.5; } else if ((t > OATempCompressorOn) && (q_full / p_full > 1.0)) { delta_full = 1.0; From d080aac0a7e33089d1f0201c1bff4974ea89738b Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 15:13:00 -0400 Subject: [PATCH 069/108] scope --- src/EnergyPlus/StandardRatings.cc | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index adeacc2e8bd..8a682e0dc8a 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -4305,7 +4305,6 @@ namespace StandardRatings { Array1D P_F_Low(nsp); // Outdoor Unit electric power at F1 test condition | p_F_Low Array1D P_E_Int(nsp); // Outdoor Unit electric power at Eint (Ev) test conditon | p_E_Int - int spnum; // compressor speed number Array1D TotCapFlowModFac(nsp); // Total capacity modifier f(actual flow vs rated flow) for each speed [-] Array1D EIRFlowModFac(nsp); // EIR modifier f(actual supply air flow vs rated flow) for each speed [-] Array1D NetCoolingCapRated_2023(nsp); // net cooling capacity at each speed @@ -4337,7 +4336,7 @@ namespace StandardRatings { } // Calculate the capacity and power for each speed - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { TotCapFlowModFac(spnum) = Curve::CurveValue(state, CapFFlowCurveIndex(spnum), AirMassFlowRatioRated); Q_A_Full(spnum) = @@ -4522,7 +4521,7 @@ namespace StandardRatings { // << ",, BIN NUMBER (C3), " << BN + 1 << ", NO SPEEDS MATCHED ??, " << spnum << std::endl; } } else if (nsp == 4) { - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { // # Intermediate Capacity Real64 q_E_int; if (spnum == 2 || spnum == 3) { @@ -4575,7 +4574,7 @@ namespace StandardRatings { } } } else if (nsp == 3) { - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { // # Intermediate Capacity Real64 q_E_int = Q_E_Int(spnum); std::tie(N_Cq, M_Cq) = CapacityAdjustmentFactorsInCoolingModeSEER2(q_F_low, q_B_low, BN, q_B_full, q_A_full, q_E_int); @@ -4616,7 +4615,7 @@ namespace StandardRatings { } } } else if (nsp == 2) { - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { // # Intermediate Capacity Real64 q_E_int = Q_E_Int(1); std::tie(N_Cq, M_Cq) = CapacityAdjustmentFactorsInCoolingModeSEER2(q_F_low, q_B_low, BN, q_B_full, q_A_full, q_E_int); @@ -7058,24 +7057,6 @@ namespace StandardRatings { using namespace OutputReportPredefined; using HVAC::CoilDX_CoolingSingleSpeed; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ClassNum; // class number (Class I, II, II, IV) - int Num; // text number counter - - // Formats - if (CompTypeNum == CoilDX_CoolingSingleSpeed) { if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag3) { static constexpr std::string_view Format_101( @@ -7087,8 +7068,8 @@ namespace StandardRatings { print(state.files.eio, "{}", Format_101); state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag3 = false; } - for (ClassNum = 1; ClassNum <= 4; ++ClassNum) { - Num = (ClassNum - 1) * 4; + for (int ClassNum = 1; ClassNum <= 4; ++ClassNum) { + int Num = (ClassNum - 1) * 4; std::string ClassName = format("Class {}", ClassNum); std::string CompNameNew = fmt::format("{}({})", CompName, ClassName); static constexpr std::string_view Format_102( From 7fe4edcf9ffa323ab857a601bb460c1176492e8a Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 15:30:25 -0400 Subject: [PATCH 070/108] conditionals and scope --- src/EnergyPlus/StandardRatings.cc | 43 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index 8a682e0dc8a..96cc3edf1d1 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -1842,7 +1842,7 @@ namespace StandardRatings { if (!OATempCompressorOnOffBlank) { if (OutdoorBinTemperature[BinNum] <= OATempCompressorOff) { LowTempCutOutFactor = 0.0; - } else if (OutdoorBinTemperature[BinNum] > OATempCompressorOff && OutdoorBinTemperature[BinNum] <= OATempCompressorOn) { + } else if (OutdoorBinTemperature[BinNum] <= OATempCompressorOn) { LowTempCutOutFactor = 0.5; } else { LowTempCutOutFactor = 1.0; @@ -1956,8 +1956,7 @@ namespace StandardRatings { if (!OATempCompressorOnOffBlank) { if (OutdoorBinTemperature[BinNum2023] <= OATempCompressorOff2023) { LowTempCutOutFactor2023 = 0.0; - } else if (OutdoorBinTemperature[BinNum2023] > OATempCompressorOff2023 && - OutdoorBinTemperature[BinNum2023] <= OATempCompressorOn) { + } else if (OutdoorBinTemperature[BinNum2023] <= OATempCompressorOn) { LowTempCutOutFactor2023 = 0.5; } else { LowTempCutOutFactor2023 = 1.0; @@ -3752,7 +3751,6 @@ namespace StandardRatings { RatedCOP, EIRFlowModFac); - StandarRatingResults["IEER"] = IEER; StandarRatingResults["IEER"] = IEER; StandarRatingResults["NetCoolingCapRated"] = NetCoolingCapRated; @@ -4063,7 +4061,7 @@ namespace StandardRatings { TotCoolElecPowerBinned = (PartLoadRatio / PartLoadFactorUser) * CoolingElecPowerLS; TotCoolElecPowerBinnedDefault = (PartLoadRatio / PartLoadFactorStandard) * CoolingElecPowerLS; goto SpeedLoop_exit; - } else if ((BuildingCoolingLoad > CoolingCapacityLS) && (BuildingCoolingLoad < CoolingCapacityHS)) { + } else if (BuildingCoolingLoad < CoolingCapacityHS) { // cycle between speed "spnum" and "spnum + 1" LoadFactor = min(1.0, (CoolingCapacityHS - BuildingCoolingLoad) / (CoolingCapacityHS - CoolingCapacityLS)); LoadFactor = max(0.0, LoadFactor); @@ -4493,7 +4491,7 @@ namespace StandardRatings { IntermediateCapacityAndPowerSEER2Case1(state, bl, q_low, n, p_low, PLFFPLRCurveIndex(spnum)); speedsUsed.push_back(spnum); goto SpeedLoop3_exit; - } else if (BuildingCoolingLoad_2023 > q_low && BuildingCoolingLoad_2023 < q_full) { + } else if (BuildingCoolingLoad_2023 < q_full) { // Case 2A: if (bl < q_int) { // Section 11.2.1.3.2 CASE 2 - Building load can be matched by modulating the compressor speed between low speed & @@ -4509,7 +4507,7 @@ namespace StandardRatings { speedsUsed.push_back(spnum); goto SpeedLoop3_exit; } - } else if (BuildingCoolingLoad_2023 >= q_full) { + } else { // Case 3: // Section 11.2.1.3.3 CASE 3 - Building load is equal to or greater than unit capacity at full stage std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = @@ -4675,7 +4673,7 @@ namespace StandardRatings { IntermediateCapacityAndPowerSEER2Case1(state, bl, q_low, n, p_low, PLFFPLRCurveIndex(1)); goto SpeedLoop3_exit; - } else if (BuildingCoolingLoad_2023 > q_low && BuildingCoolingLoad_2023 < q_full) { + } else if (BuildingCoolingLoad_2023 < q_full) { // Case 2: // Case 2A: if (bl < q_int) { @@ -4692,7 +4690,7 @@ namespace StandardRatings { goto SpeedLoop3_exit; } // Case 2B: - } else if (BuildingCoolingLoad_2023 >= q_full) { + } else { // Case 3: // Section 11.2.1.3.3 CASE 3 - Building load is equal to or greater than unit capacity at full stage std::tie(q, e, NetTotCoolCapBinned_2023, TotCoolElecPowerBinned_2023) = @@ -5943,7 +5941,7 @@ namespace StandardRatings { if (!OATempCompressorOnOffBlank) { if (OutdoorBinTemperature[BinNum] <= OATempCompressorOff) { LowTempCutOutFactor = 0.0; - } else if (OutdoorBinTemperature[BinNum] > OATempCompressorOff && OutdoorBinTemperature[BinNum] <= OATempCompressorOn) { + } else if (OutdoorBinTemperature[BinNum] <= OATempCompressorOn) { LowTempCutOutFactor = 0.5; } else { LowTempCutOutFactor = 1.0; @@ -5960,7 +5958,7 @@ namespace StandardRatings { TotHeatElecPowerBinnedRH = BuildingHeatingLoad * (1.0 - LowTempCutOutFactor); goto HeatSpeedLoop_exit; - } else if ((BuildingHeatingLoad > HeatingCapacityLS) && (BuildingHeatingLoad < HeatingCapacityHS)) { + } else if (BuildingHeatingLoad < HeatingCapacityHS) { // cycle between speed "spnum" and "spnum + 1" LoadFactor = min(1.0, (HeatingCapacityHS - BuildingHeatingLoad) / (HeatingCapacityHS - HeatingCapacityLS)); LoadFactor = max(0.0, LoadFactor); @@ -5976,8 +5974,7 @@ namespace StandardRatings { if (!OATempCompressorOnOffBlank && HeatingElecPowerMax > 0.0) { if ((OutdoorBinTemperature[BinNum] <= OATempCompressorOff) || (HeatingCapacityMax / HeatingElecPowerMax < 1.0)) { LowTempCutOutFactor = 0.0; - } else if ((OutdoorBinTemperature[BinNum] > OATempCompressorOff && OutdoorBinTemperature[BinNum] <= OATempCompressorOn) && - (HeatingCapacityMax / HeatingElecPowerMax > 1.0)) { + } else if ((OutdoorBinTemperature[BinNum] <= OATempCompressorOn) && (HeatingCapacityMax / HeatingElecPowerMax > 1.0)) { LowTempCutOutFactor = 0.5; } else if ((OutdoorBinTemperature[BinNum] > OATempCompressorOn) && (HeatingCapacityMax / HeatingElecPowerMax > 1.0)) { LowTempCutOutFactor = 1.0; @@ -7200,21 +7197,11 @@ namespace StandardRatings { Real64 HeatingEIRIDBTempMin(0.0); // EIR modifier Min value (indoor dry bulb temperature) Real64 HeatingEIRIDBTempMax(0.0); // EIR modifier Max value (indoor dry bulb temperature) - bool CapCurveOATLimitsExceeded(false); // Logical for capacity curve OD temp. limits being exceeded (low and High) bool CapCurveHighOATLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (high temp) bool CapCurveFlowLimitsExceeded(false); // Logical for capacity curve flow fraction limits being exceeded bool EIRCurveHighOATLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded (high temp) bool EIRCurveFlowLimitsExceeded(false); // Logical for EIR curve flow fraction limits being exceeded - bool CapCurveMidOATLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (mid temp) - bool EIRCurveMidOATLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded (mid temp) - bool CapCurveLowOATLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (low temp) - bool EIRCurveLowOATLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded (Low temp) - bool PLFfPLRforSEERLimitsExceeded(false); // Logical for PLF function of PLR limits being exceeded - - bool CapCurveIEERLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded (IEER calcs) - bool EIRCurveIEERLimitsExceeded(false); // Logical for EIR temperature limits being exceeded (IEER calcs) - bool HeatingCapCurveHSPFLimitsExceeded(false); // Logical for capacity curve temperature limits being exceeded // (HSPF calcs) bool HeatingEIRCurveHSPFLimitsExceeded(false); // Logical for EIR curve temperature limits being exceeded @@ -7223,6 +7210,12 @@ namespace StandardRatings { switch (DXCoilTypeNum) { case CoilDX_CoolingSingleSpeed: { + bool CapCurveMidOATLimitsExceeded = false; // Logical for capacity curve temperature limits being exceeded (mid temp) + bool EIRCurveMidOATLimitsExceeded = false; // Logical for EIR curve temperature limits being exceeded (mid temp) + bool PLFfPLRforSEERLimitsExceeded = false; // Logical for PLF function of PLR limits being exceeded + bool CapCurveIEERLimitsExceeded = false; // Logical for capacity curve temperature limits being exceeded (IEER calcs) + bool EIRCurveIEERLimitsExceeded = false; // Logical for EIR temperature limits being exceeded (IEER calcs) + GetCurveMinMaxValues(state, CapFTempCurveIndex, CapacityWBTempMin, CapacityWBTempMax, CapacityDBTempMin, CapacityDBTempMax); GetCurveMinMaxValues(state, EIRFTempCurveIndex, EIRWBTempMin, EIRWBTempMax, EIRDBTempMin, EIRDBTempMax); GetCurveMinMaxValues(state, CapFFlowCurveIndex, CapacityFlowRatioMin, CapacityFlowRatioMax); @@ -7521,6 +7514,9 @@ namespace StandardRatings { break; } case CoilDX_MultiSpeedCooling: { + bool CapCurveLowOATLimitsExceeded = false; // Logical for capacity curve temperature limits being exceeded (low temp) + bool EIRCurveLowOATLimitsExceeded = false; // Logical for EIR curve temperature limits being exceeded (Low temp) + GetCurveMinMaxValues(state, CapFTempCurveIndex, CapacityWBTempMin, CapacityWBTempMax, CapacityDBTempMin, CapacityDBTempMax); GetCurveMinMaxValues(state, EIRFTempCurveIndex, EIRWBTempMin, EIRWBTempMax, EIRDBTempMin, EIRDBTempMax); GetCurveMinMaxValues(state, CapFFlowCurveIndex, CapacityFlowRatioMin, CapacityFlowRatioMax); @@ -7642,6 +7638,7 @@ namespace StandardRatings { } case CoilDX_MultiSpeedHeating: { + bool CapCurveOATLimitsExceeded = false; // Logical for capacity curve OD temp. limits being exceeded (low and High) { if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex)->numDims == 1) { GetCurveMinMaxValues(state, CapFTempCurveIndex, HeatingCapODBTempMin, HeatingCapODBTempMax); From bb326d3e2ed4115b4821c251524a55bc5741a289 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 15:54:21 -0400 Subject: [PATCH 071/108] unused, constexpr and scope --- src/EnergyPlus/StandardRatings.cc | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index 96cc3edf1d1..8d14a96aba9 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -1631,8 +1631,7 @@ namespace StandardRatings { Real64 IEER_2022(0.0); // Integerated Energy Efficiency Ratio in SI [W/W] Real64 NetCoolingCapRated2022(0.0); - int ns = 2; - Array1D NetCoolingCapRated_2023(ns); // Net Cooling Coil capacity at Rated conditions, accounting for supply fan heat [W] + int constexpr ns = 2; Array1D NetTotCoolingCapRated_2023(16); // net total cooling capacity of DX Coils for the sixteen ASHRAE Std 127 Test conditions Array1D TotElectricPowerRated_2023(16); // total electric power of DX Coils for the sixteen ASHRAE Std 127 Test conditions @@ -1716,8 +1715,6 @@ namespace StandardRatings { TSEIRFTemp, TSRatedCOP, EIRFFlowCurveIndex); - NetCoolingCapRated_2023(ns) = NetCoolingCapRated2022; - } else { ShowSevereError(state, "Standard Ratings: Coil:Cooling:DX:TwoSpeed either has a zero rated total cooling capacity or zero air flow rate. " @@ -1894,7 +1891,6 @@ namespace StandardRatings { ObjexxFCL::Optional DefrostControl) { Real64 DesignHeatingRequirement2023(0.0); // HSPF2 minimum design heating requirement [W] - int BinNum2023; // HSPF2 bin number counter Real64 FractionalBinHours2023(0.0); // HSPF2 Fractional bin hours for the heating season [-] Real64 BuildingLoad2023(0.0); // HSPF2 Building space conditioning load corresponding to an outdoor bin temperature [W] Real64 NetHeatingCapReduced2023(0.0); // HSPF2 Net Heating Coil capacity corresponding to an outdoor bin temperature [W] @@ -1920,7 +1916,7 @@ namespace StandardRatings { DesignHeatingRequirement2023 = NetHeatingCapRated_2023; Int64 RN = static_cast(RegionNum); - for (BinNum2023 = 0; BinNum2023 < TotalNumOfTemperatureBinsHSPF2[RN - 1]; ++BinNum2023) { + for (int BinNum2023 = 0; BinNum2023 < TotalNumOfTemperatureBinsHSPF2[RN - 1]; ++BinNum2023) { FractionalBinHours2023 = FracBinHoursAtOutdoorBinTempHSPF2[RN - 1][BinNum2023]; @@ -2462,7 +2458,7 @@ namespace StandardRatings { Array1D MSEIRAirFFlow; Array1D MSPLRFPLF; - int nsp = operatingMode.speeds.size(); + int const nsp = operatingMode.speeds.size(); for (int i = 0; i < nsp; ++i) { CoilCoolingDXCurveFitSpeed speed = operatingMode.speeds[i]; @@ -2515,7 +2511,7 @@ namespace StandardRatings { Array1D MSRatedCOP; Array1D MSEIRAirFFlow; - int nsp = operatingMode.speeds.size(); + int const nsp = operatingMode.speeds.size(); for (int i = 0; i < nsp; ++i) { CoilCoolingDXCurveFitSpeed speed = operatingMode.speeds[i]; @@ -5699,10 +5695,6 @@ namespace StandardRatings { Real64 NetHeatingCapRatedHighTemp(0.0); Real64 NetHeatingCapRatedLowTemp(0.0); - int BinNum; // bin number counter - int spnum; // compressor speed number - int StandardDHRNum; // Integer counter for standardized DHRs - Array1D FanPowerPerEvapAirFlowRate(nsp); // Fan power per air volume flow rate through the evaporator coil [W/(m3/s)] Array1D TotHeatCapTestH0(nsp); // Total cooling capacity at A2 test condition (High speed) Array1D TotHeatCapTestH1(nsp); // Total cooling capacity at B2 test condition (High speed) @@ -5758,7 +5750,7 @@ namespace StandardRatings { NetHeatingCapWeighted = 0.0; TotHeatingElecPowerWeighted = 0.0; - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { FanPowerPerEvapAirFlowRate(spnum) = 0.0; if (MSFanPowerPerEvapAirFlowRateInput(spnum) <= 0.0) { FanPowerPerEvapAirFlowRate(spnum) = DefaultFanPowerPerEvapAirFlowRate; @@ -5768,7 +5760,7 @@ namespace StandardRatings { } // Proceed withe HSPF value calculation - for (spnum = 1; spnum <= nsp; ++spnum) { + for (int spnum = 1; spnum <= nsp; ++spnum) { TotCapFlowModFac(spnum) = Curve::CurveValue(state, CapFFlowCurveIndex(spnum), AirMassFlowRatioRated); { if (state.dataCurveManager->PerfCurve(CapFTempCurveIndex(spnum))->numDims == 1) { @@ -5841,7 +5833,7 @@ namespace StandardRatings { DesignHeatingRequirementMax = 2.20 * DesignHeatingRequirementMin; } // Set the Design Heating Requirement to nearest standard value (From Table 18, AHRI/ANSI Std 210/240) - for (StandardDHRNum = 0; StandardDHRNum < TotalNumOfStandardDHRs - 1; ++StandardDHRNum) { + for (int StandardDHRNum = 0; StandardDHRNum < TotalNumOfStandardDHRs - 1; ++StandardDHRNum) { if (DesignHeatingRequirementMin < StandardDesignHeatingRequirement[0]) { DesignHeatingRequirement = min(StandardDesignHeatingRequirement[0], DesignHeatingRequirementMax); @@ -5862,7 +5854,7 @@ namespace StandardRatings { // The minimum temperature below which the compressor is turned off OATempCompressorOff = MinOATCompressor; - for (BinNum = 0; BinNum < TotalNumOfTemperatureBins[RegionNum - 1]; ++BinNum) { // NumOfOATempBins + for (int BinNum = 0; BinNum < TotalNumOfTemperatureBins[RegionNum - 1]; ++BinNum) { // NumOfOATempBins FractionalBinHours = FracBinHoursAtOutdoorBinTemp[RegionNum - 1][BinNum]; @@ -5889,7 +5881,7 @@ namespace StandardRatings { } // determine the speed number - for (spnum = 1; spnum <= nsp - 1; ++spnum) { + for (int spnum = 1; spnum <= nsp - 1; ++spnum) { // Low Speed if (OutdoorBinTemperature[BinNum] < -8.33) { HeatingCapacityLS = TotHeatCapTestH3(spnum) + ((TotHeatCapTestH1(spnum) - TotHeatCapTestH3(spnum)) * From 646e3886c772596830040851f8f2c00f9893942e Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 17:29:02 -0400 Subject: [PATCH 072/108] scope and duplicate conditional --- src/EnergyPlus/PipeHeatTransfer.cc | 34 +++++++++++----------------- src/EnergyPlus/Plant/PlantManager.cc | 4 ---- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/EnergyPlus/PipeHeatTransfer.cc b/src/EnergyPlus/PipeHeatTransfer.cc index f8761f3275c..cca0c3a5284 100644 --- a/src/EnergyPlus/PipeHeatTransfer.cc +++ b/src/EnergyPlus/PipeHeatTransfer.cc @@ -218,15 +218,12 @@ void GetPipesHeatTransfer(EnergyPlusData &state) bool ErrorsFound(false); // Set to true if errors in input, // fatal at end of routine - int IOStatus; // Used in GetObjectItem - int Item; // Item to be "gotten" - int PipeItem; + int IOStatus; // Used in GetObjectItem int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int NumOfPipeHTInt; // Number of Pipe Heat Transfer objects int NumOfPipeHTExt; // Number of Pipe Heat Transfer objects int NumOfPipeHTUG; // Number of Pipe Heat Transfer objects - int NumSections; // total number of sections in pipe auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; // Initializations and allocations cCurrentModuleObject = "Pipe:Indoor"; @@ -242,10 +239,10 @@ void GetPipesHeatTransfer(EnergyPlusData &state) state.dataPipeHT->PipeHT.allocate(state.dataPipeHT->nsvNumOfPipeHT); state.dataPipeHT->PipeHTUniqueNames.reserve(static_cast(state.dataPipeHT->nsvNumOfPipeHT)); - Item = 0; + int Item = 0; cCurrentModuleObject = "Pipe:Indoor"; - for (PipeItem = 1; PipeItem <= NumOfPipeHTInt; ++PipeItem) { + for (int PipeItem = 1; PipeItem <= NumOfPipeHTInt; ++PipeItem) { ++Item; // get the object name state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -399,7 +396,7 @@ void GetPipesHeatTransfer(EnergyPlusData &state) } // end of input loop cCurrentModuleObject = "Pipe:Outdoor"; - for (PipeItem = 1; PipeItem <= NumOfPipeHTExt; ++PipeItem) { + for (int PipeItem = 1; PipeItem <= NumOfPipeHTExt; ++PipeItem) { ++Item; // get the object name state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -534,7 +531,7 @@ void GetPipesHeatTransfer(EnergyPlusData &state) } // end of input loop cCurrentModuleObject = "Pipe:Underground"; - for (PipeItem = 1; PipeItem <= NumOfPipeHTUG; ++PipeItem) { + for (int PipeItem = 1; PipeItem <= NumOfPipeHTUG; ++PipeItem) { ++Item; // get the object name @@ -693,7 +690,6 @@ void GetPipesHeatTransfer(EnergyPlusData &state) GetGroundTempModelAndInit(state, state.dataIPShortCut->cAlphaArgs(7), state.dataIPShortCut->cAlphaArgs(8)); // Select number of pipe sections. Hanby's optimal number of 20 section is selected. - NumSections = NumPipeSections; state.dataPipeHT->PipeHT(Item).NumSections = NumPipeSections; // For buried pipes, we need to allocate the cartesian finite difference array @@ -707,7 +703,7 @@ void GetPipesHeatTransfer(EnergyPlusData &state) for (Item = 1; Item <= state.dataPipeHT->nsvNumOfPipeHT; ++Item) { // Select number of pipe sections. Hanby's optimal number of 20 section is selected. - NumSections = NumPipeSections; + int NumSections = NumPipeSections; state.dataPipeHT->PipeHT(Item).NumSections = NumPipeSections; // We need to allocate the Hanby model arrays for all pipes, including buried @@ -1191,9 +1187,6 @@ void PipeHTData::CalcPipesHeatTransfer(EnergyPlusData &state, ObjexxFCL::Optiona Real64 EnvHeatTransCoef(0.0); // external convection coefficient (outside pipe) Real64 FluidNodeHeatCapacity(0.0); // local var for MCp for single node of pipe - int PipeDepth(0); - int PipeWidth(0); - int curnode; Real64 TempBelow; Real64 TempBeside; Real64 TempAbove; @@ -1274,8 +1267,8 @@ void PipeHTData::CalcPipesHeatTransfer(EnergyPlusData &state, ObjexxFCL::Optiona if (present(LengthIndex)) { // Just simulate the single section if being called from Pipe:Underground - PipeDepth = this->PipeNodeDepth; - PipeWidth = this->PipeNodeWidth; + int PipeDepth = this->PipeNodeDepth; + int PipeWidth = this->PipeNodeWidth; TempBelow = this->T(PipeWidth, PipeDepth + 1, LengthIndex, TimeIndex::Current); TempBeside = this->T(PipeWidth - 1, PipeDepth, LengthIndex, TimeIndex::Current); TempAbove = this->T(PipeWidth, PipeDepth - 1, LengthIndex, TimeIndex::Current); @@ -1301,7 +1294,7 @@ void PipeHTData::CalcPipesHeatTransfer(EnergyPlusData &state, ObjexxFCL::Optiona // start loop along pipe // b1 must not be zero but this should have been checked on input - for (curnode = 1; curnode <= this->NumSections; ++curnode) { + for (int curnode = 1; curnode <= this->NumSections; ++curnode) { this->TentativeFluidTemp(curnode) = (A2 * this->TentativeFluidTemp(curnode - 1) + A3 / B1 * (B3 * state.dataPipeHT->nsvEnvironmentTemp + B4 * this->PreviousPipeTemp(curnode)) + A4 * this->PreviousFluidTemp(curnode)) / @@ -1356,7 +1349,6 @@ void PipeHTData::CalcBuriedPipeSoil(EnergyPlusData &state) // Current Simulation // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IterationIndex(0); // Index when stepping through equations - int LengthIndex(0); // Index for nodes along length of pipe int DepthIndex(0); // Index for nodes in the depth direction int WidthIndex(0); // Index for nodes in the width direction Real64 ConvCoef(0.0); // Current convection coefficient = f(Wind Speed,Roughness) @@ -1394,7 +1386,7 @@ void PipeHTData::CalcBuriedPipeSoil(EnergyPlusData &state) // Current Simulation } // Store computed values in T_O array - for (LengthIndex = 2; LengthIndex <= this->NumSections; ++LengthIndex) { + for (int LengthIndex = 2; LengthIndex <= this->NumSections; ++LengthIndex) { for (DepthIndex = 1; DepthIndex <= this->NumDepthNodes - 1; ++DepthIndex) { for (WidthIndex = 2; WidthIndex <= this->PipeNodeWidth; ++WidthIndex) { T_O(WidthIndex, DepthIndex, LengthIndex) = this->T(WidthIndex, DepthIndex, LengthIndex, TimeIndex::Tentative); @@ -1403,7 +1395,7 @@ void PipeHTData::CalcBuriedPipeSoil(EnergyPlusData &state) // Current Simulation } // Loop along entire length of pipe, analyzing cross sects - for (LengthIndex = 1; LengthIndex <= this->NumSections; ++LengthIndex) { + for (int LengthIndex = 1; LengthIndex <= this->NumSections; ++LengthIndex) { for (DepthIndex = 1; DepthIndex <= this->NumDepthNodes - 1; ++DepthIndex) { for (WidthIndex = 2; WidthIndex <= this->PipeNodeWidth; ++WidthIndex) { @@ -1479,7 +1471,7 @@ void PipeHTData::CalcBuriedPipeSoil(EnergyPlusData &state) // Current Simulation //-Update node for cartesian system this->T(WidthIndex, DepthIndex, LengthIndex, TimeIndex::Tentative) = this->PipeTemp(LengthIndex); - } else if (DepthIndex != 1) { // Not surface node + } else { // Not surface node //-Coefficients and Temperatures NodeLeft = this->T(WidthIndex - 1, DepthIndex, LengthIndex, TimeIndex::Current); @@ -1515,7 +1507,7 @@ void PipeHTData::CalcBuriedPipeSoil(EnergyPlusData &state) // Current Simulation } // Check for convergence - for (LengthIndex = 2; LengthIndex <= this->NumSections; ++LengthIndex) { + for (int LengthIndex = 2; LengthIndex <= this->NumSections; ++LengthIndex) { for (DepthIndex = 1; DepthIndex <= this->NumDepthNodes - 1; ++DepthIndex) { for (WidthIndex = 2; WidthIndex <= this->PipeNodeWidth; ++WidthIndex) { Ttemp = this->T(WidthIndex, DepthIndex, LengthIndex, TimeIndex::Tentative); diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 89c4fc4e631..d6642ffc35e 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -637,10 +637,6 @@ void GetPlantLoopData(EnergyPlusData &state) this_loop.PressureSimType = DataPlant::PressSimType::NoPressure; break; } - } - - // if we made it this far, there was no match, and it wasn't blank - if (!MatchedPressureString) { ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition."); ShowContinueError( state, "Invalid " + state.dataIPShortCut->cAlphaFieldNames(PressSimAlphaIndex) + "=\"" + Alpha(PressSimAlphaIndex) + "\"."); From dc85da0b270d36d2282b9d1291a8cd56b8b0afcc Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 17:43:47 -0400 Subject: [PATCH 073/108] const and unused var --- src/EnergyPlus/Plant/PlantManager.cc | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index d6642ffc35e..b4aad012012 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -255,7 +255,7 @@ void ManagePlantLoops(EnergyPlusData &state, // could set SimAirLoops, SimElecCircuits, SimZoneEquipment flags for now for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { for (DataPlant::LoopSideLocation LoopSide : DataPlant::LoopSideKeys) { - auto &this_loop_side(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide)); + auto const &this_loop_side(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide)); if (this_loop_side.SimAirLoopsNeeded) SimAirLoops = true; if (this_loop_side.SimZoneEquipNeeded) SimZoneEquipment = true; // IF (this_loop_side.SimNonZoneEquipNeeded) SimNonZoneEquipment = .TRUE. @@ -1769,7 +1769,7 @@ void GetPlantInput(EnergyPlusData &state) for (BranchNum = 1; BranchNum <= this_vent_cond_supply.TotalBranches; ++BranchNum) { - auto &this_cond_supply_branch(this_cond_supply.Branch(BranchNum)); + auto const &this_cond_supply_branch(this_cond_supply.Branch(BranchNum)); auto &this_vent_cond_supply_branch(this_vent_cond_supply.Branch(BranchNum)); this_vent_cond_supply_branch.Name = this_cond_supply_branch.Name; @@ -1783,7 +1783,7 @@ void GetPlantInput(EnergyPlusData &state) for (CompNum = 1; CompNum <= this_vent_cond_supply_branch.TotalComponents; ++CompNum) { - auto &this_cond_supply_comp(this_cond_loop.LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum)); + auto const &this_cond_supply_comp(this_cond_loop.LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum)); auto &this_vent_cond_supply_comp(this_vent_cond_supply.Branch(BranchNum).Comp(CompNum)); this_vent_cond_supply_comp.Name = this_cond_supply_comp.Name; @@ -1821,7 +1821,7 @@ void GetPlantInput(EnergyPlusData &state) for (CompNum = 1; CompNum <= this_vent_cond_demand_branch.TotalComponents; ++CompNum) { - auto &this_cond_demand_comp(this_cond_demand_branch.Comp(CompNum)); + auto const &this_cond_demand_comp(this_cond_demand_branch.Comp(CompNum)); auto &this_vent_cond_demand_comp(this_vent_cond_demand_branch.Comp(CompNum)); this_vent_cond_demand_comp.Name = this_cond_demand_comp.Name; @@ -1843,7 +1843,7 @@ void GetPlantInput(EnergyPlusData &state) plantLoop.LoopHasConnectionComp = false; for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) { - auto &loopSide = plantLoop.LoopSide(LoopSideNum); + auto const &loopSide = plantLoop.LoopSide(LoopSideNum); for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) { @@ -3428,12 +3428,11 @@ void ResizePlantLoopLevelSizes(EnergyPlusData &state, int const LoopNum // Suppl static constexpr std::string_view RoutineName("ResizePlantLoop"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PlantSizNum(0); // index of Plant Sizing data for this loop - int BranchNum; // DO loop counter for cycling through branches on a demand side loop - int CompNum; // DO loop counter for cycling through components on a demand side loop - int SupNodeNum; // component inlet water node number - int WaterCompNum; // DO loop counter for cycling through all the components that demand water - bool ErrorsFound(false); // If errors detected in input + int PlantSizNum(0); // index of Plant Sizing data for this loop + int BranchNum; // DO loop counter for cycling through branches on a demand side loop + int CompNum; // DO loop counter for cycling through components on a demand side loop + int SupNodeNum; // component inlet water node number + int WaterCompNum; // DO loop counter for cycling through all the components that demand water Real64 FluidDensity(0.0); // local value from glycol routine @@ -3534,10 +3533,6 @@ void ResizePlantLoopLevelSizes(EnergyPlusData &state, int const LoopNum // Suppl state.dataPlnt->PlantLoop(LoopNum).MaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * FluidDensity; state.dataPlnt->PlantLoop(LoopNum).MinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * FluidDensity; - - if (ErrorsFound) { - ShowFatalError(state, "Preceding sizing errors cause program termination"); - } } void SetupInitialPlantCallingOrder(EnergyPlusData &state) @@ -3893,7 +3888,6 @@ void SetupBranchControlTypes(EnergyPlusData &state) } break; case DataPlant::PlantEquipmentType::Chiller_EngineDriven: { // = 11 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active; - this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit; if (LoopSideCtr == LoopSideLocation::Demand) { this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn; this_component.HowLoadServed = DataPlant::HowMet::NoneDemand; From 2f4654029a992661192099a310b8226cdbd9b7fc Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 17:48:48 -0400 Subject: [PATCH 074/108] const --- src/EnergyPlus/Plant/PlantManager.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index b4aad012012..6b34f258844 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -2105,7 +2105,7 @@ void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData constexpr std::string_view branch = "Branch"; for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) { - auto &thisComp = thisBranch.Comp(compNum); + auto const &thisComp = thisBranch.Comp(compNum); fillPlantToplogyComponentRow2(state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter); } @@ -2119,7 +2119,7 @@ void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData } for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) { - auto &thisComp = thisBranch.Comp(compNum); + auto const &thisComp = thisBranch.Comp(compNum); // fillPlantToplogyRow(state, thisComp.Name, thisComp.TypeOf, loopSide, branch, thisBranch.Name, thisLoop.FluidName, repOffset); fillPlantToplogyComponentRow2( state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter); @@ -2136,7 +2136,7 @@ void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData // Outlet Branch auto &thisBranch = thisLoopSide.Branch(thisLoopSide.TotalBranches); for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) { - auto &thisComp = thisBranch.Comp(compNum); + auto const &thisComp = thisBranch.Comp(compNum); fillPlantToplogyComponentRow2(state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter); } } From 74116caf0daa2c62eab25ba6e362b075878760fe Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:01:28 -0400 Subject: [PATCH 075/108] scope --- src/EnergyPlus/Plant/PlantManager.cc | 52 +++++++++++----------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 6b34f258844..fd6242bd160 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -305,8 +305,6 @@ void GetPlantLoopData(EnergyPlusData &state) Array1D_string Alpha(18); // dimension to num of alpha fields in input Array1D Num(30); // dimension to num of numeric data fields in input bool ErrorsFound(false); - std::string LoadingScheme; - bool ErrFound; std::string CurrentModuleObject; // for ease in renaming. bool MatchedPressureString; int PressSimAlphaIndex; @@ -498,7 +496,7 @@ void GetPlantLoopData(EnergyPlusData &state) ObjectIsParent); // Load the load distribution scheme. - LoadingScheme = Alpha(14); + std::string LoadingScheme = Alpha(14); if (Util::SameString(LoadingScheme, "Optimal")) { this_loop.LoadDistribution = DataPlant::LoadingScheme::Optimal; } else if (Util::SameString(LoadingScheme, "SequentialLoad")) { @@ -644,7 +642,7 @@ void GetPlantLoopData(EnergyPlusData &state) } } - ErrFound = false; + bool ErrFound = false; if (this_loop.TypeOfLoop == LoopType::Plant) { Avail::GetPlantAvailabilityManager(state, Alpha(15), LoopNum, state.dataPlnt->TotNumLoops, ErrFound); @@ -757,7 +755,6 @@ void GetPlantInput(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int LoopNum; // DO loop counter for loops int HalfLoopNum; - int NumOfPipesInLoop; int BranchNum; // DO loop counter for branches int CompNum; // DO loop counter for components int NodeNum; // DO loop counter for nodes @@ -792,7 +789,6 @@ void GetPlantInput(EnergyPlusData &state) Array1D_bool SplitOutBranch; Array1D_bool MixerInBranch; bool errFlag; - int LoopNumInArray; state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Connector:Splitter", NumParams, NumAlphas, NumNumbers); MaxNumAlphas = NumAlphas; @@ -808,7 +804,7 @@ void GetPlantInput(EnergyPlusData &state) auto &loopSide = plantLoop.LoopSide(LoopSideNum); ASeriesBranchHasPump = false; AParallelBranchHasPump = false; - NumOfPipesInLoop = 0; // Initialization + int NumOfPipesInLoop = 0; // Initialization ++HalfLoopNum; loopSide.BypassExists = false; if (plantLoop.TypeOfLoop == LoopType::Plant && LoopSideNum == LoopSideLocation::Demand) { @@ -1750,7 +1746,7 @@ void GetPlantInput(EnergyPlusData &state) for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumCondLoops; ++LoopNum) { - LoopNumInArray = LoopNum + state.dataHVACGlobal->NumPlantLoops; + int LoopNumInArray = LoopNum + state.dataHVACGlobal->NumPlantLoops; // set up references for this loop auto &this_cond_loop(state.dataPlnt->PlantLoop(LoopNumInArray)); @@ -2217,17 +2213,11 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr using PlantUtilities::SetAllFlowLocks; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int LoopNum; // plant loop counter DataPlant::LoopSideLocation LoopSideNum; int BranchNum; // branch loop counter int CompNum; // plant side component counter - int SensedNode; bool ErrorsFound(false); - bool FinishSizingFlag; - - int HalfLoopNum; - int passNum; if (!allocated(state.dataPlantMgr->PlantLoopSetPointInitFlag)) { state.dataPlantMgr->PlantLoopSetPointInitFlag.allocate(state.dataPlnt->TotNumLoops); @@ -2257,9 +2247,9 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr if (state.dataPlantMgr->MySetPointCheckFlag && state.dataHVACGlobal->DoSetPointTest) { // check for missing setpoints - for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { + for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - SensedNode = state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum; + int SensedNode = state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum; if (SensedNode > 0) { if (state.dataLoopNodes->Node(SensedNode).TempSetPoint == SensedNodeFlagValue) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { @@ -2293,16 +2283,16 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr if (!state.dataPlnt->PlantFirstSizeCompleted) { SetAllFlowLocks(state, DataPlant::FlowLock::Unlocked); - FinishSizingFlag = false; + bool FinishSizingFlag = false; state.dataPlnt->PlantFirstSizesOkayToFinalize = false; // set global flag for when it ready to store final sizes state.dataPlnt->PlantFirstSizesOkayToReport = false; state.dataPlnt->PlantFinalSizesOkayToReport = false; state.dataPlantMgr->GetCompSizFac = true; - for (passNum = 1; passNum <= 4; ++passNum) { // begin while loop to iterate over the next calls sequentially + for (int passNum = 1; passNum <= 4; ++passNum) { // begin while loop to iterate over the next calls sequentially // Step 2, call component models it using PlantCallingOrderInfo for sizing - for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { - LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; + for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { + int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide; state.dataSize->CurLoopNum = LoopNum; @@ -2326,9 +2316,9 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // Step 4: Simulate plant loop components so their design flows are included - for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { + for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { - LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; + int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide; state.dataSize->CurLoopNum = LoopNum; if (LoopSideNum == LoopSideLocation::Supply) { @@ -2339,7 +2329,7 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr } // iterative passes thru sizing related routines. end while? // Step 5 now one more time for the final - for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { + for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { if (state.dataGlobal->DoHVACSizingSimulation) { state.dataPlnt->PlantFirstSizesOkayToFinalize = true; FinishSizingFlag = true; @@ -2351,7 +2341,7 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr state.dataPlnt->PlantFirstSizesOkayToReport = false; state.dataPlnt->PlantFinalSizesOkayToReport = true; } - LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; + int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide; state.dataSize->CurLoopNum = LoopNum; if (LoopSideNum == LoopSideLocation::Supply) { @@ -2386,8 +2376,8 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // cycle through plant equipment calling with InitLoopEquip true state.dataPlantMgr->GetCompSizFac = false; - for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { - LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; + for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { + int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide; state.dataSize->CurLoopNum = LoopNum; @@ -2406,13 +2396,13 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // reset loop level state.dataPlnt->PlantFinalSizesOkayToReport = true; - for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { + for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { ResizePlantLoopLevelSizes(state, LoopNum); } // now call everything again to reporting turned on - for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { - LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; + for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { + int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide; state.dataSize->CurLoopNum = LoopNum; @@ -2441,7 +2431,7 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr //***************************************************************** if (state.dataPlantMgr->SupplyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) { - for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { + for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { // check if setpoints being placed on node properly if (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand) { if (state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointHi == SensedNodeFlagValue) { @@ -2494,7 +2484,7 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // Any per-environment load distribution init should be OK here // Just clear away any trailing MyLoad for now... // This could likely be moved into InitLoadDistribution also... - for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { + for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) { for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; From 0fb7bb36f2727b224724f5bb5fcc303bae704c9d Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:06:39 -0400 Subject: [PATCH 076/108] Shadow var --- src/EnergyPlus/Plant/PlantManager.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index fd6242bd160..cbb4d6ec9d0 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -254,8 +254,8 @@ void ManagePlantLoops(EnergyPlusData &state, // add check for non-plant system sim flag updates // could set SimAirLoops, SimElecCircuits, SimZoneEquipment flags for now for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - for (DataPlant::LoopSideLocation LoopSide : DataPlant::LoopSideKeys) { - auto const &this_loop_side(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide)); + for (DataPlant::LoopSideLocation LoopSideChk : DataPlant::LoopSideKeys) { + auto const &this_loop_side(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideChk)); if (this_loop_side.SimAirLoopsNeeded) SimAirLoops = true; if (this_loop_side.SimZoneEquipNeeded) SimZoneEquipment = true; // IF (this_loop_side.SimNonZoneEquipNeeded) SimNonZoneEquipment = .TRUE. From a8acbaf027b264e8c8a95d30141e1ec868f2fe37 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:12:32 -0400 Subject: [PATCH 077/108] scope --- src/EnergyPlus/Plant/PlantManager.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index cbb4d6ec9d0..7d392c4b183 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -2544,7 +2544,6 @@ void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state) int BranchNum; // branch loop counter int OpNum; // operation scheme counter int CompNum; // plant side component counter - int BranchInlet; // branch inlet node number int ComponentInlet; // component inlet node number int ComponentOutlet; // component outlet node number @@ -2656,7 +2655,7 @@ void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state) ++CompNum) { ComponentInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumIn; ComponentOutlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumOut; - BranchInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).NodeNumIn; + int BranchInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).NodeNumIn; state.dataLoopNodes->Node(ComponentInlet).Temp = LoopSetPointTemp; state.dataLoopNodes->Node(ComponentInlet).TempMin = LoopMinTemp; @@ -2905,9 +2904,8 @@ void CheckPlantOnAbort(EnergyPlusData &state) int ParalBranchNum; // used to search for active control branches in parallel with bypass branches int ParalBranchNum2; // used to search for active control branches in parallel with bypass branches int BranchNum2; // used to search for active control branches in parallel with bypass branches - int numLoopSides; - int BranchNum; // DO loop counter for branches - int CompNum; // do loop for multiple components on a branch + int BranchNum; // DO loop counter for branches + int CompNum; // do loop for multiple components on a branch bool ShouldBeACTIVE; if (!(state.dataErrTracking->AskForPlantCheckOnAbort)) { @@ -2918,7 +2916,7 @@ void CheckPlantOnAbort(EnergyPlusData &state) if (!(allocated(state.dataPlnt->PlantLoop))) return; for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - numLoopSides = 2; + int constexpr numLoopSides = 2; for (DataPlant::LoopSideLocation SideNum : DataPlant::LoopSideKeys) { if (!(state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.Exists)) continue; From 72cfc4c496c7d0d01fc891142162c16c5bb91834 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:17:20 -0400 Subject: [PATCH 078/108] unused and shadow var --- src/EnergyPlus/Plant/PlantManager.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 7d392c4b183..4466795daf6 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -804,7 +804,6 @@ void GetPlantInput(EnergyPlusData &state) auto &loopSide = plantLoop.LoopSide(LoopSideNum); ASeriesBranchHasPump = false; AParallelBranchHasPump = false; - int NumOfPipesInLoop = 0; // Initialization ++HalfLoopNum; loopSide.BypassExists = false; if (plantLoop.TypeOfLoop == LoopType::Plant && LoopSideNum == LoopSideLocation::Demand) { @@ -2108,17 +2107,18 @@ void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData if (thisLoopSide.TotalBranches >= 3) { // parallel branches for (int branchNum = 2; branchNum <= thisLoopSide.TotalBranches - 1; ++branchNum) { - auto &thisBranch = thisLoopSide.Branch(branchNum); + auto &thisBranchNext = thisLoopSide.Branch(branchNum); // splitter if (thisLoopSide.Splitter.Exists) { fillPlantToplogySplitterRow2(state, loopType, thisLoop.Name, loopSide, thisLoopSide.Splitter.Name, rowCounter); } - for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) { - auto const &thisComp = thisBranch.Comp(compNum); - // fillPlantToplogyRow(state, thisComp.Name, thisComp.TypeOf, loopSide, branch, thisBranch.Name, thisLoop.FluidName, repOffset); + for (int compNum = 1; compNum <= thisBranchNext.TotalComponents; ++compNum) { + auto const &thisComp = thisBranchNext.Comp(compNum); + // fillPlantToplogyRow(state, thisComp.Name, thisComp.TypeOf, loopSide, branch, thisBranchNext.Name, thisLoop.FluidName, + // repOffset); fillPlantToplogyComponentRow2( - state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter); + state, loopType, thisLoop.Name, loopSide, thisBranchNext.Name, thisComp.TypeOf, thisComp.Name, rowCounter); } // mixer if (thisLoopSide.Mixer.Exists) { @@ -2130,10 +2130,11 @@ void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData } // Outlet Branch - auto &thisBranch = thisLoopSide.Branch(thisLoopSide.TotalBranches); - for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) { - auto const &thisComp = thisBranch.Comp(compNum); - fillPlantToplogyComponentRow2(state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter); + auto &thisBranchLast = thisLoopSide.Branch(thisLoopSide.TotalBranches); + for (int compNum = 1; compNum <= thisBranchLast.TotalComponents; ++compNum) { + auto const &thisComp = thisBranchLast.Comp(compNum); + fillPlantToplogyComponentRow2( + state, loopType, thisLoop.Name, loopSide, thisBranchLast.Name, thisComp.TypeOf, thisComp.Name, rowCounter); } } } From 5d89e714d9addbf0629ff5be06140178bf42123a Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:22:00 -0400 Subject: [PATCH 079/108] scope --- src/EnergyPlus/Plant/PlantManager.cc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 4466795daf6..2de5910d0ba 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -3038,12 +3038,9 @@ void InitOneTimePlantSizingInfo(EnergyPlusData &state, int const LoopNum) // loo // Using/Aliasing using DataSizing::PlantSizingData; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PlantSizNum(0); // index of Plant Sizing data for this loop - if (state.dataPlnt->PlantLoop(LoopNum).PlantSizNum == 0) { if (state.dataSize->NumPltSizInput > 0) { - PlantSizNum = + int PlantSizNum = Util::FindItemInList(state.dataPlnt->PlantLoop(LoopNum).Name, state.dataSize->PlantSizData, &PlantSizingData::PlantLoopName); if (PlantSizNum > 0) { state.dataPlnt->PlantLoop(LoopNum).PlantSizNum = PlantSizNum; @@ -3078,9 +3075,6 @@ void SizePlantLoop(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PlantSizNum(0); // index of Plant Sizing data for this loop - int BranchNum; // DO loop counter for cycling through branches on a demand side loop - int CompNum; // DO loop counter for cycling through components on a demand side loop - int SupNodeNum; // component inlet water node number int WaterCompNum; // DO loop counter for cycling through all the components that demand water bool ErrorsFound(false); // If errors detected in input Real64 LoopSizFac(0.0); @@ -3106,7 +3100,7 @@ void SizePlantLoop(EnergyPlusData &state, // are assigned sizing factors of zero in this calculation if (PlantSizNum > 0) { if (state.dataPlantMgr->GetCompSizFac) { - for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) { + for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) { BranchSizFac = 0.0; state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = 1.0; if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn == @@ -3115,7 +3109,7 @@ void SizePlantLoop(EnergyPlusData &state, if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumOut == state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumOut) continue; - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents; + for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents; ++CompNum) { state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).simulate(state, true); BranchSizFac = max(BranchSizFac, @@ -3140,7 +3134,7 @@ void SizePlantLoop(EnergyPlusData &state, // store the sizing factor now, for later reuse, state.dataSize->PlantSizData(PlantSizNum).PlantSizFac = PlantSizFac; // might deprecate this next bit in favor of simpler storage in PlantSizData structure - for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) { + for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) { if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn == state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumIn) { state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = PlantSizFac; @@ -3154,10 +3148,10 @@ void SizePlantLoop(EnergyPlusData &state, // sum up contributions from CompDesWaterFlow, demand side size request (non-coincident) state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate = 0.0; // init for summation - for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches; ++BranchNum) { - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents; + for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches; ++BranchNum) { + for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents; ++CompNum) { - SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn; + int SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn; for (WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) { if (SupNodeNum == state.dataSize->CompDesWaterFlow(WaterCompNum).SupNode) { state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate += state.dataSize->CompDesWaterFlow(WaterCompNum).DesVolFlowRate; From 715c19fab16bb00940fc112410c809d31e559205 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:28:24 -0400 Subject: [PATCH 080/108] scope --- src/EnergyPlus/Plant/PlantManager.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 2de5910d0ba..3a8c5d07372 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -3075,7 +3075,6 @@ void SizePlantLoop(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PlantSizNum(0); // index of Plant Sizing data for this loop - int WaterCompNum; // DO loop counter for cycling through all the components that demand water bool ErrorsFound(false); // If errors detected in input Real64 LoopSizFac(0.0); Real64 AvLoopSizFac; @@ -3109,7 +3108,8 @@ void SizePlantLoop(EnergyPlusData &state, if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumOut == state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumOut) continue; - for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents; + for (int CompNum = 1; + CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents; ++CompNum) { state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).simulate(state, true); BranchSizFac = max(BranchSizFac, @@ -3152,7 +3152,7 @@ void SizePlantLoop(EnergyPlusData &state, for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents; ++CompNum) { int SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn; - for (WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) { + for (int WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) { if (SupNodeNum == state.dataSize->CompDesWaterFlow(WaterCompNum).SupNode) { state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate += state.dataSize->CompDesWaterFlow(WaterCompNum).DesVolFlowRate; } @@ -3413,9 +3413,6 @@ void ResizePlantLoopLevelSizes(EnergyPlusData &state, int const LoopNum // Suppl // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PlantSizNum(0); // index of Plant Sizing data for this loop int BranchNum; // DO loop counter for cycling through branches on a demand side loop - int CompNum; // DO loop counter for cycling through components on a demand side loop - int SupNodeNum; // component inlet water node number - int WaterCompNum; // DO loop counter for cycling through all the components that demand water Real64 FluidDensity(0.0); // local value from glycol routine @@ -3437,10 +3434,10 @@ void ResizePlantLoopLevelSizes(EnergyPlusData &state, int const LoopNum // Suppl state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate = 0.0; // init for summation for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches; ++BranchNum) { - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents; + for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents; ++CompNum) { - SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn; - for (WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) { + int SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn; + for (int WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) { if (SupNodeNum == state.dataSize->CompDesWaterFlow(WaterCompNum).SupNode) { state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate += state.dataSize->CompDesWaterFlow(WaterCompNum).DesVolFlowRate; } From b7f15e2373775c061c81eaec8a636cc55c9d2d5a Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:39:49 -0400 Subject: [PATCH 081/108] Shadow var and scope --- src/EnergyPlus/Plant/PlantManager.cc | 42 ++++++---------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 3a8c5d07372..aab4c3c8bec 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -2486,13 +2486,13 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // Just clear away any trailing MyLoad for now... // This could likely be moved into InitLoadDistribution also... for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) { - for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; + for (DataPlant::LoopSideLocation ResetLoopNum : DataPlant::LoopSideKeys) { + for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).TotalBranches; ++BranchNum) { + for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { - state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).MyLoad = 0.0; - state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).FreeCoolCntrlShutDown = false; - state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).Available = false; + state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).Comp(CompNum).MyLoad = 0.0; + state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).Comp(CompNum).FreeCoolCntrlShutDown = false; + state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).Comp(CompNum).Available = false; } } } @@ -2830,27 +2830,6 @@ void UpdateNodeThermalHistory(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // copy current values into "LastTimestep" values - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - // array assignment if (state.dataLoopNodes->NumOfNodes > 0) { for (auto &e : state.dataLoopNodes->Node) { // MA @@ -3596,23 +3575,20 @@ void RevisePlantCallingOrder(EnergyPlusData &state) using PlantUtilities::ShiftPlantLoopSideCallingOrder; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int HalfLoopNum; - int LoopNum; DataPlant::LoopSideLocation LoopSideNum; - int OtherLoopNum; DataPlant::LoopSideLocation OtherLoopSideNum; bool thisLoopPutsDemandOnAnother; int ConnctNum; - for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { + for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { - LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; + int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide; if (allocated(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected)) { for (ConnctNum = 1; ConnctNum <= isize(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected); ++ConnctNum) { - OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopNum; + int OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopNum; OtherLoopSideNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopSideNum; state.dataPlantMgr->OtherLoopCallingIndex = FindLoopSideInCallingOrder(state, OtherLoopNum, OtherLoopSideNum); From 91a238b0aa8ee3218fc1c4cf304038a47aed41b3 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 18:53:23 -0400 Subject: [PATCH 082/108] scope --- src/EnergyPlus/PlantCentralGSHP.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/PlantCentralGSHP.cc b/src/EnergyPlus/PlantCentralGSHP.cc index 22b83365e15..82f45d84477 100644 --- a/src/EnergyPlus/PlantCentralGSHP.cc +++ b/src/EnergyPlus/PlantCentralGSHP.cc @@ -209,13 +209,11 @@ void WrapperSpecs::SizeWrapper(EnergyPlusData &state) static constexpr std::string_view RoutineName("SizeCGSHPChillerHeater"); - bool ErrorsFound; // If errors detected in input - // auto-size the chiller heater components if (this->ControlMode == CondenserType::SmartMixing) { for (int NumChillerHeater = 1; NumChillerHeater <= this->ChillerHeaterNums; ++NumChillerHeater) { - ErrorsFound = false; + bool ErrorsFound = false; // find the appropriate Plant Sizing object int PltSizNum = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).PlantSizNum; @@ -588,7 +586,6 @@ void GetWrapperInput(EnergyPlusData &state) state.dataPlantCentralGSHP->Wrapper(WrapperNum).Name = state.dataIPShortCut->cAlphaArgs(1); // initialize nth chiller heater index (including identical units) for current wrapper - int NumChHtrPerWrapper = 0; if (Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound)) { continue; } @@ -697,6 +694,7 @@ void GetWrapperInput(EnergyPlusData &state) ErrorsFound = true; } else { int Comp = 0; + int NumChHtrPerWrapper = 0; for (int loop = 10; loop <= NumAlphas; loop += 3) { ++Comp; state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).WrapperPerformanceObjectType = @@ -1169,7 +1167,6 @@ void GetChillerHeaterInput(EnergyPlusData &state) // This routine will get the input required by the ChillerHeaterPerformance:Electric:EIR model. bool CHErrorsFound(false); // True when input errors are found - bool FoundNegValue(false); // Used to evaluate PLFFPLR curve objects 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 @@ -1433,7 +1430,7 @@ void GetChillerHeaterInput(EnergyPlusData &state) } if (state.dataPlantCentralGSHP->ChillerHeater(ChillerHeaterNum).ChillerEIRFPLRCoolingIDX > 0) { - FoundNegValue = false; + bool FoundNegValue = false; for (int CurveCheck = 0; CurveCheck <= 10; ++CurveCheck) { Real64 CurveValTmp = Curve::CurveValue( state, state.dataPlantCentralGSHP->ChillerHeater(ChillerHeaterNum).ChillerEIRFPLRCoolingIDX, double(CurveCheck / 10.0)); @@ -1496,7 +1493,7 @@ void GetChillerHeaterInput(EnergyPlusData &state) } if (state.dataPlantCentralGSHP->ChillerHeater(ChillerHeaterNum).ChillerEIRFPLRHeatingIDX > 0) { - FoundNegValue = false; + bool FoundNegValue = false; for (int CurveCheck = 0; CurveCheck <= 10; ++CurveCheck) { Real64 CurveValTmp = Curve::CurveValue( state, state.dataPlantCentralGSHP->ChillerHeater(ChillerHeaterNum).ChillerEIRFPLRHeatingIDX, double(CurveCheck / 10.0)); From ae3f5efb16777e5cd3041c68ae3c2156fd286d33 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 19:00:05 -0400 Subject: [PATCH 083/108] Value never used --- src/EnergyPlus/PlantCentralGSHP.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/PlantCentralGSHP.cc b/src/EnergyPlus/PlantCentralGSHP.cc index 82f45d84477..8b8c4ba8332 100644 --- a/src/EnergyPlus/PlantCentralGSHP.cc +++ b/src/EnergyPlus/PlantCentralGSHP.cc @@ -1824,7 +1824,7 @@ void WrapperSpecs::CalcChillerModel(EnergyPlusData &state) static constexpr std::string_view RoutineName("CalcChillerHeaterModel"); static constexpr std::string_view RoutineNameElecEIRChiller("CalcElectricEIRChillerModel"); - bool IsLoadCoolRemaining(true); + bool IsLoadCoolRemaining; bool NextCompIndicator(false); // Component indicator when identical chiller heaters exist int CompNum = 0; // Component number in the loop REAL(r64) :: FRAC int IdenticalUnitCounter = 0; // Pointer to count number of identical unit passed @@ -2191,7 +2191,7 @@ void WrapperSpecs::CalcChillerHeaterModel(EnergyPlusData &state) static constexpr std::string_view RoutineName("CalcChillerHeaterModel"); static constexpr std::string_view RoutineNameElecEIRChiller("CalcElectricEIRChillerModel"); - bool IsLoadHeatRemaining(true); // Ture if heating load remains for this chiller heater + bool IsLoadHeatRemaining; // Ture if heating load remains for this chiller heater bool NextCompIndicator(false); // Component indicator when identical chiller heaters exist int CompNum(0); // Component number int IdenticalUnitCounter = 0; // Pointer to count number of identical unit passed From d6436d02328815bcc27b364590ae50f7d15e8d87 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 19:19:47 -0400 Subject: [PATCH 084/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 39a5f69ed1b..e77629d5316 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -127,8 +127,6 @@ void ManagePlantLoadDistribution(EnergyPlusData &state, // appropriate type of control algorithm (setpoint, load range based, // or uncontrolled) for the component - int ListNum; // DO loop index in PlantLoop()%LoopSide()%Branch()%Comp()%OpScheme()%EquipList(ListNum) - int CurListNum; // Current list...= ListNum, used for error checking only // Indices in PlantLoop.LoopSide.Branch.Comp data structure int CurCompLevelOpNum; // This is set by the init routine at each FirstHVACIteration. // It tells which scheme for this component is currently scheduled @@ -138,7 +136,6 @@ void ManagePlantLoadDistribution(EnergyPlusData &state, // Used as indices in PlantLoop.OpScheme() data structure int CurSchemePtr; // set by PlantLoop.LoopSide.Branch.Comp.OpScheme.OpSchemePtr // used to locate data in PL()%OpScheme(CurSchemePtr) - int ListPtr; // !set by PL()%LoopSide()%Branch()%Comp()%OpScheme(CurCompLevelOpNum)%EquipList(CurListNum)ListPtr // used to locate data in PL()%OpScheme(CurSchemePtr)%EquipList(ListPtr) // Local values from the PlantLoop()%OpScheme() data structure Real64 RangeVariable(0.0); // holds the 'loop demand', wetbulb temp, etc. @@ -268,8 +265,9 @@ void ManagePlantLoadDistribution(EnergyPlusData &state, break; } default: { // it's a range based control type with multiple equipment lists - CurListNum = 0; - for (ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { + int ListPtr = 0; + int CurListNum = 0; + for (int ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { // setpointers to 'PlantLoop()%OpScheme()...'structure ListPtr = this_component.OpScheme(CurCompLevelOpNum).EquipList(ListNum).ListPtr; RangeHiLimit = this_op_scheme.EquipList(ListPtr).RangeUpperLimit; @@ -299,7 +297,7 @@ void ManagePlantLoadDistribution(EnergyPlusData &state, if (CurListNum > 0) { // there could be equipment on another list that needs to be nulled out, it may have a load from earlier iteration - for (ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { + for (int ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { if (ListNum == CurListNum) continue; // leave current one alone NumCompsOnList = this_op_scheme.EquipList(ListNum).NumComps; for (CompIndex = 1; CompIndex <= NumCompsOnList; ++CompIndex) { From 3ff287214985de4083a8a49d1140969fffb37897 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 19:34:36 -0400 Subject: [PATCH 085/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index e77629d5316..86661b3dcbf 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -145,10 +145,6 @@ void ManagePlantLoadDistribution(EnergyPlusData &state, // Local values from the PlantLoop()%LoopSide()%Branch()%Comp() data structure int NumEquipLists; // number of equipment lists // Error control flags - int NumCompsOnList; - int CompIndex; - int EquipBranchNum; - int EquipCompNum; // Shut down equipment and return if so instructed by LoopShutDownFlag if (LoopShutDownFlag) { @@ -299,10 +295,10 @@ void ManagePlantLoadDistribution(EnergyPlusData &state, // there could be equipment on another list that needs to be nulled out, it may have a load from earlier iteration for (int ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { if (ListNum == CurListNum) continue; // leave current one alone - NumCompsOnList = this_op_scheme.EquipList(ListNum).NumComps; - for (CompIndex = 1; CompIndex <= NumCompsOnList; ++CompIndex) { - EquipBranchNum = this_op_scheme.EquipList(ListNum).Comp(CompIndex).BranchNumPtr; - EquipCompNum = this_op_scheme.EquipList(ListNum).Comp(CompIndex).CompNumPtr; + int NumCompsOnList = this_op_scheme.EquipList(ListNum).NumComps; + for (int CompIndex = 1; CompIndex <= NumCompsOnList; ++CompIndex) { + int EquipBranchNum = this_op_scheme.EquipList(ListNum).Comp(CompIndex).BranchNumPtr; + int EquipCompNum = this_op_scheme.EquipList(ListNum).Comp(CompIndex).CompNumPtr; loop_side.Branch(EquipBranchNum).Comp(EquipCompNum).MyLoad = 0.0; } } @@ -353,7 +349,6 @@ void GetPlantOperationInput(EnergyPlusData &state, bool &GetInputOK) int NumAlphas; // Number of alpha items in the input object int NumNums; // Number of numeric items in the input object int IOStat; - std::string PlantOpSchemeName; // Name of the plant or condenser operating scheme std::string CurrentModuleObject; // for ease in renaming std::string PlantLoopObject; // for ease in renaming bool ErrorsFound; // Passed in from OpSchemeInput @@ -386,7 +381,7 @@ void GetPlantOperationInput(EnergyPlusData &state, bool &GetInputOK) // Load the Plant data structure for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - PlantOpSchemeName = state.dataPlnt->PlantLoop(LoopNum).OperationScheme; + std::string PlantOpSchemeName = state.dataPlnt->PlantLoop(LoopNum).OperationScheme; if (LoopNum <= state.dataHVACGlobal->NumPlantLoops) { CurrentModuleObject = "PlantEquipmentOperationSchemes"; PlantLoopObject = "PlantLoop"; @@ -801,7 +796,6 @@ void FindRangeBasedOrUncontrolledInput(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; int NumNums; - int IOStat; Array1D_string AlphArray; // Alpha input items for object Array1D_string cAlphaFields; // Alpha field names Array1D_string cNumericFields; // Numeric field names @@ -810,12 +804,9 @@ void FindRangeBasedOrUncontrolledInput(EnergyPlusData &state, Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a // certain object in the input file - int Num; - int NumEquipLists; int ListNum; std::string LoopOpSchemeObj; // Used to identify the object name for loop equipment operation scheme bool SchemeNameFound; // Set to FALSE if a match of OpScheme object and OpScheme name is not found - int InnerListNum; // inner loop list number Real64 OuterListNumLowerLimit; Real64 OuterListNumUpperLimit; Real64 InnerListNumLowerLimit; @@ -840,7 +831,8 @@ void FindRangeBasedOrUncontrolledInput(EnergyPlusData &state, } if (NumSchemes > 0) { - for (Num = 1; Num <= NumSchemes; ++Num) { + int IOStat; + for (int Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Num, AlphArray, NumAlphas, NumArray, NumNums, IOStat); if (Util::SameString(state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).Name, AlphArray(1))) break; @@ -863,7 +855,7 @@ void FindRangeBasedOrUncontrolledInput(EnergyPlusData &state, } else { state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate( state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists); - NumEquipLists = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists; + int NumEquipLists = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists; if (NumNums <= 0) { // Uncontrolled OpScheme type ListNum = NumEquipLists; // NumEquipLists is always 1 for Uncontrolled OpScheme type state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(ListNum).Name = AlphArray(2); @@ -931,7 +923,7 @@ void FindRangeBasedOrUncontrolledInput(EnergyPlusData &state, for (ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { OuterListNumLowerLimit = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(ListNum).RangeLowerLimit; OuterListNumUpperLimit = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(ListNum).RangeUpperLimit; - for (InnerListNum = 1; InnerListNum <= NumEquipLists; ++InnerListNum) { + for (int InnerListNum = 1; InnerListNum <= NumEquipLists; ++InnerListNum) { if (InnerListNum == ListNum) continue; // don't check against self. InnerListNumLowerLimit = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(InnerListNum).RangeLowerLimit; InnerListNumUpperLimit = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(InnerListNum).RangeUpperLimit; From 43afea197b8473da37248c35412edc8a4a64fc26 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 20:04:17 -0400 Subject: [PATCH 086/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 86661b3dcbf..3697887fd07 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -804,7 +804,6 @@ void FindRangeBasedOrUncontrolledInput(EnergyPlusData &state, Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a // certain object in the input file - int ListNum; std::string LoopOpSchemeObj; // Used to identify the object name for loop equipment operation scheme bool SchemeNameFound; // Set to FALSE if a match of OpScheme object and OpScheme name is not found Real64 OuterListNumLowerLimit; @@ -853,6 +852,7 @@ void FindRangeBasedOrUncontrolledInput(EnergyPlusData &state, ShowSevereError(state, format("{} = \"{}\", specified without equipment list.", CurrentModuleObject, AlphArray(1))); ErrorsFound = true; } else { + int ListNum; state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate( state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists); int NumEquipLists = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists; @@ -1021,7 +1021,6 @@ void FindDeltaTempRangeInput(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; int NumNums; - int IOStat; Array1D_string AlphArray; // Alpha input items for object Array1D_string cAlphaFields; // Alpha field names Array1D_string cNumericFields; // Numeric field names @@ -1030,13 +1029,7 @@ void FindDeltaTempRangeInput(EnergyPlusData &state, Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a // certain object in the input file - int Num; - int NumEquipLists; - int ListNum; std::string LoopOpSchemeObj; // Used to identify the object name for loop equipment operation scheme - bool SchemeNameFound; // Set to FALSE if a match of OpScheme object and OpScheme name is not found - - SchemeNameFound = true; std::string cmoStr = std::string(BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast(CurrentModuleObject)]); @@ -1057,7 +1050,10 @@ void FindDeltaTempRangeInput(EnergyPlusData &state, } if (NumSchemes > 0) { - for (Num = 1; Num <= NumSchemes; ++Num) { + int IOStat; + bool SchemeNameFound = true; + + for (int Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cmoStr, Num, AlphArray, NumAlphas, NumArray, NumNums, IOStat); if (Util::SameString(state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).Name, AlphArray(1))) break; if (Num == NumSchemes) { @@ -1079,7 +1075,7 @@ void FindDeltaTempRangeInput(EnergyPlusData &state, } else { state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate( state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists); - NumEquipLists = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists; + int NumEquipLists = state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists; state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).ReferenceNodeName = AlphArray(2); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).ReferenceNodeNumber = GetOnlySingleNode(state, @@ -1092,7 +1088,7 @@ void FindDeltaTempRangeInput(EnergyPlusData &state, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); // For DO Loop below -- Check for lower limit > upper limit.(invalid) - for (ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { + for (int ListNum = 1; ListNum <= NumEquipLists; ++ListNum) { state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(ListNum).RangeLowerLimit = NumArray(ListNum * 2 - 1); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(ListNum).RangeUpperLimit = NumArray(ListNum * 2); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(ListNum).Name = AlphArray(ListNum + 2); @@ -1155,8 +1151,6 @@ void LoadEquipList(EnergyPlusData &state, bool FoundIntendedList; int Num; int MachineNum; - int PELists; - int CELists; // INTEGER :: NumLists int NumAlphas; int NumNums; @@ -1168,8 +1162,8 @@ void LoadEquipList(EnergyPlusData &state, if (state.dataPlantCondLoopOp->LoadEquipListOneTimeFlag) { // assemble mapping between list names and indices one time - PELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "PlantEquipmentList"); - CELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CondenserEquipmentList"); + int PELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "PlantEquipmentList"); + int CELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CondenserEquipmentList"); state.dataPlantCondLoopOp->TotNumLists = PELists + CELists; if (state.dataPlantCondLoopOp->TotNumLists > 0) { state.dataPlantCondLoopOp->EquipListsNameList.allocate(state.dataPlantCondLoopOp->TotNumLists); From 16a6fb66dcb31db6a533675e56891083260e7270 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 20:12:45 -0400 Subject: [PATCH 087/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 3697887fd07..e2e7419f4ea 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1155,9 +1155,7 @@ void LoadEquipList(EnergyPlusData &state, int NumAlphas; int NumNums; int IOStat; - bool IsNotOK; std::string CurrentModuleObject; - int iIndex; bool firstblank; if (state.dataPlantCondLoopOp->LoadEquipListOneTimeFlag) { @@ -1165,6 +1163,7 @@ void LoadEquipList(EnergyPlusData &state, int PELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "PlantEquipmentList"); int CELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CondenserEquipmentList"); state.dataPlantCondLoopOp->TotNumLists = PELists + CELists; + bool IsNotOK; if (state.dataPlantCondLoopOp->TotNumLists > 0) { state.dataPlantCondLoopOp->EquipListsNameList.allocate(state.dataPlantCondLoopOp->TotNumLists); state.dataPlantCondLoopOp->EquipListsTypeList.allocate(state.dataPlantCondLoopOp->TotNumLists); @@ -1174,7 +1173,7 @@ void LoadEquipList(EnergyPlusData &state, if (PELists > 0) { CurrentModuleObject = "PlantEquipmentList"; for (Num = 1; Num <= PELists; ++Num) { - iIndex = Num; + int iIndex = Num; state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, Num, @@ -1230,7 +1229,7 @@ void LoadEquipList(EnergyPlusData &state, if (CELists > 0) { CurrentModuleObject = "CondenserEquipmentList"; for (Num = 1; Num <= CELists; ++Num) { - iIndex = Num + PELists; + int iIndex = Num + PELists; state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, Num, From 05654449303e059313eee601190f658346204ce0 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 20:24:39 -0400 Subject: [PATCH 088/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index e2e7419f4ea..33b97068e07 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1156,24 +1156,23 @@ void LoadEquipList(EnergyPlusData &state, int NumNums; int IOStat; std::string CurrentModuleObject; - bool firstblank; if (state.dataPlantCondLoopOp->LoadEquipListOneTimeFlag) { // assemble mapping between list names and indices one time int PELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "PlantEquipmentList"); int CELists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CondenserEquipmentList"); state.dataPlantCondLoopOp->TotNumLists = PELists + CELists; - bool IsNotOK; if (state.dataPlantCondLoopOp->TotNumLists > 0) { state.dataPlantCondLoopOp->EquipListsNameList.allocate(state.dataPlantCondLoopOp->TotNumLists); state.dataPlantCondLoopOp->EquipListsTypeList.allocate(state.dataPlantCondLoopOp->TotNumLists); state.dataPlantCondLoopOp->EquipListsIndexList.allocate(state.dataPlantCondLoopOp->TotNumLists); + bool IsNotOK; // First load PlantEquipmentList info if (PELists > 0) { CurrentModuleObject = "PlantEquipmentList"; for (Num = 1; Num <= PELists; ++Num) { - int iIndex = Num; + int iIndex = Num; state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, Num, @@ -1191,8 +1190,8 @@ void LoadEquipList(EnergyPlusData &state, state.dataPlantCondLoopOp->EquipListsIndexList(iIndex) = Num; MachineNum = 2; while (MachineNum <= NumAlphas) { - firstblank = false; if (state.dataIPShortCut->lAlphaFieldBlanks(MachineNum) || state.dataIPShortCut->lAlphaFieldBlanks(MachineNum + 1)) { + bool firstblank = false; if (state.dataIPShortCut->lAlphaFieldBlanks(MachineNum)) { ShowSevereError( state, @@ -1247,8 +1246,8 @@ void LoadEquipList(EnergyPlusData &state, state.dataPlantCondLoopOp->EquipListsIndexList(iIndex) = Num; MachineNum = 2; while (MachineNum <= NumAlphas) { - firstblank = false; if (state.dataIPShortCut->lAlphaFieldBlanks(MachineNum) || state.dataIPShortCut->lAlphaFieldBlanks(MachineNum + 1)) { + bool firstblank = false; if (state.dataIPShortCut->lAlphaFieldBlanks(MachineNum)) { ShowSevereError( state, @@ -1371,11 +1370,6 @@ void FindCompSPInput(EnergyPlusData &state, using SetPointManager::SetUpNewScheduledTESSetPtMgr; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumAlphas; - int NumNums; - int CompNum; - int CompInNode; - int IOStat; Real64 CompFlowRate(0.0); std::string LoopOpSchemeObj; // Used to identify the object name for loop equipment operation scheme bool SchemeNameFound; // Set to FALSE if a match of OpScheme object and OpScheme name is not found @@ -1402,6 +1396,11 @@ void FindCompSPInput(EnergyPlusData &state, } if (NumSchemes > 0) { + int NumAlphas; + int NumNums; + int CompNum; + int CompInNode; + int IOStat; for (int Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Num, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); From 420ae3b71fca2c31978757583fa30452192e81db Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 20:38:10 -0400 Subject: [PATCH 089/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 33b97068e07..fe1d21295f7 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1373,10 +1373,6 @@ void FindCompSPInput(EnergyPlusData &state, Real64 CompFlowRate(0.0); std::string LoopOpSchemeObj; // Used to identify the object name for loop equipment operation scheme bool SchemeNameFound; // Set to FALSE if a match of OpScheme object and OpScheme name is not found - bool NodeEMSSetPointMissing; - std::string OnPeakSchedName; - int OnPeakSchedPtr; - std::string ChargeSchedName; int ChargeSchedPtr; Real64 NonChargCHWTemp; Real64 OffPeakCHWTemp; @@ -1401,6 +1397,8 @@ void FindCompSPInput(EnergyPlusData &state, int CompNum; int CompInNode; int IOStat; + int OnPeakSchedPtr; + std::string ChargeSchedName; for (int Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Num, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); @@ -1424,7 +1422,7 @@ void FindCompSPInput(EnergyPlusData &state, if (CurrentModuleObject == "PlantEquipmentOperation:ThermalEnergyStorage") { // Read all of the additional parameters for ice storage control scheme and error check various parameters - OnPeakSchedName = state.dataIPShortCut->cAlphaArgs(2); + std::string OnPeakSchedName = state.dataIPShortCut->cAlphaArgs(2); OnPeakSchedPtr = GetScheduleIndex(state, OnPeakSchedName); if (OnPeakSchedPtr == 0) { ShowSevereError(state, @@ -1607,7 +1605,7 @@ void FindCompSPInput(EnergyPlusData &state, ErrorsFound = true; } else { // need call to EMS to check node - NodeEMSSetPointMissing = false; + bool NodeEMSSetPointMissing = false; CheckIfNodeSetPointManagedByEMS( state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).SetPointNodeNum, @@ -1662,7 +1660,7 @@ void FindCompSPInput(EnergyPlusData &state, ErrorsFound = true; } else { // need call to EMS to check node - NodeEMSSetPointMissing = false; + bool NodeEMSSetPointMissing = false; CheckIfNodeSetPointManagedByEMS( state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).SetPointNodeNum, @@ -1716,7 +1714,7 @@ void FindCompSPInput(EnergyPlusData &state, ErrorsFound = true; } else { // need call to EMS to check node - NodeEMSSetPointMissing = false; + bool NodeEMSSetPointMissing = false; CheckIfNodeSetPointManagedByEMS( state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).SetPointNodeNum, @@ -1777,7 +1775,7 @@ void FindCompSPInput(EnergyPlusData &state, ErrorsFound = true; } else { // need call to EMS to check node - NodeEMSSetPointMissing = false; + bool NodeEMSSetPointMissing = false; CheckIfNodeSetPointManagedByEMS( state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).SetPointNodeNum, From cbdd5628d01be1e6540d4b9e363cbe062c5f627e Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 20:46:13 -0400 Subject: [PATCH 090/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index fe1d21295f7..7d19add33e1 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1373,11 +1373,8 @@ void FindCompSPInput(EnergyPlusData &state, Real64 CompFlowRate(0.0); std::string LoopOpSchemeObj; // Used to identify the object name for loop equipment operation scheme bool SchemeNameFound; // Set to FALSE if a match of OpScheme object and OpScheme name is not found - int ChargeSchedPtr; Real64 NonChargCHWTemp; Real64 OffPeakCHWTemp; - int CompNumA; - int CompNumN; CtrlType CompOpType; // 1=cooling, 2=dual(or other) SchemeNameFound = true; @@ -1419,6 +1416,7 @@ void FindCompSPInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists = 1; state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate(1); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps = (NumAlphas - 1) / 5; + int ChargeSchedPtr; if (CurrentModuleObject == "PlantEquipmentOperation:ThermalEnergyStorage") { // Read all of the additional parameters for ice storage control scheme and error check various parameters @@ -1449,6 +1447,8 @@ void FindCompSPInput(EnergyPlusData &state, if (state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps > 0) { state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp.allocate( state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps); + int CompNumA; + int CompNumN; for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps; ++CompNum) { if (CurrentModuleObject == "PlantEquipmentOperation:ComponentSetPoint") { CompNumA = CompNum * 5; From 1fd65e2132b7565557fa468873fe4d186b017ac4 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 20:54:44 -0400 Subject: [PATCH 091/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 7d19add33e1..30473664af3 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1391,8 +1391,6 @@ void FindCompSPInput(EnergyPlusData &state, if (NumSchemes > 0) { int NumAlphas; int NumNums; - int CompNum; - int CompInNode; int IOStat; int OnPeakSchedPtr; std::string ChargeSchedName; @@ -1417,6 +1415,7 @@ void FindCompSPInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate(1); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps = (NumAlphas - 1) / 5; int ChargeSchedPtr; + int OnPeakSchedPtr; if (CurrentModuleObject == "PlantEquipmentOperation:ThermalEnergyStorage") { // Read all of the additional parameters for ice storage control scheme and error check various parameters @@ -1449,7 +1448,7 @@ void FindCompSPInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps); int CompNumA; int CompNumN; - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps; ++CompNum) { + for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps; ++CompNum) { if (CurrentModuleObject == "PlantEquipmentOperation:ComponentSetPoint") { CompNumA = CompNum * 5; CompNumN = CompNum; @@ -1491,7 +1490,7 @@ void FindCompSPInput(EnergyPlusData &state, if (state.dataIPShortCut->rNumericArgs(CompNumN) == AutoSize) { int Num = 1; for (; Num <= state.dataSize->SaveNumPlantComps; ++Num) { - CompInNode = state.dataSize->CompDesWaterFlow(Num).SupNode; + int CompInNode = state.dataSize->CompDesWaterFlow(Num).SupNode; CompFlowRate = state.dataSize->CompDesWaterFlow(Num).DesVolFlowRate; if (CompInNode == state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).DemandNodeNum) { state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).SetPointFlowRate = CompFlowRate; From 0bb3814bd469bdd6d44cf05e8199a98cabc2eec0 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 21:47:05 -0400 Subject: [PATCH 092/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 30473664af3..53d94aa4457 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1393,7 +1393,6 @@ void FindCompSPInput(EnergyPlusData &state, int NumNums; int IOStat; int OnPeakSchedPtr; - std::string ChargeSchedName; for (int Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Num, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); @@ -1429,7 +1428,7 @@ void FindCompSPInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).Name)); ErrorsFound = true; } - ChargeSchedName = state.dataIPShortCut->cAlphaArgs(3); + std::string ChargeSchedName = state.dataIPShortCut->cAlphaArgs(3); ChargeSchedPtr = GetScheduleIndex(state, ChargeSchedName); if (ChargeSchedPtr == 0) { ShowSevereError(state, @@ -2384,14 +2383,8 @@ void GetUserDefinedOpSchemeInput(EnergyPlusData &state, using namespace DataPlant; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumAlphas; - int NumNums; - int Num; - int CompNum; - int IOStat; bool SchemeNameFound; // Set to FALSE if a match of OpScheme object and OpScheme name is not found std::string LoopOpSchemeObj; // Used to identify the object name for loop equipment operation scheme - int StackMngrNum; // local temporary for Erl program calling manager index SchemeNameFound = true; @@ -2402,6 +2395,7 @@ void GetUserDefinedOpSchemeInput(EnergyPlusData &state, } if (NumSchemes > 0) { + int NumAlphas, NumNums, Num, IOStat; for (Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -2437,7 +2431,7 @@ void GetUserDefinedOpSchemeInput(EnergyPlusData &state, if (state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps > 0) { state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp.allocate( state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps); - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps; ++CompNum) { + for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps; ++CompNum) { state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).TypeOf = state.dataIPShortCut->cAlphaArgs(CompNum * 2 + 2); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).Name = @@ -2463,7 +2457,7 @@ void GetUserDefinedOpSchemeInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).Comp(CompNum).EMSIntVarRemainingLoadValue); } } - StackMngrNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataRuntimeLang->EMSProgramCallManager); + int StackMngrNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataRuntimeLang->EMSProgramCallManager); if (StackMngrNum > 0) { // found it state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).ErlSimProgramMngr = StackMngrNum; } else { From b3425f643bd1cd68fc322626e2fcdf107ab6e3d8 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 22:06:41 -0400 Subject: [PATCH 093/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 53d94aa4457..c93d913ed0f 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -2532,14 +2532,8 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int LoopPtr; DataPlant::LoopSideLocation LoopSidePtr; - int BranchPtr; - int CompPtr; PlantLocation plantLoc{}; - int Index; - int OpSchemePtr; - int thisSchemeNum; bool FoundScheme; bool FoundSchemeMatch; @@ -2666,6 +2660,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) auto &this_op_scheme = this_plant_loop.OpScheme(OpNum); for (int ListNum = 1, ListNum_end = this_op_scheme.NumEquipLists; ListNum <= ListNum_end; ++ListNum) { auto &this_equip_list = this_op_scheme.EquipList(ListNum); + int thisSchemeNum; for (int EquipNum = 1, EquipNum_end = this_equip_list.NumComps; EquipNum <= EquipNum_end; ++EquipNum) { auto &this_equip = this_equip_list.Comp(EquipNum); // dereference indices (stored in previous loop) @@ -2733,8 +2728,8 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) for (int CompNum = 1, CompNum_end = this_branch.TotalComponents; CompNum <= CompNum_end; ++CompNum) { auto const &this_component = this_branch.Comp(CompNum); if (allocated(this_component.OpScheme)) { - for (Index = 1; Index <= this_component.NumOpSchemes; ++Index) { - OpSchemePtr = this_component.OpScheme(Index).OpSchemePtr; + for (int Index = 1; Index <= this_component.NumOpSchemes; ++Index) { + int OpSchemePtr = this_component.OpScheme(Index).OpSchemePtr; if (OpSchemePtr == 0) { ShowSevereError(state, format("InitLoadDistribution: no operation scheme index found for component on PlantLoop={}", @@ -2861,10 +2856,10 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) auto const &this_list_component = this_equip_list.Comp(CompNum); // then look up the component topological position from this structure - LoopPtr = this_list_component.LoopNumPtr; + int LoopPtr = this_list_component.LoopNumPtr; LoopSidePtr = this_list_component.LoopSideNumPtr; - BranchPtr = this_list_component.BranchNumPtr; - CompPtr = this_list_component.CompNumPtr; + int BranchPtr = this_list_component.BranchNumPtr; + int CompPtr = this_list_component.CompNumPtr; // then set up a reference to the component on the plant data structure auto &this_loop_component = state.dataPlnt->PlantLoop(LoopPtr).LoopSide(LoopSidePtr).Branch(BranchPtr).Comp(CompPtr); From 083507aad3f383ece1466d2c50f9ef10129ac981 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 22:12:56 -0400 Subject: [PATCH 094/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index c93d913ed0f..f00e481d308 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -2535,10 +2535,6 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) DataPlant::LoopSideLocation LoopSidePtr; PlantLocation plantLoc{}; - bool FoundScheme; - bool FoundSchemeMatch; - // LOGICAL, SAVE :: FirstHVACInitsDone = .FALSE. - // LOGICAL, SAVE :: MyEnvrnFlag = .TRUE. DataPlant::PlantEquipmentType Type; int CompOpNum; int OldNumOpSchemes; @@ -2685,7 +2681,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) OldNumOpSchemes = dummy_loop_equip.NumOpSchemes; // could be new list on existing scheme or new scheme with new list. Check and see - FoundSchemeMatch = false; + bool FoundSchemeMatch = false; for (thisSchemeNum = 1; thisSchemeNum <= OldNumOpSchemes; ++thisSchemeNum) { // Loop index used below // compare the OpScheme index, 'opnum', in the PlantLoop()%OpScheme()data structure // with the OpSchemePtr in the PlantLoop()%LoopSide()%Branch()%Comp() data structure. @@ -2828,7 +2824,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) } // Update the OpScheme schedules for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - FoundScheme = false; + bool FoundScheme = false; auto &this_loop = state.dataPlnt->PlantLoop(LoopNum); for (int OpNum = 1; OpNum <= this_loop.NumOpSchemes; ++OpNum) { auto &this_op_scheme = this_loop.OpScheme(OpNum); From 76eb6b79914ad8e3b42b0ee706adb292f058762f Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 22:31:10 -0400 Subject: [PATCH 095/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 29 ++++++++---------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index f00e481d308..879d9611798 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -2536,14 +2536,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) PlantLocation plantLoc{}; DataPlant::PlantEquipmentType Type; - int CompOpNum; - int OldNumOpSchemes; - int NewNumEquipLists; - int NewNumOpSchemes; - int NumSearchResults; - bool GetInputOK; // successful Get Input - - bool errFlag1; + bool errFlag2; Real64 HighestRange; @@ -2552,6 +2545,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) errFlag2 = false; // Get Input if (state.dataPlantCondLoopOp->GetPlantOpInput) { + bool GetInputOK; // successful Get Input GetPlantOperationInput(state, GetInputOK); if (GetInputOK) { GetOperationSchemeInput(state); @@ -2566,6 +2560,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) // Set up 'component' to 'op scheme' pointers in Plant data structure // We're looking for matches between a component on a PlantLoop.OpScheme.List() // and the same component in the PlantLoop.LoopSide.Branch.Comp() data structure + int NumSearchResults; // first loop over main operation scheme data and finish filling out indexes to plant topology for the components in the lists for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { @@ -2577,7 +2572,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) for (int EquipNum = 1, EquipNum_end = this_equip_list.NumComps; EquipNum <= EquipNum_end; ++EquipNum) { auto &this_equip = this_equip_list.Comp(EquipNum); Type = static_cast(getEnumValue(PlantEquipTypeNamesUC, Util::makeUPPER(this_equip.TypeOf))); - errFlag1 = false; + bool errFlag1 = false; PlantUtilities::ScanPlantLoopsForObject(state, this_equip.Name, Type, plantLoc, errFlag1, _, _, NumSearchResults, _, LoopNum); if (errFlag1) { @@ -2678,7 +2673,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) dummy_op_scheme_1.EquipList(1).ListPtr = ListNum; dummy_op_scheme_1.EquipList(1).CompPtr = EquipNum; } else { // already an op scheme - OldNumOpSchemes = dummy_loop_equip.NumOpSchemes; + int OldNumOpSchemes = dummy_loop_equip.NumOpSchemes; // could be new list on existing scheme or new scheme with new list. Check and see bool FoundSchemeMatch = false; @@ -2691,13 +2686,13 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) } if (FoundSchemeMatch) { // op scheme already exists, but need to add a list to the existing OpScheme auto &this_op_scheme = dummy_loop_equip.OpScheme(thisSchemeNum); - NewNumEquipLists = this_op_scheme.NumEquipLists + 1; + int NewNumEquipLists = this_op_scheme.NumEquipLists + 1; this_op_scheme.EquipList.redimension(NewNumEquipLists); this_op_scheme.NumEquipLists = NewNumEquipLists; this_op_scheme.EquipList(NewNumEquipLists).ListPtr = ListNum; this_op_scheme.EquipList(NewNumEquipLists).CompPtr = EquipNum; } else { // !FoundSchemeMatch: Add new op scheme and a new list - NewNumOpSchemes = OldNumOpSchemes + 1; + int NewNumOpSchemes = OldNumOpSchemes + 1; dummy_loop_equip.OpScheme.redimension(NewNumOpSchemes); auto &new_op_scheme = dummy_loop_equip.OpScheme(NewNumOpSchemes); new_op_scheme.EquipList.allocate(1); @@ -2824,7 +2819,6 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) } // Update the OpScheme schedules for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - bool FoundScheme = false; auto &this_loop = state.dataPlnt->PlantLoop(LoopNum); for (int OpNum = 1; OpNum <= this_loop.NumOpSchemes; ++OpNum) { auto &this_op_scheme = this_loop.OpScheme(OpNum); @@ -2840,7 +2834,6 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) if (GetCurrentScheduleValue(state, this_op_scheme.SchedPtr) > 0.0) { this_op_scheme.Available = true; - FoundScheme = true; for (int ListNum = 1, ListNum_end = this_op_scheme.NumEquipLists; ListNum <= ListNum_end; ++ListNum) { auto &this_equip_list = this_op_scheme.EquipList(ListNum); // The component loop loads the pointers from the OpScheme data structure @@ -2870,7 +2863,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) errFlag2 = true; } - for (CompOpNum = 1; CompOpNum <= this_loop_component.NumOpSchemes; ++CompOpNum) { + for (int CompOpNum = 1; CompOpNum <= this_loop_component.NumOpSchemes; ++CompOpNum) { if (this_loop_component.OpScheme(CompOpNum).OpSchemePtr == OpNum) { this_loop_component.CurCompLevelOpNum = CompOpNum; } @@ -2881,9 +2874,6 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) this_op_scheme.Available = false; } } - // IF(.NOT. foundscheme)THEN - // !'call warning 'no current control scheme specified. Loop Equipment will be shut down' - // ENDIF } } else { // call supervisory scheme every iteration if (!state.dataPlantCondLoopOp->ChillerHeaterSupervisoryOperationSchemes.empty()) { @@ -2992,7 +2982,6 @@ void DistributePlantLoad(EnergyPlusData &state, // load local variables NumCompsOnList = this_equiplist.NumComps; - int numAvail = 0; // Allocate array once accrued_load_plr_values.reserve(NumCompsOnList); @@ -3004,10 +2993,10 @@ void DistributePlantLoad(EnergyPlusData &state, } else { // OPTIMAL DISTRIBUTION SCHEME + int numAvail = 0; switch (this_loop.LoadDistribution) { case DataPlant::LoadingScheme::Optimal: // step 1: load all machines to optimal PLR - numAvail = 0; for (CompIndex = 1; CompIndex <= NumCompsOnList; ++CompIndex) { // look up topology from the equipment list From 85c874171191b18cc6aa1b677959c532495fe291 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 22:37:29 -0400 Subject: [PATCH 096/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 879d9611798..b21f4939215 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -4081,9 +4081,6 @@ void SetupPlantEMSActuators(EnergyPlusData &state) // Call the setupAcuator routine // Locals - std::string ActuatorType; - std::string ActuatorName; - std::string UniqueIDName; static constexpr std::string_view Units("[on/off]"); // INTEGER :: NumAct int LoopNum; @@ -4091,9 +4088,9 @@ void SetupPlantEMSActuators(EnergyPlusData &state) int CompNum; for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - ActuatorName = "Plant Loop Overall"; - UniqueIDName = state.dataPlnt->PlantLoop(LoopNum).Name; - ActuatorType = "On/Off Supervisory"; + std::string ActuatorName = "Plant Loop Overall"; + std::string UniqueIDName = state.dataPlnt->PlantLoop(LoopNum).Name; + std::string ActuatorType = "On/Off Supervisory"; SetupEMSActuator(state, ActuatorName, UniqueIDName, From 467e5eb7cf7fb1a39bcc18ce02b79b0a72b06649 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 23:09:55 -0400 Subject: [PATCH 097/108] scope --- src/EnergyPlus/PlantCondLoopOperation.cc | 36 +++++++++++------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index b21f4939215..82a928ae227 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1392,7 +1392,6 @@ void FindCompSPInput(EnergyPlusData &state, int NumAlphas; int NumNums; int IOStat; - int OnPeakSchedPtr; for (int Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Num, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); @@ -1414,7 +1413,7 @@ void FindCompSPInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate(1); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps = (NumAlphas - 1) / 5; int ChargeSchedPtr; - int OnPeakSchedPtr; + int OnPeakSchedPtr; if (CurrentModuleObject == "PlantEquipmentOperation:ThermalEnergyStorage") { // Read all of the additional parameters for ice storage control scheme and error check various parameters @@ -2325,9 +2324,9 @@ void GetChillerHeaterChangeoverOpSchemeInput(EnergyPlusData &state, ErrorsFound = true; } - for (int listNum = 1; listNum <= scheme.PlantOps.NumSimultHeatCoolHeatingEquipLists; ++listNum) { + cCurrentModuleObject = "PlantEquipmentList"; - std::string cCurrentModuleObject("PlantEquipmentList"); + for (int listNum = 1; listNum <= scheme.PlantOps.NumSimultHeatCoolHeatingEquipLists; ++listNum) { auto const instances = ip->epJSON.find(cCurrentModuleObject); auto const &objectSchemaProps = ip->getObjectSchemaProps(state, cCurrentModuleObject); @@ -2653,7 +2652,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) auto &this_equip_list = this_op_scheme.EquipList(ListNum); int thisSchemeNum; for (int EquipNum = 1, EquipNum_end = this_equip_list.NumComps; EquipNum <= EquipNum_end; ++EquipNum) { - auto &this_equip = this_equip_list.Comp(EquipNum); + auto const &this_equip = this_equip_list.Comp(EquipNum); // dereference indices (stored in previous loop) plantLoc.loopNum = this_equip.LoopNumPtr; plantLoc.loopSideNum = this_equip.LoopSideNumPtr; @@ -2685,12 +2684,12 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) break; } if (FoundSchemeMatch) { // op scheme already exists, but need to add a list to the existing OpScheme - auto &this_op_scheme = dummy_loop_equip.OpScheme(thisSchemeNum); - int NewNumEquipLists = this_op_scheme.NumEquipLists + 1; - this_op_scheme.EquipList.redimension(NewNumEquipLists); - this_op_scheme.NumEquipLists = NewNumEquipLists; - this_op_scheme.EquipList(NewNumEquipLists).ListPtr = ListNum; - this_op_scheme.EquipList(NewNumEquipLists).CompPtr = EquipNum; + auto &this_op_schemeAdd = dummy_loop_equip.OpScheme(thisSchemeNum); + int NewNumEquipLists = this_op_schemeAdd.NumEquipLists + 1; + this_op_schemeAdd.EquipList.redimension(NewNumEquipLists); + this_op_schemeAdd.NumEquipLists = NewNumEquipLists; + this_op_schemeAdd.EquipList(NewNumEquipLists).ListPtr = ListNum; + this_op_schemeAdd.EquipList(NewNumEquipLists).CompPtr = EquipNum; } else { // !FoundSchemeMatch: Add new op scheme and a new list int NewNumOpSchemes = OldNumOpSchemes + 1; dummy_loop_equip.OpScheme.redimension(NewNumOpSchemes); @@ -3122,7 +3121,7 @@ void DistributePlantLoad(EnergyPlusData &state, CompNum = this_equiplist.Comp(CompIndex).CompNumPtr; // create a reference to the component itself - auto &this_component = this_loopside.Branch(BranchNum).Comp(CompNum); + auto const &this_component = this_loopside.Branch(BranchNum).Comp(CompNum); if (this_component.Available) ++numAvail; } @@ -4082,12 +4081,8 @@ void SetupPlantEMSActuators(EnergyPlusData &state) // Locals static constexpr std::string_view Units("[on/off]"); - // INTEGER :: NumAct - int LoopNum; - int BranchNum; - int CompNum; - for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { + for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { std::string ActuatorName = "Plant Loop Overall"; std::string UniqueIDName = state.dataPlnt->PlantLoop(LoopNum).Name; std::string ActuatorType = "On/Off Supervisory"; @@ -4122,7 +4117,7 @@ void SetupPlantEMSActuators(EnergyPlusData &state) state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).EMSValue); for (DataPlant::LoopSideLocation LoopSideNum : LoopSideKeys) { - for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { + for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { if (LoopSideNum == LoopSideLocation::Supply) { ActuatorName = "Supply Side Branch"; UniqueIDName = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Name; @@ -4146,7 +4141,8 @@ void SetupPlantEMSActuators(EnergyPlusData &state) state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).EMSCtrlOverrideOn, state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).EMSCtrlOverrideValue); } - for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) { + for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; + ++CompNum) { ActuatorName = format("Plant Component {}", PlantEquipTypeNames[static_cast( state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).Type)]); @@ -4330,7 +4326,7 @@ void AdjustChangeInLoadByEMSControls(EnergyPlusData &state, // set up some nice references to avoid lookups auto &this_loopside = state.dataPlnt->PlantLoop(plantLoc.loopNum).LoopSide(plantLoc.loopSideNum); auto &this_branch = this_loopside.Branch(plantLoc.branchNum); - auto &this_comp = this_branch.Comp(plantLoc.compNum); + auto const &this_comp = this_branch.Comp(plantLoc.compNum); if ((this_loopside.EMSCtrl) && (this_loopside.EMSValue <= 0.0)) { ChangeInLoad = 0.0; From c71e07d1dda9c543c63140481370bbda5c989f90 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 24 Aug 2024 23:16:58 -0400 Subject: [PATCH 098/108] clang fornat --- src/EnergyPlus/PlantCondLoopOperation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 82a928ae227..9e5efcff68e 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1413,7 +1413,7 @@ void FindCompSPInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate(1); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps = (NumAlphas - 1) / 5; int ChargeSchedPtr; - int OnPeakSchedPtr; + int OnPeakSchedPtr; if (CurrentModuleObject == "PlantEquipmentOperation:ThermalEnergyStorage") { // Read all of the additional parameters for ice storage control scheme and error check various parameters From 96f7144edb74c49c19f64a352a248a1aa156c54a Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 14:42:00 -0400 Subject: [PATCH 099/108] redundant logic --- src/EnergyPlus/PlantPipingSystemsManager.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index dc8deb1da92..a5b03641417 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -3459,15 +3459,13 @@ namespace PlantPipingSystemsManager { // Check if vertical insulation present if (this->VertInsPresentFlag) { if (InsulationYIndex != 0) { // Partial vertical insulation - if (CellYIndex <= this->y_max_index && CellYIndex > InsulationYIndex) { + if (CellYIndex > InsulationYIndex) { cellType = CellType::VertInsulation; ++NumInsulationCells; } } else { // Vertical insulation extends to depth of basement floor - if (CellYIndex <= this->y_max_index && CellYIndex > YFloorIndex) { - cellType = CellType::VertInsulation; - ++NumInsulationCells; - } + cellType = CellType::VertInsulation; + ++NumInsulationCells; } } } @@ -5858,12 +5856,12 @@ namespace PlantPipingSystemsManager { //'calculate this cell's new Cp value based on the cell temperature if (CellTemp <= frzAllIce) { // totally frozen rhoCp = this->Moisture.rhoCP_soil_ice; - } else if ((CellTemp > frzAllIce) && (CellTemp < frzIceTrans)) { // in between totally frozen and ice transition + } else if (CellTemp < frzIceTrans) { // in between totally frozen and ice transition rhoCp = this->Moisture.rhoCP_soil_ice + (this->Moisture.rhoCP_soil_transient - this->Moisture.rhoCP_soil_ice) / (frzIceTrans - frzAllIce) * (CellTemp - frzAllIce); - } else if ((CellTemp >= frzIceTrans) && (CellTemp <= frzLiqTrans)) { // in between ice transition and liquid transition + } else if (CellTemp <= frzLiqTrans) { // in between ice transition and liquid transition rhoCp = this->Moisture.rhoCP_soil_transient; - } else if ((CellTemp > frzLiqTrans) && (CellTemp < frzAllLiq)) { // in between liquid transition and all liquid + } else if (CellTemp < frzAllLiq) { // in between liquid transition and all liquid rhoCp = this->Moisture.rhoCp_soil_liq_1 + (this->Moisture.rhoCP_soil_transient - this->Moisture.rhoCP_soil_liq) / (frzAllLiq - frzLiqTrans) * (frzAllLiq - CellTemp); } else { // ( CellTemp >= frzAllLiq ) --- greater than or equal to all liquid From ad4a6d7c1567dde0fb44a158f1a5d4c77ccf9962 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 14:52:18 -0400 Subject: [PATCH 100/108] const and reduce --- src/EnergyPlus/PlantPipingSystemsManager.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index a5b03641417..d13e71a27ef 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -285,7 +285,7 @@ namespace PlantPipingSystemsManager { Real64 ZoneTemp = 0.0; // Set ZoneTemp equal to the average air temperature of the zones the coupled surfaces are part of. - for (auto &z : thisDomain.ZoneCoupledSurfaces) { + for (auto const &z : thisDomain.ZoneCoupledSurfaces) { int ZoneNum = z.Zone; ZoneTemp += state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZTAV; } @@ -428,7 +428,7 @@ namespace PlantPipingSystemsManager { for (int DomainNum = 0; DomainNum < TotalNumDomains; ++DomainNum) { // Convenience - auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainNum]; + auto const &thisDomain = state.dataPlantPipingSysMgr->domains[DomainNum]; // validate pipe domain-circuit name-to-index references for (auto &thisCircuit : thisDomain.circuits) { @@ -437,7 +437,7 @@ namespace PlantPipingSystemsManager { // correct segment locations for: INTERNAL DATA STRUCTURE Y VALUE MEASURED FROM BOTTOM OF DOMAIN, // INPUT WAS MEASURED FROM GROUND SURFACE - for (auto &thisCircuit : thisDomain.circuits) { + for (auto const &thisCircuit : thisDomain.circuits) { for (auto &thisSegment : thisCircuit->pipeSegments) { thisSegment->PipeLocation.Y = thisDomain.Extents.yMax - thisSegment->PipeLocation.Y; } @@ -445,7 +445,7 @@ namespace PlantPipingSystemsManager { // correct segment locations for: BASEMENT X SHIFT if (thisDomain.HasBasement && thisDomain.BasementZone.ShiftPipesByWidth) { - for (auto &thisCircuit : thisDomain.circuits) { + for (auto const &thisCircuit : thisDomain.circuits) { for (auto &thisSegment : thisCircuit->pipeSegments) { thisSegment->PipeLocation.X += thisDomain.BasementZone.Width; } @@ -453,9 +453,9 @@ namespace PlantPipingSystemsManager { } // now we will have good values of pipe segment locations, we can validate them - for (auto &thisCircuit : thisDomain.circuits) { + for (auto const &thisCircuit : thisDomain.circuits) { // check to make sure it isn't outside the domain - for (auto &thisSegment : thisCircuit->pipeSegments) { + for (auto const &thisSegment : thisCircuit->pipeSegments) { if ((thisSegment->PipeLocation.X > thisDomain.Extents.xMax) || (thisSegment->PipeLocation.X < 0.0) || (thisSegment->PipeLocation.Y > thisDomain.Extents.yMax) || (thisSegment->PipeLocation.Y < 0.0)) { ShowSevereError(state, @@ -1106,7 +1106,6 @@ namespace PlantPipingSystemsManager { int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem - int CurIndex; // initialize these counters properly so they can be incremented within the DO loop int DomainNum = StartingDomainNumForBasement - 1; @@ -1173,7 +1172,7 @@ namespace PlantPipingSystemsManager { } // Basement zone depth - CurIndex = 11; + int CurIndex = 11; thisDomain.BasementZone.Depth = state.dataIPShortCut->rNumericArgs(CurIndex); if (thisDomain.BasementZone.Depth >= thisDomain.Extents.yMax || thisDomain.BasementZone.Depth <= 0.0) { ShowSevereError(state, format("Invalid {}", state.dataIPShortCut->cNumericFieldNames(CurIndex))); @@ -3142,13 +3141,13 @@ namespace PlantPipingSystemsManager { // MODIFIED na // RE-ENGINEERED na - int cellCountUpToNow = 0; std::vector tempCellWidths; if (PartitionsExist) { for (int i = 0; i < (int)ThesePartitionRegions.size(); ++i) { auto &thisPartition = ThesePartitionRegions[i]; + int cellCountUpToNow = 0; if (i == 0) { // First partition // Create region to left of partition @@ -3472,7 +3471,7 @@ namespace PlantPipingSystemsManager { } else if (CellYIndex == this->y_max_index) { // Surface cells cellType = CellType::GroundSurface; ++NumGroundSurfaceCells; - } else if (CellYIndex == 0 || CellXIndex == 0 || CellZIndex == 0) { // Farfield boundary + } else if (CellXIndex == 0 || CellZIndex == 0) { // Farfield boundary cellType = CellType::FarfieldBoundary; } } else if (CellXIndex == MaxBasementXNodeIndex && CellYIndex == MinBasementYNodeIndex) { From 7c3028c7b352f4034e42a266e3e4248b33b59990 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 15:00:12 -0400 Subject: [PATCH 101/108] const and unused --- src/EnergyPlus/PlantPipingSystemsManager.cc | 26 ++++++++------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index d13e71a27ef..7e65dd6b5db 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -1377,7 +1377,7 @@ namespace PlantPipingSystemsManager { // Total surface area Real64 ThisArea = 0.0; - for (auto &z : thisDomain.ZoneCoupledSurfaces) { + for (auto const &z : thisDomain.ZoneCoupledSurfaces) { ThisArea += z.SurfaceArea; } @@ -1654,9 +1654,6 @@ namespace PlantPipingSystemsManager { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - if (thisCircuit.InletNodeNum == 0) { - CurIndex = 2; - } thisCircuit.OutletNodeName = state.dataIPShortCut->cAlphaArgs(3); thisCircuit.OutletNodeNum = NodeInputManager::GetOnlySingleNode(state, thisCircuit.OutletNodeName, @@ -1667,9 +1664,6 @@ namespace PlantPipingSystemsManager { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - if (thisCircuit.OutletNodeNum == 0) { - CurIndex = 3; - } BranchNodeConnections::TestCompSet( state, ObjName_HorizTrench, thisTrenchName, thisCircuit.InletNodeName, thisCircuit.OutletNodeName, "Piping System Circuit Nodes"); @@ -2122,8 +2116,8 @@ namespace PlantPipingSystemsManager { this->developMesh(state); // would be OK to do some post-mesh error handling here I think - for (auto &thisDomainCircuit : this->circuits) { - for (auto &segment : thisDomainCircuit->pipeSegments) { + for (auto const &thisDomainCircuit : this->circuits) { + for (auto const &segment : thisDomainCircuit->pipeSegments) { if (!segment->PipeCellCoordinatesSet) { ShowSevereError(state, format("PipingSystems:{}:Pipe segment index not set.", RoutineName)); ShowContinueError(state, "...Possibly because pipe segment was placed outside of the domain."); @@ -2355,7 +2349,7 @@ namespace PlantPipingSystemsManager { Real64 ThisCellMax; Real64 MaxDivAmount = 0.0; - for (auto &radCell : CellToCheck.PipeCellData.Soil) { + for (auto const &radCell : CellToCheck.PipeCellData.Soil) { ThisCellMax = std::abs(radCell.Temperature - radCell.Temperature_PrevIteration); if (ThisCellMax > MaxDivAmount) { MaxDivAmount = ThisCellMax; @@ -2750,7 +2744,7 @@ namespace PlantPipingSystemsManager { //'NOTE: pipe location y values have already been corrected to be measured from the bottom surface //'in input they are measured by depth, but internally they are referred to by distance from y = 0, or the bottom boundary - for (auto &thisCircuit : this->circuits) { + for (auto const &thisCircuit : this->circuits) { // set up a convenience variable here //'account for the pipe and insulation if necessary @@ -3028,7 +3022,7 @@ namespace PlantPipingSystemsManager { //'loop across all partitions for (int Index = 0; Index < (int)ThesePartitionCenters.size(); ++Index) { - auto &thisPartitionCenter = ThesePartitionCenters[Index]; + auto const &thisPartitionCenter = ThesePartitionCenters[Index]; Real64 const ThisCellWidthBy2 = thisPartitionCenter.TotalWidth / 2.0; PartitionType ThisPartitionType = thisPartitionCenter.partitionType; @@ -3265,7 +3259,7 @@ namespace PlantPipingSystemsManager { default: if (thisRegion.thisRegionType == DirDirection) { Real64 StartingPointCounter = thisRegion.Min; - for (auto &cellWidth : thisRegion.CellWidths) { + for (auto const &cellWidth : thisRegion.CellWidths) { RetVal.push_back(StartingPointCounter); StartingPointCounter += cellWidth; } @@ -3504,7 +3498,7 @@ namespace PlantPipingSystemsManager { bool HasInsulation(false); RadialSizing PipeSizing; Circuit *circuitReference = nullptr; - for (auto &thisCircuit : this->circuits) { + for (auto const &thisCircuit : this->circuits) { for (auto &segment : thisCircuit->pipeSegments) { if (XYRectangle.contains(segment->PipeLocation)) { //'inform the cell that it is a pipe node @@ -3839,7 +3833,7 @@ namespace PlantPipingSystemsManager { bool CircuitInletCellSet = false; - for (auto &segment : thisCircuit->pipeSegments) { + for (auto const &segment : thisCircuit->pipeSegments) { switch (segment->FlowDirection) { case SegmentFlow::IncreasingZ: SegmentInletCellX = segment->PipeCellCoordinates.X; @@ -5175,7 +5169,7 @@ namespace PlantPipingSystemsManager { NextOuterRadialCellTemperature = cell.PipeCellData.Pipe.Temperature; } } else { - auto &nextOuterMostSoilCell = cell.PipeCellData.Soil[numSoilCells - 2]; + auto const &nextOuterMostSoilCell = cell.PipeCellData.Soil[numSoilCells - 2]; NextOuterRadialCellOuterRadius = nextOuterMostSoilCell.OuterRadius; NextOuterRadialCellRadialCentroid = nextOuterMostSoilCell.RadialCentroid; NextOuterRadialCellConductivity = nextOuterMostSoilCell.Properties.Conductivity; From 5982033ef1ecc98588d9ad3d649e0b242c29afb9 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 15:18:22 -0400 Subject: [PATCH 102/108] const, scope and shadow outer function --- src/EnergyPlus/PlantPressureSystem.cc | 47 ++++++++++++--------------- src/EnergyPlus/PlantPressureSystem.hh | 4 +-- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/EnergyPlus/PlantPressureSystem.cc b/src/EnergyPlus/PlantPressureSystem.cc index dc15cff6b4c..f539eb4898b 100644 --- a/src/EnergyPlus/PlantPressureSystem.cc +++ b/src/EnergyPlus/PlantPressureSystem.cc @@ -469,8 +469,6 @@ void UpdatePressureDrop(EnergyPlusData &state, int const LoopNum) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int BranchNum; - int NumBranches; - Real64 BranchPressureDrop; Real64 LoopSidePressureDrop; Real64 LoopPressureDrop; Array1D ParallelBranchPressureDrops; @@ -493,25 +491,27 @@ void UpdatePressureDrop(EnergyPlusData &state, int const LoopNum) // Loop through all branches on this loop side LoopSidePressureDrop = 0.0; - NumBranches = size(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch); + int NumBranches = size(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch); // Split here based on a single branch loop or a splitter/mixer configuration if (NumBranches == 1) { // Just do the single branch //***SINGLE BRANCH***! BranchNum = 1; - DistributePressureOnBranch(state, LoopNum, LoopSideNum, BranchNum, BranchPressureDrop, FoundAPumpOnBranch); - LoopSidePressureDrop += BranchPressureDrop; - LoopPressureDrop += BranchPressureDrop; + Real64 BranchPressureDropValue = 0.0; + DistributePressureOnBranch(state, LoopNum, LoopSideNum, BranchNum, BranchPressureDropValue, FoundAPumpOnBranch); + LoopSidePressureDrop += BranchPressureDropValue; + LoopPressureDrop += BranchPressureDropValue; //*******************! } else if (NumBranches > 1) { // Loop through all branches on this loop side, mixer/splitter configuration //***OUTLET BRANCH***! BranchNum = NumBranches; - DistributePressureOnBranch(state, LoopNum, LoopSideNum, BranchNum, BranchPressureDrop, FoundAPumpOnBranch); - LoopSidePressureDrop += BranchPressureDrop; - LoopPressureDrop += BranchPressureDrop; + Real64 BranchPressureDropValue = 0.0; + DistributePressureOnBranch(state, LoopNum, LoopSideNum, BranchNum, BranchPressureDropValue, FoundAPumpOnBranch); + LoopSidePressureDrop += BranchPressureDropValue; + LoopPressureDrop += BranchPressureDropValue; //*******************! //***MIXER SIMULATION***! @@ -539,9 +539,9 @@ void UpdatePressureDrop(EnergyPlusData &state, int const LoopNum) // Now take max inlet pressure to pass across splitter and max branch pressure for bookkeeping SplitterInletPressure = maxval(ParallelBranchInletPressures); - BranchPressureDrop = maxval(ParallelBranchPressureDrops); - LoopSidePressureDrop += BranchPressureDrop; - LoopPressureDrop += BranchPressureDrop; + BranchPressureDropValue = maxval(ParallelBranchPressureDrops); + LoopSidePressureDrop += BranchPressureDropValue; + LoopPressureDrop += BranchPressureDropValue; //**********************! // If we found pumps on the parallel branches then we are done, @@ -571,9 +571,9 @@ void UpdatePressureDrop(EnergyPlusData &state, int const LoopNum) //***INLET BRANCH***! BranchNum = 1; - DistributePressureOnBranch(state, LoopNum, LoopSideNum, BranchNum, BranchPressureDrop, FoundAPumpOnBranch); - LoopSidePressureDrop += BranchPressureDrop; - LoopPressureDrop += BranchPressureDrop; + DistributePressureOnBranch(state, LoopNum, LoopSideNum, BranchNum, BranchPressureDropValue, FoundAPumpOnBranch); + LoopSidePressureDrop += BranchPressureDropValue; + LoopPressureDrop += BranchPressureDropValue; //******************! //***PLANT INTERFACE***! @@ -654,17 +654,10 @@ void DistributePressureOnBranch(EnergyPlusData &state, // Account for branch pressure drop at branch inlet node // Update PlantLoop(:)%LoopSide(:)%Branch(:)%PressureDrop Variable - // Using/Aliasing - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int CompNum; - int NumCompsOnBranch; - Real64 TempBranchPressureDrop; - // Initialize - TempBranchPressureDrop = 0.0; + Real64 TempBranchPressureDrop = 0.0; BranchPressureDrop = 0.0; - NumCompsOnBranch = size(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp); + int NumCompsOnBranch = size(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp); // Retrieve temporary branch pressure drop if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).HasPressureComponents) { @@ -708,7 +701,7 @@ void DistributePressureOnBranch(EnergyPlusData &state, // Then Smear any internal nodes with this new node pressure by working backward through // all but the last component, and passing node pressure upstream if (NumCompsOnBranch > 1) { - for (CompNum = NumCompsOnBranch - 1; CompNum >= 1; --CompNum) { + for (int CompNum = NumCompsOnBranch - 1; CompNum >= 1; --CompNum) { // If this component is a pump, stop passing pressure upstream, and set flag to true for calling routine if (DataPlant::PlantEquipmentTypeIsPump[static_cast( @@ -725,7 +718,7 @@ void DistributePressureOnBranch(EnergyPlusData &state, } void PassPressureAcrossMixer( - EnergyPlusData &state, int const LoopNum, const DataPlant::LoopSideLocation LoopSideNum, Real64 &MixerPressure, int const NumBranchesOnLoopSide) + EnergyPlusData &state, int const LoopNum, const DataPlant::LoopSideLocation LoopSideNum, Real64 const MixerPressure, int const NumBranchesOnLoopSide) { // SUBROUTINE INFORMATION: @@ -753,7 +746,7 @@ void PassPressureAcrossMixer( void PassPressureAcrossSplitter(EnergyPlusData &state, int const LoopNum, const DataPlant::LoopSideLocation LoopSideNum, - Real64 &SplitterInletPressure) + Real64 const SplitterInletPressure) { // SUBROUTINE INFORMATION: diff --git a/src/EnergyPlus/PlantPressureSystem.hh b/src/EnergyPlus/PlantPressureSystem.hh index 642571604eb..7c490d773c7 100644 --- a/src/EnergyPlus/PlantPressureSystem.hh +++ b/src/EnergyPlus/PlantPressureSystem.hh @@ -91,13 +91,13 @@ namespace PlantPressureSystem { void PassPressureAcrossMixer(EnergyPlusData &state, const int LoopNum, const DataPlant::LoopSideLocation LoopSideNum, - Real64 &MixerPressure, + const Real64 MixerPressure, const int NumBranchesOnLoopSide); void PassPressureAcrossSplitter(EnergyPlusData &state, const int LoopNum, const DataPlant::LoopSideLocation LoopSideNum, - Real64 &SplitterInletPressure); + const Real64 SplitterInletPressure); void PassPressureAcrossInterface(EnergyPlusData &state, int LoopNum); From cb6350c2859f99be34630e40c92acf0283dcc685 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 15:23:53 -0400 Subject: [PATCH 103/108] scope --- src/EnergyPlus/PlantPressureSystem.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/PlantPressureSystem.cc b/src/EnergyPlus/PlantPressureSystem.cc index f539eb4898b..7237ce4199d 100644 --- a/src/EnergyPlus/PlantPressureSystem.cc +++ b/src/EnergyPlus/PlantPressureSystem.cc @@ -155,12 +155,6 @@ void InitPressureDrop(EnergyPlusData &state, int const LoopNum, bool const First // Initializes output variables and data structure // On FirstHVAC, updates the demand inlet node pressure - // Using/Aliasing - - // Simulation Variables - int NumBranches; - int BranchPressureTally; - if (state.dataPlantPressureSys->InitPressureDropOneTimeInit) { // First allocate the initialization array to each plant loop state.dataPlantPressureSys->LoopInit.allocate(size(state.dataPlnt->PlantLoop)); @@ -175,7 +169,6 @@ void InitPressureDrop(EnergyPlusData &state, int const LoopNum, bool const First // Initialize bool ErrorsFound(false); - bool SeriesPressureComponentFound(false); // Need to go along plant loop and set up component pressure drop data structure! for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) { @@ -230,6 +223,8 @@ void InitPressureDrop(EnergyPlusData &state, int const LoopNum, bool const First } if (loop.HasPressureComponents) { + bool SeriesPressureComponentFound = false; + int BranchPressureTally = 0; state.dataPlantPressureSys->FullParallelBranchSetFound[static_cast(DataPlant::LoopSideLocation::Demand)] = state.dataPlantPressureSys->FullParallelBranchSetFound[static_cast(DataPlant::LoopSideLocation::Supply)] = false; @@ -247,8 +242,7 @@ void InitPressureDrop(EnergyPlusData &state, int const LoopNum, bool const First for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) { // Check for illegal parallel branch setups auto &loop_side(loop.LoopSide(LoopSideNum)); - BranchPressureTally = 0; - NumBranches = size(loop_side.Branch); + int NumBranches = size(loop_side.Branch); if (NumBranches > 2) { for (int BranchNum = 2; BranchNum <= NumBranches - 1; ++BranchNum) { if (loop_side.Branch(BranchNum).HasPressureComponents) { @@ -717,8 +711,11 @@ void DistributePressureOnBranch(EnergyPlusData &state, } } -void PassPressureAcrossMixer( - EnergyPlusData &state, int const LoopNum, const DataPlant::LoopSideLocation LoopSideNum, Real64 const MixerPressure, int const NumBranchesOnLoopSide) +void PassPressureAcrossMixer(EnergyPlusData &state, + int const LoopNum, + const DataPlant::LoopSideLocation LoopSideNum, + Real64 const MixerPressure, + int const NumBranchesOnLoopSide) { // SUBROUTINE INFORMATION: From 8c62c56f96fcd7d10517ba36e2facb4bd2e284c4 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 15:31:07 -0400 Subject: [PATCH 104/108] scope --- src/EnergyPlus/PlantUtilities.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/PlantUtilities.cc b/src/EnergyPlus/PlantUtilities.cc index 6ecabb91bbe..5e901159a27 100644 --- a/src/EnergyPlus/PlantUtilities.cc +++ b/src/EnergyPlus/PlantUtilities.cc @@ -525,22 +525,16 @@ void CheckPlantMixerSplitterConsistency(EnergyPlusData &state, using DataPlant::CriteriaDelta_MassFlowRate; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int MixerOutletNode; - int SplitterInletNode; Real64 AbsDifference; - int NumSplitterOutlets; Real64 SumOutletFlow; - int OutletNum; - int BranchNum; - int LastNodeOnBranch; if (!state.dataPlnt->PlantLoop(LoopNum).LoopHasConnectionComp) { if (!state.dataGlobal->DoingSizing && !state.dataGlobal->WarmupFlag && state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Mixer.Exists && !FirstHVACIteration) { // Find mixer outlet node number - MixerOutletNode = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Mixer.NodeNumOut; + int MixerOutletNode = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Mixer.NodeNumOut; // Find splitter inlet node number - SplitterInletNode = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Splitter.NodeNumIn; + int SplitterInletNode = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Splitter.NodeNumIn; AbsDifference = std::abs(state.dataLoopNodes->Node(SplitterInletNode).MassFlowRate - state.dataLoopNodes->Node(MixerOutletNode).MassFlowRate); @@ -588,12 +582,12 @@ void CheckPlantMixerSplitterConsistency(EnergyPlusData &state, // now check inside s/m to see if there are problems // loop across branch outlet nodes and check mass continuity - NumSplitterOutlets = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Splitter.TotalOutletNodes; + int NumSplitterOutlets = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Splitter.TotalOutletNodes; SumOutletFlow = 0.0; // SumInletFlow = 0.0; - for (OutletNum = 1; OutletNum <= NumSplitterOutlets; ++OutletNum) { - BranchNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Splitter.BranchNumOut(OutletNum); - LastNodeOnBranch = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).NodeNumOut; + for (int OutletNum = 1; OutletNum <= NumSplitterOutlets; ++OutletNum) { + int BranchNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Splitter.BranchNumOut(OutletNum); + int LastNodeOnBranch = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).NodeNumOut; SumOutletFlow += state.dataLoopNodes->Node(LastNodeOnBranch).MassFlowRate; // FirstNodeOnBranch= PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%NodeNumIn // SumInletFlow = SumInletFlow + Node(FirstNodeOnBranch)%MassFlowRate From b3bb6977b3be664a1352176cf7f585e6345315c9 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 15:42:25 -0400 Subject: [PATCH 105/108] scope and const --- src/EnergyPlus/PlantUtilities.cc | 42 +++++++++++++------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/EnergyPlus/PlantUtilities.cc b/src/EnergyPlus/PlantUtilities.cc index 5e901159a27..252dc923965 100644 --- a/src/EnergyPlus/PlantUtilities.cc +++ b/src/EnergyPlus/PlantUtilities.cc @@ -148,7 +148,7 @@ void SetComponentFlowRate(EnergyPlusData &state, Real64 const MdotOldRequest = state.dataLoopNodes->Node(InletNode).MassFlowRateRequest; auto &loop_side = state.dataPlnt->PlantLoop(plantLoc.loopNum).LoopSide(plantLoc.loopSideNum); - auto &comp = loop_side.Branch(plantLoc.branchNum).Comp(plantLoc.compNum); + auto const &comp = loop_side.Branch(plantLoc.branchNum).Comp(plantLoc.compNum); if (comp.CurOpSchemeType == DataPlant::OpScheme::Demand) { // store flow request on inlet node @@ -202,9 +202,9 @@ void SetComponentFlowRate(EnergyPlusData &state, bool EMSLoadOverride = false; for (int CompNum = 1; CompNum <= loop_side.Branch(plantLoc.branchNum).TotalComponents; ++CompNum) { - auto &thisComp = loop_side.Branch(plantLoc.branchNum).Comp(CompNum); + auto const &thisComp = loop_side.Branch(plantLoc.branchNum).Comp(CompNum); int const CompInletNodeNum = thisComp.NodeNumIn; - auto &thisInletNode = state.dataLoopNodes->Node(CompInletNodeNum); + auto const &thisInletNode = state.dataLoopNodes->Node(CompInletNodeNum); SeriesBranchHighFlowRequest = max(thisInletNode.MassFlowRateRequest, SeriesBranchHighFlowRequest); SeriesBranchHardwareMaxLim = min(thisInletNode.MassFlowRateMax, SeriesBranchHardwareMaxLim); SeriesBranchHardwareMinLim = max(thisInletNode.MassFlowRateMin, SeriesBranchHardwareMinLim); @@ -231,7 +231,7 @@ void SetComponentFlowRate(EnergyPlusData &state, state.dataLoopNodes->Node(OutletNode).MassFlowRate = CompFlow; state.dataLoopNodes->Node(InletNode).MassFlowRate = state.dataLoopNodes->Node(OutletNode).MassFlowRate; for (int CompNum = 1; CompNum <= loop_side.Branch(plantLoc.branchNum).TotalComponents; ++CompNum) { - auto &thisComp = loop_side.Branch(plantLoc.branchNum).Comp(CompNum); + auto const &thisComp = loop_side.Branch(plantLoc.branchNum).Comp(CompNum); int const CompInletNodeNum = thisComp.NodeNumIn; int const CompOutletNodeNum = thisComp.NodeNumOut; state.dataLoopNodes->Node(CompInletNodeNum).MassFlowRate = state.dataLoopNodes->Node(OutletNode).MassFlowRate; @@ -253,7 +253,7 @@ void SetComponentFlowRate(EnergyPlusData &state, for (int CompNum = 1; CompNum <= loop_side.Branch(plantLoc.branchNum).TotalComponents; ++CompNum) { // check to see if any component on branch uses EMS On/Off Supervisory control to shut down flow - auto &thisComp = loop_side.Branch(plantLoc.branchNum).Comp(CompNum); + auto const &thisComp = loop_side.Branch(plantLoc.branchNum).Comp(CompNum); if (thisComp.EMSLoadOverrideOn && thisComp.EMSLoadOverrideValue == 0.0) EMSLoadOverride = true; } @@ -660,8 +660,6 @@ void CheckForRunawayPlantTemps(EnergyPlusData &state, int const LoopNum, const D // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string hotcold; bool makefatalerror; - int BrN; - int CpN; Real64 LoopCapacity; Real64 LoopDemandSideCapacity; Real64 LoopSupplySideCapacity; @@ -771,8 +769,8 @@ void CheckForRunawayPlantTemps(EnergyPlusData &state, int const LoopNum, const D LoopCapacity = 0.0; DispatchedCapacity = 0.0; for (DataPlant::LoopSideLocation LSN : DataPlant::LoopSideKeys) { - for (BrN = 1; BrN <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LSN).TotalBranches; ++BrN) { - for (CpN = 1; CpN <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LSN).Branch(BrN).TotalComponents; ++CpN) { + for (int BrN = 1; BrN <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LSN).TotalBranches; ++BrN) { + for (int CpN = 1; CpN <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LSN).Branch(BrN).TotalComponents; ++CpN) { LoopCapacity += state.dataPlnt->PlantLoop(LoopNum).LoopSide(LSN).Branch(BrN).Comp(CpN).MaxLoad; DispatchedCapacity += std::abs(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LSN).Branch(BrN).Comp(CpN).MyLoad); } @@ -986,9 +984,7 @@ void UpdateChillerComponentCondenserSide(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool DidAnythingChange(false); // set to true if conditions changed - int OtherLoopNum; // local loop pointer for remote connected loop DataPlant::LoopSideLocation OtherLoopSide; // local loop side pointer for remote connected loop - int ConnectLoopNum; // local do loop counter Real64 Cp; // check if any conditions have changed @@ -1028,12 +1024,12 @@ void UpdateChillerComponentCondenserSide(EnergyPlusData &state, // set sim flag on connected loops to true because this side changed if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected > 0) { - for (ConnectLoopNum = 1; ConnectLoopNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected; ++ConnectLoopNum) { + for (int ConnectLoopNum = 1; ConnectLoopNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected; ++ConnectLoopNum) { // see 10133 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopDemandsOnRemote) { // full chiller model is not really run when called from the condenser side and the chiller evap loop puts demand on the condenser // loop, so this logic is flawed, remove if statement so evap side gets simulated again - OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopNum; + int OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopNum; OtherLoopSide = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopSideNum; state.dataPlnt->PlantLoop(OtherLoopNum).LoopSide(OtherLoopSide).SimLoopSideNeeded = true; } @@ -1080,9 +1076,7 @@ void UpdateComponentHeatRecoverySide(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool DidAnythingChange(false); // set to true if conditions changed - int OtherLoopNum; // local loop pointer for remote connected loop DataPlant::LoopSideLocation OtherLoopSide; // local loop side pointer for remote connected loop - int ConnectLoopNum; // local do loop counter Real64 Cp; // local fluid specific heat // check if any conditions have changed @@ -1121,12 +1115,12 @@ void UpdateComponentHeatRecoverySide(EnergyPlusData &state, // set sim flag on connected loops to true because this side changed if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected > 0) { - for (ConnectLoopNum = 1; ConnectLoopNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected; ++ConnectLoopNum) { + for (int ConnectLoopNum = 1; ConnectLoopNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected; ++ConnectLoopNum) { // see 10133 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopDemandsOnRemote) { // full chiller model is not really run when called from the heat recovery side and the chiller evap loop puts demand on the heat // recovery loop, so this logic is flawed, remove if statement so evap side gets simulated again - OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopNum; + int OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopNum; OtherLoopSide = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopSideNum; state.dataPlnt->PlantLoop(OtherLoopNum).LoopSide(OtherLoopSide).SimLoopSideNeeded = true; } @@ -1166,9 +1160,7 @@ void UpdateAbsorberChillerComponentGeneratorSide(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool DidAnythingChange(false); // set to true if conditions changed - int OtherLoopNum; // local loop pointer for remote connected loop DataPlant::LoopSideLocation OtherLoopSide; // local loop side pointer for remote connected loop - int ConnectLoopNum; // local do loop counter // check if any conditions have changed if (state.dataLoopNodes->Node(InletNodeNum).MassFlowRate != ModelMassFlowRate) DidAnythingChange = true; @@ -1187,9 +1179,9 @@ void UpdateAbsorberChillerComponentGeneratorSide(EnergyPlusData &state, // set sim flag on connected loops to true because this side changed if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected > 0) { - for (ConnectLoopNum = 1; ConnectLoopNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected; ++ConnectLoopNum) { + for (int ConnectLoopNum = 1; ConnectLoopNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).TotalConnected; ++ConnectLoopNum) { if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopDemandsOnRemote) { - OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopNum; + int OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopNum; OtherLoopSide = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide).Connected(ConnectLoopNum).LoopSideNum; state.dataPlnt->PlantLoop(OtherLoopNum).LoopSide(OtherLoopSide).SimLoopSideNeeded = true; } @@ -1798,7 +1790,7 @@ void ScanPlantLoopsForNodeNum(EnergyPlusData &state, for (BranchCtr = 1; BranchCtr <= this_loop_side.TotalBranches; ++BranchCtr) { auto &this_branch = this_loop_side.Branch(BranchCtr); for (CompCtr = 1; CompCtr <= this_branch.TotalComponents; ++CompCtr) { - auto &this_comp = this_branch.Comp(CompCtr); + auto const &this_comp = this_branch.Comp(CompCtr); if (NodeNum == this_comp.NodeNumIn) { FoundNode = true; ++inFoundCount; @@ -1998,9 +1990,9 @@ bool verifyTwoNodeNumsOnSamePlantLoop(EnergyPlusData &state, int const nodeIndex int matchedIndexA = 0; int matchedIndexB = 0; for (int loopNum = 1; loopNum <= state.dataPlnt->TotNumLoops; loopNum++) { - for (auto &loopSide : state.dataPlnt->PlantLoop(loopNum).LoopSide) { - for (auto &branch : loopSide.Branch) { - for (auto &comp : branch.Comp) { + for (auto const &loopSide : state.dataPlnt->PlantLoop(loopNum).LoopSide) { + for (auto const &branch : loopSide.Branch) { + for (auto const &comp : branch.Comp) { if (comp.NodeNumIn == nodeIndexA || comp.NodeNumOut == nodeIndexA) { matchedIndexA = loopNum; } From ec6c1a55943c28cf56bbd04244fb25b658efcf67 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 15:47:11 -0400 Subject: [PATCH 106/108] const --- src/EnergyPlus/PlantValves.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/PlantValves.cc b/src/EnergyPlus/PlantValves.cc index 7c0e98d2dde..0a0a2e00e71 100644 --- a/src/EnergyPlus/PlantValves.cc +++ b/src/EnergyPlus/PlantValves.cc @@ -328,10 +328,10 @@ namespace PlantValves { if (thisLoopSide.Mixer.Exists) { if (any_eq(thisLoopSide.Mixer.NodeNumIn, this->PltStream2NodeNum)) { int thisInnerBranchCtr = 0; - for (auto &thisInnerBranch : thisLoopSide.Branch) { + for (auto const &thisInnerBranch : thisLoopSide.Branch) { thisInnerBranchCtr++; if (branchCtr == thisInnerBranchCtr) continue; // already looped into this one - for (auto &thisInnerComp : thisInnerBranch.Comp) { + for (auto const &thisInnerComp : thisInnerBranch.Comp) { if (thisInnerComp.NodeNumOut == this->PltStream2NodeNum) { Stream2NodeOkay = true; } From 4fd7d700d5258f2640967117e1d53bd0ad171de7 Mon Sep 17 00:00:00 2001 From: rraustad Date: Sun, 25 Aug 2024 19:30:21 -0400 Subject: [PATCH 107/108] Move to match previous code --- src/EnergyPlus/PlantPipingSystemsManager.cc | 2 +- src/EnergyPlus/PlantPressureSystem.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index 7e65dd6b5db..fbd751e8dcf 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -3138,10 +3138,10 @@ namespace PlantPipingSystemsManager { std::vector tempCellWidths; if (PartitionsExist) { + int cellCountUpToNow = 0; for (int i = 0; i < (int)ThesePartitionRegions.size(); ++i) { auto &thisPartition = ThesePartitionRegions[i]; - int cellCountUpToNow = 0; if (i == 0) { // First partition // Create region to left of partition diff --git a/src/EnergyPlus/PlantPressureSystem.cc b/src/EnergyPlus/PlantPressureSystem.cc index 7237ce4199d..0512ee9a99a 100644 --- a/src/EnergyPlus/PlantPressureSystem.cc +++ b/src/EnergyPlus/PlantPressureSystem.cc @@ -224,7 +224,6 @@ void InitPressureDrop(EnergyPlusData &state, int const LoopNum, bool const First if (loop.HasPressureComponents) { bool SeriesPressureComponentFound = false; - int BranchPressureTally = 0; state.dataPlantPressureSys->FullParallelBranchSetFound[static_cast(DataPlant::LoopSideLocation::Demand)] = state.dataPlantPressureSys->FullParallelBranchSetFound[static_cast(DataPlant::LoopSideLocation::Supply)] = false; @@ -242,6 +241,7 @@ void InitPressureDrop(EnergyPlusData &state, int const LoopNum, bool const First for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) { // Check for illegal parallel branch setups auto &loop_side(loop.LoopSide(LoopSideNum)); + int BranchPressureTally = 0; int NumBranches = size(loop_side.Branch); if (NumBranches > 2) { for (int BranchNum = 2; BranchNum <= NumBranches - 1; ++BranchNum) { From 8a1341f8f8ad3e4b9b8e9c10a7d13a53cc6c599d Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Wed, 28 Aug 2024 07:39:49 -0500 Subject: [PATCH 108/108] Remove third party nested gtest folder --- third_party/btwxt/vendor/courierr/vendor/googletest | 1 - 1 file changed, 1 deletion(-) delete mode 160000 third_party/btwxt/vendor/courierr/vendor/googletest diff --git a/third_party/btwxt/vendor/courierr/vendor/googletest b/third_party/btwxt/vendor/courierr/vendor/googletest deleted file mode 160000 index e2239ee6043..00000000000 --- a/third_party/btwxt/vendor/courierr/vendor/googletest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e2239ee6043f73722e7aa812a459f54a28552929