diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index 2fb88c72643..f42be6b6a47 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -1035,7 +1035,7 @@ namespace FluidProperties { continue; } - auto &supTempArray = FluidTemps(supTempArrayNum); + auto const &supTempArray = FluidTemps(supTempArrayNum); refrig->NumSupTempPoints = supTempArray.NumOfTemps; refrig->SupTemps.allocate(refrig->NumSupTempPoints); refrig->SupTemps = supTempArray.Temps; @@ -1441,7 +1441,7 @@ namespace FluidProperties { if (!glycolRaw->CpTempArrayName.empty()) { int cpTempArrayNum = Util::FindItemInList(glycolRaw->CpTempArrayName, FluidTemps); - auto &cpTempArray = FluidTemps(cpTempArrayNum); + auto const &cpTempArray = FluidTemps(cpTempArrayNum); glycolRaw->NumCpTempPoints = cpTempArray.NumOfTemps; glycolRaw->CpTemps.allocate(glycolRaw->NumCpTempPoints); glycolRaw->CpTemps = cpTempArray.Temps; @@ -1452,7 +1452,7 @@ namespace FluidProperties { if (!glycolRaw->RhoTempArrayName.empty()) { int rhoTempArrayNum = Util::FindItemInList(glycolRaw->RhoTempArrayName, FluidTemps); - auto &rhoTempArray = FluidTemps(rhoTempArrayNum); + auto const &rhoTempArray = FluidTemps(rhoTempArrayNum); glycolRaw->NumRhoTempPoints = rhoTempArray.NumOfTemps; glycolRaw->RhoTemps.allocate(glycolRaw->NumRhoTempPoints); glycolRaw->RhoTemps = rhoTempArray.Temps; @@ -1463,7 +1463,7 @@ namespace FluidProperties { if (!glycolRaw->CondTempArrayName.empty()) { int condTempArrayNum = Util::FindItemInList(glycolRaw->CondTempArrayName, FluidTemps); - auto &condTempArray = FluidTemps(condTempArrayNum); + auto const &condTempArray = FluidTemps(condTempArrayNum); glycolRaw->NumCondTempPoints = condTempArray.NumOfTemps; glycolRaw->CondTemps.allocate(glycolRaw->NumCondTempPoints); glycolRaw->CondTemps = condTempArray.Temps; @@ -1474,7 +1474,7 @@ namespace FluidProperties { if (!glycolRaw->ViscTempArrayName.empty()) { int viscTempArrayNum = Util::FindItemInList(glycolRaw->ViscTempArrayName, FluidTemps); - auto &viscTempArray = FluidTemps(viscTempArrayNum); + auto const &viscTempArray = FluidTemps(viscTempArrayNum); glycolRaw->NumViscTempPoints = viscTempArray.NumOfTemps; glycolRaw->ViscTemps.allocate(glycolRaw->NumViscTempPoints); glycolRaw->ViscTemps = viscTempArray.Temps; @@ -1936,7 +1936,7 @@ namespace FluidProperties { // Most properties requested (e.g., Specific Heat) must be > 0 but the tables may // be set up for symmetry and not be limited to just valid values. - auto &df = state.dataFluidProps; + auto const &df = state.dataFluidProps; for (auto *glycol : df->glycols) { if (glycol->CpDataPresent) { @@ -2039,7 +2039,7 @@ namespace FluidProperties { // for the refrigerant properties. // Most properties requested (e.g., Specific Heat) must be > 0 but the tables may // be set up for symmetry and not be limited to just valid values. - auto &df = state.dataFluidProps; + auto const &df = state.dataFluidProps; for (auto *refrig : df->refrigs) { for (int IndexNum = 1; IndexNum <= refrig->NumPsPoints; ++IndexNum) { @@ -2181,7 +2181,7 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from glycol functions - auto &df = state.dataFluidProps; + auto const &df = state.dataFluidProps; for (auto *glycol : df->glycols) { @@ -2423,7 +2423,7 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from refrigerant functions - auto &df = state.dataFluidProps; + auto const &df = state.dataFluidProps; for (auto *refrig : df->refrigs) { // Lay out the basic values: @@ -2759,8 +2759,6 @@ namespace FluidProperties { int LoTempIndex = FindArrayIndex(Temperature, this->PsTemps, this->PsLowTempIndex, this->PsHighTempIndex); - auto &df = state.dataFluidProps; - // check for out of data bounds problems if (LoTempIndex == 0) { ReturnValue = this->PsValues(this->PsLowTempIndex); @@ -2778,6 +2776,8 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatTemp].count; + auto &df = state.dataFluidProps; + // send warning if (this->errors[(int)RefrigError::SatTemp].count <= df->RefrigErrorLimitTest) { ShowSevereMessage( @@ -2851,8 +2851,6 @@ namespace FluidProperties { // FUNCTION LOCAL VARIABLE DECLARATIONS: bool ErrorFlag = false; // error flag for current call - auto &df = state.dataFluidProps; - // get the array indices int LoPresIndex = FindArrayIndex(Pressure, this->PsValues, this->PsLowPresIndex, this->PsHighPresIndex); @@ -2873,6 +2871,8 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatPress].count; + auto &df = state.dataFluidProps; + // send warning if (this->errors[(int)RefrigError::SatPress].count <= df->RefrigErrorLimitTest) { ShowSevereMessage(state, @@ -2995,8 +2995,6 @@ namespace FluidProperties { // FUNCTION PARAMETER DEFINITIONS: static constexpr std::string_view routineName = "RefrigProps::getSatDensity"; - auto &df = state.dataFluidProps; - if ((Quality < 0.0) || (Quality > 1.0)) { ShowSevereError(state, fmt::format("{}Refrigerant \"{}\", invalid quality, called from {}", routineName, this->Name, CalledFrom)); ShowContinueError(state, format("Saturated density quality must be between 0 and 1, entered value=[{:.4R}].", Quality)); @@ -3045,6 +3043,8 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatTempDensity].count; + auto &df = state.dataFluidProps; + // send warning if (this->errors[(int)RefrigError::SatTempDensity].count <= df->RefrigErrorLimitTest) { ShowSevereMessage( @@ -3403,8 +3403,6 @@ namespace FluidProperties { // the enthalpy calculated from the pressure found static constexpr std::string_view routineName = "RefrigProps::getSupHeatPressure"; - auto &df = state.dataFluidProps; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 EnthalpyCheck; // recalculates enthalpy based on calculated pressure Real64 EnthalpyHigh; // Enthalpy value at interpolated pressure and high temperature @@ -3542,6 +3540,8 @@ namespace FluidProperties { } if (ErrCount > 0 && !state.dataGlobal->WarmupFlag) { + auto &df = state.dataFluidProps; + // send near saturation warning if flagged this->errors[(int)RefrigError::SatSupPress].count += CurSatErrCount; // send warning @@ -4593,7 +4593,7 @@ namespace FluidProperties { int GetGlycolRawNum(EnergyPlusData &state, std::string_view const glycolRawName) // carries in substance name { - auto &df = state.dataFluidProps; + auto const &df = state.dataFluidProps; auto found = std::find_if(df->glycolsRaw.begin(), df->glycolsRaw.end(), [glycolRawName](GlycolRawProps const *glycolRaw) { return glycolRaw->Name == glycolRawName; @@ -4779,8 +4779,6 @@ namespace FluidProperties { // Return value Real64 ReturnValue; - auto &df = state.dataFluidProps; - // error counters and dummy string bool ErrorFlag(false); // error flag for current call @@ -4811,6 +4809,8 @@ namespace FluidProperties { } if (ErrorFlag && (CalledFrom != "ReportAndTestRefrigerants")) { + auto &df = state.dataFluidProps; + ++df->TempRangeErrCountGetInterpolatedSatProp; // send warning if (df->TempRangeErrCountGetInterpolatedSatProp <= df->RefrigErrorLimitTest) { @@ -4832,7 +4832,7 @@ namespace FluidProperties { //***************************************************************************** - bool CheckFluidPropertyName(EnergyPlusData &state, + bool CheckFluidPropertyName(EnergyPlusData const &state, std::string const &name) // Name from input(?) to be checked against valid FluidPropertyNames { @@ -4842,7 +4842,7 @@ namespace FluidProperties { // PURPOSE OF THIS FUNCTION: // This function checks on an input fluid property to make sure it is valid. - auto &df = state.dataFluidProps; + auto const &df = state.dataFluidProps; auto foundRefrig = std::find_if(df->refrigs.begin(), df->refrigs.end(), [name](RefrigProps const *refrig) { return refrig->Name == name; }); if (foundRefrig != df->refrigs.end()) return true; @@ -4867,7 +4867,7 @@ namespace FluidProperties { bool NeedOrphanMessage = true; int NumUnusedRefrig = 0; - auto &df = state.dataFluidProps; + auto const &df = state.dataFluidProps; for (auto const *refrig : df->refrigs) { if (refrig->used) continue; @@ -4913,18 +4913,18 @@ namespace FluidProperties { void GetFluidDensityTemperatureLimits(EnergyPlusData &state, int const FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit) { if (FluidIndex > 0) { - auto &df = state.dataFluidProps; - MinTempLimit = df->glycols(FluidIndex)->RhoLowTempValue; - MaxTempLimit = df->glycols(FluidIndex)->RhoHighTempValue; + auto const &df = state.dataFluidProps->glycols(FluidIndex); + MinTempLimit = df->RhoLowTempValue; + MaxTempLimit = df->RhoHighTempValue; } } void GetFluidSpecificHeatTemperatureLimits(EnergyPlusData &state, int const FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit) { if (FluidIndex > 0) { - auto &df = state.dataFluidProps; - MinTempLimit = df->glycols(FluidIndex)->CpLowTempValue; - MaxTempLimit = df->glycols(FluidIndex)->CpHighTempValue; + auto const &df = state.dataFluidProps->glycols(FluidIndex); + MinTempLimit = df->CpLowTempValue; + MaxTempLimit = df->CpHighTempValue; } } diff --git a/src/EnergyPlus/FluidProperties.hh b/src/EnergyPlus/FluidProperties.hh index 8beb5eb006f..2fd4cf1aeb8 100644 --- a/src/EnergyPlus/FluidProperties.hh +++ b/src/EnergyPlus/FluidProperties.hh @@ -564,7 +564,7 @@ namespace FluidProperties { int UpperBound // Valid values upper bound (set by calling program) ); - bool CheckFluidPropertyName(EnergyPlusData &state, + bool CheckFluidPropertyName(EnergyPlusData const &state, std::string const &NameToCheck); // Name from input(?) to be checked against valid FluidPropertyNames void ReportOrphanFluids(EnergyPlusData &state); diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index 1f456af1569..6081df8a17f 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -2768,8 +2768,6 @@ namespace Furnaces { // Get fan data FanName = Alphas(7); - errFlag = false; - thisFurnace.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(6))); if (thisFurnace.fanType == HVAC::FanType::OnOff || thisFurnace.fanType == HVAC::FanType::Constant) { @@ -4739,11 +4737,7 @@ namespace Furnaces { if (!state.dataGlobal->DoingSizing && state.dataFurnaces->MySecondOneTimeFlag(FurnaceNum)) { // sizing all done. check fan air flow rates - errFlag = false; thisFurnace.ActualFanVolFlowRate = state.dataFans->fans(thisFurnace.FanIndex)->maxAirFlowRate; - if (errFlag) { - ShowContinueError(state, format("...occurs in {} ={}", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); - } if (thisFurnace.ActualFanVolFlowRate != DataSizing::AutoSize) { if (thisFurnace.DesignFanVolFlowRate > thisFurnace.ActualFanVolFlowRate) { ShowWarningError(state, @@ -5001,11 +4995,11 @@ namespace Furnaces { thisFurnace.CoolingSpeedRatio = thisFurnace.MaxCoolAirVolFlow / thisFurnace.ActualFanVolFlowRate; thisFurnace.NoHeatCoolSpeedRatio = thisFurnace.MaxNoCoolHeatAirVolFlow / thisFurnace.ActualFanVolFlowRate; } - std::string FanName; // used in warning messages if (dynamic_cast(state.dataFans->fans(thisFurnace.FanIndex))->powerRatioAtSpeedRatioCurveNum > 0) { if (thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxHeatAirVolFlow && thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxCoolAirVolFlow && thisFurnace.ActualFanVolFlowRate == thisFurnace.MaxNoCoolHeatAirVolFlow) { + std::string FanName = state.dataFans->fans(thisFurnace.FanIndex)->Name; ShowWarningError(state, format("{} \"{}\"", HVAC::unitarySysTypeNames[(int)thisFurnace.type], thisFurnace.Name)); ShowContinueError(state, format("...For fan type and name = {} \"{}\"", HVAC::fanTypeNames[(int)thisFurnace.fanType], FanName)); diff --git a/src/EnergyPlus/HVACInterfaceManager.cc b/src/EnergyPlus/HVACInterfaceManager.cc index d292194eacc..bc69d709fb9 100644 --- a/src/EnergyPlus/HVACInterfaceManager.cc +++ b/src/EnergyPlus/HVACInterfaceManager.cc @@ -123,7 +123,7 @@ void UpdateHVACInterface(EnergyPlusData &state, Real64 totDemandSideMaxAvail = 0.0; for (int demIn = 1; demIn <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumSupplyNodes; ++demIn) { int demInNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(demIn); - auto &node = state.dataLoopNodes->Node(demInNode); + auto const &node = state.dataLoopNodes->Node(demInNode); totDemandSideMassFlow += node.MassFlowRate; totDemandSideMinAvail += node.MassFlowRateMinAvail; totDemandSideMaxAvail += node.MassFlowRateMaxAvail; diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index bcf586817a3..8bc8708c0ed 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -2051,7 +2051,7 @@ void ResolveLockoutFlags(EnergyPlusData &state, bool &SimAir) // TRUE means air } } -void ResetHVACControl(EnergyPlusData &state) +void ResetHVACControl(EnergyPlusData const &state) { // SUBROUTINE INFORMATION: diff --git a/src/EnergyPlus/HVACManager.hh b/src/EnergyPlus/HVACManager.hh index d7fe431d612..89d35831ceb 100644 --- a/src/EnergyPlus/HVACManager.hh +++ b/src/EnergyPlus/HVACManager.hh @@ -97,7 +97,7 @@ namespace HVACManager { void ResolveLockoutFlags(EnergyPlusData &state, bool &SimAir); // TRUE means air loops must be (re)simulated - void ResetHVACControl(EnergyPlusData &state); + void ResetHVACControl(EnergyPlusData const &state); void ResetNodeData(EnergyPlusData &state); diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index 15438f65487..a606bccb8c8 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -281,8 +281,6 @@ void GetStandAloneERV(EnergyPlusData &state) GlobalNames::IntraObjUniquenessCheck( state, Alphas(4), CurrentModuleObject, cAlphaFields(4), state.dataHVACStandAloneERV->SupplyAirFanUniqueNames, ErrorsFound); - errFlag = false; - if ((standAloneERV.SupplyAirFanIndex = Fans::GetFanIndex(state, standAloneERV.SupplyAirFanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(4), standAloneERV.SupplyAirFanName); ErrorsFound = true; @@ -297,7 +295,6 @@ void GetStandAloneERV(EnergyPlusData &state) standAloneERV.ExhaustAirFanName = Alphas(5); GlobalNames::IntraObjUniquenessCheck( state, Alphas(5), CurrentModuleObject, cAlphaFields(5), state.dataHVACStandAloneERV->ExhaustAirFanUniqueNames, ErrorsFound); - errFlag = false; if ((standAloneERV.ExhaustAirFanIndex = Fans::GetFanIndex(state, standAloneERV.ExhaustAirFanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(5), standAloneERV.ExhaustAirFanName); @@ -1695,7 +1692,6 @@ int getEqIndex(EnergyPlusData &state, std::string_view CompName) for (int StandAloneERVNum = 1; StandAloneERVNum <= state.dataHVACStandAloneERV->NumStandAloneERVs; StandAloneERVNum++) { if (Util::SameString(CompName, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).Name)) { return StandAloneERVNum; - break; } } return 0; diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index b12b3213faf..29014cd42a6 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -330,7 +330,6 @@ namespace HVACUnitaryBypassVAV { bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine bool DXErrorsFound(false); // Set to true if errors in get coil input Array1D_int OANodeNums(4); // Node numbers of OA mixer (OA, EA, RA, MA) - std::string HXDXCoolCoilName; // Name of DX cooling coil used with Heat Exchanger Assisted Cooling Coil bool DXCoilErrFlag; // used in warning messages Array1D_string Alphas(20, ""); @@ -754,7 +753,7 @@ namespace HVACUnitaryBypassVAV { ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); ErrorsFound = true; } else { - auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[thisCBVAV.DXCoolCoilIndexNum]; + auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[thisCBVAV.DXCoolCoilIndexNum]; thisCBVAV.DXCoilInletNode = newCoil.evapInletNodeIndex; thisCBVAV.DXCoilOutletNode = newCoil.evapOutletNodeIndex; thisCBVAV.CondenserNodeNum = newCoil.condInletNodeIndex; @@ -2444,7 +2443,7 @@ namespace HVACUnitaryBypassVAV { } // now find the speed ratio for the found speednum auto f = [&state, CBVAVNum, SpeedNum, DesOutTemp](Real64 const SpeedRatio) { - auto &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); + auto const &thisCBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 OutletAirTemp; // outlet air temperature [C] Real64 QZnReqCycling = 0.001;