diff --git a/doc/engineering-reference/src/on-site-generation/electric-load-center-distribution-manager.tex b/doc/engineering-reference/src/on-site-generation/electric-load-center-distribution-manager.tex index 89563a13ba2..fa71c1239cd 100644 --- a/doc/engineering-reference/src/on-site-generation/electric-load-center-distribution-manager.tex +++ b/doc/engineering-reference/src/on-site-generation/electric-load-center-distribution-manager.tex @@ -516,13 +516,13 @@ \subsubsection{Capacity degradation} During the second half of the battery life cycle degradation is dominated by the charge discharge cycles. The battery capacity during this period is expressed as shown below. \begin{equation} Q_{max}^{neg}=\sqrt{(c_0^2-2c_2 c_0 N)} -\label{Equation: b2_computation} +\label{Equation: qmax_computation_a} \end{equation} As in the case with the calendar life degradation, the parameters $c_0$ and $c_2$ were determined experimentally. The description of the model parameters, and constants can be found in (Smith, 2017), and the corresponding values can be found in (Mishra, 2020). -\subsubsection{References}\label{references-022} +\subsubsection{References}\label{references-022-b} N. DiOrio et al. Technoeconomic modeling of battery energy storage in SAM. Tech. rep. National Renewable Energy Lab. (NREL), Golden, CO (United States), 2015. diff --git a/src/EnergyPlus/DataGenerators.hh b/src/EnergyPlus/DataGenerators.hh index 7c5e51673f3..304e800979c 100644 --- a/src/EnergyPlus/DataGenerators.hh +++ b/src/EnergyPlus/DataGenerators.hh @@ -320,6 +320,12 @@ struct GeneratorsData : BaseGlobalStruct { Array1D FuelSupply; // fuel supply (reused across various) Array1D GeneratorDynamics; + int InletCWnode = 0; // cooling water inlet node ID + bool InternalFlowControl = false; + Real64 TcwIn = 0.0; // inlet cooling water temperature (C) + Real64 TrialMdotcw = 0.0; // test or estimate of what the plant flows are going to be (kg/s) + Real64 LimitMinMdotcw = 0.0; // lower limit for cooling water flow for generatior operation (kg/s) + void clear_state() override { NumFuelConstit = 0; @@ -328,6 +334,11 @@ struct GeneratorsData : BaseGlobalStruct { GasPhaseThermoChemistryData.deallocate(); FuelSupply.deallocate(); GeneratorDynamics.deallocate(); + this->InletCWnode = 0; + this->InternalFlowControl = false; + this->TcwIn = 0.0; + this->TrialMdotcw = 0.0; + this->LimitMinMdotcw = 0.0; } }; diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index 779501641b3..da7c3b006fb 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -1622,7 +1622,7 @@ namespace EnergyPlus::General { int JulianDay; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Array1D_int EndDayofMonth(12, {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}); + static Array1D_int const EndDayofMonth(12, {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}); // End day numbers of each month (without Leap Year) if (Month == 1) { @@ -2163,7 +2163,7 @@ namespace EnergyPlus::General { // string but in this case the output string is a fixed size so this is more // clear for formatting and faster. If formatted string changes, make sure to // add more to buffer. - static char buffer[11]; + char buffer[11]; int cx = snprintf(buffer, 11, "%02d:%02d:%04.1f", Hours, Minutes, Seconds); // Make sure output string is only between 0 and 10 characters so string is @@ -2267,16 +2267,16 @@ namespace EnergyPlus::General { int NumNames; int NumNumbers; int IOStat; - static std::string DXFOption1; - static std::string DXFOption2; - static std::string DXFWFOption1; - static std::string DXFWFOption2; - static std::string VRMLOption1; - static std::string VRMLOption2; - static std::string ViewRptOption1; - static std::string LineRptOption1; - static std::string VarDictOption1; - static std::string VarDictOption2; + auto & DXFOption1 = state.dataGeneral->DXFOption1; + auto & DXFOption2 = state.dataGeneral->DXFOption2; + auto & DXFWFOption1 = state.dataGeneral->DXFWFOption1; + auto & DXFWFOption2 = state.dataGeneral->DXFWFOption2; + auto & VRMLOption1 = state.dataGeneral->VRMLOption1; + auto & VRMLOption2 = state.dataGeneral->VRMLOption2; + auto & ViewRptOption1 = state.dataGeneral->ViewRptOption1; + auto & LineRptOption1 = state.dataGeneral->LineRptOption1; + auto & VarDictOption1 = state.dataGeneral->VarDictOption1; + auto & VarDictOption2 = state.dataGeneral->VarDictOption2; auto & cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; if (state.dataGeneral->GetReportInput) { diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index 783a6f44d60..f91e3eede39 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -372,6 +372,17 @@ struct GeneralData : BaseGlobalStruct { bool LineRpt = false; bool VarDict = false; bool EMSoutput = false; + Real64 XNext = 0.0; // used in root finder + std::string DXFOption1; + std::string DXFOption2; + std::string DXFWFOption1; + std::string DXFWFOption2; + std::string VRMLOption1; + std::string VRMLOption2; + std::string ViewRptOption1; + std::string LineRptOption1; + std::string VarDictOption1; + std::string VarDictOption2; void clear_state() override { @@ -389,6 +400,17 @@ struct GeneralData : BaseGlobalStruct { this->LineRpt = false; this->VarDict = false; this->EMSoutput = false; + this->XNext = 0.0; + this->DXFOption1.clear(); + this->DXFOption2.clear(); + this->DXFWFOption1.clear(); + this->DXFWFOption2.clear(); + this->VRMLOption1.clear(); + this->VRMLOption2.clear(); + this->ViewRptOption1.clear(); + this->LineRptOption1.clear(); + this->VarDictOption1.clear(); + this->VarDictOption2.clear(); } }; diff --git a/src/EnergyPlus/GeneralRoutines.cc b/src/EnergyPlus/GeneralRoutines.cc index 61c01fc877c..fdf95604fdf 100644 --- a/src/EnergyPlus/GeneralRoutines.cc +++ b/src/EnergyPlus/GeneralRoutines.cc @@ -189,7 +189,7 @@ void ControlCompOutput(EnergyPlusData &state, std::string const &CompName, // Interval Half Type used for Controller // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static int Iter(0); // Iteration limit for the interval halving process + int Iter(0); // Iteration limit for the interval halving process Real64 CpAir; // specific heat of air (J/kg-C) bool Converged; Real64 Denom; // the denominator of the control signal @@ -198,70 +198,12 @@ void ControlCompOutput(EnergyPlusData &state, std::string const &CompName, // INTEGER, SAVE :: ErrCount1=0 ! for recurring error bool WaterCoilAirFlowControl; // True if controlling air flow through water coil, water flow fixed int SimCompNum; // internal number for case statement - static Real64 HalvingPrec(0.0); // precision of halving algorithm + Real64 HalvingPrec(0.0); // precision of halving algorithm bool BBConvergeCheckFlag; // additional check on convergence specifically for radiant/convective baseboard units - struct IntervalHalf - { - // Members - Real64 MaxFlow; - Real64 MinFlow; - Real64 MaxResult; - Real64 MinResult; - Real64 MidFlow; - Real64 MidResult; - bool MaxFlowCalc; - bool MinFlowCalc; - bool MinFlowResult; - bool NormFlowCalc; - - // Default Constructor - IntervalHalf() = default; - - // Member Constructor - IntervalHalf(Real64 const MaxFlow, - Real64 const MinFlow, - Real64 const MaxResult, - Real64 const MinResult, - Real64 const MidFlow, - Real64 const MidResult, - bool const MaxFlowCalc, - bool const MinFlowCalc, - bool const MinFlowResult, - bool const NormFlowCalc) - : MaxFlow(MaxFlow), MinFlow(MinFlow), MaxResult(MaxResult), MinResult(MinResult), MidFlow(MidFlow), MidResult(MidResult), - MaxFlowCalc(MaxFlowCalc), MinFlowCalc(MinFlowCalc), MinFlowResult(MinFlowResult), NormFlowCalc(NormFlowCalc) - { - } - }; - - struct ZoneEquipControllerProps - { - // Members - Real64 SetPoint; // Desired setpoint; - Real64 MaxSetPoint; // The maximum setpoint; either user input or reset per time step by simulation - Real64 MinSetPoint; // The minimum setpoint; either user input or reset per time step by simulation - Real64 SensedValue; // The sensed control variable of any type - Real64 CalculatedSetPoint; // The Calculated SetPoint or new control actuated value - - // Default Constructor - ZoneEquipControllerProps() = default; - - // Member Constructor - ZoneEquipControllerProps(Real64 const SetPoint, // Desired setpoint; - Real64 const MaxSetPoint, // The maximum setpoint; either user input or reset per time step by simulation - Real64 const MinSetPoint, // The minimum setpoint; either user input or reset per time step by simulation - Real64 const SensedValue, // The sensed control variable of any type - Real64 const CalculatedSetPoint // The Calculated SetPoint or new control actuated value - ) - : SetPoint(SetPoint), MaxSetPoint(MaxSetPoint), MinSetPoint(MinSetPoint), SensedValue(SensedValue), CalculatedSetPoint(CalculatedSetPoint) - { - } - }; - // Object Data - static IntervalHalf ZoneInterHalf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false); - static ZoneEquipControllerProps ZoneController(0.0, 0.0, 0.0, 0.0, 0.0); + auto & ZoneInterHalf = state.dataGeneralRoutines->ZoneInterHalf; + auto & ZoneController = state.dataGeneralRoutines->ZoneController; if (ControlCompTypeNum != 0) { SimCompNum = ControlCompTypeNum; diff --git a/src/EnergyPlus/GeneralRoutines.hh b/src/EnergyPlus/GeneralRoutines.hh index 9abc3ba2673..c98ffd815cc 100644 --- a/src/EnergyPlus/GeneralRoutines.hh +++ b/src/EnergyPlus/GeneralRoutines.hh @@ -62,6 +62,64 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; + struct IntervalHalf + { + // Members + Real64 MaxFlow; + Real64 MinFlow; + Real64 MaxResult; + Real64 MinResult; + Real64 MidFlow; + Real64 MidResult; + bool MaxFlowCalc; + bool MinFlowCalc; + bool MinFlowResult; + bool NormFlowCalc; + + // Default Constructor + IntervalHalf() = default; + + // Member Constructor + IntervalHalf(Real64 const MaxFlow, + Real64 const MinFlow, + Real64 const MaxResult, + Real64 const MinResult, + Real64 const MidFlow, + Real64 const MidResult, + bool const MaxFlowCalc, + bool const MinFlowCalc, + bool const MinFlowResult, + bool const NormFlowCalc) + : MaxFlow(MaxFlow), MinFlow(MinFlow), MaxResult(MaxResult), MinResult(MinResult), MidFlow(MidFlow), MidResult(MidResult), + MaxFlowCalc(MaxFlowCalc), MinFlowCalc(MinFlowCalc), MinFlowResult(MinFlowResult), NormFlowCalc(NormFlowCalc) + { + } + }; + + struct ZoneEquipControllerProps + { + // Members + Real64 SetPoint; // Desired setpoint; + Real64 MaxSetPoint; // The maximum setpoint; either user input or reset per time step by simulation + Real64 MinSetPoint; // The minimum setpoint; either user input or reset per time step by simulation + Real64 SensedValue; // The sensed control variable of any type + Real64 CalculatedSetPoint; // The Calculated SetPoint or new control actuated value + + // Default Constructor + ZoneEquipControllerProps() = default; + + // Member Constructor + ZoneEquipControllerProps(Real64 const SetPoint, // Desired setpoint; + Real64 const MaxSetPoint, // The maximum setpoint; either user input or reset per time step by simulation + Real64 const MinSetPoint, // The minimum setpoint; either user input or reset per time step by simulation + Real64 const SensedValue, // The sensed control variable of any type + Real64 const CalculatedSetPoint // The Calculated SetPoint or new control actuated value + ) + : SetPoint(SetPoint), MaxSetPoint(MaxSetPoint), MinSetPoint(MinSetPoint), SensedValue(SensedValue), CalculatedSetPoint(CalculatedSetPoint) + { + } + }; + void ControlCompOutput(EnergyPlusData &state, std::string const &CompName, // the component Name std::string const &CompType, // Type of component @@ -193,6 +251,8 @@ void CalcZoneSensibleOutput(Real64 const MassFlow, // air mass flow rate, {kg/s} struct GeneralRoutinesData : BaseGlobalStruct { bool MyICSEnvrnFlag = true; + IntervalHalf ZoneInterHalf = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false}; + ZoneEquipControllerProps ZoneController = {0.0, 0.0, 0.0, 0.0, 0.0}; void clear_state() override { diff --git a/src/EnergyPlus/GeneratorDynamicsManager.cc b/src/EnergyPlus/GeneratorDynamicsManager.cc index 593da289971..4a477bf2f14 100644 --- a/src/EnergyPlus/GeneratorDynamicsManager.cc +++ b/src/EnergyPlus/GeneratorDynamicsManager.cc @@ -243,7 +243,6 @@ namespace GeneratorDynamicsManager { Real64 Pel; DataGenerators::OperatingMode newOpMode(DataGenerators::OperatingMode::Unassigned); Real64 SchedVal; - // REAL(r64) :: PelDiff Real64 ElectLoadForThermalRequest; bool ConstrainedMaxP; // true if request was altered because of max power limit bool ConstrainedMinP; // true if request was altered because of min power limit @@ -252,12 +251,11 @@ namespace GeneratorDynamicsManager { bool ConstrainedByPlant; // true if request was altered because of cooling water problem bool PLRStartUp; // true if subtimestep issue involving startup bool PLRShutDown; - // INTEGER :: OutletCWnode = 0 ! cooling water outlet node ID - static int InletCWnode(0); // cooling water inlet node ID - static bool InternalFlowControl(false); - static Real64 TcwIn(0.0); // inlet cooling water temperature (C) - static Real64 TrialMdotcw(0.0); // test or estimate of what the plant flows are going to be (kg/s) - static Real64 LimitMinMdotcw(0.0); // lower limit for cooling water flow for generatior operation (kg/s) + auto & InletCWnode = state.dataGenerator->InletCWnode; + auto & InternalFlowControl = state.dataGenerator->InternalFlowControl; + auto & TcwIn = state.dataGenerator->TcwIn; + auto & TrialMdotcw = state.dataGenerator->TrialMdotcw; + auto & LimitMinMdotcw = state.dataGenerator->LimitMinMdotcw; // inits PLRforSubtimestepStartUp = 1.0; diff --git a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc index 477d6f2fc47..9cea1d0943b 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc @@ -1131,19 +1131,19 @@ void FiniteDiffGroundTempsModel::evaluateSoilRhoCp(Optional cell, Opt // Evaluates the soil properties // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Real64 Theta_ice; - static Real64 Theta_liq; - static Real64 Theta_sat; - static Real64 rho_ice; - static Real64 rho_liq; - static Real64 rhoCp_soil_liq_1; - static Real64 CP_liq; - static Real64 CP_ice; - static Real64 Lat_fus; - static Real64 Cp_transient; - static Real64 rhoCP_soil_liq; - static Real64 rhoCP_soil_transient; - static Real64 rhoCP_soil_ice; + Real64 Theta_ice; + Real64 Theta_liq; + Real64 Theta_sat; + Real64 rho_ice; + Real64 rho_liq; + Real64 rhoCp_soil_liq_1; + Real64 CP_liq; + Real64 CP_ice; + Real64 Lat_fus; + Real64 Cp_transient; + Real64 rhoCP_soil_liq; + Real64 rhoCP_soil_transient; + Real64 rhoCP_soil_ice; // other variables Real64 frzAllIce; Real64 frzIceTrans; diff --git a/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc b/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc index b2b6b52a57a..27445f62b9a 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc @@ -137,7 +137,7 @@ Real64 XingGroundTempsModel::getGroundTemp(EnergyPlusData &state) // USE STATEMENTS: // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int n; - Real64 static tp(state.dataWeatherManager->NumDaysInYear); // Period of soil temperature cycle + Real64 tp = state.dataWeatherManager->NumDaysInYear; // Period of soil temperature cycle Real64 Ts_1; // Amplitude of surface temperature Real64 Ts_2; // Amplitude of surface temperature Real64 PL_1; // Phase shift of surface temperature diff --git a/src/EnergyPlus/HVACSingleDuctInduc.cc b/src/EnergyPlus/HVACSingleDuctInduc.cc index ffe39f0a916..12b1d024c83 100644 --- a/src/EnergyPlus/HVACSingleDuctInduc.cc +++ b/src/EnergyPlus/HVACSingleDuctInduc.cc @@ -134,11 +134,11 @@ namespace HVACSingleDuctInduc { // These are purposefully not in the header file as an extern variable. No one outside of this should // use these. They are cleared by clear_state() for use by unit tests, but normal simulations should be unaffected. // This is purposefully in an anonymous namespace so nothing outside this implementation file can use it. - static bool MyOneTimeFlag(true); - static Array1D_bool MyEnvrnFlag; - static Array1D_bool MySizeFlag; - static Array1D_bool MyPlantScanFlag; - static Array1D_bool MyAirDistInitFlag; + bool MyOneTimeFlag(true); + Array1D_bool MyEnvrnFlag; + Array1D_bool MySizeFlag; + Array1D_bool MyPlantScanFlag; + Array1D_bool MyAirDistInitFlag; } // namespace // SUBROUTINE SPECIFICATIONS FOR MODULE HVACSingleDuctInduc: diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 0b1d63a0bac..9d510f74951 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -7144,7 +7144,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { static std::string const RoutineName("SizeVRF: "); // include trailing blank space - static Array1D_bool CheckVRFCombinationRatio; + 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 @@ -7153,7 +7153,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { int TUListNum; // index to terminal unit list int TUIndex; // index to terminal unit int NumTU; // DO Loop index counter - static bool MyOneTimeEIOFlag(true); // eio header flag reporting + auto & MyOneTimeEIOFlag = state.dataHVACVarRefFlow->MyOneTimeEIOFlag; // eio header flag reporting Real64 OnOffAirFlowRat; // temporary variable used when sizing coils Real64 DXCoilCap; // capacity of DX cooling coil (W) bool IsAutoSize; // Indicator to autosize @@ -8773,7 +8773,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { Real64 SpecHumIn(0.0); // specific humidity ratio at inlet node int TUListIndex; // index to TU list for this VRF system int IndexToTUInTUList; // index to TU in specific list for the VRF system - static int ATMixOutNode(0); // terminal unit mixer outlet node + auto & ATMixOutNode = state.dataHVACVarRefFlow->ATMixOutNode; int ZoneNode; // Zone node of VRFTU is serving VRFCond = this->VRFSysNum; @@ -11947,7 +11947,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { int IndexToTUInTUList; // index to TU in specific list for the VRF system Real64 EvapTemp; // evaporating temperature Real64 CondTemp; // condensing temperature - static int ATMixOutNode(0); // outlet node of ATM Mixer + auto & ATMixOutNode2 = state.dataHVACVarRefFlow->ATMixOutNode2; // outlet node of ATM Mixer int ZoneNode; // Zone node of VRFTU is serving @@ -11975,7 +11975,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { if (this->ATMixerExists) { // There is an air terminal mixer - ATMixOutNode = this->ATMixerOutNode; + ATMixOutNode2 = this->ATMixerOutNode; if (this->ATMixerType == DataHVACGlobals::ATMixer_InletSide) { // if there is an inlet side air terminal mixer // set the primary air inlet mass flow rate state.dataLoopNodes->Node(this->ATMixerPriNode).MassFlowRate = @@ -11985,7 +11985,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { SimATMixer(state, this->ATMixerName, FirstHVACIteration, this->ATMixerIndex); } } else { - ATMixOutNode = 0; + ATMixOutNode2 = 0; // simulate OA Mixer if (this->OAMixerUsed) SimOAMixer(state, this->OAMixerName, FirstHVACIteration, this->OAMixerIndex); } @@ -12093,9 +12093,9 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { if (this->ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { // Air terminal supply side mixer, calculate supply side mixer output SimATMixer(state, this->ATMixerName, FirstHVACIteration, this->ATMixerIndex); - TempOut = state.dataLoopNodes->Node(ATMixOutNode).Temp; - SpecHumOut = state.dataLoopNodes->Node(ATMixOutNode).HumRat; - AirMassFlow = state.dataLoopNodes->Node(ATMixOutNode).MassFlowRate; + TempOut = state.dataLoopNodes->Node(ATMixOutNode2).Temp; + SpecHumOut = state.dataLoopNodes->Node(ATMixOutNode2).HumRat; + AirMassFlow = state.dataLoopNodes->Node(ATMixOutNode2).MassFlowRate; } else { // Air terminal inlet side mixer TempOut = state.dataLoopNodes->Node(VRFTUOutletNodeNum).Temp; diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index 9e44d7d3a86..44da255cdc0 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -1008,6 +1008,10 @@ struct HVACVarRefFlowData : BaseGlobalStruct { Array1D MinDeltaT; // minimum zone temperature difference from setpoint Array1D SumCoolingLoads; // sum of cooling loads Array1D SumHeatingLoads; // sum of heating loads + Array1D_bool CheckVRFCombinationRatio; + bool MyOneTimeEIOFlag = true; // eio header flag reporting + int ATMixOutNode = 0; // terminal unit mixer outlet node + int ATMixOutNode2 = 0; // terminal unit mixer outlet node // Object Data Array1D VRF; // AirConditioner:VariableRefrigerantFlow object @@ -1065,6 +1069,10 @@ struct HVACVarRefFlowData : BaseGlobalStruct { this->VRFTU.deallocate(); this->TerminalUnitList.deallocate(); this->VRFTUNumericFields.deallocate(); + this->CheckVRFCombinationRatio.clear(); + this->MyOneTimeEIOFlag = true; + this->ATMixOutNode = 0; + this->ATMixOutNode2 = 0; } }; diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.cc b/src/EnergyPlus/HybridUnitaryAirConditioners.cc index 188b795423b..40ee2e8f104 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.cc +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.cc @@ -187,11 +187,10 @@ namespace EnergyPlus::HybridUnitaryAirConditioners { // Locals int Loop; - static Array1D_bool MySizeFlag; - - static Array1D_bool MyEnvrnFlag; - static Array1D_bool MyFanFlag; - static Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + auto & MySizeFlag = state.dataHybridUnitaryAC->MySizeFlag; + auto & MyEnvrnFlag = state.dataHybridUnitaryAC->MyEnvrnFlag; + auto & MyFanFlag = state.dataHybridUnitaryAC->MyFanFlag; + auto & MyZoneEqFlag = state.dataHybridUnitaryAC->MyZoneEqFlag; // used to set up zone equipment availability managers int InletNode; diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.hh b/src/EnergyPlus/HybridUnitaryAirConditioners.hh index 0b3889da1ed..9076ca83db5 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.hh +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.hh @@ -108,6 +108,10 @@ struct HybridUnitaryAirConditionersData : BaseGlobalStruct { bool HybridCoolOneTimeFlag = true; Array1D_bool CheckZoneHybridEvapName; Array1D ZoneHybridUnitaryAirConditioner; + Array1D_bool MySizeFlag; + Array1D_bool MyEnvrnFlag; + Array1D_bool MyFanFlag; + Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers void clear_state() override { @@ -117,6 +121,10 @@ struct HybridUnitaryAirConditionersData : BaseGlobalStruct { this->HybridCoolOneTimeFlag = true; this->CheckZoneHybridEvapName.deallocate(); this->ZoneHybridUnitaryAirConditioner.deallocate(); + this->MySizeFlag.clear(); + this->MyEnvrnFlag.clear(); + this->MyFanFlag.clear(); + this->MyZoneEqFlag.clear(); } }; diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index afb7244f55a..dabbcf2b301 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -290,9 +290,9 @@ namespace OutdoorAirUnit { int InListNum; int ListNum; bool ErrorsFound(false); - static int MaxNums(0); // Maximum number of numeric input fields - static int MaxAlphas(0); // Maximum number of alpha input fields - static int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a + int MaxNums(0); // Maximum number of numeric input fields + int MaxAlphas(0); // Maximum number of alpha input fields + int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a bool IsValid; // Set for outside air node check Array1D_string cAlphaArgs; // Alpha input items for object std::string CurrentModuleObject; // Object type for getting and messages @@ -302,7 +302,7 @@ namespace OutdoorAirUnit { Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. Array1D NumArray; Array1D_string AlphArray; - static bool errFlag(false); + bool errFlag(false); // Figure out how many outdoor air units there are in the input file @@ -1059,28 +1059,15 @@ namespace OutdoorAirUnit { using SteamCoils::GetCoilMaxSteamFlowRate; using WaterCoils::SimulateWaterCoilComponents; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static std::string const CurrentModuleObject("ZoneHVAC:OutdoorAirUnit"); static std::string const RoutineName("SizeOutdoorAirUnit"); - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Loop; - //////////// hoisted into namespace //////////////////////////////////////////////// - // static bool MyOneTimeFlag( true ); - // static bool ZoneEquipmentListChecked( false ); // True after the Zone Equipment List has been checked for items - //////////////////////////////////////////////////////////////////////////////////// - static Array1D_bool MyEnvrnFlag; - static Array1D_bool MyPlantScanFlag; - static Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + auto & MyEnvrnFlag = state.dataOutdoorAirUnit->MyEnvrnFlag; + auto & MyPlantScanFlag = state.dataOutdoorAirUnit->MyPlantScanFlag; + auto & MyZoneEqFlag = state.dataOutdoorAirUnit->MyZoneEqFlag; // used to set up zone equipment availability managers int InNode; // inlet node number in outdoor air unit int OutNode; // outlet node number in outdoor air unit int OutsideAirNode; // outside air node number outdoor air unit @@ -1091,7 +1078,6 @@ namespace OutdoorAirUnit { Real64 rho; bool errFlag; - // Do the one time initializations auto & OutAirUnit(state.dataOutdoorAirUnit->OutAirUnit); @@ -2090,13 +2076,13 @@ namespace OutdoorAirUnit { int WHCoilInletNode; int WHCoilOutletNode; Real64 QUnitOut; - static int DXSystemIndex(0); + int DXSystemIndex(0); Real64 CompAirOutTemp; Real64 FanEffect; bool DrawFan; // fan position If .True., the temperature increasing by fan operating is considered Real64 Dxsystemouttemp; - static bool HeatActive(false); - static bool CoolActive(false); + auto & HeatActive = state.dataOutdoorAirUnit->HeatActive; + auto & CoolActive = state.dataOutdoorAirUnit->CoolActive; auto & OutAirUnit(state.dataOutdoorAirUnit->OutAirUnit); diff --git a/src/EnergyPlus/OutdoorAirUnit.hh b/src/EnergyPlus/OutdoorAirUnit.hh index 010a3a8cd31..644d7ab5066 100644 --- a/src/EnergyPlus/OutdoorAirUnit.hh +++ b/src/EnergyPlus/OutdoorAirUnit.hh @@ -305,6 +305,11 @@ struct EnergyPlusData; std::unordered_set SupplyFanUniqueNames; std::unordered_set ExhaustFanUniqueNames; std::unordered_set ComponentListUniqueNames; + Array1D_bool MyEnvrnFlag; + Array1D_bool MyPlantScanFlag; + Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + bool HeatActive = false; + bool CoolActive = false; void clear_state() override { @@ -320,6 +325,11 @@ struct EnergyPlusData; ComponentListUniqueNames.clear(); MyOneTimeFlag = true; ZoneEquipmentListChecked = false; + this->MyEnvrnFlag.clear(); + this->MyPlantScanFlag.clear(); + this->MyZoneEqFlag.clear(); + this->HeatActive = false; + this->CoolActive = false; } }; diff --git a/src/EnergyPlus/PackagedTerminalHeatPump.cc b/src/EnergyPlus/PackagedTerminalHeatPump.cc index f8f838c584d..d67f7a3c797 100644 --- a/src/EnergyPlus/PackagedTerminalHeatPump.cc +++ b/src/EnergyPlus/PackagedTerminalHeatPump.cc @@ -515,7 +515,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine bool IsNotOK; // Flag to verify name std::string CurrentModuleObject; // Object type for getting and error messages - static bool errFlag(false); // Error flag returned during CALL to mining functions + bool errFlag(false); // Error flag returned during CALL to mining functions Real64 FanVolFlow; // maximum supply air volumetric flow rate of fan int TempNodeNum; // dummy variable to set up HW coil water inlet node int SteamIndex; // dummy variable to set up steam coil steam inlet density @@ -3668,11 +3668,11 @@ namespace EnergyPlus::PackagedTerminalHeatPump { Real64 PartLoadFrac; // compressor part load fraction Real64 CoilMaxVolFlowRate; // water or steam max volumetric water flow rate int Loop; - static Array1D_bool MyEnvrnFlag; // used for initializations each begin environment flag - static Array1D_bool MySizeFlag; // used for sizing PTHP inputs one time - static Array1D_bool MyFanFlag; // used for sizing PTHP fan inputs one time - static Array1D_bool MyPlantScanFlag; - static Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + auto & MyEnvrnFlag = state.dataPTHP->MyEnvrnFlag; + auto & MySizeFlag = state.dataPTHP->MySizeFlag; + auto & MyFanFlag = state.dataPTHP->MyFanFlag; + auto & MyPlantScanFlag = state.dataPTHP->MyPlantScanFlag; + auto & MyZoneEqFlag = state.dataPTHP->MyZoneEqFlag; Real64 QActual; // actual PTAC steam heating coil load met (W) bool ErrorsFound; // flag returned from mining call Real64 QToCoolSetPt; @@ -5412,9 +5412,6 @@ namespace EnergyPlus::PackagedTerminalHeatPump { // METHODOLOGY EMPLOYED: // Use RegulaFalsi technique to iterate on part-load ratio until convergence is achieved. - // REFERENCES: - // na - // Using/Aliasing using General::SolveRoot; @@ -5425,7 +5422,6 @@ namespace EnergyPlus::PackagedTerminalHeatPump { using TempSolveRoot::SolveRoot; using WaterCoils::SimulateWaterCoilComponents; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: Real64 mdot; // coil fluid mass flow rate (kg/s) @@ -5433,19 +5429,13 @@ namespace EnergyPlus::PackagedTerminalHeatPump { int const MaxIte(500); // maximum number of iterations Real64 const MinPLF(0.0); // minimum part load factor allowed - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: 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] Real64 ErrorToler; // error tolerance int SolFla; // Flag of RegulaFalsi solver - static Array1D Par(8); // Parameters passed to RegulaFalsi + auto & ControlPTUnitOutputPar = state.dataPTHP->ControlPTUnitOutputPar; Real64 CpAir; // air specific heat Real64 OutsideDryBulbTemp; // Outside air temperature at external node height // unused1208 REAL(r64) :: UpperLimitPLR ! used when RegulaFalsi exceeds iteration limit @@ -5488,7 +5478,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { int AirLoopNum = 0; int CompressorOnFlag = 0; auto &SZVAVModel(state.dataPTHP->PTUnit(PTUnitNum)); - // seems like passing these (arguments 2-n) as an array (similar to Par) would make this more uniform across different models + // seems like passing these (arguments 2-n) as an array (similar to ControlPTUnitOutputPar) would make this more uniform across different models SZVAVModel::calcSZVAVModel(state, SZVAVModel, PTUnitNum, @@ -5544,23 +5534,23 @@ namespace EnergyPlus::PackagedTerminalHeatPump { if ((state.dataPTHP->HeatingLoad && QZnReq < FullOutput) || (state.dataPTHP->CoolingLoad && QZnReq > FullOutput)) { - Par(1) = PTUnitNum; - Par(2) = ZoneNum; + ControlPTUnitOutputPar(1) = PTUnitNum; + ControlPTUnitOutputPar(2) = ZoneNum; if (FirstHVACIteration) { - Par(3) = 1.0; + ControlPTUnitOutputPar(3) = 1.0; } else { - Par(3) = 0.0; + ControlPTUnitOutputPar(3) = 0.0; } - Par(4) = OpMode; - Par(5) = QZnReq; - Par(6) = OnOffAirFlowRatio; - Par(7) = SupHeaterLoad; + ControlPTUnitOutputPar(4) = OpMode; + ControlPTUnitOutputPar(5) = QZnReq; + ControlPTUnitOutputPar(6) = OnOffAirFlowRatio; + ControlPTUnitOutputPar(7) = SupHeaterLoad; if (HXUnitOn) { - Par(8) = 1.0; + ControlPTUnitOutputPar(8) = 1.0; } else { - Par(8) = 0.0; + ControlPTUnitOutputPar(8) = 0.0; } - SolveRoot(state, ErrorToler, MaxIte, SolFla, PartLoadFrac, PLRResidual, 0.0, 1.0, Par); + SolveRoot(state, ErrorToler, MaxIte, SolFla, PartLoadFrac, PLRResidual, 0.0, 1.0, ControlPTUnitOutputPar); if (SolFla == -1) { // Very low loads may not converge quickly. Tighten PLR boundary and try again. TempMaxPLR = -0.1; @@ -5579,7 +5569,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { if (state.dataPTHP->HeatingLoad && TempOutput < QZnReq) ContinueIter = false; if (state.dataPTHP->CoolingLoad && TempOutput > QZnReq) ContinueIter = false; } - SolveRoot(state, ErrorToler, MaxIte, SolFla, PartLoadFrac, PLRResidual, TempMinPLR, TempMaxPLR, Par); + SolveRoot(state, ErrorToler, MaxIte, SolFla, PartLoadFrac, PLRResidual, TempMinPLR, TempMaxPLR, ControlPTUnitOutputPar); if (SolFla == -1) { if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag) { CalcPTUnit( @@ -5758,9 +5748,9 @@ namespace EnergyPlus::PackagedTerminalHeatPump { Real64 mdot; // local temporary for mass flow rate Real64 MaxHotWaterFlow; // coil maximum hot water mass flow rate, kg/s Real64 HotWaterMdot; // actual hot water mass flow rate - static Array1D Par(3); + auto & CalcPTUnitPar = state.dataPTHP->CalcPTUnitPar; int SolFlag; - static int ATMixOutNode(0); // outlet node of ATM Mixer + int ATMixOutNode(0); // outlet node of ATM Mixer // Tuned Named constants to avoid heap allocation when passed to Optional args bool const True(true); @@ -5770,8 +5760,6 @@ namespace EnergyPlus::PackagedTerminalHeatPump { Real64 const dZero(0.0); Real64 const dOne(1.0); - - OutletNode = state.dataPTHP->PTUnit(PTUnitNum).AirOutNode; InletNode = state.dataPTHP->PTUnit(PTUnitNum).AirInNode; ControlledZoneNum = state.dataPTHP->PTUnit(PTUnitNum).ControlZoneNum; @@ -6161,16 +6149,16 @@ namespace EnergyPlus::PackagedTerminalHeatPump { // control water flow to obtain output matching SupHeaterLoad SolFlag = 0; MinWaterFlow = 0.0; - Par(1) = double(PTUnitNum); + CalcPTUnitPar(1) = double(PTUnitNum); if (FirstHVACIteration) { - Par(2) = 1.0; + CalcPTUnitPar(2) = 1.0; } else { - Par(2) = 0.0; + CalcPTUnitPar(2) = 0.0; } - Par(3) = SupHeaterLoad; + CalcPTUnitPar(3) = SupHeaterLoad; MaxHotWaterFlow = state.dataPTHP->PTUnit(PTUnitNum).MaxSuppCoilFluidFlow; SolveRoot( - state, ErrTolerance, SolveMaxIter, SolFlag, HotWaterMdot, HotWaterCoilResidual, MinWaterFlow, MaxHotWaterFlow, Par); + state, ErrTolerance, SolveMaxIter, SolFlag, HotWaterMdot, HotWaterCoilResidual, MinWaterFlow, MaxHotWaterFlow, CalcPTUnitPar); if (SolFlag == -1) { if (state.dataPTHP->PTUnit(PTUnitNum).HotWaterCoilMaxIterIndex == 0) { ShowWarningMessage(state, "CalcPTUnit: Hot water coil control failed for " + state.dataPTHP->PTUnit(PTUnitNum).UnitType + "=\"" + @@ -7085,38 +7073,25 @@ namespace EnergyPlus::PackagedTerminalHeatPump { // METHODOLOGY EMPLOYED: // Calls ControlMSHPOutput to obtain the desired unit output - // REFERENCES: - // na - // Using/Aliasing using namespace DataZoneEnergyDemands; // Locals Real64 SupHeaterLoad; // supplement heater load - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Real64 PartLoadFrac(0.0); // compressor part load fraction - static Real64 SpeedRatio(0.0); // compressor speed ratio + Real64 PartLoadFrac(0.0); // compressor part load fraction + Real64 SpeedRatio(0.0); // compressor speed ratio bool UnitOn; // TRUE if unit is on int OutletNode; // MSHP air outlet node int InletNode; // MSHP air inlet node Real64 AirMassFlow; // air mass flow rate [kg/s] Real64 QTotUnitOut; // capacity output - static int SpeedNum(1); // Speed number + int SpeedNum(1); // Speed number Real64 QSensUnitOut; // sensible capacity output Real64 QLatUnitOut; // latent capacity output int CompOp; // compressor operation; 1=on, 0=off - static Real64 TotalZoneLatentLoad; // Total ZONE heating load (not including outside air) + Real64 TotalZoneLatentLoad; // Total ZONE heating load (not including outside air) // zero the fan, DX coils, and supplemental electric heater electricity consumption @@ -7304,14 +7279,13 @@ namespace EnergyPlus::PackagedTerminalHeatPump { Real64 LatOutput; // latent capacity output Real64 ErrorToler; // error tolerance int SolFla; // Flag of RegulaFalsi solver - static Array1D Par(11); // Parameters passed to RegulaFalsi + auto & ControlVSHPOutputPar = state.dataPTHP->ControlVSHPOutputPar; // Parameters passed to RegulaFalsi Real64 CpAir; // air specific heat int i; // Speed index - static int ErrCountCyc(0); // Counter used to minimize the occurrence of output warnings - static int ErrCountVar(0); // Counter used to minimize the occurrence of output warnings + auto & ErrCountCyc = state.dataPTHP->ErrCountCyc; // Counter used to minimize the occurrence of output warnings + auto & ErrCountVar = state.dataPTHP->ErrCountVar; // Counter used to minimize the occurrence of output warnings Real64 mdot; // coil fluid mass flow rate (kg/s) - SupHeaterLoad = 0.0; PartLoadFrac = 0.0; SpeedRatio = 0.0; @@ -7432,23 +7406,23 @@ namespace EnergyPlus::PackagedTerminalHeatPump { if (((QZnReq > SmallLoad && QZnReq < FullOutput) || (QZnReq < (-1.0 * SmallLoad) && QZnReq > FullOutput) || (QLatReq < (-1.0 * SmallLoad))) && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { - Par(1) = PTUnitNum; - Par(2) = ZoneNum; + ControlVSHPOutputPar(1) = PTUnitNum; + ControlVSHPOutputPar(2) = ZoneNum; if (FirstHVACIteration) { - Par(3) = 1.0; + ControlVSHPOutputPar(3) = 1.0; } else { - Par(3) = 0.0; - } - Par(4) = OpMode; - Par(5) = QZnReq; - Par(6) = OnOffAirFlowRatio; - Par(7) = SupHeaterLoad; - Par(9) = CompOp; - Par(10) = 1.0; + ControlVSHPOutputPar(3) = 0.0; + } + ControlVSHPOutputPar(4) = OpMode; + ControlVSHPOutputPar(5) = QZnReq; + ControlVSHPOutputPar(6) = OnOffAirFlowRatio; + ControlVSHPOutputPar(7) = SupHeaterLoad; + ControlVSHPOutputPar(9) = CompOp; + ControlVSHPOutputPar(10) = 1.0; if (HXUnitOn) { - Par(11) = 1.0; + ControlVSHPOutputPar(11) = 1.0; } else { - Par(11) = 0.0; + ControlVSHPOutputPar(11) = 0.0; } // Check whether the low speed coil can meet the load or not CalcVarSpeedHeatPump(state, @@ -7473,11 +7447,11 @@ namespace EnergyPlus::PackagedTerminalHeatPump { SpeedNum = 1; if (QLatReq < 0.0) { // calculate latent heat residual - Par(10) = 0.0; - Par(5) = QLatReq; + ControlVSHPOutputPar(10) = 0.0; + ControlVSHPOutputPar(5) = QLatReq; } - SolveRoot(state, ErrorToler, MaxIte, SolFla, PartLoadFrac, VSHPCyclingResidual, 0.0, 1.0, Par); + SolveRoot(state, ErrorToler, MaxIte, SolFla, PartLoadFrac, VSHPCyclingResidual, 0.0, 1.0, ControlVSHPOutputPar); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { if (ErrCountCyc == 0) { @@ -7552,14 +7526,14 @@ namespace EnergyPlus::PackagedTerminalHeatPump { } } } - Par(8) = SpeedNum; + ControlVSHPOutputPar(8) = SpeedNum; if (QLatReq < (-1.0 * SmallLoad)) { // calculate latent heat residual - Par(10) = 0.0; - Par(5) = QLatReq; + ControlVSHPOutputPar(10) = 0.0; + ControlVSHPOutputPar(5) = QLatReq; } - SolveRoot(state, ErrorToler, MaxIte, SolFla, SpeedRatio, VSHPSpeedResidual, 1.0e-10, 1.0, Par); + SolveRoot(state, ErrorToler, MaxIte, SolFla, SpeedRatio, VSHPSpeedResidual, 1.0e-10, 1.0, ControlVSHPOutputPar); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { if (ErrCountVar == 0) { @@ -7985,11 +7959,9 @@ namespace EnergyPlus::PackagedTerminalHeatPump { Real64 mdot; // local temporary for mass flow rate Real64 MaxHotWaterFlow; // coil maximum hot water mass flow rate, kg/s Real64 HotWaterMdot; // actual hot water mass flow rate - static Array1D Par(3); + auto & CalcVarSpeedHeatPumpPar = state.dataPTHP->CalcVarSpeedHeatPumpPar; int SolFlag; - static int ATMixOutNode(0); // outlet node of ATM Mixer - - + int ATMixOutNode(0); // outlet node of ATM Mixer OutletNode = state.dataPTHP->PTUnit(PTUnitNum).AirOutNode; InletNode = state.dataPTHP->PTUnit(PTUnitNum).AirInNode; @@ -8298,16 +8270,16 @@ namespace EnergyPlus::PackagedTerminalHeatPump { // control water flow to obtain output matching SupHeaterLoad SolFlag = 0; state.dataPTHP->MinWaterFlow = 0.0; - Par(1) = double(PTUnitNum); + CalcVarSpeedHeatPumpPar(1) = double(PTUnitNum); if (FirstHVACIteration) { - Par(2) = 1.0; + CalcVarSpeedHeatPumpPar(2) = 1.0; } else { - Par(2) = 0.0; + CalcVarSpeedHeatPumpPar(2) = 0.0; } - Par(3) = SupHeaterLoad; + CalcVarSpeedHeatPumpPar(3) = SupHeaterLoad; MaxHotWaterFlow = state.dataPTHP->PTUnit(PTUnitNum).MaxSuppCoilFluidFlow; SolveRoot( - state, ErrTolerance, SolveMaxIter, SolFlag, HotWaterMdot, HotWaterCoilResidual, state.dataPTHP->MinWaterFlow, MaxHotWaterFlow, Par); + state, ErrTolerance, SolveMaxIter, SolFlag, HotWaterMdot, HotWaterCoilResidual, state.dataPTHP->MinWaterFlow, MaxHotWaterFlow, CalcVarSpeedHeatPumpPar); if (SolFlag == -1) { if (state.dataPTHP->PTUnit(PTUnitNum).HotWaterCoilMaxIterIndex == 0) { ShowWarningMessage(state, "RoutineName//Hot water coil control failed for " + state.dataPTHP->PTUnit(PTUnitNum).UnitType + "=\"" + @@ -8422,8 +8394,8 @@ namespace EnergyPlus::PackagedTerminalHeatPump { int InletNode; // inlet node number for PTUnitNum int OutsideAirNode; // outside air node number in PTHP loop int AirRelNode; // relief air node number in PTHP loop - static Real64 AverageUnitMassFlow(0.0); // average supply air mass flow rate over time step - static Real64 AverageOAMassFlow(0.0); // average outdoor air mass flow rate over time step + Real64 AverageUnitMassFlow(0.0); // average supply air mass flow rate over time step + Real64 AverageOAMassFlow(0.0); // average outdoor air mass flow rate over time step auto &MSHPMassFlowRateHigh = state.dataHVACGlobal->MSHPMassFlowRateHigh; auto &MSHPMassFlowRateLow = state.dataHVACGlobal->MSHPMassFlowRateLow; diff --git a/src/EnergyPlus/PackagedTerminalHeatPump.hh b/src/EnergyPlus/PackagedTerminalHeatPump.hh index d7d38cf0f24..da3dbac5dbe 100644 --- a/src/EnergyPlus/PackagedTerminalHeatPump.hh +++ b/src/EnergyPlus/PackagedTerminalHeatPump.hh @@ -572,6 +572,17 @@ struct PackagedTerminalHeatPumpData : BaseGlobalStruct Array1D PTUnit; std::unordered_map PTUnitUniqueNames; Array1D PTUnitUNumericFields; // holds VRF TU numeric input fields character field name + Array1D_bool MyEnvrnFlag; // used for initializations each begin environment flag + Array1D_bool MySizeFlag; // used for sizing PTHP inputs one time + Array1D_bool MyFanFlag; // used for sizing PTHP fan inputs one time + Array1D_bool MyPlantScanFlag; + Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + Array1D ControlPTUnitOutputPar = Array1D(8); + Array1D CalcPTUnitPar = Array1D(3); + Array1D ControlVSHPOutputPar = Array1D(11); + int ErrCountCyc = 0; // Counter used to minimize the occurrence of output warnings + int ErrCountVar = 0; // Counter used to minimize the occurrence of output warnings + Array1D CalcVarSpeedHeatPumpPar = Array1D(3); void clear_state() override { @@ -600,6 +611,13 @@ struct PackagedTerminalHeatPumpData : BaseGlobalStruct this->PTUnit.deallocate(); this->PTUnitUniqueNames.clear(); this->PTUnitUNumericFields.deallocate(); + this->MyEnvrnFlag.clear(); + this->MySizeFlag.clear(); + this->MyFanFlag.clear(); + this->MyPlantScanFlag.clear(); + this->MyZoneEqFlag.clear(); + this->ErrCountCyc = 0; + this->ErrCountVar = 0; } }; diff --git a/src/EnergyPlus/PackagedThermalStorageCoil.cc b/src/EnergyPlus/PackagedThermalStorageCoil.cc index 49fade4f42a..ed53ff0d317 100644 --- a/src/EnergyPlus/PackagedThermalStorageCoil.cc +++ b/src/EnergyPlus/PackagedThermalStorageCoil.cc @@ -1759,10 +1759,10 @@ namespace EnergyPlus::PackagedThermalStorageCoil { using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Array1D_bool MyFlag; // One time environment flag - static Array1D_bool MySizeFlag; // One time sizing flag - static Array1D_bool MyEnvrnFlag; // flag for init once at start of environment - static Array1D_bool MyWarmupFlag; // flag for init after warmup complete + auto & MyFlag = state.dataPackagedThermalStorageCoil->MyFlag; + auto & MySizeFlag = state.dataPackagedThermalStorageCoil->MySizeFlag; + auto & MyEnvrnFlag = state.dataPackagedThermalStorageCoil->MyEnvrnFlag; + auto & MyWarmupFlag = state.dataPackagedThermalStorageCoil->MyWarmupFlag; bool errFlag; int plloopnum; int lsnum; diff --git a/src/EnergyPlus/PackagedThermalStorageCoil.hh b/src/EnergyPlus/PackagedThermalStorageCoil.hh index 51a19b9e974..1af1fbaf1c8 100644 --- a/src/EnergyPlus/PackagedThermalStorageCoil.hh +++ b/src/EnergyPlus/PackagedThermalStorageCoil.hh @@ -510,6 +510,10 @@ struct PackagedThermalStorageCoilData : BaseGlobalStruct bool GetTESInputFlag = true; bool MyOneTimeFlag = true; Array1D TESCoil; + Array1D_bool MyFlag; // One time environment flag + Array1D_bool MySizeFlag; // One time sizing flag + Array1D_bool MyEnvrnFlag; // flag for init once at start of environment + Array1D_bool MyWarmupFlag; // flag for init after warmup complete void clear_state() override { @@ -518,6 +522,10 @@ struct PackagedThermalStorageCoilData : BaseGlobalStruct this->GetTESInputFlag = true; this->MyOneTimeFlag = true; this->TESCoil.deallocate(); + this->MyFlag.clear(); + this->MySizeFlag.clear(); + this->MyEnvrnFlag.clear(); + this->MyWarmupFlag.clear(); } }; diff --git a/src/EnergyPlus/Photovoltaics.cc b/src/EnergyPlus/Photovoltaics.cc index 7daef184713..f25528b0eaf 100644 --- a/src/EnergyPlus/Photovoltaics.cc +++ b/src/EnergyPlus/Photovoltaics.cc @@ -1134,7 +1134,7 @@ namespace Photovoltaics { auto & SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Array1D_bool MyEnvrnFlag; + auto & MyEnvrnFlag = state.dataPhotovoltaicState->MyEnvrnFlag; Real64 TimeElapsed; // Fraction of the current hour that has elapsed (h) // perform the one time initializations @@ -1198,8 +1198,7 @@ namespace Photovoltaics { Real64 const MinInsolation(30.0); int const KMAX(100); Real64 const EtaIni(0.10); // initial value of eta - - static Real64 PVTimeStep; // internal timestep (in seconds) for cell temperature mode 3 + auto & PVTimeStep = state.dataPhotovoltaicState->PVTimeStep; Real64 DummyErr; Real64 ETA; Real64 Tambient; @@ -1229,7 +1228,6 @@ namespace Photovoltaics { int K; Real64 CellTemp(0.0); // cell temperature in Kelvin Real64 CellTempC; // cell temperature in degrees C - // unused1208 INTEGER :: thisZone // if the cell temperature mode is 2, convert the timestep to seconds if (firstTime && state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode == CellIntegration::DecoupledUllebergDynamic) { diff --git a/src/EnergyPlus/Photovoltaics.hh b/src/EnergyPlus/Photovoltaics.hh index 8ff0b00368c..5e12050dcaa 100644 --- a/src/EnergyPlus/Photovoltaics.hh +++ b/src/EnergyPlus/Photovoltaics.hh @@ -318,10 +318,11 @@ namespace Photovoltaics { } // namespace Photovoltaics struct PhotovoltaicStateData : BaseGlobalStruct { - + Array1D_bool MyEnvrnFlag; + Real64 PVTimeStep; // internal timestep (in seconds) for cell temperature mode 3 void clear_state() override { - + this->MyEnvrnFlag.clear(); } }; diff --git a/src/EnergyPlus/PipeHeatTransfer.cc b/src/EnergyPlus/PipeHeatTransfer.cc index c47949ee986..ec102019a16 100644 --- a/src/EnergyPlus/PipeHeatTransfer.cc +++ b/src/EnergyPlus/PipeHeatTransfer.cc @@ -1011,37 +1011,24 @@ namespace EnergyPlus::PipeHeatTransfer { // Using/Aliasing using namespace DataEnvironment; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // fluid node heat balance (see engineering doc). - static Real64 A1(0.0); // sum of the heat balance terms - static Real64 A2(0.0); // mass flow term - static Real64 A3(0.0); // inside pipe wall convection term - static Real64 A4(0.0); // fluid node heat capacity term + Real64 A1(0.0); // sum of the heat balance terms + Real64 A2(0.0); // mass flow term + Real64 A3(0.0); // inside pipe wall convection term + Real64 A4(0.0); // fluid node heat capacity term // pipe wall node heat balance (see engineering doc). - static Real64 B1(0.0); // sum of the heat balance terms - static Real64 B2(0.0); // inside pipe wall convection term - static Real64 B3(0.0); // outside pipe wall convection term - static Real64 B4(0.0); // fluid node heat capacity term - - static Real64 AirConvCoef(0.0); // air-pipe convection coefficient - static Real64 FluidConvCoef(0.0); // fluid-pipe convection coefficient - static Real64 EnvHeatTransCoef(0.0); // external convection coefficient (outside pipe) - static Real64 FluidNodeHeatCapacity(0.0); // local var for MCp for single node of pipe - - static int PipeDepth(0); - static int PipeWidth(0); + Real64 B1(0.0); // sum of the heat balance terms + Real64 B2(0.0); // inside pipe wall convection term + Real64 B3(0.0); // outside pipe wall convection term + Real64 B4(0.0); // fluid node heat capacity term + + Real64 AirConvCoef(0.0); // air-pipe convection coefficient + Real64 FluidConvCoef(0.0); // fluid-pipe convection coefficient + 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; @@ -1187,14 +1174,9 @@ namespace EnergyPlus::PipeHeatTransfer { // is set up, which simulates transient behavior in the soil. // This then interfaces with the Hanby model for near-pipe region - // REFERENCES: See Module Level Description - // Using/Aliasing using ConvectionCoefficients::CalcASHRAESimpExtConvectCoeff; - // SUBROUTINE ARGUMENT DEFINITIONS: - - // Locals // SUBROUTINE PARAMETER DEFINITIONS: int const NumSections(20); Real64 const ConvCrit(0.05); @@ -1202,33 +1184,33 @@ namespace EnergyPlus::PipeHeatTransfer { Real64 const StefBoltzmann(5.6697e-08); // Stefan-Boltzmann constant // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static int IterationIndex(0); // Index when stepping through equations - static int LengthIndex(0); // Index for nodes along length of pipe - static int DepthIndex(0); // Index for nodes in the depth direction - static int WidthIndex(0); // Index for nodes in the width direction - static Real64 ConvCoef(0.0); // Current convection coefficient = f(Wind Speed,Roughness) - static Real64 RadCoef(0.0); // Current radiation coefficient - static Real64 QSolAbsorbed(0.0); // Current total solar energy absorbed + 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) + Real64 RadCoef(0.0); // Current radiation coefficient + Real64 QSolAbsorbed(0.0); // Current total solar energy absorbed Array3D T_O(this->PipeNodeWidth, this->NumDepthNodes, NumSections); // Local variable placeholders for code readability - static Real64 A1(0.0); // Placeholder for CoefA1 - static Real64 A2(0.0); // Placeholder for CoefA2 - static Real64 NodeBelow(0.0); // Placeholder for Node temp below current node - static Real64 NodeAbove(0.0); // Placeholder for Node temp above current node - static Real64 NodeRight(0.0); // Placeholder for Node temp to the right of current node - static Real64 NodeLeft(0.0); // Placeholder for Node temp to the left of current node - static Real64 NodePast(0.0); // Placeholder for Node temp at current node but previous time step - static Real64 PastNodeTempAbs(0.0); // Placeholder for absolute temperature (K) version of NodePast - static Real64 Ttemp(0.0); // Placeholder for a current temperature node in convergence check - static Real64 SkyTempAbs(0.0); // Placeholder for current sky temperature in Kelvin - static int TopRoughness(0); // Placeholder for soil surface roughness - static Real64 TopThermAbs(0.0); // Placeholder for soil thermal radiation absorptivity - static Real64 TopSolarAbs(0.0); // Placeholder for soil solar radiation absorptivity - static Real64 kSoil(0.0); // Placeholder for soil conductivity - static Real64 dS(0.0); // Placeholder for soil grid spacing - static Real64 rho(0.0); // Placeholder for soil density - static Real64 Cp(0.0); // Placeholder for soil specific heat + Real64 A1(0.0); // Placeholder for CoefA1 + Real64 A2(0.0); // Placeholder for CoefA2 + Real64 NodeBelow(0.0); // Placeholder for Node temp below current node + Real64 NodeAbove(0.0); // Placeholder for Node temp above current node + Real64 NodeRight(0.0); // Placeholder for Node temp to the right of current node + Real64 NodeLeft(0.0); // Placeholder for Node temp to the left of current node + Real64 NodePast(0.0); // Placeholder for Node temp at current node but previous time step + Real64 PastNodeTempAbs(0.0); // Placeholder for absolute temperature (K) version of NodePast + Real64 Ttemp(0.0); // Placeholder for a current temperature node in convergence check + Real64 SkyTempAbs(0.0); // Placeholder for current sky temperature in Kelvin + int TopRoughness(0); // Placeholder for soil surface roughness + Real64 TopThermAbs(0.0); // Placeholder for soil thermal radiation absorptivity + Real64 TopSolarAbs(0.0); // Placeholder for soil solar radiation absorptivity + Real64 kSoil(0.0); // Placeholder for soil conductivity + Real64 dS(0.0); // Placeholder for soil grid spacing + Real64 rho(0.0); // Placeholder for soil density + Real64 Cp(0.0); // Placeholder for soil specific heat // There are a number of coefficients which change through the simulation, and they are updated here this->FourierDS = this->SoilDiffusivity * state.dataPipeHT->nsvDeltaTime / pow_2(this->dSregular); // Eq. D4 diff --git a/src/EnergyPlus/Plant/Component.cc b/src/EnergyPlus/Plant/Component.cc index 266121a4c7a..38aae09bb65 100644 --- a/src/EnergyPlus/Plant/Component.cc +++ b/src/EnergyPlus/Plant/Component.cc @@ -112,8 +112,6 @@ namespace DataPlant { // If you add a module or new equipment type, you must set up this structure. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static std::vector compsToSimAfterInitLoopEquip = { - DataPlant::TypeOf_Pipe, DataPlant::TypeOf_PipeSteam, DataPlant::TypeOf_SolarCollectorICS, DataPlant::TypeOf_SolarCollectorFlatPlate}; if (this->compPtr != nullptr) { if (InitLoopEquip) { this->compPtr->onInitLoopEquip(state, this->location); @@ -133,8 +131,8 @@ namespace DataPlant { // I anticipate the list of components that fall through to be very small, so that is the check I will do. // If std::find returns the .end() iterator, that means it didn't find it in the list, which means it's not one of the ones to fall // through, so RETURN - if (std::find(compsToSimAfterInitLoopEquip.begin(), compsToSimAfterInitLoopEquip.end(), this->TypeOf_Num) == - compsToSimAfterInitLoopEquip.end()) { + if (std::find(state.dataPlnt->compsToSimAfterInitLoopEquip.begin(), state.dataPlnt->compsToSimAfterInitLoopEquip.end(), this->TypeOf_Num) == + state.dataPlnt->compsToSimAfterInitLoopEquip.end()) { return; } } diff --git a/src/EnergyPlus/Plant/DataPlant.hh b/src/EnergyPlus/Plant/DataPlant.hh index 932e14a4593..7bc7f174df7 100644 --- a/src/EnergyPlus/Plant/DataPlant.hh +++ b/src/EnergyPlus/Plant/DataPlant.hh @@ -226,6 +226,8 @@ namespace DataPlant { } // namespace DataPlant struct DataPlantData : BaseGlobalStruct { + std::vector compsToSimAfterInitLoopEquip = { + DataPlant::TypeOf_Pipe, DataPlant::TypeOf_PipeSteam, DataPlant::TypeOf_SolarCollectorICS, DataPlant::TypeOf_SolarCollectorFlatPlate}; int TotNumLoops = 0; // number of plant and condenser loops int TotNumHalfLoops = 0; // number of half loops (2 * TotNumLoops) diff --git a/src/EnergyPlus/PluginManager.cc b/src/EnergyPlus/PluginManager.cc index 18e3ac822d2..b67ead5aac2 100644 --- a/src/EnergyPlus/PluginManager.cc +++ b/src/EnergyPlus/PluginManager.cc @@ -1341,13 +1341,8 @@ namespace EnergyPlus::PluginManagement { #if LINK_WITH_PYTHON == 1 bool PluginManager::anyUnexpectedPluginObjects(EnergyPlusData &state) { - static std::vector objectsToFind = {"PythonPlugin:OutputVariable", - "PythonPlugin:SearchPaths", - "PythonPlugin:Instance", - "PythonPlugin:Variables", - "PythonPlugin:TrendVariable"}; int numTotalThings = 0; - for (auto const &objToFind : objectsToFind) { + for (auto const &objToFind : state.dataPluginManager->objectsToFind) { int instances = inputProcessor->getNumObjectsFound(state, objToFind); numTotalThings += instances; if (numTotalThings == 1) { diff --git a/src/EnergyPlus/PluginManager.hh b/src/EnergyPlus/PluginManager.hh index fb1bad11bc5..f24d22bcbc1 100644 --- a/src/EnergyPlus/PluginManager.hh +++ b/src/EnergyPlus/PluginManager.hh @@ -238,7 +238,11 @@ struct PluginManagerData : BaseGlobalStruct { std::vector globalVariableValues; bool fullyReady = false; bool apiErrorFlag = false; - + std::vector const objectsToFind = {"PythonPlugin:OutputVariable", + "PythonPlugin:SearchPaths", + "PythonPlugin:Instance", + "PythonPlugin:Variables", + "PythonPlugin:TrendVariable"}; void clear_state() override { callbacks.clear(); #if LINK_WITH_PYTHON == 1 diff --git a/src/EnergyPlus/PoweredInductionUnits.cc b/src/EnergyPlus/PoweredInductionUnits.cc index b957078b20a..8d43fbb9020 100644 --- a/src/EnergyPlus/PoweredInductionUnits.cc +++ b/src/EnergyPlus/PoweredInductionUnits.cc @@ -728,9 +728,9 @@ namespace EnergyPlus::PoweredInductionUnits { int HotConNode; // hot water control node number in PIU int OutletNode; // unit air outlet node number Real64 RhoAir; // air density at outside pressure and standard temperature and humidity - static Array1D_bool MyEnvrnFlag; - static Array1D_bool MySizeFlag; - static Array1D_bool MyPlantScanFlag; + auto & MyEnvrnFlag = state.dataPowerInductionUnits->MyEnvrnFlag; + auto & MySizeFlag = state.dataPowerInductionUnits->MySizeFlag; + auto & MyPlantScanFlag = state.dataPowerInductionUnits->MyPlantScanFlag; int Loop; // Loop checking control variable Real64 rho; // local plant fluid density bool errFlag; @@ -961,14 +961,14 @@ namespace EnergyPlus::PoweredInductionUnits { Real64 EnthSteamOutWet; Real64 LatentHeatSteam; Real64 SteamDensity; - static int CoilWaterInletNode(0); - static int CoilWaterOutletNode(0); - static int CoilSteamInletNode(0); - static int CoilSteamOutletNode(0); + int CoilWaterInletNode(0); + int CoilWaterOutletNode(0); + int CoilSteamInletNode(0); + int CoilSteamOutletNode(0); bool ErrorsFound; Real64 rho; Real64 Cp; - static int DummyWaterIndex(1); + int DummyWaterIndex(1); bool IsAutoSize; // Indicator to autosize Real64 MaxPriAirVolFlowDes; // Autosized maximum primary air flow for reporting Real64 MaxPriAirVolFlowUser; // Hardsized maximum primary air flow for reporting diff --git a/src/EnergyPlus/PoweredInductionUnits.hh b/src/EnergyPlus/PoweredInductionUnits.hh index 54f6f3903af..ad0ae1b4f3a 100644 --- a/src/EnergyPlus/PoweredInductionUnits.hh +++ b/src/EnergyPlus/PoweredInductionUnits.hh @@ -213,6 +213,9 @@ struct PoweredInductionUnitsData : BaseGlobalStruct int NumParallelPIUs = 0; Array1D PIU; std::unordered_map PiuUniqueNames; + Array1D_bool MyEnvrnFlag; + Array1D_bool MySizeFlag; + Array1D_bool MyPlantScanFlag; void clear_state() override { @@ -225,6 +228,9 @@ struct PoweredInductionUnitsData : BaseGlobalStruct this->NumParallelPIUs = 0; this->PIU.deallocate(); this->PiuUniqueNames.clear(); + this->MyEnvrnFlag.clear(); + this->MySizeFlag.clear(); + this->MyPlantScanFlag.clear(); } }; diff --git a/src/EnergyPlus/Pumps.cc b/src/EnergyPlus/Pumps.cc index ae2a089ddcd..c4d374a5f98 100644 --- a/src/EnergyPlus/Pumps.cc +++ b/src/EnergyPlus/Pumps.cc @@ -265,7 +265,7 @@ namespace EnergyPlus::Pumps { int NumConstPumpBankSimple; Real64 SteamDensity; Real64 TempWaterDensity; - static int DummyWaterIndex(1); + int DummyWaterIndex(1); ErrorsFound = false; @@ -1208,7 +1208,7 @@ namespace EnergyPlus::Pumps { int OutletNode; // pump outlet node number Real64 TotalEffic; Real64 SteamDensity; // Density of working fluid - static int DummyWaterIndex(1); + int DummyWaterIndex(1); Real64 TempWaterDensity; bool errFlag; Real64 mdotMax; // local fluid mass flow rate maximum @@ -1912,7 +1912,7 @@ namespace EnergyPlus::Pumps { Real64 PumpSizFac; // pump sizing factor Real64 SteamDensity; Real64 TempWaterDensity; - static int DummyWaterIndex(1); + int DummyWaterIndex(1); Real64 DesVolFlowRatePerBranch; // local temporary for split of branch pumps // Calculate density at InitConvTemp once here, to remove RhoH2O calls littered throughout @@ -2187,12 +2187,12 @@ namespace EnergyPlus::Pumps { using PlantUtilities::SetComponentFlowRate; using ScheduleManager::GetCurrentScheduleValue; - static Real64 PumpMassFlowRateMaxPress(0.0); // Maximum mass flow rate associated with maximum pressure limit - static Real64 PumpMassFlowRateMinPress(0.0); // Minimum mass flow rate associated with minimum pressure limit - static Real64 RotSpeed_Max(0.0); // Maximum rotational speed in rps - static Real64 RotSpeed_Min(0.0); // Minimum rotational speed in rps - static Real64 MinPress(0.0); // Minimum pressure - static Real64 MaxPress(0.0); // Maximum pressure + Real64 PumpMassFlowRateMaxPress(0.0); // Maximum mass flow rate associated with maximum pressure limit + Real64 PumpMassFlowRateMinPress(0.0); // Minimum mass flow rate associated with minimum pressure limit + Real64 RotSpeed_Max(0.0); // Maximum rotational speed in rps + Real64 RotSpeed_Min(0.0); // Minimum rotational speed in rps + Real64 MinPress(0.0); // Minimum pressure + Real64 MaxPress(0.0); // Maximum pressure RotSpeed_Min = GetCurrentScheduleValue(state, state.dataPumps->PumpEquip(PumpNum).VFD.MinRPMSchedIndex); RotSpeed_Max = GetCurrentScheduleValue(state, state.dataPumps->PumpEquip(PumpNum).VFD.MaxRPMSchedIndex); diff --git a/src/EnergyPlus/RefrigeratedCase.cc b/src/EnergyPlus/RefrigeratedCase.cc index f37ff24d0c7..c7b71d0e902 100644 --- a/src/EnergyPlus/RefrigeratedCase.cc +++ b/src/EnergyPlus/RefrigeratedCase.cc @@ -6196,7 +6196,7 @@ namespace EnergyPlus::RefrigeratedCase { auto &CoilSysCredit(state.dataRefrigCase->CoilSysCredit); auto &CaseWIZoneReport(state.dataRefrigCase->CaseWIZoneReport); - static std::string Walkin_and_zone_name; // concat name for walk-in/zone credit reporting + std::string Walkin_and_zone_name; // concat name for walk-in/zone credit reporting if (state.dataRefrigCase->NumSimulationCases > 0) { // Setup Report Variables for simulated Refrigerated Case (do not report unused cases) @@ -8724,9 +8724,9 @@ namespace EnergyPlus::RefrigeratedCase { // this most recent addition/subtraction is reversed before the rest of the refrigeration simulation begins. // Used to adjust accumulative variables when time step is repeated - static Real64 MyCurrentTimeSaved(0.0); // Used to determine whether the zone time step is a repetition - static Real64 MyStepStartTimeSaved(0.0); // Used to determine whether the system time step is a repetition - static Real64 TimeStepFraction(0.0); // Used to calculate my current time + auto & MyCurrentTimeSaved = state.dataRefrigCase->MyCurrentTimeSaved; // Used to determine whether the zone time step is a repetition + auto & MyStepStartTimeSaved = state.dataRefrigCase->MyStepStartTimeSaved; // Used to determine whether the system time step is a repetition + auto & TimeStepFraction = state.dataRefrigCase->TimeStepFraction; // Used to calculate my current time auto &RefrigCase(state.dataRefrigCase->RefrigCase); auto &RefrigRack(state.dataRefrigCase->RefrigRack); diff --git a/src/EnergyPlus/RefrigeratedCase.hh b/src/EnergyPlus/RefrigeratedCase.hh index 89e565c4c9c..9a7215a39d4 100644 --- a/src/EnergyPlus/RefrigeratedCase.hh +++ b/src/EnergyPlus/RefrigeratedCase.hh @@ -1865,6 +1865,10 @@ struct RefrigeratedCaseData : BaseGlobalStruct bool InitRefrigerationPlantConnectionsMyBeginEnvrnFlag = true; bool FigureRefrigerationZoneGainsMyEnvrnFlag = true; + Real64 MyCurrentTimeSaved = 0.0; // Used to determine whether the zone time step is a repetition + Real64 MyStepStartTimeSaved = 0.0; // Used to determine whether the system time step is a repetition + Real64 TimeStepFraction = 0.0; // Used to calculate my current time + void clear_state() override { this->NumRefrigeratedRacks = 0; @@ -1946,6 +1950,9 @@ struct RefrigeratedCaseData : BaseGlobalStruct this->InitRefrigerationMyBeginEnvrnFlag = true; this->InitRefrigerationPlantConnectionsMyBeginEnvrnFlag = true; this->FigureRefrigerationZoneGainsMyEnvrnFlag = true; + this->MyCurrentTimeSaved = 0.0; + this->MyStepStartTimeSaved = 0.0; + this->TimeStepFraction = 0.0; } }; diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.cc b/src/EnergyPlus/RoomAirModelUserTempPattern.cc index 19c8246942d..7e5f7b045c1 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.cc +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.cc @@ -165,7 +165,7 @@ namespace EnergyPlus::RoomAirModelUserTempPattern { // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Array1D_bool MyEnvrnFlag; // flag for init once at start of environment + auto & MyEnvrnFlag = state.dataRoomAirModelTempPattern->MyEnvrnFlag; // flag for init once at start of environment int SurfNum; // do loop counter if (MyOneTimeFlag) { @@ -438,7 +438,7 @@ namespace EnergyPlus::RoomAirModelUserTempPattern { Real64 thisZeta; // non-dimensional height Real64 DeltaHeight; // height difference in m Real64 tempDeltaTai; // temporary temperature difference - static Array1D_bool SetupOutputFlag; // flag to set up output variable one-time if 2-grad model used + auto & SetupOutputFlag = state.dataRoomAirModelTempPattern->SetupOutputFlag; // flag to set up output variable one-time if 2-grad model used if (MyOneTimeFlag2) { SetupOutputFlag.dimension(state.dataGlobal->NumOfZones, true); // init diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.hh b/src/EnergyPlus/RoomAirModelUserTempPattern.hh index 8dbe4b22962..c4dc74f43ff 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.hh +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.hh @@ -119,10 +119,12 @@ namespace RoomAirModelUserTempPattern { } // namespace RoomAirModelUserTempPattern struct RoomAirModelUserTempPatternData : BaseGlobalStruct { - + Array1D_bool MyEnvrnFlag; // flag for init once at start of environment + Array1D_bool SetupOutputFlag; // flag to set up output variable one-time if 2-grad model used void clear_state() override { - + this->MyEnvrnFlag.clear(); + this->SetupOutputFlag.clear(); } }; diff --git a/src/EnergyPlus/RootFinder.cc b/src/EnergyPlus/RootFinder.cc index 17621d87024..6923bddd84b 100644 --- a/src/EnergyPlus/RootFinder.cc +++ b/src/EnergyPlus/RootFinder.cc @@ -52,6 +52,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -1419,7 +1420,7 @@ namespace EnergyPlus::RootFinder { // False position, Secant and Brent) to compute the next candidate. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Real64 XNext(0.0); + auto & XNext = state.dataGeneral->XNext; //---------------------------------------------------------------------------- // First attempt to bracket root between a lower point and an upper point. diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 22869a80e5a..390aad4200a 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -104,10 +104,10 @@ namespace EnergyPlus::RuntimeLanguageProcessor { auto & SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; auto & TimeStepSys = state.dataHVACGlobal->TimeStepSys; - static Real64 tmpCurrentTime(0.0); - static Real64 tmpMinutes(0.0); - static Real64 tmpHours(0.0); - static Real64 tmpCurEnvirNum(0.0); + Real64 tmpCurrentTime(0.0); + Real64 tmpMinutes(0.0); + Real64 tmpHours(0.0); + Real64 tmpCurEnvirNum(0.0); Array1D_int datevalues(8); // value(1) Current year // value(2) Current month @@ -767,7 +767,7 @@ namespace EnergyPlus::RuntimeLanguageProcessor { int InstructionNum; int InstructionNum2; int ExpressionNum; - static int VariableNum; + int VariableNum; int WhileLoopExitCounter; // to avoid infinite loop in While loop bool seriousErrorFound(false); // once it gets set true (inside EvaluateExpresssion) it will trigger a fatal (in WriteTrace) @@ -1021,8 +1021,7 @@ namespace EnergyPlus::RuntimeLanguageProcessor { bool LastED; // last character in a numeric was an E or D // Object Data - static Array1D Token; - + auto & Token = state.dataRuntimeLangProcessor->Token; CountDoLooping = 0; NumErrors = 0; @@ -2495,21 +2494,21 @@ namespace EnergyPlus::RuntimeLanguageProcessor { int VariableNum(0); // temporary int RuntimeReportVarNum; bool Found; - static std::string FreqString; // temporary - static std::string VarTypeString; // temporary - static std::string ResourceTypeString; - static std::string GroupTypeString; - static std::string EndUseTypeString; - static std::string EndUseSubCatString; + std::string FreqString; // temporary + std::string VarTypeString; // temporary + std::string ResourceTypeString; + std::string GroupTypeString; + std::string EndUseTypeString; + std::string EndUseSubCatString; int TrendNum; int NumTrendSteps; int loop; int ErlVarLoop; int CurveIndexNum; - static int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs - static int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs - static int TotalArgs(0); // argument for call to GetObjectDefMaxArgs + int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs + int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs + int TotalArgs(0); // argument for call to GetObjectDefMaxArgs Array1D_string cAlphaFieldNames; Array1D_string cNumericFieldNames; Array1D_bool lNumericFieldBlanks; diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.hh b/src/EnergyPlus/RuntimeLanguageProcessor.hh index 4cc3bdb5306..58c861ddc8d 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.hh +++ b/src/EnergyPlus/RuntimeLanguageProcessor.hh @@ -226,6 +226,7 @@ struct RuntimeLanguageProcessorData : BaseGlobalStruct { std::unordered_map ErlStackUniqueNames; std::unordered_map RuntimeReportVarUniqueNames; bool WriteTraceMyOneTimeFlag = false; + Array1D Token; void clear_state() override { this->AlreadyDidOnce = false; @@ -264,6 +265,7 @@ struct RuntimeLanguageProcessorData : BaseGlobalStruct { this->ErlStackUniqueNames.clear(); this->RuntimeReportVarUniqueNames.clear(); this->WriteTraceMyOneTimeFlag = false; + this->Token.clear(); } };