From 842b1090c298bdadf9c040b40200ed53c76fba1e Mon Sep 17 00:00:00 2001 From: rraustad Date: Mon, 19 Aug 2024 19:54:04 -0400 Subject: [PATCH 1/3] FluidProperties through HVACUnitaryBypassVAV --- src/EnergyPlus/FluidProperties.cc | 92 ++++++++++---------------- src/EnergyPlus/FluidProperties.hh | 2 +- src/EnergyPlus/Furnaces.cc | 8 +-- src/EnergyPlus/HVACInterfaceManager.cc | 2 +- src/EnergyPlus/HVACManager.cc | 2 +- src/EnergyPlus/HVACManager.hh | 2 +- src/EnergyPlus/HVACStandAloneERV.cc | 5 +- src/EnergyPlus/HVACUnitaryBypassVAV.cc | 7 +- 8 files changed, 44 insertions(+), 76 deletions(-) diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index 2fb88c72643..be30d53ed39 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,9 +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; - - for (auto *glycol : df->glycols) { + for (auto *glycol : state.dataFluidProps->glycols) { if (glycol->CpDataPresent) { // check for lowest non-zero value by referencing temp data for (int IndexNum = 1; IndexNum <= glycol->NumCpTempPoints; ++IndexNum) { @@ -2039,9 +2037,8 @@ 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; - for (auto *refrig : df->refrigs) { + for (auto *refrig : state.dataFluidProps->refrigs) { for (int IndexNum = 1; IndexNum <= refrig->NumPsPoints; ++IndexNum) { if (refrig->PsValues(IndexNum) <= 0.0) continue; refrig->PsLowPresIndex = IndexNum; @@ -2181,9 +2178,7 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from glycol functions - auto &df = state.dataFluidProps; - - for (auto *glycol : df->glycols) { + for (auto *glycol : state.dataFluidProps->glycols) { int GlycolIndex = 0; // used in routine calls -- value is returned when first 0 // Lay out the basic values: @@ -2423,9 +2418,7 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from refrigerant functions - auto &df = state.dataFluidProps; - - for (auto *refrig : df->refrigs) { + for (auto *refrig : state.dataFluidProps->refrigs) { // Lay out the basic values: if (!refrig->Name.empty()) { print(state.files.debug, "Refrigerant={}", refrig->Name); @@ -2759,8 +2752,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); @@ -2779,7 +2770,7 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatTemp].count; // send warning - if (this->errors[(int)RefrigError::SatTemp].count <= df->RefrigErrorLimitTest) { + if (this->errors[(int)RefrigError::SatTemp].count <= state.dataFluidProps->RefrigErrorLimitTest) { ShowSevereMessage( state, format("{}: Saturation temperature is out of range for refrigerant [{}] supplied data: **", routineName, this->Name)); ShowContinueError(state, @@ -2810,7 +2801,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatPressure() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -2820,7 +2810,7 @@ namespace FluidProperties { } } - return df->refrigs(RefrigIndex)->getSatPressure(state, Temperature, CalledFrom); + return state.dataFluidProps->refrigs(RefrigIndex)->getSatPressure(state, Temperature, CalledFrom); } //***************************************************************************** @@ -2851,8 +2841,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); @@ -2874,7 +2862,7 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatPress].count; // send warning - if (this->errors[(int)RefrigError::SatPress].count <= df->RefrigErrorLimitTest) { + if (this->errors[(int)RefrigError::SatPress].count <= state.dataFluidProps->RefrigErrorLimitTest) { ShowSevereMessage(state, format("{}: Saturation pressure is out of range for refrigerant [{}] supplied data: **", routineName, this->Name)); ShowContinueError(state, @@ -2904,7 +2892,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatTemperature() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -2914,7 +2901,7 @@ namespace FluidProperties { } } - return df->refrigs(RefrigIndex)->getSatTemperature(state, Pressure, CalledFrom); + return state.dataFluidProps->refrigs(RefrigIndex)->getSatTemperature(state, Pressure, CalledFrom); } //***************************************************************************** @@ -2954,7 +2941,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatEnthalpy() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -2963,7 +2949,7 @@ namespace FluidProperties { return 0.0; } } - return df->refrigs(RefrigIndex)->getSatEnthalpy(state, Temperature, Quality, CalledFrom); + return state.dataFluidProps->refrigs(RefrigIndex)->getSatEnthalpy(state, Temperature, Quality, CalledFrom); } //***************************************************************************** @@ -2995,8 +2981,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)); @@ -3046,7 +3030,7 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatTempDensity].count; // send warning - if (this->errors[(int)RefrigError::SatTempDensity].count <= df->RefrigErrorLimitTest) { + if (this->errors[(int)RefrigError::SatTempDensity].count <= state.dataFluidProps->RefrigErrorLimitTest) { ShowSevereMessage( state, format("{}: Saturation temperature is out of range for refrigerant [{}] supplied data: **", routineName, this->Name)); ShowContinueError(state, @@ -3077,7 +3061,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatDensity() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -3087,7 +3070,7 @@ namespace FluidProperties { } } - return df->refrigs(RefrigIndex)->getSatDensity(state, Temperature, Quality, CalledFrom); + return state.dataFluidProps->refrigs(RefrigIndex)->getSatDensity(state, Temperature, Quality, CalledFrom); } //***************************************************************************** @@ -3137,7 +3120,6 @@ namespace FluidProperties { { // Wrapper for RefrigProps::getSpecificHeat() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -3147,7 +3129,7 @@ namespace FluidProperties { } } - return df->refrigs(RefrigIndex)->getSatSpecificHeat(state, Temperature, Quality, CalledFrom); + return state.dataFluidProps->refrigs(RefrigIndex)->getSatSpecificHeat(state, Temperature, Quality, CalledFrom); } //***************************************************************************** @@ -3403,8 +3385,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 +3522,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 +4575,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; @@ -4607,9 +4589,8 @@ namespace FluidProperties { GlycolRawProps *GetGlycolRaw(EnergyPlusData &state, std::string_view const glycolRawName) { - auto &df = state.dataFluidProps; int glycolRawNum = GetGlycolRawNum(state, glycolRawName); - return (glycolRawNum > 0) ? df->glycolsRaw(glycolRawNum) : nullptr; + return (glycolRawNum > 0) ? state.dataFluidProps->glycolsRaw(glycolRawNum) : nullptr; } //***************************************************************************** @@ -4635,9 +4616,8 @@ namespace FluidProperties { // Check to see if this glycol shows up in the glycol data // ArrayLength = SIZE(GlycolData) - auto &df = state.dataFluidProps; - if (Idx > 0 && Idx <= df->glycols.isize()) { - return df->glycols(Idx)->Name; + if (Idx > 0 && Idx <= state.dataFluidProps->glycols.isize()) { + return state.dataFluidProps->glycols(Idx)->Name; } else { // return blank - error checking in calling proceedure return ""; } @@ -4779,8 +4759,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 +4789,8 @@ namespace FluidProperties { } if (ErrorFlag && (CalledFrom != "ReportAndTestRefrigerants")) { + auto &df = state.dataFluidProps; + ++df->TempRangeErrCountGetInterpolatedSatProp; // send warning if (df->TempRangeErrCountGetInterpolatedSatProp <= df->RefrigErrorLimitTest) { @@ -4832,7 +4812,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 +4822,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,9 +4847,7 @@ namespace FluidProperties { bool NeedOrphanMessage = true; int NumUnusedRefrig = 0; - auto &df = state.dataFluidProps; - - for (auto const *refrig : df->refrigs) { + for (auto const *refrig : state.dataFluidProps->refrigs) { if (refrig->used) continue; if (refrig->Name == "STEAM") continue; if (NeedOrphanMessage && state.dataGlobal->DisplayUnusedObjects) { @@ -4886,7 +4864,7 @@ namespace FluidProperties { int NumUnusedGlycol = 0; - for (auto const *glycol : df->glycols) { + for (auto const *glycol : state.dataFluidProps->glycols) { if (glycol->used) continue; if (glycol->Name == "WATER") continue; if (glycol->Name == "ETHYLENEGLYCOL") continue; @@ -4913,18 +4891,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..df323e14e3d 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -275,14 +275,13 @@ void GetStandAloneERV(EnergyPlusData &state) ShowContinueError(state, format("... occurs in {} \"{}\"", CurrentModuleObject, standAloneERV.Name)); ErrorsFound = true; } + standAloneERV.DesignHXVolFlowRate = HXSupAirFlowRate; standAloneERV.SupplyAirFanName = Alphas(4); 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 +296,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 +1693,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..9be6d26b584 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; @@ -3429,7 +3428,7 @@ namespace HVACUnitaryBypassVAV { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad = 0.0; // Total load in controlled zone [W] - int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day + int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); From a0f066f9a916f3acfceb72f9b089d0db674d3cab Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 08:26:45 -0400 Subject: [PATCH 2/3] Revert shortcut removal --- src/EnergyPlus/FluidProperties.cc | 48 +++++++++++++++++++------- src/EnergyPlus/HVACStandAloneERV.cc | 1 - src/EnergyPlus/HVACUnitaryBypassVAV.cc | 2 +- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index be30d53ed39..f111ac104f0 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -1936,7 +1936,9 @@ 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. - for (auto *glycol : state.dataFluidProps->glycols) { + auto const &df = state.dataFluidProps; + + for (auto *glycol : df->glycols) { if (glycol->CpDataPresent) { // check for lowest non-zero value by referencing temp data for (int IndexNum = 1; IndexNum <= glycol->NumCpTempPoints; ++IndexNum) { @@ -2038,7 +2040,9 @@ 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. - for (auto *refrig : state.dataFluidProps->refrigs) { + auto const &df = state.dataFluidProps; + + for (auto *refrig : df->refrigs) { for (int IndexNum = 1; IndexNum <= refrig->NumPsPoints; ++IndexNum) { if (refrig->PsValues(IndexNum) <= 0.0) continue; refrig->PsLowPresIndex = IndexNum; @@ -2178,7 +2182,9 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from glycol functions - for (auto *glycol : state.dataFluidProps->glycols) { + auto const &df = state.dataFluidProps; + + for (auto *glycol : df->glycols) { int GlycolIndex = 0; // used in routine calls -- value is returned when first 0 // Lay out the basic values: @@ -2418,7 +2424,9 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from refrigerant functions - for (auto *refrig : state.dataFluidProps->refrigs) { + auto const &df = state.dataFluidProps; + + for (auto *refrig : df->refrigs) { // Lay out the basic values: if (!refrig->Name.empty()) { print(state.files.debug, "Refrigerant={}", refrig->Name); @@ -2769,8 +2777,10 @@ 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 <= state.dataFluidProps->RefrigErrorLimitTest) { + if (this->errors[(int)RefrigError::SatTemp].count <= df->RefrigErrorLimitTest) { ShowSevereMessage( state, format("{}: Saturation temperature is out of range for refrigerant [{}] supplied data: **", routineName, this->Name)); ShowContinueError(state, @@ -2802,6 +2812,8 @@ namespace FluidProperties { { // Wrapper for RefrigProps::getSatPressure() + auto &df = state.dataFluidProps; + if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom)); @@ -2810,7 +2822,7 @@ namespace FluidProperties { } } - return state.dataFluidProps->refrigs(RefrigIndex)->getSatPressure(state, Temperature, CalledFrom); + return df->refrigs(RefrigIndex)->getSatPressure(state, Temperature, CalledFrom); } //***************************************************************************** @@ -2861,8 +2873,10 @@ 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 <= state.dataFluidProps->RefrigErrorLimitTest) { + if (this->errors[(int)RefrigError::SatPress].count <= df->RefrigErrorLimitTest) { ShowSevereMessage(state, format("{}: Saturation pressure is out of range for refrigerant [{}] supplied data: **", routineName, this->Name)); ShowContinueError(state, @@ -2893,6 +2907,8 @@ namespace FluidProperties { { // Wrapper for RefrigProps::getSatTemperature() + auto &df = state.dataFluidProps; + if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom)); @@ -2901,7 +2917,7 @@ namespace FluidProperties { } } - return state.dataFluidProps->refrigs(RefrigIndex)->getSatTemperature(state, Pressure, CalledFrom); + return df->refrigs(RefrigIndex)->getSatTemperature(state, Pressure, CalledFrom); } //***************************************************************************** @@ -2942,6 +2958,8 @@ namespace FluidProperties { { // Wrapper for RefrigProps::getSatEnthalpy() + auto &df = state.dataFluidProps; + if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom)); @@ -2949,7 +2967,7 @@ namespace FluidProperties { return 0.0; } } - return state.dataFluidProps->refrigs(RefrigIndex)->getSatEnthalpy(state, Temperature, Quality, CalledFrom); + return df->refrigs(RefrigIndex)->getSatEnthalpy(state, Temperature, Quality, CalledFrom); } //***************************************************************************** @@ -3029,8 +3047,10 @@ 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 <= state.dataFluidProps->RefrigErrorLimitTest) { + if (this->errors[(int)RefrigError::SatTempDensity].count <= df->RefrigErrorLimitTest) { ShowSevereMessage( state, format("{}: Saturation temperature is out of range for refrigerant [{}] supplied data: **", routineName, this->Name)); ShowContinueError(state, @@ -3062,6 +3082,8 @@ namespace FluidProperties { { // Wrapper for RefrigProps::getSatDensity() + auto &df = state.dataFluidProps; + if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom)); @@ -3070,7 +3092,7 @@ namespace FluidProperties { } } - return state.dataFluidProps->refrigs(RefrigIndex)->getSatDensity(state, Temperature, Quality, CalledFrom); + return df->refrigs(RefrigIndex)->getSatDensity(state, Temperature, Quality, CalledFrom); } //***************************************************************************** @@ -3121,6 +3143,8 @@ namespace FluidProperties { // Wrapper for RefrigProps::getSpecificHeat() + auto &df = state.dataFluidProps; + if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom)); @@ -3129,7 +3153,7 @@ namespace FluidProperties { } } - return state.dataFluidProps->refrigs(RefrigIndex)->getSatSpecificHeat(state, Temperature, Quality, CalledFrom); + return df->refrigs(RefrigIndex)->getSatSpecificHeat(state, Temperature, Quality, CalledFrom); } //***************************************************************************** diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index df323e14e3d..a606bccb8c8 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -275,7 +275,6 @@ void GetStandAloneERV(EnergyPlusData &state) ShowContinueError(state, format("... occurs in {} \"{}\"", CurrentModuleObject, standAloneERV.Name)); ErrorsFound = true; } - standAloneERV.DesignHXVolFlowRate = HXSupAirFlowRate; standAloneERV.SupplyAirFanName = Alphas(4); diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 9be6d26b584..29014cd42a6 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -3428,7 +3428,7 @@ namespace HVACUnitaryBypassVAV { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad = 0.0; // Total load in controlled zone [W] - int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day + int lastDayOfSim(0); // used during warmup to reset changeOverTimer since need to do same thing next warmup day auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); From 266dfa2096aebbe5ee5f8a7fd4c90fcebbebc50a Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 20 Aug 2024 09:08:47 -0400 Subject: [PATCH 3/3] More reverts --- src/EnergyPlus/FluidProperties.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index f111ac104f0..f42be6b6a47 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -2039,7 +2039,6 @@ 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 const &df = state.dataFluidProps; for (auto *refrig : df->refrigs) { @@ -2811,7 +2810,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatPressure() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { @@ -2906,7 +2904,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatTemperature() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { @@ -2957,7 +2954,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatEnthalpy() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { @@ -3081,7 +3077,6 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatDensity() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { @@ -3142,7 +3137,6 @@ namespace FluidProperties { { // Wrapper for RefrigProps::getSpecificHeat() - auto &df = state.dataFluidProps; if (RefrigIndex == 0) { @@ -4613,8 +4607,9 @@ namespace FluidProperties { GlycolRawProps *GetGlycolRaw(EnergyPlusData &state, std::string_view const glycolRawName) { + auto &df = state.dataFluidProps; int glycolRawNum = GetGlycolRawNum(state, glycolRawName); - return (glycolRawNum > 0) ? state.dataFluidProps->glycolsRaw(glycolRawNum) : nullptr; + return (glycolRawNum > 0) ? df->glycolsRaw(glycolRawNum) : nullptr; } //***************************************************************************** @@ -4640,8 +4635,9 @@ namespace FluidProperties { // Check to see if this glycol shows up in the glycol data // ArrayLength = SIZE(GlycolData) - if (Idx > 0 && Idx <= state.dataFluidProps->glycols.isize()) { - return state.dataFluidProps->glycols(Idx)->Name; + auto &df = state.dataFluidProps; + if (Idx > 0 && Idx <= df->glycols.isize()) { + return df->glycols(Idx)->Name; } else { // return blank - error checking in calling proceedure return ""; } @@ -4871,7 +4867,9 @@ namespace FluidProperties { bool NeedOrphanMessage = true; int NumUnusedRefrig = 0; - for (auto const *refrig : state.dataFluidProps->refrigs) { + auto const &df = state.dataFluidProps; + + for (auto const *refrig : df->refrigs) { if (refrig->used) continue; if (refrig->Name == "STEAM") continue; if (NeedOrphanMessage && state.dataGlobal->DisplayUnusedObjects) { @@ -4888,7 +4886,7 @@ namespace FluidProperties { int NumUnusedGlycol = 0; - for (auto const *glycol : state.dataFluidProps->glycols) { + for (auto const *glycol : df->glycols) { if (glycol->used) continue; if (glycol->Name == "WATER") continue; if (glycol->Name == "ETHYLENEGLYCOL") continue;