diff --git a/src/EnergyPlus/AirLoopHVACDOAS.cc b/src/EnergyPlus/AirLoopHVACDOAS.cc index 5f049de21b2..8cc55c1a7d7 100644 --- a/src/EnergyPlus/AirLoopHVACDOAS.cc +++ b/src/EnergyPlus/AirLoopHVACDOAS.cc @@ -936,7 +936,7 @@ namespace AirLoopHVACDOAS { bool errorsFound = false; if (this->m_FanIndex > 0 && this->m_FanTypeNum == SimAirServingZones::Fan_ComponentModel) { Fans::SetFanData(state, this->m_FanIndex, errorsFound, Name, sizingMassFlow / state.dataEnvrn->StdRhoAir, 0); - Fans::Fan(this->m_FanIndex).MaxAirMassFlowRate = sizingMassFlow; + state.dataFans->Fan(this->m_FanIndex).MaxAirMassFlowRate = sizingMassFlow; state.dataLoopNodes->Node(this->m_FanInletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = sizingMassFlow; diff --git a/src/EnergyPlus/AirflowNetworkBalanceManager.cc b/src/EnergyPlus/AirflowNetworkBalanceManager.cc index e18915e8b1f..a5f2e0fd740 100644 --- a/src/EnergyPlus/AirflowNetworkBalanceManager.cc +++ b/src/EnergyPlus/AirflowNetworkBalanceManager.cc @@ -452,7 +452,7 @@ namespace AirflowNetworkBalanceManager { } Real64 flowRate; - GetFanVolFlow(fanIndex, flowRate); + GetFanVolFlow(state, fanIndex, flowRate); flowRate *= state.dataEnvrn->StdRhoAir; bool nodeErrorsFound{false}; int inletNode = GetFanInletNode(state, "Fan:ZoneExhaust", thisObjectName, nodeErrorsFound); @@ -1268,7 +1268,7 @@ namespace AirflowNetworkBalanceManager { success = false; } - GetFanVolFlow(fanIndex, flowRate); + GetFanVolFlow(state, fanIndex, flowRate); flowRate *= state.dataEnvrn->StdRhoAir; GetFanType(state, fan_name, fanType_Num, FanErrorFound); @@ -9786,7 +9786,7 @@ namespace AirflowNetworkBalanceManager { HVACFan::fanObjs[DisSysCompCVFData(AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).TypeNum).FanIndex]->AirLoopNum = AirflowNetworkLinkageData(i).AirLoopNum; } else { - SetFanAirLoopNumber(n, AirflowNetworkLinkageData(i).AirLoopNum); + SetFanAirLoopNumber(state, n, AirflowNetworkLinkageData(i).AirLoopNum); } } if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == EPlusTypeNum_COI) { @@ -10324,7 +10324,7 @@ namespace AirflowNetworkBalanceManager { HVACFan::fanObjs[DisSysCompCVFData(typeNum).FanIndex]->designAirVolFlowRate * state.dataEnvrn->StdRhoAir; } else { Real64 FanFlow; // Return type - GetFanVolFlow(DisSysCompCVFData(typeNum).FanIndex, FanFlow); + GetFanVolFlow(state, DisSysCompCVFData(typeNum).FanIndex, FanFlow); DisSysCompCVFData(typeNum).MaxAirMassFlowRate = FanFlow * state.dataEnvrn->StdRhoAir; } } diff --git a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc index 54ef69b155d..ca314ba3c0a 100644 --- a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc +++ b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc @@ -103,7 +103,7 @@ void BaseSizerWithScalableInputs::initializeWithinEP(EnergyPlusData &state, coilSelectionReportObj->setCoilSupplyFanInfo(state, this->compName, this->compType, - Fans::Fan(SupFanNum).FanName, + state.dataFans->Fan(SupFanNum).FanName, DataAirSystems::structArrayLegacyFanModels, this->primaryAirSystem(this->curSysNum).SupFanNum); } diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index f1a4dea64e1..608e57254f9 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -192,19 +192,15 @@ set(SRC DataLoopNode.hh DataMoistureBalance.cc DataMoistureBalance.hh - DataMoistureBalanceEMPD.cc DataMoistureBalanceEMPD.hh DataOutputs.cc DataOutputs.hh DataPhotovoltaics.cc DataPhotovoltaics.hh - DataPrecisionGlobals.cc DataPrecisionGlobals.hh - DataReportingFlags.cc DataReportingFlags.hh DataRoomAirModel.cc DataRoomAirModel.hh - DataRootFinder.cc DataRootFinder.hh DataRuntimeLanguage.cc DataRuntimeLanguage.hh diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc index 087c532d3f9..e6f2f33821b 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc @@ -446,7 +446,7 @@ void CoilCoolingDXCurveFitPerformance::calcStandardRatings(EnergyPlus::EnergyPlu fanPowerCorrection = HVACFan::fanObjs[supplyFanIndex]->fanPower(); } else { Fans::SimulateFanComponents(state, supplyFanName, true, supplyFanIndex, _, true, false, FanStaticPressureRise); - fanPowerCorrection = Fans::GetFanPower(supplyFanIndex); + fanPowerCorrection = Fans::GetFanPower(state, supplyFanIndex); } fanHeatCorrection = state.dataLoopNodes->Node(fanOutletNode).Enthalpy - state.dataLoopNodes->Node(fanInletNode).Enthalpy; @@ -600,7 +600,7 @@ void CoilCoolingDXCurveFitPerformance::calcStandardRatings(EnergyPlus::EnergyPlu fanPowerCorrection = HVACFan::fanObjs[supplyFanIndex]->fanPower(); } else { Fans::SimulateFanComponents(state, supplyFanName, true, supplyFanIndex, _, true, false, FanStaticPressureRise); - fanPowerCorrection = Fans::GetFanPower(supplyFanIndex); + fanPowerCorrection = Fans::GetFanPower(state, supplyFanIndex); } fanHeatCorrection = state.dataLoopNodes->Node(fanOutletNode).Enthalpy - state.dataLoopNodes->Node(fanInletNode).Enthalpy; diff --git a/src/EnergyPlus/CondenserLoopTowers.cc b/src/EnergyPlus/CondenserLoopTowers.cc index 7122dff8620..d76fec57033 100644 --- a/src/EnergyPlus/CondenserLoopTowers.cc +++ b/src/EnergyPlus/CondenserLoopTowers.cc @@ -5440,7 +5440,7 @@ namespace CondenserLoopTowers { // PURPOSE OF THIS SUBROUTINE: // To verify that the empirical model's independent variables are within the limits used during the - // developement of the empirical model. + // development of the empirical model. // METHODOLOGY EMPLOYED: // The empirical models used for simulating a variable speed cooling tower are based on a limited data set. diff --git a/src/EnergyPlus/Construction.cc b/src/EnergyPlus/Construction.cc index ac6b5b493c9..c69b596ef92 100644 --- a/src/EnergyPlus/Construction.cc +++ b/src/EnergyPlus/Construction.cc @@ -113,24 +113,24 @@ namespace EnergyPlus::Construction { // Urbana-Champaign, 1995. // SUBROUTINE PARAMETER DEFINITIONS: - Real64 const PhysPropLimit(1.0e-6); // Physical properties limit. + constexpr Real64 PhysPropLimit(1.0e-6); // Physical properties limit. // This is more or less the traditional value from BLAST. - Real64 const RValueLowLimit(1.0e-3); // Physical properties limit for R-value only layers + constexpr Real64 RValueLowLimit(1.0e-3); // Physical properties limit for R-value only layers // This value was based on trial and error related to CR 7791 where a // user had entered a "no insulation" layer with an R-value of 1.0E-05. // Some trial and error established this as a potential value though // there is no guarantee that this is a good value. - int const MinNodes(6); // Minimum number of state space nodes + constexpr int MinNodes(6); // Minimum number of state space nodes // per layer. This value was chosen based on experience with IBLAST. - Real64 const MaxAllowedCTFSumError(0.01); // Allow a 1 percent + constexpr Real64 MaxAllowedCTFSumError(0.01); // Allow a 1 percent // difference between the CTF series summations. If the difference is // greater than this, then the coefficients will not yield a valid steady // state solution. - Real64 const MaxAllowedTimeStep(4.0); // Sets the maximum allowed time step + constexpr Real64 MaxAllowedTimeStep(4.0); // Sets the maximum allowed time step // for CTF calculations to be 4 hours. This is done in response to some // rare situations where odd or faulty input will cause the routine to // go off and get some huge time step (in excess of 20 hours). This value @@ -1100,7 +1100,7 @@ namespace EnergyPlus::Construction { // Calculation Code in BEST", BSO internal document, // May/June 1996. - Real64 const DPLimit(1.0e-20); + constexpr Real64 DPLimit(1.0e-20); // This argument is nice, but not sure it's accurate -- LKL Nov 1999. // Parameter set to the significant figures limit of double // precision variables plus a safety factor.- The argument for setting this parameter to 1E-20 involves the @@ -1576,7 +1576,7 @@ namespace EnergyPlus::Construction { // dissertation. // SUBROUTINE PARAMETER DEFINITIONS: - Real64 const ConvrgLim(1.0e-13); // Convergence limit (ratio) for cutting off the calculation of further + constexpr Real64 ConvrgLim(1.0e-13); // Convergence limit (ratio) for cutting off the calculation of further // CTFs. This value was found to give suitable accuracy in IBLAST. Real64 avg; // Intermediate calculation variable (average) diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 09493fce0dc..07f1471f36f 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -8255,7 +8255,7 @@ namespace EnergyPlus::DXCoils { if (Coil.SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { locFanElecPower = HVACFan::fanObjs[Coil.SupplyFanIndex]->fanPower(); } else { - locFanElecPower = Fans::GetFanPower(Coil.SupplyFanIndex); + locFanElecPower = Fans::GetFanPower(state, Coil.SupplyFanIndex); } // calculate evaporator total cooling capacity @@ -13644,7 +13644,7 @@ namespace EnergyPlus::DXCoils { } else { Fans::SimulateFanComponents( state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, true, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); - FanPowerCorrection = Fans::GetFanPower(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); + FanPowerCorrection = Fans::GetFanPower(state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } FanHeatCorrection = state.dataLoopNodes->Node(FanOutletNode).Enthalpy - state.dataLoopNodes->Node(FanInletNode).Enthalpy; @@ -13786,7 +13786,7 @@ namespace EnergyPlus::DXCoils { } else { Fans::SimulateFanComponents( state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, true, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); - FanPowerCorrection = Fans::GetFanPower(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); + FanPowerCorrection = Fans::GetFanPower(state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } FanHeatCorrection = state.dataLoopNodes->Node(FanOutletNode).Enthalpy - state.dataLoopNodes->Node(FanInletNode).Enthalpy; @@ -15175,7 +15175,7 @@ namespace EnergyPlus::DXCoils { coilSelectionReportObj->setCoilSupplyFanInfo(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, - Fans::Fan(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex).FanName, + state.dataFans->Fan(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex).FanName, DataAirSystems::structArrayLegacyFanModels, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } diff --git a/src/EnergyPlus/DataMoistureBalanceEMPD.cc b/src/EnergyPlus/DataMoistureBalanceEMPD.cc deleted file mode 100644 index 7c2ef09c701..00000000000 --- a/src/EnergyPlus/DataMoistureBalanceEMPD.cc +++ /dev/null @@ -1,87 +0,0 @@ -// EnergyPlus, Copyright (c) 1996-2021, The Board of Trustees of the University of Illinois, -// The Regents of the University of California, through Lawrence Berkeley National Laboratory -// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge -// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other -// contributors. All rights reserved. -// -// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the -// U.S. Government consequently retains certain rights. As such, the U.S. Government has been -// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, -// worldwide license in the Software to reproduce, distribute copies to the public, prepare -// derivative works, and perform publicly and display publicly, and to permit others to do so. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted -// provided that the following conditions are met: -// -// (1) Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// (2) Redistributions in binary form must reproduce the above copyright notice, this list of -// conditions and the following disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, -// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific prior -// written permission. -// -// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form -// without changes from the version obtained under this License, or (ii) Licensee makes a -// reference solely to the software portion of its product, Licensee must refer to the -// software as "EnergyPlus version X" software, where "X" is the version number Licensee -// obtained under this License and may not use a different name for the software. Except as -// specifically required in this Section (4), Licensee shall not use in a company name, a -// product name, in advertising, publicity, or other promotional activities any name, trade -// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly -// similar designation, without the U.S. Department of Energy's prior written consent. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// EnergyPlus Headers -#include - -namespace EnergyPlus::DataMoistureBalanceEMPD { - - // MODULE INFORMATION: - // AUTHOR Muthusamy V. Swami and Lixing Gu - // DATE WRITTEN Aug. 2000 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS MODULE: - // This module should contain the information that is needed to calculate - // moisture level at interior surfaces - - // MODULE VARIABLE DECLARATIONS: - // Variables that are used in both the Surface Heat Balance and the Moisture Balance - Array1D RVSurfaceOld; // Moisture level at interior surfaces at previous time step - Array1D RVSurface; // Moisture level at interior surfaces at current interation - // and current time step - Array1D HeatFluxLatent; // Moisture flux at interior surfaces [W] - Array1D RVSurfLayerOld; - Array1D RVdeepOld; - Array1D RVSurfLayer; - Array1D RVDeepLayer; - Array1D RVwall; - - void clear_state() - { - RVSurfaceOld.deallocate(); - RVSurface.deallocate(); - HeatFluxLatent.deallocate(); - RVSurfLayerOld.deallocate(); - RVdeepOld.deallocate(); - RVSurfLayer.deallocate(); - RVDeepLayer.deallocate(); - RVwall.deallocate(); - } - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/DataMoistureBalanceEMPD.hh b/src/EnergyPlus/DataMoistureBalanceEMPD.hh index 4343920b6f0..524fa9c8b6b 100644 --- a/src/EnergyPlus/DataMoistureBalanceEMPD.hh +++ b/src/EnergyPlus/DataMoistureBalanceEMPD.hh @@ -61,27 +61,31 @@ namespace DataMoistureBalanceEMPD { constexpr Real64 Lam(2500000.0); // heat of adsorption for building materials - // MODULE VARIABLE DECLARATIONS: - // Variables that are used in both the Surface Heat Balance and the Moisture Balance - extern Array1D RVSurfaceOld; // Moisture level at interior surfaces at previous time step - extern Array1D RVSurface; // Moisture level at interior surfaces at current interation - // and current time step - extern Array1D HeatFluxLatent; // Moisture flux at interior surfaces [W] - extern Array1D RVSurfLayerOld; - extern Array1D RVdeepOld; - extern Array1D RVSurfLayer; - extern Array1D RVDeepLayer; - extern Array1D RVwall; - - void clear_state(); - } // namespace DataMoistureBalanceEMPD -struct MoistureBalanceEMPDData : BaseGlobalStruct { +struct MoistureBalanceEMPDData : BaseGlobalStruct +{ + + // Variables that are used in both the Surface Heat Balance and the Moisture Balance + Array1D RVSurfaceOld; // Moisture level at interior surfaces at previous time step + Array1D RVSurface; // Moisture level at interior surfaces at current iteration and current time step + Array1D HeatFluxLatent; // Moisture flux at interior surfaces [W] + Array1D RVSurfLayerOld; + Array1D RVdeepOld; + Array1D RVSurfLayer; + Array1D RVDeepLayer; + Array1D RVwall; void clear_state() override { - + this->RVSurfaceOld.deallocate(); + this->RVSurface.deallocate(); + this->HeatFluxLatent.deallocate(); + this->RVSurfLayerOld.deallocate(); + this->RVdeepOld.deallocate(); + this->RVSurfLayer.deallocate(); + this->RVDeepLayer.deallocate(); + this->RVwall.deallocate(); } }; diff --git a/src/EnergyPlus/DataPrecisionGlobals.cc b/src/EnergyPlus/DataPrecisionGlobals.cc deleted file mode 100644 index 76ace22ef69..00000000000 --- a/src/EnergyPlus/DataPrecisionGlobals.cc +++ /dev/null @@ -1,110 +0,0 @@ -// EnergyPlus, Copyright (c) 1996-2021, The Board of Trustees of the University of Illinois, -// The Regents of the University of California, through Lawrence Berkeley National Laboratory -// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge -// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other -// contributors. All rights reserved. -// -// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the -// U.S. Government consequently retains certain rights. As such, the U.S. Government has been -// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, -// worldwide license in the Software to reproduce, distribute copies to the public, prepare -// derivative works, and perform publicly and display publicly, and to permit others to do so. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted -// provided that the following conditions are met: -// -// (1) Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// (2) Redistributions in binary form must reproduce the above copyright notice, this list of -// conditions and the following disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, -// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific prior -// written permission. -// -// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form -// without changes from the version obtained under this License, or (ii) Licensee makes a -// reference solely to the software portion of its product, Licensee must refer to the -// software as "EnergyPlus version X" software, where "X" is the version number Licensee -// obtained under this License and may not use a different name for the software. Except as -// specifically required in this Section (4), Licensee shall not use in a company name, a -// product name, in advertising, publicity, or other promotional activities any name, trade -// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly -// similar designation, without the U.S. Department of Energy's prior written consent. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// ObjexxFCL Headers -#include - -// EnergyPlus Headers -#include - -namespace EnergyPlus { - -namespace DataPrecisionGlobals { - - // Module containing the routines dealing with the precision of data in EnergyPlus - - // MODULE INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN January 2008 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS MODULE: - // This module allows for setting the default precision to "double precision" using - // F95 KIND and parameters. Should it ever be necessary to try a higher precision, it - // will be easy to switch for testing. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // USE STATEMENTS: - // na - - // Data - // MODULE PARAMETER DEFINITIONS: - int const i32(SELECTED_INT_KIND(6)); // 6 digits - int const i64(SELECTED_INT_KIND(12)); // 12 digits - int const r32(KIND(1.0)); - int const r64(KIND(1.0)); - int const default_prec(r64); - Real64 const constant_zero(0.0); - Real64 const constant_one(1.0); - Real64 const constant_minusone(-1.0); - Real64 const constant_twenty(20.0); - Real64 const constant_pointfive(0.5); - Real64 const EXP_LowerLimit(-20.0); // In IVF=2.061153622438558d-009 - used 20 - // because it's already used in other parts of the code - Real64 const EXP_UpperLimit(40.0); // In IVF=2.353852668370200d+017 - - // DERIVED TYPE DEFINITIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - // na - - // SUBROUTINE SPECIFICATIONS FOR MODULE: - // na - -} // namespace DataPrecisionGlobals - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/DataPrecisionGlobals.hh b/src/EnergyPlus/DataPrecisionGlobals.hh index dae4e865811..a33642778bd 100644 --- a/src/EnergyPlus/DataPrecisionGlobals.hh +++ b/src/EnergyPlus/DataPrecisionGlobals.hh @@ -51,28 +51,16 @@ // EnergyPlus Headers #include -namespace EnergyPlus { +namespace EnergyPlus::DataPrecisionGlobals { -namespace DataPrecisionGlobals { - - // Data - // MODULE PARAMETER DEFINITIONS: - extern int const i32; // 6 digits - extern int const i64; // 12 digits - extern int const r32; - extern int const r64; - extern int const default_prec; - extern Real64 const constant_zero; - extern Real64 const constant_one; - extern Real64 const constant_minusone; - extern Real64 const constant_twenty; - extern Real64 const constant_pointfive; - extern Real64 const EXP_LowerLimit; // In IVF=2.061153622438558d-009 - used 20 - // because it's already used in other parts of the code - extern Real64 const EXP_UpperLimit; // In IVF=2.353852668370200d+017 + constexpr Real64 constant_zero = 0.0; + constexpr Real64 constant_one = 1.0; + constexpr Real64 constant_minusone = -1.0; + constexpr Real64 constant_twenty = 20.0; + constexpr Real64 constant_pointfive = 0.5; + constexpr Real64 EXP_LowerLimit = -20.0; // In IVF=2.061153622438558d-009 - used 20 because it's already used in other parts of the code + constexpr Real64 EXP_UpperLimit = 40.0; // In IVF=2.353852668370200d+017 } // namespace DataPrecisionGlobals -} // namespace EnergyPlus - #endif diff --git a/src/EnergyPlus/DataReportingFlags.cc b/src/EnergyPlus/DataReportingFlags.cc deleted file mode 100644 index f90b03632a8..00000000000 --- a/src/EnergyPlus/DataReportingFlags.cc +++ /dev/null @@ -1,114 +0,0 @@ -// EnergyPlus, Copyright (c) 1996-2021, The Board of Trustees of the University of Illinois, -// The Regents of the University of California, through Lawrence Berkeley National Laboratory -// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge -// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other -// contributors. All rights reserved. -// -// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the -// U.S. Government consequently retains certain rights. As such, the U.S. Government has been -// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, -// worldwide license in the Software to reproduce, distribute copies to the public, prepare -// derivative works, and perform publicly and display publicly, and to permit others to do so. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted -// provided that the following conditions are met: -// -// (1) Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// (2) Redistributions in binary form must reproduce the above copyright notice, this list of -// conditions and the following disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, -// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific prior -// written permission. -// -// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form -// without changes from the version obtained under this License, or (ii) Licensee makes a -// reference solely to the software portion of its product, Licensee must refer to the -// software as "EnergyPlus version X" software, where "X" is the version number Licensee -// obtained under this License and may not use a different name for the software. Except as -// specifically required in this Section (4), Licensee shall not use in a company name, a -// product name, in advertising, publicity, or other promotional activities any name, trade -// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly -// similar designation, without the U.S. Department of Energy's prior written consent. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// EnergyPlus Headers -#include - -namespace EnergyPlus { - -namespace DataReportingFlags { - - // Module containing the data and routines dealing with Reporting Flags - - // MODULE INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN December 2008 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS MODULE: - // The module contains various reporting flags and character strings - // that are used in a small number of modules. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // USE STATEMENTS: - // na - - // Data - // MODULE PARAMETER DEFINITIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - int NumOfWarmupDays(0); // reinitialized for each environment. - std::string cWarmupDay; - bool DisplayPerfSimulationFlag(false); // True when "Performing Simulation" should be displayed - bool DoWeatherInitReporting(false); // Init reporting -- items that go onto OutputFileInits (eio) - bool PrintEndDataDictionary(false); // Flag for printing "End of Data Dictionary" on output files - bool MakeMirroredDetachedShading(true); // True (default) when Detached Shading Surfaces should be "mirrored" - bool MakeMirroredAttachedShading(true); // True (default) when Attached Shading Surfaces should be "mirrored" - bool DebugOutput(false); - bool EvenDuringWarmup(false); - - // MODULE SUBROUTINES: - - // Functions - void clear_state() { - NumOfWarmupDays = 0; - cWarmupDay.clear(); - DisplayPerfSimulationFlag = false; - DoWeatherInitReporting = false; - PrintEndDataDictionary = false; - MakeMirroredDetachedShading = true; - MakeMirroredAttachedShading = true; - DebugOutput = false; - EvenDuringWarmup = false; - } - -} // namespace DataReportingFlags - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/DataReportingFlags.hh b/src/EnergyPlus/DataReportingFlags.hh index 5cf4a6f2161..03bbf27ab92 100644 --- a/src/EnergyPlus/DataReportingFlags.hh +++ b/src/EnergyPlus/DataReportingFlags.hh @@ -57,29 +57,30 @@ namespace EnergyPlus { -namespace DataReportingFlags { +struct ReportFlagData : BaseGlobalStruct +{ - // MODULE VARIABLE DECLARATIONS: - extern int NumOfWarmupDays; // reinitialized for each environment. - extern std::string cWarmupDay; - extern bool DisplayPerfSimulationFlag; // True when "Performing Simulation" should be displayed - extern bool DoWeatherInitReporting; // Init reporting -- items that go onto OutputFileInits - extern bool PrintEndDataDictionary; // Flag for printing "End of Data Dictionary" on output files - extern bool MakeMirroredDetachedShading; // True (default) when Detached Shading Surfaces should be "mirrored" - extern bool MakeMirroredAttachedShading; // True (default) when Attached Shading Surfaces should be "mirrored" - extern bool DebugOutput; - extern bool EvenDuringWarmup; - - // Functions - void clear_state(); - -} // namespace DataReportingFlags - -struct ReportFlagData : BaseGlobalStruct { + int NumOfWarmupDays = 0; // reinitialized for each environment. + std::string cWarmupDay; + bool DisplayPerfSimulationFlag = false; // True when "Performing Simulation" should be displayed + bool DoWeatherInitReporting = false; // Init reporting -- items that go onto OutputFileInits (eio) + bool PrintEndDataDictionary = false; // Flag for printing "End of Data Dictionary" on output files + bool MakeMirroredDetachedShading = true; // True (default) when Detached Shading Surfaces should be "mirrored" + bool MakeMirroredAttachedShading = true; // True (default) when Attached Shading Surfaces should be "mirrored" + bool DebugOutput = false; + bool EvenDuringWarmup = false; void clear_state() override { - + this->NumOfWarmupDays = 0; + this->cWarmupDay.clear(); + this->DisplayPerfSimulationFlag = false; + this->DoWeatherInitReporting = false; + this->PrintEndDataDictionary = false; + this->MakeMirroredDetachedShading = true; + this->MakeMirroredAttachedShading = true; + this->DebugOutput = false; + this->EvenDuringWarmup = false; } }; diff --git a/src/EnergyPlus/DataRootFinder.cc b/src/EnergyPlus/DataRootFinder.cc deleted file mode 100644 index 5f779de56b0..00000000000 --- a/src/EnergyPlus/DataRootFinder.cc +++ /dev/null @@ -1,138 +0,0 @@ -// EnergyPlus, Copyright (c) 1996-2021, The Board of Trustees of the University of Illinois, -// The Regents of the University of California, through Lawrence Berkeley National Laboratory -// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge -// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other -// contributors. All rights reserved. -// -// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the -// U.S. Government consequently retains certain rights. As such, the U.S. Government has been -// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, -// worldwide license in the Software to reproduce, distribute copies to the public, prepare -// derivative works, and perform publicly and display publicly, and to permit others to do so. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted -// provided that the following conditions are met: -// -// (1) Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// (2) Redistributions in binary form must reproduce the above copyright notice, this list of -// conditions and the following disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, -// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific prior -// written permission. -// -// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form -// without changes from the version obtained under this License, or (ii) Licensee makes a -// reference solely to the software portion of its product, Licensee must refer to the -// software as "EnergyPlus version X" software, where "X" is the version number Licensee -// obtained under this License and may not use a different name for the software. Except as -// specifically required in this Section (4), Licensee shall not use in a company name, a -// product name, in advertising, publicity, or other promotional activities any name, trade -// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly -// similar designation, without the U.S. Department of Energy's prior written consent. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// EnergyPlus Headers -#include - -namespace EnergyPlus { - -namespace DataRootFinder { - - // MODULE INFORMATION: - // AUTHOR Dimitri Curtil - // DATE WRITTEN February 2006 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS MODULE: - // This data-only module is a repository for variables and types used by the - // RootFinder module. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // Using/Aliasing - // Data - // -only module should be available to other modules and routines. - // Thus, all variables in this module must be PUBLIC. - - // MODULE PARAMETER DEFINITIONS - int const iSlopeNone(0); // Undefined slope specification - int const iSlopeIncreasing(1); // For overall increasing function F(X) between min and max points - int const iSlopeDecreasing(-1); // For overall decreasing function F(X) between min and max points - - // Error because the overall slope appears to be flat between the min and max points, - // implying that the function might be singular over the interval: - // F(XMin) == F(XMax) - int const iStatusErrorSingular(-4); - // Error because the overall slope assumption is not observed at the min and max points: - // - for an increasing function F(X), we expect F(XMin) < F(XMax) otherwise error - // - for a decreasing function F(X), we expect F(XMin) > F(XMax) otherwise error - // Note that this error status does not detect strict monotonicity at points - // between the min and max points. - int const iStatusErrorSlope(-3); - // Error because the current candidate X does not lie within the current lower an upper points: - // X < XLower or X > XUpper - int const iStatusErrorBracket(-2); - // Error because the current candidate X does not lie within the min and max points: - // X < XMin or X > XMax - int const iStatusErrorRange(-1); - - int const iStatusNone(0); // Indeterminate error state (not converged), also default state - int const iStatusOK(1); // Unconstrained convergence achieved with root solution so that: - // XMin < XRoot < XMax - int const iStatusOKMin(2); // Constrained convergence achieved with solution XRoot==XMin - int const iStatusOKMax(3); // Constrained convergence achieved with solution XRoot==XMax - int const iStatusOKRoundOff(4); // Reached requested tolerance in X variables although Y=F(X) does not - // satisfy unconstrained convergence check - - int const iStatusWarningNonMonotonic(10); // Error because F(X) is not strictly monotonic between the - // lower and upper points - int const iStatusWarningSingular(11); // Error because F(X) == YLower or F(X) == YUpper - - int const iMethodNone(-1); // No solution method (used internally only when root finder is reset) - int const iMethodBracket(0); // Bracketting mode (used internally only to bracket root) - int const iMethodBisection(1); // Step performed using bisection method (aka interval halving) - int const iMethodFalsePosition(2); // Step performed using false position method (aka regula falsi) - int const iMethodSecant(3); // Step performed using secant method - int const iMethodBrent(4); // Step performed using Brent's method - // Names for each solution method type - Array1D_string const SolutionMethodTypes( - {-1, 4}, {"No solution method", "Bracketting method", "Bisection method", "False position method", "Secant method", "Brent method"}); - - // DERIVED TYPE DEFINITIONS - // Type declaration for the numerical controls. - - // Type declaration for iterate tracking. - - // Type declaration for the root finder solution technique. - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - // na - -} // namespace DataRootFinder - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/DataRootFinder.hh b/src/EnergyPlus/DataRootFinder.hh index 3cfa4f7da80..91c4a95f352 100644 --- a/src/EnergyPlus/DataRootFinder.hh +++ b/src/EnergyPlus/DataRootFinder.hh @@ -54,124 +54,102 @@ // EnergyPlus Headers #include -namespace EnergyPlus { - -namespace DataRootFinder { - - // Using/Aliasing - - // Data - // -only module should be available to other modules and routines. - // Thus, all variables in this module must be PUBLIC. - - // MODULE PARAMETER DEFINITIONS - extern int const iSlopeNone; // Undefined slope specification - extern int const iSlopeIncreasing; // For overall increasing function F(X) between min and max points - extern int const iSlopeDecreasing; // For overall decreasing function F(X) between min and max points - - // Error because the overall slope appears to be flat between the min and max points, - // implying that the function might be singular over the interval: - // F(XMin) == F(XMax) - extern int const iStatusErrorSingular; - // Error because the overall slope assumption is not observed at the min and max points: - // - for an increasing function F(X), we expect F(XMin) < F(XMax) otherwise error - // - for a decreasing function F(X), we expect F(XMin) > F(XMax) otherwise error - // Note that this error status does not detect strict monotonicity at points - // between the min and max points. - extern int const iStatusErrorSlope; - // Error because the current candidate X does not lie within the current lower an upper points: - // X < XLower or X > XUpper - extern int const iStatusErrorBracket; - // Error because the current candidate X does not lie within the min and max points: - // X < XMin or X > XMax - extern int const iStatusErrorRange; - - extern int const iStatusNone; // Indeterminate error state (not converged), also default state - extern int const iStatusOK; // Unconstrained convergence achieved with root solution so that: - // XMin < XRoot < XMax - extern int const iStatusOKMin; // Constrained convergence achieved with solution XRoot==XMin - extern int const iStatusOKMax; // Constrained convergence achieved with solution XRoot==XMax - extern int const iStatusOKRoundOff; // Reached requested tolerance in X variables although Y=F(X) does not - // satisfy unconstrained convergence check - - extern int const iStatusWarningNonMonotonic; // Error because F(X) is not strictly monotonic between the - // lower and upper points - extern int const iStatusWarningSingular; // Error because F(X) == YLower or F(X) == YUpper - - extern int const iMethodNone; // No solution method (used internally only when root finder is reset) - extern int const iMethodBracket; // Bracketting mode (used internally only to bracket root) - extern int const iMethodBisection; // Step performed using bisection method (aka interval halving) - extern int const iMethodFalsePosition; // Step performed using false position method (aka regula falsi) - extern int const iMethodSecant; // Step performed using secant method - extern int const iMethodBrent; // Step performed using Brent's method - // Names for each solution method type - extern Array1D_string const SolutionMethodTypes; - - // DERIVED TYPE DEFINITIONS - // Type declaration for the numerical controls. - - // Type declaration for iterate tracking. - - // Type declaration for the root finder solution technique. - - // Types - - struct ControlsType +namespace EnergyPlus::DataRootFinder { + +constexpr int iSlopeNone(0); // Undefined slope specification +constexpr int iSlopeIncreasing(1); // For overall increasing function F(X) between min and max points +constexpr int iSlopeDecreasing(-1); // For overall decreasing function F(X) between min and max points + +enum class iStatus +{ + ErrorSingular, // Error because the overall slope appears to be flat between the min and max points, implying that the + // function might be singular over the interval: F(XMin) == F(XMax) + + ErrorSlope, // Error because the overall slope assumption is not observed at the min and max points: + // - for an increasing function F(X), we expect F(XMin) < F(XMax) otherwise error + // - for a decreasing function F(X), we expect F(XMin) > F(XMax) otherwise error + // Note that this error status does not detect strict monotonicity at points + // between the min and max points. + + ErrorBracket, // Error because the current candidate X does not lie within the current lower an upper points: + // X < XLower or X > XUpper + + ErrorRange, // Error because the current candidate X does not lie within the min and max points: + // X < XMin or X > XMax + + None, // Indeterminate error state (not converged), also default state + OK, // Unconstrained convergence achieved with root solution so that: XMin < XRoot < XMax + OKMin, // Constrained convergence achieved with solution XRoot==XMin + OKMax, // Constrained convergence achieved with solution XRoot==XMax + OKRoundOff, // Reached requested tolerance in X variables although Y=F(X) does not satisfy unconstrained convergence check + WarningNonMonotonic, // Error because F(X) is not strictly monotonic between the lower and upper points + WarningSingular, // Error because F(X) == YLower or F(X) == YUpper +}; + +enum class iMethod +{ + None, // No solution method (used internally only when root finder is reset) + Bracket, // Bracketing mode (used internally only to bracket root) + Bisection, // Step performed using bisection method (aka interval halving) + FalsePosition, // Step performed using false position method (aka regula falsi) + Secant, // Step performed using secant method + Brent, // Step performed using Brent's method +}; + +struct ControlsType +{ + // Members + int SlopeType; // Set to any of the iSlope<...> codes + iMethod MethodType; // Desired solution method. + // Set to any of the iMethod<...> codes except for iMethodNone and iMethodBracket + Real64 TolX; // Relative tolerance for variable X + Real64 ATolX; // Absolute tolerance for variable X + Real64 ATolY; // Absolute tolerance for variable Y + + // Default Constructor + ControlsType() : SlopeType(iSlopeNone), MethodType(iMethod::None), TolX(1.0e-3), ATolX(1.0e-3), ATolY(1.0e-3) { - // Members - int SlopeType; // Set to any of the iSlope<...> codes - int MethodType; // Desired solution method. - // Set to any of the iMethod<...> codes except for iMethodNone and iMethodBracket - Real64 TolX; // Relative tolerance for variable X - Real64 ATolX; // Absolute tolerance for variable X - Real64 ATolY; // Absolute tolerance for variable Y - - // Default Constructor - ControlsType() : SlopeType(iSlopeNone), MethodType(iMethodNone), TolX(1.0e-3), ATolX(1.0e-3), ATolY(1.0e-3) - { - } - }; - - struct PointType + } +}; + +struct PointType +{ + // Members + bool DefinedFlag; // Set to true if point has been set; false otherwise + Real64 X; // X value + Real64 Y; // Y value = F(X) + + // Default Constructor + PointType() : DefinedFlag(false), X(0.0), Y(0.0) { - // Members - bool DefinedFlag; // Set to true if point has been set; false otherwise - Real64 X; // X value - Real64 Y; // Y value = F(X) - - // Default Constructor - PointType() : DefinedFlag(false), X(0.0), Y(0.0) - { - } - }; - - struct RootFinderDataType + } +}; + +struct RootFinderDataType +{ + // Members + ControlsType Controls; + iStatus StatusFlag; // Current status of root finder + // Valid values are any of the STATUS_ constants + iMethod CurrentMethodType; // Solution method used to perform current step + Real64 XCandidate; // Candidate X value to use next when evaluating F(X) + Real64 ConvergenceRate; // Convergence rate achieved over the last 2 successive iterations + PointType Increment; // Increment between last 2 iterations + PointType MinPoint; // Point { XMin, F(XMin) } + PointType MaxPoint; // Point { XMax, F(XMax) } + PointType LowerPoint; // Point { XLower, F(XLower) } so that XLower <= XRoot + PointType UpperPoint; // Point { XUpper, F(XUpper) } so that XRoot <= YUpper + PointType CurrentPoint; // Last evaluated point { X, F(X) } + int NumHistory; // Number of points stored in History + Array1D History; // Vector containing last 3 best iterates + + // Default Constructor + RootFinderDataType() + : StatusFlag(iStatus::None), CurrentMethodType(iMethod::None), XCandidate(0.0), ConvergenceRate(0.0), NumHistory(0), History(3) { - // Members - ControlsType Controls; - int StatusFlag; // Current status of root finder - // Valid values are any of the STATUS_ constants - int CurrentMethodType; // Solution method used to perform current step - Real64 XCandidate; // Candidate X value to use next when evaluating F(X) - Real64 ConvergenceRate; // Convergence rate achieved over the last 2 successive iterations - PointType Increment; // Increment between last 2 iterations - PointType MinPoint; // Point { XMin, F(XMin) } - PointType MaxPoint; // Point { XMax, F(XMax) } - PointType LowerPoint; // Point { XLower, F(XLower) } so that XLower <= XRoot - PointType UpperPoint; // Point { XUpper, F(XUpper) } so that XRoot <= YUpper - PointType CurrentPoint; // Last evaluated point { X, F(X) } - int NumHistory; // Number of points stored in History - Array1D History; // Vector containing last 3 best iterates - - // Default Constructor - RootFinderDataType() - : StatusFlag(iStatusNone), CurrentMethodType(iMethodNone), XCandidate(0.0), ConvergenceRate(0.0), NumHistory(0), History(3) - { - } - }; - -} // namespace DataRootFinder - -} // namespace EnergyPlus + } +}; + +} // namespace EnergyPlus::DataRootFinder #endif diff --git a/src/EnergyPlus/DataSurfaceLists.cc b/src/EnergyPlus/DataSurfaceLists.cc index 04fc926a289..78e648981a9 100644 --- a/src/EnergyPlus/DataSurfaceLists.cc +++ b/src/EnergyPlus/DataSurfaceLists.cc @@ -69,45 +69,6 @@ namespace EnergyPlus::DataSurfaceLists { // This data-only module contains type definitions and variables // associated with Radiant System Surface Groups. - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // Using/Aliasing - // Data - // -only module should be available to other modules and routines. - // Thus, all variables in this module must be PUBLIC. - - // MODULE PARAMETER DEFINITIONS: - - // DERIVED TYPE DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // MODULE VARIABLE DECLARATIONS: - - int NumOfSurfaceLists(0); // Number of surface lists in the user input file - int NumOfSurfListVentSlab(0); // Number of surface lists in the user input file - bool SurfaceListInputsFilled(false); // Set to TRUE after first pass through air loop - - // Object Data - Array1D SurfList; - Array1D SlabList; - - // Functions - - void clear_state() - { - NumOfSurfaceLists = 0; - NumOfSurfListVentSlab = 0; - SurfaceListInputsFilled = false; - SurfList.deallocate(); - SlabList.deallocate(); - } - void GetSurfaceListsInputs(EnergyPlusData &state) { @@ -155,6 +116,11 @@ namespace EnergyPlus::DataSurfaceLists { // Obtain all of the user data related to surface lists. Need to get // this before getting the radiant system or ventilated slab data. + auto &SurfList(state.dataSurfLists->SurfList); + auto &SlabList(state.dataSurfLists->SlabList); + auto &NumOfSurfaceLists(state.dataSurfLists->NumOfSurfaceLists); + auto &NumOfSurfListVentSlab(state.dataSurfLists->NumOfSurfListVentSlab); + ErrorsFound = false; NumOfSurfaceLists = inputProcessor->getNumObjectsFound(state, CurrentModuleObject1); NumOfSurfListVentSlab = inputProcessor->getNumObjectsFound(state, CurrentModuleObject2); @@ -377,39 +343,15 @@ namespace EnergyPlus::DataSurfaceLists { // PURPOSE OF THIS FUNCTION: // Acts as a target for outside routines to make sure data is gotten before using. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value int NumberOfSurfaceLists; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - if (!SurfaceListInputsFilled) { + if (!state.dataSurfLists->SurfaceListInputsFilled) { GetSurfaceListsInputs(state); - SurfaceListInputsFilled = true; + state.dataSurfLists->SurfaceListInputsFilled = true; } - NumberOfSurfaceLists = NumOfSurfaceLists; + NumberOfSurfaceLists = state.dataSurfLists->NumOfSurfaceLists; return NumberOfSurfaceLists; } @@ -425,39 +367,15 @@ namespace EnergyPlus::DataSurfaceLists { // PURPOSE OF THIS FUNCTION: // Acts as a target for outside routines to make sure data is gotten before using. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value int NumberOfSurfListVentSlab; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - if (!SurfaceListInputsFilled) { + if (!state.dataSurfLists->SurfaceListInputsFilled) { GetSurfaceListsInputs(state); - SurfaceListInputsFilled = true; + state.dataSurfLists->SurfaceListInputsFilled = true; } - NumberOfSurfListVentSlab = NumOfSurfListVentSlab; + NumberOfSurfListVentSlab = state.dataSurfLists->NumOfSurfListVentSlab; return NumberOfSurfListVentSlab; } diff --git a/src/EnergyPlus/DataSurfaceLists.hh b/src/EnergyPlus/DataSurfaceLists.hh index 6a878a8a2a0..91f1068845c 100644 --- a/src/EnergyPlus/DataSurfaceLists.hh +++ b/src/EnergyPlus/DataSurfaceLists.hh @@ -63,28 +63,6 @@ struct EnergyPlusData; namespace DataSurfaceLists { - // Using/Aliasing - - // Data - // -only module should be available to other modules and routines. - // Thus, all variables in this module must be PUBLIC. - - // MODULE PARAMETER DEFINITIONS: - - // DERIVED TYPE DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // MODULE VARIABLE DECLARATIONS: - - extern int NumOfSurfaceLists; // Number of surface lists in the user input file - extern int NumOfSurfListVentSlab; // Number of surface lists in the user input file - extern bool SurfaceListInputsFilled; // Set to TRUE after first pass through air loop - - // CHARACTER(len=*), PARAMETER :: CurrentModuleObject = ' ' - // SUBROUTINE SPECIFICATIONS FOR MODULE DataSurfaceLists - // Types struct SurfaceListData @@ -123,14 +101,6 @@ namespace DataSurfaceLists { } }; - // Object Data - extern Array1D SurfList; - extern Array1D SlabList; - - // Functions - - void clear_state(); - void GetSurfaceListsInputs(EnergyPlusData &state); int GetNumberOfSurfaceLists(EnergyPlusData &state); @@ -141,9 +111,19 @@ namespace DataSurfaceLists { struct SurfaceListsData : BaseGlobalStruct { + int NumOfSurfaceLists = 0; // Number of surface lists in the user input file + int NumOfSurfListVentSlab = 0; // Number of surface lists in the user input file + bool SurfaceListInputsFilled = false; // Set to TRUE after first pass through air loop + Array1D SurfList; + Array1D SlabList; + void clear_state() override { - + this->NumOfSurfaceLists = 0; + this->NumOfSurfListVentSlab = 0; + this->SurfaceListInputsFilled = false; + this->SurfList.deallocate(); + this->SlabList.deallocate(); } }; diff --git a/src/EnergyPlus/DemandManager.cc b/src/EnergyPlus/DemandManager.cc index 62d7c1b72a3..c64b12d58ab 100644 --- a/src/EnergyPlus/DemandManager.cc +++ b/src/EnergyPlus/DemandManager.cc @@ -96,13 +96,6 @@ namespace EnergyPlus::DemandManager { // Locals // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ListNum; - static bool firstTime; // Flag to allow Demand Manager List to simulate at least once - static bool ResimExt; // Flag to resimulate the exterior energy use simulation - static bool ResimHB; // Flag to resimulate the heat balance simulation (including HVAC) - static bool ResimHVAC; // Flag to resimulate the HVAC simulation - static bool BeginDemandSim; // TRUE in the first timestep after warmup of a new environment - static bool ClearHistory; // TRUE in the first timestep during warmup of a new environment - if (state.dataDemandManager->GetInput && !state.dataGlobal->DoingSizing) { GetDemandManagerInput(state); @@ -113,8 +106,8 @@ namespace EnergyPlus::DemandManager { if (state.dataDemandManager->NumDemandManagerList > 0) { if (state.dataGlobal->WarmupFlag) { - BeginDemandSim = true; - if (ClearHistory) { + state.dataDemandManager->BeginDemandSim = true; + if (state.dataDemandManager->ClearHistory) { // Clear historical variables for (ListNum = 1; ListNum <= state.dataDemandManager->NumDemandManagerList; ++ListNum) { state.dataDemandManager->DemandManagerList(ListNum).History = 0.0; @@ -136,37 +129,37 @@ namespace EnergyPlus::DemandManager { e.RotatedLoadNum = 0; } } - ClearHistory = false; + state.dataDemandManager->ClearHistory = false; } if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing) { - if (BeginDemandSim) { - BeginDemandSim = false; - ClearHistory = true; + if (state.dataDemandManager->BeginDemandSim) { + state.dataDemandManager->BeginDemandSim = false; + state.dataDemandManager->ClearHistory = true; } state.dataDemandManager->DemandManagerExtIterations = 0; state.dataDemandManager->DemandManagerHBIterations = 0; state.dataDemandManager->DemandManagerHVACIterations = 0; - firstTime = true; - ResimExt = false; - ResimHB = false; - ResimHVAC = false; + state.dataDemandManager->firstTime = true; + state.dataDemandManager->ResimExt = false; + state.dataDemandManager->ResimHB = false; + state.dataDemandManager->ResimHVAC = false; - while (firstTime || ResimExt || ResimHB || ResimHVAC) { - firstTime = false; + while (state.dataDemandManager->firstTime || state.dataDemandManager->ResimExt || state.dataDemandManager->ResimHB || state.dataDemandManager->ResimHVAC) { + state.dataDemandManager->firstTime = false; - Resimulate(state, ResimExt, ResimHB, ResimHVAC); - ResimExt = false; - ResimHB = false; - ResimHVAC = false; + Resimulate(state, state.dataDemandManager->ResimExt, state.dataDemandManager->ResimHB, state.dataDemandManager->ResimHVAC); + state.dataDemandManager->ResimExt = false; + state.dataDemandManager->ResimHB = false; + state.dataDemandManager->ResimHVAC = false; SurveyDemandManagers(state); // Determines which Demand Managers can reduce demand for (ListNum = 1; ListNum <= state.dataDemandManager->NumDemandManagerList; ++ListNum) { - SimulateDemandManagerList(state, ListNum, ResimExt, ResimHB, ResimHVAC); + SimulateDemandManagerList(state, ListNum, state.dataDemandManager->ResimExt, state.dataDemandManager->ResimHB, state.dataDemandManager->ResimHVAC); } // ListNum ActivateDemandManagers(state); // Sets limits on loads @@ -328,7 +321,7 @@ namespace EnergyPlus::DemandManager { Array1D_string AlphArray; // Character string data Array1D NumArray; // Numeric data std::string Units; // String for meter units - static bool ErrorsFound(false); + bool ErrorsFound(false); std::string CurrentModuleObject; // for ease in renaming. @@ -591,7 +584,7 @@ namespace EnergyPlus::DemandManager { int IOStat; // IO Status when calling get input subroutine Array1D_string AlphArray; // Character string data Array1D NumArray; // Numeric data - static bool ErrorsFound(false); + bool ErrorsFound(false); std::string CurrentModuleObject; // for ease in renaming. int Item; int Item1; diff --git a/src/EnergyPlus/DemandManager.hh b/src/EnergyPlus/DemandManager.hh index 5d20a24847d..d7fc4772bab 100644 --- a/src/EnergyPlus/DemandManager.hh +++ b/src/EnergyPlus/DemandManager.hh @@ -213,6 +213,12 @@ struct DemandManagerData : BaseGlobalStruct { Array1D DemandManagerList; Array1D DemandMgr; std::unordered_map UniqueDemandMgrNames; + bool ClearHistory = true; + bool BeginDemandSim = true; + bool ResimHVAC = true; + bool ResimHB = true; + bool ResimExt = true; + bool firstTime = true; void clear_state() override { @@ -225,6 +231,12 @@ struct DemandManagerData : BaseGlobalStruct { DemandManagerList.deallocate(); DemandMgr.deallocate(); UniqueDemandMgrNames.clear(); + ClearHistory = true; + BeginDemandSim = true; + ResimHVAC = true; + ResimHB = true; + ResimExt = true; + firstTime = true; } }; diff --git a/src/EnergyPlus/EvaporativeCoolers.cc b/src/EnergyPlus/EvaporativeCoolers.cc index 1dae336ab64..81a422d3a2c 100644 --- a/src/EnergyPlus/EvaporativeCoolers.cc +++ b/src/EnergyPlus/EvaporativeCoolers.cc @@ -3553,7 +3553,7 @@ namespace EvaporativeCoolers { GetFanInletNode(state, ZoneEvapUnit(UnitLoop).FanObjectClassName, ZoneEvapUnit(UnitLoop).FanName, errFlag); ZoneEvapUnit(UnitLoop).FanOutletNodeNum = GetFanOutletNode(state, ZoneEvapUnit(UnitLoop).FanObjectClassName, ZoneEvapUnit(UnitLoop).FanName, errFlag); - GetFanVolFlow(ZoneEvapUnit(UnitLoop).FanIndex, FanVolFlow); + GetFanVolFlow(state, ZoneEvapUnit(UnitLoop).FanIndex, FanVolFlow); ZoneEvapUnit(UnitLoop).ActualFanVolFlowRate = FanVolFlow; // Get the fan's availability schedule ZoneEvapUnit(UnitLoop).FanAvailSchedPtr = @@ -3927,7 +3927,7 @@ namespace EvaporativeCoolers { ZoneEvapUnit(UnitNum).MyFan = false; } else { if (ZoneEvapUnit(UnitNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - GetFanVolFlow(ZoneEvapUnit(UnitNum).FanIndex, ZoneEvapUnit(UnitNum).ActualFanVolFlowRate); + GetFanVolFlow(state, ZoneEvapUnit(UnitNum).FanIndex, ZoneEvapUnit(UnitNum).ActualFanVolFlowRate); } else { ZoneEvapUnit(UnitNum).ActualFanVolFlowRate = HVACFan::fanObjs[ZoneEvapUnit(UnitNum).FanIndex]->designAirVolFlowRate; } diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 12e975cdf32..fd2977f0eba 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -2621,7 +2621,7 @@ namespace FanCoilUnits { FanCoil(FanCoilNum).SensCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QUnitOut)); FanCoil(FanCoilNum).TotCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QTotUnitOut)); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanCoil(FanCoilNum).ElecPower = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } @@ -2950,7 +2950,7 @@ namespace FanCoilUnits { FanCoil(FanCoilNum).SensCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QUnitOut)); FanCoil(FanCoilNum).TotCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QTotUnitOut)); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanCoil(FanCoilNum).ElecPower = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } @@ -3287,7 +3287,7 @@ namespace FanCoilUnits { FanCoil(FanCoilNum).SensCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QSensUnitOutNoATM)); FanCoil(FanCoilNum).TotCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QTotUnitOut)); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanCoil(FanCoilNum).ElecPower = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } @@ -3309,7 +3309,7 @@ namespace FanCoilUnits { FanCoil(FanCoilNum).SensCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QSensUnitOutNoATM)); FanCoil(FanCoilNum).TotCoolPower = std::abs(min(DataPrecisionGlobals::constant_zero, QTotUnitOut)); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanCoil(FanCoilNum).ElecPower = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanCoil(FanCoilNum).ElecPower = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } @@ -4309,7 +4309,7 @@ namespace FanCoilUnits { state.dataFanCoilUnits->FanFlowRatio = LowSpeedRatio; Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutMaxLS); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanElecPowerLS = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanElecPowerLS = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanElecPowerLS = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } @@ -4324,7 +4324,7 @@ namespace FanCoilUnits { state.dataFanCoilUnits->FanFlowRatio = HighSpeedRatio; Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutMaxHS); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanElecPowerHS = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanElecPowerHS = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanElecPowerHS = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } @@ -4494,7 +4494,7 @@ namespace FanCoilUnits { state.dataFanCoilUnits->FanFlowRatio = LowSpeedRatio; Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutMaxLS); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanElecPowerLS = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanElecPowerLS = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanElecPowerLS = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } @@ -4509,7 +4509,7 @@ namespace FanCoilUnits { state.dataFanCoilUnits->FanFlowRatio = HighSpeedRatio; Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutMaxHS); if (FanCoil(FanCoilNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - FanElecPowerHS = Fans::GetFanPower(FanCoil(FanCoilNum).FanIndex); + FanElecPowerHS = Fans::GetFanPower(state, FanCoil(FanCoilNum).FanIndex); } else { FanElecPowerHS = HVACFan::fanObjs[FanCoil(FanCoilNum).FanIndex]->fanPower(); } diff --git a/src/EnergyPlus/Fans.cc b/src/EnergyPlus/Fans.cc index 406b3685986..d19a49cd60e 100644 --- a/src/EnergyPlus/Fans.cc +++ b/src/EnergyPlus/Fans.cc @@ -76,9 +76,7 @@ #include #include -namespace EnergyPlus { - -namespace Fans { +namespace EnergyPlus::Fans { // Module containing the fan simulation routines // MODULE INFORMATION: @@ -93,12 +91,6 @@ namespace Fans { // To encapsulate the data and algorithms required to // manage the Fan System Component - // REFERENCES: none - - // OTHER NOTES: none - - // USE STATEMENTS: - // Use statements for data only modules // Using/Aliasing using namespace DataLoopNode; using DataHVACGlobals::BalancedExhMassFlow; @@ -126,44 +118,6 @@ namespace Fans { using Psychrometrics::PsyTdbFnHW; using namespace ScheduleManager; - namespace { - // These were static variables within different functions. They were pulled out into the namespace - // to facilitate easier unit testing of those functions. - // These are purposefully not in the header file as an extern variable. No one outside of this module 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. - bool MyOneTimeFlag(true); // used for allocation in Init - bool ZoneEquipmentListChecked(false); // True after the Zone Equipment List has been checked for items - - Array1D_bool MySizeFlag; - Array1D_bool MyEnvrnFlag; - Array1D_bool CheckEquipName; - } // namespace - - // Subroutine Specifications for the Module - // Driver/Manager Routines - - // Get Input routines for module - - // Initialization routines for module - - // Algorithms for the module - - // Update routine to check convergence and update nodes - - // Reporting routines for module - - // Utility routines for module - - // Object Data - Array1D Fan; - std::unordered_map UniqueFanNames; - Array1D NightVentPerf; - Array1D FanNumericFields; - - // MODULE SUBROUTINES: - //************************************************************************* - void SimulateFanComponents(EnergyPlusData &state, std::string const &CompName, bool const FirstHVACIteration, @@ -184,12 +138,10 @@ namespace Fans { // PURPOSE OF THIS SUBROUTINE: // This subroutine manages Fan component simulation. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int FanNum; // current fan number - + auto & Fan(state.dataFans->Fan); // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered @@ -212,7 +164,7 @@ namespace Fans { state.dataFans->NumFans, CompName)); } - if (CheckEquipName(FanNum)) { + if (state.dataFans->CheckEquipName(FanNum)) { if (!CompName.empty() && CompName != Fan(FanNum).FanName) { ShowFatalError(state, format("SimulateFanComponents: Invalid CompIndex passed={}, Fan name={}, stored Fan Name for that index={}", @@ -220,7 +172,7 @@ namespace Fans { CompName, Fan(FanNum).FanName)); } - CheckEquipName(FanNum) = false; + state.dataFans->CheckEquipName(FanNum) = false; } } @@ -280,9 +232,6 @@ namespace Fans { // PURPOSE OF THIS SUBROUTINE: // Obtains input data for fans and stores it in fan data structures - // METHODOLOGY EMPLOYED: - // Uses "Get" routines to read in data. - // Using/Aliasing using BranchNodeConnections::TestCompSet; using CurveManager::GetCurveIndex; @@ -319,6 +268,11 @@ namespace Fans { int MaxAlphas; int MaxNumbers; + auto & Fan(state.dataFans->Fan); + auto & FanNumericFields(state.dataFans->FanNumericFields); + auto & UniqueFanNames(state.dataFans->UniqueFanNames); + auto & NightVentPerf(state.dataFans->NightVentPerf); + state.dataFans->GetFanInputFlag = false; MaxAlphas = 0; @@ -374,7 +328,7 @@ namespace Fans { FanNumericFields.allocate(state.dataFans->NumFans); UniqueFanNames.reserve(state.dataFans->NumFans); } - CheckEquipName.dimension(state.dataFans->NumFans, true); + state.dataFans->CheckEquipName.dimension(state.dataFans->NumFans, true); for (SimpFanNum = 1; SimpFanNum <= NumSimpFan; ++SimpFanNum) { FanNum = SimpFanNum; @@ -988,7 +942,7 @@ namespace Fans { bool anyRan; ManageEMS(state, EMSManager::EMSCallFrom::ComponentGetInput, anyRan, ObjexxFCL::Optional_int_const()); - MySizeFlag.dimension(state.dataFans->NumFans, true); + state.dataFans->MySizeFlag.dimension(state.dataFans->NumFans, true); } // End of Get Input subroutines for the HB Module @@ -1024,18 +978,19 @@ namespace Fans { int OutNode; int Loop; + auto & Fan(state.dataFans->Fan); + auto & NightVentPerf(state.dataFans->NightVentPerf); + if (state.dataFans->MyOneTimeFlag) { - if (MyOneTimeFlag) { - - MyEnvrnFlag.dimension(state.dataFans->NumFans, true); + state.dataFans->MyEnvrnFlag.dimension(state.dataFans->NumFans, true); - MyOneTimeFlag = false; + state.dataFans->MyOneTimeFlag = false; } // need to check all fans to see if they are on Zone Equipment List or issue warning - if (!ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { - ZoneEquipmentListChecked = true; + if (!state.dataFans->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { + state.dataFans->ZoneEquipmentListChecked = true; for (Loop = 1; Loop <= state.dataFans->NumFans; ++Loop) { if (!UtilityRoutines::SameString(Fan(Loop).FanType, "Fan:ZoneExhaust")) continue; if (CheckZoneEquipmentList(state, Fan(Loop).FanType, Fan(Loop).FanName)) continue; @@ -1044,7 +999,7 @@ namespace Fans { } } - if (!state.dataGlobal->SysSizingCalc && MySizeFlag(FanNum)) { + if (!state.dataGlobal->SysSizingCalc && state.dataFans->MySizeFlag(FanNum)) { SizeFan(state, FanNum); // Set the loop cycling flag @@ -1054,11 +1009,11 @@ namespace Fans { } } - MySizeFlag(FanNum) = false; + state.dataFans->MySizeFlag(FanNum) = false; } // Do the Begin Environment initializations - if (state.dataGlobal->BeginEnvrnFlag && MyEnvrnFlag(FanNum)) { + if (state.dataGlobal->BeginEnvrnFlag && state.dataFans->MyEnvrnFlag(FanNum)) { // For all Fan inlet nodes convert the Volume flow to a mass flow // unused0909 InNode = Fan(FanNum)%InletNodeNum @@ -1093,11 +1048,11 @@ namespace Fans { Fan(FanNum).PowerLossToAir = 0.0; Fan(FanNum).FanEnergy = 0.0; - MyEnvrnFlag(FanNum) = false; + state.dataFans->MyEnvrnFlag(FanNum) = false; } if (!state.dataGlobal->BeginEnvrnFlag) { - MyEnvrnFlag(FanNum) = true; + state.dataFans->MyEnvrnFlag(FanNum) = true; } // Do the Begin Day initializations @@ -1162,27 +1117,15 @@ namespace Fans { // METHODOLOGY EMPLOYED: // Obtains flow rates from the zone or system sizing arrays. - // REFERENCES: - // na - // Using/Aliasing using namespace DataSizing; using namespace OutputReportPredefined; using CurveManager::CurveValue; using CurveManager::GetCurveIndex; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("SizeFan: "); // include trailing blank space - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NVPerfNum; // Index to night ventialation performance object std::string equipName; // Equipment name @@ -1213,6 +1156,10 @@ namespace Fans { int FieldNum = 2; // IDD numeric field number where input field description is found int NumFansSized = 0; // counter used to deallocate temporary string array after all fans have been sized + auto & Fan(state.dataFans->Fan); + auto & FanNumericFields(state.dataFans->FanNumericFields); + auto & NightVentPerf(state.dataFans->NightVentPerf); + if (Fan(FanNum).FanType_Num == FanType_ComponentModel) { FieldNum = 1; } else { @@ -1482,12 +1429,6 @@ namespace Fans { if (++NumFansSized == state.dataFans->NumFans) FanNumericFields.deallocate(); // remove temporary array for field names at end of sizing } - // End Initialization Section of the Module - //****************************************************************************** - - // Begin Algorithm Section of the Module - //****************************************************************************** - void SimSimpleFan(EnergyPlusData &state, int const FanNum) { @@ -1509,21 +1450,6 @@ namespace Fans { // REFERENCES: // ASHRAE HVAC 2 Toolkit, page 2-3 (FANSIM) - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 RhoAir; Real64 DeltaPress; // [N/m2] @@ -1531,12 +1457,13 @@ namespace Fans { Real64 MotInAirFrac; Real64 MotEff; Real64 MassFlow; // [kg/sec] - // unused0909 REAL(r64) Tin ! [C] - // unused0909 REAL(r64) Win Real64 FanShaftPower; // power delivered to fan shaft int NVPerfNum; + auto & Fan(state.dataFans->Fan); + auto & NightVentPerf(state.dataFans->NightVentPerf); + NVPerfNum = Fan(FanNum).NVPerfNum; if (NightVentOn && NVPerfNum > 0) { @@ -1642,21 +1569,6 @@ namespace Fans { // REFERENCES: // ASHRAE HVAC 2 Toolkit, page 2-3 (FANSIM) - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 RhoAir; Real64 DeltaPress; // [N/m2 = Pa] @@ -1667,10 +1579,7 @@ namespace Fans { Real64 MotInAirFrac; Real64 MotEff; Real64 MassFlow; // [kg/sec] - // unused0909 REAL(r64) Tin ! [C] - // unused0909 REAL(r64) Win Real64 PartLoadFrac; - // unused0909 REAL(r64) MaxFlowFrac !Variable Volume Fan Max Flow Fraction [-] Real64 MinFlowFrac; // Variable Volume Fan Min Flow Fraction [-] static Real64 FlowFracForPower(0.0); // Variable Volume Fan Flow Fraction for power calcs[-] static Real64 FlowFracActual(0.0); // actual VAV fan flow fraction @@ -1689,6 +1598,9 @@ namespace Fans { // DISCHARGE DAMPERS 0.37073425 0.97250253 -0.34240761 0.000 0.000 // VARIABLE SPEED MOTOR 0.0015302446 0.0052080574 1.1086242 -0.11635563 0.000 + auto & Fan(state.dataFans->Fan); + auto & NightVentPerf(state.dataFans->NightVentPerf); + NVPerfNum = Fan(FanNum).NVPerfNum; MaxAirFlowRate = Fan(FanNum).MaxAirFlowRate; @@ -1859,35 +1771,21 @@ namespace Fans { // Using/Aliasing using CurveManager::CurveValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 RhoAir; Real64 DeltaPress; // [N/m2] Real64 FanEff; Real64 MassFlow; // [kg/sec] Real64 MaxAirMassFlowRate; // [kg/sec] - // unused0909 REAL(r64) Tin ! [C] - // unused0909 REAL(r64) Win Real64 PartLoadRatio; // Ratio of actual mass flow rate to max mass flow rate Real64 FlowFrac; // Actual Fan Flow Fraction = actual mass flow rate / max air mass flow rate Real64 FanShaftPower; // power delivered to fan shaft Real64 SpeedRaisedToPower; // Result of the speed ratio raised to the power of n (Curve object) - Real64 EffRatioAtSpeedRatio; // Efficeincy ratio at current speed ratio (Curve object) + Real64 EffRatioAtSpeedRatio; // Efficiency ratio at current speed ratio (Curve object) static int ErrCount(0); - // unused0909 Tin = Fan(FanNum)%InletAirTemp - // unused0909 Win = Fan(FanNum)%InletAirHumRat + auto & Fan(state.dataFans->Fan); + MassFlow = Fan(FanNum).InletAirMassFlowRate; MaxAirMassFlowRate = Fan(FanNum).MaxAirMassFlowRate; DeltaPress = Fan(FanNum).DeltaPress; @@ -2048,21 +1946,6 @@ namespace Fans { // REFERENCES: // ASHRAE HVAC 2 Toolkit, page 2-3 (FANSIM) - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 RhoAir; Real64 DeltaPress; // [N/m2] @@ -2071,6 +1954,8 @@ namespace Fans { Real64 Tin; // [C] bool FanIsRunning = false; // There seems to be a missing else case below unless false is assumed + auto & Fan(state.dataFans->Fan); + DeltaPress = Fan(FanNum).DeltaPress; if (Fan(FanNum).EMSFanPressureOverrideOn) DeltaPress = Fan(FanNum).EMSFanPressureValue; @@ -2177,45 +2062,15 @@ namespace Fans { // Calculate air temperature rise due to fan (and belt+motor if in airstream) power entering air-handler airflow // Calculate output node conditions - // REFERENCES: - // TBD - // Using/Aliasing using CurveManager::CurveValue; using CurveManager::GetCurveIndex; using namespace OutputReportPredefined; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NVPerfNum; Real64 MaxAirMassFlowRate; // Fan Max mass airflow [kg/s] - // unused062011 REAL(r64) MinFlowFrac ! Fan Min Volumetric airflow Fraction [-] - // unused062011 REAL(r64) FlowFrac ! Fan Volumetric airflow Fraction [-] - - // unused062011 REAL(r64) DeltaPress ! Delta Pressure Across the Fan (Fan Static Pressure Rise) [N/m2 = Pa] - // unused062011 REAL(r64) FanAirPower ! Air power for Fan being Simulated [W] - // unused062011 REAL(r64) FanSpd ! Fan shaft rotational speed [rpm] - // unused062011 REAL(r64) FanTrq ! Fan shaft torque [N-m] - // unused062011 REAL(r64) FanWheelEff ! Fan efficiency (mechanical) [-] - // unused062011 REAL(r64) FanShaftPower ! Shaft input power for Fan being Simulated [W] - // unused062011 REAL(r64) BeltEff ! Belt efficiency (mechanical) [-] - // unused062011 REAL(r64) BeltInputPower ! Belt input power for Fan being Simulated [W] - // unused062011 REAL(r64) MotEff ! Fan motor efficiency [-] - // unused062011 REAL(r64) MotorInputPower ! Motor input power for Fan being Simulated [W] - // unused062011 REAL(r64) VFDEff ! VFD efficiency (electrical) [-] - // unused062011 REAL(r64) VFDInputPower ! VFD input power for Fan being Simulated [W] - // unused062011 REAL(r64) FanEff ! Fan total system efficiency (fan*belt*motor*VFD) [-] Real64 MotInAirFrac; // Fraction of fan power input to airstream // Local variables @@ -2238,6 +2093,9 @@ namespace Fans { static Real64 VFDOutPwrRatio(0.0); // Ratio of VFD output power to max VFD output power [-] Real64 FanEnthalpyChange; // Air enthalpy change due to fan, belt, and motor losses [kJ/kg] + auto & NightVentPerf(state.dataFans->NightVentPerf); + auto & Fan(state.dataFans->Fan); + // Get inputs for night ventilation option NVPerfNum = Fan(FanNum).NVPerfNum; @@ -2409,12 +2267,6 @@ namespace Fans { } } - // End Algorithm Section of the Module - // ***************************************************************************** - - // Beginning of Update subroutines for the Fan Module - // ***************************************************************************** - void UpdateFan(EnergyPlusData &state, int const FanNum) { @@ -2434,6 +2286,8 @@ namespace Fans { int OutletNode; int InletNode; + auto & Fan(state.dataFans->Fan); + OutletNode = Fan(FanNum).OutletNodeNum; InletNode = Fan(FanNum).InletNodeNum; @@ -2477,12 +2331,6 @@ namespace Fans { } } - // End of Update subroutines for the Fan Module - // ***************************************************************************** - - // Beginning of Reporting subroutines for the Fan Module - // ***************************************************************************** - void ReportFan(EnergyPlusData &state, int const FanNum) { @@ -2495,29 +2343,10 @@ namespace Fans { // PURPOSE OF THIS SUBROUTINE: // This subroutine updates the report variables for the fans. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using DataHVACGlobals::TimeStepSys; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na + auto & Fan(state.dataFans->Fan); Fan(FanNum).FanEnergy = Fan(FanNum).FanPower * TimeStepSys * DataGlobalConstants::SecInHour; Fan(FanNum).DeltaTemp = Fan(FanNum).OutletAirTemp - Fan(FanNum).InletAirTemp; @@ -2529,12 +2358,6 @@ namespace Fans { } } - // End of Reporting subroutines for the Fan Module - // ***************************************************************************** - - // Beginning of Utility subroutines for the Fan Module - // ***************************************************************************** - void GetFanIndex(EnergyPlusData &state, std::string const &FanName, int &FanIndex, bool &ErrorsFound, Optional_string_const ThisObjectType) { @@ -2553,7 +2376,7 @@ namespace Fans { state.dataFans->GetFanInputFlag = false; } - FanIndex = UtilityRoutines::FindItemInList(FanName, Fan, &FanEquipConditions::FanName); + FanIndex = UtilityRoutines::FindItemInList(FanName, state.dataFans->Fan, &FanEquipConditions::FanName); if (FanIndex == 0) { if (present(ThisObjectType)) { ShowSevereError(state, ThisObjectType() + ", GetFanIndex: Fan not found=" + FanName); @@ -2564,7 +2387,7 @@ namespace Fans { } } - void GetFanVolFlow(int const FanIndex, Real64 &FanVolFlow) + void GetFanVolFlow(EnergyPlusData &state, int const FanIndex, Real64 &FanVolFlow) { // SUBROUTINE INFORMATION: @@ -2577,38 +2400,14 @@ namespace Fans { // This subroutine gets the fan volumetric flow for use by zone equipment (e.g. Packaged Terminal Heat Pump) // Zone equipment must ensure that a properly sized fan is used to meet the maximum supply air flow rate - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - if (FanIndex == 0) { FanVolFlow = 0.0; } else { - FanVolFlow = Fan(FanIndex).MaxAirFlowRate; + FanVolFlow = state.dataFans->Fan(FanIndex).MaxAirFlowRate; } } - Real64 GetFanPower(int const FanIndex) + Real64 GetFanPower(EnergyPlusData &state, int const FanIndex) { // SUBROUTINE INFORMATION: @@ -2620,34 +2419,10 @@ namespace Fans { // PURPOSE OF THIS SUBROUTINE: // This subroutine gets the fan power draw - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - if (FanIndex == 0) { return 0.0; } else { - return Fan(FanIndex).FanPower; + return state.dataFans->Fan(FanIndex).FanPower; } } @@ -2673,6 +2448,8 @@ namespace Fans { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int FanIndex; + auto & Fan(state.dataFans->Fan); + if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); state.dataFans->GetFanInputFlag = false; @@ -2719,6 +2496,8 @@ namespace Fans { // FUNCTION LOCAL VARIABLE DECLARATIONS: int WhichFan; + auto & Fan(state.dataFans->Fan); + // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); @@ -2766,6 +2545,8 @@ namespace Fans { // FUNCTION LOCAL VARIABLE DECLARATIONS: int WhichFan; + auto & Fan(state.dataFans->Fan); + // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); @@ -2792,6 +2573,8 @@ namespace Fans { int NodeNumber = 0; // returned outlet node of matched fan + auto & Fan(state.dataFans->Fan); + // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); @@ -2832,6 +2615,8 @@ namespace Fans { // FUNCTION LOCAL VARIABLE DECLARATIONS: int WhichFan; + auto & Fan(state.dataFans->Fan); + // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); @@ -2874,6 +2659,8 @@ namespace Fans { // FUNCTION LOCAL VARIABLE DECLARATIONS: int WhichFan; + auto & Fan(state.dataFans->Fan); + // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); @@ -2916,6 +2703,8 @@ namespace Fans { // FUNCTION LOCAL VARIABLE DECLARATIONS: int WhichFan; + auto & Fan(state.dataFans->Fan); + // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); @@ -2965,29 +2754,11 @@ namespace Fans { // information from the ZoneHVAC:EnergyRecoveryVentilator object. // This is an illustration of setting data from an outside source. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int WhichFan; // index to generic HX + auto & Fan(state.dataFans->Fan); + // Obtains and Allocates fan related parameters from input file if (state.dataFans->GetFanInputFlag) { // First time subroutine has been entered GetFanInput(state); @@ -3015,7 +2786,7 @@ namespace Fans { } } - Real64 FanDesDT(EnergyPlusData &state, + [[maybe_unused]] Real64 FanDesDT(EnergyPlusData &state, int const FanNum, // index of fan in Fan array [[maybe_unused]] Real64 const FanVolFlow // fan volumetric flow rate [m3/s] ) @@ -3046,7 +2817,9 @@ namespace Fans { Real64 TotEff; // fan design total efficiency Real64 MotEff; // fan design motor efficiency Real64 MotInAirFrac; // fraction of motor in the air stream - // + + auto & Fan(state.dataFans->Fan); + if (FanNum == 0) { DesignDeltaT = 0.0; } else if (Fan(FanNum).FanType_Num != FanType_ComponentModel) { @@ -3084,34 +2857,14 @@ namespace Fans { // Calculate the decrease of the fan air flow rate, given the fan curve // and the increase of fan pressure rise due to fouling air filters - // METHODOLOGY EMPLOYED: - // NA - - // REFERENCES: - // na - // Using/Aliasing using namespace CurveManager; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 FanFaultyAirFlowRate; // Fan Volume Flow Rate in the Faulty Case [m3/sec] Real64 FanCalDeltaPress; // Calculated Fan Delta Pressure for temp use [Pa] Real64 FanCalDeltaPresstemp; // Calculated Fan Delta Pressure for temp use [Pa] - - // Check whether the fan curve covers the design operational point of the fan FanCalDeltaPress = CurveValue(state, FanCurvePtr, FanDesignAirFlowRate); if ((FanCalDeltaPress < 0.9 * FanDesignDeltaPress) || (FanCalDeltaPress > 1.1 * FanDesignDeltaPress)) { @@ -3171,7 +2924,9 @@ namespace Fans { Real64 MotEff; // fan design motor efficiency Real64 MotInAirFrac; // fraction of motor in the air stream Real64 FanPowerTot; // total fan power consumption [W] - // + + auto & Fan(state.dataFans->Fan); + if (FanNum == 0) { DesignHeatGain = 0.0; } else if (Fan(FanNum).FanType_Num != FanType_ComponentModel) { @@ -3182,9 +2937,9 @@ namespace Fans { FanPowerTot = (FanVolFlow * DeltaP) / TotEff; DesignHeatGain = MotEff * FanPowerTot + (FanPowerTot - MotEff * FanPowerTot) * MotInAirFrac; } else { - if (!state.dataGlobal->SysSizingCalc && MySizeFlag(FanNum)) { + if (!state.dataGlobal->SysSizingCalc && state.dataFans->MySizeFlag(FanNum)) { SizeFan(state, FanNum); - MySizeFlag(FanNum) = false; + state.dataFans->MySizeFlag(FanNum) = false; } DesignHeatGain = Fan(FanNum).FanShaftPower + (Fan(FanNum).MotorInputPower - Fan(FanNum).FanShaftPower) * Fan(FanNum).MotInAirFrac; } @@ -3210,6 +2965,9 @@ namespace Fans { fanShaftPow = 0.0; motInPower = 0.0; fanCompModel = false; + + auto & Fan(state.dataFans->Fan); + if (fanIndex <= 0) { return; } else if (Fan(fanIndex).FanType_Num != FanType_ComponentModel) { @@ -3218,9 +2976,9 @@ namespace Fans { totEff = Fan(fanIndex).FanEff; motInAirFrac = Fan(fanIndex).MotInAirFrac; } else { - if (!state.dataGlobal->SysSizingCalc && MySizeFlag(fanIndex)) { + if (!state.dataGlobal->SysSizingCalc && state.dataFans->MySizeFlag(fanIndex)) { SizeFan(state, fanIndex); - MySizeFlag(fanIndex) = false; + state.dataFans->MySizeFlag(fanIndex) = false; } fanCompModel = true; fanShaftPow = Fan(fanIndex).FanShaftPower; @@ -3229,30 +2987,9 @@ namespace Fans { } } - // Clears the global data in Fans. - // Needed for unit tests, should not be normally called. - void clear_state() + void SetFanAirLoopNumber(EnergyPlusData &state, int const FanIndex, int const AirLoopNum) { - MyOneTimeFlag = true; - ZoneEquipmentListChecked = false; - - CheckEquipName.deallocate(); - MySizeFlag.deallocate(); - MyEnvrnFlag.deallocate(); - Fan.deallocate(); - NightVentPerf.deallocate(); - FanNumericFields.deallocate(); - UniqueFanNames.clear(); + state.dataFans->Fan(FanIndex).AirLoopNum = AirLoopNum; } - void SetFanAirLoopNumber(int const FanIndex, int const AirLoopNum) - { - Fan(FanIndex).AirLoopNum = AirLoopNum; - } - - // End of Utility subroutines for the Fan Module - // ***************************************************************************** - -} // namespace Fans - } // namespace EnergyPlus diff --git a/src/EnergyPlus/Fans.hh b/src/EnergyPlus/Fans.hh index e95757878ae..1772eb00d75 100644 --- a/src/EnergyPlus/Fans.hh +++ b/src/EnergyPlus/Fans.hh @@ -104,14 +104,14 @@ namespace Fans { Real64 PowerLossToAir; // Fan heat gain to air stream [W] bool EMSFanPressureOverrideOn; // if true, then EMS is calling to override Real64 EMSFanPressureValue; // EMS value for Delta Pressure Across the Fan [Pa] - Real64 FanEff; // Fan total system efficiency (fan*belt*motor*VFD) - bool EMSFanEffOverrideOn; // if true, then EMS is calling to override - Real64 EMSFanEffValue; // EMS value for total efficiency of the Fan, fraction on 0..1 - bool FaultyFilterFlag; // Indicate whether there is a fouling air filter corresponding to the fan - int FaultyFilterIndex; // Index of the fouling air filter corresponding to the fan - Real64 MotEff; // Fan motor efficiency - Real64 MotInAirFrac; // Fraction of motor heat entering air stream - Array1D FanCoeff; // Fan Part Load Coefficients to match fan type + Real64 FanEff; // Fan total system efficiency (fan*belt*motor*VFD) + bool EMSFanEffOverrideOn; // if true, then EMS is calling to override + Real64 EMSFanEffValue; // EMS value for total efficiency of the Fan, fraction on 0..1 + bool FaultyFilterFlag; // Indicate whether there is a fouling air filter corresponding to the fan + int FaultyFilterIndex; // Index of the fouling air filter corresponding to the fan + Real64 MotEff; // Fan motor efficiency + Real64 MotInAirFrac; // Fraction of motor heat entering air stream + Array1D FanCoeff; // Fan Part Load Coefficients to match fan type // Mass Flow Rate Control Variables Real64 MassFlowRateMaxAvail; Real64 MassFlowRateMinAvail; @@ -122,52 +122,52 @@ namespace Fans { int FanPowerRatAtSpeedRatCurveIndex; int FanEffRatioCurveIndex; std::string EndUseSubcategoryName; - bool OneTimePowerRatioCheck; // one time flag used for error message - bool OneTimeEffRatioCheck; // one time flag used for error message - Real64 FanWheelDia; // Fan wheel outer diameter [m] - Real64 FanOutletArea; // Fan outlet area [m2] - Real64 FanMaxEff; // Fan maximum static efficiency [-] - Real64 EuMaxEff; // Euler number at fan maximum static efficiency [-] - Real64 FanMaxDimFlow; // Fan maximum dimensionless airflow [-] - Real64 FanShaftPwrMax; // Fan shaft maximum input power [W] - Real64 FanSizingFactor; // Fan sizing factor [-] - Real64 PulleyDiaRatio; // Motor/fan pulley diameter ratio [-] - Real64 BeltMaxTorque; // Belt maximum torque [N-m] - Real64 BeltSizingFactor; // Belt sizing factor [-] - Real64 BeltTorqueTrans; // Belt fractional torque transition Region 1-2 [-] - Real64 MotorMaxSpd; // Motor maximum speed [rpm] - Real64 MotorMaxOutPwr; // Motor maximum output power [W] - Real64 MotorSizingFactor; // Motor sizing factor [-] - std::string VFDEffType; // VFD efficiency type [Speed or Power] - Real64 VFDMaxOutPwr; // VFD maximum output power [W] - Real64 VFDSizingFactor; // VFD sizing factor [-] - int PressRiseCurveIndex; // Fan pressure rise curve index - int PressResetCurveIndex; // Duct static pressure reset curve index - int PLFanEffNormCurveIndex; // Fan part-load efficiency (normal) curve index - int PLFanEffStallCurveIndex; // Fan part-load efficiency (stall) curve index - int DimFlowNormCurveIndex; // Fan dimensionless airflow (normal) curve index - int DimFlowStallCurveIndex; // Fan dimensionless airflow (stall) curve index - int BeltMaxEffCurveIndex; // Belt maximum efficiency curve index - int PLBeltEffReg1CurveIndex; // Belt part-load efficiency (Region 1) curve index - int PLBeltEffReg2CurveIndex; // Belt part-load efficiency (Region 2) curve index - int PLBeltEffReg3CurveIndex; // Belt part-load efficiency (Region 3) curve index - int MotorMaxEffCurveIndex; // Motor maximum efficiency curve index - int PLMotorEffCurveIndex; // Motor part-load efficiency curve index - int VFDEffCurveIndex; // VFD efficiency curve index - Real64 DeltaPressTot; // Total pressure rise across fan [N/m2] - Real64 FanAirPower; // Air power for fan being Simulated [W] - Real64 FanSpd; // Fan shaft rotational speed [rpm] - Real64 FanTrq; // Fan shaft torque [N-m] - Real64 FanWheelEff; // Fan efficiency (mechanical) - Real64 FanShaftPower; // Shaft input power for fan being Simulated [W] - Real64 BeltMaxEff; // Belt maximum efficiency (mechanical) - Real64 BeltEff; // Belt efficiency (mechanical) - Real64 BeltInputPower; // Belt input power for fan being Simulated [W] - Real64 MotorMaxEff; // Motor maximum efficiency (electrical) - Real64 MotorInputPower; // Motor input power for fan being Simulated [W] - Real64 VFDEff; // VFD efficiency (electrical) - Real64 VFDInputPower; // VFD input power for fan being Simulated [W] - Real64 MaxFanPowerEncountered; // Maximum VFD input power encountered [W] + bool OneTimePowerRatioCheck; // one time flag used for error message + bool OneTimeEffRatioCheck; // one time flag used for error message + Real64 FanWheelDia; // Fan wheel outer diameter [m] + Real64 FanOutletArea; // Fan outlet area [m2] + Real64 FanMaxEff; // Fan maximum static efficiency [-] + Real64 EuMaxEff; // Euler number at fan maximum static efficiency [-] + Real64 FanMaxDimFlow; // Fan maximum dimensionless airflow [-] + Real64 FanShaftPwrMax; // Fan shaft maximum input power [W] + Real64 FanSizingFactor; // Fan sizing factor [-] + Real64 PulleyDiaRatio; // Motor/fan pulley diameter ratio [-] + Real64 BeltMaxTorque; // Belt maximum torque [N-m] + Real64 BeltSizingFactor; // Belt sizing factor [-] + Real64 BeltTorqueTrans; // Belt fractional torque transition Region 1-2 [-] + Real64 MotorMaxSpd; // Motor maximum speed [rpm] + Real64 MotorMaxOutPwr; // Motor maximum output power [W] + Real64 MotorSizingFactor; // Motor sizing factor [-] + std::string VFDEffType; // VFD efficiency type [Speed or Power] + Real64 VFDMaxOutPwr; // VFD maximum output power [W] + Real64 VFDSizingFactor; // VFD sizing factor [-] + int PressRiseCurveIndex; // Fan pressure rise curve index + int PressResetCurveIndex; // Duct static pressure reset curve index + int PLFanEffNormCurveIndex; // Fan part-load efficiency (normal) curve index + int PLFanEffStallCurveIndex; // Fan part-load efficiency (stall) curve index + int DimFlowNormCurveIndex; // Fan dimensionless airflow (normal) curve index + int DimFlowStallCurveIndex; // Fan dimensionless airflow (stall) curve index + int BeltMaxEffCurveIndex; // Belt maximum efficiency curve index + int PLBeltEffReg1CurveIndex; // Belt part-load efficiency (Region 1) curve index + int PLBeltEffReg2CurveIndex; // Belt part-load efficiency (Region 2) curve index + int PLBeltEffReg3CurveIndex; // Belt part-load efficiency (Region 3) curve index + int MotorMaxEffCurveIndex; // Motor maximum efficiency curve index + int PLMotorEffCurveIndex; // Motor part-load efficiency curve index + int VFDEffCurveIndex; // VFD efficiency curve index + Real64 DeltaPressTot; // Total pressure rise across fan [N/m2] + Real64 FanAirPower; // Air power for fan being Simulated [W] + Real64 FanSpd; // Fan shaft rotational speed [rpm] + Real64 FanTrq; // Fan shaft torque [N-m] + Real64 FanWheelEff; // Fan efficiency (mechanical) + Real64 FanShaftPower; // Shaft input power for fan being Simulated [W] + Real64 BeltMaxEff; // Belt maximum efficiency (mechanical) + Real64 BeltEff; // Belt efficiency (mechanical) + Real64 BeltInputPower; // Belt input power for fan being Simulated [W] + Real64 MotorMaxEff; // Motor maximum efficiency (electrical) + Real64 MotorInputPower; // Motor input power for fan being Simulated [W] + Real64 VFDEff; // VFD efficiency (electrical) + Real64 VFDInputPower; // VFD input power for fan being Simulated [W] + [[maybe_unused]] Real64 MaxFanPowerEncountered; // Maximum VFD input power encountered [W] // zone exhaust fan int FlowFractSchedNum; // schedule index flow rate modifier schedule int AvailManagerMode; // mode for how exhaust fan should react to availability managers @@ -175,7 +175,7 @@ namespace Fans { int BalancedFractSchedNum; // schedule index portion recirculated Real64 UnbalancedOutletMassFlowRate; Real64 BalancedOutletMassFlowRate; - int AirLoopNum; // Airloop number + int AirLoopNum; // Airloop number Real64 DesignPointFEI; // Fan Energy Index for the fan at the design operating point // Default Constructor @@ -223,23 +223,11 @@ namespace Fans { { // Members Array1D_string FieldNames; - - // Default Constructor - FanNumericFieldData() - { - } }; - // Object Data - extern Array1D Fan; - extern Array1D NightVentPerf; - extern Array1D FanNumericFields; - - // Functions - void clear_state(); - - void SimulateFanComponents(EnergyPlusData &state, std::string const &CompName, - bool const FirstHVACIteration, + void SimulateFanComponents(EnergyPlusData &state, + std::string const &CompName, + bool FirstHVACIteration, int &CompIndex, Optional SpeedRatio = _, Optional_bool_const ZoneCompTurnFansOn = _, // Turn fans ON signal from ZoneHVAC component @@ -247,66 +235,34 @@ namespace Fans { Optional PressureRise = _ // Pressure difference to use for DeltaPress ); - // Get Input Section of the Module - //****************************************************************************** - void GetFanInput(EnergyPlusData &state); - // End of Get Input subroutines for the HB Module - //****************************************************************************** - - // Beginning Initialization Section of the Module - //****************************************************************************** - - void InitFan(EnergyPlusData &state, int const FanNum, - bool const FirstHVACIteration // unused1208 + void InitFan(EnergyPlusData &state, + int FanNum, + bool FirstHVACIteration // unused1208 ); - void SizeFan(EnergyPlusData &state, int const FanNum); - - // End Initialization Section of the Module - //****************************************************************************** - - // Begin Algorithm Section of the Module - //****************************************************************************** + void SizeFan(EnergyPlusData &state, int FanNum); - void SimSimpleFan(EnergyPlusData &state, int const FanNum); + void SimSimpleFan(EnergyPlusData &state, int FanNum); - void SimVariableVolumeFan(EnergyPlusData &state, int const FanNum, Optional PressureRise = _); + void SimVariableVolumeFan(EnergyPlusData &state, int FanNum, Optional PressureRise = _); - void SimOnOffFan(EnergyPlusData &state, int const FanNum, Optional SpeedRatio = _); + void SimOnOffFan(EnergyPlusData &state, int FanNum, Optional SpeedRatio = _); - void SimZoneExhaustFan(EnergyPlusData &state, int const FanNum); + void SimZoneExhaustFan(EnergyPlusData &state, int FanNum); - void SimComponentModelFan(EnergyPlusData &state, int const FanNum); + void SimComponentModelFan(EnergyPlusData &state, int FanNum); - // End Algorithm Section of the Module - // ***************************************************************************** + void UpdateFan(EnergyPlusData &state, int FanNum); - // Beginning of Update subroutines for the Fan Module - // ***************************************************************************** - - void UpdateFan(EnergyPlusData &state, int const FanNum); - - // End of Update subroutines for the Fan Module - // ***************************************************************************** - - // Beginning of Reporting subroutines for the Fan Module - // ***************************************************************************** - - void ReportFan(EnergyPlusData &state, int const FanNum); - - // End of Reporting subroutines for the Fan Module - // ***************************************************************************** - - // Beginning of Utility subroutines for the Fan Module - // ***************************************************************************** + void ReportFan(EnergyPlusData &state, int FanNum); void GetFanIndex(EnergyPlusData &state, std::string const &FanName, int &FanIndex, bool &ErrorsFound, Optional_string_const ThisObjectType = _); - void GetFanVolFlow(int const FanIndex, Real64 &FanVolFlow); + void GetFanVolFlow(EnergyPlusData &state, int FanIndex, Real64 &FanVolFlow); - Real64 GetFanPower(int const FanIndex); + Real64 GetFanPower(EnergyPlusData &state, int FanIndex); void GetFanType(EnergyPlusData &state, std::string const &FanName, // Fan name @@ -353,31 +309,32 @@ namespace Fans { ); void SetFanData(EnergyPlusData &state, - int const FanNum, // Index of fan + int FanNum, // Index of fan bool &ErrorsFound, // Set to true if certain errors found std::string const &FanName, // Name of fan Optional MaxAirVolFlow = _, // Fan air volumetric flow rate [m3/s] Optional MinAirVolFlow = _ // Fan air volumetric flow rate [m3/s] ); - Real64 FanDesDT(EnergyPlusData &state, - int const FanNum, // index of fan in Fan array - Real64 const FanVolFlow // fan volumetric flow rate [m3/s] + [[maybe_unused]] Real64 FanDesDT(EnergyPlusData &state, + int FanNum, // index of fan in Fan array + Real64 FanVolFlow // fan volumetric flow rate [m3/s] ); Real64 CalFaultyFanAirFlowReduction(EnergyPlusData &state, std::string const &FanName, // Name of the Fan - Real64 const FanDesignAirFlowRate, // Fan Design Volume Flow Rate [m3/s] - Real64 const FanDesignDeltaPress, // Fan Design Delta Pressure [Pa] - Real64 const FanFaultyDeltaPressInc, // Increase of Fan Delta Pressure in the Faulty Case [Pa] - int const FanCurvePtr // Fan Curve Pointer + Real64 FanDesignAirFlowRate, // Fan Design Volume Flow Rate [m3/s] + Real64 FanDesignDeltaPress, // Fan Design Delta Pressure [Pa] + Real64 FanFaultyDeltaPressInc, // Increase of Fan Delta Pressure in the Faulty Case [Pa] + int FanCurvePtr // Fan Curve Pointer ); - Real64 FanDesHeatGain(EnergyPlusData &state, int const FanNum, // index of fan in Fan array - Real64 const FanVolFlow // fan volumetric flow rate [m3/s] + Real64 FanDesHeatGain(EnergyPlusData &state, + int FanNum, // index of fan in Fan array + Real64 FanVolFlow // fan volumetric flow rate [m3/s] ); - void SetFanAirLoopNumber(int const FanIndex, int const AirLoopNum); + void SetFanAirLoopNumber(EnergyPlusData &state, int FanIndex, int AirLoopNum); void FanInputsForDesHeatGain(EnergyPlusData &state, int const &fanIndex, @@ -389,38 +346,48 @@ namespace Fans { Real64 &motInPower, bool &fanCompModel); - // Clears the global data in Fans. - // Needed for unit tests, should not be normally called. - void clear_state(); - - // End of Utility subroutines for the Fan Module - // ***************************************************************************** - } // namespace Fans - struct FansData : BaseGlobalStruct { - // constants - static constexpr int ExhaustFanCoupledToAvailManagers = 150; - static constexpr int ExhaustFanDecoupledFromAvailManagers = 151; - - // members - int NumFans; - int NumNightVentPerf; // number of FAN:NIGHT VENT PERFORMANCE objects found in the input - bool GetFanInputFlag; // Flag set to make sure you get input once - bool LocalTurnFansOn; // If True, overrides fan schedule and cycles ZoneHVAC component fans on - bool LocalTurnFansOff; // If True, overrides fan schedule and LocalTurnFansOn and cycles ZoneHVAC component fans off - - FansData() : NumFans(0), NumNightVentPerf(0), GetFanInputFlag(true), LocalTurnFansOn(false), - LocalTurnFansOff(false) {} - - void clear_state() override { - NumFans = 0; - NumNightVentPerf = 0; - GetFanInputFlag = true; - LocalTurnFansOn = false; - LocalTurnFansOff = false; - } - }; +struct FansData : BaseGlobalStruct +{ + // constants + static constexpr int ExhaustFanCoupledToAvailManagers = 150; + static constexpr int ExhaustFanDecoupledFromAvailManagers = 151; + + // members + int NumFans = 0; + int NumNightVentPerf = 0; // number of FAN:NIGHT VENT PERFORMANCE objects found in the input + bool GetFanInputFlag = true; // Flag set to make sure you get input once + bool LocalTurnFansOn = false; // If True, overrides fan schedule and cycles ZoneHVAC component fans on + bool LocalTurnFansOff = false; // If True, overrides fan schedule and LocalTurnFansOn and cycles ZoneHVAC component fans off + bool MyOneTimeFlag = true; + bool ZoneEquipmentListChecked = false; + Array1D_bool MySizeFlag; + Array1D_bool MyEnvrnFlag; + Array1D_bool CheckEquipName; + Array1D Fan; + std::unordered_map UniqueFanNames; + Array1D NightVentPerf; + Array1D FanNumericFields; + + void clear_state() override + { + this->NumFans = 0; + this->NumNightVentPerf = 0; + this->GetFanInputFlag = true; + this->LocalTurnFansOn = false; + this->LocalTurnFansOff = false; + this->MyOneTimeFlag = true; + this->ZoneEquipmentListChecked = false; + this->MySizeFlag.deallocate(); + this->MyEnvrnFlag.deallocate(); + this->CheckEquipName.deallocate(); + this->Fan.deallocate(); + this->UniqueFanNames.clear(); + this->NightVentPerf.deallocate(); + this->FanNumericFields.deallocate(); + } +}; } // namespace EnergyPlus diff --git a/src/EnergyPlus/FaultsManager.cc b/src/EnergyPlus/FaultsManager.cc index 7051db95e24..33286960daa 100644 --- a/src/EnergyPlus/FaultsManager.cc +++ b/src/EnergyPlus/FaultsManager.cc @@ -873,13 +873,13 @@ namespace FaultsManager { ErrorsFound = true; } // Read in controller input if not done yet - if (HVACControllers::GetControllerInputFlag) { + if (state.dataHVACControllers->GetControllerInputFlag) { HVACControllers::GetControllerInput(state); - HVACControllers::GetControllerInputFlag = false; + state.dataHVACControllers->GetControllerInputFlag = false; } // Check the controller name int ControlNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).WaterCoilControllerName, - HVACControllers::ControllerProps, + state.dataHVACControllers->ControllerProps, &HVACControllers::ControllerPropsType::ControllerName); if (ControlNum <= 0) { ShowSevereError(state, cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(6) + " = \"" + @@ -887,11 +887,11 @@ namespace FaultsManager { ErrorsFound = true; } else { // Link the controller with the fault model - HVACControllers::ControllerProps(ControlNum).FaultyCoilSATFlag = true; - HVACControllers::ControllerProps(ControlNum).FaultyCoilSATIndex = jFault_CoilSAT; + state.dataHVACControllers->ControllerProps(ControlNum).FaultyCoilSATFlag = true; + state.dataHVACControllers->ControllerProps(ControlNum).FaultyCoilSATIndex = jFault_CoilSAT; // Check whether the controller match the coil - if (HVACControllers::ControllerProps(ControlNum).SensedNode != state.dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum) { + if (state.dataHVACControllers->ControllerProps(ControlNum).SensedNode != state.dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum) { ShowSevereError(state, cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(6) + " = \"" + cAlphaArgs(6) + "\" does not match " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5)); ErrorsFound = true; @@ -1400,7 +1400,7 @@ namespace FaultsManager { state.dataFaultsMgr->FaultsFouledAirFilters(jFault_AirFilter).FaultyAirFilterFanName = cAlphaArgs(3); // Check whether the specified fan exists in the fan list - if (UtilityRoutines::FindItemInList(cAlphaArgs(3), Fans::Fan, &Fans::FanEquipConditions::FanName) <= 0) { + if (UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataFans->Fan, &Fans::FanEquipConditions::FanName) <= 0) { ShowSevereError(state, cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(3) + " = \"" + cAlphaArgs(3) + "\" not found."); ErrorsFound = true; @@ -1408,9 +1408,9 @@ namespace FaultsManager { // Assign fault index to the fan object for (int FanNum = 1; FanNum <= state.dataFans->NumFans; ++FanNum) { - if (UtilityRoutines::SameString(Fans::Fan(FanNum).FanName, cAlphaArgs(3))) { - Fans::Fan(FanNum).FaultyFilterFlag = true; - Fans::Fan(FanNum).FaultyFilterIndex = jFault_AirFilter; + if (UtilityRoutines::SameString(state.dataFans->Fan(FanNum).FanName, cAlphaArgs(3))) { + state.dataFans->Fan(FanNum).FaultyFilterFlag = true; + state.dataFans->Fan(FanNum).FaultyFilterIndex = jFault_AirFilter; break; } } @@ -1672,14 +1672,14 @@ namespace FaultsManager { ErrorsFound = true; } else { // Coil is found: check if the right type - if ( (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) || - (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) ) + if ( (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) || + (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) ) { // Link the Coil with the fault model state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag = true; state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex = jFault_FoulingCoil; - state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoiledType = state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num; + state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoiledType = state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType; state.dataFaultsMgr->FouledCoils(jFault_FoulingCoil).FouledCoilNum = CoilNum; SetupOutputVariable(state, "Coil Fouling Factor", @@ -1691,7 +1691,7 @@ namespace FaultsManager { // Coil:Cooling:Water doesn't report UA because it's not variable, // but here, it's useful since we do change it via fouling, so report it - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { SetupOutputVariable(state, "Cooling Coil Total U Factor Times Area Value", OutputProcessor::Unit::W_K, state.dataWaterCoils->WaterCoil(CoilNum).UACoilTotal, @@ -1745,7 +1745,7 @@ namespace FaultsManager { } else { ShowSevereError(state, cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(2) + " = \"" + cAlphaArgs(2) + "\"."); - ShowContinueError(state, "Coil was found but it is not one of the supported types (\"Coil:Cooling:Water\" or \"Coil:Heating:Water\")."); + ShowContinueError(state, R"(Coil was found but it is not one of the supported types ("Coil:Cooling:Water" or "Coil:Heating:Water").)"); ErrorsFound = true; } } @@ -2063,9 +2063,9 @@ namespace FaultsManager { FanFound = false; for (int FanNum = 1; FanNum <= state.dataFans->NumFans; ++FanNum) { - if (UtilityRoutines::SameString(Fan(FanNum).FanName, FanName)) { - FanMaxAirFlowRate = Fan(FanNum).MaxAirFlowRate; - FanDeltaPress = Fan(FanNum).DeltaPress; + if (UtilityRoutines::SameString(state.dataFans->Fan(FanNum).FanName, FanName)) { + FanMaxAirFlowRate = state.dataFans->Fan(FanNum).MaxAirFlowRate; + FanDeltaPress = state.dataFans->Fan(FanNum).DeltaPress; FanFound = true; break; } diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index a149e233de6..0b5b6ccd8c9 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -5453,7 +5453,7 @@ namespace Furnaces { // IF MSHP system was not autosized and the fan is autosized, check that fan volumetric flow rate is greater than MSHP flow rates if (state.dataFurnaces->Furnace(FurnaceNum).CheckFanFlow) { state.dataFurnaces->CurrentModuleObject = "AirLoopHVAC:UnitaryHeatPump:VariableSpeed"; - GetFanVolFlow(state.dataFurnaces->Furnace(FurnaceNum).FanIndex, state.dataFurnaces->Furnace(FurnaceNum).FanVolFlow); + GetFanVolFlow(state, state.dataFurnaces->Furnace(FurnaceNum).FanIndex, state.dataFurnaces->Furnace(FurnaceNum).FanVolFlow); if (state.dataFurnaces->Furnace(FurnaceNum).bIsIHP) // set max fan flow rate to the IHP collection { diff --git a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc index 7d8c338f9cf..ae93fcb0d45 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc @@ -179,7 +179,6 @@ void FiniteDiffGroundTempsModel::getWeatherData(EnergyPlusData &state) // USE STATEMENTS: using namespace DataEnvironment; - using namespace DataReportingFlags; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -204,7 +203,7 @@ void FiniteDiffGroundTempsModel::getWeatherData(EnergyPlusData &state) bool WarmupFlag_reset = state.dataGlobal->WarmupFlag; int DayOfSim_reset = state.dataGlobal->DayOfSim; std::string DayOfSimChr_reset = state.dataGlobal->DayOfSimChr; - int NumOfWarmupDays_reset = NumOfWarmupDays; + int NumOfWarmupDays_reset = state.dataReportFlag->NumOfWarmupDays; bool BeginDayFlag_reset = state.dataGlobal->BeginDayFlag; bool EndDayFlag_reset = state.dataGlobal->EndDayFlag; bool BeginHourFlag_reset = state.dataGlobal->BeginHourFlag; @@ -252,7 +251,7 @@ void FiniteDiffGroundTempsModel::getWeatherData(EnergyPlusData &state) state.dataGlobal->WarmupFlag = false; state.dataGlobal->DayOfSim = 0; state.dataGlobal->DayOfSimChr = "0"; - NumOfWarmupDays = 0; + state.dataReportFlag->NumOfWarmupDays = 0; annualAveAirTemp_num = 0.0; @@ -360,7 +359,7 @@ void FiniteDiffGroundTempsModel::getWeatherData(EnergyPlusData &state) state.dataGlobal->WarmupFlag = WarmupFlag_reset; state.dataGlobal->DayOfSim = DayOfSim_reset; state.dataGlobal->DayOfSimChr = DayOfSimChr_reset; - NumOfWarmupDays = NumOfWarmupDays_reset; + state.dataReportFlag->NumOfWarmupDays = NumOfWarmupDays_reset; state.dataGlobal->BeginDayFlag = BeginDayFlag_reset; state.dataGlobal->EndDayFlag = EndDayFlag_reset; state.dataGlobal->BeginHourFlag = BeginHourFlag_reset; diff --git a/src/EnergyPlus/HVACControllers.cc b/src/EnergyPlus/HVACControllers.cc index aabbd32088d..b3c92bea9a3 100644 --- a/src/EnergyPlus/HVACControllers.cc +++ b/src/EnergyPlus/HVACControllers.cc @@ -71,16 +71,13 @@ #include #include #include -#include #include #include #include #include #include -namespace EnergyPlus { - -namespace HVACControllers { +namespace EnergyPlus::HVACControllers { // Module containing the controller simulation routines for the air loop // MODULE INFORMATION: @@ -162,9 +159,6 @@ namespace HVACControllers { // Check the subroutines SolveAirLoopControllers() and ReSolveAirLoopControllers() // invoked in the subroutine SimAirLoop() for the actual calling sequences. - // REFERENCES: - // na - // OTHER NOTES: // To enable runtime statistics tracking for each air loop, define the environment variable // TRACK_AIRLOOP=YES or TRACK_AIRLOOP=Y. @@ -184,94 +178,25 @@ namespace HVACControllers { using namespace DataHVACControllers; using namespace DataRootFinder; - // Data - // MODULE PARAMETER DEFINITIONS // Number of significant digits to display in error messages for floating-point numbers - Real64 const SomeFloatingPoint(1.0); + constexpr Real64 SomeFloatingPoint(1.0); int const NumSigDigits(PRECISION(SomeFloatingPoint)); - // Parameters for controls used here - int const iNoControlVariable(0); - int const iTemperature(1); - int const iHumidityRatio(2); - int const iTemperatureAndHumidityRatio(3); - int const iFlow(4); - - int const CoilType_Cooling(1); - int const CoilType_Heating(2); - - Array1D_string const - ControlVariableTypes({0, 4}, {"No control variable", "Temperature", "Humidity ratio", "Temperature and humidity ratio", "Flow rate"}); - - // DERIVED TYPE DEFINITIONS - - // Type describing a controller's properties - - // Type describing a controller's runtime statistics over the course of the simulation - - // Type describing an air loop's runtime statistics over the course of the simulation - - // MODULE VARIABLE DECLARATIONS: - int NumControllers(0); // The number of controllers found in the Input - int NumAirLoopStats(0); // Same size as NumPrimaryAirSys if controllers - // are defined, 0 otherwise. - // all controllers per air loop - Array1D_bool CheckEquipName; - - // Flag set to make sure you get input once - bool GetControllerInputFlag(true); - - // SUBROUTINE Specifications for the Module - // Driver/Manager Routines - - // Get Input routines for module - - // Initialization routines for module - - // Algorithms for the module - - // Update routine to check convergence and update nodes - - // Reporting routines for module - - // Algorithms for the Simple Controller - - // Statistics routines - - // Trace routines for all controllers on each air loop - - // Trace routines for each individual controller - - // Misc routines - - // Object Data - Array1D ControllerProps; - Array1D RootFinders; - Array1D AirLoopStats; // Statistics array to analyze computational profile for - - namespace { - bool InitControllerOneTimeFlag(true); - bool InitControllerSetPointCheckFlag(true); - } // namespace - - // MODULE SUBROUTINES: - //************************************************************************* - - // Functions - - // Needed for unit tests, should not be normally called. - void clear_state() + std::string ControlVariableTypes(iCtrl const &c) { - NumControllers = 0; - NumAirLoopStats = 0; - GetControllerInputFlag = true; - InitControllerOneTimeFlag = true; - InitControllerSetPointCheckFlag = true; - - ControllerProps.deallocate(); - RootFinders.deallocate(); - AirLoopStats.deallocate(); - CheckEquipName.deallocate(); + switch (c) { + case iCtrl::NoControlVariable: + return "No control variable"; + case iCtrl::Temperature: + return "Temperature"; + case iCtrl::HumidityRatio: + return "Humidity ratio"; + case iCtrl::TemperatureAndHumidityRatio: + return "Temperature and humidity ratio"; + case iCtrl::Flow: + return "Flow rate"; + } + return "no controller type found"; } void ManageControllers(EnergyPlusData &state, @@ -318,10 +243,15 @@ namespace HVACControllers { int ControlNum; int ControllerType; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + auto & NumControllers(state.dataHVACControllers->NumControllers); + auto & CheckEquipName(state.dataHVACControllers->CheckEquipName); + auto & RootFinders(state.dataHVACControllers->RootFinders); + // Obtains and Allocates Controller related parameters from input file - if (GetControllerInputFlag) { // First time subroutine has been entered + if (state.dataHVACControllers->GetControllerInputFlag) { // First time subroutine has been entered GetControllerInput(state); - GetControllerInputFlag = false; + state.dataHVACControllers->GetControllerInputFlag = false; } if (ControllerIndex == 0) { @@ -383,7 +313,7 @@ namespace HVACControllers { // NOTE: Never allow speculative warm restart with dual humidity ratio and temperature control // because the actual setpoint depends on the current temperature and max hum ratio at // the sensed node, and therefore might not be known until after one air loop simulation. - if (ControllerProps(ControlNum).ControlVar == iTemperatureAndHumidityRatio) { + if (ControllerProps(ControlNum).ControlVar == iCtrl::TemperatureAndHumidityRatio) { AllowWarmRestartFlag = false; } else { AllowWarmRestartFlag = true; @@ -406,11 +336,16 @@ namespace HVACControllers { auto const SELECT_CASE_var(Operation); if (SELECT_CASE_var == iControllerOpColdStart) { // For temperature and humidity control reset humidity control override if it was set - if (HVACControllers::ControllerProps(ControlNum).HumRatCtrlOverride) { - HVACControllers::ControllerProps(ControlNum).HumRatCtrlOverride = false; + if (ControllerProps(ControlNum).HumRatCtrlOverride) { + ControllerProps(ControlNum).HumRatCtrlOverride = false; // Put the controller tolerance (offset) back to it's original value RootFinder::SetupRootFinder(state, - RootFinders(ControlNum), iSlopeDecreasing, iMethodBrent, DataPrecisionGlobals::constant_zero, 1.0e-6, ControllerProps(ControlNum).Offset); + RootFinders(ControlNum), + iSlopeDecreasing, + DataRootFinder::iMethod::Brent, + DataPrecisionGlobals::constant_zero, + 1.0e-6, + ControllerProps(ControlNum).Offset); } // If a iControllerOpColdStart call, reset the actuator inlet flows @@ -458,7 +393,7 @@ namespace HVACControllers { auto const SELECT_CASE_var1(ControllerType); if (SELECT_CASE_var1 == ControllerSimple_Type) { // 'Controller:WaterCoil' CheckSimpleController(state, ControlNum, IsConvergedFlag); - SaveSimpleController(ControlNum, FirstHVACIteration, IsConvergedFlag); + SaveSimpleController(state, ControlNum, FirstHVACIteration, IsConvergedFlag); } else { ShowFatalError(state, "Invalid controller type in ManageControllers=" + ControllerProps(ControlNum).ControllerType); } @@ -566,11 +501,17 @@ namespace HVACControllers { Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. std::string CurrentModuleObject; // for ease in getting objects - static bool ErrorsFound(false); - int iNodeType; // for checking actuator node type + bool ErrorsFound(false); bool NodeNotFound; // flag true if the sensor node is on the coil air outlet node bool EMSSetPointErrorFlag; // flag true is EMS is used to set node setpoints + auto & NumControllers(state.dataHVACControllers->NumControllers); + auto & NumAirLoopStats(state.dataHVACControllers->NumAirLoopStats); + auto & AirLoopStats(state.dataHVACControllers->AirLoopStats); + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + auto & RootFinders(state.dataHVACControllers->RootFinders); + auto & CheckEquipName(state.dataHVACControllers->CheckEquipName); + // All the controllers are loaded into the same derived type, both the PI and Limit // These controllers are separate objects and loaded sequentially, but will // be retrieved by name as they are needed. @@ -629,11 +570,11 @@ namespace HVACControllers { { auto const SELECT_CASE_var(AlphArray(2)); if (SELECT_CASE_var == "TEMPERATURE") { - ControllerProps(Num).ControlVar = iTemperature; + ControllerProps(Num).ControlVar = iCtrl::Temperature; } else if (SELECT_CASE_var == "HUMIDITYRATIO") { - ControllerProps(Num).ControlVar = iHumidityRatio; + ControllerProps(Num).ControlVar = iCtrl::HumidityRatio; } else if (SELECT_CASE_var == "TEMPERATUREANDHUMIDITYRATIO") { - ControllerProps(Num).ControlVar = iTemperatureAndHumidityRatio; + ControllerProps(Num).ControlVar = iCtrl::TemperatureAndHumidityRatio; // CASE ('FLOW') // ControllerProps(Num)%ControlVar = iFlow } else { @@ -651,11 +592,11 @@ namespace HVACControllers { ControllerProps(Num).Action = 0; } else { ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + AlphArray(1) + "\"."); - ShowSevereError(state, "...Invalid " + cAlphaFields(3) + "=\"" + AlphArray(3) + "\", must be \"Normal\", \"Reverse\" or blank."); + ShowSevereError(state, "...Invalid " + cAlphaFields(3) + "=\"" + AlphArray(3) + R"(", must be "Normal", "Reverse" or blank.)"); ErrorsFound = true; } if (AlphArray(4) == "FLOW") { - ControllerProps(Num).ActuatorVar = iFlow; + ControllerProps(Num).ActuatorVar = iCtrl::Flow; } else { ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + AlphArray(1) + "\"."); ShowContinueError(state, "...Invalid " + cAlphaFields(4) + "=\"" + AlphArray(4) + "\", only FLOW is allowed."); @@ -689,7 +630,7 @@ namespace HVACControllers { if (ControllerProps(Num).SensedNode > 0) { - if (ControllerProps(Num).ControlVar == iHumidityRatio || ControllerProps(Num).ControlVar == iTemperatureAndHumidityRatio) { + if (ControllerProps(Num).ControlVar == iCtrl::HumidityRatio || ControllerProps(Num).ControlVar == iCtrl::TemperatureAndHumidityRatio) { ResetHumidityRatioCtrlVarType(state, ControllerProps(Num).SensedNode); } CheckForSensorAndSetPointNode(state, ControllerProps(Num).SensedNode, ControllerProps(Num).ControlVar, NodeNotFound); @@ -704,7 +645,7 @@ namespace HVACControllers { EMSSetPointErrorFlag = false; { auto const SELECT_CASE_var(ControllerProps(Num).ControlVar); - if (SELECT_CASE_var == iTemperature) { + if (SELECT_CASE_var == iCtrl::Temperature) { CheckIfNodeSetPointManagedByEMS(state, ControllerProps(Num).SensedNode, EMSManager::SPControlType::iTemperatureSetPoint, EMSSetPointErrorFlag); state.dataLoopNodes->NodeSetpointCheck(ControllerProps(Num).SensedNode).needsSetpointChecking = false; if (EMSSetPointErrorFlag) { @@ -715,7 +656,7 @@ namespace HVACControllers { ShowContinueError(state, " ..Specify the setpoint and the sensor on the coil air outlet node when possible."); } } - } else if (SELECT_CASE_var == iHumidityRatio) { + } else if (SELECT_CASE_var == iCtrl::HumidityRatio) { CheckIfNodeSetPointManagedByEMS(state, ControllerProps(Num).SensedNode, EMSManager::SPControlType::iHumidityRatioMaxSetPoint, EMSSetPointErrorFlag); state.dataLoopNodes->NodeSetpointCheck(ControllerProps(Num).SensedNode).needsSetpointChecking = false; if (EMSSetPointErrorFlag) { @@ -726,7 +667,7 @@ namespace HVACControllers { ShowContinueError(state, " ..Specify the setpoint and the sensor on the coil air outlet node when possible."); } } - } else if (SELECT_CASE_var == iTemperatureAndHumidityRatio) { + } else if (SELECT_CASE_var == iCtrl::TemperatureAndHumidityRatio) { CheckIfNodeSetPointManagedByEMS(state, ControllerProps(Num).SensedNode, EMSManager::SPControlType::iTemperatureSetPoint, EMSSetPointErrorFlag); state.dataLoopNodes->NodeSetpointCheck(ControllerProps(Num).SensedNode).needsSetpointChecking = false; if (EMSSetPointErrorFlag) { @@ -757,13 +698,14 @@ namespace HVACControllers { // check that actuator nodes are matched by a water coil inlet node for (Num = 1; Num <= NumSimpleControllers; ++Num) { + int iNodeType; CheckActuatorNode(state, ControllerProps(Num).ActuatedNode, iNodeType, ActuatorNodeNotFound); if (ActuatorNodeNotFound) { ErrorsFound = true; ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + ControllerProps(Num).ControllerName + "\":"); ShowContinueError(state, "...the actuator node must also be a water inlet node of a water coil"); } else { // Node found, check type and action - if (iNodeType == CoilType_Cooling) { + if (iNodeType == DataPlant::TypeOf_CoilWaterCooling) { if (ControllerProps(Num).Action == 0) { ControllerProps(Num).Action = iReverseAction; } else if (ControllerProps(Num).Action == iNormalAction) { @@ -772,7 +714,7 @@ namespace HVACControllers { ShowContinueError(state, "...overriding user input action with Reverse Action."); ControllerProps(Num).Action = iReverseAction; } - } else if (iNodeType == CoilType_Heating) { + } else if (iNodeType == DataPlant::TypeOf_CoilWaterSimpleHeating) { if (ControllerProps(Num).Action == 0) { ControllerProps(Num).Action = iNormalAction; } else if (ControllerProps(Num).Action == iReverseAction) { @@ -822,32 +764,17 @@ namespace HVACControllers { // PURPOSE OF THIS SUBROUTINE: // This subroutine resets the actuator inlet flows. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using PlantUtilities::SetActuatedBranchFlowRate; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; int SensedNode; Real64 NoFlowResetValue; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + auto & RootFinders(state.dataHVACControllers->RootFinders); + ActuatedNode = ControllerProps(ControlNum).ActuatedNode; SensedNode = ControllerProps(ControlNum).SensedNode; @@ -901,8 +828,8 @@ namespace HVACControllers { // Reset root finder // This is independent of the processing in InitializeRootFinder() performed in Calc() routine. - RootFinders(ControlNum).StatusFlag = iStatusNone; - RootFinders(ControlNum).CurrentMethodType = iMethodNone; + RootFinders(ControlNum).StatusFlag = iStatus::None; + RootFinders(ControlNum).CurrentMethodType = DataRootFinder::iMethod::None; RootFinders(ControlNum).CurrentPoint.DefinedFlag = false; RootFinders(ControlNum).CurrentPoint.X = 0.0; @@ -944,11 +871,17 @@ namespace HVACControllers { int ActuatedNode; int SensedNode; int ControllerIndex; - static Array1D_bool MyEnvrnFlag; - static Array1D_bool MySizeFlag; - static Array1D_bool MyPlantIndexsFlag; Real64 rho; // local fluid density + auto & NumControllers(state.dataHVACControllers->NumControllers); + auto & InitControllerOneTimeFlag(state.dataHVACControllers->InitControllerOneTimeFlag); + auto & InitControllerSetPointCheckFlag(state.dataHVACControllers->InitControllerSetPointCheckFlag); + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + auto & RootFinders(state.dataHVACControllers->RootFinders); + auto & MyEnvrnFlag(state.dataHVACControllers->MyEnvrnFlag); + auto & MySizeFlag(state.dataHVACControllers->MySizeFlag); + auto & MyPlantIndexsFlag(state.dataHVACControllers->MyPlantIndexsFlag); + if (InitControllerOneTimeFlag) { MyEnvrnFlag.allocate(NumControllers); @@ -966,7 +899,7 @@ namespace HVACControllers { SensedNode = ControllerProps(ControllerIndex).SensedNode; { auto const SELECT_CASE_var(ControllerProps(ControllerIndex).ControlVar); - if (SELECT_CASE_var == iTemperature) { // 'Temperature' + if (SELECT_CASE_var == iCtrl::Temperature) { // 'Temperature' if (state.dataLoopNodes->Node(SensedNode).TempSetPoint == SensedNodeFlagValue) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { ShowSevereError(state, "HVACControllers: Missing temperature setpoint for controller type=" + @@ -1002,7 +935,7 @@ namespace HVACControllers { // SetPointErrorFlag = .TRUE. } } - } else if (SELECT_CASE_var == iHumidityRatio) { // 'HumidityRatio' + } else if (SELECT_CASE_var == iCtrl::HumidityRatio) { // 'HumidityRatio' ControllerProps(ControllerIndex).HumRatCntrlType = GetHumidityRatioVariableType(state, SensedNode); if ((ControllerProps(ControlNum).HumRatCntrlType == iCtrlVarType::HumRat && state.dataLoopNodes->Node(SensedNode).HumRatSetPoint == SensedNodeFlagValue) || @@ -1038,7 +971,7 @@ namespace HVACControllers { "setpoint at the controller sensed node."); SetPointErrorFlag = true; } - } else if (SELECT_CASE_var == iTemperatureAndHumidityRatio) { // 'TemperatureAndHumidityRatio' + } else if (SELECT_CASE_var == iCtrl::TemperatureAndHumidityRatio) { // 'TemperatureAndHumidityRatio' if (state.dataLoopNodes->Node(SensedNode).TempSetPoint == SensedNodeFlagValue) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { ShowSevereError(state, "HVACControllers: Missing temperature setpoint for controller type=" + @@ -1085,7 +1018,7 @@ namespace HVACControllers { } } } - } else if (SELECT_CASE_var == iFlow) { // 'Flow' + } else if (SELECT_CASE_var == iCtrl::Flow) { // 'Flow' if (state.dataLoopNodes->Node(SensedNode).MassFlowRateSetPoint == SensedNodeFlagValue) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { ShowSevereError(state, "HVACControllers: Missing mass flow rate setpoint for controller type=" + @@ -1144,9 +1077,10 @@ namespace HVACControllers { { auto const SELECT_CASE_var(ControllerProps(ControlNum).Action); if (SELECT_CASE_var == iNormalAction) { - SetupRootFinder(state, RootFinders(ControlNum), + SetupRootFinder(state, + RootFinders(ControlNum), iSlopeIncreasing, - iMethodBrent, + DataRootFinder::iMethod::Brent, DataPrecisionGlobals::constant_zero, 1.0e-6, ControllerProps(ControlNum).Offset); // Slope type | Method type | TolX: no relative tolerance for X variables | @@ -1154,16 +1088,17 @@ namespace HVACControllers { // Y variables } else if (SELECT_CASE_var == iReverseAction) { - SetupRootFinder(state, RootFinders(ControlNum), + SetupRootFinder(state, + RootFinders(ControlNum), iSlopeDecreasing, - iMethodBrent, + DataRootFinder::iMethod::Brent, DataPrecisionGlobals::constant_zero, 1.0e-6, ControllerProps(ControlNum).Offset); // Slope type | Method type | TolX: no relative tolerance for X variables | // ATolX: absolute tolerance for X variables | ATolY: absolute tolerance for // Y variables } else { - ShowFatalError(state, "InitController: Invalid controller action. Valid choices are \"Normal\" or \"Reverse\""); + ShowFatalError(state, R"(InitController: Invalid controller action. Valid choices are "Normal" or "Reverse")"); } } @@ -1216,7 +1151,7 @@ namespace HVACControllers { { auto const SELECT_CASE_var(ControllerProps(ControlNum).ControlVar); - if (SELECT_CASE_var == iTemperature) { // 'Temperature' + if (SELECT_CASE_var == iCtrl::Temperature) { // 'Temperature' ControllerProps(ControlNum).SensedValue = state.dataLoopNodes->Node(SensedNode).Temp; // Done once per HVAC step if (!ControllerProps(ControlNum).IsSetPointDefinedFlag) { @@ -1234,7 +1169,7 @@ namespace HVACControllers { } } - } else if (SELECT_CASE_var == iTemperatureAndHumidityRatio) { // 'TemperatureAndHumidityRatio' + } else if (SELECT_CASE_var == iCtrl::TemperatureAndHumidityRatio) { // 'TemperatureAndHumidityRatio' if (ControllerProps(ControlNum).HumRatCtrlOverride) { // Humidity ratio control ControllerProps(ControlNum).SensedValue = state.dataLoopNodes->Node(SensedNode).HumRat; @@ -1254,7 +1189,7 @@ namespace HVACControllers { ControllerProps(ControlNum).IsSetPointDefinedFlag = true; } - } else if (SELECT_CASE_var == iHumidityRatio) { // 'HumidityRatio' + } else if (SELECT_CASE_var == iCtrl::HumidityRatio) { // 'HumidityRatio' ControllerProps(ControlNum).SensedValue = state.dataLoopNodes->Node(SensedNode).HumRat; // Done once per HVAC step if (!ControllerProps(ControlNum).IsSetPointDefinedFlag) { @@ -1269,7 +1204,7 @@ namespace HVACControllers { ControllerProps(ControlNum).IsSetPointDefinedFlag = true; } - } else if (SELECT_CASE_var == iFlow) { // 'Flow' + } else if (SELECT_CASE_var == iCtrl::Flow) { // 'Flow' ControllerProps(ControlNum).SensedValue = state.dataLoopNodes->Node(SensedNode).MassFlowRate; // Done once per HVAC step if (!ControllerProps(ControlNum).IsSetPointDefinedFlag) { @@ -1284,7 +1219,7 @@ namespace HVACControllers { { auto const SELECT_CASE_var(ControllerProps(ControlNum).ActuatorVar); - if (SELECT_CASE_var == iFlow) { // 'Flow' + if (SELECT_CASE_var == iCtrl::Flow) { // 'Flow' // At the beginning of every time step the value is reset to the User Input // The interface managers can reset the Max or Min to available values during the time step // and these will then be the new setpoint limits for the controller to work within. @@ -1334,28 +1269,15 @@ namespace HVACControllers { // METHODOLOGY EMPLOYED: // Obtains flow rates from the actuated node. Should have been set by the water coils. - // REFERENCES: - // na - // Using/Aliasing using namespace DataSizing; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; // node number of actuated node int WaterCompNum; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + ActuatedNode = ControllerProps(ControlNum).ActuatedNode; if (ControllerProps(ControlNum).MaxVolFlowActuated == AutoSize) { @@ -1393,12 +1315,6 @@ namespace HVACControllers { } } - // End Initialization Section of the Module - //****************************************************************************** - - // Begin Algorithm Section of the Module - //****************************************************************************** - void CalcSimpleController(EnergyPlusData &state, int const ControlNum, bool const FirstHVACIteration, @@ -1436,21 +1352,9 @@ namespace HVACControllers { // mode. // RE-ENGINEERED na - // PURPOSE OF THIS SUBROUTINE: - // This subroutine needs a description. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using RootFinder::CheckRootFinderCandidate; using RootFinder::InitializeRootFinder; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // Set to TRUE if current controller is converged; FALSE if more iteration are needed. // Note that an error in the root finding process can be mapped onto IsConvergedFlag=TRUE @@ -1458,19 +1362,13 @@ namespace HVACControllers { // TRUE if air loop is up-to-date meaning that the current node values are consistent (air loop evaluated) // Only used within the Calc routines - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; int SensedNode; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + auto & RootFinders(state.dataHVACControllers->RootFinders); + // Increment counter ++ControllerProps(ControlNum).NumCalcCalls; @@ -1481,7 +1379,7 @@ namespace HVACControllers { // Check to see if the component is running; if not converged and return. This check will be done // by looking at the component mass flow rate at the sensed node. if (state.dataLoopNodes->Node(SensedNode).MassFlowRate == 0.0) { - ExitCalcController(ControlNum, DataPrecisionGlobals::constant_zero, iModeOff, IsConvergedFlag, IsUpToDateFlag); + ExitCalcController(state, ControlNum, DataPrecisionGlobals::constant_zero, iModeOff, IsConvergedFlag, IsUpToDateFlag); return; } @@ -1574,27 +1472,9 @@ namespace HVACControllers { // - Updates IsConvergedFlag depending ou iteration status. // - Sets next actuated value to try in ControllerProps(ControlNum)%NextActuatedValue - // METHODOLOGY EMPLOYED: - - // REFERENCES: - - // Using/Aliasing - using RootFinder::CheckRootFinderCandidate; using RootFinder::IterateRootFinder; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; int SensedNode; @@ -1605,6 +1485,9 @@ namespace HVACControllers { int PreviousSolutionMode; Real64 PreviousSolutionValue; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + auto & RootFinders(state.dataHVACControllers->RootFinders); + // Obtain actuated and sensed nodes ActuatedNode = ControllerProps(ControlNum).ActuatedNode; SensedNode = ControllerProps(ControlNum).SensedNode; @@ -1622,7 +1505,7 @@ namespace HVACControllers { // Map root finder status onto controller mode { auto const SELECT_CASE_var(RootFinders(ControlNum).StatusFlag); - if ((SELECT_CASE_var == iStatusNone) || (SELECT_CASE_var == iStatusWarningNonMonotonic) || (SELECT_CASE_var == iStatusWarningSingular)) { + if ((SELECT_CASE_var == iStatus::None) || (SELECT_CASE_var == iStatus::WarningNonMonotonic) || (SELECT_CASE_var == iStatus::WarningSingular)) { // We need to keep iterating... IsConvergedFlag = false; @@ -1644,8 +1527,8 @@ namespace HVACControllers { // Make sure that mode of previous solution was active // Make sure that proposed candidate does not conflict with current min/max range and lower/upper brackets ReusePreviousSolutionFlag = ControllerProps(ControlNum).ReusePreviousSolutionFlag && - (RootFinders(ControlNum).CurrentMethodType == iMethodBracket) && PreviousSolutionDefinedFlag && - (PreviousSolutionMode == iModeActive) && + (RootFinders(ControlNum).CurrentMethodType == DataRootFinder::iMethod::Bracket) && + PreviousSolutionDefinedFlag && (PreviousSolutionMode == iModeActive) && CheckRootFinderCandidate(RootFinders(ControlNum), PreviousSolutionValue); if (ReusePreviousSolutionFlag) { @@ -1660,21 +1543,21 @@ namespace HVACControllers { ControllerProps(ControlNum).NextActuatedValue = RootFinders(ControlNum).XCandidate; } - } else if ((SELECT_CASE_var == iStatusOK) || (SELECT_CASE_var == iStatusOKRoundOff)) { + } else if ((SELECT_CASE_var == iStatus::OK) || (SELECT_CASE_var == iStatus::OKRoundOff)) { // Indicate convergence with base value (used to obtain DeltaSensed!) - ExitCalcController(ControlNum, RootFinders(ControlNum).XCandidate, iModeActive, IsConvergedFlag, IsUpToDateFlag); + ExitCalcController(state, ControlNum, RootFinders(ControlNum).XCandidate, iModeActive, IsConvergedFlag, IsUpToDateFlag); - } else if (SELECT_CASE_var == iStatusOKMin) { + } else if (SELECT_CASE_var == iStatus::OKMin) { // Indicate convergence with min value // Should be the same as ControllerProps(ControlNum)%MinAvailActuated - ExitCalcController(ControlNum, RootFinders(ControlNum).MinPoint.X, iModeMinActive, IsConvergedFlag, IsUpToDateFlag); + ExitCalcController(state, ControlNum, RootFinders(ControlNum).MinPoint.X, iModeMinActive, IsConvergedFlag, IsUpToDateFlag); - } else if (SELECT_CASE_var == iStatusOKMax) { + } else if (SELECT_CASE_var == iStatus::OKMax) { // Indicate convergence with max value // Should be the same as ControllerProps(ControlNum)%MaxAvailActuated - ExitCalcController(ControlNum, RootFinders(ControlNum).MaxPoint.X, iModeMaxActive, IsConvergedFlag, IsUpToDateFlag); + ExitCalcController(state, ControlNum, RootFinders(ControlNum).MaxPoint.X, iModeMaxActive, IsConvergedFlag, IsUpToDateFlag); - } else if (SELECT_CASE_var == iStatusErrorSingular) { + } else if (SELECT_CASE_var == iStatus::ErrorSingular) { // Indicate inactive mode with min actuated value // NOTE: Original code returned Node(ActuatedNode)%MassFlowRateMinAvail // This was not portable in case the actuated variable was NOT a mass flow rate! @@ -1682,10 +1565,10 @@ namespace HVACControllers { // with RootFinders(ControlNum)%MinPoint%X // which is the same as (see SUBROUTINE InitController) // ControllerProps(ControlNum)%MinAvailActuated - ExitCalcController(ControlNum, RootFinders(ControlNum).MinPoint.X, iModeInactive, IsConvergedFlag, IsUpToDateFlag); + ExitCalcController(state, ControlNum, RootFinders(ControlNum).MinPoint.X, iModeInactive, IsConvergedFlag, IsUpToDateFlag); // Abnormal case: should never happen - } else if (SELECT_CASE_var == iStatusErrorRange) { + } else if (SELECT_CASE_var == iStatus::ErrorRange) { ShowSevereError(state, "FindRootSimpleController: Root finder failed at " + CreateHVACStepFullString(state)); ShowContinueError(state, " Controller name=\"" + ControllerName + "\""); ShowContinueError(state, @@ -1697,7 +1580,7 @@ namespace HVACControllers { ShowFatalError(state, "Preceding error causes program termination."); // Abnormal case: should never happen - } else if (SELECT_CASE_var == iStatusErrorBracket) { + } else if (SELECT_CASE_var == iStatus::ErrorBracket) { ShowSevereError(state, "FindRootSimpleController: Root finder failed at " + CreateHVACStepFullString(state)); ShowContinueError(state, " Controller name=" + ControllerProps(ControlNum).ControllerName); ShowContinueError(state, " Controller action=" + ActionTypes(ControllerProps(ControlNum).Action)); @@ -1724,7 +1607,7 @@ namespace HVACControllers { // - REVERSE ACTION: // - If y(xMin) < ySetPoint && y(xMax) > y(xMin), then x = xMin // - If y(xMin) > ySetPoint && y(xMax) > y(xMin), then x = xMax - } else if (SELECT_CASE_var == iStatusErrorSlope) { + } else if (SELECT_CASE_var == iStatus::ErrorSlope) { if (!state.dataGlobal->WarmupFlag && ControllerProps(ControlNum).BadActionErrCount == 0) { ++ControllerProps(ControlNum).BadActionErrCount; ShowSevereError(state, "FindRootSimpleController: Controller error for controller = \"" + ControllerName + "\""); @@ -1733,16 +1616,16 @@ namespace HVACControllers { ActionTypes(ControllerProps(ControlNum).Action)); ShowContinueError(state, " Actuator will be set to maximum action"); ShowContinueError(state, "Controller control type=" + ControlVariableTypes(ControllerProps(ControlNum).ControlVar)); - if (ControllerProps(ControlNum).ControlVar == iTemperature) { + if (ControllerProps(ControlNum).ControlVar == iCtrl::Temperature) { ShowContinueError(state, format("Controller temperature setpoint = {:.2T} [C]", ControllerProps(ControlNum).SetPointValue)); ShowContinueError(state, format("Controller sensed temperature = {:.2T} [C]", ControllerProps(ControlNum).SensedValue)); - } else if (ControllerProps(ControlNum).ControlVar == iHumidityRatio) { + } else if (ControllerProps(ControlNum).ControlVar == iCtrl::HumidityRatio) { ShowContinueError( state, format("Controller humidity ratio setpoint = {:.2T} [kgWater/kgDryAir]", ControllerProps(ControlNum).SetPointValue)); ShowContinueError( state, format("Controller sensed humidity ratio = {:.2T} [kgWater/kgDryAir]", ControllerProps(ControlNum).SensedValue)); - } else if (ControllerProps(ControlNum).ControlVar == iTemperatureAndHumidityRatio) { + } else if (ControllerProps(ControlNum).ControlVar == iCtrl::TemperatureAndHumidityRatio) { ShowContinueError(state, format("Controller temperature setpoint = {:.2T} [C]", ControllerProps(ControlNum).SetPointValue)); ShowContinueError(state, format("Controller sensed temperature = {:.2T} [C]", ControllerProps(ControlNum).SensedValue)); ShowContinueError(state, @@ -1751,17 +1634,17 @@ namespace HVACControllers { ShowContinueError(state, format("Controller sensed humidity ratio = {:.2T} [kgWater/kgDryAir]", state.dataLoopNodes->Node(ControllerProps(ControlNum).SensedNode).HumRat)); - } else if (ControllerProps(ControlNum).ControlVar == iFlow) { + } else if (ControllerProps(ControlNum).ControlVar == iCtrl::Flow) { ShowContinueError(state, format("Controller mass flow rate setpoint = {:.2T} [kg/s]", ControllerProps(ControlNum).SetPointValue)); ShowContinueError(state, format("Controller sensed mass flow rate = {:.2T} [kg/s]", ControllerProps(ControlNum).SensedValue)); } else { // bad control variable input checked in input routine } - if (ControllerProps(ControlNum).ActuatorVar == iFlow) { + if (ControllerProps(ControlNum).ActuatorVar == iCtrl::Flow) { ShowContinueError( state, format("Controller actuator mass flow rate set to {:.2T} [kg/s]", ControllerProps(ControlNum).MaxAvailActuated)); - if (ControllerProps(ControlNum).ControlVar == iTemperature) { + if (ControllerProps(ControlNum).ControlVar == iCtrl::Temperature) { ShowContinueError(state, format("Controller actuator temperature = {:.2T} [C]", state.dataLoopNodes->Node(ControllerProps(ControlNum).ActuatedNode).Temp)); @@ -1783,7 +1666,7 @@ namespace HVACControllers { } // Indicate convergence with min value // Should be the same as ControllerProps(ControlNum)%MaxAvailActuated - ExitCalcController(ControlNum, RootFinders(ControlNum).MaxPoint.X, iModeMaxActive, IsConvergedFlag, IsUpToDateFlag); + ExitCalcController(state, ControlNum, RootFinders(ControlNum).MaxPoint.X, iModeMaxActive, IsConvergedFlag, IsUpToDateFlag); } else { // Should never happen @@ -1813,30 +1696,15 @@ namespace HVACControllers { // state. // PRECONDITION: Setpoint must be known. See ControllerProps%IsSetPointDefinedFlag - // METHODOLOGY EMPLOYED: - - // REFERENCES: - - // Using/Aliasing - using RootFinder::CheckRootFinderConvergence; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; int SensedNode; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + auto & RootFinders(state.dataHVACControllers->RootFinders); + // Obtain actuated and sensed nodes ActuatedNode = ControllerProps(ControlNum).ActuatedNode; SensedNode = ControllerProps(ControlNum).SensedNode; @@ -1848,7 +1716,7 @@ namespace HVACControllers { auto const SELECT_CASE_var(ControllerProps(ControlNum).Mode); if (SELECT_CASE_var == iModeOff) { // Check whether the component is running - // This check is perfomed by looking at the component mass flow rate at the sensed node. + // This check is performed by looking at the component mass flow rate at the sensed node. // Since the components have been simulated before getting here, if they are zero they should be OFF. if (state.dataLoopNodes->Node(SensedNode).MassFlowRate == 0.0) { if (ControllerProps(ControlNum).ActuatedValue == 0.0) { @@ -1948,35 +1816,13 @@ namespace HVACControllers { // PURPOSE OF THIS FUNCTION: // Returns true if controller is min-constrained. false otherwise. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckMinActiveController; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - CheckMinActiveController = false; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + // Check that actuated value is the min avail actuated value if (ControllerProps(ControlNum).ActuatedValue != ControllerProps(ControlNum).MinAvailActuated) { CheckMinActiveController = false; @@ -2003,7 +1849,7 @@ namespace HVACControllers { // Should never happen ShowSevereError(state, "CheckMinActiveController: Invalid controller action during " + CreateHVACStepFullString(state) + '.'); ShowContinueError(state, "CheckMinActiveController: Controller name=" + ControllerProps(ControlNum).ControllerName); - ShowContinueError(state, "CheckMinActiveController: Valid choices are \"NORMAL\" or \"REVERSE\""); + ShowContinueError(state, R"(CheckMinActiveController: Valid choices are "NORMAL" or "REVERSE")"); ShowFatalError(state, "CheckMinActiveController: Preceding error causes program termination."); } } @@ -2022,35 +1868,13 @@ namespace HVACControllers { // PURPOSE OF THIS FUNCTION: // Returns true if controller is max-constrained. false otherwise. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckMaxActiveController; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - CheckMaxActiveController = false; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + // Check that actuated value is the max avail actuated value if (ControllerProps(ControlNum).ActuatedValue != ControllerProps(ControlNum).MaxAvailActuated) { CheckMaxActiveController = false; @@ -2077,7 +1901,7 @@ namespace HVACControllers { // Should never happen ShowSevereError(state, "CheckMaxActiveController: Invalid controller action during " + CreateHVACStepFullString(state) + '.'); ShowContinueError(state, "CheckMaxActiveController: Controller name=" + ControllerProps(ControlNum).ControllerName); - ShowContinueError(state, "CheckMaxActiveController: Valid choices are \"NORMAL\" or \"REVERSE\""); + ShowContinueError(state, R"(CheckMaxActiveController: Valid choices are "NORMAL" or "REVERSE")"); ShowFatalError(state, "CheckMaxActiveController: Preceding error causes program termination."); } } @@ -2085,7 +1909,7 @@ namespace HVACControllers { return CheckMaxActiveController; } - void SaveSimpleController(int const ControlNum, bool const FirstHVACIteration, bool const IsConvergedFlag) + void SaveSimpleController(EnergyPlusData &state, int const ControlNum, bool const FirstHVACIteration, bool const IsConvergedFlag) { // SUBROUTINE INFORMATION: @@ -2097,29 +1921,10 @@ namespace HVACControllers { // PURPOSE OF THIS SUBROUTINE: // Updates solution trackers if simple controller is converged. - // METHODOLOGY EMPLOYED: - - // REFERENCES: - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PreviousSolutionIndex; - + auto & ControllerProps(state.dataHVACControllers->ControllerProps); // Save solution and mode for next call only if converged if (IsConvergedFlag) { @@ -2153,31 +1958,15 @@ namespace HVACControllers { // PURPOSE OF THIS SUBROUTINE: // This subroutine updates the actuated node with the next candidate value. - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // REFERENCES: - // na - // Using/Aliasing using PlantUtilities::SetActuatedBranchFlowRate; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; int SensedNode; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + // Set the sensed and actuated node numbers ActuatedNode = ControllerProps(ControlNum).ActuatedNode; SensedNode = ControllerProps(ControlNum).SensedNode; @@ -2185,7 +1974,7 @@ namespace HVACControllers { // Set the actuated node of the Controller { auto const SELECT_CASE_var(ControllerProps(ControlNum).ActuatorVar); - if (SELECT_CASE_var == iFlow) { // 'Flow' + if (SELECT_CASE_var == iCtrl::Flow) { // 'Flow' SetActuatedBranchFlowRate(state, ControllerProps(ControlNum).NextActuatedValue, ControllerProps(ControlNum).ActuatedNode, ControllerProps(ControlNum).ActuatedNodePlantLoopNum, @@ -2200,16 +1989,13 @@ namespace HVACControllers { } } - // End of Update subroutines for the Controller Module - // ***************************************************************************** - void CheckTempAndHumRatCtrl(EnergyPlusData &state, int const ControlNum, bool &IsConvergedFlag) { { - auto &thisController(ControllerProps(ControlNum)); + auto &thisController(state.dataHVACControllers->ControllerProps(ControlNum)); if (IsConvergedFlag) { - if (thisController.ControlVar == iTemperatureAndHumidityRatio) { + if (thisController.ControlVar == iCtrl::TemperatureAndHumidityRatio) { // For temperature and humidity control, after temperature control is converged, check if humidity setpoint is met if (!thisController.HumRatCtrlOverride) { // For humidity control tolerance, always use 0.0001 which is roughly equivalent to a 0.015C change in dewpoint @@ -2221,7 +2007,12 @@ namespace HVACControllers { if (thisController.Action == iReverseAction) { // Cooling coil controller should always be ReverseAction, but skip this if not RootFinder::SetupRootFinder(state, - RootFinders(ControlNum), iSlopeDecreasing, iMethodFalsePosition, DataPrecisionGlobals::constant_zero, 1.0e-6, 1.0e-5); + state.dataHVACControllers->RootFinders(ControlNum), + iSlopeDecreasing, + DataRootFinder::iMethod::FalsePosition, + DataPrecisionGlobals::constant_zero, + 1.0e-6, + 1.0e-5); } // Do a cold start reset, same as iControllerOpColdStart ResetController(state, ControlNum, false, IsConvergedFlag); @@ -2232,7 +2023,7 @@ namespace HVACControllers { } } - void ExitCalcController(int const ControlNum, Real64 const NextActuatedValue, int const Mode, bool &IsConvergedFlag, bool &IsUpToDateFlag) + void ExitCalcController(EnergyPlusData &state, int const ControlNum, Real64 const NextActuatedValue, int const Mode, bool &IsConvergedFlag, bool &IsUpToDateFlag) { // SUBROUTINE INFORMATION: @@ -2252,26 +2043,7 @@ namespace HVACControllers { // - IsConvergedFlag // - IsUpToDateFlag - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na + auto & ControllerProps(state.dataHVACControllers->ControllerProps); ControllerProps(ControlNum).NextActuatedValue = NextActuatedValue; ControllerProps(ControlNum).Mode = Mode; @@ -2286,9 +2058,6 @@ namespace HVACControllers { } } - // Beginning of Statistics subroutines for the Controller Module - // ***************************************************************************** - void TrackAirLoopControllers(EnergyPlusData &state, int const AirLoopNum, int const WarmRestartStatus, int const AirLoopIterMax, int const AirLoopIterTot, int const AirLoopNumCalls) { @@ -2304,19 +2073,9 @@ namespace HVACControllers { // Used to produce objective metrics when analyzing runtime performance // of HVAC controllers for different implementations. - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // REFERENCES: - // na - // Using/Aliasing using DataHVACGlobals::NumPrimaryAirSys; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - // SUBROUTINE PARAMETER DEFINITIONS: // See CONTROLLER_WARM_RESTART_<> parameters in DataHVACControllers.cc // If Status<0, no speculative warm restart. @@ -2326,21 +2085,15 @@ namespace HVACControllers { // Aggregated number of iterations performed by controllers on this air loop (per call to SimAirLoop) // Number of times SimAirLoopComponents() has been invoked - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ControllerNum; + auto & AirLoopStats(state.dataHVACControllers->AirLoopStats); - - // If no controllers on this air loop then we have nothig to do + // If no controllers on this air loop then we have nothing to do if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumControllers == 0) return; // To avoid tracking statistics in case of no air loop or no HVAC controllers are defined - if (NumAirLoopStats == 0) return; + if (state.dataHVACControllers->NumAirLoopStats == 0) return; // Update performance statistics for air loop ++AirLoopStats(AirLoopNum).NumCalls; @@ -2387,28 +2140,8 @@ namespace HVACControllers { // Used to produce objective metrics when analyzing runtime performance // of HVAC controllers for different implementations. - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // REFERENCES: - // na - - // Using/Aliasing using DataHVACGlobals::NumPrimaryAirSys; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: // Corresponding index in ControllerProps array int ControlIndex; // Number of iterations needed to solve this controller @@ -2416,7 +2149,8 @@ namespace HVACControllers { // Current operating mode int Mode; - + auto & AirLoopStats(state.dataHVACControllers->AirLoopStats); + auto & ControllerProps(state.dataHVACControllers->ControllerProps); ControlIndex = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).ControllerIndex(AirLoopControlNum); @@ -2451,29 +2185,8 @@ namespace HVACControllers { // Writes runtime statistics for controllers on all air loops // to a CSV file named "statistics.HVACControllers.csv". - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // REFERENCES: - // na - - // Using/Aliasing using DataHVACGlobals::NumPrimaryAirSys; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - - // DERIVED TYPE DEFINITIONS - // na - - - // Detect if statistics have been generated or not for this run if (!state.dataSysVars->TrackAirLoopEnvFlag) { return; @@ -2485,7 +2198,7 @@ namespace HVACControllers { // note that the AirLoopStats object does not seem to be initialized when this code // is executed and it causes a crash here for (int AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { - WriteAirLoopStatistics(statisticsFile, state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum), AirLoopStats(AirLoopNum)); + WriteAirLoopStatistics(statisticsFile, state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum), state.dataHVACControllers->AirLoopStats(AirLoopNum)); } } @@ -2504,27 +2217,8 @@ namespace HVACControllers { // Writes runtime statistics for controllers on the specified air loop // to the specified file. - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // REFERENCES: - // na - - // Using/Aliasing using namespace DataAirSystems; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int AirLoopControlNum; int NumWarmRestarts; @@ -2535,8 +2229,6 @@ namespace HVACControllers { Real64 AvgIterations; int iModeNum; - - print(statisticsFile, "{},\n", ThisPrimaryAirSystem.Name); // Number of calls to SimAirLoop() has been invoked over the course of the simulation @@ -2635,9 +2327,6 @@ namespace HVACControllers { } } - // Beginning of Tracing subroutines for the Controller Module - // ***************************************************************************** - void SetupAirLoopControllersTracer(EnergyPlusData &state, int const AirLoopNum) { @@ -2651,15 +2340,13 @@ namespace HVACControllers { // Opens main trace file for controllers on specific air loop // and writes header row with titles. - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ControllerNum; // Open main controller trace file for each air loop const auto TraceFileName = "controller." + state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Name + ".csv"; + auto & AirLoopStats(state.dataHVACControllers->AirLoopStats); + // Store file unit in air loop stats AirLoopStats(AirLoopNum).TraceFile->fileName = TraceFileName; AirLoopStats(AirLoopNum).TraceFile->open(); @@ -2718,36 +2405,19 @@ namespace HVACControllers { // PURPOSE OF THIS SUBROUTINE: // This subroutine writes diagnostic to the trace file attached to each air loop. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // TRUE when primary air system & controllers simulation has converged; // Number of times SimAirLoopComponents() has been invoked - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ControllerNum; - + auto & AirLoopStats(state.dataHVACControllers->AirLoopStats); // IF no controllers on this air loop then we have nothing to do if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumControllers == 0) return; // To avoid tracking statistics in case of no air loop or no HVAC controllers are defined - if (NumAirLoopStats == 0) return; + if (state.dataHVACControllers->NumAirLoopStats == 0) return; // Setup trace file on first call only if (AirLoopStats(AirLoopNum).FirstTraceFlag) { @@ -2789,33 +2459,14 @@ namespace HVACControllers { // PURPOSE OF THIS SUBROUTINE: // Writes current iteration time stamp to specified trace file. - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // REFERENCES: - // na - // Using/Aliasing using DataHVACGlobals::FirstTimeStepSysFlag; using General::LogicalToInteger; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - // SUBROUTINE PARAMETER DEFINITIONS: // TRUE when primary air system and controllers simulation has converged; // Number of times SimAirLoopComponents() has been invoked - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - // Write step stamp to air loop trace file after reset // Note that we do not go to the next line print(TraceFile, @@ -2847,30 +2498,12 @@ namespace HVACControllers { // This subroutine writes convergence diagnostic to the air loop trace file // for the specified controller index. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; int SensedNode; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + // Set the sensed and actuated node numbers ActuatedNode = ControllerProps(ControlNum).ActuatedNode; SensedNode = ControllerProps(ControlNum).SensedNode; @@ -2897,25 +2530,9 @@ namespace HVACControllers { // Opens individual controller trace file for the specified controller // and writes header row. - // METHODOLOGY EMPLOYED: - // Needs description, as appropriate. - - // REFERENCES: - // na - - // Using/Aliasing using RootFinder::WriteRootFinderTraceHeader; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - - // DERIVED TYPE DEFINITIONS - // na + auto & ControllerProps(state.dataHVACControllers->ControllerProps); const auto TraceFileName = "controller." + ControllerProps(ControlNum).ControllerName + ".csv"; auto &TraceFile = *ControllerProps(ControlNum).TraceFile; @@ -2959,34 +2576,16 @@ namespace HVACControllers { // This subroutine writes convergence diagnostic to the trace file for the specified // controller. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing using General::LogicalToInteger; - using RootFinder::WriteRootFinderTrace; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ActuatedNode; int SensedNode; bool SkipLineFlag; + auto & ControllerProps(state.dataHVACControllers->ControllerProps); + // Setup individual trace file on first trace only if (ControllerProps(ControlNum).FirstTraceFlag) { SetupIndividualControllerTracer(state, ControlNum); @@ -3069,7 +2668,7 @@ namespace HVACControllers { // X | Y | setpoint | DeltaSensed = Y - YRoot | Offset | Mode | IsConvergedFlag // Append trace for root finder - WriteRootFinderTrace(TraceFile, RootFinders(ControlNum)); + WriteRootFinderTrace(TraceFile, state.dataHVACControllers->RootFinders(ControlNum)); // Finally skip line print(TraceFile, "\n"); @@ -3127,30 +2726,12 @@ namespace HVACControllers { // This function creates a string describing the current time stamp of the system // time step. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing using General::CreateTimeString; using General::GetCurrentHVACTime; // Return value std::string OutputString; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: std::string Buffer; @@ -3175,30 +2756,9 @@ namespace HVACControllers { // time stamp for the system time step. // It is used in error messages only. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing // Return value std::string OutputString; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - OutputString = state.dataEnvrn->EnvironmentName + ", " + MakeHVACTimeIntervalString(state); return OutputString; @@ -3217,39 +2777,17 @@ namespace HVACControllers { // This function creates a string describing the current time interval of the system // time step. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using General::CreateHVACTimeIntervalString; // Return value std::string OutputString; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - OutputString = stripped(CreateHVACTimeIntervalString(state)); return OutputString; } - // End of Tracing subroutines for the Controller Module - void CheckControllerListOrder(EnergyPlusData &state) { @@ -3298,9 +2836,9 @@ namespace HVACControllers { if (UtilityRoutines::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).ControllerType(ContrlNum), "CONTROLLER:WATERCOIL")) { ++SensedNodeIndex; foundControl = UtilityRoutines::FindItemInList( - state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).ControllerName(ContrlNum), ControllerProps, &ControllerPropsType::ControllerName); + state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).ControllerName(ContrlNum), state.dataHVACControllers->ControllerProps, &ControllerPropsType::ControllerName); if (foundControl > 0) { - ContrlSensedNodeNums(1, SensedNodeIndex) = ControllerProps(foundControl).SensedNode; + ContrlSensedNodeNums(1, SensedNodeIndex) = state.dataHVACControllers->ControllerProps(foundControl).SensedNode; } } } @@ -3364,37 +2902,17 @@ namespace HVACControllers { // This subroutine checks that the water inlet node number is matched by // the actuator node number of some water coil - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: int ControlNum; - if (GetControllerInputFlag) { + if (state.dataHVACControllers->GetControllerInputFlag) { GetControllerInput(state); - GetControllerInputFlag = false; + state.dataHVACControllers->GetControllerInputFlag = false; } NodeNotFound = true; - for (ControlNum = 1; ControlNum <= NumControllers; ++ControlNum) { - if (ControllerProps(ControlNum).ActuatedNode == WaterInletNodeNum) { + for (ControlNum = 1; ControlNum <= state.dataHVACControllers->NumControllers; ++ControlNum) { + if (state.dataHVACControllers->ControllerProps(ControlNum).ActuatedNode == WaterInletNodeNum) { NodeNotFound = false; } } @@ -3419,17 +2937,17 @@ namespace HVACControllers { // FUNCTION LOCAL VARIABLE DECLARATIONS: int ControlNum; - if (GetControllerInputFlag) { + if (state.dataHVACControllers->GetControllerInputFlag) { GetControllerInput(state); - GetControllerInputFlag = false; + state.dataHVACControllers->GetControllerInputFlag = false; } ControllerName = " "; ControllerIndex = 0; - for (ControlNum = 1; ControlNum <= NumControllers; ++ControlNum) { - if (ControllerProps(ControlNum).ActuatedNode == WaterInletNodeNum) { + for (ControlNum = 1; ControlNum <= state.dataHVACControllers->NumControllers; ++ControlNum) { + if (state.dataHVACControllers->ControllerProps(ControlNum).ActuatedNode == WaterInletNodeNum) { ControllerIndex = ControlNum; - ControllerName = ControllerProps(ControlNum).ControllerName; + ControllerName = state.dataHVACControllers->ControllerProps(ControlNum).ControllerName; break; } } @@ -3458,15 +2976,15 @@ namespace HVACControllers { // FUNCTION LOCAL VARIABLE DECLARATIONS: int ControlNum; - if (GetControllerInputFlag) { + if (state.dataHVACControllers->GetControllerInputFlag) { GetControllerInput(state); - GetControllerInputFlag = false; + state.dataHVACControllers->GetControllerInputFlag = false; } NodeNotFound = true; - ControlNum = UtilityRoutines::FindItemInList(ControllerName, ControllerProps, &ControllerPropsType::ControllerName); - if (ControlNum > 0 && ControlNum <= NumControllers) { - WaterInletNodeNum = ControllerProps(ControlNum).ActuatedNode; + ControlNum = UtilityRoutines::FindItemInList(ControllerName, state.dataHVACControllers->ControllerProps, &ControllerPropsType::ControllerName); + if (ControlNum > 0 && ControlNum <= state.dataHVACControllers->NumControllers) { + WaterInletNodeNum = state.dataHVACControllers->ControllerProps(ControlNum).ActuatedNode; NodeNotFound = false; } } @@ -3481,12 +2999,12 @@ namespace HVACControllers { // This subroutine finds the controllers actuator node number - if (GetControllerInputFlag) { + if (state.dataHVACControllers->GetControllerInputFlag) { GetControllerInput(state); - GetControllerInputFlag = false; + state.dataHVACControllers->GetControllerInputFlag = false; } - int ControllerIndex = UtilityRoutines::FindItemInList(ControllerName, ControllerProps, &ControllerPropsType::ControllerName); + int ControllerIndex = UtilityRoutines::FindItemInList(ControllerName, state.dataHVACControllers->ControllerProps, &ControllerPropsType::ControllerName); if (ControllerIndex == 0) { ShowFatalError(state, "ManageControllers: Invalid controller=" + ControllerName + ". The only valid controller type for an AirLoopHVAC is Controller:WaterCoil."); @@ -3496,5 +3014,3 @@ namespace HVACControllers { } } // namespace HVACControllers - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/HVACControllers.hh b/src/EnergyPlus/HVACControllers.hh index 536a90a5c41..9ee1b951e11 100644 --- a/src/EnergyPlus/HVACControllers.hh +++ b/src/EnergyPlus/HVACControllers.hh @@ -77,67 +77,15 @@ namespace HVACControllers { using DataHVACControllers::iNoAction; using DataRootFinder::RootFinderDataType; - // Data - // MODULE PARAMETER DEFINITIONS - // Number of significant digits to display in error messages for floating-point numbers - extern Real64 const SomeFloatingPoint; - extern int const NumSigDigits; - // Parameters for controls used here - extern int const iNoControlVariable; - extern int const iTemperature; - extern int const iHumidityRatio; - extern int const iTemperatureAndHumidityRatio; - extern int const iFlow; - - extern int const CoilType_Cooling; - extern int const CoilType_Heating; - - extern Array1D_string const ControlVariableTypes; - - // DERIVED TYPE DEFINITIONS - - // Type describing a controller's properties - - // Type describing a controller's runtime statistics over the course of the simulation - - // Type describing an air loop's runtime statistics over the course of the simulation - - // MODULE VARIABLE DECLARATIONS: - extern int NumControllers; // The number of controllers found in the Input - extern int NumAirLoopStats; // Same size as NumPrimaryAirSys if controllers - // are defined, 0 otherwise. - // all controllers per air loop - extern Array1D_bool CheckEquipName; - - // Flag set to make sure you get input once - extern bool GetControllerInputFlag; - - // SUBROUTINE Specifications for the Module - // Driver/Manager Routines - - // Get Input routines for module - - // Initialization routines for module - - // Algorithms for the module - - // Update routine to check convergence and update nodes - - // Reporting routines for module - - // Algorithms for the Simple Controller - - // Statistics routines - - // Trace routines for all controllers on each air loop - - // Trace routines for each individual controller - - // Misc routines - - // Types - + enum class iCtrl + { + NoControlVariable, + Temperature, + HumidityRatio, + TemperatureAndHumidityRatio, + Flow, + }; struct SolutionTrackerType { @@ -158,9 +106,9 @@ namespace HVACControllers { std::string ControllerName; // Name of the Controller std::string ControllerType; // Type of Controller int ControllerType_Num; - int ControlVar; // The type of control variable being sensed - int ActuatorVar; // The variable that the controller will act on ie. flow - int Action; // Controller Action - Reverse or Normal + iCtrl ControlVar; // The type of control variable being sensed + iCtrl ActuatorVar; // The variable that the controller will act on ie. flow + int Action; // Controller Action - Reverse or Normal // Controller must be initialized to set MinActuated and MaxActuated bool InitFirstPass; // -------------------- @@ -214,11 +162,11 @@ namespace HVACControllers { int SensedNode; // The sensed node number from the grid bool IsSetPointDefinedFlag; // If TRUE indicates that the setpoint has been defined and can // be used to compute DeltaSensed - Real64 SetPointValue; // Desired setpoint; set in the SetPoint Manager or computed in Init() routine - Real64 SensedValue; // The sensed control variable of any type - Real64 DeltaSensed; // Difference of sensed to setpoint value for calculating proportional gain - Real64 Offset; // This is the tolerance or droop from the error - SetPointManager::iCtrlVarType HumRatCntrlType; // iCtrlVarType_HumRat=4,iCtrlVarType_MaxHumRat=5,iCtrlVarType_MinHumRat=6 + Real64 SetPointValue; // Desired setpoint; set in the SetPoint Manager or computed in Init() routine + Real64 SensedValue; // The sensed control variable of any type + Real64 DeltaSensed; // Difference of sensed to setpoint value for calculating proportional gain + Real64 Offset; // This is the tolerance or droop from the error + SetPointManager::iCtrlVarType HumRatCntrlType; // iCtrlVarType_HumRat=4,iCtrlVarType_MaxHumRat=5,iCtrlVarType_MinHumRat=6 // -------------------- // Other controller inputs, not yet used // -------------------- @@ -243,14 +191,15 @@ namespace HVACControllers { // Default Constructor ControllerPropsType() - : ControllerType_Num(ControllerSimple_Type), ControlVar(iNoControlVariable), ActuatorVar(0), Action(iNoAction), InitFirstPass(true), - NumCalcCalls(0), Mode(iModeNone), DoWarmRestartFlag(false), ReuseIntermediateSolutionFlag(false), ReusePreviousSolutionFlag(false), - SolutionTrackers(2), MaxAvailActuated(0.0), MaxAvailSensed(0.0), MinAvailActuated(0.0), MinAvailSensed(0.0), MaxVolFlowActuated(0.0), - MinVolFlowActuated(0.0), MaxActuated(0.0), MinActuated(0.0), ActuatedNode(0), ActuatedValue(0.0), NextActuatedValue(0.0), - ActuatedNodePlantLoopNum(0), ActuatedNodePlantLoopSide(0), ActuatedNodePlantLoopBranchNum(0), SensedNode(0), - IsSetPointDefinedFlag(false), SetPointValue(0.0), SensedValue(0.0), DeltaSensed(0.0), Offset(0.0), HumRatCntrlType(SetPointManager::iCtrlVarType::Unknown), Range(0.0), - Limit(0.0), FirstTraceFlag(true), BadActionErrCount(0), BadActionErrIndex(0), FaultyCoilSATFlag(false), - FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0), BypassControllerCalc(false), AirLoopControllerIndex(0), HumRatCtrlOverride(false) + : ControllerType_Num(ControllerSimple_Type), ControlVar(iCtrl::NoControlVariable), ActuatorVar(iCtrl::NoControlVariable), + Action(iNoAction), InitFirstPass(true), NumCalcCalls(0), Mode(iModeNone), DoWarmRestartFlag(false), + ReuseIntermediateSolutionFlag(false), ReusePreviousSolutionFlag(false), SolutionTrackers(2), MaxAvailActuated(0.0), MaxAvailSensed(0.0), + MinAvailActuated(0.0), MinAvailSensed(0.0), MaxVolFlowActuated(0.0), MinVolFlowActuated(0.0), MaxActuated(0.0), MinActuated(0.0), + ActuatedNode(0), ActuatedValue(0.0), NextActuatedValue(0.0), ActuatedNodePlantLoopNum(0), ActuatedNodePlantLoopSide(0), + ActuatedNodePlantLoopBranchNum(0), SensedNode(0), IsSetPointDefinedFlag(false), SetPointValue(0.0), SensedValue(0.0), DeltaSensed(0.0), + Offset(0.0), HumRatCntrlType(SetPointManager::iCtrlVarType::Unknown), Range(0.0), Limit(0.0), FirstTraceFlag(true), + BadActionErrCount(0), BadActionErrIndex(0), FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0), + BypassControllerCalc(false), AirLoopControllerIndex(0), HumRatCtrlOverride(false) { } }; @@ -296,133 +245,87 @@ namespace HVACControllers { } }; - // Object Data - extern Array1D ControllerProps; - extern Array1D RootFinders; - extern Array1D AirLoopStats; // Statistics array to analyze computational profile for - - // Functions - - // Needed for unit tests, should not be normally called. - void clear_state(); - - void ManageControllers(EnergyPlusData &state, std::string const &ControllerName, + void ManageControllers(EnergyPlusData &state, + std::string const &ControllerName, int &ControllerIndex, - bool const FirstHVACIteration, - int const AirLoopNum, // unused1208 - int const Operation, + bool FirstHVACIteration, + int AirLoopNum, // unused1208 + int Operation, bool &IsConvergedFlag, bool &IsUpToDateFlag, bool &BypassOAController, Optional_bool AllowWarmRestartFlag = _); - // Get Input Section of the Module - //****************************************************************************** - void GetControllerInput(EnergyPlusData &state); - // End of Get Input subroutines for the Module - //****************************************************************************** - - // Beginning Initialization Section of the Module - //****************************************************************************** - - void ResetController(EnergyPlusData &state, int const ControlNum, bool const DoWarmRestartFlag, bool &IsConvergedFlag); + void ResetController(EnergyPlusData &state, int ControlNum, bool DoWarmRestartFlag, bool &IsConvergedFlag); - void InitController(EnergyPlusData &state, int const ControlNum, - bool &IsConvergedFlag); + void InitController(EnergyPlusData &state, int ControlNum, bool &IsConvergedFlag); - void SizeController(EnergyPlusData &state, int const ControlNum); - - // End Initialization Section of the Module - //****************************************************************************** - - // Begin Algorithm Section of the Module - //****************************************************************************** + void SizeController(EnergyPlusData &state, int ControlNum); void CalcSimpleController(EnergyPlusData &state, - int const ControlNum, - bool const FirstHVACIteration, + int ControlNum, + bool FirstHVACIteration, bool &IsConvergedFlag, bool &IsUpToDateFlag, std::string const &ControllerName // used when errors occur ); void FindRootSimpleController(EnergyPlusData &state, - int const ControlNum, - bool const FirstHVACIteration, + int ControlNum, + bool FirstHVACIteration, bool &IsConvergedFlag, bool &IsUpToDateFlag, std::string const &ControllerName // used when errors occur ); - void CheckSimpleController(EnergyPlusData &state, int const ControlNum, bool &IsConvergedFlag); - - bool CheckMinActiveController(EnergyPlusData &state, int const ControlNum); - - bool CheckMaxActiveController(EnergyPlusData &state, int const ControlNum); - - void CheckTempAndHumRatCtrl(EnergyPlusData &state, int const ControlNum, bool &IsConvergedFlag); + void CheckSimpleController(EnergyPlusData &state, int ControlNum, bool &IsConvergedFlag); - void SaveSimpleController(int const ControlNum, bool const FirstHVACIteration, bool const IsConvergedFlag); + bool CheckMinActiveController(EnergyPlusData &state, int ControlNum); - // End Algorithm Section of the Module - // ***************************************************************************** + bool CheckMaxActiveController(EnergyPlusData &state, int ControlNum); - // Beginning of Update subroutines for the Controller Module - // ***************************************************************************** + void CheckTempAndHumRatCtrl(EnergyPlusData &state, int ControlNum, bool &IsConvergedFlag); - void UpdateController(EnergyPlusData &state, int const ControlNum); + void SaveSimpleController(EnergyPlusData &state, int ControlNum, bool FirstHVACIteration, bool IsConvergedFlag); - // End of Update subroutines for the Controller Module - // ***************************************************************************** + void UpdateController(EnergyPlusData &state, int ControlNum); - void ExitCalcController(int const ControlNum, Real64 const NextActuatedValue, int const Mode, bool &IsConvergedFlag, bool &IsUpToDateFlag); + void ExitCalcController(EnergyPlusData &state, int ControlNum, Real64 NextActuatedValue, int Mode, bool &IsConvergedFlag, bool &IsUpToDateFlag); - // Beginning of Statistics subroutines for the Controller Module - // ***************************************************************************** - - void TrackAirLoopControllers(EnergyPlusData &state, - int const AirLoopNum, int const WarmRestartStatus, int const AirLoopIterMax, int const AirLoopIterTot, int const AirLoopNumCalls); + void TrackAirLoopControllers( + EnergyPlusData &state, int AirLoopNum, int WarmRestartStatus, int AirLoopIterMax, int AirLoopIterTot, int AirLoopNumCalls); void TrackAirLoopController(EnergyPlusData &state, - int const AirLoopNum, // Air loop index - int const AirLoopControlNum // Controller index on this air loop + int AirLoopNum, // Air loop index + int AirLoopControlNum // Controller index on this air loop ); void DumpAirLoopStatistics(EnergyPlusData &state); - void WriteAirLoopStatistics(InputOutputFile &statisticsFile, DefinePrimaryAirSystem const &ThisPrimaryAirSystem, AirLoopStatsType const &ThisAirLoopStats); - - // Beginning of Tracing subroutines for the Controller Module - // ***************************************************************************** + void WriteAirLoopStatistics(InputOutputFile &statisticsFile, + DefinePrimaryAirSystem const &ThisPrimaryAirSystem, + AirLoopStatsType const &ThisAirLoopStats); - void SetupAirLoopControllersTracer(EnergyPlusData &state, int const AirLoopNum); + void SetupAirLoopControllersTracer(EnergyPlusData &state, int AirLoopNum); - void TraceAirLoopControllers(EnergyPlusData &state, - bool const FirstHVACIteration, - int const AirLoopNum, - int const AirLoopPass, - bool const AirLoopConverged, - int const AirLoopNumCalls); + void TraceAirLoopControllers( + EnergyPlusData &state, bool FirstHVACIteration, int AirLoopNum, int AirLoopPass, bool AirLoopConverged, int AirLoopNumCalls); - void TraceIterationStamp(EnergyPlusData &state, - InputOutputFile &TraceFile, - bool const FirstHVACIteration, - int const AirLoopPass, - bool const AirLoopConverged, - int const AirLoopNumCalls); + void TraceIterationStamp( + EnergyPlusData &state, InputOutputFile &TraceFile, bool FirstHVACIteration, int AirLoopPass, bool AirLoopConverged, int AirLoopNumCalls); void TraceAirLoopController(EnergyPlusData &state, InputOutputFile &TraceFile, int const ControlNum); - void SetupIndividualControllerTracer(EnergyPlusData &state, int const ControlNum); + void SetupIndividualControllerTracer(EnergyPlusData &state, int ControlNum); void TraceIndividualController(EnergyPlusData &state, - int const ControlNum, - bool const FirstHVACIteration, - int const AirLoopPass, - int const Operation, // Operation to execute - bool const IsConvergedFlag); + int ControlNum, + bool FirstHVACIteration, + int AirLoopPass, + int Operation, // Operation to execute + bool IsConvergedFlag); std::string CreateHVACTimeString(EnergyPlusData &state); @@ -430,37 +333,62 @@ namespace HVACControllers { std::string MakeHVACTimeIntervalString(EnergyPlusData &state); - // End of Tracing subroutines for the Controller Module - void CheckControllerListOrder(EnergyPlusData &state); void CheckCoilWaterInletNode(EnergyPlusData &state, - int const WaterInletNodeNum, // input actuator node number - bool &NodeNotFound // true if matching actuator node not found, false if found + int WaterInletNodeNum, // input actuator node number + bool &NodeNotFound // true if matching actuator node not found, false if found ); void GetControllerNameAndIndex(EnergyPlusData &state, - int const WaterInletNodeNum, // input actuator node number + int WaterInletNodeNum, // input actuator node number std::string &ControllerName, // controller name used by water coil int &ControllerIndex, // controller index used by water coil bool &ErrorsFound // true if matching actuator node not found ); - void GetControllerActuatorNodeNum(EnergyPlusData &state, std::string const &ControllerName, // name of coil controller + void GetControllerActuatorNodeNum(EnergyPlusData &state, + std::string const &ControllerName, // name of coil controller int &WaterInletNodeNum, // input actuator node number bool &NodeNotFound // true if matching actuator node not found, false if found ); - int GetControllerIndex(EnergyPlusData &state, std::string const &ControllerName // name of coil controller + int GetControllerIndex(EnergyPlusData &state, + std::string const &ControllerName // name of coil controller ); } // namespace HVACControllers -struct HVACControllersData : BaseGlobalStruct { +struct HVACControllersData : BaseGlobalStruct +{ + int NumControllers = 0; // The number of controllers found in the Input + int NumAirLoopStats = 0; // Same size as NumPrimaryAirSys if controllers + Array1D_bool CheckEquipName; + bool GetControllerInputFlag = true; + bool InitControllerOneTimeFlag = true; + bool InitControllerSetPointCheckFlag = true; + Array1D ControllerProps; + Array1D RootFinders; + Array1D AirLoopStats; // Statistics array to analyze computational profile for + Array1D_bool MyEnvrnFlag; + Array1D_bool MySizeFlag; + Array1D_bool MyPlantIndexsFlag; + void clear_state() override { - + this->NumControllers = 0; + this->NumAirLoopStats = 0; + this->CheckEquipName.deallocate(); + this->GetControllerInputFlag = true; + this->InitControllerOneTimeFlag = true; + this->InitControllerSetPointCheckFlag = true; + this->ControllerProps.deallocate(); + this->RootFinders.deallocate(); + this->AirLoopStats.deallocate(); + this->MyEnvrnFlag.deallocate(); + this->MySizeFlag.deallocate(); + this->MyPlantIndexsFlag.deallocate(); } }; diff --git a/src/EnergyPlus/HVACDXSystem.cc b/src/EnergyPlus/HVACDXSystem.cc index 3c0ef696ec7..d6a0171d698 100644 --- a/src/EnergyPlus/HVACDXSystem.cc +++ b/src/EnergyPlus/HVACDXSystem.cc @@ -871,7 +871,7 @@ namespace HVACDXSystem { if (SupFanNum > 0) { coilSelectionReportObj->setCoilSupplyFanInfo(state, DXCoolingSystem(DXSystemNum).CoolingCoilName, DXCoolingSystem(DXSystemNum).CoolingCoilType, - Fans::Fan(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).SupFanNum).FanName, + state.dataFans->Fan(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).SupFanNum).FanName, DataAirSystems::structArrayLegacyFanModels, state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).SupFanNum); } diff --git a/src/EnergyPlus/HVACInterfaceManager.cc b/src/EnergyPlus/HVACInterfaceManager.cc index 776c6302f4b..8cca02c5991 100644 --- a/src/EnergyPlus/HVACInterfaceManager.cc +++ b/src/EnergyPlus/HVACInterfaceManager.cc @@ -66,9 +66,7 @@ #include #include -namespace EnergyPlus { - -namespace HVACInterfaceManager { +namespace EnergyPlus::HVACInterfaceManager { // MODULE INFORMATION: // AUTHOR Rick Strand @@ -87,38 +85,6 @@ namespace HVACInterfaceManager { // interface boundary and the logical flag is set if the nodes across // from each other are not within tolerance. - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // Data - // MODULE PARAMETER DEFINITIONS: - // Common Pipe Recirc Flow Directions - int const NoRecircFlow(0); - int const PrimaryRecirc(1); // flow from Supply-outlet/Demand-inlet to Supply-inlet/demand-outlet - int const SecondaryRecirc(2); // flow from Supply-inlet/Demand-oulet to Supply-outlet/demand-inlet - - int const FlowTypeNotSet(9); - int const ConstantFlow(10); - int const VariableFlow(11); - - // DERIVED TYPE DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - bool CommonPipeSetupFinished(false); - - // Object Data - Array1D PlantCommonPipe; - - // MODULE SUBROUTINES: - - // Functions - void UpdateHVACInterface(EnergyPlusData &state, int const AirLoopNum, // airloop number for which air loop this is DataConvergParams::iCalledFrom const CalledFrom, @@ -137,7 +103,7 @@ namespace HVACInterfaceManager { // METHODOLOGY EMPLOYED: // This is a simple "forward" interface where all of the properties - // from the outlet of one side of the loop get transfered directly + // from the outlet of one side of the loop get transferred directly // to the inlet node of the corresponding other side of the loop. static Array1D TmpRealARR(DataConvergParams::ConvergLogStackDepth); // Tuned Made static @@ -422,25 +388,13 @@ namespace HVACInterfaceManager { // flow or energy are out of tolerance. This in effect checks flow and // ~.25C temperature difference. - // REFERENCES: - // na - // Using/Aliasing using DataPlant::DemandSide; using FluidProperties::GetSpecificHeatGlycol; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("UpdatePlantLoopInterface"); - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 OldTankOutletTemp; Real64 OldOtherLoopSideInletMdot; @@ -449,8 +403,6 @@ namespace HVACInterfaceManager { Real64 MixedOutletTemp; int ThisLoopSideInletNode; - - auto &convergence(state.dataConvergeParams->PlantConvergence(LoopNum)); // reset out of tolerance flags @@ -598,19 +550,10 @@ namespace HVACInterfaceManager { using DataHVACGlobals::TimeStepSys; using FluidProperties::GetSpecificHeatGlycol; - // Locals - // SUBROUTINE ARGUMENTS: - // SUBROUTINE PARAMETER DEFINITIONS: Real64 const FracTotLoopMass(0.5); // Fraction of total loop mass assigned to the half loop static std::string const RoutineName("UpdateHalfLoopInletTemp"); - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int TankOutletLoopSide; // inlet loopsidenumber int TankInletNode; // inlet loop side outlet node @@ -627,8 +570,6 @@ namespace HVACInterfaceManager { Real64 TankFinalTemp; Real64 TankAverageTemp; - - // find tank inlet and outlet nodes TankOutletLoopSide = 3 - TankInletLoopSide; TankInletNode = state.dataPlnt->PlantLoop(LoopNum).LoopSide(TankInletLoopSide).NodeNumOut; @@ -757,14 +698,6 @@ namespace HVACInterfaceManager { // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("UpdateCommonPipe"); - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int TankOutletLoopSide; // inlet loopsidenumber int TankInletNode; // inlet loop side outlet node @@ -782,8 +715,6 @@ namespace HVACInterfaceManager { Real64 TankFinalTemp; Real64 TankAverageTemp; - - // find tank inlet and outlet nodes TankOutletLoopSide = 3 - TankInletLoopSide; TankInletNode = state.dataPlnt->PlantLoop(LoopNum).LoopSide(TankInletLoopSide).NodeNumOut; @@ -881,7 +812,7 @@ namespace HVACInterfaceManager { // MODIFIED B. Griffith, Jan 2010 clean up setup to allow mixing common pipe modes // B. Griffith, Mar 2010 add LoopNum arg and simplify // RE-ENGINEERED D. Fisher, Sept. 2010 - // B. Griffitth, Oct 2011, major rewrite for plant upgrade + // B. Griffith, Oct 2011, major rewrite for plant upgrade // PURPOSE OF THIS SUBROUTINE: // To determine the conditions in common pipe viz., the flow flow temperature and direction of flow. @@ -892,38 +823,33 @@ namespace HVACInterfaceManager { // called from "Demand to Supply" interface or "Supply to Demand" interface. Update the node temperatures // accordingly. - // REFERENCES: - // na - // Using/Aliasing using namespace DataPlant; - // SUBROUTINE ARGUMENT DEFINITIONS - - // Locals // SUBROUTINE LOCAL VARIABLE DECLARATIONS - static Real64 MdotPri(0.0); // flow rate on primary side kg/s - static Real64 MdotSec(0.0); // flow rate on secondary side kg/s - static Real64 MdotPriRCLeg(0.0); // flow rate of primary recirculation thru common pipe kg/s - static Real64 MdotSecRCLeg(0.0); // flow rate of secondary recirculation thru common pipe kg/s - static Real64 TempSecInlet(0.0); // temperature at secondary inlet deg C - static Real64 TempPriInlet(0.0); // temperature at primary inlet deg C - static Real64 TempPriOutTankOut(0.0); - static Real64 TempSecOutTankOut(0.0); - static int NodeNumPriOut(0); - static int NodeNumSecOut(0); - static int NodeNumPriIn(0); - static int NodeNumSecIn(0); + Real64 MdotPri(0.0); // flow rate on primary side kg/s + Real64 MdotSec(0.0); // flow rate on secondary side kg/s + Real64 MdotPriRCLeg(0.0); // flow rate of primary recirculation thru common pipe kg/s + Real64 MdotSecRCLeg(0.0); // flow rate of secondary recirculation thru common pipe kg/s + Real64 TempSecInlet(0.0); // temperature at secondary inlet deg C + Real64 TempPriInlet(0.0); // temperature at primary inlet deg C + Real64 TempPriOutTankOut(0.0); + Real64 TempSecOutTankOut(0.0); + int NodeNumPriOut(0); + int NodeNumSecOut(0); + int NodeNumPriIn(0); + int NodeNumSecIn(0); int CPFlowDir; // flow direction in single common pipe - static Array1D_bool MyEnvrnFlag; - static bool OneTimeData(true); Real64 CommonPipeTemp; + auto &PlantCommonPipe(state.dataHVACInterfaceMgr->PlantCommonPipe); + auto &MyEnvrnFlag(state.dataHVACInterfaceMgr->MyEnvrnFlag_SingleCommonPipe); + // One time call to set up report variables and set common pipe 'type' flag - if (OneTimeData) { - if (!CommonPipeSetupFinished) SetupCommonPipes(state); + if (state.dataHVACInterfaceMgr->OneTimeData_SingleCommonPipe) { + if (!state.dataHVACInterfaceMgr->CommonPipeSetupFinished) SetupCommonPipes(state); MyEnvrnFlag.dimension(state.dataPlnt->TotNumLoops, true); - OneTimeData = false; + state.dataHVACInterfaceMgr->OneTimeData_SingleCommonPipe = false; } // fill local node indexes @@ -1023,7 +949,7 @@ namespace HVACInterfaceManager { // METHODOLOGY EMPLOYED: // calculate mixed temperatures and various flow rates - // sequential subsitution of system of equations + // sequential substitution of system of equations // REFERENCES: // reimplementation of CheckTwoWayCommonPipeConditions by Sankaranarayanan K P Jan 2007 @@ -1034,54 +960,42 @@ namespace HVACInterfaceManager { using DataPlant::SupplySide; using PlantUtilities::SetActuatedBranchFlowRate; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: int const DemandLedPrimaryInletUpdate(101); int const DemandLedSecondaryInletUpdate(102); int const SupplyLedPrimaryInletUpdate(103); int const SupplyLedSecondaryInletUpdate(104); - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static Array1D_bool MyEnvrnFlag; - static bool OneTimeData(true); int CurCallingCase; // local temporary - static Real64 MdotPri(0.0); // flow rate on primary side kg/s - static Real64 MdotSec(0.0); // flow rate on secondary side kg/s - static Real64 MdotPriToSec(0.0); // flow rate between primary and secondary side kg/s - static Real64 MdotPriRCLeg(0.0); // flow rate on primary recirculation common pipe kg/s - static Real64 MdotSecRCLeg(0.0); // flow rate on secondary recirculation common pipe kg/s - static Real64 TempSecInlet(0.0); // temperature at secondary inlet deg C - static Real64 TempPriInlet(0.0); // temperature at primary inlet deg C - static Real64 TempPriOutTankOut(0.0); - static Real64 TempSecOutTankOut(0.0); - static Real64 TempCPPrimaryCntrlSetPoint(0.0); - // REAL(r64) :: TempCPCntrlCurrent = 0.0d0 - static Real64 TempCPSecondaryCntrlSetPoint(0.0); - // REAL(r64) :: TempCPCntrlCurrent = 0.0d0 - static int NodeNumPriOut(0); - static int NodeNumSecOut(0); - static int NodeNumPriIn(0); - static int NodeNumSecIn(0); - - static int MaxIterLimitCaseA(8); - static int MaxIterLimitCaseB(4); - - int loop; // interation loop counter - // INTEGER :: loop2 + Real64 MdotPri(0.0); // flow rate on primary side kg/s + Real64 MdotSec(0.0); // flow rate on secondary side kg/s + Real64 MdotPriToSec(0.0); // flow rate between primary and secondary side kg/s + Real64 MdotPriRCLeg(0.0); // flow rate on primary recirculation common pipe kg/s + Real64 MdotSecRCLeg(0.0); // flow rate on secondary recirculation common pipe kg/s + Real64 TempSecInlet(0.0); // temperature at secondary inlet deg C + Real64 TempPriInlet(0.0); // temperature at primary inlet deg C + Real64 TempPriOutTankOut(0.0); + Real64 TempSecOutTankOut(0.0); + Real64 TempCPPrimaryCntrlSetPoint(0.0); + Real64 TempCPSecondaryCntrlSetPoint(0.0); + int NodeNumPriOut(0); + int NodeNumSecOut(0); + int NodeNumPriIn(0); + int NodeNumSecIn(0); + constexpr int MaxIterLimitCaseA(8); + constexpr int MaxIterLimitCaseB(4); + + int loop; // iteration loop counter + + auto &PlantCommonPipe(state.dataHVACInterfaceMgr->PlantCommonPipe); + auto &MyEnvrnFlag(state.dataHVACInterfaceMgr->MyEnvrnFlag_TwoWayCommonPipe); // one time setups - if (OneTimeData) { - if (!CommonPipeSetupFinished) SetupCommonPipes(state); + if (state.dataHVACInterfaceMgr->OneTimeData_TwoWayCommonPipe) { + if (!state.dataHVACInterfaceMgr->CommonPipeSetupFinished) SetupCommonPipes(state); MyEnvrnFlag.dimension(state.dataPlnt->TotNumLoops, true); - OneTimeData = false; + state.dataHVACInterfaceMgr->OneTimeData_TwoWayCommonPipe = false; } // fill local node indexes @@ -1180,13 +1094,9 @@ namespace HVACInterfaceManager { if ((PlantCommonPipe(LoopNum).SupplySideInletPumpType == VariableFlow) && (CurCallingCase == SupplyLedPrimaryInletUpdate)) { // MdotPri is a variable to be calculated and flow request needs to be made if (std::abs(TempCPPrimaryCntrlSetPoint) > DeltaTempTol) { - // Do loop2 = 1, MaxIterLimitCaseA - // MdotPri = (MdotSec * TempSecInlet + MdotPriRCLeg *TempPriOutTankOut - MdotSecRCLeg * TempSecOutTankOut ) & - // / (TempPriOutTankOut ) MdotPri = (MdotPriRCLeg * TempPriOutTankOut + MdotPriToSec * TempSecOutTankOut) / (TempCPPrimaryCntrlSetPoint); - // ENDDO if (MdotPri < DataBranchAirLoopPlant::MassFlowTolerance) MdotPri = 0.0; } else { MdotPri = MdotSec; @@ -1276,31 +1186,14 @@ namespace HVACInterfaceManager { // PURPOSE OF THIS SUBROUTINE: // collect allocation, outputs, and other set up for common pipes - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - // Using/Aliasing using namespace DataPlant; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int CurLoopNum; // local do loop counter + auto &PlantCommonPipe(state.dataHVACInterfaceMgr->PlantCommonPipe); + PlantCommonPipe.allocate(state.dataPlnt->TotNumLoops); for (CurLoopNum = 1; CurLoopNum <= state.dataPlnt->TotNumLoops; ++CurLoopNum) { @@ -1391,9 +1284,7 @@ namespace HVACInterfaceManager { } } - CommonPipeSetupFinished = true; + state.dataHVACInterfaceMgr->CommonPipeSetupFinished = true; } -} // namespace HVACInterfaceManager - } // namespace EnergyPlus diff --git a/src/EnergyPlus/HVACInterfaceManager.hh b/src/EnergyPlus/HVACInterfaceManager.hh index 2c0510fe9e8..84622efb9c4 100644 --- a/src/EnergyPlus/HVACInterfaceManager.hh +++ b/src/EnergyPlus/HVACInterfaceManager.hh @@ -64,26 +64,14 @@ struct EnergyPlusData; namespace HVACInterfaceManager { - // Data - // MODULE PARAMETER DEFINITIONS: // Common Pipe Recirc Flow Directions - extern int const NoRecircFlow; - extern int const PrimaryRecirc; // flow from Supply-outlet/Demand-inlet to Supply-inlet/demand-outlet - extern int const SecondaryRecirc; // flow from Supply-inlet/Demand-oulet to Supply-outlet/demand-inlet + constexpr int NoRecircFlow(0); + constexpr int PrimaryRecirc(1); // flow from Supply-outlet/Demand-inlet to Supply-inlet/demand-outlet + constexpr int SecondaryRecirc(2); // flow from Supply-inlet/Demand-outlet to Supply-outlet/demand-inlet - extern int const FlowTypeNotSet; - extern int const ConstantFlow; - extern int const VariableFlow; - - // DERIVED TYPE DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - extern bool CommonPipeSetupFinished; - - // Types + constexpr int FlowTypeNotSet(9); + constexpr int ConstantFlow(10); + constexpr int VariableFlow(11); struct CommonPipeData { @@ -120,57 +108,64 @@ namespace HVACInterfaceManager { } }; - // Object Data - extern Array1D PlantCommonPipe; - // Functions void UpdateHVACInterface(EnergyPlusData &state, - int const AirLoopNum, // airloop number for which air loop this is - DataConvergParams::iCalledFrom const CalledFrom, - int const OutletNode, // Node number for the outlet of the side of the loop just simulated - int const InletNode, // Node number for the inlet of the side that needs the outlet node data + int AirLoopNum, // airloop number for which air loop this is + DataConvergParams::iCalledFrom CalledFrom, + int OutletNode, // Node number for the outlet of the side of the loop just simulated + int InletNode, // Node number for the inlet of the side that needs the outlet node data bool &OutOfToleranceFlag // True when the other side of the loop need to be (re)simulated ); //*************** void UpdatePlantLoopInterface(EnergyPlusData &state, - int const LoopNum, // The 'inlet/outlet node' loop number - int const ThisLoopSideNum, // The 'outlet node' LoopSide number - int const ThisLoopSideOutletNode, // Node number for the inlet of the side that needs the outlet node data - int const OtherLoopSideInletNode, // Node number for the outlet of the side of the loop just simulated - bool &OutOfToleranceFlag, // True when the other side of the loop need to be (re)simulated - DataPlant::iCommonPipeType const CommonPipeType); + int LoopNum, // The 'inlet/outlet node' loop number + int ThisLoopSideNum, // The 'outlet node' LoopSide number + int ThisLoopSideOutletNode, // Node number for the inlet of the side that needs the outlet node data + int OtherLoopSideInletNode, // Node number for the outlet of the side of the loop just simulated + bool &OutOfToleranceFlag, // True when the other side of the loop need to be (re)simulated + DataPlant::iCommonPipeType CommonPipeType); //*************** - void UpdateHalfLoopInletTemp(EnergyPlusData &state, int const LoopNum, int const TankInletLoopSide, Real64 &TankOutletTemp); + void UpdateHalfLoopInletTemp(EnergyPlusData &state, int LoopNum, int TankInletLoopSide, Real64 &TankOutletTemp); - void UpdateCommonPipe(EnergyPlusData &state, - int const LoopNum, - int const TankInletLoopSide, - DataPlant::iCommonPipeType const CommonPipeType, - Real64 &MixedOutletTemp); + void + UpdateCommonPipe(EnergyPlusData &state, int LoopNum, int TankInletLoopSide, DataPlant::iCommonPipeType CommonPipeType, Real64 &MixedOutletTemp); void ManageSingleCommonPipe(EnergyPlusData &state, - int const LoopNum, // plant loop number - int const LoopSide, // plant loop side number - Real64 const TankOutletTemp, // inlet temperature to the common pipe passed in from the capacitance calculation - Real64 &MixedOutletTemp // inlet temperature to the common pipe passed in from the capacitance calculation + int LoopNum, // plant loop number + int LoopSide, // plant loop side number + Real64 TankOutletTemp, // inlet temperature to the common pipe passed in from the capacitance calculation + Real64 &MixedOutletTemp // inlet temperature to the common pipe passed in from the capacitance calculation ); - void ManageTwoWayCommonPipe(EnergyPlusData &state, int const LoopNum, int const LoopSide, Real64 const TankOutletTemp); + void ManageTwoWayCommonPipe(EnergyPlusData &state, int LoopNum, int LoopSide, Real64 TankOutletTemp); void SetupCommonPipes(EnergyPlusData &state); } // namespace HVACInterfaceManager -struct HVACInterfaceManagerData : BaseGlobalStruct { +struct HVACInterfaceManagerData : BaseGlobalStruct +{ + + bool CommonPipeSetupFinished = false; + Array1D PlantCommonPipe; + Array1D_bool MyEnvrnFlag_SingleCommonPipe; + Array1D_bool MyEnvrnFlag_TwoWayCommonPipe; + bool OneTimeData_SingleCommonPipe = true; + bool OneTimeData_TwoWayCommonPipe = true; void clear_state() override { - + this->CommonPipeSetupFinished = false; + this->PlantCommonPipe.deallocate(); + this->MyEnvrnFlag_SingleCommonPipe.deallocate(); + this->MyEnvrnFlag_TwoWayCommonPipe.deallocate(); + this->OneTimeData_SingleCommonPipe = true; + this->OneTimeData_TwoWayCommonPipe = true; } }; diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index 9df97a2d56a..256e50573fc 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -127,7 +127,6 @@ namespace EnergyPlus::HVACManager { using namespace DataHVACGlobals; using namespace DataLoopNode; using namespace DataAirLoop; - using namespace DataReportingFlags; int HVACManageIteration(0); // counts iterations to enforce maximum iteration limit int RepIterAir(0); @@ -453,17 +452,17 @@ namespace EnergyPlus::HVACManager { } if (!state.dataGlobal->BeginDayFlag) state.dataEnvrn->PrintEnvrnStampWarmupPrinted = false; if (state.dataEnvrn->PrintEnvrnStampWarmup) { - if (PrintEndDataDictionary && state.dataGlobal->DoOutputReporting && !PrintedWarmup) { + if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting && !PrintedWarmup) { print(state.files.eso, "{}\n", EndOfHeaderString); print(state.files.mtr, "{}\n", EndOfHeaderString); - PrintEndDataDictionary = false; + state.dataReportFlag->PrintEndDataDictionary = false; } if (state.dataGlobal->DoOutputReporting && !PrintedWarmup) { print(state.files.eso, EnvironmentStampFormatStr, "1", - "Warmup {" + cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, + "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, state.dataEnvrn->Latitude, state.dataEnvrn->Longitude, state.dataEnvrn->TimeZoneNumber, @@ -471,7 +470,7 @@ namespace EnergyPlus::HVACManager { print(state.files.mtr, EnvironmentStampFormatStr, "1", - "Warmup {" + cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, + "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, state.dataEnvrn->Latitude, state.dataEnvrn->Longitude, state.dataEnvrn->TimeZoneNumber, @@ -492,16 +491,16 @@ namespace EnergyPlus::HVACManager { } if (!state.dataGlobal->BeginDayFlag) state.dataEnvrn->PrintEnvrnStampWarmupPrinted = false; if (state.dataEnvrn->PrintEnvrnStampWarmup) { - if (PrintEndDataDictionary && state.dataGlobal->DoOutputReporting && !PrintedWarmup) { + if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting && !PrintedWarmup) { print(state.files.eso, "{}\n", EndOfHeaderString); print(state.files.mtr, "{}\n", EndOfHeaderString); - PrintEndDataDictionary = false; + state.dataReportFlag->PrintEndDataDictionary = false; } if (state.dataGlobal->DoOutputReporting && !PrintedWarmup) { print(state.files.eso, EnvironmentStampFormatStr, "1", - "Warmup {" + cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, + "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, state.dataEnvrn->Latitude, state.dataEnvrn->Longitude, state.dataEnvrn->TimeZoneNumber, @@ -509,7 +508,7 @@ namespace EnergyPlus::HVACManager { print(state.files.mtr, EnvironmentStampFormatStr, "1", - "Warmup {" + cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, + "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, state.dataEnvrn->Latitude, state.dataEnvrn->Longitude, state.dataEnvrn->TimeZoneNumber, @@ -537,8 +536,8 @@ namespace EnergyPlus::HVACManager { // DO FINAL UPDATE OF RECORD KEEPING VARIABLES // Report the Node Data to Aid in Debugging - if (DebugOutput) { - if (EvenDuringWarmup) { + if (state.dataReportFlag->DebugOutput) { + if (state.dataReportFlag->EvenDuringWarmup) { ReportDebug = true; } else { ReportDebug = !state.dataGlobal->WarmupFlag; @@ -2154,7 +2153,6 @@ namespace EnergyPlus::HVACManager { using Psychrometrics::PsyRhoAirFnPbTdbW; using AirflowNetworkBalanceManager::ReportAirflowNetwork; using DataHVACGlobals::FanType_ZoneExhaust; - using Fans::Fan; // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName3("ReportAirHeatBalance:3"); @@ -2188,6 +2186,7 @@ namespace EnergyPlus::HVACManager { auto &CrossMixing(state.dataHeatBal->CrossMixing); auto &RefDoorMixing(state.dataHeatBal->RefDoorMixing); auto &ZoneEquipConfig(state.dataZoneEquip->ZoneEquipConfig); + auto &Fan(state.dataFans->Fan); // Ensure no airflownetwork and simple calculations if (AirflowNetwork::SimulateAirflowNetwork == 0) return; diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc index df33fdd4715..bc2d88bd721 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc @@ -495,7 +495,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).AuxElecPower = MSHeatPump(MSHeatPumpNum).AuxOnCyclePower * SaveCompressorPLR + MSHeatPump(MSHeatPumpNum).AuxOffCyclePower * (1.0 - SaveCompressorPLR); Real64 locFanElecPower = 0.0; - locFanElecPower = Fans::GetFanPower(MSHeatPump(MSHeatPumpNum).FanNum); + locFanElecPower = Fans::GetFanPower(state, MSHeatPump(MSHeatPumpNum).FanNum); MSHeatPump(MSHeatPumpNum).ElecPower = locFanElecPower + DXElecCoolingPower + DXElecHeatingPower + ElecHeatingCoilPower + DataHVACGlobals::SuppHeatingCoilPower + MSHeatPump(MSHeatPumpNum).AuxElecPower; } @@ -1981,7 +1981,7 @@ namespace HVACMultiSpeedHeatPump { } if (!state.dataGlobal->SysSizingCalc && MSHeatPump(MSHeatPumpNum).MySizeFlag) { - GetFanVolFlow(MSHeatPump(MSHeatPumpNum).FanNum, MSHeatPump(MSHeatPumpNum).FanVolFlow); + GetFanVolFlow(state, MSHeatPump(MSHeatPumpNum).FanNum, MSHeatPump(MSHeatPumpNum).FanVolFlow); SizeMSHeatPump(state, MSHeatPumpNum); MSHeatPump(MSHeatPumpNum).FlowFraction = 1.0; MSHeatPump(MSHeatPumpNum).MySizeFlag = false; @@ -2214,7 +2214,7 @@ namespace HVACMultiSpeedHeatPump { // IF MSHP system was not autosized and the fan is autosized, check that fan volumetric flow rate is greater than MSHP flow rates if (!state.dataGlobal->DoingSizing && MSHeatPump(MSHeatPumpNum).CheckFanFlow) { CurrentModuleObject = "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed"; - GetFanVolFlow(MSHeatPump(MSHeatPumpNum).FanNum, MSHeatPump(MSHeatPumpNum).FanVolFlow); + GetFanVolFlow(state, MSHeatPump(MSHeatPumpNum).FanNum, MSHeatPump(MSHeatPumpNum).FanVolFlow); if (MSHeatPump(MSHeatPumpNum).FanVolFlow != AutoSize) { // Check fan versus system supply air flow rates if (MSHeatPump(MSHeatPumpNum).FanVolFlow < MSHeatPump(MSHeatPumpNum).CoolVolumeFlowRate(NumOfSpeedCooling)) { diff --git a/src/EnergyPlus/HVACSizingSimulationManager.cc b/src/EnergyPlus/HVACSizingSimulationManager.cc index 7e708fdf33c..bf9f8a18732 100644 --- a/src/EnergyPlus/HVACSizingSimulationManager.cc +++ b/src/EnergyPlus/HVACSizingSimulationManager.cc @@ -206,11 +206,8 @@ void ManageHVACSizingSimulation(EnergyPlusData &state, bool &ErrorsFound) { using EMSManager::ManageEMS; using ExteriorEnergyUse::ManageExteriorEnergyUse; - using PlantPipingSystemsManager::SimulateGroundDomains; - using namespace WeatherManager; - using namespace DataReportingFlags; using namespace HeatBalanceManager; hvacSizingSimulationManager = std::unique_ptr(new HVACSizingSimulationManager()); @@ -278,7 +275,7 @@ void ManageHVACSizingSimulation(EnergyPlusData &state, bool &ErrorsFound) state.dataGlobal->WarmupFlag = true; state.dataGlobal->DayOfSim = 0; state.dataGlobal->DayOfSimChr = "0"; - NumOfWarmupDays = 0; + state.dataReportFlag->NumOfWarmupDays = 0; bool anyEMSRan; ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyEMSRan, ObjexxFCL::Optional_int_const()); // calling point @@ -301,16 +298,16 @@ void ManageHVACSizingSimulation(EnergyPlusData &state, bool &ErrorsFound) state.dataGlobal->EndDayFlag = false; if (state.dataGlobal->WarmupFlag) { - ++NumOfWarmupDays; - cWarmupDay = fmt::to_string(NumOfWarmupDays); - DisplayString(state, "Warming up {" + cWarmupDay + '}'); + ++state.dataReportFlag->NumOfWarmupDays; + state.dataReportFlag->cWarmupDay = fmt::to_string(state.dataReportFlag->NumOfWarmupDays); + DisplayString(state, "Warming up {" + state.dataReportFlag->cWarmupDay + '}'); } else if (state.dataGlobal->DayOfSim == 1) { DisplayString(state, fmt::format("Starting HVAC Sizing Simulation at {} for {}", state.dataEnvrn->CurMnDy, state.dataEnvrn->EnvironmentName)); static constexpr auto Format_700("Environment:WarmupDays,{:3}\n"); - print(state.files.eio, Format_700, NumOfWarmupDays); - } else if (DisplayPerfSimulationFlag) { + print(state.files.eio, Format_700, state.dataReportFlag->NumOfWarmupDays); + } else if (state.dataReportFlag->DisplayPerfSimulationFlag) { DisplayString(state, "Continuing Simulation at " + state.dataEnvrn->CurMnDy + " for " + state.dataEnvrn->EnvironmentName); - DisplayPerfSimulationFlag = false; + state.dataReportFlag->DisplayPerfSimulationFlag = false; } for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index 9f2e09c10d0..9942230abc5 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -1589,7 +1589,7 @@ namespace EnergyPlus::HVACStandAloneERV { _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); - state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ElecUseRate += Fans::GetFanPower(state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).SupplyAirFanIndex); + state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ElecUseRate += Fans::GetFanPower(state, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).SupplyAirFanIndex); } else { HVACFan::fanObjs[state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).SupplyAirFanIndex]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ElecUseRate += HVACFan::fanObjs[state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).SupplyAirFanIndex]->fanPower(); @@ -1600,7 +1600,7 @@ namespace EnergyPlus::HVACStandAloneERV { state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ExhaustAirFanName, FirstHVACIteration, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ExhaustAirFanIndex); // why no Turn on off flags here? - state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ElecUseRate += Fans::GetFanPower(state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ExhaustAirFanIndex); + state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ElecUseRate += Fans::GetFanPower(state, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ExhaustAirFanIndex); } else { HVACFan::fanObjs[state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ExhaustAirFanIndex]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ElecUseRate += HVACFan::fanObjs[state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ExhaustAirFanIndex]->fanPower(); @@ -2082,7 +2082,7 @@ namespace EnergyPlus::HVACStandAloneERV { // Fan:OnOff SupplyFanInletNodeIndex = Fans::GetFanInletNode(state, "Fan:OnOff", StandAloneERV.SupplyAirFanName, ErrorsFound); SupplyFanOutletNodeIndex = Fans::GetFanOutletNode(state, "Fan:OnOff", StandAloneERV.SupplyAirFanName, ErrorsFound); - GetFanVolFlow(StandAloneERV.SupplyAirFanIndex, SupplyFanAirFlow); + GetFanVolFlow(state, StandAloneERV.SupplyAirFanIndex, SupplyFanAirFlow); if (ErrorsFound) { ShowWarningError(state, "Could not retrieve fan outlet node for this unit=\"" + StandAloneERV.Name + "\"."); ErrorsFound = true; @@ -2098,7 +2098,7 @@ namespace EnergyPlus::HVACStandAloneERV { // Fan:OnOff ExhaustFanInletNodeIndex = Fans::GetFanInletNode(state, "Fan:OnOff", StandAloneERV.ExhaustAirFanName, ErrorsFound); ExhaustFanOutletNodeIndex = Fans::GetFanOutletNode(state, "Fan:OnOff", StandAloneERV.ExhaustAirFanName, ErrorsFound); - GetFanVolFlow(StandAloneERV.ExhaustAirFanIndex, ExhaustFanAirFlow); + GetFanVolFlow(state, StandAloneERV.ExhaustAirFanIndex, ExhaustFanAirFlow); if (ErrorsFound) { ShowWarningError(state, "Could not retrieve fan outlet node for this unit=\"" + StandAloneERV.Name + "\"."); ErrorsFound = true; diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 9d1532bbae1..5bc11ba3e5d 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -218,7 +218,7 @@ namespace HVACUnitaryBypassVAV { QSensUnitOut = 0.0; // probably don't need this initialization Real64 HeatingPower; // Power consumption of DX heating coil or electric heating coil [W] - + auto &CBVAV(state.dataHVACUnitaryBypassVAV->CBVAV); // zero the fan and DX coils electricity consumption @@ -302,7 +302,7 @@ namespace HVACUnitaryBypassVAV { if (CBVAV(CBVAVNum).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { locFanElecPower = HVACFan::fanObjs[CBVAV(CBVAVNum).FanIndex]->fanPower(); } else { - locFanElecPower = Fans::GetFanPower(CBVAV(CBVAVNum).FanIndex); + locFanElecPower = Fans::GetFanPower(state, CBVAV(CBVAVNum).FanIndex); } CBVAV(CBVAVNum).ElecPower = locFanElecPower + DataHVACGlobals::DXElecCoolingPower + HeatingPower; @@ -353,7 +353,7 @@ namespace HVACUnitaryBypassVAV { // find the number of each type of CBVAV unit std::string CurrentModuleObject = "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass"; - + auto &CBVAV(state.dataHVACUnitaryBypassVAV->CBVAV); auto &NumCBVAV(state.dataHVACUnitaryBypassVAV->NumCBVAV); @@ -613,7 +613,7 @@ namespace HVACUnitaryBypassVAV { CBVAV(CBVAVNum).FanInletNodeNum = Fans::GetFanInletNode(state, CBVAV(CBVAVNum).FanType, CBVAV(CBVAVNum).FanName, FanErrFlag); fanOutletNode = Fans::GetFanOutletNode(state, CBVAV(CBVAVNum).FanType, CBVAV(CBVAVNum).FanName, ErrorsFound); Fans::GetFanIndex(state, CBVAV(CBVAVNum).FanName, CBVAV(CBVAVNum).FanIndex, FanErrFlag, ObjexxFCL::Optional_string_const()); - Fans::GetFanVolFlow(CBVAV(CBVAVNum).FanIndex, CBVAV(CBVAVNum).FanVolFlow); + Fans::GetFanVolFlow(state, CBVAV(CBVAVNum).FanIndex, CBVAV(CBVAVNum).FanVolFlow); } } diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index a8cdcd43d86..e8d7fad97f5 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -3369,8 +3369,8 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanInletNode = Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).InletNodeNum; - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode = Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).OutletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanInletNode = state.dataFans->Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).InletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode = state.dataFans->Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).OutletNodeNum; } // Set the Design Fan Volume Flow Rate @@ -3544,7 +3544,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { } else { if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) { state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = - EnergyPlus::Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; + state.dataFans->Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; } else { state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = AutoSize; } @@ -3815,7 +3815,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { } else { if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) { state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = - EnergyPlus::Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; + state.dataFans->Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; } else { state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = AutoSize; } @@ -6329,7 +6329,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate = HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; } else { - GetFanVolFlow(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate); + GetFanVolFlow(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate); } } } else { @@ -8894,7 +8894,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { if (this->fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { this->FanPower = HVACFan::fanObjs[this->FanIndex]->fanPower(); } else { - this->FanPower = Fans::GetFanPower(this->FanIndex); + this->FanPower = Fans::GetFanPower(state, this->FanIndex); } // run supplemental heating coil @@ -12070,7 +12070,7 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { if (this->fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { this->FanPower = HVACFan::fanObjs[this->FanIndex]->fanPower(); } else { - this->FanPower = Fans::GetFanPower(this->FanIndex); + this->FanPower = Fans::GetFanPower(state, this->FanIndex); } // run supplemental heating coil @@ -12244,7 +12244,6 @@ namespace EnergyPlus::HVACVariableRefrigerantFlow { // OA mixer simulation, which leads to different coil inlet conditions. So, there is a coupling issue here. using DXCoils::ControlVRFIUCoil; - using Fans::Fan; using Fans::SimulateFanComponents; using MixedAir::SimOAMixer; using Psychrometrics::PsyHFnTdbW; diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 66ca980c8ed..96a26477a1f 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -114,41 +114,6 @@ namespace EnergyPlus::HeatBalanceAirManager { using Psychrometrics::PsyRhoAirFnPbTdbW; using Psychrometrics::PsyTdbFnHW; - // Data - std::unordered_set UniqueZoneNames; - std::unordered_map UniqueInfiltrationNames; - // MODULE PARAMETER DEFINITIONS: - static std::string const BlankString; - - namespace { - // These were static variables within different functions. They were pulled out into the namespace - // to facilitate easier unit testing of those functions. - // 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. - bool ManageAirHeatBalanceGetInputFlag(true); - } // namespace - // Subroutine Specifications for the Heat Balance Module - // Driver Routines - - // Get Input routines for module - - // Initialization routines for module - - // Algorithms for the module - // Reporting routines for module - - // MODULE SUBROUTINES: - //************************************************************************* - - // Functions - void clear_state() - { - ManageAirHeatBalanceGetInputFlag = true; - UniqueZoneNames.clear(); - UniqueInfiltrationNames.clear(); - } - void ManageAirHeatBalance(EnergyPlusData &state) { @@ -164,34 +129,10 @@ namespace EnergyPlus::HeatBalanceAirManager { // at the time step level. This driver manages the calls to all of // the other drivers and simulation algorithms. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // Obtains and Allocates heat balance related parameters from input file - if (ManageAirHeatBalanceGetInputFlag) { + if (state.dataHeatBalAirMgr->ManageAirHeatBalanceGetInputFlag) { GetAirHeatBalanceInput(state); - ManageAirHeatBalanceGetInputFlag = false; + state.dataHeatBalAirMgr->ManageAirHeatBalanceGetInputFlag = false; } InitAirHeatBalance(state); // Initialize all heat balance related parameters @@ -203,9 +144,6 @@ namespace EnergyPlus::HeatBalanceAirManager { ReportZoneMeanAirTemp(state); } - // Get Input Section of the Module - //****************************************************************************** - void GetAirHeatBalanceInput(EnergyPlusData &state) { @@ -221,30 +159,9 @@ namespace EnergyPlus::HeatBalanceAirManager { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger events. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFound(false); - - GetAirFlowFlag(state, ErrorsFound); SetZoneMassConservationFlag(state); @@ -275,11 +192,6 @@ namespace EnergyPlus::HeatBalanceAirManager { // Using/Aliasing using ScheduleManager::GetScheduleIndex; - // Formats - - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - state.dataHeatBal->AirFlowFlag = UseSimpleAirFlow; GetSimpleAirModelInputs(state, ErrorsFound); @@ -337,7 +249,6 @@ namespace EnergyPlus::HeatBalanceAirManager { // Using/Aliasing using General::CheckCreatedZoneItemName; - using ScheduleManager::CheckScheduleValueMinMax; using ScheduleManager::GetScheduleIndex; using ScheduleManager::GetScheduleMinValue; @@ -408,8 +319,6 @@ namespace EnergyPlus::HeatBalanceAirManager { static constexpr auto Format_721("! <{} Airflow Stats Nominal>,Name,Schedule Name,Zone Name, Zone Floor Area {{m2}}, # Zone Occupants,{}\n"); static constexpr auto Format_722(" {}, {}\n"); - - RepVarSet.dimension(state.dataGlobal->NumOfZones, true); // Following used for reporting @@ -608,7 +517,7 @@ namespace EnergyPlus::HeatBalanceAirManager { "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } - GlobalNames::IntraObjUniquenessCheck(state, cAlphaArgs(2), cCurrentModuleObject, cAlphaFieldNames(2), UniqueZoneNames, IsNotOK); + GlobalNames::IntraObjUniquenessCheck(state, cAlphaArgs(2), cCurrentModuleObject, cAlphaFieldNames(2), state.dataHeatBalAirMgr->UniqueZoneNames, IsNotOK); if (IsNotOK) { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", a duplicated object " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\" is found."); @@ -823,7 +732,7 @@ namespace EnergyPlus::HeatBalanceAirManager { state.dataHeatBal->TotInfiltration = state.dataHeatBal->TotDesignFlowInfiltration + state.dataHeatBal->TotShermGrimsInfiltration + state.dataHeatBal->TotAIM2Infiltration; state.dataHeatBal->Infiltration.allocate(state.dataHeatBal->TotInfiltration); - UniqueInfiltrationNames.reserve(static_cast(state.dataHeatBal->TotInfiltration)); + state.dataHeatBalAirMgr->UniqueInfiltrationNames.reserve(static_cast(state.dataHeatBal->TotInfiltration)); if (state.dataHeatBal->TotDesignFlowInfiltration > 0) { Loop = 0; @@ -1054,7 +963,7 @@ namespace EnergyPlus::HeatBalanceAirManager { cAlphaFieldNames, cNumericFieldNames); ++InfiltCount; - GlobalNames::VerifyUniqueInterObjectName(state, UniqueInfiltrationNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); + GlobalNames::VerifyUniqueInterObjectName(state, state.dataHeatBalAirMgr->UniqueInfiltrationNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); state.dataHeatBal->Infiltration(InfiltCount).Name = cAlphaArgs(1); state.dataHeatBal->Infiltration(InfiltCount).ModelType = InfiltrationShermanGrimsrud; state.dataHeatBal->Infiltration(InfiltCount).ZonePtr = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); @@ -1117,7 +1026,7 @@ namespace EnergyPlus::HeatBalanceAirManager { cAlphaFieldNames, cNumericFieldNames); ++InfiltCount; - GlobalNames::VerifyUniqueInterObjectName(state, UniqueInfiltrationNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); + GlobalNames::VerifyUniqueInterObjectName(state, state.dataHeatBalAirMgr->UniqueInfiltrationNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); state.dataHeatBal->Infiltration(InfiltCount).Name = cAlphaArgs(1); state.dataHeatBal->Infiltration(InfiltCount).ModelType = InfiltrationAIM2; state.dataHeatBal->Infiltration(InfiltCount).ZonePtr = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); @@ -1489,7 +1398,7 @@ namespace EnergyPlus::HeatBalanceAirManager { state.dataHeatBal->Ventilation(Loop).FanType = ExhaustVentilation; } else if (SELECT_CASE_var == "INTAKE") { state.dataHeatBal->Ventilation(Loop).FanType = IntakeVentilation; - } else if ((SELECT_CASE_var == "NATURAL") || (SELECT_CASE_var == "NONE") || (SELECT_CASE_var == BlankString)) { + } else if ((SELECT_CASE_var == "NATURAL") || (SELECT_CASE_var == "NONE") || (SELECT_CASE_var == std::string())) { state.dataHeatBal->Ventilation(Loop).FanType = NaturalVentilation; } else if (SELECT_CASE_var == "BALANCED") { state.dataHeatBal->Ventilation(Loop).FanType = BalancedVentilation; @@ -3914,9 +3823,6 @@ namespace EnergyPlus::HeatBalanceAirManager { // 'Electric Load {W/m2}, Gas Load {W/m2}, Other Load {W/m2}, Hot Water Eq {W/m2}, Outdoor Controlled Baseboard Heat') } - //***************************************************************************************** - // This subroutine was moved from 'RoomAirManager' Module - void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if errors found during this input routine { @@ -3930,9 +3836,6 @@ namespace EnergyPlus::HeatBalanceAirManager { // PURPOSE OF THIS SUBROUTINE: // Get room air model parameters for all zones at once - // METHODOLOGY EMPLOYED: - // Use input processer to get input from idf file - // Using/Aliasing using namespace DataIPShortCuts; @@ -4091,7 +3994,7 @@ namespace EnergyPlus::HeatBalanceAirManager { if (NumOfAirModels == 0) { state.dataRoomAirMod->AirModel(ZoneNum).AirModelName = "MIXING AIR MODEL FOR " + state.dataHeatBal->Zone(ZoneNum).Name; state.dataRoomAirMod->AirModel(ZoneNum).ZoneName = state.dataHeatBal->Zone(ZoneNum).Name; - } else if (state.dataRoomAirMod->AirModel(ZoneNum).ZoneName == BlankString) { + } else if (state.dataRoomAirMod->AirModel(ZoneNum).ZoneName == std::string()) { // no 'select air model' object for this zone so the mixing model is used for this zone state.dataRoomAirMod->AirModel(ZoneNum).AirModelName = "MIXING AIR MODEL FOR " + state.dataHeatBal->Zone(ZoneNum).Name; state.dataRoomAirMod->AirModel(ZoneNum).ZoneName = state.dataHeatBal->Zone(ZoneNum).Name; @@ -4132,12 +4035,6 @@ namespace EnergyPlus::HeatBalanceAirManager { } } - // END of Get Input subroutines for the HBAir Module - //****************************************************************************** - - // Beginning Initialization Section of the Module - //****************************************************************************** - void InitAirHeatBalance(EnergyPlusData &state) { @@ -4149,9 +4046,6 @@ namespace EnergyPlus::HeatBalanceAirManager { // This subroutine is for initializations within the // air heat balance. - // METHODOLOGY EMPLOYED: - // Uses the status flags to trigger events. - // Do the Begin Day initializations if (state.dataGlobal->BeginDayFlag) { } @@ -4175,29 +4069,9 @@ namespace EnergyPlus::HeatBalanceAirManager { // PURPOSE OF THIS SUBROUTINE: // This subroutine sets up the mixing and cross mixing flows - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; using ScheduleManager::GetScheduleIndex; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Loop; // local loop index int NZ; // local index for zone number @@ -4271,12 +4145,6 @@ namespace EnergyPlus::HeatBalanceAirManager { } } - // END Initialization Section of the Module - //****************************************************************************** - - // Begin Algorithm Section of the Module - //****************************************************************************** - void CalcHeatBalanceAir(EnergyPlusData &state) { @@ -4289,30 +4157,9 @@ namespace EnergyPlus::HeatBalanceAirManager { // PURPOSE OF THIS SUBROUTINE: // This subroutine calculates the air component of the heat balance. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using HVACManager::ManageHVAC; - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - if(state.dataGlobal->externalHVACManager) { if (!state.dataGlobal->externalHVACManagerInitialized) { initializeForExternalHVACManager(state); diff --git a/src/EnergyPlus/HeatBalanceAirManager.hh b/src/EnergyPlus/HeatBalanceAirManager.hh index 2c097cf9709..4565f7a15b1 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.hh +++ b/src/EnergyPlus/HeatBalanceAirManager.hh @@ -48,6 +48,9 @@ #ifndef HeatBalanceAirManager_hh_INCLUDED #define HeatBalanceAirManager_hh_INCLUDED +// C++ Headers +#include + // EnergyPlus Headers #include #include @@ -59,28 +62,8 @@ struct EnergyPlusData; namespace HeatBalanceAirManager { - // Data - // MODULE PARAMETER DEFINITIONS: - // na - - // Subroutine Specifications for the Heat Balance Module - // Driver Routines - - // Get Input routines for module - - // Initialization routines for module - - // Algorithms for the module - // Reporting routines for module - - // Functions - void clear_state(); - void ManageAirHeatBalance(EnergyPlusData &state); - // Get Input Section of the Module - //****************************************************************************** - void GetAirHeatBalanceInput(EnergyPlusData &state); void GetAirFlowFlag(EnergyPlusData &state, bool &ErrorsFound); // Set to true if errors found @@ -89,42 +72,32 @@ namespace HeatBalanceAirManager { void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound); // IF errors found in input - //***************************************************************************************** - // This subroutine was moved from 'RoomAirManager' Module - void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag); // True if errors found during this input routine - // END of Get Input subroutines for the HBAir Module - //****************************************************************************** - - // Beginning Initialization Section of the Module - //****************************************************************************** - void InitAirHeatBalance(EnergyPlusData &state); void InitSimpleMixingConvectiveHeatGains(EnergyPlusData &state); void initializeForExternalHVACManager(EnergyPlusData &state); - // END Initialization Section of the Module - //****************************************************************************** - - // Begin Algorithm Section of the Module - //****************************************************************************** - void CalcHeatBalanceAir(EnergyPlusData &state); - // END Algorithm Section of the Module - void ReportZoneMeanAirTemp(EnergyPlusData &state); } // namespace HeatBalanceAirManager -struct HeatBalanceAirMgrData : BaseGlobalStruct { +struct HeatBalanceAirMgrData : BaseGlobalStruct +{ + + std::unordered_set UniqueZoneNames; + std::unordered_map UniqueInfiltrationNames; + bool ManageAirHeatBalanceGetInputFlag = true; void clear_state() override { - + this->ManageAirHeatBalanceGetInputFlag = true; + this->UniqueZoneNames.clear(); + this->UniqueInfiltrationNames.clear(); } }; diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index b8b31a806f2..8bc728f3ea2 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -6023,7 +6023,6 @@ namespace HeatBalanceManager { using NodeInputManager::CalcMoreNodeInfo; using OutputReportTabular::UpdateTabularReports; using ScheduleManager::ReportScheduleValues; - using namespace DataReportingFlags; ReportScheduleValues(state); @@ -6044,18 +6043,18 @@ namespace HeatBalanceManager { } if (!state.dataGlobal->BeginDayFlag) state.dataEnvrn->PrintEnvrnStampWarmupPrinted = false; if (state.dataEnvrn->PrintEnvrnStampWarmup) { - if (PrintEndDataDictionary && state.dataGlobal->DoOutputReporting) { + if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting) { constexpr const char * EndOfHeaderString("End of Data Dictionary"); // End of data dictionary marker print(state.files.eso, "{}\n", EndOfHeaderString); print(state.files.mtr, "{}\n", EndOfHeaderString); - PrintEndDataDictionary = false; + state.dataReportFlag->PrintEndDataDictionary = false; } if (state.dataGlobal->DoOutputReporting) { constexpr const char * EnvironmentStampFormatStr("{},{},{:7.2F},{:7.2F},{:7.2F},{:7.2F}\n"); // Format descriptor for environ stamp print(state.files.eso, EnvironmentStampFormatStr, "1", - "Warmup {" + cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, + "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, state.dataEnvrn->Latitude, state.dataEnvrn->Longitude, state.dataEnvrn->TimeZoneNumber, @@ -6064,7 +6063,7 @@ namespace HeatBalanceManager { print(state.files.mtr, EnvironmentStampFormatStr, "1", - "Warmup {" + cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, + "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, state.dataEnvrn->Latitude, state.dataEnvrn->Longitude, state.dataEnvrn->TimeZoneNumber, diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index dfb8c91ebe1..06649f8e4e3 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -6423,7 +6423,7 @@ namespace EnergyPlus::HeatBalanceSurfaceManager { } if (surface.HeatTransferAlgorithm == HeatTransferModel_EMPD) { TempSurfInTmp(SurfNum) -= - DataMoistureBalanceEMPD::HeatFluxLatent(SurfNum) * TempDiv; // Conduction term (both partition sides same temp) | + state.dataMstBalEMPD->HeatFluxLatent(SurfNum) * TempDiv; // Conduction term (both partition sides same temp) | // Conduction term (both partition sides same temp) | // Convection and damping term if (TempSurfInSat > TempSurfInTmp(SurfNum)) { @@ -6528,7 +6528,7 @@ namespace EnergyPlus::HeatBalanceSurfaceManager { // Coefficient for conduction (current time) | Pool and damping term } if (surface.HeatTransferAlgorithm == HeatTransferModel_EMPD) { - TempSurfInTmp(SurfNum) -= DataMoistureBalanceEMPD::HeatFluxLatent(SurfNum) * + TempSurfInTmp(SurfNum) -= state.dataMstBalEMPD->HeatFluxLatent(SurfNum) * TempDiv; // Coefficient for conduction (current time) | Convection and damping term if (TempSurfInSat > TempSurfInTmp(SurfNum)) { TempSurfInTmp(SurfNum) = TempSurfInSat; // Surface temp cannot be below dew point @@ -6971,8 +6971,8 @@ namespace EnergyPlus::HeatBalanceSurfaceManager { // leaving the zone from all of the surfaces and is a rate. Multiply // by time to get the actual amount affecting the zone volume of air. - MoistureBalanceEMPDManager::UpdateMoistureBalanceEMPD(SurfNum); - RhoVaporSurfIn(SurfNum) = DataMoistureBalanceEMPD::RVSurface(SurfNum); + MoistureBalanceEMPDManager::UpdateMoistureBalanceEMPD(state, SurfNum); + RhoVaporSurfIn(SurfNum) = state.dataMstBalEMPD->RVSurface(SurfNum); Real64 const FD_Area_fac(HMassConvInFD(SurfNum) * surface.Area); state.dataHeatBalFanSys->SumHmAW(ZoneNum) += FD_Area_fac * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); Real64 const MAT_zone(state.dataHeatBalFanSys->MAT(ZoneNum)); diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index f38b6b46bec..2b4599c7a1b 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -677,17 +677,17 @@ namespace LowTempRadiantSystem { thisRadSys.SurfListName = Alphas(5); SurfListNum = 0; - if (NumOfSurfaceLists > 0) SurfListNum = UtilityRoutines::FindItemInList(thisRadSys.SurfListName, SurfList); + if (state.dataSurfLists->NumOfSurfaceLists > 0) SurfListNum = UtilityRoutines::FindItemInList(thisRadSys.SurfListName, state.dataSurfLists->SurfList); if (SurfListNum > 0) { // Found a valid surface list - thisRadSys.NumOfSurfaces = SurfList(SurfListNum).NumOfSurfaces; + thisRadSys.NumOfSurfaces = state.dataSurfLists->SurfList(SurfListNum).NumOfSurfaces; thisRadSys.SurfacePtr.allocate(thisRadSys.NumOfSurfaces); thisRadSys.SurfaceName.allocate(thisRadSys.NumOfSurfaces); thisRadSys.SurfaceFrac.allocate(thisRadSys.NumOfSurfaces); thisRadSys.NumCircuits.allocate(thisRadSys.NumOfSurfaces); - for (SurfNum = 1; SurfNum <= SurfList(SurfListNum).NumOfSurfaces; ++SurfNum) { - thisRadSys.SurfacePtr(SurfNum) = SurfList(SurfListNum).SurfPtr(SurfNum); - thisRadSys.SurfaceName(SurfNum) = SurfList(SurfListNum).SurfName(SurfNum); - thisRadSys.SurfaceFrac(SurfNum) = SurfList(SurfListNum).SurfFlowFrac(SurfNum); + for (SurfNum = 1; SurfNum <= state.dataSurfLists->SurfList(SurfListNum).NumOfSurfaces; ++SurfNum) { + thisRadSys.SurfacePtr(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfPtr(SurfNum); + thisRadSys.SurfaceName(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfName(SurfNum); + thisRadSys.SurfaceFrac(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfFlowFrac(SurfNum); if (thisRadSys.SurfacePtr(SurfNum) > 0) { Surface(thisRadSys.SurfacePtr(SurfNum)).IntConvSurfHasActiveInIt = true; } @@ -948,18 +948,18 @@ namespace LowTempRadiantSystem { thisCFloSys.SurfListName = Alphas(5); SurfListNum = 0; - if (NumOfSurfaceLists > 0) SurfListNum = UtilityRoutines::FindItemInList(thisCFloSys.SurfListName, SurfList); + if (state.dataSurfLists->NumOfSurfaceLists > 0) SurfListNum = UtilityRoutines::FindItemInList(thisCFloSys.SurfListName, state.dataSurfLists->SurfList); if (SurfListNum > 0) { // Found a valid surface list - thisCFloSys.NumOfSurfaces = SurfList(SurfListNum).NumOfSurfaces; + thisCFloSys.NumOfSurfaces = state.dataSurfLists->SurfList(SurfListNum).NumOfSurfaces; thisCFloSys.SurfacePtr.allocate(thisCFloSys.NumOfSurfaces); thisCFloSys.SurfaceName.allocate(thisCFloSys.NumOfSurfaces); thisCFloSys.SurfaceFrac.allocate(thisCFloSys.NumOfSurfaces); thisCFloSys.NumCircuits.allocate(thisCFloSys.NumOfSurfaces); MaxCloNumOfSurfaces = max(MaxCloNumOfSurfaces, thisCFloSys.NumOfSurfaces); - for (SurfNum = 1; SurfNum <= SurfList(SurfListNum).NumOfSurfaces; ++SurfNum) { - thisCFloSys.SurfacePtr(SurfNum) = SurfList(SurfListNum).SurfPtr(SurfNum); - thisCFloSys.SurfaceName(SurfNum) = SurfList(SurfListNum).SurfName(SurfNum); - thisCFloSys.SurfaceFrac(SurfNum) = SurfList(SurfListNum).SurfFlowFrac(SurfNum); + for (SurfNum = 1; SurfNum <= state.dataSurfLists->SurfList(SurfListNum).NumOfSurfaces; ++SurfNum) { + thisCFloSys.SurfacePtr(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfPtr(SurfNum); + thisCFloSys.SurfaceName(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfName(SurfNum); + thisCFloSys.SurfaceFrac(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfFlowFrac(SurfNum); thisCFloSys.NumCircuits(SurfNum) = 0.0; if (thisCFloSys.SurfacePtr(SurfNum) != 0) { Surface(thisCFloSys.SurfacePtr(SurfNum)).IntConvSurfHasActiveInIt = true; @@ -1164,16 +1164,16 @@ namespace LowTempRadiantSystem { thisElecSys.SurfListName = Alphas(4); SurfListNum = 0; - if (NumOfSurfaceLists > 0) SurfListNum = UtilityRoutines::FindItemInList(thisElecSys.SurfListName, SurfList); + if (state.dataSurfLists->NumOfSurfaceLists > 0) SurfListNum = UtilityRoutines::FindItemInList(thisElecSys.SurfListName, state.dataSurfLists->SurfList); if (SurfListNum > 0) { // Found a valid surface list - thisElecSys.NumOfSurfaces = SurfList(SurfListNum).NumOfSurfaces; + thisElecSys.NumOfSurfaces = state.dataSurfLists->SurfList(SurfListNum).NumOfSurfaces; thisElecSys.SurfacePtr.allocate(thisElecSys.NumOfSurfaces); thisElecSys.SurfaceName.allocate(thisElecSys.NumOfSurfaces); thisElecSys.SurfaceFrac.allocate(thisElecSys.NumOfSurfaces); - for (SurfNum = 1; SurfNum <= SurfList(SurfListNum).NumOfSurfaces; ++SurfNum) { - thisElecSys.SurfacePtr(SurfNum) = SurfList(SurfListNum).SurfPtr(SurfNum); - thisElecSys.SurfaceName(SurfNum) = SurfList(SurfListNum).SurfName(SurfNum); - thisElecSys.SurfaceFrac(SurfNum) = SurfList(SurfListNum).SurfFlowFrac(SurfNum); + for (SurfNum = 1; SurfNum <= state.dataSurfLists->SurfList(SurfListNum).NumOfSurfaces; ++SurfNum) { + thisElecSys.SurfacePtr(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfPtr(SurfNum); + thisElecSys.SurfaceName(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfName(SurfNum); + thisElecSys.SurfaceFrac(SurfNum) = state.dataSurfLists->SurfList(SurfListNum).SurfFlowFrac(SurfNum); } } else { // User entered a single surface name rather than a surface list thisElecSys.NumOfSurfaces = 1; diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 355150b5097..4e0dfec7a72 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -407,7 +407,6 @@ namespace EnergyPlus::MixedAir { using HeatingCoils::SimulateHeatingCoilComponents; using HeatRecovery::SimHeatRecovery; using Humidifiers::SimHumidifier; - using HVACControllers::ControllerProps; using HVACDXHeatPumpSystem::SimDXHeatPumpSystem; using HVACDXSystem::SimDXCoolingSystem; using HVACHXAssistedCoolingCoil::HXAssistedCoil; @@ -478,7 +477,7 @@ namespace EnergyPlus::MixedAir { state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex, false); // set flag to tell HVAC controller it will be simulated only in SolveWaterCoilController() - ControllerProps(state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; + state.dataHVACControllers->ControllerProps(state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; } OACoolingCoil = true; } else if (SELECT_CASE_var == WaterCoil_SimpleHeat) { // 'Coil:Heating:Water') @@ -495,7 +494,7 @@ namespace EnergyPlus::MixedAir { state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex, false); // set flag to tell HVAC controller it will be simulated only in SolveWaterCoilController() - ControllerProps(state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; + state.dataHVACControllers->ControllerProps(state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; } OAHeatingCoil = true; } else if (SELECT_CASE_var == SteamCoil_AirHeat) { // 'Coil:Heating:Steam' @@ -517,7 +516,7 @@ namespace EnergyPlus::MixedAir { state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex, false); // set flag to tell HVAC controller it will be simulated only in SolveWaterCoilController() - ControllerProps(state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; + state.dataHVACControllers->ControllerProps(state.dataWaterCoils->WaterCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; } OACoolingCoil = true; } else if (SELECT_CASE_var == Coil_ElectricHeat) { // 'Coil:Heating:Electric' @@ -546,7 +545,7 @@ namespace EnergyPlus::MixedAir { HXAssistedCoil(CompIndex).ControllerIndex, true); // set flag to tell HVAC controller it will be simulated only in SolveWaterCoilController() - ControllerProps(HXAssistedCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; + state.dataHVACControllers->ControllerProps(HXAssistedCoil(CompIndex).ControllerIndex).BypassControllerCalc = true; } OACoolingCoil = true; } else if (SELECT_CASE_var == DXSystem) { // CoilSystem:Cooling:DX old 'AirLoopHVAC:UnitaryCoolOnly' diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index ca620ae070c..bfc21708f90 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -339,15 +339,15 @@ namespace EnergyPlus::MoistureBalanceEMPDManager { int SurfNum; if (state.dataMoistureBalEMPD->InitEnvrnFlag) { - RVSurfaceOld.allocate(state.dataSurface->TotSurfaces); - RVSurface.allocate(state.dataSurface->TotSurfaces); - HeatFluxLatent.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->RVSurfaceOld.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->RVSurface.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->HeatFluxLatent.allocate(state.dataSurface->TotSurfaces); state.dataMoistureBalEMPD->EMPDReportVars.allocate(state.dataSurface->TotSurfaces); - RVSurfLayer.allocate(state.dataSurface->TotSurfaces); - RVSurfLayerOld.allocate(state.dataSurface->TotSurfaces); - RVDeepLayer.allocate(state.dataSurface->TotSurfaces); - RVdeepOld.allocate(state.dataSurface->TotSurfaces); - RVwall.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->RVSurfLayer.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->RVSurfLayerOld.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->RVDeepLayer.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->RVdeepOld.allocate(state.dataSurface->TotSurfaces); + state.dataMstBalEMPD->RVwall.allocate(state.dataSurface->TotSurfaces); } for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { @@ -355,13 +355,13 @@ namespace EnergyPlus::MoistureBalanceEMPDManager { if (!state.dataSurface->Surface(SurfNum).HeatTransSurf) continue; Real64 const rv_air_in_initval = min(PsyRhovFnTdbWPb_fast(state.dataHeatBalFanSys->MAT(ZoneNum), max(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNum), 1.0e-5), state.dataEnvrn->OutBaroPress), PsyRhovFnTdbRh(state, state.dataHeatBalFanSys->MAT(ZoneNum), 1.0, "InitMoistureBalanceEMPD")); - RVSurfaceOld(SurfNum) = rv_air_in_initval; - RVSurface(SurfNum) = rv_air_in_initval; - RVSurfLayer(SurfNum) = rv_air_in_initval; - RVSurfLayerOld(SurfNum) = rv_air_in_initval; - RVDeepLayer(SurfNum) = rv_air_in_initval; - RVdeepOld(SurfNum) = rv_air_in_initval; - RVwall(SurfNum) = rv_air_in_initval; + state.dataMstBalEMPD->RVSurfaceOld(SurfNum) = rv_air_in_initval; + state.dataMstBalEMPD->RVSurface(SurfNum) = rv_air_in_initval; + state.dataMstBalEMPD->RVSurfLayer(SurfNum) = rv_air_in_initval; + state.dataMstBalEMPD->RVSurfLayerOld(SurfNum) = rv_air_in_initval; + state.dataMstBalEMPD->RVDeepLayer(SurfNum) = rv_air_in_initval; + state.dataMstBalEMPD->RVdeepOld(SurfNum) = rv_air_in_initval; + state.dataMstBalEMPD->RVwall(SurfNum) = rv_air_in_initval; } if (!state.dataMoistureBalEMPD->InitEnvrnFlag) return; // Initialize the report variable @@ -463,8 +463,8 @@ namespace EnergyPlus::MoistureBalanceEMPDManager { } auto const &surface(state.dataSurface->Surface(SurfNum)); // input - auto &rv_surface(RVSurface(SurfNum)); // output - auto const &rv_surface_old(RVSurfaceOld(SurfNum)); // input + auto &rv_surface(state.dataMstBalEMPD->RVSurface(SurfNum)); // output + auto const &rv_surface_old(state.dataMstBalEMPD->RVSurfaceOld(SurfNum)); // input auto const &h_mass_conv_in_fd(HMassConvInFD(SurfNum)); // input auto const &rho_vapor_air_in(RhoVaporAirIn(SurfNum)); // input Real64 RHZone; @@ -475,12 +475,12 @@ namespace EnergyPlus::MoistureBalanceEMPDManager { Real64 mass_flux_surf_layer; Real64 mass_flux_deep_layer; Real64 mass_flux_zone; - auto &rv_surf_layer(RVSurfLayer(SurfNum)); // output - auto const &rv_surf_layer_old(RVSurfLayerOld(SurfNum)); // input + auto &rv_surf_layer(state.dataMstBalEMPD->RVSurfLayer(SurfNum)); // output + auto const &rv_surf_layer_old(state.dataMstBalEMPD->RVSurfLayerOld(SurfNum)); // input Real64 hm_surf_layer; - auto &rv_deep_layer(RVDeepLayer(SurfNum)); // output - auto const &rv_deep_old(RVdeepOld(SurfNum)); // input - auto &heat_flux_latent(HeatFluxLatent(SurfNum)); // output + auto &rv_deep_layer(state.dataMstBalEMPD->RVDeepLayer(SurfNum)); // output + auto const &rv_deep_old(state.dataMstBalEMPD->RVdeepOld(SurfNum)); // input + auto &heat_flux_latent(state.dataMstBalEMPD->HeatFluxLatent(SurfNum)); // output heat_flux_latent = 0.0; Flag = 1; @@ -652,7 +652,7 @@ namespace EnergyPlus::MoistureBalanceEMPDManager { material.MoistACoeff * pow(RH_deep_layer, material.MoistBCoeff) + material.MoistCCoeff * pow(RH_deep_layer, material.MoistDCoeff); } - void UpdateMoistureBalanceEMPD(int const SurfNum) // Surface number + void UpdateMoistureBalanceEMPD(EnergyPlusData &state, int const SurfNum) // Surface number { // SUBROUTINE INFORMATION: @@ -664,9 +664,9 @@ namespace EnergyPlus::MoistureBalanceEMPDManager { // PURPOSE OF THIS SUBROUTINE: // Update inside surface vapor density - RVSurfaceOld(SurfNum) = RVSurface(SurfNum); - RVdeepOld(SurfNum) = RVDeepLayer(SurfNum); - RVSurfLayerOld(SurfNum) = RVSurfLayer(SurfNum); + state.dataMstBalEMPD->RVSurfaceOld(SurfNum) = state.dataMstBalEMPD->RVSurface(SurfNum); + state.dataMstBalEMPD->RVdeepOld(SurfNum) = state.dataMstBalEMPD->RVDeepLayer(SurfNum); + state.dataMstBalEMPD->RVSurfLayerOld(SurfNum) = state.dataMstBalEMPD->RVSurfLayer(SurfNum); } void ReportMoistureBalanceEMPD(EnergyPlusData &state) diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.hh b/src/EnergyPlus/MoistureBalanceEMPDManager.hh index 65a20bc3f6f..6117e6fea28 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.hh +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.hh @@ -98,10 +98,10 @@ namespace MoistureBalanceEMPDManager { int SurfNum, Real64 TempSurfIn, // INSIDE SURFACE TEMPERATURE at current time step Real64 TempZone, // Zone temperature at current time step. - Real64 &TempSat // Satutared surface temperature. + Real64 &TempSat // Saturated surface temperature. ); - void UpdateMoistureBalanceEMPD(int SurfNum); // Surface number + void UpdateMoistureBalanceEMPD(EnergyPlusData &state, int SurfNum); // Surface number void ReportMoistureBalanceEMPD(EnergyPlusData &state); diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index 47fac315a11..731db0f9591 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -1967,13 +1967,13 @@ namespace OutdoorAirUnit { // OutAirUnit( OAUnitNum ).ElecFanRate = FanElecPower; //Issue #5524 this would only get the last fan called, not both if there are two OutAirUnit(OAUnitNum).ElecFanRate = 0.0; if (OutAirUnit(OAUnitNum).SFanType != DataHVACGlobals::FanType_SystemModelObject) { - OutAirUnit(OAUnitNum).ElecFanRate += Fans::GetFanPower(OutAirUnit(OAUnitNum).SFan_Index); + OutAirUnit(OAUnitNum).ElecFanRate += Fans::GetFanPower(state, OutAirUnit(OAUnitNum).SFan_Index); } else { OutAirUnit(OAUnitNum).ElecFanRate += HVACFan::fanObjs[OutAirUnit(OAUnitNum).SFan_Index]->fanPower(); } if (OutAirUnit(OAUnitNum).ExtFan) { if (OutAirUnit(OAUnitNum).ExtFanType != DataHVACGlobals::FanType_SystemModelObject) { - OutAirUnit(OAUnitNum).ElecFanRate += Fans::GetFanPower(OutAirUnit(OAUnitNum).ExtFan_Index); + OutAirUnit(OAUnitNum).ElecFanRate += Fans::GetFanPower(state, OutAirUnit(OAUnitNum).ExtFan_Index); } else { OutAirUnit(OAUnitNum).ElecFanRate += HVACFan::fanObjs[OutAirUnit(OAUnitNum).ExtFan_Index]->fanPower(); } diff --git a/src/EnergyPlus/PackagedTerminalHeatPump.cc b/src/EnergyPlus/PackagedTerminalHeatPump.cc index 5c4e695f682..13d3012224f 100644 --- a/src/EnergyPlus/PackagedTerminalHeatPump.cc +++ b/src/EnergyPlus/PackagedTerminalHeatPump.cc @@ -398,7 +398,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { Real64 locFanElecPower = 0.0; if (state.dataPTHP->PTUnit(PTUnitNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - locFanElecPower = Fans::GetFanPower(state.dataPTHP->PTUnit(PTUnitNum).FanIndex); + locFanElecPower = Fans::GetFanPower(state, state.dataPTHP->PTUnit(PTUnitNum).FanIndex); } else { locFanElecPower = HVACFan::fanObjs[state.dataPTHP->PTUnit(PTUnitNum).FanIndex]->fanPower(); } @@ -734,7 +734,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { GetFanIndex(state, state.dataPTHP->PTUnit(PTUnitNum).FanName, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, errFlag, CurrentModuleObject); FanInletNodeNum = GetFanInletNode(state, state.dataPTHP->PTUnit(PTUnitNum).FanType, state.dataPTHP->PTUnit(PTUnitNum).FanName, errFlag); FanOutletNodeNum = GetFanOutletNode(state, state.dataPTHP->PTUnit(PTUnitNum).FanType, state.dataPTHP->PTUnit(PTUnitNum).FanName, errFlag); - GetFanVolFlow(state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); + GetFanVolFlow(state, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate = FanVolFlow; // Get the fan's availability schedule state.dataPTHP->PTUnit(PTUnitNum).FanAvailSchedPtr = GetFanAvailSchPtr(state, state.dataPTHP->PTUnit(PTUnitNum).FanType, state.dataPTHP->PTUnit(PTUnitNum).FanName, errFlag); @@ -1644,7 +1644,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { GetFanIndex(state, state.dataPTHP->PTUnit(PTUnitNum).FanName, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, errFlag, CurrentModuleObject); FanInletNodeNum = GetFanInletNode(state, state.dataPTHP->PTUnit(PTUnitNum).FanType, state.dataPTHP->PTUnit(PTUnitNum).FanName, errFlag); FanOutletNodeNum = GetFanOutletNode(state, state.dataPTHP->PTUnit(PTUnitNum).FanType, state.dataPTHP->PTUnit(PTUnitNum).FanName, errFlag); - GetFanVolFlow(state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); + GetFanVolFlow(state, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate = FanVolFlow; } } @@ -2402,7 +2402,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { ShowContinueError(state, "...specified in " + CurrentModuleObject + "=\"" + Alphas(1) + "\"."); ErrorsFound = true; } else { - GetFanVolFlow(state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); + GetFanVolFlow(state, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate = FanVolFlow; } errFlag = false; @@ -3002,7 +3002,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate = HVACFan::fanObjs[state.dataPTHP->PTUnit(PTUnitNum).FanIndex]->designAirVolFlowRate; } else { errFlag = false; - GetFanVolFlow(state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); + GetFanVolFlow(state, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, FanVolFlow); state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate = FanVolFlow; if (errFlag) { ShowContinueError(state, "...occurs in " + CurrentModuleObject + " = " + Alphas(1)); @@ -3988,7 +3988,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { if (state.dataPTHP->PTUnit(PTUnitNum).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate = HVACFan::fanObjs[state.dataPTHP->PTUnit(PTUnitNum).FanIndex]->designAirVolFlowRate; } else { - GetFanVolFlow(state.dataPTHP->PTUnit(PTUnitNum).FanIndex, state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate); + GetFanVolFlow(state, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, state.dataPTHP->PTUnit(PTUnitNum).ActualFanVolFlowRate); } } } @@ -4041,7 +4041,7 @@ namespace EnergyPlus::PackagedTerminalHeatPump { if (state.dataPTHP->PTUnit(PTUnitNum).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { state.dataPTHP->PTUnit(PTUnitNum).FanVolFlow = HVACFan::fanObjs[state.dataPTHP->PTUnit(PTUnitNum).FanIndex]->designAirVolFlowRate; } else { - GetFanVolFlow(state.dataPTHP->PTUnit(PTUnitNum).FanIndex, state.dataPTHP->PTUnit(PTUnitNum).FanVolFlow); + GetFanVolFlow(state, state.dataPTHP->PTUnit(PTUnitNum).FanIndex, state.dataPTHP->PTUnit(PTUnitNum).FanVolFlow); } if (state.dataPTHP->PTUnit(PTUnitNum).FanVolFlow != AutoSize) { diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index e81f7593698..10a7e896f6a 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -2405,7 +2405,6 @@ namespace EnergyPlus::PlantManager { // this contains all the initializations // Using/Aliasing - using HVACInterfaceManager::PlantCommonPipe; using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE PARAMETER DEFINITIONS: @@ -2656,11 +2655,11 @@ namespace EnergyPlus::PlantManager { } // initialize common pipe flows to zero. - if (allocated(PlantCommonPipe)) { - PlantCommonPipe(LoopNum).PriToSecFlow = 0.0; - PlantCommonPipe(LoopNum).SecToPriFlow = 0.0; - PlantCommonPipe(LoopNum).PriCPLegFlow = 0.0; - PlantCommonPipe(LoopNum).SecCPLegFlow = 0.0; + if (allocated(state.dataHVACInterfaceMgr->PlantCommonPipe)) { + state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).PriToSecFlow = 0.0; + state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).SecToPriFlow = 0.0; + state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).PriCPLegFlow = 0.0; + state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).SecCPLegFlow = 0.0; } } else { // no secondary loop, so use supply side loop SP on demand side too. state.dataPlnt->PlantLoop(LoopNum).LoopSide(DemandSide).TempSetPoint = LoopSetPointTemp; diff --git a/src/EnergyPlus/ReportCoilSelection.cc b/src/EnergyPlus/ReportCoilSelection.cc index 707e08ea33c..f249aa28c3f 100644 --- a/src/EnergyPlus/ReportCoilSelection.cc +++ b/src/EnergyPlus/ReportCoilSelection.cc @@ -517,7 +517,7 @@ void ReportCoilSelection::doZoneEqSetup(EnergyPlusData &state, int const coilVec coilSelectionReportObj->setCoilSupplyFanInfo(state, c->coilName_, c->coilObjName, - Fans::Fan(state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).SupFanNum).FanName, + state.dataFans->Fan(state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).SupFanNum).FanName, DataAirSystems::structArrayLegacyFanModels, state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).SupFanNum); break; @@ -780,7 +780,7 @@ void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state) Fans::GetFanIndex(state, c->fanAssociatedWithCoilName, c->supFanNum, errorsFound, c->fanTypeName); } c->fanSizeMaxAirVolumeFlow = Fans::GetFanDesignVolumeFlowRate(state, c->fanTypeName, c->fanAssociatedWithCoilName, errorsFound, c->supFanNum); - c->fanSizeMaxAirMassFlow = Fans::Fan(c->supFanNum).MaxAirMassFlowRate; + c->fanSizeMaxAirMassFlow = state.dataFans->Fan(c->supFanNum).MaxAirMassFlowRate; break; } case DataAirSystems::objectVectorOOFanSystemModel: { diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc index 69ee4b66701..13f98044414 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc @@ -1126,15 +1126,8 @@ namespace RoomAirModelAirflowNetwork { // PURPOSE OF THIS SUBROUTINE: // Breakout summation of surface moisture interaction terms - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using DataHeatBalSurface::TempSurfInTmp; - using DataMoistureBalanceEMPD::RVSurface; using HeatBalanceHAMTManager::UpdateHeatBalHAMT; using MoistureBalanceEMPDManager::UpdateMoistureBalanceEMPD; using Psychrometrics::PsyRhFnTdbRhov; @@ -1189,8 +1182,8 @@ namespace RoomAirModelAirflowNetwork { if (state.dataSurface->Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_EMPD) { - UpdateMoistureBalanceEMPD(SurfNum); - RhoVaporSurfIn(SurfNum) = RVSurface(SurfNum); + UpdateMoistureBalanceEMPD(state, SurfNum); + RhoVaporSurfIn(SurfNum) = state.dataMstBalEMPD->RVSurface(SurfNum); SumHmAW = SumHmAW + HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); SumHmARa = SumHmARa + HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * diff --git a/src/EnergyPlus/RootFinder.cc b/src/EnergyPlus/RootFinder.cc index a11cfa703c9..17621d87024 100644 --- a/src/EnergyPlus/RootFinder.cc +++ b/src/EnergyPlus/RootFinder.cc @@ -57,9 +57,7 @@ #include #include -namespace EnergyPlus { - -namespace RootFinder { +namespace EnergyPlus::RootFinder { // Module containing the derivative-free, root finder routines for smooth, // "mostly" monotonic functions in one variable. // The algorithm is guaranteed to find the root if: @@ -167,39 +165,16 @@ namespace RootFinder { // "Numerical Recipes in FORTRAN", Chapter 9 "Root Finding and Nonlinear Sets of Equations", pp.340-352 // Used for formulas, but not for code. - // OTHER NOTES: - // na - - // USE STATEMENTS: - // Use statements for data only modules // Using/Aliasing using namespace DataRootFinder; - // Data - // MODULE PARAMETER DEFINITIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // MODULE VARIABLE DECLARATIONS: - // na - - // SUBROUTINE SPECIFICATIONS FOR THE MODULE - - // For a decreasing function, MinPoint%Y > MaxPoint%Y - - // MODULE SUBROUTINES: - //************************************************************************* - - // Functions - - void SetupRootFinder(EnergyPlusData &state, RootFinderDataType &RootFinderData, // Data used by root finding algorithm - int const SlopeType, // Either iSlopeIncreasing or iSlopeDecreasing - int const MethodType, // Any of the iMethod code but iMethodNone - Real64 const TolX, // Relative tolerance for X variables - Real64 const ATolX, // Absolute tolerance for X variables - Real64 const ATolY // Absolute tolerance for Y variables + void SetupRootFinder(EnergyPlusData &state, + RootFinderDataType &RootFinderData, // Data used by root finding algorithm + int const SlopeType, // Either iSlopeIncreasing or iSlopeDecreasing + DataRootFinder::iMethod const MethodType, // Any of the iMethod code but iMethodNone + Real64 const TolX, // Relative tolerance for X variables + Real64 const ATolX, // Absolute tolerance for X variables + Real64 const ATolY // Absolute tolerance for Y variables ) { @@ -212,32 +187,6 @@ namespace RootFinder { // PURPOSE OF THIS SUBROUTINE: // This subroutine loads the numerical controls for the root finder. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - // Load assumed action for underlying function F(X) if (SlopeType != iSlopeIncreasing && SlopeType != iSlopeDecreasing) { ShowSevereError(state, "SetupRootFinder: Invalid function slope specification. Valid choices are:"); @@ -248,13 +197,13 @@ namespace RootFinder { RootFinderData.Controls.SlopeType = SlopeType; // Load solution method - if (MethodType != iMethodBisection && MethodType != iMethodFalsePosition && MethodType != iMethodSecant && MethodType != iMethodBrent) { + if (MethodType != iMethod::Bisection && MethodType != iMethod::FalsePosition && MethodType != iMethod::Secant && MethodType != iMethod::Brent) { ShowSevereError(state, "SetupRootFinder: Invalid solution method specification. Valid choices are:"); - ShowContinueError(state, format("SetupRootFinder: iMethodBisection={}", iMethodBisection)); - ShowContinueError(state, format("SetupRootFinder: iMethodFalsePosition={}", iMethodFalsePosition)); - ShowContinueError(state, format("SetupRootFinder: iMethodSecant={}", iMethodSecant)); - ShowContinueError(state, format("SetupRootFinder: iMethodBrent={}", iMethodBrent)); + ShowContinueError(state, format("SetupRootFinder: iMethodBisection={}", iMethod::Bisection)); + ShowContinueError(state, format("SetupRootFinder: iMethodFalsePosition={}", iMethod::FalsePosition)); + ShowContinueError(state, format("SetupRootFinder: iMethodSecant={}", iMethod::Secant)); + ShowContinueError(state, format("SetupRootFinder: iMethodBrent={}", iMethod::Brent)); ShowFatalError(state, "SetupRootFinder: Preceding error causes program termination."); } RootFinderData.Controls.MethodType = MethodType; @@ -296,32 +245,6 @@ namespace RootFinder { // PURPOSE OF THIS SUBROUTINE: // This subroutine initializes the data for the root finder. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - // Reset min point RootFinderData.MinPoint.X = XMin; RootFinderData.MinPoint.Y = 0.0; @@ -354,7 +277,7 @@ namespace RootFinder { e.DefinedFlag = false; } - // Reset increments over successive iterationes + // Reset increments over successive iterations RootFinderData.Increment.X = 0.0; RootFinderData.Increment.Y = 0.0; RootFinderData.Increment.DefinedFlag = false; @@ -362,8 +285,8 @@ namespace RootFinder { RootFinderData.XCandidate = 0.0; // Reset default state - RootFinderData.StatusFlag = iStatusNone; - RootFinderData.CurrentMethodType = iMethodNone; + RootFinderData.StatusFlag = iStatus::None; + RootFinderData.CurrentMethodType = iMethod::None; RootFinderData.ConvergenceRate = -1.0; } @@ -383,32 +306,10 @@ namespace RootFinder { // This subroutine initializes the min and max for the root finder before // finding a new root. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 SavedXCandidate; Real64 XMinReset; - XMinReset = XMin; if (XMin > XMax) { if (XMax == 0.0) { @@ -498,35 +399,12 @@ namespace RootFinder { // - CheckIncrementRoundOff() // - CheckBracketRoundOff() - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - // Reset status flag - RootFinderData.StatusFlag = iStatusNone; + RootFinderData.StatusFlag = iStatus::None; // Check that MinPoint%X <= X <= MaxPoint%X if (!CheckMinMaxRange(RootFinderData, X)) { - RootFinderData.StatusFlag = iStatusErrorRange; + RootFinderData.StatusFlag = iStatus::ErrorRange; // Fatal error: No need to continue iterating IsDoneFlag = true; @@ -547,7 +425,7 @@ namespace RootFinder { // Check that min and max points are distinct if (RootFinderData.MinPoint.X == RootFinderData.MaxPoint.X) { - RootFinderData.StatusFlag = iStatusOKMin; + RootFinderData.StatusFlag = iStatus::OKMin; RootFinderData.XCandidate = RootFinderData.MinPoint.X; // Solution found: No need to continue iterating @@ -557,7 +435,7 @@ namespace RootFinder { if (RootFinderData.MinPoint.DefinedFlag) { if (CheckMinConstraint(state, RootFinderData)) { - RootFinderData.StatusFlag = iStatusOKMin; + RootFinderData.StatusFlag = iStatus::OKMin; RootFinderData.XCandidate = RootFinderData.MinPoint.X; // Solution found: No need to continue iterating @@ -568,7 +446,7 @@ namespace RootFinder { // Check singularity condition between min and max points if (!CheckNonSingularity(RootFinderData)) { - RootFinderData.StatusFlag = iStatusErrorSingular; + RootFinderData.StatusFlag = iStatus::ErrorSingular; // Fatal error: No need to continue iterating IsDoneFlag = true; @@ -577,7 +455,7 @@ namespace RootFinder { // Check slope condition between min and max points if (!CheckSlope(state, RootFinderData)) { - RootFinderData.StatusFlag = iStatusErrorSlope; + RootFinderData.StatusFlag = iStatus::ErrorSlope; // Fatal error: No need to continue iterating IsDoneFlag = true; @@ -593,7 +471,7 @@ namespace RootFinder { // in ManagerControllers() if (RootFinderData.MinPoint.DefinedFlag) { if (CheckMinConstraint(state, RootFinderData)) { - RootFinderData.StatusFlag = iStatusOKMin; + RootFinderData.StatusFlag = iStatus::OKMin; RootFinderData.XCandidate = RootFinderData.MinPoint.X; // Solution found: No need to continue iterating @@ -609,7 +487,7 @@ namespace RootFinder { if (RootFinderData.MaxPoint.DefinedFlag) { if (CheckMaxConstraint(state, RootFinderData)) { - RootFinderData.StatusFlag = iStatusOKMax; + RootFinderData.StatusFlag = iStatus::OKMax; RootFinderData.XCandidate = RootFinderData.MaxPoint.X; // Solution found: No need to continue iterating @@ -625,7 +503,7 @@ namespace RootFinder { // Check unconstrained convergence after we are sure that the candidate X value lies // within the allowed min/max range if (CheckRootFinderConvergence(RootFinderData, Y)) { - RootFinderData.StatusFlag = iStatusOK; + RootFinderData.StatusFlag = iStatus::OK; RootFinderData.XCandidate = X; // Update root finder internal data with current iterate (X,Y) @@ -641,7 +519,7 @@ namespace RootFinder { // - the distance between the lower and upper bounds is smaller than the user-specified // tolerance for the X variables. (USING brackets from previous iteration) if (CheckBracketRoundOff(RootFinderData)) { - RootFinderData.StatusFlag = iStatusOKRoundOff; + RootFinderData.StatusFlag = iStatus::OKRoundOff; // Solution found: No need to continue iterating IsDoneFlag = true; @@ -660,7 +538,7 @@ namespace RootFinder { // Check that current iterate is within the current lower and upper points if (!CheckLowerUpperBracket(RootFinderData, X)) { - RootFinderData.StatusFlag = iStatusErrorBracket; + RootFinderData.StatusFlag = iStatus::ErrorBracket; // Fatal error: No need to continue iterating IsDoneFlag = true; @@ -680,7 +558,7 @@ namespace RootFinder { IsDoneFlag = false; } - int CheckInternalConsistency(EnergyPlusData &state, RootFinderDataType const &RootFinderData) // Data used by root finding algorithm + iStatus CheckInternalConsistency(EnergyPlusData &state, RootFinderDataType const &RootFinderData) // Data used by root finding algorithm { // FUNCTION INFORMATION: // AUTHOR Dimitri Curtil (LBNL) @@ -695,44 +573,18 @@ namespace RootFinder { // This function does not modify the argument RooFinderData. // Only used internally for debugging. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value - int CheckInternalConsistency; - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - + iStatus CheckInternalConsistency; // Default initialization - CheckInternalConsistency = iStatusNone; + CheckInternalConsistency = iStatus::None; // Internal consistency check involving both support points if (RootFinderData.LowerPoint.DefinedFlag && RootFinderData.UpperPoint.DefinedFlag) { // Check that the existing lower and upper points do bracket the root if (RootFinderData.LowerPoint.X > RootFinderData.UpperPoint.X) { - CheckInternalConsistency = iStatusErrorRange; + CheckInternalConsistency = iStatus::ErrorRange; return CheckInternalConsistency; } @@ -742,14 +594,14 @@ namespace RootFinder { if (SELECT_CASE_var == iSlopeIncreasing) { // Y-value of lower point must be strictly smaller than Y-value of upper point if (RootFinderData.LowerPoint.Y > RootFinderData.UpperPoint.Y) { - CheckInternalConsistency = iStatusWarningNonMonotonic; + CheckInternalConsistency = iStatus::WarningNonMonotonic; return CheckInternalConsistency; } } else if (SELECT_CASE_var == iSlopeDecreasing) { // Y-value of lower point must be strictly larger than Y-value of upper point if (RootFinderData.LowerPoint.Y < RootFinderData.UpperPoint.Y) { - CheckInternalConsistency = iStatusWarningNonMonotonic; + CheckInternalConsistency = iStatus::WarningNonMonotonic; return CheckInternalConsistency; } @@ -766,7 +618,7 @@ namespace RootFinder { // Only check if the lower and upper points are distinct! if (RootFinderData.UpperPoint.X > RootFinderData.LowerPoint.X) { if (RootFinderData.UpperPoint.Y == RootFinderData.LowerPoint.Y) { - CheckInternalConsistency = iStatusErrorSingular; + CheckInternalConsistency = iStatus::ErrorSingular; return CheckInternalConsistency; } } @@ -778,13 +630,13 @@ namespace RootFinder { auto const SELECT_CASE_var(RootFinderData.Controls.SlopeType); if (SELECT_CASE_var == iSlopeIncreasing) { if (RootFinderData.MinPoint.Y >= 0.0) { - CheckInternalConsistency = iStatusOKMin; + CheckInternalConsistency = iStatus::OKMin; return CheckInternalConsistency; } } else if (SELECT_CASE_var == iSlopeDecreasing) { if (RootFinderData.MinPoint.Y <= 0.0) { - CheckInternalConsistency = iStatusOKMin; + CheckInternalConsistency = iStatus::OKMin; return CheckInternalConsistency; } @@ -804,13 +656,13 @@ namespace RootFinder { auto const SELECT_CASE_var(RootFinderData.Controls.SlopeType); if (SELECT_CASE_var == iSlopeIncreasing) { if (RootFinderData.MaxPoint.Y <= 0.0) { - CheckInternalConsistency = iStatusOKMax; + CheckInternalConsistency = iStatus::OKMax; return CheckInternalConsistency; } } else if (SELECT_CASE_var == iSlopeDecreasing) { if (RootFinderData.MaxPoint.Y >= 0.0) { - CheckInternalConsistency = iStatusOKMax; + CheckInternalConsistency = iStatus::OKMax; return CheckInternalConsistency; } @@ -843,35 +695,9 @@ namespace RootFinder { // Returns TRUE if X value is a valid root candidate. // Returns FALSE otherwise. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckRootFinderCandidate; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - if (CheckMinMaxRange(RootFinderData, X) && CheckLowerUpperBracket(RootFinderData, X)) { CheckRootFinderCandidate = true; } else { @@ -897,34 +723,9 @@ namespace RootFinder { // Returns TRUE if current iterate satisfies min/max constraints. // Returns FALSE if current iterate is out-of-range. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckMinMaxRange; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - if (RootFinderData.MinPoint.DefinedFlag) { if (X < RootFinderData.MinPoint.X) { CheckMinMaxRange = false; @@ -961,35 +762,9 @@ namespace RootFinder { // Returns TRUE if current iterate lies within the lower/upper bracket. // Returns FALSE otherwise. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckLowerUpperBracket; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - if (RootFinderData.LowerPoint.DefinedFlag) { if (X < RootFinderData.LowerPoint.X) { CheckLowerUpperBracket = false; @@ -1027,35 +802,9 @@ namespace RootFinder { // POSTCONDITION: // - RootFinderData is NOT changed by this function. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckSlope; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - // Check that the slope requirement is respected at the min and max points // Note that the singularity check takes care of RootFinderData%MinPoint%Y == RootFinderData%MaxPoint%Y // therefore we use strict comparison operators < and >. @@ -1108,39 +857,19 @@ namespace RootFinder { // POSTCONDITION: // - RootFinderData is NOT changed by this function. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckNonSingularity; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - // FUNCTION PARAMETER DEFINITIONS: // Safety factor used to detect a singular residual function between the min and max // points. // NOTE: Requesting exactly the same value is obtained by setting SafetyFactor = 0.0 Real64 const SafetyFactor(0.1); - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 DeltaY; // Difference between min and max Y-values Real64 ATolY; // Absolute tolerance used to detected equal min and max Y-values - - // Added this check based on an absolute tolerance test for y values to avoid incorrectly detecting // functions with bad slope due to numerical noise. // Typically, this takes care of situations where the controlled equipment in ManageControllers() @@ -1174,35 +903,9 @@ namespace RootFinder { // POSTCONDITION: // - RootFinderData is NOT changed by this function. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckMinConstraint; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - { auto const SELECT_CASE_var(RootFinderData.Controls.SlopeType); if (SELECT_CASE_var == iSlopeIncreasing) { @@ -1247,35 +950,9 @@ namespace RootFinder { // POSTCONDITION: // - RootFinderData is NOT changed by this function. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckMaxConstraint; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - // Check for max constrained convergence with respect to the new iterate (X,Y) { auto const SELECT_CASE_var(RootFinderData.Controls.SlopeType); @@ -1319,35 +996,9 @@ namespace RootFinder { // This function checks whether the current iterate (X,Y) satisfies the // unconstrained convergence criterion or not. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckRootFinderConvergence; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - // Check for unconstrained convergence if (std::abs(Y) <= RootFinderData.Controls.ATolY) { CheckRootFinderConvergence = true; @@ -1371,36 +1022,14 @@ namespace RootFinder { // This function checks whether the current lower and upper brackets satisfies // the round-off criterion or not. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - bool CheckBracketRoundOff; - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + // Return value + bool CheckBracketRoundOff; // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 DeltaUL; // Distance between lower and upper points Real64 TypUL; // Typical value for values lying within lower/upper interval Real64 TolUL; // Tolerance to satisfy for lower-upper distance - // Check for round-off error in Lower/Upper interval if (RootFinderData.LowerPoint.DefinedFlag && RootFinderData.UpperPoint.DefinedFlag) { DeltaUL = RootFinderData.UpperPoint.X - RootFinderData.LowerPoint.X; @@ -1440,29 +1069,6 @@ namespace RootFinder { // - RootFinderData%MinPoint possibly updated // - RootFinderData%MaxPoint possibly updated - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - // Update min support point if (X == RootFinderData.MinPoint.X) { RootFinderData.MinPoint.Y = Y; @@ -1503,29 +1109,6 @@ namespace RootFinder { // - iStatusWarningNonMonotonic // - iStatusWarningSingular - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - { auto const SELECT_CASE_var(RootFinderData.Controls.SlopeType); @@ -1539,9 +1122,9 @@ namespace RootFinder { } else { if (X >= RootFinderData.LowerPoint.X) { if (Y == RootFinderData.LowerPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningSingular; + RootFinderData.StatusFlag = iStatus::WarningSingular; } else if (Y < RootFinderData.LowerPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningNonMonotonic; + RootFinderData.StatusFlag = iStatus::WarningNonMonotonic; } // Update lower point with current iterate RootFinderData.LowerPoint.X = X; @@ -1566,9 +1149,9 @@ namespace RootFinder { } else { if (X <= RootFinderData.UpperPoint.X) { if (Y == RootFinderData.UpperPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningSingular; + RootFinderData.StatusFlag = iStatus::WarningSingular; } else if (Y > RootFinderData.UpperPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningNonMonotonic; + RootFinderData.StatusFlag = iStatus::WarningNonMonotonic; } // Update upper point with current iterate RootFinderData.UpperPoint.X = X; @@ -1596,9 +1179,9 @@ namespace RootFinder { } else { if (X >= RootFinderData.LowerPoint.X) { if (Y == RootFinderData.LowerPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningSingular; + RootFinderData.StatusFlag = iStatus::WarningSingular; } else if (Y > RootFinderData.LowerPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningNonMonotonic; + RootFinderData.StatusFlag = iStatus::WarningNonMonotonic; } // Update lower point with current iterate RootFinderData.LowerPoint.X = X; @@ -1623,9 +1206,9 @@ namespace RootFinder { } else { if (X <= RootFinderData.UpperPoint.X) { if (Y == RootFinderData.UpperPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningSingular; + RootFinderData.StatusFlag = iStatus::WarningSingular; } else if (Y < RootFinderData.UpperPoint.Y) { - RootFinderData.StatusFlag = iStatusWarningNonMonotonic; + RootFinderData.StatusFlag = iStatus::WarningNonMonotonic; } // Update upper point with current iterate RootFinderData.UpperPoint.X = X; @@ -1673,29 +1256,9 @@ namespace RootFinder { // POSTCONDITION: // - RootFinderData%History(:) updated with last 3 best iterates - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumHistory; - - // Update history with best iterates so that: // ABS(History(1)%Y) <= ABS(History(2)%Y) <= ABS(History(3)%Y) // Note that the history points are sorted so that @@ -1762,29 +1325,6 @@ namespace RootFinder { // - RootFinderData%Increment updated // - RootFinderData%ConvergenceRate updated - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - // Update history with best iterates so that: // ABS(History(1)%Y) <= ABS(History(2)%Y) <= ABS(History(3)%Y) // Note that we must update the history before updating the lower/upper points @@ -1828,36 +1368,12 @@ namespace RootFinder { // This subroutine orders the N points in the history array in increasing // order of ABS(Y) values. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Argument array dimensioning - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int I; int J; Real64 XTemp; Real64 YTemp; - // Nothing to do if only one point stored in history if (N <= 1) { return; @@ -1902,36 +1418,16 @@ namespace RootFinder { // Once it is bracketed, then we use the specified solution methods (Bisection, // False position, Secant and Brent) to compute the next candidate. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static Real64 XNext(0.0); - - //---------------------------------------------------------------------------- // First attempt to bracket root between a lower point and an upper point. //---------------------------------------------------------------------------- // Detect the lower bracket if (!RootFinderData.LowerPoint.DefinedFlag) { - RootFinderData.CurrentMethodType = iMethodBracket; + RootFinderData.CurrentMethodType = iMethod::Bracket; // If we have 2 points already, try to detect lower point using the Secant formula if (BracketRoot(RootFinderData, XNext)) { RootFinderData.XCandidate = XNext; @@ -1946,7 +1442,7 @@ namespace RootFinder { // Detect the upper bracket } else if (!RootFinderData.UpperPoint.DefinedFlag) { - RootFinderData.CurrentMethodType = iMethodBracket; + RootFinderData.CurrentMethodType = iMethod::Bracket; // If we have 2 points already, try to detect upper point using the Secant formula if (BracketRoot(RootFinderData, XNext)) { RootFinderData.XCandidate = XNext; @@ -1968,11 +1464,11 @@ namespace RootFinder { } else { { auto const SELECT_CASE_var(RootFinderData.StatusFlag); - if (SELECT_CASE_var == iStatusOKRoundOff) { + if (SELECT_CASE_var == iStatus::OKRoundOff) { // Should never happen if we exit the root finder upon detecting round-off condition RootFinderData.XCandidate = BisectionMethod(RootFinderData); - } else if ((SELECT_CASE_var == iStatusWarningSingular) || (SELECT_CASE_var == iStatusWarningNonMonotonic)) { + } else if ((SELECT_CASE_var == iStatus::WarningSingular) || (SELECT_CASE_var == iStatus::WarningNonMonotonic)) { // Following local singularity or non-monotonicity warnings we attempt // to recover with the false position method to avoid running into trouble // because the latest iterate did nt produce any improvement compared to @@ -1985,24 +1481,24 @@ namespace RootFinder { // for the root. { auto const SELECT_CASE_var1(RootFinderData.Controls.MethodType); - if (SELECT_CASE_var1 == iMethodBisection) { + if (SELECT_CASE_var1 == iMethod::Bisection) { // Bisection method (aka interval halving) RootFinderData.XCandidate = BisectionMethod(RootFinderData); - } else if (SELECT_CASE_var1 == iMethodFalsePosition) { + } else if (SELECT_CASE_var1 == iMethod::FalsePosition) { // False position method (aka regula falsi) RootFinderData.XCandidate = FalsePositionMethod(RootFinderData); - } else if (SELECT_CASE_var1 == iMethodSecant) { + } else if (SELECT_CASE_var1 == iMethod::Secant) { // Secant method RootFinderData.XCandidate = SecantMethod(RootFinderData); - } else if (SELECT_CASE_var1 == iMethodBrent) { + } else if (SELECT_CASE_var1 == iMethod::Brent) { // Brent method RootFinderData.XCandidate = BrentMethod(RootFinderData); } else { ShowSevereError(state, "AdvanceRootFinder: Invalid solution method specification. Valid choices are:"); - ShowContinueError(state, format("AdvanceRootFinder: iMethodBisection={}", iMethodBisection)); - ShowContinueError(state, format("AdvanceRootFinder: iMethodFalsePosition={}", iMethodFalsePosition)); - ShowContinueError(state, format("AdvanceRootFinder: iMethodSecant={}", iMethodSecant)); - ShowContinueError(state, format("AdvanceRootFinder: iMethodBrent={}", iMethodBrent)); + ShowContinueError(state, format("AdvanceRootFinder: iMethodBisection={}", iMethod::Bisection)); + ShowContinueError(state, format("AdvanceRootFinder: iMethodFalsePosition={}", iMethod::FalsePosition)); + ShowContinueError(state, format("AdvanceRootFinder: iMethodSecant={}", iMethod::Secant)); + ShowContinueError(state, format("AdvanceRootFinder: iMethodBrent={}", iMethod::Brent)); ShowFatalError(state, "AdvanceRootFinder: Preceding error causes program termination."); } } @@ -2036,38 +1532,12 @@ namespace RootFinder { // - MinPoint%X <= XNext <= MaxPoint%X // - LowerPoint%X < XNext < UpperPoint%X - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool BracketRoot; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - // Cannot use Secant method unless there are at least 2 points // Also do not use Secant method more than once, i.e. NumHistory==3, in order to avoid - // the pathological case whereby the secant method always comes up short of bracketting + // the pathological case whereby the secant method always comes up short of bracketing // the root because the function slope flattens as we come closer to either min/max point. if (RootFinderData.NumHistory != 2) { BracketRoot = false; @@ -2075,7 +1545,7 @@ namespace RootFinder { } // Should not use Secant method if the last 2 points produced a warning - if (RootFinderData.StatusFlag == iStatusWarningSingular || RootFinderData.StatusFlag == iStatusWarningNonMonotonic) { + if (RootFinderData.StatusFlag == iStatus::WarningSingular || RootFinderData.StatusFlag == iStatus::WarningNonMonotonic) { BracketRoot = false; return BracketRoot; } @@ -2112,35 +1582,10 @@ namespace RootFinder { // - LowerPoint%X < XCandidate < UpperPoint%X // - RootFinderData%CurrentMethodType update with current solution method. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value Real64 BisectionMethod; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - - RootFinderData.CurrentMethodType = iMethodBisection; + RootFinderData.CurrentMethodType = iMethod::Bisection; BisectionMethod = (RootFinderData.LowerPoint.X + RootFinderData.UpperPoint.X) / 2.0; return BisectionMethod; @@ -2165,43 +1610,20 @@ namespace RootFinder { // - LowerPoint%X < XCandidate < UpperPoint%X // - RootFinderData%CurrentMethodType update with current solution method. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value Real64 FalsePositionMethod; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 XCandidate; Real64 Num; Real64 Den; - - Num = RootFinderData.UpperPoint.X - RootFinderData.LowerPoint.X; Den = RootFinderData.UpperPoint.Y - RootFinderData.LowerPoint.Y; if (Den != 0.0) { // False position method - RootFinderData.CurrentMethodType = iMethodFalsePosition; + RootFinderData.CurrentMethodType = iMethod::FalsePosition; XCandidate = RootFinderData.LowerPoint.X - RootFinderData.LowerPoint.Y * Num / Den; // Check that new candidate is within range and brackets @@ -2238,39 +1660,16 @@ namespace RootFinder { // - LowerPoint%X < XCandidate < UpperPoint%X // - RootFinderData%CurrentMethodType update with current solution method. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value Real64 SecantMethod; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 XCandidate; - - // Recover with false position if (SecantFormula(RootFinderData, XCandidate)) { // Secant method - RootFinderData.CurrentMethodType = iMethodSecant; + RootFinderData.CurrentMethodType = iMethod::Secant; // Check that new candidate is within range and brackets if (!CheckRootFinderCandidate(RootFinderData, XCandidate)) { @@ -2306,36 +1705,13 @@ namespace RootFinder { // XNext contains the result from applying the Secant formula. // If XNext could not be computed then leave XNext unchanged. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool SecantFormula; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 Num; Real64 Den; - - Num = RootFinderData.Increment.X; Den = RootFinderData.Increment.Y; @@ -2375,27 +1751,9 @@ namespace RootFinder { // The next root estimate is x = B + P/Q whereby B is the current best estimate // of the root. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value Real64 BrentMethod; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 XCandidate; Real64 A; @@ -2444,7 +1802,7 @@ namespace RootFinder { // Only accept correction if it is small enough (75% of previous increment) if (std::abs(P) <= 0.75 * std::abs(Q * RootFinderData.Increment.X)) { - RootFinderData.CurrentMethodType = iMethodBrent; + RootFinderData.CurrentMethodType = iMethod::Brent; XCandidate = B + P / Q; // Check that new candidate is within range and brackets @@ -2454,7 +1812,7 @@ namespace RootFinder { } } else { // Recover from bad correction with bisection - // Biscetion produced the best numerical performance in testing compared to + // Bisection produced the best numerical performance in testing compared to // - Secant // - False position (very slow recovery) XCandidate = BisectionMethod(RootFinderData); @@ -2481,39 +1839,6 @@ namespace RootFinder { // This subroutine writes the header for the trace file to the specified // file unit using CSV formatting. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - - //'MinPoint%DefinedFlag', ',', & - //'LowerPoint%DefinedFlag', ',', & - //'UpperPoint%DefinedFlag', ',', & - //'MaxPoint%DefinedFlag', ',', & - //'History(1)%DefinedFlag', ',', & - //'History(2)%DefinedFlag', ',', & - //'History(3)%DefinedFlag', ',', & print(TraceFile, "{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},", "Status", @@ -2552,31 +1877,6 @@ namespace RootFinder { // This subroutine writes the current state of the root finder data to the trace file // unit using CSV formatting. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - print(TraceFile, "{},{},", RootFinderData.StatusFlag,RootFinderData.CurrentMethodType); // Only show current point if defined. @@ -2611,31 +1911,6 @@ namespace RootFinder { // unit using CSV formatting. // If not defined writes an empty string instead. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // If set to TRUE, ten always show the X value even if not defined - - // SUBROUTINE PARAMETER DEFINITIONS: - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - if (PointData.DefinedFlag) { print(TraceFile, "{:20.10F},{:20.10F},", PointData.X, PointData.Y); } else { @@ -2662,31 +1937,6 @@ namespace RootFinder { // the standard output file. // Used only for debugging. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - print(DebugFile, "Current = "); WritePoint(DebugFile, RootFinderData.CurrentPoint, true); print(DebugFile, "\n"); @@ -2718,55 +1968,28 @@ namespace RootFinder { // MODIFIED // RE-ENGINEERED na - // PURPOSE OF THIS SUBROUTINE: - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - - auto const SELECT_CASE_var(RootFinderData.StatusFlag); - if (SELECT_CASE_var == iStatusOK) { + if (SELECT_CASE_var == iStatus::OK) { print(File, "Found unconstrained root"); - } else if (SELECT_CASE_var == iStatusOKMin) { + } else if (SELECT_CASE_var == iStatus::OKMin) { print(File, "Found min constrained root"); - } else if (SELECT_CASE_var == iStatusOKMax) { + } else if (SELECT_CASE_var == iStatus::OKMax) { print(File, "Found max constrained root"); - } else if (SELECT_CASE_var == iStatusOKRoundOff) { + } else if (SELECT_CASE_var == iStatus::OKRoundOff) { print(File, "Detected round-off convergence in bracket"); - } else if (SELECT_CASE_var == iStatusWarningSingular) { + } else if (SELECT_CASE_var == iStatus::WarningSingular) { print(File, "Detected singularity warning"); - } else if (SELECT_CASE_var == iStatusWarningNonMonotonic) { + } else if (SELECT_CASE_var == iStatus::WarningNonMonotonic) { print(File, "Detected non-monotonicity warning"); - } else if (SELECT_CASE_var == iStatusErrorRange) { + } else if (SELECT_CASE_var == iStatus::ErrorRange) { print(File, "Detected out-of-range error"); - } else if (SELECT_CASE_var == iStatusErrorBracket) { + } else if (SELECT_CASE_var == iStatus::ErrorBracket) { print(File, "Detected bracket error"); - } else if (SELECT_CASE_var == iStatusErrorSlope) { + } else if (SELECT_CASE_var == iStatus::ErrorSlope) { print(File, "Detected slope error"); - } else if (SELECT_CASE_var == iStatusErrorSingular) { + } else if (SELECT_CASE_var == iStatus::ErrorSingular) { print(File, "Detected singularity error"); } else { @@ -2775,5 +1998,3 @@ namespace RootFinder { } } // namespace RootFinder - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/RootFinder.hh b/src/EnergyPlus/RootFinder.hh index f9cd16e8d95..d9cafae08db 100644 --- a/src/EnergyPlus/RootFinder.hh +++ b/src/EnergyPlus/RootFinder.hh @@ -56,144 +56,129 @@ #include #include -namespace EnergyPlus { +namespace EnergyPlus::RootFinder { -namespace RootFinder { +// Using/Aliasing +using DataRootFinder::PointType; +using DataRootFinder::RootFinderDataType; - // Using/Aliasing - using DataRootFinder::PointType; - using DataRootFinder::RootFinderDataType; +void SetupRootFinder(EnergyPlusData &state, + RootFinderDataType &RootFinderData, // Data used by root finding algorithm + int SlopeType, // Either iSlopeIncreasing or iSlopeDecreasing + DataRootFinder::iMethod MethodType, // Any of the iMethod code but iMethodNone + Real64 TolX, // Relative tolerance for X variables + Real64 ATolX, // Absolute tolerance for X variables + Real64 ATolY // Absolute tolerance for Y variables +); - // Data - // MODULE PARAMETER DEFINITIONS - // na +void ResetRootFinder(RootFinderDataType &RootFinderData, // Data used by root finding algorithm + Real64 XMin, // Minimum X value allowed + Real64 XMax // Maximum X value allowed +); - // DERIVED TYPE DEFINITIONS - // na +void InitializeRootFinder(EnergyPlusData &state, + RootFinderDataType &RootFinderData, // Data used by root finding algorithm + Real64 XMin, // Minimum X value allowed + Real64 XMax // Maximum X value allowed +); - // MODULE VARIABLE DECLARATIONS: - // na +void IterateRootFinder(EnergyPlusData &state, + RootFinderDataType &RootFinderData, // Data used by root finding algorithm + Real64 X, // X value of current iterate + Real64 Y, // Y value of current iterate + bool &IsDoneFlag // If TRUE indicates that the iteration should be stopped +); - // SUBROUTINE SPECIFICATIONS FOR THE MODULE +DataRootFinder::iStatus CheckInternalConsistency(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm - // For a decreasing function, MinPoint%Y > MaxPoint%Y +bool CheckRootFinderCandidate(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm + Real64 X // X value for current iterate +); - // Functions +bool CheckMinMaxRange(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm + Real64 X // X value for current iterate +); - void SetupRootFinder(EnergyPlusData &state, RootFinderDataType &RootFinderData, // Data used by root finding algorithm - int const SlopeType, // Either iSlopeIncreasing or iSlopeDecreasing - int const MethodType, // Any of the iMethod code but iMethodNone - Real64 const TolX, // Relative tolerance for X variables - Real64 const ATolX, // Absolute tolerance for X variables - Real64 const ATolY // Absolute tolerance for Y variables - ); +bool CheckLowerUpperBracket(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm + Real64 X // X value for current iterate +); - void ResetRootFinder(RootFinderDataType &RootFinderData, // Data used by root finding algorithm - Real64 const XMin, // Minimum X value allowed - Real64 const XMax // Maximum X value allowed - ); +bool CheckSlope(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm - void InitializeRootFinder(EnergyPlusData &state, RootFinderDataType &RootFinderData, // Data used by root finding algorithm - Real64 const XMin, // Minimum X value allowed - Real64 const XMax // Maximum X value allowed - ); +bool CheckNonSingularity(RootFinderDataType const &RootFinderData); // Data used by root finding algorithm - void IterateRootFinder(EnergyPlusData &state, RootFinderDataType &RootFinderData, // Data used by root finding algorithm - Real64 const X, // X value of current iterate - Real64 const Y, // Y value of current iterate - bool &IsDoneFlag // If TRUE indicates that the iteration should be stopped - ); +bool CheckMinConstraint(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm - int CheckInternalConsistency(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm +bool CheckMaxConstraint(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm - bool CheckRootFinderCandidate(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm - Real64 const X // X value for current iterate - ); +bool CheckRootFinderConvergence(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm + Real64 Y // Y value for current iterate +); - bool CheckMinMaxRange(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm - Real64 const X // X value for current iterate - ); +bool CheckBracketRoundOff(RootFinderDataType const &RootFinderData); // Data used by root finding algorithm - bool CheckLowerUpperBracket(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm - Real64 const X // X value for current iterate - ); +void UpdateMinMax(RootFinderDataType &RootFinderData, // Data used by root finding algorithm + Real64 X, // X value for current iterate + Real64 Y // Y value for current iterate, F(X)=Y +); - bool CheckSlope(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm +void UpdateBracket(EnergyPlusData &state, + RootFinderDataType &RootFinderData, // Data used by root finding algorithm + Real64 X, // X value for current iterate + Real64 Y // Y value for current iterate, F(X)=Y +); - bool CheckNonSingularity(RootFinderDataType const &RootFinderData); // Data used by root finding algorithm +void UpdateHistory(RootFinderDataType &RootFinderData, // Data used by root finding algorithm + Real64 X, // X value for current iterate + Real64 Y // Y value for current iterate, F(X)=Y +); - bool CheckMinConstraint(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm +void UpdateRootFinder(EnergyPlusData &state, + RootFinderDataType &RootFinderData, // Data used by root finding algorithm + Real64 X, // X value for current iterate + Real64 Y // Y value for current iterate, F(X)=Y +); - bool CheckMaxConstraint(EnergyPlusData &state, RootFinderDataType const &RootFinderData); // Data used by root finding algorithm +void SortHistory(int N, // Number of points to sort in history array + Array1D &History // Array of PointType variables. At least N of them +); - bool CheckRootFinderConvergence(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm - Real64 const Y // Y value for current iterate - ); +void AdvanceRootFinder(EnergyPlusData &state, RootFinderDataType &RootFinderData); // Data used by root finding algorithm - bool CheckBracketRoundOff(RootFinderDataType const &RootFinderData); // Data used by root finding algorithm +bool BracketRoot(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm + Real64 &XNext // Next value +); - void UpdateMinMax(RootFinderDataType &RootFinderData, // Data used by root finding algorithm - Real64 const X, // X value for current iterate - Real64 const Y // Y value for current iterate, F(X)=Y - ); +Real64 BisectionMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm - void UpdateBracket(EnergyPlusData &state, RootFinderDataType &RootFinderData, // Data used by root finding algorithm - Real64 const X, // X value for current iterate - Real64 const Y // Y value for current iterate, F(X)=Y - ); +Real64 FalsePositionMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm - void UpdateHistory(RootFinderDataType &RootFinderData, // Data used by root finding algorithm - Real64 const X, // X value for current iterate - Real64 const Y // Y value for current iterate, F(X)=Y - ); +Real64 SecantMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm - void UpdateRootFinder(EnergyPlusData &state, RootFinderDataType &RootFinderData, // Data used by root finding algorithm - Real64 const X, // X value for current iterate - Real64 const Y // Y value for current iterate, F(X)=Y - ); +bool SecantFormula(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm + Real64 &XNext // Result from Secant formula if possible to compute +); - void SortHistory(int const N, // Number of points to sort in history array - Array1D &History // Array of PointType variables. At least N of them - ); +Real64 BrentMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm - void AdvanceRootFinder(EnergyPlusData &state, RootFinderDataType &RootFinderData); // Data used by root finding algorithm +void WriteRootFinderTraceHeader(InputOutputFile &TraceFileUnit); // Unit for trace file - bool BracketRoot(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm - Real64 &XNext // Next value - ); +void WriteRootFinderTrace(InputOutputFile &TraceFile, // Unit for trace file + RootFinderDataType const &RootFinderData // Data used by root finding algorithm +); - Real64 BisectionMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm +void WritePoint(InputOutputFile &TraceFile, // Unit for trace file + PointType const &PointData, // Point data structure + bool ShowXValue); - Real64 FalsePositionMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm +void DebugRootFinder(InputOutputFile &DebugFile, // File unit where to write debugging info + RootFinderDataType const &RootFinderData // Data used by root finding algorithm +); - Real64 SecantMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm +void WriteRootFinderStatus(InputOutputFile &File, // File unit where to write the status description + RootFinderDataType const &RootFinderData // Data used by root finding algorithm +); - bool SecantFormula(RootFinderDataType const &RootFinderData, // Data used by root finding algorithm - Real64 &XNext // Result from Secant formula if possible to compute - ); - - Real64 BrentMethod(RootFinderDataType &RootFinderData); // Data used by root finding algorithm - - void WriteRootFinderTraceHeader(InputOutputFile &TraceFileUnit); // Unit for trace file - - void WriteRootFinderTrace(InputOutputFile &TraceFile, // Unit for trace file - RootFinderDataType const &RootFinderData // Data used by root finding algorithm - ); - - void WritePoint(InputOutputFile &TraceFile, // Unit for trace file - PointType const &PointData, // Point data structure - bool const ShowXValue); - - void DebugRootFinder(InputOutputFile &DebugFile, // File unit where to write debugging info - RootFinderDataType const &RootFinderData // Data used by root finding algorithm - ); - - void WriteRootFinderStatus(InputOutputFile &File, // File unit where to write the status description - RootFinderDataType const &RootFinderData // Data used by root finding algorithm - ); - -} // namespace RootFinder - -} // namespace EnergyPlus +} // namespace EnergyPlus::RootFinder #endif diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index e00414dbacc..16e37eda904 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -2841,7 +2841,7 @@ namespace EnergyPlus::SimAirServingZones { for (int AirLoopControlNum = 1; AirLoopControlNum <= PrimaryAirSystems(AirLoopNum).NumControllers; ++AirLoopControlNum) { PrimaryAirSystems(AirLoopNum).ControllerIndex(AirLoopControlNum) = HVACControllers::GetControllerIndex(state, PrimaryAirSystems(AirLoopNum).ControllerName(AirLoopControlNum)); - HVACControllers::ControllerProps(PrimaryAirSystems(AirLoopNum).ControllerIndex(AirLoopControlNum)).AirLoopControllerIndex = + state.dataHVACControllers->ControllerProps(PrimaryAirSystems(AirLoopNum).ControllerIndex(AirLoopControlNum)).AirLoopControllerIndex = AirLoopControlNum; } // When using controllers, size air loop coils so ControllerProps (e.g., Min/Max Actuated) can be set @@ -3112,7 +3112,7 @@ namespace EnergyPlus::SimAirServingZones { // if the controller can be locked out by the economizer operation and the economizer is active, leave the controller inactive if (AirLoopCheck) { if (AirLoopControlInfo(AirLoopNum).EconoActive) { - if (PrimaryAirSystems(AirLoopNum).CanBeLockedOutByEcono(HVACControllers::ControllerProps(ControllerIndex).AirLoopControllerIndex)) { + if (PrimaryAirSystems(AirLoopNum).CanBeLockedOutByEcono(state.dataHVACControllers->ControllerProps(ControllerIndex).AirLoopControllerIndex)) { ControllerConvergedFlag = true; } } @@ -3134,7 +3134,7 @@ namespace EnergyPlus::SimAirServingZones { BypassOAController); if (AirLoopCheck) { - PrimaryAirSystems(AirLoopNum).ControlConverged(HVACControllers::ControllerProps(ControllerIndex).AirLoopControllerIndex) = + PrimaryAirSystems(AirLoopNum).ControlConverged(state.dataHVACControllers->ControllerProps(ControllerIndex).AirLoopControllerIndex) = ControllerConvergedFlag; } @@ -3197,7 +3197,7 @@ namespace EnergyPlus::SimAirServingZones { // pass convergence of OA system water coils back to SolveAirLoopControllers via PrimaryAirSystem().ControlConverged flag if (AirLoopCheck) { - PrimaryAirSystems(AirLoopNum).ControlConverged(HVACControllers::ControllerProps(ControllerIndex).AirLoopControllerIndex) = + PrimaryAirSystems(AirLoopNum).ControlConverged(state.dataHVACControllers->ControllerProps(ControllerIndex).AirLoopControllerIndex) = ControllerConvergedFlag; AirLoopControlInfo(AirLoopNum).ConvergedFlag = AirLoopControlInfo(AirLoopNum).ConvergedFlag && ControllerConvergedFlag; } diff --git a/src/EnergyPlus/SimulationManager.cc b/src/EnergyPlus/SimulationManager.cc index fe3773f7001..00f84b4f975 100644 --- a/src/EnergyPlus/SimulationManager.cc +++ b/src/EnergyPlus/SimulationManager.cc @@ -160,7 +160,6 @@ namespace SimulationManager { // Using/Aliasing using namespace DataSizing; - using namespace DataReportingFlags; using namespace DataSystemVariables; using namespace HeatBalanceManager; using namespace WeatherManager; @@ -277,8 +276,8 @@ namespace SimulationManager { state.dataGlobal->BeginSimFlag = true; state.dataGlobal->BeginFullSimFlag = false; state.dataGlobal->DoOutputReporting = false; - DisplayPerfSimulationFlag = false; - DoWeatherInitReporting = false; + state.dataReportFlag->DisplayPerfSimulationFlag = false; + state.dataReportFlag->DoWeatherInitReporting = false; state.dataSimulationManager->RunPeriodsInInput = (inputProcessor->getNumObjectsFound(state, "RunPeriod") > 0 || inputProcessor->getNumObjectsFound(state, "RunPeriod:CustomRange") > 0 || state.dataSysVars->FullAnnualRun); state.dataErrTracking->AskForConnectionsReport = false; // set to false until sizing is finished @@ -356,7 +355,7 @@ namespace SimulationManager { state.dataErrTracking->AskForConnectionsReport = true; // set to true now that input processing and sizing is done. state.dataGlobal->KickOffSimulation = false; state.dataGlobal->WarmupFlag = false; - DoWeatherInitReporting = true; + state.dataReportFlag->DoWeatherInitReporting = true; // Note: All the inputs have been 'gotten' by the time we get here. ErrFound = false; @@ -478,7 +477,7 @@ namespace SimulationManager { state.dataGlobal->WarmupFlag = true; state.dataGlobal->DayOfSim = 0; state.dataGlobal->DayOfSimChr = "0"; - NumOfWarmupDays = 0; + state.dataReportFlag->NumOfWarmupDays = 0; if (state.dataEnvrn->CurrentYearIsLeapYear) { if (state.dataGlobal->NumOfDayInEnvrn <= 366) { state.dataOutputProcessor->isFinalYear = true; @@ -511,9 +510,9 @@ namespace SimulationManager { state.dataGlobal->EndDayFlag = false; if (state.dataGlobal->WarmupFlag) { - ++NumOfWarmupDays; - cWarmupDay = fmt::to_string(NumOfWarmupDays); - DisplayString(state, "Warming up {" + cWarmupDay + '}'); + ++state.dataReportFlag->NumOfWarmupDays; + state.dataReportFlag->cWarmupDay = fmt::to_string(state.dataReportFlag->NumOfWarmupDays); + DisplayString(state, "Warming up {" + state.dataReportFlag->cWarmupDay + '}'); } else if (state.dataGlobal->DayOfSim == 1) { if (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::RunPeriodWeather) { DisplayString(state, "Starting Simulation at " + state.dataEnvrn->CurMnDyYr + " for " + state.dataEnvrn->EnvironmentName); @@ -521,15 +520,15 @@ namespace SimulationManager { DisplayString(state, "Starting Simulation at " + state.dataEnvrn->CurMnDy + " for " + state.dataEnvrn->EnvironmentName); } static constexpr auto Format_700("Environment:WarmupDays,{:3}\n"); - print(state.files.eio, Format_700, NumOfWarmupDays); + print(state.files.eio, Format_700, state.dataReportFlag->NumOfWarmupDays); ResetAccumulationWhenWarmupComplete(state); - } else if (DisplayPerfSimulationFlag) { + } else if (state.dataReportFlag->DisplayPerfSimulationFlag) { if (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::RunPeriodWeather) { DisplayString(state, "Continuing Simulation at " + state.dataEnvrn->CurMnDyYr + " for " + state.dataEnvrn->EnvironmentName); } else { DisplayString(state, "Continuing Simulation at " + state.dataEnvrn->CurMnDy + " for " + state.dataEnvrn->EnvironmentName); } - DisplayPerfSimulationFlag = false; + state.dataReportFlag->DisplayPerfSimulationFlag = false; } // for simulations that last longer than a week, identify when the last year of the simulation is started if ((state.dataGlobal->DayOfSim > 365) && ((state.dataGlobal->NumOfDayInEnvrn - state.dataGlobal->DayOfSim) == 364) && !state.dataGlobal->WarmupFlag) { @@ -994,8 +993,8 @@ namespace SimulationManager { LimitNumSysSteps = int(state.dataGlobal->TimeStepZone / state.dataConvergeParams->MinTimeStepSys); - DebugOutput = false; - EvenDuringWarmup = false; + state.dataReportFlag->DebugOutput = false; + state.dataReportFlag->EvenDuringWarmup = false; CurrentModuleObject = "Output:DebuggingData"; NumDebugOut = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); if (NumDebugOut > 1) { @@ -1004,10 +1003,10 @@ namespace SimulationManager { if (NumDebugOut > 0) { inputProcessor->getObjectItem(state, CurrentModuleObject, 1, Alphas, NumAlpha, Number, NumNumber, IOStat); if (NumAlpha >= 1) { - DebugOutput = UtilityRoutines::SameString(Alphas(1), "Yes"); + state.dataReportFlag->DebugOutput = UtilityRoutines::SameString(Alphas(1), "Yes"); } if (NumAlpha >= 2) { - EvenDuringWarmup = UtilityRoutines::SameString(Alphas(2), "Yes"); + state.dataReportFlag->EvenDuringWarmup = UtilityRoutines::SameString(Alphas(2), "Yes"); } } @@ -1058,9 +1057,9 @@ namespace SimulationManager { } else if (UtilityRoutines::SameString(diagnosticName, "DisplayZoneAirHeatBalanceOffBalance")) { state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance = true; } else if (UtilityRoutines::SameString(diagnosticName, "DoNotMirrorDetachedShading")) { - MakeMirroredDetachedShading = false; + state.dataReportFlag->MakeMirroredDetachedShading = false; } else if (UtilityRoutines::SameString(diagnosticName, "DoNotMirrorAttachedShading")) { - MakeMirroredAttachedShading = false; + state.dataReportFlag->MakeMirroredAttachedShading = false; } else if (UtilityRoutines::SameString(diagnosticName, "ReportDuringWarmup")) { state.dataSysVars->ReportDuringWarmup = true; } else if (UtilityRoutines::SameString(diagnosticName, "DisplayWeatherMissingDataWarnings")) { diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index e8b76bcbdaf..b6f67a8ddce 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -131,7 +131,6 @@ namespace EnergyPlus::SolarShading { using namespace DataShadowingCombinations; using DaylightingManager::ProfileAngle; using namespace SolarReflectionManager; - using namespace DataReportingFlags; using namespace DataVectorTypes; using namespace WindowManager; using namespace FenestrationCommon; @@ -8050,7 +8049,7 @@ namespace EnergyPlus::SolarShading { } else { DisplayString(state, "Updating Shadowing Calculations, Start Date=" + state.dataEnvrn->CurMnDy); } - DisplayPerfSimulationFlag = true; + state.dataReportFlag->DisplayPerfSimulationFlag = true; } PerDayOfYear = state.dataEnvrn->DayOfYear; @@ -8072,7 +8071,7 @@ namespace EnergyPlus::SolarShading { AvgCosSolarDeclin = std::sqrt(1.0 - pow_2(AvgSinSolarDeclin)); // trigger display of progress in the simulation every two weeks if (!state.dataGlobal->WarmupFlag && state.dataGlobal->BeginDayFlag && (state.dataGlobal->DayOfSim % 14 == 0)) { - DisplayPerfSimulationFlag = true; + state.dataReportFlag->DisplayPerfSimulationFlag = true; } } diff --git a/src/EnergyPlus/StateManagement.cc b/src/EnergyPlus/StateManagement.cc index af98c4fca70..aac8e4666f4 100644 --- a/src/EnergyPlus/StateManagement.cc +++ b/src/EnergyPlus/StateManagement.cc @@ -59,12 +59,9 @@ #include #include #include -#include #include #include -#include #include -#include #include #include #include @@ -75,14 +72,12 @@ #include #include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -92,7 +87,6 @@ #include #include #include -#include #include #include #include @@ -134,12 +128,9 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) DataHVACGlobals::clear_state(); DataIPShortCuts::clear_state(); DataMoistureBalance::clear_state(); - DataMoistureBalanceEMPD::clear_state(); DataOutputs::clear_state(); DataPhotovoltaics::clear_state(); - DataReportingFlags::clear_state(); DataStringGlobals::clear_state(); - DataSurfaceLists::clear_state(); DataSystemVariables::clear_state(); DataUCSDSharedData::clear_state(); DataViewFactorInformation::clear_state(); @@ -150,13 +141,11 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) ElectricBaseboardRadiator::clear_state(); EvaporativeFluidCoolers::clear_state(); ExternalInterface::clear_state(); - Fans::clear_state(); FaultsManager::clear_state(); FluidProperties::clear_state(); Furnaces::clear_state(); General::clear_state(); GroundTemperatureManager::clear_state(); - HeatBalanceAirManager::clear_state(); HeatBalanceIntRadExchange::clear_state(); HeatBalanceManager::clear_state(); HeatBalanceSurfaceManager::clear_state(); @@ -165,7 +154,6 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) HeatingCoils::clear_state(); HighTempRadiantSystem::clear_state(); Humidifiers::clear_state(); - HVACControllers::clear_state(); HVACCooledBeam::clear_state(); HVACDuct::clear_state(); HVACDXSystem::clear_state(); diff --git a/src/EnergyPlus/SteamCoils.cc b/src/EnergyPlus/SteamCoils.cc index b92e127c5db..6921e7e331a 100644 --- a/src/EnergyPlus/SteamCoils.cc +++ b/src/EnergyPlus/SteamCoils.cc @@ -806,7 +806,7 @@ namespace SteamCoils { coilSelectionReportObj->setCoilSupplyFanInfo(state, state.dataSteamCoils->SteamCoil(CoilNum).Name, "Coil:Heating:Steam", - Fans::Fan(state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).SupFanNum).FanName, + state.dataFans->Fan(state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).SupFanNum).FanName, DataAirSystems::structArrayLegacyFanModels, state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).SupFanNum); } diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 4227cd95c0e..36a2f8b48f2 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -275,9 +275,6 @@ namespace SurfaceGeometry { using namespace DataVectorTypes; using namespace OutputReportPredefined; - using namespace DataReportingFlags; - - static std::string const RoutineName("SetUpZoneGeometry: "); Real64 AverageHeight; // Used to keep track of average height of a surface/zone @@ -2730,7 +2727,6 @@ namespace SurfaceGeometry { // Using/Aliasing using namespace DataIPShortCuts; - using namespace DataReportingFlags; using ScheduleManager::CheckScheduleValueMinMax; using ScheduleManager::GetScheduleIndex; @@ -2873,7 +2869,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, rNumericArgs({2, _})); CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - if (MakeMirroredDetachedShading) { + if (state.dataReportFlag->MakeMirroredDetachedShading) { MakeMirrorSurface(state, SurfNum); } } @@ -2896,11 +2892,10 @@ namespace SurfaceGeometry { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Gets the simple, rectantular detached surfaces. + // Gets the simple, rectangular detached surfaces. // Using/Aliasing using namespace DataIPShortCuts; - using namespace DataReportingFlags; // SUBROUTINE PARAMETER DEFINITIONS: static Array1D_string const cModuleObjects(2, {"Shading:Site", "Shading:Building"}); @@ -2986,7 +2981,7 @@ namespace SurfaceGeometry { ErrorsFound = true; } - if (MakeMirroredDetachedShading) { + if (state.dataReportFlag->MakeMirroredDetachedShading) { MakeMirrorSurface(state, SurfNum); } } @@ -5407,7 +5402,6 @@ namespace SurfaceGeometry { using ScheduleManager::GetScheduleIndex; using ScheduleManager::GetScheduleMaxValue; using ScheduleManager::GetScheduleMinValue; - using namespace DataReportingFlags; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; // IO Status when calling get input subroutine @@ -5560,7 +5554,7 @@ namespace SurfaceGeometry { // SurfaceTmp(SurfNum)%BaseSurfName=' ' state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; // SurfaceTmp(SurfNum)%ZoneName=' ' - if (MakeMirroredAttachedShading) { + if (state.dataReportFlag->MakeMirroredAttachedShading) { MakeMirrorSurface(state, SurfNum); } } @@ -5587,8 +5581,6 @@ namespace SurfaceGeometry { // Using/Aliasing using namespace DataIPShortCuts; - - using namespace DataReportingFlags; using namespace Vectors; // SUBROUTINE PARAMETER DEFINITIONS: @@ -5751,7 +5743,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; // and mirror - if (MakeMirroredAttachedShading) { + if (state.dataReportFlag->MakeMirroredAttachedShading) { MakeMirrorSurface(state, SurfNum); } @@ -5830,7 +5822,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; // and mirror - if (MakeMirroredAttachedShading) { + if (state.dataReportFlag->MakeMirroredAttachedShading) { MakeMirrorSurface(state, SurfNum); } } else { @@ -5921,7 +5913,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; // and mirror - if (MakeMirroredAttachedShading) { + if (state.dataReportFlag->MakeMirroredAttachedShading) { MakeMirrorSurface(state, SurfNum); } } else { diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index d18e0e800d7..5ad18ea6838 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -363,7 +363,7 @@ namespace UnitHeater { if (errFlag) { ErrorsFound = true; } else { - GetFanVolFlow(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index, FanVolFlow); + GetFanVolFlow(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index, FanVolFlow); if (FanVolFlow != AutoSize && state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow != AutoSize && FanVolFlow < state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow) { @@ -1643,7 +1643,7 @@ namespace UnitHeater { // Report variables... state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower = max(0.0, QUnitOut); if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecPower = Fans::GetFanPower(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index); + state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecPower = Fans::GetFanPower(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index); } else { state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecPower = HVACFan::fanObjs[state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index]->fanPower(); } diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index 6c12ccb17fe..92688c708e6 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -468,7 +468,7 @@ namespace UnitVentilator { GetFanIndex(state, state.dataUnitVentilators->UnitVent(UnitVentNum).FanName, FanIndex, errFlag, CurrentModuleObject); // Other error checks should trap before it gets to this point in the code, but including just in case. - GetFanVolFlow(FanIndex, FanVolFlow); + GetFanVolFlow(state, FanIndex, FanVolFlow); if (FanVolFlow != AutoSize && state.dataUnitVentilators->UnitVent(UnitVentNum).MaxAirVolFlow != AutoSize && FanVolFlow < state.dataUnitVentilators->UnitVent(UnitVentNum).MaxAirVolFlow) { ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataUnitVentilators->UnitVent(UnitVentNum).Name + "\""); @@ -3235,7 +3235,7 @@ namespace UnitVentilator { state.dataUnitVentilators->UnitVent(UnitVentNum).SensCoolPower = std::abs(min(0.0, QUnitOut)); state.dataUnitVentilators->UnitVent(UnitVentNum).TotCoolPower = std::abs(min(0.0, QTotUnitOut)); if (state.dataUnitVentilators->UnitVent(UnitVentNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - state.dataUnitVentilators->UnitVent(UnitVentNum).ElecPower = Fans::GetFanPower(state.dataUnitVentilators->UnitVent(UnitVentNum).Fan_Index); + state.dataUnitVentilators->UnitVent(UnitVentNum).ElecPower = Fans::GetFanPower(state, state.dataUnitVentilators->UnitVent(UnitVentNum).Fan_Index); } else { state.dataUnitVentilators->UnitVent(UnitVentNum).ElecPower = HVACFan::fanObjs[state.dataUnitVentilators->UnitVent(UnitVentNum).Fan_Index]->fanPower(); } diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 75fca42d796..b5cbfa1f6c8 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -1429,7 +1429,7 @@ namespace UnitarySystems { // Object Data, points to specific array DataSizing::ZoneEqSizingData &EqSizing(*select_EqSizing); - // can't hurt to initialize these going in, problably redundant + // can't hurt to initialize these going in, probably redundant EqSizing.AirFlow = false; EqSizing.CoolingAirFlow = false; EqSizing.HeatingAirFlow = false; @@ -13999,7 +13999,7 @@ namespace UnitarySystems { if (this->m_FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { locFanElecPower = HVACFan::fanObjs[this->m_FanIndex]->fanPower(); } else { - locFanElecPower = Fans::GetFanPower(this->m_FanIndex); + locFanElecPower = Fans::GetFanPower(state, this->m_FanIndex); } Real64 elecCoolingPower = 0.0; diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index a5128b53917..4990682db29 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -766,18 +766,13 @@ namespace UtilityRoutines { // Use INQUIRE to determine if file is open. // Using/Aliasing - using DataReportingFlags::DebugOutput; using DaylightingManager::CloseDFSFile; using DaylightingManager::CloseReportIllumMaps; - // LOGICAL :: exists, opened - // INTEGER :: UnitNumber - // INTEGER :: ios - CloseReportIllumMaps(state); CloseDFSFile(state); - if (DebugOutput || (state.files.debug.good() && state.files.debug.position() > 0)) { + if (state.dataReportFlag->DebugOutput || (state.files.debug.good() && state.files.debug.position() > 0)) { state.files.debug.close(); } else { state.files.debug.del(); diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index 3c719985aa2..fb2d4ea72e9 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -5778,7 +5778,7 @@ namespace VariableSpeedCoils { } } else { if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex > 0) { - locFanElecPower = Fans::GetFanPower(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex); + locFanElecPower = Fans::GetFanPower(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex); } } diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 7360a18103b..fb9039000ee 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -337,9 +337,9 @@ namespace VentilatedSlab { state.dataVentilatedSlab->VentSlab(Item).SurfListName = cAlphaArgs(4); SurfListNum = 0; // IF (NumOfSlabLists > 0) SurfListNum = UtilityRoutines::FindItemInList(VentSlab(Item)%SurfListName, SlabList%Name, NumOfSlabLists) - if (NumOfSurfListVentSlab > 0) SurfListNum = UtilityRoutines::FindItemInList(state.dataVentilatedSlab->VentSlab(Item).SurfListName, SlabList); + if (state.dataSurfLists->NumOfSurfListVentSlab > 0) SurfListNum = UtilityRoutines::FindItemInList(state.dataVentilatedSlab->VentSlab(Item).SurfListName, state.dataSurfLists->SlabList); if (SurfListNum > 0) { // Found a valid surface list - state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces = SlabList(SurfListNum).NumOfSurfaces; + state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces = state.dataSurfLists->SlabList(SurfListNum).NumOfSurfaces; state.dataVentilatedSlab->VentSlab(Item).ZName.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); state.dataVentilatedSlab->VentSlab(Item).ZPtr.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); state.dataVentilatedSlab->VentSlab(Item).SurfaceName.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); @@ -351,16 +351,16 @@ namespace VentilatedSlab { state.dataVentilatedSlab->VentSlab(Item).SlabOut.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); state.dataVentilatedSlab->MaxCloNumOfSurfaces = max(state.dataVentilatedSlab->MaxCloNumOfSurfaces, state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); - for (SurfNum = 1; SurfNum <= SlabList(SurfListNum).NumOfSurfaces; ++SurfNum) { - state.dataVentilatedSlab->VentSlab(Item).ZName(SurfNum) = SlabList(SurfListNum).ZoneName(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).ZPtr(SurfNum) = SlabList(SurfListNum).ZonePtr(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).SurfaceName(SurfNum) = SlabList(SurfListNum).SurfName(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum) = SlabList(SurfListNum).SurfPtr(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).CDiameter(SurfNum) = SlabList(SurfListNum).CoreDiameter(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).CLength(SurfNum) = SlabList(SurfListNum).CoreLength(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).CNumbers(SurfNum) = SlabList(SurfListNum).CoreNumbers(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).SlabIn(SurfNum) = SlabList(SurfListNum).SlabInNodeName(SurfNum); - state.dataVentilatedSlab->VentSlab(Item).SlabOut(SurfNum) = SlabList(SurfListNum).SlabOutNodeName(SurfNum); + for (SurfNum = 1; SurfNum <= state.dataSurfLists->SlabList(SurfListNum).NumOfSurfaces; ++SurfNum) { + state.dataVentilatedSlab->VentSlab(Item).ZName(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).ZoneName(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).ZPtr(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).ZonePtr(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SurfaceName(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).SurfName(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).SurfPtr(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).CDiameter(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).CoreDiameter(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).CLength(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).CoreLength(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).CNumbers(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).CoreNumbers(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SlabIn(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).SlabInNodeName(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SlabOut(SurfNum) = state.dataSurfLists->SlabList(SurfListNum).SlabOutNodeName(SurfNum); if (state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum) != 0) { state.dataSurface->Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).IntConvSurfHasActiveInIt = true; } @@ -3155,7 +3155,7 @@ namespace VentilatedSlab { if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { locFanElecPower = HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->fanPower(); } else { - locFanElecPower = Fans::GetFanPower(state.dataVentilatedSlab->VentSlab(Item).Fan_Index); + locFanElecPower = Fans::GetFanPower(state, state.dataVentilatedSlab->VentSlab(Item).Fan_Index); } if ((AirMassFlow <= 0.0) && (locFanElecPower > 0.0)) { state.dataLoopNodes->Node(MixoutNode).MassFlowRate = 0.0; @@ -3333,7 +3333,7 @@ namespace VentilatedSlab { if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { state.dataVentilatedSlab->VentSlab(Item).ElecFanPower = HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->fanPower(); } else { - state.dataVentilatedSlab->VentSlab(Item).ElecFanPower = Fans::GetFanPower(state.dataVentilatedSlab->VentSlab(Item).Fan_Index); + state.dataVentilatedSlab->VentSlab(Item).ElecFanPower = Fans::GetFanPower(state, state.dataVentilatedSlab->VentSlab(Item).Fan_Index); } state.dataVentilatedSlab->VentSlab(Item).AirMassFlowRate = AirMassFlow; diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index d65ee4cc388..53f87920ce2 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -106,9 +106,7 @@ #include #include -namespace EnergyPlus { - -namespace WaterCoils { +namespace EnergyPlus::WaterCoils { // Module containing the WaterCoil simulation routines // MODULE INFORMATION: @@ -219,15 +217,15 @@ namespace WaterCoils { } // Calculate the Correct WaterCoil Model with the current CoilNum - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_DetFlatFinCooling) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling) { CalcDetailFlatFinCoolingCoil(state, CoilNum, state.dataWaterCoils->SimCalc, OpMode, PartLoadFrac); if (present(QActual)) QActual = state.dataWaterCoils->WaterCoil(CoilNum).SenWaterCoolingCoilRate; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { CoolingCoil(state, CoilNum, FirstHVACIteration, state.dataWaterCoils->SimCalc, OpMode, PartLoadFrac); if (present(QActual)) QActual = state.dataWaterCoils->WaterCoil(CoilNum).SenWaterCoolingCoilRate; } - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { CalcSimpleHeatingCoil(state, CoilNum, OpMode, PartLoadFrac, state.dataWaterCoils->SimCalc); if (present(QActual)) QActual = state.dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate; } @@ -366,10 +364,10 @@ namespace WaterCoils { } state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilTypeA = "Heating"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; // 'Heating' + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; // 'Heating' state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModelA = "SIMPLE"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilModel_Simple; // 'SIMPLE' - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = iCoilModel::HeatingSimple; // 'SIMPLE' + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; state.dataWaterCoils->WaterCoil(CoilNum).UACoil = NumArray(1); state.dataWaterCoils->WaterCoil(CoilNum).UACoilVariable = state.dataWaterCoils->WaterCoil(CoilNum).UACoil; @@ -514,10 +512,10 @@ namespace WaterCoils { } state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilTypeA = "Cooling"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Cooling; // 'Cooling' + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; // 'Cooling' state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModelA = "DETAILED FLAT FIN"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilModel_Detailed; // 'DETAILED FLAT FIN' - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_DetFlatFinCooling; + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = iCoilModel::CoolingDetailed; // 'DETAILED FLAT FIN' + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterDetailedFlatCooling; state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = NumArray(1); if (state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate == AutoSize) state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; @@ -696,10 +694,10 @@ namespace WaterCoils { } state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilTypeA = "Cooling"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Cooling; // 'Cooling' + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; // 'Cooling' state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModelA = "Cooling"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilModel_Cooling; // 'Cooling' - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_Cooling; + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = iCoilModel::CoolingSimple; // 'Cooling' + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = NumArray(1); // Liquid mass flow rate at Design kg/s if (state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate == AutoSize) state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; @@ -905,7 +903,7 @@ namespace WaterCoils { Real64 DesHumRatAtWaterInTemp; // Enthalpy at water inlet temp and entering air HumRat (J/kg) Real64 CapacitanceAir; // Air-side capacity rate(W/C) Real64 DesAirTempApparatusDewPt; // Temperature apparatus dew point at design capacity - Real64 DesAirHumRatApparatusDewPt; // Humdity Ratio at apparatus dew point at design capacity + Real64 DesAirHumRatApparatusDewPt; // Humidity Ratio at apparatus dew point at design capacity Real64 DesBypassFactor; // ByPass Factor at design condition Real64 SlopeTempVsHumRatio; // Ratio temperature difference to humidity difference // between entering and leaving air states @@ -1014,13 +1012,13 @@ namespace WaterCoils { int CoilTypeNum(0); std::string CompType; std::string CompName = state.dataWaterCoils->WaterCoil(tempCoilNum).Name; - if (state.dataWaterCoils->WaterCoil(tempCoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + if (state.dataWaterCoils->WaterCoil(tempCoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { CoilTypeNum = SimAirServingZones::WaterCoil_Cooling; CompType = cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater); - } else if (state.dataWaterCoils->WaterCoil(tempCoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_DetFlatFinCooling) { + } else if (state.dataWaterCoils->WaterCoil(tempCoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling) { CoilTypeNum = SimAirServingZones::WaterCoil_DetailedCool; CompType = cAllCoilTypes(DataHVACGlobals::Coil_CoolingWaterDetailed); - } else if (state.dataWaterCoils->WaterCoil(tempCoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + } else if (state.dataWaterCoils->WaterCoil(tempCoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { CoilTypeNum = SimAirServingZones::WaterCoil_SimpleHeat; CompType = cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater); } @@ -1042,7 +1040,7 @@ namespace WaterCoils { errFlag = false; ScanPlantLoopsForObject(state, state.dataWaterCoils->WaterCoil(CoilNum).Name, - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num, + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType, state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum, state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide, state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum, @@ -1088,7 +1086,8 @@ namespace WaterCoils { DesCpAir(CoilNum) = PsyCpAirFnW(0.0); DesUARangeCheck(CoilNum) = (-1568.6 * state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat + 20.157); - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == state.dataWaterCoils->CoilType_Cooling) { // 'Cooling' + if ((state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) || + (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling)) { // 'Cooling' Node(WaterInletNode).Temp = 5.0; Cp = GetSpecificHeatGlycol(state, @@ -1103,7 +1102,7 @@ namespace WaterCoils { Node(WaterInletNode).HumRat = 0.0; } - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == state.dataWaterCoils->CoilType_Heating) { // 'Heating' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { // 'Heating' Node(WaterInletNode).Temp = 60.0; Cp = GetSpecificHeatGlycol(state, @@ -1141,7 +1140,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum); // effective fin diameter for detailed flat fin coil - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' state.dataWaterCoils->WaterCoil(CoilNum).EffectiveFinDiam = std::sqrt(4.0 * state.dataWaterCoils->WaterCoil(CoilNum).FinDiam * state.dataWaterCoils->WaterCoil(CoilNum).CoilDepth / (DataGlobalConstants::Pi * state.dataWaterCoils->WaterCoil(CoilNum).NumOfTubeRows * state.dataWaterCoils->WaterCoil(CoilNum).NumOfTubesPerRow)); @@ -1207,7 +1206,7 @@ namespace WaterCoils { //@@@ DESIGN CONDITION BEGIN HERE @@@ // Check for zero design cooling capacity as specified by coil design inputs - if (state.dataWaterCoils->MyCoilDesignFlag(CoilNum) && (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Cooling) && + if (state.dataWaterCoils->MyCoilDesignFlag(CoilNum) && (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingSimple) && (state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate > 0.0) && (state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterMassFlowRate > 0.0)) { DesInletAirEnth = PsyHFnTdbW(state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp, state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat); @@ -1246,7 +1245,7 @@ namespace WaterCoils { } } - if (state.dataWaterCoils->MyCoilDesignFlag(CoilNum) && (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Cooling) && + if (state.dataWaterCoils->MyCoilDesignFlag(CoilNum) && (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingSimple) && (state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate > 0.0) && (state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterMassFlowRate > 0.0)) { // 'Cooling' state.dataWaterCoils->MyCoilDesignFlag(CoilNum) = false; @@ -1294,7 +1293,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = TOutNew; // update outlet air conditions used for sizing std::string CompType; - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { CompType = cAllCoilTypes(Coil_CoolingWaterDetailed); } else { CompType = cAllCoilTypes(Coil_CoolingWater); @@ -1538,7 +1537,7 @@ namespace WaterCoils { //@@@@ DESIGN CONDITION END HERE @@@@ // Calculate rated Total, latent, sensible capacity, SHR, effectiveness - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp = 16.6; state.dataWaterCoils->WaterCoil(CoilNum).InletAirHumRat = PsyWFnTdbRhPb(state, 16.6, 0.5, state.dataEnvrn->StdBaroPress, RoutineName); state.dataWaterCoils->WaterCoil(CoilNum).InletWaterTemp = 82.2; @@ -1561,19 +1560,19 @@ namespace WaterCoils { CapacitanceWater = state.dataWaterCoils->WaterCoil(CoilNum).InletWaterMassFlowRate * Cp; CMin = min(CapacitanceAir, CapacitanceWater); if (CMin > 0.0) { - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { CoolingCoil(state, CoilNum, FirstHVACIteration, state.dataWaterCoils->DesignCalc, ContFanCycCoil, 1.0); CoilEffectiveness = (state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp - state.dataWaterCoils->WaterCoil(CoilNum).OutletAirTemp) / (state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp - state.dataWaterCoils->WaterCoil(CoilNum).InletWaterTemp) * (CapacitanceAir / CMin); RatedLatentCapacity = state.dataWaterCoils->WaterCoil(CoilNum).TotWaterCoolingCoilRate - state.dataWaterCoils->WaterCoil(CoilNum).SenWaterCoolingCoilRate; RatedSHR = state.dataWaterCoils->WaterCoil(CoilNum).SenWaterCoolingCoilRate / state.dataWaterCoils->WaterCoil(CoilNum).TotWaterCoolingCoilRate; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_DetFlatFinCooling) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling) { CalcDetailFlatFinCoolingCoil(state, CoilNum, state.dataWaterCoils->DesignCalc, ContFanCycCoil, 1.0); CoilEffectiveness = (state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp - state.dataWaterCoils->WaterCoil(CoilNum).OutletAirTemp) / (state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp - state.dataWaterCoils->WaterCoil(CoilNum).InletWaterTemp) * (CapacitanceAir / CMin); RatedLatentCapacity = state.dataWaterCoils->WaterCoil(CoilNum).TotWaterCoolingCoilRate - state.dataWaterCoils->WaterCoil(CoilNum).SenWaterCoolingCoilRate; RatedSHR = state.dataWaterCoils->WaterCoil(CoilNum).SenWaterCoolingCoilRate / state.dataWaterCoils->WaterCoil(CoilNum).TotWaterCoolingCoilRate; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { CalcSimpleHeatingCoil(state, CoilNum, ContFanCycCoil, 1.0, state.dataWaterCoils->DesignCalc); CoilEffectiveness = (state.dataWaterCoils->WaterCoil(CoilNum).OutletAirTemp - state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp) / (state.dataWaterCoils->WaterCoil(CoilNum).InletWaterTemp - state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp) * (CapacitanceAir / CMin); @@ -1599,8 +1598,8 @@ namespace WaterCoils { // create predefined report entries MyCoilReportFlag(CoilNum) = false; { - auto const SELECT_CASE_var(state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); - if (SELECT_CASE_var == state.dataWaterCoils->WaterCoil_SimpleHeating) { + auto const SELECT_CASE_var(state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType); + if (SELECT_CASE_var == DataPlant::TypeOf_CoilWaterSimpleHeating) { if (RptCoilHeaderFlag(1)) { print(state.files.eio, "{}", @@ -1630,7 +1629,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum, state.dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum, state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum); // coil report - } else if (SELECT_CASE_var == state.dataWaterCoils->WaterCoil_DetFlatFinCooling) { + } else if (SELECT_CASE_var == DataPlant::TypeOf_CoilWaterDetailedFlatCooling) { if (RptCoilHeaderFlag(2)) { print(state.files.eio, "{}\n", @@ -1670,7 +1669,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum, state.dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum, state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum); // Coil Report - } else if (SELECT_CASE_var == state.dataWaterCoils->WaterCoil_Cooling) { + } else if (SELECT_CASE_var == DataPlant::TypeOf_CoilWaterCooling) { if (RptCoilHeaderFlag(2)) { print(state.files.eio, "{}\n", @@ -1746,13 +1745,13 @@ namespace WaterCoils { std::string coilTypeName(" "); // calculate coil sim model at rating point, full load, continuous fan - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_DetFlatFinCooling) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling) { CalcDetailFlatFinCoolingCoil(state, CoilNum, state.dataWaterCoils->SimCalc, ContFanCycCoil, 1.0); coilTypeName = "Coil:Cooling:Water:DetailedGeometry"; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { CoolingCoil(state, CoilNum, FirstHVACIteration, state.dataWaterCoils->SimCalc, ContFanCycCoil, 1.0); coilTypeName = "Coil:Cooling:Water"; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { CalcSimpleHeatingCoil(state, CoilNum, ContFanCycCoil, 1.0, state.dataWaterCoils->SimCalc); coilTypeName = "Coil:Heating:Water"; } @@ -1763,8 +1762,8 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).OutletAirTemp, state.dataWaterCoils->WaterCoil(CoilNum).OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, "InitWaterCoil"); // call set routine in coil report - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_DetFlatFinCooling || - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling || + state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { coilSelectionReportObj->setRatedCoilConditions(state, state.dataWaterCoils->WaterCoil(CoilNum).Name, coilTypeName, @@ -1781,7 +1780,7 @@ namespace WaterCoils { -999.0, -999.0, -999.0); // coil effectiveness - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { coilSelectionReportObj->setRatedCoilConditions(state, state.dataWaterCoils->WaterCoil(CoilNum).Name, coilTypeName, @@ -1845,7 +1844,7 @@ namespace WaterCoils { Real64 WaterConvSensitivity; // "s" in Wetter 1999, temperature sensitivity in water side convection // Coil:Heating:Water - if ((state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) && + if ((state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) && (!(state.dataWaterCoils->MyUAAndFlowCalcFlag(CoilNum)))) { // update Coil UA based on inlet mass flows and temps x_a = 1.0 + 4.769E-3 * (state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp); if (state.dataWaterCoils->WaterCoil(CoilNum).DesAirMassFlowRate > 0.0) { @@ -1907,7 +1906,7 @@ namespace WaterCoils { // Coil:Cooling:Water // update Coil UA based on inlet mass flows and temps - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling && (!state.dataWaterCoils->MyCoilDesignFlag(CoilNum))) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling && (!state.dataWaterCoils->MyCoilDesignFlag(CoilNum))) { if (state.dataWaterCoils->WaterCoil(CoilNum).DesAirMassFlowRate > 0.0) { x_a = 1.0 + 4.769E-3 * (state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp); state.dataWaterCoils->WaterCoil(CoilNum).UACoilExternal = x_a * @@ -2065,7 +2064,9 @@ namespace WaterCoils { auto &OASysEqSizing(state.dataSize->OASysEqSizing); // cooling coils - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == state.dataWaterCoils->CoilType_Cooling && state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize) { + if (((state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) || + (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling)) && + state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize) { // find the appropriate Plant Sizing object PltSizCoolNum = PlantUtilities::MyPlantSizingIndex(state, "chilled water coil", state.dataWaterCoils->WaterCoil(CoilNum).Name, @@ -2074,7 +2075,8 @@ namespace WaterCoils { LoopErrorsFound); } - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == state.dataWaterCoils->CoilType_Cooling) { // 'Cooling' + if (((state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) || + (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling))) { // 'Cooling' if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { state.dataSize->DataWaterCoilSizCoolDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; @@ -2089,7 +2091,7 @@ namespace WaterCoils { state.dataSize->DataPltSizCoolNum = PltSizCoolNum; state.dataSize->DataWaterLoopNum = state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum; - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' CompType = cAllCoilTypes(Coil_CoolingWaterDetailed); // Coil:Cooling:Water:DetailedGeometry } else { CompType = cAllCoilTypes(Coil_CoolingWater); // Coil:Cooling:Water @@ -2135,7 +2137,7 @@ namespace WaterCoils { // calculate pre-sizing data needed for specific functions (e.g., CoolingWaterDesAirInletTempSizing needs HRin and air flow) // these will be calculated again after other parameters are known - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' TempSize = AutoSize; // coil report } else { TempSize = state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat; // preserve input if entered @@ -2165,7 +2167,7 @@ namespace WaterCoils { } // end pre-sizing data calculations - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' bPRINT = false; // do not print this sizing request since this coil does not have a design inlet air temp input field (we // should print this!) TempSize = AutoSize; // not an input for this model @@ -2182,7 +2184,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = sizerCWDesInletAirTemp.size(state, TempSize, ErrorsFound); state.dataSize->DataDesInletAirTemp = state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp; - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' bPRINT = false; // no field for detailed water coil, should print to eio anyway TempSize = AutoSize; // coil report SizingString.clear(); // doesn't matter @@ -2197,7 +2199,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = sizerCWDesWaterInTemp.size(state, TempSize, ErrorsFound); if (state.dataSize->CurZoneEqNum > 0) { // zone equipment use air inlet humrat to calculate design outlet air temperature - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' bPRINT = false; // no field for detailed water coil, should print to eio anyway TempSize = AutoSize; // coil report } else { @@ -2208,7 +2210,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = sizerCWDesInHumRat.size(state, TempSize, ErrorsFound); } - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' bPRINT = false; // no field for detailed water coil, should print to eio anyway TempSize = AutoSize; // coil report SizingString.clear(); // doesn't matter @@ -2227,7 +2229,7 @@ namespace WaterCoils { if (state.dataSize->CurSysNum > 0) { // This call can be deleted at a future time and remove the if ( CurZoneEqNum > 0 ) check above. This will // change the order of the eio file. - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' bPRINT = false; // no field for detailed water coil, should print this to eio anyway TempSize = AutoSize; // coil report } else { @@ -2238,7 +2240,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = sizerCWDesInHumRat.size(state, TempSize, ErrorsFound); } - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' bPRINT = false; // no field for detailed water coil, should print this to eio anyway TempSize = AutoSize; // coil report } else { @@ -2273,7 +2275,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = sizerCWWaterflow.size(state, TempSize, ErrorsFound); state.dataSize->DataWaterFlowUsedForSizing = state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate; - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { // 'DETAILED FLAT FIN' + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { // 'DETAILED FLAT FIN' bPRINT = false; // do not print this sizing request since this coil does not have a design air flow rate input field (we // should print this!) } else { @@ -2295,7 +2297,7 @@ namespace WaterCoils { ShowContinueError(state, "The autosize value for max air volume flow rate is zero"); } - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == state.dataWaterCoils->CoilModel_Detailed) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel == iCoilModel::CoolingDetailed) { FieldNum = 16; // N16, \field Number of Tubes per Row bPRINT = true; @@ -2429,7 +2431,7 @@ namespace WaterCoils { } // end cooling coil IF // if this is a heating coil - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == state.dataWaterCoils->CoilType_Heating && state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating && state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize) { // find the appropriate heating Plant Sizing object PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(state, "hot water coil", state.dataWaterCoils->WaterCoil(CoilNum).Name, @@ -2438,7 +2440,7 @@ namespace WaterCoils { LoopErrorsFound); } - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == state.dataWaterCoils->CoilType_Heating) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { // use water design deltaT specified in the heating water coils @@ -2929,7 +2931,7 @@ namespace WaterCoils { // OTHER NOTES: // Routine was originally adapted for use in IBLAST by R.D. Taylor in l993. // Subsequently rewritten and improved by J.C. Vanderzee in 1994 - // Revised and further enanced by R.D. Taylor in Jan 1996 + // Revised and further enhanced by R.D. Taylor in Jan 1996 // Re-engineered for EnergyPlus by Richard Liesen PhD in 1998 // Using/Aliasing @@ -3424,7 +3426,7 @@ namespace WaterCoils { WetDryInterfcAirEnthl = 0.0; OutletAirEnthalpy = InletAirEnthalpy - MoistAirSpecificHeat * (TempAirIn - AirWetDryInterfcTemp); } - // total cooling = change in air enmthalpy across coil + // total cooling = change in air enthalpy across coil TotWaterCoilLoad = AirMassFlow * (InletAirEnthalpy - OutletAirEnthalpy); // conservation of energy on water stream gives water outlet // temperature @@ -4748,7 +4750,7 @@ namespace WaterCoils { if (state.dataWaterCoils->WaterCoil(CoilNum).reportCoilFinalSizes) { if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) { std::string coilObjClassName; - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { coilObjClassName = "Coil:Heating:Water"; coilSelectionReportObj->setCoilFinalSizes(state, state.dataWaterCoils->WaterCoil(CoilNum).Name, coilObjClassName, @@ -4757,7 +4759,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); state.dataWaterCoils->WaterCoil(CoilNum).reportCoilFinalSizes = false; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_DetFlatFinCooling) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling) { coilObjClassName = "Coil:Cooling:Water:DetailedGeometry"; coilSelectionReportObj->setCoilFinalSizes(state, state.dataWaterCoils->WaterCoil(CoilNum).Name, coilObjClassName, @@ -4766,7 +4768,7 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); state.dataWaterCoils->WaterCoil(CoilNum).reportCoilFinalSizes = false; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { coilObjClassName = "Coil:Cooling:Water"; coilSelectionReportObj->setCoilFinalSizes(state, state.dataWaterCoils->WaterCoil(CoilNum).Name, coilObjClassName, @@ -5977,9 +5979,10 @@ namespace WaterCoils { return CoilDesAirFlow; } - void CheckActuatorNode(EnergyPlusData &state, int const ActuatorNodeNum, // input actuator node number - int &iNodeType, // Cooling or Heating or 0 - bool &NodeNotFound // true if matching water inlet node not found + void CheckActuatorNode(EnergyPlusData &state, + int const ActuatorNodeNum, // input actuator node number + int &iNodeType, // Cooling or Heating or 0 + bool &NodeNotFound // true if matching water inlet node not found ) { @@ -6016,9 +6019,9 @@ namespace WaterCoils { } void CheckForSensorAndSetPointNode(EnergyPlusData &state, - int const SensorNodeNum, // controller sensor node number - int const ControlledVar, // controlled variable type - bool &NodeNotFound // true if matching air outlet node not found + int const SensorNodeNum, // controller sensor node number + HVACControllers::iCtrl const &ControlledVar, // controlled variable type + bool &NodeNotFound // true if matching air outlet node not found ) { @@ -6032,33 +6035,13 @@ namespace WaterCoils { // This subroutine checks that the sensor node number matches the air outlet node number // of some water coils - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using EMSManager::CheckIfNodeSetPointManagedByEMS; using SetPointManager::iCtrlVarType; using SetPointManager::NodeHasSPMCtrlVarType; - // USE HVACControllers, ONLY: iTemperature, iHumidityRatio, iTemperatureAndHumidityRatio - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("CheckForSensorAndSetpointNode: "); - int const iTemperature(1); - int const iHumidityRatio(2); - int const iTemperatureAndHumidityRatio(3); - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int WhichCoil; // water coil index @@ -6085,17 +6068,17 @@ namespace WaterCoils { // a setpoint is also specified on the water coil outlet node if (!NodeNotFound) { if (WhichCoil > 0) { - if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_DetFlatFinCooling) { + if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterDetailedFlatCooling) { WaterCoilType = "Coil:Cooling:Water:DetailedGeometry"; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_Cooling) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterCooling) { WaterCoilType = "Coil:Cooling:Water"; - } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num == state.dataWaterCoils->WaterCoil_SimpleHeating) { + } else if (state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType == DataPlant::TypeOf_CoilWaterSimpleHeating) { WaterCoilType = "Coil:Heating:Water"; } EMSSetPointErrorFlag = false; { auto const SELECT_CASE_var(ControlledVar); - if (SELECT_CASE_var == iTemperature) { + if (SELECT_CASE_var == HVACControllers::iCtrl::Temperature) { CheckIfNodeSetPointManagedByEMS(state, SensorNodeNum, EMSManager::SPControlType::iTemperatureSetPoint, EMSSetPointErrorFlag); state.dataLoopNodes->NodeSetpointCheck(SensorNodeNum).needsSetpointChecking = false; if (EMSSetPointErrorFlag) { @@ -6107,7 +6090,7 @@ namespace WaterCoils { ShowContinueError(state, " ..Specify the setpoint and the sensor on the coil air outlet node when possible."); } } - } else if (SELECT_CASE_var == iHumidityRatio) { + } else if (SELECT_CASE_var == HVACControllers::iCtrl::HumidityRatio) { CheckIfNodeSetPointManagedByEMS(state, SensorNodeNum, EMSManager::SPControlType::iHumidityRatioMaxSetPoint, EMSSetPointErrorFlag); state.dataLoopNodes->NodeSetpointCheck(SensorNodeNum).needsSetpointChecking = false; if (EMSSetPointErrorFlag) { @@ -6119,7 +6102,7 @@ namespace WaterCoils { ShowContinueError(state, " ..Specify the setpoint and the sensor on the coil air outlet node when possible."); } } - } else if (SELECT_CASE_var == iTemperatureAndHumidityRatio) { + } else if (SELECT_CASE_var == HVACControllers::iCtrl::TemperatureAndHumidityRatio) { CheckIfNodeSetPointManagedByEMS(state, SensorNodeNum, EMSManager::SPControlType::iTemperatureSetPoint, EMSSetPointErrorFlag); state.dataLoopNodes->NodeSetpointCheck(SensorNodeNum).needsSetpointChecking = false; if (EMSSetPointErrorFlag) { @@ -6390,7 +6373,8 @@ namespace WaterCoils { return IndexNum; } - Real64 GetWaterCoilCapacity(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + Real64 GetWaterCoilCapacity(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ) @@ -6500,7 +6484,7 @@ namespace WaterCoils { CoilName, state.dataWaterCoils->WaterCoil(CoilNum).Name)); } - if (CoilTypeNum != state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num) { + if (CoilTypeNum != state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType) { ShowFatalError( state, format("UpdateWaterToAirCoilPlantConnection: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", @@ -6762,6 +6746,4 @@ namespace WaterCoils { // End of Coil Utility subroutines // ***************************************************************************** -} // namespace WaterCoils - } // namespace EnergyPlus diff --git a/src/EnergyPlus/WaterCoils.hh b/src/EnergyPlus/WaterCoils.hh index cdae0f5f7df..4d32d24280a 100644 --- a/src/EnergyPlus/WaterCoils.hh +++ b/src/EnergyPlus/WaterCoils.hh @@ -56,6 +56,7 @@ #include #include #include +#include #include namespace EnergyPlus { @@ -65,20 +66,27 @@ struct EnergyPlusData; namespace WaterCoils { + enum class iCoilModel + { + Unassigned, + HeatingSimple, + CoolingSimple, + CoolingDetailed, + }; + struct WaterCoilEquipConditions { // Members - std::string Name; // Name of the WaterCoil - std::string WaterCoilTypeA; // Type of WaterCoil ie. Heating or Cooling - std::string WaterCoilModelA; // Type of WaterCoil ie. Simple, Detailed, etc. - int WaterCoilType; // Type of WaterCoil ie. Heating or Cooling - int WaterCoilModel; // Type of WaterCoil ie. Simple, Detailed, etc. - int WaterCoilType_Num; + std::string Name; // Name of the WaterCoil + std::string WaterCoilTypeA; // Type of WaterCoil ie. Heating or Cooling + std::string WaterCoilModelA; // Type of WaterCoil ie. Simple, Detailed, etc. + int WaterCoilType; // Type of WaterCoil ie. Heating or Cooling + iCoilModel WaterCoilModel; // Type of WaterCoil ie. Simple, Detailed, etc. std::string Schedule; // WaterCoil Operation Schedule int SchedPtr; // Pointer to the correct schedule bool RequestingAutoSize; // True if this coil has appropriate autosize fields Real64 InletAirMassFlowRate; // MassFlow through the WaterCoil being Simulated [kg/s] - Real64 OutletAirMassFlowRate; // MassFlow throught the WaterCoil being Simulated[kg/s] + Real64 OutletAirMassFlowRate; // MassFlow through the WaterCoil being Simulated[kg/s] Real64 InletAirTemp; // Inlet Air Temperature Operating Condition [C] Real64 OutletAirTemp; // Outlet Air Temperature Operating Condition [C] Real64 InletAirHumRat; // Inlet Air Humidity Ratio Operating Condition @@ -183,12 +191,12 @@ namespace WaterCoils { int CondensateCollectMode; // where does water come from std::string CondensateCollectName; // name of water source e.g. water storage tank int CondensateTankID; // index "pointer" to Storage TAnk array WaterStorage - int CondensateTankSupplyARRID; // index pointe to supply Vdot array in WaterStorage + int CondensateTankSupplyARRID; // index point to supply Vdot array in WaterStorage Real64 CondensateVdot; // rate of water condensation from air stream [m3/s] Real64 CondensateVol; // amount of water condensed from air stream [m3] // end variables for water system interactions // COIL:Water:SimpleHeating Coil Performance Input Method - int CoilPerfInpMeth; // 1 = UA and Design Water Flow Rate; 2 = Nominal Capacity + int CoilPerfInpMeth; // 1 = UA and Design Water Flow Rate; 2 = Nominal Capacity // Operational fault parameters bool FaultyCoilFoulingFlag; // True if the coil has fouling fault @@ -209,7 +217,7 @@ namespace WaterCoils { // Default Constructor WaterCoilEquipConditions() - : WaterCoilType(0), WaterCoilModel(0), WaterCoilType_Num(0), SchedPtr(0), RequestingAutoSize(false), InletAirMassFlowRate(0.0), + : WaterCoilType(0), WaterCoilModel(iCoilModel::Unassigned), SchedPtr(0), RequestingAutoSize(false), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), OutletAirTemp(0.0), InletAirHumRat(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotWaterCoilLoad(0.0), SenWaterCoilLoad(0.0), TotWaterHeatingCoilEnergy(0.0), TotWaterCoolingCoilEnergy(0.0), SenWaterCoolingCoilEnergy(0.0), DesWaterHeatingCoilRate(0.0), TotWaterHeatingCoilRate(0.0), DesWaterCoolingCoilRate(0.0), @@ -227,11 +235,11 @@ namespace WaterCoils { HeatExchType(0), CoolingCoilAnalysisMode(0), UACoilInternalPerUnitArea(0.0), UAWetExtPerUnitArea(0.0), UADryExtPerUnitArea(0.0), SurfAreaWetFractionSaved(0.0), UACoilVariable(0.0), RatioAirSideToWaterSideConvect(1.0), AirSideNominalConvect(0.0), LiquidSideNominalConvect(0.0), Control(0), AirInletNodeNum(0), AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0), - WaterLoopNum(0), WaterLoopSide(0), WaterLoopBranchNum(0), WaterLoopCompNum(0), CondensateCollectMode(1001), - CondensateTankID(0), CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), CoilPerfInpMeth(0), - FaultyCoilFoulingFlag(false), FaultyCoilFoulingIndex(0), FaultyCoilFoulingFactor(0.0), - DesiccantRegenerationCoil(false), DesiccantDehumNum(0), DesignWaterDeltaTemp(0.0), UseDesignWaterDeltaTemp(false), ControllerName(""), - ControllerIndex(0), reportCoilFinalSizes(true), AirLoopDOASFlag(false) + WaterLoopNum(0), WaterLoopSide(0), WaterLoopBranchNum(0), WaterLoopCompNum(0), CondensateCollectMode(1001), CondensateTankID(0), + CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), CoilPerfInpMeth(0), FaultyCoilFoulingFlag(false), + FaultyCoilFoulingIndex(0), FaultyCoilFoulingFactor(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), + DesignWaterDeltaTemp(0.0), UseDesignWaterDeltaTemp(false), ControllerName(""), ControllerIndex(0), reportCoilFinalSizes(true), + AirLoopDOASFlag(false) { } }; @@ -249,7 +257,8 @@ namespace WaterCoils { // Functions - void SimulateWaterCoilComponents(EnergyPlusData &state, std::string const &CompName, + void SimulateWaterCoilComponents(EnergyPlusData &state, + std::string const &CompName, bool const FirstHVACIteration, int &CompIndex, Optional QActual = _, @@ -260,31 +269,35 @@ namespace WaterCoils { void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVACIteration); - void // refactor for coil report + void // refactor for coil report CalcAdjustedCoilUA(EnergyPlusData &state, int const CoilNum); // refactor for coil report void SizeWaterCoil(EnergyPlusData &state, int const CoilNum); - void CalcSimpleHeatingCoil(EnergyPlusData &state, int const CoilNum, // index to heating coil + void CalcSimpleHeatingCoil(EnergyPlusData &state, + int const CoilNum, // index to heating coil int const FanOpMode, // fan operating mode Real64 const PartLoadRatio, // part-load ratio of heating coil int const CalcMode // 1 = design calc; 2 = simulation calculation ); - void CalcDetailFlatFinCoolingCoil(EnergyPlusData &state, int const CoilNum, + void CalcDetailFlatFinCoolingCoil(EnergyPlusData &state, + int const CoilNum, int const CalcMode, int const FanOpMode, // fan operating mode Real64 const PartLoadRatio // part-load ratio of heating coil ); - void CoolingCoil(EnergyPlusData &state, int const CoilNum, + void CoolingCoil(EnergyPlusData &state, + int const CoilNum, bool const FirstHVACIteration, int const CalcMode, int const FanOpMode, // fan operating mode Real64 const PartLoadRatio // part-load ratio of heating coil ); - void CoilCompletelyDry(EnergyPlusData &state, int const CoilNum, + void CoilCompletelyDry(EnergyPlusData &state, + int const CoilNum, Real64 const WaterTempIn, // Entering water temperature Real64 const AirTempIn, // Entering air dry bulb temperature Real64 const CoilUA, // Overall heat transfer coefficient @@ -298,7 +311,8 @@ namespace WaterCoils { // Coil Completely Wet Subroutine for Cooling Coil - void CoilCompletelyWet(EnergyPlusData &state, int const CoilNum, // Number of Coil + void CoilCompletelyWet(EnergyPlusData &state, + int const CoilNum, // Number of Coil Real64 const WaterTempIn, // Water temperature IN to this function (C) Real64 const AirTempIn, // Air dry bulb temperature IN to this function(C) Real64 const AirHumRat, // Air Humidity Ratio IN to this funcation (C) @@ -317,7 +331,8 @@ namespace WaterCoils { // Coil Part Wet Part Dry Subroutine for Cooling Coil - void CoilPartWetPartDry(EnergyPlusData &state, int const CoilNum, // Number of Coil + void CoilPartWetPartDry(EnergyPlusData &state, + int const CoilNum, // Number of Coil bool const FirstHVACIteration, // Saving Old values Real64 const InletWaterTemp, // Entering liquid temperature(C) Real64 const InletAirTemp, // Entering air dry bulb temperature(C) @@ -334,7 +349,8 @@ namespace WaterCoils { // Calculating coil UA for Cooling Coil - Real64 CalcCoilUAbyEffectNTU(EnergyPlusData &state, int const CoilNum, + Real64 CalcCoilUAbyEffectNTU(EnergyPlusData &state, + int const CoilNum, Real64 const CapacityStream1, // Capacity rate of stream1.(W/C) Real64 const EnergyInStreamOne, // Inlet state of stream1.(C) Real64 const CapacityStream2, // Capacity rate of stream2.(W/C) @@ -344,7 +360,8 @@ namespace WaterCoils { // Calculating coil outlet stream conditions and coil UA for Cooling Coil - void CoilOutletStreamCondition(EnergyPlusData &state, int const CoilNum, + void CoilOutletStreamCondition(EnergyPlusData &state, + int const CoilNum, Real64 const CapacityStream1, // Capacity rate of stream1(W/C) Real64 const EnergyInStreamOne, // Inlet state of stream1 (C) Real64 const CapacityStream2, // Capacity rate of stream2 (W/C) @@ -356,7 +373,8 @@ namespace WaterCoils { // Subroutine for caculating outlet condition if coil is wet , for Cooling Coil - void WetCoilOutletCondition(EnergyPlusData &state, int const CoilNum, + void WetCoilOutletCondition(EnergyPlusData &state, + int const CoilNum, Real64 const AirTempIn, // Entering air dry bulb temperature(C) Real64 const EnthAirInlet, // Entering air enthalpy(J/kg) Real64 const EnthAirOutlet, // Leaving air enthalpy(J/kg) @@ -378,11 +396,13 @@ namespace WaterCoils { void CalcPolynomCoef(EnergyPlusData &state, Array2 const &OrderedPair, Array1D &PolynomCoef); - Real64 SimpleHeatingCoilUAResidual(EnergyPlusData &state, Real64 const UA, // UA of coil + Real64 SimpleHeatingCoilUAResidual(EnergyPlusData &state, + Real64 const UA, // UA of coil Array1D const &Par // par(1) = design coil load [W] ); - Real64 SimpleCoolingCoilUAResidual(EnergyPlusData &state, Real64 const UA, // UA of coil + Real64 SimpleCoolingCoilUAResidual(EnergyPlusData &state, + Real64 const UA, // UA of coil Array1D const &Par // par(1) = design coil load [W] ); @@ -399,79 +419,94 @@ namespace WaterCoils { int &icvg // Iteration convergence flag ); - void CheckWaterCoilSchedule(EnergyPlusData &state, std::string const &CompType, // unused1208 + void CheckWaterCoilSchedule(EnergyPlusData &state, + std::string const &CompType, // unused1208 std::string const &CompName, Real64 &Value, int &CompIndex); - Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - int GetCoilInletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + int GetCoilInletNode(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - int GetCoilOutletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + int GetCoilOutletNode(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - int GetCoilWaterInletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + int GetCoilWaterInletNode(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - int GetCoilWaterOutletNode(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + int GetCoilWaterOutletNode(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - void SetCoilDesFlow(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + void SetCoilDesFlow(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type Real64 const CoilDesFlow, // coil volumetric air flow rate [m3/s] bool &ErrorsFound // set to true if problem ); - Real64 GetWaterCoilDesAirFlow(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + Real64 GetWaterCoilDesAirFlow(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - void CheckActuatorNode(EnergyPlusData &state, int const ActuatorNodeNum, // input actuator node number + void CheckActuatorNode(EnergyPlusData &state, + int const ActuatorNodeNum, // input actuator node number int &iNodeType, // Cooling or Heating or 0 bool &NodeNotFound // true if matching water inlet node not found ); - void CheckForSensorAndSetPointNode(EnergyPlusData &state, int const SensorNodeNum, // controller sensor node number - int const ControlledVar, // controlled variable type - bool &NodeNotFound // true if matching air outlet node not found + void CheckForSensorAndSetPointNode(EnergyPlusData &state, + int const SensorNodeNum, // controller sensor node number + HVACControllers::iCtrl const &ControlledVar, // controlled variable type + bool &NodeNotFound // true if matching air outlet node not found ); - Real64 TdbFnHRhPb(EnergyPlusData &state, Real64 const H, // specific enthalpy {J/kg} + Real64 TdbFnHRhPb(EnergyPlusData &state, + Real64 const H, // specific enthalpy {J/kg} Real64 const RH, // relative humidity value (0.0-1.0) Real64 const PB // barometric pressure {Pascals} ); - Real64 EnthalpyResidual(EnergyPlusData &state, Real64 const Tprov, // test value of Tdb [C] + Real64 EnthalpyResidual(EnergyPlusData &state, + Real64 const Tprov, // test value of Tdb [C] Array1D const &Par // Par(1) = desired enthaply H [J/kg] ); Real64 EstimateHEXSurfaceArea(EnergyPlusData &state, int const CoilNum); // coil number, [-] - int GetWaterCoilIndex(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + int GetWaterCoilIndex(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - Real64 GetWaterCoilCapacity(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + Real64 GetWaterCoilCapacity(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); - void UpdateWaterToAirCoilPlantConnection(EnergyPlusData &state, int const CoilTypeNum, + void UpdateWaterToAirCoilPlantConnection(EnergyPlusData &state, + int const CoilTypeNum, std::string const &CoilName, int const EquipFlowCtrl, // Flow control mode for the equipment int const LoopNum, // Plant loop index for where called from @@ -481,21 +516,24 @@ namespace WaterCoils { bool &InitLoopEquip // If not zero, calculate the max load for operating conditions ); - int GetWaterCoilAvailScheduleIndex(EnergyPlusData &state, std::string const &CoilType, // must match coil types in this module + int GetWaterCoilAvailScheduleIndex(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module std::string const &CoilName, // must match coil names for the coil type bool &ErrorsFound // set to true if problem ); // sets data to a coil that is used as a regeneration air heating coil in // desiccant dehumidification system - void SetWaterCoilData(EnergyPlusData &state, int const CoilNum, // index of hot water heating Coil + void SetWaterCoilData(EnergyPlusData &state, + int const CoilNum, // index of hot water heating Coil bool &ErrorsFound, // Set to true if certain errors found Optional_bool DesiccantRegenerationCoil = _, // Flag that this coil is used as regeneration air heating coil Optional_int DesiccantDehumIndex = _ // Index for the desiccant dehum system where this caoil is used ); // estimate heating coil design inlet water temperature for autosizing UA-value - void EstimateCoilInletWaterTemp(EnergyPlusData &state, int const CoilNum, // index to heating coil + void EstimateCoilInletWaterTemp(EnergyPlusData &state, + int const CoilNum, // index to heating coil int const FanOpMode, // fan operating mode Real64 const PartLoadRatio, // part-load ratio of heating coil Real64 const UAMax, // maximum UA-Value @@ -504,92 +542,79 @@ namespace WaterCoils { } // namespace WaterCoils - struct WaterCoilsData : BaseGlobalStruct { - - int const MaxPolynomOrder; - int const MaxOrderedPairs; +struct WaterCoilsData : BaseGlobalStruct +{ - Real64 const PolyConvgTol; - Real64 const MinWaterMassFlowFrac; - Real64 const MinAirMassFlow; + int const MaxPolynomOrder; + int const MaxOrderedPairs; - int const CoilType_Cooling; - int const CoilType_Heating; + Real64 const PolyConvgTol; + Real64 const MinWaterMassFlowFrac; + Real64 const MinAirMassFlow; - int const CoilModel_Simple; - int const CoilModel_Cooling; - int const CoilModel_Detailed; + // Parameters for Heat Exchanger Configuration + int const CounterFlow; + int const CrossFlow; + int const SimpleAnalysis; + int const DetailedAnalysis; - // Parameters for Heat Exchanger Configuration - int const CounterFlow; - int const CrossFlow; - int const SimpleAnalysis; - int const DetailedAnalysis; + // Water Systems + int const CondensateDiscarded; // default mode where water is "lost" + int const CondensateToTank; // collect coil condensate from air and store in water storage tank - // Water Systems - int const CondensateDiscarded; // default mode where water is "lost" - int const CondensateToTank; // collect coil condensate from air and store in water storage tank + // Parameters for COIL:Water:SimpleHeating Coil Performance Input Method + int const UAandFlow; // for Coil Performance Input Method = UA and Design Water Flow Rate + int const NomCap; // for Coil Performance Input Method = Nominal Capacity - // Parameters for COIL:Water:SimpleHeating Coil Performance Input Method - int const UAandFlow; // for Coil Performance Input Method = UA and Design Water Flow Rate - int const NomCap; // for Coil Performance Input Method = Nominal Capacity + // Parameters Subroutine CoolingCoil: design calc or simulation calc. + int const DesignCalc; // ignore on/off check in CoolingCoil + int const SimCalc; // pay attention to on/off check in CoolingCoil - // Parameters Subroutine CoolingCoil: design calc or simulation calc. - int const DesignCalc; // ignore on/off check in CoolingCoil - int const SimCalc; // pay attention to on/off check in CoolingCoil + // DERIVED TYPE DEFINITIONS - // DERIVED TYPE DEFINITIONS + // MODULE VARIABLE DECLARATIONS: + int NumWaterCoils; // The Number of WaterCoils found in the Input + Array1D_bool MySizeFlag; + Array1D_bool MyUAAndFlowCalcFlag; + Array1D_bool MyCoilDesignFlag; + Array1D_bool CoilWarningOnceFlag; + Array1D_int WaterTempCoolCoilErrs; // error counting for detailed coils + Array1D_int PartWetCoolCoilErrs; // error counting for detailed coils + bool GetWaterCoilsInputFlag; // Flag set to make sure you get input once + bool WaterCoilControllerCheckOneTimeFlag; // flg used to check water coil controller + Array1D_bool CheckEquipName; - // MODULE VARIABLE DECLARATIONS: - int NumWaterCoils; // The Number of WaterCoils found in the Input - Array1D_bool MySizeFlag; - Array1D_bool MyUAAndFlowCalcFlag; - Array1D_bool MyCoilDesignFlag; - Array1D_bool CoilWarningOnceFlag; - Array1D_int WaterTempCoolCoilErrs; // error counting for detailed coils - Array1D_int PartWetCoolCoilErrs; // error counting for detailed coils - bool GetWaterCoilsInputFlag; // Flag set to make sure you get input once - bool WaterCoilControllerCheckOneTimeFlag; // flg used to check water coil controller - Array1D_bool CheckEquipName; + bool InitWaterCoilOneTimeFlag; - bool InitWaterCoilOneTimeFlag; + Array1D WaterCoil; + Array1D WaterCoilNumericFields; - // coil types in this module - int const WaterCoil_SimpleHeating; - int const WaterCoil_DetFlatFinCooling; - int const WaterCoil_Cooling; - - Array1D WaterCoil; - Array1D WaterCoilNumericFields; - - void clear_state() override - { - this->NumWaterCoils = 0; - this->InitWaterCoilOneTimeFlag = true; - this->MySizeFlag.deallocate(); - this->MyUAAndFlowCalcFlag.deallocate(); - this->MyCoilDesignFlag.deallocate(); - this->CoilWarningOnceFlag.deallocate(); - this->WaterTempCoolCoilErrs.deallocate(); - this->PartWetCoolCoilErrs.deallocate(); - this->GetWaterCoilsInputFlag = true; - this->CheckEquipName.deallocate(); - this->WaterCoil.deallocate(); - this->WaterCoilNumericFields.deallocate(); - this->WaterCoilControllerCheckOneTimeFlag = true; - } - - // Default Constructor - WaterCoilsData() - : MaxPolynomOrder(4), MaxOrderedPairs(60), PolyConvgTol(1.E-05), MinWaterMassFlowFrac(0.000001), - MinAirMassFlow(0.001), CoilType_Cooling(1), CoilType_Heating(2), CoilModel_Simple(1), CoilModel_Cooling(2), CoilModel_Detailed(3), - CounterFlow(1), CrossFlow(2), SimpleAnalysis(1), DetailedAnalysis(2), CondensateDiscarded(1001), - CondensateToTank(1002), UAandFlow(1), NomCap(2), DesignCalc(1), SimCalc(2), NumWaterCoils(0), - GetWaterCoilsInputFlag(true), WaterCoilControllerCheckOneTimeFlag(true), - InitWaterCoilOneTimeFlag(true), WaterCoil_SimpleHeating(DataPlant::TypeOf_CoilWaterSimpleHeating), WaterCoil_DetFlatFinCooling(DataPlant::TypeOf_CoilWaterDetailedFlatCooling), WaterCoil_Cooling(DataPlant::TypeOf_CoilWaterCooling) - { - } - }; + void clear_state() override + { + this->NumWaterCoils = 0; + this->InitWaterCoilOneTimeFlag = true; + this->MySizeFlag.deallocate(); + this->MyUAAndFlowCalcFlag.deallocate(); + this->MyCoilDesignFlag.deallocate(); + this->CoilWarningOnceFlag.deallocate(); + this->WaterTempCoolCoilErrs.deallocate(); + this->PartWetCoolCoilErrs.deallocate(); + this->GetWaterCoilsInputFlag = true; + this->CheckEquipName.deallocate(); + this->WaterCoil.deallocate(); + this->WaterCoilNumericFields.deallocate(); + this->WaterCoilControllerCheckOneTimeFlag = true; + } + + // Default Constructor + WaterCoilsData() + : MaxPolynomOrder(4), MaxOrderedPairs(60), PolyConvgTol(1.E-05), MinWaterMassFlowFrac(0.000001), MinAirMassFlow(0.001), CounterFlow(1), + CrossFlow(2), SimpleAnalysis(1), DetailedAnalysis(2), CondensateDiscarded(1001), CondensateToTank(1002), UAandFlow(1), NomCap(2), + DesignCalc(1), SimCalc(2), NumWaterCoils(0), GetWaterCoilsInputFlag(true), WaterCoilControllerCheckOneTimeFlag(true), + InitWaterCoilOneTimeFlag(true) + { + } +}; } // namespace EnergyPlus diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index b3c67412e5d..675a608a72c 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1590,7 +1590,7 @@ namespace EnergyPlus::WaterThermalTanks { } else { Fans::GetFanType(state, HPWH.FanName, HPWH.FanType_Num, errFlag, DataIPShortCuts::cCurrentModuleObject, HPWH.Name); Fans::GetFanIndex(state, HPWH.FanName, HPWH.FanNum, errFlag, DataIPShortCuts::cCurrentModuleObject); - Fans::GetFanVolFlow(HPWH.FanNum, FanVolFlow); + Fans::GetFanVolFlow(state, HPWH.FanNum, FanVolFlow); } } // issue #5630, set fan info in coils. @@ -6110,7 +6110,7 @@ namespace EnergyPlus::WaterThermalTanks { if (state.dataWaterThermalTanks->HPWaterHeater(HPNum).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { FanVolFlow = HVACFan::fanObjs[state.dataWaterThermalTanks->HPWaterHeater(HPNum).FanNum]->designAirVolFlowRate; } else if (state.dataWaterThermalTanks->HPWaterHeater(HPNum).FanType_Num == DataHVACGlobals::FanType_SimpleOnOff) { - Fans::GetFanVolFlow(state.dataWaterThermalTanks->HPWaterHeater(HPNum).FanNum, FanVolFlow); + Fans::GetFanVolFlow(state, state.dataWaterThermalTanks->HPWaterHeater(HPNum).FanNum, FanVolFlow); } if (FanVolFlow < @@ -9677,14 +9677,14 @@ namespace EnergyPlus::WaterThermalTanks { if (HPWH.FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { FanInNode = HVACFan::fanObjs[HPWH.FanNum]->inletNodeNum; } else { - FanInNode = Fans::Fan(HPWH.FanNum).InletNodeNum; + FanInNode = state.dataFans->Fan(HPWH.FanNum).InletNodeNum; } state.dataLoopNodes->Node(FanInNode).MassFlowRate = state.dataWaterThermalTanks->mdotAir; state.dataLoopNodes->Node(FanInNode).MassFlowRateMaxAvail = state.dataWaterThermalTanks->mdotAir; state.dataLoopNodes->Node(FanInNode).MassFlowRateMax = state.dataWaterThermalTanks->mdotAir; if (HPWH.FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - Fans::Fan(HPWH.FanNum).MassFlowRateMaxAvail = state.dataWaterThermalTanks->mdotAir; + state.dataFans->Fan(HPWH.FanNum).MassFlowRateMaxAvail = state.dataWaterThermalTanks->mdotAir; } // system fan will use the inlet node max avail. if (HPWH.FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index 7ed86848cbc..fe24909b6e5 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -368,7 +368,7 @@ namespace WeatherManager { if (state.dataGlobal->BeginSimFlag && state.dataWeatherManager->GetEnvironmentFirstCall) { - DataReportingFlags::PrintEndDataDictionary = true; + state.dataReportFlag->PrintEndDataDictionary = true; ReportOutputFileHeaders(state); // Write the output file header information @@ -647,7 +647,7 @@ namespace WeatherManager { state.dataEnvrn->RunPeriodStartDayOfWeek = 0; if ((state.dataGlobal->DoDesDaySim && (state.dataGlobal->KindOfSim != DataGlobalConstants::KindOfSim::RunPeriodWeather)) || ((state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::RunPeriodWeather) && state.dataGlobal->DoWeathSim)) { - if (state.dataWeatherManager->PrntEnvHeaders && DataReportingFlags::DoWeatherInitReporting) { + if (state.dataWeatherManager->PrntEnvHeaders && state.dataReportFlag->DoWeatherInitReporting) { static constexpr auto EnvironFormat( "! ,Environment Name,Environment Type, Start Date, End Date, Start DayOfWeek, Duration {#days}, " "Source:Start DayOfWeek, Use Daylight Saving, Use Holidays, Apply Weekend Holiday Rule, Use Rain Values, Use Snow " @@ -780,7 +780,7 @@ namespace WeatherManager { int TWeekDay = (state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DayOfWeek == 0) ? 1 : state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DayOfWeek; auto const &MonWeekDay = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).MonWeekDay; - if (DataReportingFlags::DoWeatherInitReporting) { + if (state.dataReportFlag->DoWeatherInitReporting) { std::string const AlpUseDST = (state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).UseDST) ? "Yes" : "No"; std::string const AlpUseSpec = (state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).UseHolidays) ? "Yes" : "No"; std::string const ApWkRule = (state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).ApplyWeekendRule) ? "Yes" : "No"; @@ -905,7 +905,7 @@ namespace WeatherManager { if (state.dataWeatherManager->IDFDaylightSaving) { Source = "InputFile"; } - if (state.dataWeatherManager->DaylightSavingIsActive && DataReportingFlags::DoWeatherInitReporting) { + if (state.dataWeatherManager->DaylightSavingIsActive && state.dataReportFlag->DoWeatherInitReporting) { StDate = format(DateFormat, DSTActStMon, DSTActStDay); EnDate = format(DateFormat, DSTActEnMon, DSTActEnDay); print(state.files.eio, EnvDSTYFormat, Source, StDate, EnDate); @@ -914,7 +914,7 @@ namespace WeatherManager { } for (int i = 1; i <= state.dataWeatherManager->NumSpecialDays; ++i) { static constexpr auto EnvSpDyFormat("Environment:Special Days,{},{},{},{},{:3}"); - if (state.dataWeatherManager->SpecialDays(i).WthrFile && state.dataWeatherManager->UseSpecialDays && DataReportingFlags::DoWeatherInitReporting) { + if (state.dataWeatherManager->SpecialDays(i).WthrFile && state.dataWeatherManager->UseSpecialDays && state.dataReportFlag->DoWeatherInitReporting) { StDate = format(DateFormat, state.dataWeatherManager->SpecialDays(i).ActStMon, state.dataWeatherManager->SpecialDays(i).ActStDay); print(state.files.eio, EnvSpDyFormat, @@ -924,7 +924,7 @@ namespace WeatherManager { StDate, state.dataWeatherManager->SpecialDays(i).Duration); } - if (!state.dataWeatherManager->SpecialDays(i).WthrFile && DataReportingFlags::DoWeatherInitReporting) { + if (!state.dataWeatherManager->SpecialDays(i).WthrFile && state.dataReportFlag->DoWeatherInitReporting) { StDate = format(DateFormat, state.dataWeatherManager->SpecialDays(i).ActStMon, state.dataWeatherManager->SpecialDays(i).ActStDay); print(state.files.eio, EnvSpDyFormat, @@ -943,7 +943,7 @@ namespace WeatherManager { StDate = format( DateFormat, state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum).Month, state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum).DayOfMonth); EnDate = StDate; - if (state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum).DayType <= 7 && DataReportingFlags::DoWeatherInitReporting) { + if (state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum).DayType <= 7 && state.dataReportFlag->DoWeatherInitReporting) { print(state.files.eio, EnvNameFormat, @@ -960,7 +960,7 @@ namespace WeatherManager { "N/A", "N/A", SkyTempModelNames.at(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).SkyTempModel)); - } else if (DataReportingFlags::DoWeatherInitReporting) { + } else if (state.dataReportFlag->DoWeatherInitReporting) { print(state.files.eio, EnvNameFormat, state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).Title, @@ -977,9 +977,9 @@ namespace WeatherManager { "N/A", SkyTempModelNames.at(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).SkyTempModel)); } - if (state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum).DSTIndicator == 0 && DataReportingFlags::DoWeatherInitReporting) { + if (state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum).DSTIndicator == 0 && state.dataReportFlag->DoWeatherInitReporting) { print(state.files.eio, EnvDSTNFormat, "SizingPeriod:DesignDay"); - } else if (DataReportingFlags::DoWeatherInitReporting) { + } else if (state.dataReportFlag->DoWeatherInitReporting) { print(state.files.eio, EnvDSTYFormat, "SizingPeriod:DesignDay", StDate, EnDate); } } @@ -3472,7 +3472,7 @@ namespace WeatherManager { state.dataWeatherManager->DesignDay(EnvrnNum).SinSolarDeclinAngle, state.dataWeatherManager->DesignDay(EnvrnNum).CosSolarDeclinAngle); - if (state.dataWeatherManager->PrintDDHeader && DataReportingFlags::DoWeatherInitReporting) { + if (state.dataWeatherManager->PrintDDHeader && state.dataReportFlag->DoWeatherInitReporting) { static constexpr auto EnvDDHdFormat( "! , Max Dry-Bulb Temp {C}, Temp Range {dC}, Temp Range Ind Type, " "Hum Ind Type, Hum Ind Value at Max Temp, Hum Ind Units, Pressure {Pa}, Wind Direction {deg CW from N}, Wind " @@ -3483,7 +3483,7 @@ namespace WeatherManager { print(state.files.eio, "{}\n", DDayMiscHdFormat); state.dataWeatherManager->PrintDDHeader = false; } - if (DataReportingFlags::DoWeatherInitReporting) { + if (state.dataReportFlag->DoWeatherInitReporting) { std::string const AlpUseRain = (state.dataWeatherManager->DesDayInput(EnvrnNum).RainInd == 1) ? "Yes" : "No"; std::string const AlpUseSnow = (state.dataWeatherManager->DesDayInput(EnvrnNum).SnowInd == 1) ? "Yes" : "No"; print(state.files.eio, "Environment:Design Day Data,"); @@ -4635,11 +4635,11 @@ namespace WeatherManager { if (printEnvrnStamp) { - if (DataReportingFlags::PrintEndDataDictionary && state.dataGlobal->DoOutputReporting) { + if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting) { static constexpr auto EndOfHeaderString("End of Data Dictionary"); // End of data dictionary marker print(state.files.eso, "{}\n", EndOfHeaderString); print(state.files.mtr, "{}\n", EndOfHeaderString); - DataReportingFlags::PrintEndDataDictionary = false; + state.dataReportFlag->PrintEndDataDictionary = false; } if (state.dataGlobal->DoOutputReporting) { std::string const &Title(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).Title); diff --git a/src/EnergyPlus/WindowAC.cc b/src/EnergyPlus/WindowAC.cc index c644d2b3b24..66392309310 100644 --- a/src/EnergyPlus/WindowAC.cc +++ b/src/EnergyPlus/WindowAC.cc @@ -409,7 +409,7 @@ namespace WindowAC { "\"."); ErrorsFound = true; } else { - GetFanVolFlow(state.dataWindowAC->WindAC(WindACNum).FanIndex, FanVolFlow); + GetFanVolFlow(state, state.dataWindowAC->WindAC(WindACNum).FanIndex, FanVolFlow); if (FanVolFlow != AutoSize) { if (FanVolFlow < state.dataWindowAC->WindAC(WindACNum).MaxAirVolFlow) { ShowWarningError(state, @@ -1220,7 +1220,7 @@ namespace WindowAC { state.dataWindowAC->WindAC(WindACNum).TotCoolEnergyRate - state.dataWindowAC->WindAC(WindACNum).SensCoolEnergyRate; Real64 locFanElecPower = 0.0; if (state.dataWindowAC->WindAC(WindACNum).FanType_Num != DataHVACGlobals::FanType_SystemModelObject) { - locFanElecPower = Fans::GetFanPower(state.dataWindowAC->WindAC(WindACNum).FanIndex); + locFanElecPower = Fans::GetFanPower(state, state.dataWindowAC->WindAC(WindACNum).FanIndex); } else { locFanElecPower = HVACFan::fanObjs[state.dataWindowAC->WindAC(WindACNum).FanIndex]->fanPower(); } diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc index 3572a344e10..1d8088e3b01 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc @@ -648,11 +648,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -979,11 +979,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -1393,11 +1393,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -1806,11 +1806,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -2487,11 +2487,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -3163,11 +3163,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -4915,11 +4915,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -6667,11 +6667,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -6908,11 +6908,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) state->dataLoopNodes->Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // primary air condition set at outdoor air condition state->dataLoopNodes->Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; @@ -7145,11 +7145,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) state->dataLoopNodes->Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // primary air condition at outside air condition state->dataLoopNodes->Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; @@ -7546,7 +7546,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); auto &thisATMixer(state->dataSingleDuct->SysATMixer(1)); - auto &thisFan(Fan(1)); + auto &thisFan(state->dataFans->Fan(1)); // get input test for terminal air single duct mixer on inlet side of PTAC ASSERT_EQ(1, state->dataSingleDuct->NumATMixers); @@ -7596,7 +7596,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; auto &CWLoopSizingData(state->dataSize->PlantSizData(2)); @@ -7613,7 +7613,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; HWLoop.LoopSide(1).Branch(1).Comp(1).Name = HWCoil.Name; - HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = HWCoil.WaterOutletNodeNum; auto &HWLoopSizingData(state->dataSize->PlantSizData(1)); @@ -8027,7 +8027,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; auto &CWLoopSizingData(state->dataSize->PlantSizData(2)); @@ -8044,7 +8044,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; HWLoop.LoopSide(1).Branch(1).Comp(1).Name = HWCoil.Name; - HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = HWCoil.WaterOutletNodeNum; auto &HWLoopSizingData(state->dataSize->PlantSizData(1)); diff --git a/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc index 5d0d69754b2..e980cc220fa 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc @@ -20225,28 +20225,28 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestNoZoneEqpSupportZoneE // Create Fans Real64 supplyFlowRate = 0.005; Real64 exhaustFlowRate = 0.005; - Fan.allocate(2); - Fan(1).InletNodeNum = 2; - Fan(1).OutletNodeNum = 3; - Fan(1).FanType_Num = FanType_SimpleOnOff; - Fan(1).FanName = "SupplyFan"; - Fan(1).MaxAirFlowRate = supplyFlowRate; + state->dataFans->Fan.allocate(2); + state->dataFans->Fan(1).InletNodeNum = 2; + state->dataFans->Fan(1).OutletNodeNum = 3; + state->dataFans->Fan(1).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(1).FanName = "SupplyFan"; + state->dataFans->Fan(1).MaxAirFlowRate = supplyFlowRate; state->dataLoopNodes->NodeID(2) = "SupplyFanInletNode"; - BranchNodeConnections::RegisterNodeConnection(*state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", Fan(1).FanName, "Inlet", 1, false, errFlag); + BranchNodeConnections::RegisterNodeConnection(*state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(3) = "SupplyFanOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", Fan(1).FanName, "Outlet", 1, false, errFlag); - Fan(2).InletNodeNum = 4; - Fan(2).OutletNodeNum = 5; - Fan(2).FanType_Num = FanType_SimpleOnOff; - Fan(2).FanName = "ExhaustFan"; - Fan(2).MaxAirFlowRate = exhaustFlowRate; + *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Outlet", 1, false, errFlag); + state->dataFans->Fan(2).InletNodeNum = 4; + state->dataFans->Fan(2).OutletNodeNum = 5; + state->dataFans->Fan(2).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(2).FanName = "ExhaustFan"; + state->dataFans->Fan(2).MaxAirFlowRate = exhaustFlowRate; state->dataLoopNodes->NodeID(4) = "SupplyExhaustInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 4, state->dataLoopNodes->NodeID(4), "Fan:OnOff", Fan(2).FanName, "Inlet", 1, false, errFlag); + *state, 4, state->dataLoopNodes->NodeID(4), "Fan:OnOff", state->dataFans->Fan(2).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(5) = "SupplyExhaustOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 5, state->dataLoopNodes->NodeID(5), "Fan:OnOff", Fan(2).FanName, "Outlet", 1, false, errFlag); + *state, 5, state->dataLoopNodes->NodeID(5), "Fan:OnOff", state->dataFans->Fan(2).FanName, "Outlet", 1, false, errFlag); // Create ERV state->dataHVACStandAloneERV->StandAloneERV.allocate(1); @@ -20257,10 +20257,10 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestNoZoneEqpSupportZoneE state->dataHVACStandAloneERV->StandAloneERV(1).DesignSAFanVolFlowRate = 0.005; state->dataHVACStandAloneERV->StandAloneERV(1).DesignEAFanVolFlowRate = 0.005; state->dataHVACStandAloneERV->StandAloneERV(1).DesignHXVolFlowRate = 0.005; - state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = Fan(1).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = state->dataFans->Fan(1).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanIndex = 1; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirInletNode = 2; - state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = Fan(2).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = state->dataFans->Fan(2).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanIndex = 2; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerTypeNum = HX_AIRTOAIR_GENERIC; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerName = "ERV Heat Exchanger"; @@ -20365,29 +20365,29 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestZoneEqpSupportZoneERV // Create Fans Real64 supplyFlowRate = 0.005; Real64 exhaustFlowRate = 0.005; - Fan.allocate(2); - Fan(1).InletNodeNum = 2; - Fan(1).OutletNodeNum = 3; - Fan(1).FanType_Num = FanType_SimpleOnOff; - Fan(1).FanName = "SupplyFan"; - Fan(1).MaxAirFlowRate = supplyFlowRate; + state->dataFans->Fan.allocate(2); + state->dataFans->Fan(1).InletNodeNum = 2; + state->dataFans->Fan(1).OutletNodeNum = 3; + state->dataFans->Fan(1).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(1).FanName = "SupplyFan"; + state->dataFans->Fan(1).MaxAirFlowRate = supplyFlowRate; state->dataLoopNodes->NodeID(2) = "SupplyFanInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", Fan(1).FanName, "Inlet", 1, false, errFlag); + *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(3) = "SupplyFanOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", Fan(1).FanName, "Outlet", 1, false, errFlag); - Fan(2).InletNodeNum = 4; - Fan(2).OutletNodeNum = 5; - Fan(2).FanType_Num = FanType_SimpleOnOff; - Fan(2).FanName = "ExhaustFan"; - Fan(2).MaxAirFlowRate = exhaustFlowRate; + *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Outlet", 1, false, errFlag); + state->dataFans->Fan(2).InletNodeNum = 4; + state->dataFans->Fan(2).OutletNodeNum = 5; + state->dataFans->Fan(2).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(2).FanName = "ExhaustFan"; + state->dataFans->Fan(2).MaxAirFlowRate = exhaustFlowRate; state->dataLoopNodes->NodeID(4) = "SupplyExhaustInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 4, state->dataLoopNodes->NodeID(4), "Fan:OnOff", Fan(2).FanName, "Inlet", 1, false, errFlag); + *state, 4, state->dataLoopNodes->NodeID(4), "Fan:OnOff", state->dataFans->Fan(2).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(5) = "SupplyExhaustOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 5, state->dataLoopNodes->NodeID(5), "Fan:OnOff", Fan(2).FanName, "Outlet", 1, false, errFlag); + *state, 5, state->dataLoopNodes->NodeID(5), "Fan:OnOff", state->dataFans->Fan(2).FanName, "Outlet", 1, false, errFlag); // Create ERV state->dataHVACStandAloneERV->StandAloneERV.allocate(1); @@ -20398,10 +20398,10 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestZoneEqpSupportZoneERV state->dataHVACStandAloneERV->StandAloneERV(1).DesignSAFanVolFlowRate = 0.005; state->dataHVACStandAloneERV->StandAloneERV(1).DesignEAFanVolFlowRate = 0.005; state->dataHVACStandAloneERV->StandAloneERV(1).DesignHXVolFlowRate = 0.005; - state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = Fan(1).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = state->dataFans->Fan(1).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanIndex = 1; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirInletNode = 2; - state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = Fan(2).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = state->dataFans->Fan(2).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanIndex = 2; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerTypeNum = HX_AIRTOAIR_GENERIC; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerName = "ERV Heat Exchanger"; @@ -20497,29 +20497,29 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestZoneEqpSupportUnbalan // Create Fans Real64 supplyFlowRate = 0.005; Real64 exhaustFlowRate = 0.003; - Fan.allocate(2); - Fan(1).InletNodeNum = 2; - Fan(1).OutletNodeNum = 3; - Fan(1).FanType_Num = FanType_SimpleOnOff; - Fan(1).FanName = "SupplyFan"; - Fan(1).MaxAirFlowRate = supplyFlowRate; + state->dataFans->Fan.allocate(2); + state->dataFans->Fan(1).InletNodeNum = 2; + state->dataFans->Fan(1).OutletNodeNum = 3; + state->dataFans->Fan(1).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(1).FanName = "SupplyFan"; + state->dataFans->Fan(1).MaxAirFlowRate = supplyFlowRate; state->dataLoopNodes->NodeID(2) = "SupplyFanInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", Fan(1).FanName, "Inlet", 1, false, errFlag); + *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(3) = "SupplyFanOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", Fan(1).FanName, "Outlet", 1, false, errFlag); - Fan(2).InletNodeNum = 4; - Fan(2).OutletNodeNum = 5; - Fan(2).FanType_Num = FanType_SimpleOnOff; - Fan(2).FanName = "ExhaustFan"; - Fan(2).MaxAirFlowRate = exhaustFlowRate; + *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Outlet", 1, false, errFlag); + state->dataFans->Fan(2).InletNodeNum = 4; + state->dataFans->Fan(2).OutletNodeNum = 5; + state->dataFans->Fan(2).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(2).FanName = "ExhaustFan"; + state->dataFans->Fan(2).MaxAirFlowRate = exhaustFlowRate; state->dataLoopNodes->NodeID(4) = "SupplyExhaustInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 4, state->dataLoopNodes->NodeID(4), "Fan:OnOff", Fan(2).FanName, "Inlet", 1, false, errFlag); + *state, 4, state->dataLoopNodes->NodeID(4), "Fan:OnOff", state->dataFans->Fan(2).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(5) = "SupplyExhaustOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 5, state->dataLoopNodes->NodeID(5), "Fan:OnOff", Fan(2).FanName, "Outlet", 1, false, errFlag); + *state, 5, state->dataLoopNodes->NodeID(5), "Fan:OnOff", state->dataFans->Fan(2).FanName, "Outlet", 1, false, errFlag); // Create ERV state->dataHVACStandAloneERV->StandAloneERV.allocate(1); @@ -20530,10 +20530,10 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestZoneEqpSupportUnbalan state->dataHVACStandAloneERV->StandAloneERV(1).DesignSAFanVolFlowRate = 0.005; state->dataHVACStandAloneERV->StandAloneERV(1).DesignEAFanVolFlowRate = 0.005; state->dataHVACStandAloneERV->StandAloneERV(1).DesignHXVolFlowRate = 0.005; - state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = Fan(1).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = state->dataFans->Fan(1).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanIndex = 1; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirInletNode = 2; - state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = Fan(2).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = state->dataFans->Fan(2).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanIndex = 2; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerTypeNum = HX_AIRTOAIR_GENERIC; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerName = "ERV Heat Exchanger"; @@ -20634,24 +20634,24 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestNoZoneEqpSupportHPWH) AirflowNetwork::AirflowNetworkSimu.AllowSupportZoneEqp = false; // Create Fan - Fan.allocate(1); - Fan(1).InletNodeNum = 2; - Fan(1).OutletNodeNum = 3; - Fan(1).FanType_Num = FanType_SimpleOnOff; - Fan(1).FanName = "SupplyFan"; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).InletNodeNum = 2; + state->dataFans->Fan(1).OutletNodeNum = 3; + state->dataFans->Fan(1).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(1).FanName = "SupplyFan"; state->dataLoopNodes->NodeID(2) = "SupplyFanInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", Fan(1).FanName, "Inlet", 1, false, errFlag); + *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(3) = "SupplyFanOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", Fan(1).FanName, "Outlet", 1, false, errFlag); + *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Outlet", 1, false, errFlag); // Create HPWH state->dataWaterThermalTanks->HPWaterHeater.allocate(1); state->dataWaterThermalTanks->getWaterThermalTankInputFlag = false; state->dataWaterThermalTanks->numHeatPumpWaterHeater = 1; state->dataWaterThermalTanks->HPWaterHeater(1).InletAirConfiguration = WaterThermalTanks::AmbientTempEnum::TempZone; - state->dataWaterThermalTanks->HPWaterHeater(1).FanName = Fan(1).FanName; + state->dataWaterThermalTanks->HPWaterHeater(1).FanName = state->dataFans->Fan(1).FanName; state->dataWaterThermalTanks->HPWaterHeater(1).FanType = "Fan:OnOff"; state->dataWaterThermalTanks->HPWaterHeater(1).FanOutletNode = 3; @@ -20748,24 +20748,24 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestZoneEqpSupportHPWH) AirflowNetwork::AirflowNetworkSimu.AllowSupportZoneEqp = true; // Create Fan - Fan.allocate(1); - Fan(1).InletNodeNum = 2; - Fan(1).OutletNodeNum = 3; - Fan(1).FanType_Num = FanType_SimpleOnOff; - Fan(1).FanName = "SupplyFan"; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).InletNodeNum = 2; + state->dataFans->Fan(1).OutletNodeNum = 3; + state->dataFans->Fan(1).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(1).FanName = "SupplyFan"; state->dataLoopNodes->NodeID(2) = "SupplyFanInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", Fan(1).FanName, "Inlet", 1, false, errFlag); + *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(3) = "SupplyFanOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", Fan(1).FanName, "Outlet", 1, false, errFlag); + *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Outlet", 1, false, errFlag); // Create HPWH state->dataWaterThermalTanks->HPWaterHeater.allocate(1); state->dataWaterThermalTanks->getWaterThermalTankInputFlag = false; state->dataWaterThermalTanks->numHeatPumpWaterHeater = 1; state->dataWaterThermalTanks->HPWaterHeater(1).InletAirConfiguration = WaterThermalTanks::AmbientTempEnum::TempZone; - state->dataWaterThermalTanks->HPWaterHeater(1).FanName = Fan(1).FanName; + state->dataWaterThermalTanks->HPWaterHeater(1).FanName = state->dataFans->Fan(1).FanName; state->dataWaterThermalTanks->HPWaterHeater(1).FanType = "Fan:OnOff"; state->dataWaterThermalTanks->HPWaterHeater(1).FanOutletNode = 3; @@ -20855,24 +20855,24 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestZoneEqpSupportHPWHZon AirflowNetwork::AirflowNetworkSimu.AllowSupportZoneEqp = true; // Create Fan - Fan.allocate(1); - Fan(1).InletNodeNum = 2; - Fan(1).OutletNodeNum = 3; - Fan(1).FanType_Num = FanType_SimpleOnOff; - Fan(1).FanName = "SupplyFan"; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).InletNodeNum = 2; + state->dataFans->Fan(1).OutletNodeNum = 3; + state->dataFans->Fan(1).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(1).FanName = "SupplyFan"; state->dataLoopNodes->NodeID(2) = "SupplyFanInletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", Fan(1).FanName, "Inlet", 1, false, errFlag); + *state, 2, state->dataLoopNodes->NodeID(2), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Inlet", 1, false, errFlag); state->dataLoopNodes->NodeID(3) = "SupplyFanOutletNode"; BranchNodeConnections::RegisterNodeConnection( - *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", Fan(1).FanName, "Outlet", 1, false, errFlag); + *state, 3, state->dataLoopNodes->NodeID(3), "Fan:OnOff", state->dataFans->Fan(1).FanName, "Outlet", 1, false, errFlag); // Create HPWH state->dataWaterThermalTanks->HPWaterHeater.allocate(1); state->dataWaterThermalTanks->getWaterThermalTankInputFlag = false; state->dataWaterThermalTanks->numHeatPumpWaterHeater = 1; state->dataWaterThermalTanks->HPWaterHeater(1).InletAirConfiguration = WaterThermalTanks::AmbientTempEnum::ZoneAndOA; - state->dataWaterThermalTanks->HPWaterHeater(1).FanName = Fan(1).FanName; + state->dataWaterThermalTanks->HPWaterHeater(1).FanName = state->dataFans->Fan(1).FanName; state->dataWaterThermalTanks->HPWaterHeater(1).FanType = "Fan:OnOff"; state->dataWaterThermalTanks->HPWaterHeater(1).FanOutletNode = 3; diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc index dba539bfba1..5a69d107416 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc @@ -374,12 +374,12 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) sizer.autoSizedValue = 0.0; // reset for next test // add fan heat - Fans::Fan.allocate(1); - Fans::Fan(1).DeltaPress = 600.0; - Fans::Fan(1).MotEff = 0.9; - Fans::Fan(1).FanEff = 0.6; - Fans::Fan(1).MotInAirFrac = 0.5; - Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).DeltaPress = 600.0; + state->dataFans->Fan(1).MotEff = 0.9; + state->dataFans->Fan(1).FanEff = 0.6; + state->dataFans->Fan(1).MotInAirFrac = 0.5; + state->dataFans->Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; state->dataAirSystemsData->PrimaryAirSystems(1).SupFanNum = 1; state->dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; state->dataSize->DataFanPlacement = DataSizing::zoneFanPlacement::zoneBlowThru; diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc index 7a4ad51b6d4..0e28f032ebe 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc @@ -178,12 +178,12 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) sizer.autoSizedValue = 0.0; // reset for next test // Test 6 - Zone Equipment, Induction Unit, add fan heat - Fans::Fan.allocate(1); - Fans::Fan(1).DeltaPress = 600.0; - Fans::Fan(1).MotEff = 0.9; - Fans::Fan(1).FanEff = 0.6; - Fans::Fan(1).MotInAirFrac = 0.5; - Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).DeltaPress = 600.0; + state->dataFans->Fan(1).MotEff = 0.9; + state->dataFans->Fan(1).FanEff = 0.6; + state->dataFans->Fan(1).MotInAirFrac = 0.5; + state->dataFans->Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; state->dataSize->DataFanIndex = 1; state->dataSize->DataFanEnumType = DataAirSystems::structArrayLegacyFanModels; state->dataSize->DataFanPlacement = DataSizing::zoneFanPlacement::zoneBlowThru; diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc index 04ec6635ef0..d1be569c794 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc @@ -182,12 +182,12 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) sizer.autoSizedValue = 0.0; // reset for next test // Test 6 - Zone Equipment, Induction Unit, add fan heat - Fans::Fan.allocate(1); - Fans::Fan(1).DeltaPress = 100.0; - Fans::Fan(1).MotEff = 0.9; - Fans::Fan(1).FanEff = 0.6; - Fans::Fan(1).MotInAirFrac = 0.1; - Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).DeltaPress = 100.0; + state->dataFans->Fan(1).MotEff = 0.9; + state->dataFans->Fan(1).FanEff = 0.6; + state->dataFans->Fan(1).MotInAirFrac = 0.1; + state->dataFans->Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; state->dataSize->DataFanIndex = 1; state->dataSize->DataFanEnumType = DataAirSystems::structArrayLegacyFanModels; state->dataSize->DataFanPlacement = DataSizing::zoneFanPlacement::zoneDrawThru; diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc index 6d5372bd8d3..d2abadda4b0 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc @@ -156,12 +156,12 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 4 - Zone Equipment, Single Duct TU, add fan heat - Fans::Fan.allocate(1); - Fans::Fan(1).DeltaPress = 600.0; - Fans::Fan(1).MotEff = 0.9; - Fans::Fan(1).FanEff = 0.6; - Fans::Fan(1).MotInAirFrac = 0.5; - Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).DeltaPress = 600.0; + state->dataFans->Fan(1).MotEff = 0.9; + state->dataFans->Fan(1).FanEff = 0.6; + state->dataFans->Fan(1).MotInAirFrac = 0.5; + state->dataFans->Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; state->dataSize->DataFanIndex = 1; state->dataSize->DataFanEnumType = DataAirSystems::structArrayLegacyFanModels; sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); diff --git a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc index 6970657fc15..fe6af3ee369 100644 --- a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc +++ b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc @@ -256,7 +256,7 @@ namespace EnergyPlus { ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("MULTISPEEDFAN", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -295,13 +295,13 @@ namespace EnergyPlus { state->dataFanCoilUnits->FanCoil(1).MaxAirMassFlow = MaxAirMassFlow; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).OutsideAirNode).MassFlowRateMax = 0.0; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; @@ -358,7 +358,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; @@ -366,7 +366,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataFanCoilUnits->CoolingLoad = false; @@ -568,7 +568,7 @@ namespace EnergyPlus { ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("MULTISPEEDFAN", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -608,13 +608,13 @@ namespace EnergyPlus { state->dataFanCoilUnits->FanCoil(1).MaxAirMassFlow = MaxAirMassFlow; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).OutsideAirNode).MassFlowRateMax = 0.0; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; @@ -671,7 +671,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; @@ -679,7 +679,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataFanCoilUnits->HeatingLoad = false; @@ -878,7 +878,7 @@ namespace EnergyPlus { ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -924,13 +924,13 @@ namespace EnergyPlus { state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).CoolCoilFluidInletNode).MassFlowRateMaxAvail = 0.14; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).HeatCoilFluidInletNode).MassFlowRateMaxAvail = 0.14; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; @@ -990,7 +990,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).FlowLock = DataPlant::iFlowLock::Unlocked; @@ -1000,7 +1000,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).FlowLock = DataPlant::iFlowLock::Unlocked; @@ -1257,7 +1257,7 @@ namespace EnergyPlus { ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -1301,13 +1301,13 @@ namespace EnergyPlus { state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).CoolCoilFluidInletNode).MassFlowRateMax = 0.14; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).CoolCoilFluidInletNode).MassFlowRateMaxAvail = 0.14; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(1).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(1).UACoilExternal = 611.0; @@ -1354,7 +1354,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).FlowLock = DataPlant::iFlowLock::Unlocked; @@ -1576,7 +1576,7 @@ namespace EnergyPlus { ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -1623,13 +1623,13 @@ namespace EnergyPlus { state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).CoolCoilFluidInletNode).MassFlowRateMaxAvail = 0.14; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).HeatCoilFluidInletNode).MassFlowRateMaxAvail = 0.14; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; @@ -1689,7 +1689,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).FlowLock = DataPlant::iFlowLock::Unlocked; @@ -1699,7 +1699,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).FlowLock = DataPlant::iFlowLock::Unlocked; @@ -1933,7 +1933,7 @@ namespace EnergyPlus { ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("ASHRAE90VARIABLEFAN", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -1973,13 +1973,13 @@ namespace EnergyPlus { state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).OutsideAirNode).MassFlowRateMax = 0.0; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).NodeNumOfControlledZone).Temp = 22.0; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; @@ -2036,7 +2036,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; @@ -2045,7 +2045,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; @@ -2298,7 +2298,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; @@ -2307,7 +2307,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; @@ -2642,7 +2642,7 @@ namespace EnergyPlus { ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("CYCLINGFAN", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -2681,13 +2681,13 @@ namespace EnergyPlus { state->dataFanCoilUnits->FanCoil(1).MaxAirMassFlow = MaxAirMassFlow; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).OutsideAirNode).MassFlowRateMax = 0.0; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; @@ -2744,7 +2744,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; @@ -2753,7 +2753,7 @@ namespace EnergyPlus { state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; @@ -3155,7 +3155,7 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; // hot water plant loop @@ -3165,7 +3165,7 @@ namespace EnergyPlus { HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; HWLoop.LoopSide(1).Branch(1).Comp(1).Name = HWCoil.Name; - HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = HWCoil.WaterOutletNodeNum; @@ -3536,7 +3536,7 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; @@ -3903,7 +3903,7 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; @@ -4270,7 +4270,7 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; @@ -4582,7 +4582,7 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; diff --git a/tst/EnergyPlus/unit/Fans.unit.cc b/tst/EnergyPlus/unit/Fans.unit.cc index 5ca524fef42..4ec716917ae 100644 --- a/tst/EnergyPlus/unit/Fans.unit.cc +++ b/tst/EnergyPlus/unit/Fans.unit.cc @@ -69,21 +69,21 @@ TEST_F(EnergyPlusFixture, Fans_FanSizing) state->dataSize->CurSysNum = 0; state->dataSize->CurOASysNum = 0; state->dataFans->NumFans = 1; - Fan.allocate(state->dataFans->NumFans); - FanNumericFields.allocate(state->dataFans->NumFans); - FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(3); + state->dataFans->Fan.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(3); int FanNum = 1; - Fan(FanNum).FanName = "Test Fan"; - Fan(FanNum).FanType = "Fan:OnOff"; - Fan(FanNum).FanType_Num = FanType_SimpleOnOff; - Fan(FanNum).MaxAirFlowRate = AutoSize; - Fan(FanNum).DeltaPress = 500.0; - Fan(FanNum).FanEff = 0.4; // Prevent divide by zero computing RatedPower + state->dataFans->Fan(FanNum).FanName = "Test Fan"; + state->dataFans->Fan(FanNum).FanType = "Fan:OnOff"; + state->dataFans->Fan(FanNum).FanType_Num = FanType_SimpleOnOff; + state->dataFans->Fan(FanNum).MaxAirFlowRate = AutoSize; + state->dataFans->Fan(FanNum).DeltaPress = 500.0; + state->dataFans->Fan(FanNum).FanEff = 0.4; // Prevent divide by zero computing RatedPower state->dataEnvrn->StdRhoAir = 1.2; - FanNumericFields(FanNum).FieldNames(3) = "Maximum Flow Rate"; + state->dataFans->FanNumericFields(FanNum).FieldNames(3) = "Maximum Flow Rate"; state->dataSize->CurZoneEqNum = 0; state->dataSize->CurSysNum = 0; @@ -92,25 +92,25 @@ TEST_F(EnergyPlusFixture, Fans_FanSizing) // DataNonZoneNonAirloopValue must be set when CurZoneEqNum and CurSysNum = 0 state->dataSize->DataNonZoneNonAirloopValue = 1.00635; SizeFan(*state, FanNum); - EXPECT_DOUBLE_EQ(1.00635, Fan(FanNum).MaxAirFlowRate); + EXPECT_DOUBLE_EQ(1.00635, state->dataFans->Fan(FanNum).MaxAirFlowRate); state->dataSize->DataNonZoneNonAirloopValue = 0.0; - EXPECT_NEAR(1.0371, Fan(FanNum).DesignPointFEI, 0.0001); + EXPECT_NEAR(1.0371, state->dataFans->Fan(FanNum).DesignPointFEI, 0.0001); } TEST_F(EnergyPlusFixture, Fans_ConstantVolume_EMSPressureRiseResetTest) { state->dataFans->NumFans = 1; - Fans::Fan.allocate(state->dataFans->NumFans); - Fans::FanNumericFields.allocate(state->dataFans->NumFans); - Fans::FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); + state->dataFans->Fan.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); // set standard air density state->dataEnvrn->StdRhoAir = 1.0; // set fan model inputs int FanNum(1); - FanNumericFields(FanNum).FieldNames(1) = "Fan Total Efficiency"; - FanNumericFields(FanNum).FieldNames(2) = "Pressure Rise"; - auto &thisFan(Fans::Fan(FanNum)); + state->dataFans->FanNumericFields(FanNum).FieldNames(1) = "Fan Total Efficiency"; + state->dataFans->FanNumericFields(FanNum).FieldNames(2) = "Pressure Rise"; + auto &thisFan(state->dataFans->Fan(FanNum)); thisFan.FanName = "Test Fan"; thisFan.FanType = "Fan:ConstantVolume"; thisFan.FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; @@ -148,16 +148,16 @@ TEST_F(EnergyPlusFixture, Fans_OnOff_EMSPressureRiseResetTest) { state->dataFans->NumFans = 1; - Fans::Fan.allocate(state->dataFans->NumFans); - Fans::FanNumericFields.allocate(state->dataFans->NumFans); - Fans::FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); + state->dataFans->Fan.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); // set standard air density state->dataEnvrn->StdRhoAir = 1.0; // set fan model inputs int FanNum(1); - FanNumericFields(FanNum).FieldNames(1) = "Fan Total Efficiency"; - FanNumericFields(FanNum).FieldNames(2) = "Pressure Rise"; - auto &thisFan(Fans::Fan(FanNum)); + state->dataFans->FanNumericFields(FanNum).FieldNames(1) = "Fan Total Efficiency"; + state->dataFans->FanNumericFields(FanNum).FieldNames(2) = "Pressure Rise"; + auto &thisFan(state->dataFans->Fan(FanNum)); thisFan.FanName = "Test Fan"; thisFan.FanType = "Fan:OnOff"; thisFan.FanType_Num = DataHVACGlobals::FanType_SimpleOnOff; @@ -195,16 +195,16 @@ TEST_F(EnergyPlusFixture, Fans_VariableVolume_EMSPressureRiseResetTest) { state->dataFans->NumFans = 1; - Fans::Fan.allocate(state->dataFans->NumFans); - Fans::FanNumericFields.allocate(state->dataFans->NumFans); - Fans::FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); + state->dataFans->Fan.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields.allocate(state->dataFans->NumFans); + state->dataFans->FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); // set standard air density state->dataEnvrn->StdRhoAir = 1.0; // set fan model inputs int FanNum(1); - FanNumericFields(FanNum).FieldNames(1) = "Fan Total Efficiency"; - FanNumericFields(FanNum).FieldNames(2) = "Pressure Rise"; - auto &thisFan(Fans::Fan(FanNum)); + state->dataFans->FanNumericFields(FanNum).FieldNames(1) = "Fan Total Efficiency"; + state->dataFans->FanNumericFields(FanNum).FieldNames(2) = "Pressure Rise"; + auto &thisFan(state->dataFans->Fan(FanNum)); thisFan.FanName = "Test Fan"; thisFan.FanType = "Fan:VariableVolume"; thisFan.FanType_Num = DataHVACGlobals::FanType_SimpleVAV; diff --git a/tst/EnergyPlus/unit/FaultsManager.unit.cc b/tst/EnergyPlus/unit/FaultsManager.unit.cc index 3874f07b991..10e03116a5f 100644 --- a/tst/EnergyPlus/unit/FaultsManager.unit.cc +++ b/tst/EnergyPlus/unit/FaultsManager.unit.cc @@ -95,7 +95,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); state->dataFans->NumFans = 2; - Fan.allocate(state->dataFans->NumFans); + state->dataFans->Fan.allocate(state->dataFans->NumFans); state->dataFaultsMgr->FaultsFouledAirFilters.allocate(state->dataFans->NumFans); // Inputs: fan curve @@ -114,18 +114,18 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // Inputs: FanNum = 1; - Fan(FanNum).FanName = "Fan_1"; - Fan(FanNum).FanType = "Fan:VariableVolume"; - Fan(FanNum).MaxAirFlowRate = 18.194; - Fan(FanNum).DeltaPress = 1017.59; + state->dataFans->Fan(FanNum).FanName = "Fan_1"; + state->dataFans->Fan(FanNum).FanType = "Fan:VariableVolume"; + state->dataFans->Fan(FanNum).MaxAirFlowRate = 18.194; + state->dataFans->Fan(FanNum).DeltaPress = 1017.59; state->dataFaultsMgr->FaultsFouledAirFilters(FanNum).FaultyAirFilterFanName = "Fan_1"; state->dataFaultsMgr->FaultsFouledAirFilters(FanNum).FaultyAirFilterFanCurvePtr = CurveNum; FanNum = 2; - Fan(FanNum).FanName = "Fan_2"; - Fan(FanNum).FanType = "Fan:VariableVolume"; - Fan(FanNum).MaxAirFlowRate = 18.194; - Fan(FanNum).DeltaPress = 1017.59 * 1.2; + state->dataFans->Fan(FanNum).FanName = "Fan_2"; + state->dataFans->Fan(FanNum).FanType = "Fan:VariableVolume"; + state->dataFans->Fan(FanNum).MaxAirFlowRate = 18.194; + state->dataFans->Fan(FanNum).DeltaPress = 1017.59 * 1.2; state->dataFaultsMgr->FaultsFouledAirFilters(FanNum).FaultyAirFilterFanName = "Fan_2"; state->dataFaultsMgr->FaultsFouledAirFilters(FanNum).FaultyAirFilterFanCurvePtr = CurveNum; @@ -141,7 +141,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // Clean up state->dataCurveManager->PerfCurve.deallocate(); - Fan.deallocate(); + state->dataFans->Fan.deallocate(); } TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFilterFanCurve_AutosizedFan) @@ -231,7 +231,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // We expect this one to throw, I changed the fan design pressure to 400, and made it non autosized. int FanNum = 1; EXPECT_NO_THROW(Fans::SizeFan(*state, FanNum)); - EXPECT_DOUBLE_EQ(0.114, Fans::Fan(FanNum).MaxAirFlowRate); + EXPECT_DOUBLE_EQ(0.114, state->dataFans->Fan(FanNum).MaxAirFlowRate); } TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFilterFanCurve_NonAutosizedFan) @@ -320,7 +320,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // We expect this one to throw, I changed the fan design pressure to 400, and made it non autosized. int FanNum = 1; EXPECT_ANY_THROW(Fans::SizeFan(*state, FanNum)); - EXPECT_DOUBLE_EQ(0.114, Fans::Fan(FanNum).MaxAirFlowRate); + EXPECT_DOUBLE_EQ(0.114, state->dataFans->Fan(FanNum).MaxAirFlowRate); std::string const error_string = delimited_string({ " ** Severe ** FaultModel:Fouling:AirFilter = \"FAN CV FOULING AIR FILTER\"", " ** ~~~ ** Invalid Fan Curve Name = \"FOULED FAN CURVE\" does not cover ", @@ -350,7 +350,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CalFaultyFanAirFl state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); state->dataFans->NumFans = 1; - Fan.allocate(state->dataFans->NumFans); + state->dataFans->Fan.allocate(state->dataFans->NumFans); // Inputs: fan curve CurveNum = 1; @@ -368,20 +368,20 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CalFaultyFanAirFl // Inputs: fans FanNum = 1; - Fan(FanNum).FanName = "Fan_1"; - Fan(FanNum).FanType = "Fan:VariableVolume"; - Fan(FanNum).MaxAirFlowRate = 18.194; - Fan(FanNum).DeltaPress = 1017.59; + state->dataFans->Fan(FanNum).FanName = "Fan_1"; + state->dataFans->Fan(FanNum).FanType = "Fan:VariableVolume"; + state->dataFans->Fan(FanNum).MaxAirFlowRate = 18.194; + state->dataFans->Fan(FanNum).DeltaPress = 1017.59; // Run and Check FanDesignFlowRateDec = CalFaultyFanAirFlowReduction(*state, - Fan(FanNum).FanName, Fan(FanNum).MaxAirFlowRate, Fan(FanNum).DeltaPress, FanFaultyDeltaPressInc * Fan(FanNum).DeltaPress, CurveNum); + state->dataFans->Fan(FanNum).FanName, state->dataFans->Fan(FanNum).MaxAirFlowRate, state->dataFans->Fan(FanNum).DeltaPress, FanFaultyDeltaPressInc * state->dataFans->Fan(FanNum).DeltaPress, CurveNum); EXPECT_NEAR(3.845, FanDesignFlowRateDec, 0.005); // Clean up state->dataCurveManager->PerfCurve.deallocate(); - Fan.deallocate(); + state->dataFans->Fan.deallocate(); } TEST_F(EnergyPlusFixture, FaultsManager_TemperatureSensorOffset_CoilSAT) @@ -467,8 +467,8 @@ TEST_F(EnergyPlusFixture, FaultsManager_TemperatureSensorOffset_CoilSAT) // Check EXPECT_EQ(2.0, state->dataFaultsMgr->FaultsCoilSATSensor(1).Offset); EXPECT_EQ("COIL:COOLING:WATER", state->dataFaultsMgr->FaultsCoilSATSensor(1).CoilType); - EXPECT_TRUE(HVACControllers::ControllerProps(1).FaultyCoilSATFlag); - EXPECT_EQ(1, HVACControllers::ControllerProps(1).FaultyCoilSATIndex); + EXPECT_TRUE(state->dataHVACControllers->ControllerProps(1).FaultyCoilSATFlag); + EXPECT_EQ(1, state->dataHVACControllers->ControllerProps(1).FaultyCoilSATIndex); } TEST_F(EnergyPlusFixture, FaultsManager_FaultChillerSWTSensor_CalFaultChillerSWT) @@ -908,10 +908,10 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) int FaultIndex = 1; EXPECT_EQ("AHU HW HEATING COIL", state->dataWaterCoils->WaterCoil(CoilNum).Name); EXPECT_NEAR(6.64, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.0001); - EXPECT_EQ(state->dataWaterCoils->WaterCoil_SimpleHeating, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); + EXPECT_EQ(DataPlant::TypeOf_CoilWaterSimpleHeating, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType); EXPECT_EQ(CoilNum, state->dataFaultsMgr->FouledCoils(FaultIndex).FouledCoilNum); - EXPECT_EQ(state->dataWaterCoils->WaterCoil_SimpleHeating, state->dataFaultsMgr->FouledCoils(FaultIndex).FouledCoiledType); + EXPECT_EQ(DataPlant::TypeOf_CoilWaterSimpleHeating, state->dataFaultsMgr->FouledCoils(FaultIndex).FouledCoiledType); EXPECT_TRUE(state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); EXPECT_EQ(FaultIndex, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); @@ -936,10 +936,10 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) int CoilNum = 2; int FaultIndex = 2; EXPECT_EQ("AHU CHW COOLING COIL", state->dataWaterCoils->WaterCoil(CoilNum).Name); - EXPECT_EQ(state->dataWaterCoils->WaterCoil_Cooling, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); + EXPECT_EQ(DataPlant::TypeOf_CoilWaterCooling, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType); EXPECT_EQ(CoilNum, state->dataFaultsMgr->FouledCoils(FaultIndex).FouledCoilNum); - EXPECT_EQ(state->dataWaterCoils->WaterCoil_Cooling, state->dataFaultsMgr->FouledCoils(FaultIndex).FouledCoiledType); + EXPECT_EQ(DataPlant::TypeOf_CoilWaterCooling, state->dataFaultsMgr->FouledCoils(FaultIndex).FouledCoiledType); EXPECT_TRUE(state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); EXPECT_EQ(FaultIndex, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); @@ -969,7 +969,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) { int CoilNum = 3; EXPECT_EQ("AHU CHW COIL WITH NO FAULT", state->dataWaterCoils->WaterCoil(CoilNum).Name); - EXPECT_EQ(state->dataWaterCoils->WaterCoil_Cooling, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); + EXPECT_EQ(DataPlant::TypeOf_CoilWaterCooling, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType); EXPECT_FALSE(state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); EXPECT_EQ(0, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); diff --git a/tst/EnergyPlus/unit/HVACControllers.unit.cc b/tst/EnergyPlus/unit/HVACControllers.unit.cc index 0c834423cc6..de48609866a 100644 --- a/tst/EnergyPlus/unit/HVACControllers.unit.cc +++ b/tst/EnergyPlus/unit/HVACControllers.unit.cc @@ -139,13 +139,13 @@ TEST_F(EnergyPlusFixture, HVACControllers_ResetHumidityRatioCtrlVarType) // check control variable type in AllSetPtMgr is reset to "MaximumHumidityRatio" ASSERT_EQ(iCtrlVarType::MaxHumRat, state->dataSetPointManager->AllSetPtMgr(1).CtrlTypeMode); - // ControllerProps always expects the control variable type to be "HumididtyRatio" - ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, ControllerProps(1).SensedNode); - ASSERT_EQ(iCtrlVarType::HumRat, ControllerProps(1).HumRatCntrlType); + // ControllerProps always expects the control variable type to be "HumidityRatio" + state->dataHVACControllers->ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, state->dataHVACControllers->ControllerProps(1).SensedNode); + ASSERT_EQ(iCtrlVarType::HumRat, state->dataHVACControllers->ControllerProps(1).HumRatCntrlType); - ASSERT_EQ(ControllerProps.size(), 1u); - EXPECT_EQ(ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); - EXPECT_EQ(ControllerProps(1).Offset, DataSizing::AutoSize); + ASSERT_EQ(state->dataHVACControllers->ControllerProps.size(), 1u); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).Offset, DataSizing::AutoSize); } TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) @@ -212,12 +212,12 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) ASSERT_EQ(iCtrlVarType::MaxHumRat, state->dataSetPointManager->AllSetPtMgr(1).CtrlTypeMode); // ControllerProps expects the control variable type to be "MaximumHumididtyRatio" - ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, ControllerProps(1).SensedNode); - ASSERT_EQ(iCtrlVarType::MaxHumRat, ControllerProps(1).HumRatCntrlType); + state->dataHVACControllers->ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, state->dataHVACControllers->ControllerProps(1).SensedNode); + ASSERT_EQ(iCtrlVarType::MaxHumRat, state->dataHVACControllers->ControllerProps(1).HumRatCntrlType); // test index for air loop controllers // before controllers are simulated, AirLoopControllerIndex = 0 - ASSERT_EQ(0, ControllerProps(1).AirLoopControllerIndex); + ASSERT_EQ(0, state->dataHVACControllers->ControllerProps(1).AirLoopControllerIndex); OutputReportPredefined::SetPredefinedTables(*state); state->dataSimAirServingZones->GetAirLoopInputFlag = false; @@ -254,7 +254,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum(1) = 1; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "CHILLED WATER COIL"; - state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = 5; // state->dataWaterCoils->WaterCoil_Cooling + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = 5; // DataPlant::TypeOf_CoilWaterCooling state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop(1).LoopSide.allocate(2); @@ -272,7 +272,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) // after controllers are simulated, AirLoopControllerIndex = index to this controller on this air loop (e.g., n of num contollers on air loop) ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).NumControllers); ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1)); - ASSERT_EQ(1, ControllerProps(1).AirLoopControllerIndex); + ASSERT_EQ(1, state->dataHVACControllers->ControllerProps(1).AirLoopControllerIndex); } TEST_F(EnergyPlusFixture, HVACControllers_SchSetPointMgrsOrderTest) @@ -360,8 +360,8 @@ TEST_F(EnergyPlusFixture, HVACControllers_SchSetPointMgrsOrderTest) GetControllerInput(*state); // check ControllerProps control variable is set to "MaximumHumidityRatio" - ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, ControllerProps(1).SensedNode); - ASSERT_EQ(iCtrlVarType::MaxHumRat, ControllerProps(1).HumRatCntrlType); // MaximumHumidityRatio + state->dataHVACControllers->ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, state->dataHVACControllers->ControllerProps(1).SensedNode); + ASSERT_EQ(iCtrlVarType::MaxHumRat, state->dataHVACControllers->ControllerProps(1).HumRatCntrlType); // MaximumHumidityRatio } TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnPrimaryLoopCheckTest) @@ -408,7 +408,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnPrimaryLoopCheckTest) GetControllerInput(*state); ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).Name, "CHILLED WATER COIL"); - ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_Cooling); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType, DataPlant::TypeOf_CoilWaterCooling); OutputReportPredefined::SetPredefinedTables(*state); state->dataSimAirServingZones->GetAirLoopInputFlag = false; @@ -453,7 +453,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnPrimaryLoopCheckTest) EXPECT_TRUE(WaterCoilOnAirLoop); // now test a different water coil type - CoilTypeNum = state->dataWaterCoils->WaterCoil_DetFlatFinCooling; + CoilTypeNum = DataPlant::TypeOf_CoilWaterDetailedFlatCooling; WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); } @@ -501,7 +501,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnOutsideAirSystemCheckTest) GetControllerInput(*state); ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).Name, "OA PREHEAT HW COIL"); - ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_SimpleHeating); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType, DataPlant::TypeOf_CoilWaterSimpleHeating); OutputReportPredefined::SetPredefinedTables(*state); state->dataSimAirServingZones->GetAirLoopInputFlag = false; @@ -633,7 +633,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CoilSystemCoolingWaterOnOutsideAirSyst GetControllerInput(*state); ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).Name, "DETAILED PRE COOLING COIL"); - ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_DetFlatFinCooling); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType, DataPlant::TypeOf_CoilWaterDetailedFlatCooling); OutputReportPredefined::SetPredefinedTables(*state); state->dataSimAirServingZones->GetAirLoopInputFlag = false; @@ -691,12 +691,12 @@ TEST_F(EnergyPlusFixture, HVACControllers_CoilSystemCoolingWaterOnOutsideAirSyst } TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) { - HVACControllers::ControllerProps.allocate(1); - HVACControllers::RootFinders.allocate(1); + state->dataHVACControllers->ControllerProps.allocate(1); + state->dataHVACControllers->RootFinders.allocate(1); bool isConverged = true; int const controlNum = 1; - auto &thisController(ControllerProps(1)); - thisController.ControlVar = HVACControllers::iTemperatureAndHumidityRatio; + auto &thisController(state->dataHVACControllers->ControllerProps(1)); + thisController.ControlVar = HVACControllers::iCtrl::TemperatureAndHumidityRatio; thisController.Offset = 0.0001; int sensedNode = 1; thisController.SensedNode = sensedNode; @@ -775,7 +775,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) thisController.IsSetPointDefinedFlag = true; thisController.NumCalcCalls = 5; state->dataLoopNodes->Node(sensedNode).HumRat = state->dataLoopNodes->Node(sensedNode).HumRatMax - 0.001; - thisController.ControlVar = HVACControllers::iTemperature; + thisController.ControlVar = HVACControllers::iCtrl::Temperature; HVACControllers::CheckTempAndHumRatCtrl(*state, controlNum, isConverged); EXPECT_TRUE(isConverged); @@ -843,10 +843,10 @@ TEST_F(EnergyPlusFixture, HVACControllers_BlankAutosized) GetControllerInput(*state); - ASSERT_EQ(ControllerProps.size(), 1u); - EXPECT_EQ(ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); - EXPECT_EQ(ControllerProps(1).Offset, DataSizing::AutoSize); - EXPECT_EQ(ControllerProps(1).MinVolFlowActuated, 0.0); + ASSERT_EQ(state->dataHVACControllers->ControllerProps.size(), 1u); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).Offset, DataSizing::AutoSize); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).MinVolFlowActuated, 0.0); } TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) @@ -918,14 +918,14 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) GetControllerInput(*state); - ASSERT_EQ(ControllerProps.size(), 1u); - EXPECT_EQ(ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); - EXPECT_EQ(ControllerProps(1).Offset, DataSizing::AutoSize); - EXPECT_EQ(ControllerProps(1).MinVolFlowActuated, 0.0); + ASSERT_EQ(state->dataHVACControllers->ControllerProps.size(), 1u); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).Offset, DataSizing::AutoSize); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).MinVolFlowActuated, 0.0); // test index for air loop controllers // before controllers are simulated, AirLoopControllerIndex = 0 - ASSERT_EQ(0, ControllerProps(1).AirLoopControllerIndex); + ASSERT_EQ(0, state->dataHVACControllers->ControllerProps(1).AirLoopControllerIndex); OutputReportPredefined::SetPredefinedTables(*state); state->dataSimAirServingZones->GetAirLoopInputFlag = false; @@ -1006,18 +1006,18 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) // after controllers are simulated, AirLoopControllerIndex = index to this controller on this air loop (e.g., n of num contollers on air loop) ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).NumControllers); ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1)); - ASSERT_EQ(1, ControllerProps(1).AirLoopControllerIndex); + ASSERT_EQ(1, state->dataHVACControllers->ControllerProps(1).AirLoopControllerIndex); // This should have been autosized to zero - EXPECT_EQ(ControllerProps(1).MaxVolFlowActuated, 0.0); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).MaxVolFlowActuated, 0.0); // This should have been reset to zero - EXPECT_EQ(ControllerProps(1).MinVolFlowActuated, 0.0); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).MinVolFlowActuated, 0.0); Real64 expectedOffset = (0.001 / (2100.0 * DataHVACGlobals::SmallWaterVolFlow)) * (DataConvergParams::HVACEnergyToler / 10.0); // do not let the controller tolerance exceed 1/10 of the loop temperature tolerance. expectedOffset = min(0.1 * DataConvergParams::HVACTemperatureToler, expectedOffset); EXPECT_EQ(expectedOffset, 0.1 * DataConvergParams::HVACTemperatureToler); - EXPECT_EQ(ControllerProps(1).Offset, expectedOffset); + EXPECT_EQ(state->dataHVACControllers->ControllerProps(1).Offset, expectedOffset); std::string const error_string = delimited_string({ " ** Warning ** InitController: Controller:WaterCoil=\"CW COIL CONTROLLER\", Maximum Actuated Flow is zero.", diff --git a/tst/EnergyPlus/unit/HVACManager.unit.cc b/tst/EnergyPlus/unit/HVACManager.unit.cc index 0423526687a..22cdd149637 100644 --- a/tst/EnergyPlus/unit/HVACManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACManager.unit.cc @@ -245,13 +245,13 @@ TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) state->dataZoneEquip->ZoneEquipConfig(1).ExhaustNode.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ExhaustNode(1) = 1; - Fans::Fan.allocate(1); + state->dataFans->Fan.allocate(1); state->dataFans->NumFans = 1; - Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_ZoneExhaust; - Fans::Fan(1).OutletAirMassFlowRate = 1.0; - Fans::Fan(1).OutletAirTemp = 22.0; - Fans::Fan(1).OutletAirEnthalpy = Psychrometrics::PsyHFnTdbW(Fans::Fan(1).OutletAirTemp, 0.0005); - Fans::Fan(1).InletNodeNum = 1; + state->dataFans->Fan(1).FanType_Num = DataHVACGlobals::FanType_ZoneExhaust; + state->dataFans->Fan(1).OutletAirMassFlowRate = 1.0; + state->dataFans->Fan(1).OutletAirTemp = 22.0; + state->dataFans->Fan(1).OutletAirEnthalpy = Psychrometrics::PsyHFnTdbW(state->dataFans->Fan(1).OutletAirTemp, 0.0005); + state->dataFans->Fan(1).InletNodeNum = 1; state->dataLoopNodes->Node.allocate(1); state->dataLoopNodes->Node(1).MassFlowRate = 0.0; diff --git a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc index a546da0aee7..81e636a60f7 100644 --- a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc @@ -1334,8 +1334,8 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) state->dataLoopNodes->Node(16).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(16).Temp, state->dataLoopNodes->Node(16).HumRat); state->dataLoopNodes->Node(24).MassFlowRateMax = state->dataLoopNodes->Node(16).MassFlowRateMaxAvail; - Fans::Fan(2).MaxAirMassFlowRate = state->dataLoopNodes->Node(16).MassFlowRateMaxAvail; - Fans::Fan(2).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataFans->Fan(2).MaxAirMassFlowRate = state->dataLoopNodes->Node(16).MassFlowRateMaxAvail; + state->dataFans->Fan(2).RhoAirStdInit = state->dataEnvrn->StdRhoAir; state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(1) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(1) * state->dataEnvrn->StdRhoAir; state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(2) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(2) * state->dataEnvrn->StdRhoAir; state->dataDXCoils->DXCoil(2).MSRatedCBF(1) = 0.2; diff --git a/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc b/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc index f7b7cf00bcd..c94c067d4ae 100644 --- a/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc +++ b/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc @@ -251,9 +251,9 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test2) state->dataHVACStandAloneERV->StandAloneERV(1).DesignSAFanVolFlowRate = DataSizing::AutoSize; state->dataHVACStandAloneERV->StandAloneERV(1).DesignEAFanVolFlowRate = DataSizing::AutoSize; state->dataHVACStandAloneERV->StandAloneERV(1).DesignHXVolFlowRate = DataSizing::AutoSize; - state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = Fan(1).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanName = state->dataFans->Fan(1).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).SupplyAirFanIndex = 1; - state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = Fan(2).FanName; + state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanName = state->dataFans->Fan(2).FanName; state->dataHVACStandAloneERV->StandAloneERV(1).ExhaustAirFanIndex = 2; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerTypeNum = HX_AIRTOAIR_GENERIC; state->dataHVACStandAloneERV->StandAloneERV(1).HeatExchangerName = "ERV Heat Exchanger"; diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 86dd3198b51..9d888fc7402 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -8075,9 +8075,8 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) state->dataWaterCoils->NumWaterCoils = 1; state->dataWaterCoils->WaterCoil.allocate(state->dataWaterCoils->NumWaterCoils); state->dataWaterCoils->WaterCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::HeatingSimple; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilTypeA = "Heating"; state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; @@ -8122,7 +8121,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(CoilNum).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataWaterCoils->CheckEquipName.dimension(state->dataWaterCoils->NumWaterCoils, true); @@ -11231,7 +11230,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).CoolDesTemp = 13.1; state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).CoolDesHumRat = 0.0095; // set pointer to components - auto &thisFan(Fan(1)); + auto &thisFan(state->dataFans->Fan(1)); auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); // run the model @@ -12964,7 +12963,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).CoolDesHumRat = 0.0095; // set pointer to components - auto &thisFan(Fan(1)); + auto &thisFan(state->dataFans->Fan(1)); auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); // run the model @@ -15642,7 +15641,7 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).CoolDesTemp = 13.1; state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).CoolDesHumRat = 0.0095; // set pointer to components - auto &thisFan(Fan(1)); + auto &thisFan(state->dataFans->Fan(1)); auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); // run the model diff --git a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc index cc11086effe..8d8eca7b604 100644 --- a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc @@ -2345,7 +2345,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempElecRadSurfaceGroupTest) EXPECT_EQ(state->dataLowTempRadSys->ElecRadSys(1).ZoneName, "WEST ZONE"); EXPECT_EQ(state->dataLowTempRadSys->ElecRadSys(1).SurfListName, "WEST ZONE SURFACE GROUP"); // the 2nd surface list group holds data for 1st elec rad sys (#5958) - EXPECT_EQ(DataSurfaceLists::SurfList(2).Name, "WEST ZONE SURFACE GROUP"); + EXPECT_EQ(state->dataSurfLists->SurfList(2).Name, "WEST ZONE SURFACE GROUP"); EXPECT_EQ(state->dataLowTempRadSys->ElecRadSys(1).NumOfSurfaces, 2); // surface ptr's are not set correctly when elec rad sys "index" (e.g., state->dataLowTempRadSys->ElecRadSys(N)) is not the same as surface group "index" // #5958 fixes this issue diff --git a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc index 8071f144d87..86b3b1cdb0d 100644 --- a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc +++ b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc @@ -130,14 +130,14 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) // Set up conditions state->dataGlobal->TimeStepZone = 0.25; state->dataEnvrn->OutBaroPress = 101325.; - DataMoistureBalanceEMPD::RVSurface(1) = 0.007077173214149593; - DataMoistureBalanceEMPD::RVSurfaceOld(1) = DataMoistureBalanceEMPD::RVSurface(1); + state->dataMstBalEMPD->RVSurface(1) = 0.007077173214149593; + state->dataMstBalEMPD->RVSurfaceOld(1) = state->dataMstBalEMPD->RVSurface(1); DataMoistureBalance::HMassConvInFD(1) = 0.0016826898264131584; DataMoistureBalance::RhoVaporAirIn(1) = 0.0073097913062508896; - DataMoistureBalanceEMPD::RVSurfLayer(1) = 0.007038850125652322; - DataMoistureBalanceEMPD::RVDeepLayer(1) = 0.0051334905162138695; - DataMoistureBalanceEMPD::RVdeepOld(1) = 0.0051334905162138695; - DataMoistureBalanceEMPD::RVSurfLayerOld(1) = 0.007038850125652322; + state->dataMstBalEMPD->RVSurfLayer(1) = 0.007038850125652322; + state->dataMstBalEMPD->RVDeepLayer(1) = 0.0051334905162138695; + state->dataMstBalEMPD->RVdeepOld(1) = 0.0051334905162138695; + state->dataMstBalEMPD->RVSurfLayerOld(1) = 0.007038850125652322; // Do calcs Real64 Tsat(0.0); @@ -145,12 +145,12 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) auto const &report_vars = state->dataMoistureBalEMPD->EMPDReportVars(1); EXPECT_DOUBLE_EQ(6.3445188238394508, Tsat); - EXPECT_DOUBLE_EQ(0.0071762141417078054, DataMoistureBalanceEMPD::RVSurface(1)); + EXPECT_DOUBLE_EQ(0.0071762141417078054, state->dataMstBalEMPD->RVSurface(1)); EXPECT_DOUBLE_EQ(0.00000076900234067835945, report_vars.mass_flux_deep); EXPECT_DOUBLE_EQ(-0.00000019077843350248091, report_vars.mass_flux_zone); - EXPECT_DOUBLE_EQ(0.0070186500259181136, DataMoistureBalanceEMPD::RVSurfLayer(1)); - EXPECT_DOUBLE_EQ(0.0051469229632164605, DataMoistureBalanceEMPD::RVDeepLayer(1)); - EXPECT_DOUBLE_EQ(-0.47694608375620229, DataMoistureBalanceEMPD::HeatFluxLatent(1)); + EXPECT_DOUBLE_EQ(0.0070186500259181136, state->dataMstBalEMPD->RVSurfLayer(1)); + EXPECT_DOUBLE_EQ(0.0051469229632164605, state->dataMstBalEMPD->RVDeepLayer(1)); + EXPECT_DOUBLE_EQ(-0.47694608375620229, state->dataMstBalEMPD->HeatFluxLatent(1)); // Clean up state->dataHeatBalFanSys->ZoneAirHumRat.deallocate(); @@ -255,14 +255,14 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) // Set up conditions state->dataGlobal->TimeStepZone = 0.25; state->dataEnvrn->OutBaroPress = 101325.; - DataMoistureBalanceEMPD::RVSurface(1) = 0.007077173214149593; - DataMoistureBalanceEMPD::RVSurfaceOld(1) = DataMoistureBalanceEMPD::RVSurface(1); + state->dataMstBalEMPD->RVSurface(1) = 0.007077173214149593; + state->dataMstBalEMPD->RVSurfaceOld(1) = state->dataMstBalEMPD->RVSurface(1); DataMoistureBalance::HMassConvInFD(1) = 0.0016826898264131584; DataMoistureBalance::RhoVaporAirIn(1) = 0.0073097913062508896; - DataMoistureBalanceEMPD::RVSurfLayer(1) = 0.007038850125652322; - DataMoistureBalanceEMPD::RVDeepLayer(1) = 0.0051334905162138695; - DataMoistureBalanceEMPD::RVdeepOld(1) = 0.0051334905162138695; - DataMoistureBalanceEMPD::RVSurfLayerOld(1) = 0.007038850125652322; + state->dataMstBalEMPD->RVSurfLayer(1) = 0.007038850125652322; + state->dataMstBalEMPD->RVDeepLayer(1) = 0.0051334905162138695; + state->dataMstBalEMPD->RVdeepOld(1) = 0.0051334905162138695; + state->dataMstBalEMPD->RVSurfLayerOld(1) = 0.007038850125652322; // Do calcs Real64 Tsat(0.0); @@ -270,12 +270,12 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) auto const &report_vars = state->dataMoistureBalEMPD->EMPDReportVars(1); EXPECT_DOUBLE_EQ(6.3445188238394508, Tsat); - EXPECT_DOUBLE_EQ(0.0071815819413115663, DataMoistureBalanceEMPD::RVSurface(1)); + EXPECT_DOUBLE_EQ(0.0071815819413115663, state->dataMstBalEMPD->RVSurface(1)); EXPECT_DOUBLE_EQ(0.00000076900234067835945, report_vars.mass_flux_deep); EXPECT_DOUBLE_EQ(-1.8118197009111738e-07, report_vars.mass_flux_zone); - EXPECT_DOUBLE_EQ(0.0070183147759991828, DataMoistureBalanceEMPD::RVSurfLayer(1)); - EXPECT_DOUBLE_EQ(0.0051469229632164605, DataMoistureBalanceEMPD::RVDeepLayer(1)); - EXPECT_DOUBLE_EQ(-0.45295492522779346, DataMoistureBalanceEMPD::HeatFluxLatent(1)); + EXPECT_DOUBLE_EQ(0.0070183147759991828, state->dataMstBalEMPD->RVSurfLayer(1)); + EXPECT_DOUBLE_EQ(0.0051469229632164605, state->dataMstBalEMPD->RVDeepLayer(1)); + EXPECT_DOUBLE_EQ(-0.45295492522779346, state->dataMstBalEMPD->HeatFluxLatent(1)); // Clean up state->dataHeatBalFanSys->ZoneAirHumRat.deallocate(); @@ -346,14 +346,14 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) // Set up conditions state->dataGlobal->TimeStepZone = 0.25; state->dataEnvrn->OutBaroPress = 101325.; - DataMoistureBalanceEMPD::RVSurface(surfNum) = 0.0070277983586713262; - DataMoistureBalanceEMPD::RVSurfaceOld(surfNum) = DataMoistureBalanceEMPD::RVSurface( surfNum ); + state->dataMstBalEMPD->RVSurface(surfNum) = 0.0070277983586713262; + state->dataMstBalEMPD->RVSurfaceOld(surfNum) = state->dataMstBalEMPD->RVSurface( surfNum ); DataMoistureBalance::HMassConvInFD(surfNum) = 0.0016826898264131584; DataMoistureBalance::RhoVaporAirIn(surfNum) = 0.0073097913062508896; - DataMoistureBalanceEMPD::RVSurfLayer(surfNum) = 0.0070277983586713262; - DataMoistureBalanceEMPD::RVDeepLayer(surfNum) = 0.0051402944814058216; - DataMoistureBalanceEMPD::RVdeepOld(surfNum) = 0.0051402944814058216; - DataMoistureBalanceEMPD::RVSurfLayerOld(surfNum) = 0.0070277983586713262; + state->dataMstBalEMPD->RVSurfLayer(surfNum) = 0.0070277983586713262; + state->dataMstBalEMPD->RVDeepLayer(surfNum) = 0.0051402944814058216; + state->dataMstBalEMPD->RVdeepOld(surfNum) = 0.0051402944814058216; + state->dataMstBalEMPD->RVSurfLayerOld(surfNum) = 0.0070277983586713262; using DataHeatBalSurface::TempSurfIn; using Psychrometrics::PsyRhFnTdbRhov; @@ -367,8 +367,8 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) // Calculate average vapor density [kg/m^3] Real64 Taver = DataHeatBalSurface::TempSurfIn(surfNum); // Calculate RH for use in material property calculations. - Real64 RV_Deep_Old = DataMoistureBalanceEMPD::RVdeepOld( surfNum ); - Real64 RVaver = DataMoistureBalanceEMPD::RVSurfLayerOld(surfNum); + Real64 RV_Deep_Old = state->dataMstBalEMPD->RVdeepOld( surfNum ); + Real64 RVaver = state->dataMstBalEMPD->RVSurfLayerOld(surfNum); Real64 RHaver = RVaver * 461.52 * (Taver + DataGlobalConstants::KelvinConv) * std::exp(-23.7093 + 4111.0 / (Taver + 237.7)); Real64 dU_dRH = material.MoistACoeff * material.MoistBCoeff * pow(RHaver, material.MoistBCoeff - 1) + material.MoistCCoeff * material.MoistDCoeff * pow(RHaver, material.MoistDCoeff - 1); diff --git a/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc b/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc index ffe37cbc44a..8adaf967cbd 100644 --- a/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc +++ b/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc @@ -2045,8 +2045,8 @@ TEST_F(EnergyPlusFixture, OASystem_HotWaterPreheatCoilScheduledOnSim) 1.0); // test that OA sys water coil bypasses normal controller calls before air loop simulation - EXPECT_EQ("PREHEAT COIL CONTROLLER", HVACControllers::ControllerProps(1).ControllerName); - EXPECT_TRUE(HVACControllers::ControllerProps(1).BypassControllerCalc); + EXPECT_EQ("PREHEAT COIL CONTROLLER", state->dataHVACControllers->ControllerProps(1).ControllerName); + EXPECT_TRUE(state->dataHVACControllers->ControllerProps(1).BypassControllerCalc); // test that water coil knows which controller controls the HW coil EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).ControllerIndex, 1); } diff --git a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc index ccaa08ac282..20bf135f7b2 100644 --- a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc +++ b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc @@ -335,7 +335,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // enable the VRF condenser state->dataScheduleMgr->Schedule(2).CurrentValue = 1.0; // enable the terminal unit state->dataScheduleMgr->Schedule(3).CurrentValue = 1.0; // turn on fan - int EAFanInletNode = Fans::Fan(2).InletNodeNum; + int EAFanInletNode = state->dataFans->Fan(2).InletNodeNum; state->dataLoopNodes->Node(EAFanInletNode).MassFlowRate = 0.60215437; // zone exhaust flow rate state->dataLoopNodes->Node(EAFanInletNode).MassFlowRateMaxAvail = 0.60215437; // exhaust fan will not turn on unless max avail is set @@ -349,8 +349,8 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) EXPECT_DOUBLE_EQ(state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).MinOA * state->dataEnvrn->StdRhoAir, state->dataOutdoorAirUnit->OutAirUnit(OAUnitNum).ExtAirMassFlow); // test that both fans are included in OA unit fan power report - Real64 SAFanPower = Fans::Fan(1).FanPower; - Real64 EAFanPower = Fans::Fan(2).FanPower; + Real64 SAFanPower = state->dataFans->Fan(1).FanPower; + Real64 EAFanPower = state->dataFans->Fan(2).FanPower; EXPECT_DOUBLE_EQ(SAFanPower, 75.0); EXPECT_DOUBLE_EQ(EAFanPower, 75.0); EXPECT_DOUBLE_EQ(SAFanPower + EAFanPower, state->dataOutdoorAirUnit->OutAirUnit(OAUnitNum).ElecFanRate); diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index 7c146a15626..a85d7541242 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -534,8 +534,8 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) SizeFan(*state, 1); // the fan vol flow rate should equal the max of cooling and heating coil flow rates Real64 maxCoilAirFlow = max(state->dataVariableSpeedCoils->VarSpeedCoil( 1 ).RatedAirVolFlowRate, state->dataVariableSpeedCoils->VarSpeedCoil( 2 ).RatedAirVolFlowRate); - EXPECT_EQ(Fan(1).MaxAirFlowRate, maxCoilAirFlow); - EXPECT_EQ(Fan(1).MaxAirFlowRate, max(state->dataPTHP->PTUnit(1).MaxCoolAirVolFlow, state->dataPTHP->PTUnit(1).MaxHeatAirVolFlow)); + EXPECT_EQ(state->dataFans->Fan(1).MaxAirFlowRate, maxCoilAirFlow); + EXPECT_EQ(state->dataFans->Fan(1).MaxAirFlowRate, max(state->dataPTHP->PTUnit(1).MaxCoolAirVolFlow, state->dataPTHP->PTUnit(1).MaxHeatAirVolFlow)); // Initialize the packaged terminal heat pump Real64 OnOffAirFlowRatio(1.0); // ratio of compressor ON airflow to average airflow over timestep @@ -565,8 +565,8 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) EXPECT_TRUE(state->dataSize->ZoneEqSizing(1).HeatingAirFlow); EXPECT_EQ(state->dataSize->ZoneEqSizing(1).CoolingAirVolFlow, state->dataPTHP->PTUnit(1).MaxCoolAirVolFlow); EXPECT_EQ(state->dataSize->ZoneEqSizing(1).HeatingAirVolFlow, state->dataPTHP->PTUnit(1).MaxHeatAirVolFlow); - EXPECT_EQ(Fan(1).MaxAirFlowRate, state->dataSize->ZoneEqSizing(1).AirVolFlow); - EXPECT_EQ(Fan(1).MaxAirFlowRate, max(state->dataSize->ZoneEqSizing(1).CoolingAirVolFlow, state->dataSize->ZoneEqSizing(1).HeatingAirVolFlow)); + EXPECT_EQ(state->dataFans->Fan(1).MaxAirFlowRate, state->dataSize->ZoneEqSizing(1).AirVolFlow); + EXPECT_EQ(state->dataFans->Fan(1).MaxAirFlowRate, max(state->dataSize->ZoneEqSizing(1).CoolingAirVolFlow, state->dataSize->ZoneEqSizing(1).HeatingAirVolFlow)); } TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) @@ -852,11 +852,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) state->dataLoopNodes->Node(state->dataPTHP->PTUnit(1).OutsideAirNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; @@ -1198,11 +1198,11 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) // state->dataLoopNodes->Node( PTUnit( 1 ).OutsideAirNode ).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters - Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; - Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; - state->dataLoopNodes->Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; + state->dataFans->Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).InletAirMassFlowRate = HVACInletMassFlowRate; + state->dataFans->Fan(1).RhoAirStdInit = state->dataEnvrn->StdRhoAir; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = HVACInletMassFlowRate; + state->dataLoopNodes->Node(state->dataFans->Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index fe280a946e9..a2e7c24b1d7 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -109,12 +109,12 @@ class RoomAirflowNetworkTest : public EnergyPlusFixture state->dataSurface->Surface.allocate(NumOfSurfaces); state->dataHeatBal->HConvIn.allocate(NumOfSurfaces); TempSurfInTmp.allocate(NumOfSurfaces); - RVSurface.allocate(NumOfSurfaces); - RVSurfaceOld.allocate(NumOfSurfaces); - RVDeepLayer.allocate(NumOfSurfaces); - RVdeepOld.allocate(NumOfSurfaces); - RVSurfLayerOld.allocate(NumOfSurfaces); - RVSurfLayer.allocate(NumOfSurfaces); + state->dataMstBalEMPD->RVSurface.allocate(NumOfSurfaces); + state->dataMstBalEMPD->RVSurfaceOld.allocate(NumOfSurfaces); + state->dataMstBalEMPD->RVDeepLayer.allocate(NumOfSurfaces); + state->dataMstBalEMPD->RVdeepOld.allocate(NumOfSurfaces); + state->dataMstBalEMPD->RVSurfLayerOld.allocate(NumOfSurfaces); + state->dataMstBalEMPD->RVSurfLayer.allocate(NumOfSurfaces); RhoVaporSurfIn.allocate(NumOfSurfaces); RhoVaporAirIn.allocate(NumOfSurfaces); HMassConvInFD.allocate(NumOfSurfaces); @@ -265,8 +265,8 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) state->dataSurface->Surface(1).HeatTransferAlgorithm = HeatTransferModel_EMPD; state->dataSurface->Surface(2).HeatTransferAlgorithm = HeatTransferModel_EMPD; - RVSurface(1) = 0.0011; - RVSurface(2) = 0.0012; + state->dataMstBalEMPD->RVSurface(1) = 0.0011; + state->dataMstBalEMPD->RVSurface(2) = 0.0012; state->dataLoopNodes->NodeID(1) = "Supply"; state->dataLoopNodes->NodeID(2) = "Return"; diff --git a/tst/EnergyPlus/unit/RootFinder.unit.cc b/tst/EnergyPlus/unit/RootFinder.unit.cc index e594d250f7a..11451ae58cd 100644 --- a/tst/EnergyPlus/unit/RootFinder.unit.cc +++ b/tst/EnergyPlus/unit/RootFinder.unit.cc @@ -62,18 +62,18 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckConvergence) { DataRootFinder::RootFinderDataType rootFinderData; int slopeType = DataRootFinder::iSlopeDecreasing; - int methodType = DataRootFinder::iMethodBrent; + DataRootFinder::iMethod methodType = DataRootFinder::iMethod::Brent; Real64 relativeXTolerance = 0.0; Real64 absoluteXTolerance = 1.0e-6; Real64 absoluteYTolerance = 1.0e-5; RootFinder::SetupRootFinder(*state, rootFinderData, slopeType, methodType, relativeXTolerance, absoluteXTolerance, absoluteYTolerance); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); Real64 xMin = 0.0; Real64 xMax = 100.0; RootFinder::InitializeRootFinder(*state, rootFinderData, xMin, xMax); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); bool isDone = false; @@ -81,28 +81,28 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckConvergence) Real64 xValue = xMin; Real64 yValue = 100.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); EXPECT_FALSE(isDone); // Set max point xValue = xMax; yValue = -100.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); EXPECT_FALSE(isDone); // Set 3rd point xValue = 20.0; yValue = -1.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); EXPECT_FALSE(isDone); // 4th point should converge xValue = rootFinderData.XCandidate; yValue = absoluteYTolerance / 2.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusOK); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::OK); EXPECT_TRUE(isDone); } @@ -110,18 +110,18 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckBracketRoundOff) { DataRootFinder::RootFinderDataType rootFinderData; int slopeType = DataRootFinder::iSlopeDecreasing; - int methodType = DataRootFinder::iMethodBrent; + DataRootFinder::iMethod methodType = DataRootFinder::iMethod::Brent; Real64 relativeXTolerance = 0.0; Real64 absoluteXTolerance = 1.0e-6; Real64 absoluteYTolerance = 1.0e-5; RootFinder::SetupRootFinder(*state, rootFinderData, slopeType, methodType, relativeXTolerance, absoluteXTolerance, absoluteYTolerance); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); Real64 xMin = 0.0; Real64 xMax = 100.0; RootFinder::InitializeRootFinder(*state, rootFinderData, xMin, xMax); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); bool isDone = false; @@ -129,34 +129,34 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckBracketRoundOff) Real64 xValue = xMin; Real64 yValue = 100.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); EXPECT_FALSE(isDone); // Set max point xValue = xMax; yValue = -100.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); EXPECT_FALSE(isDone); // Set 3rd point (this will be the upper point) xValue = 20.0; yValue = -10.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); EXPECT_FALSE(isDone); // Set 4th point slightly below 3rd point but with opposite sign for y (this will be the lower point) xValue = xValue - absoluteXTolerance / 3.0; yValue = 10.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::None); EXPECT_FALSE(isDone); // Set 5th point in between upper and lower, but non-convergent so it gets to the Increment check) xValue = rootFinderData.XCandidate; yValue = 5.0; RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); - EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusOKRoundOff); + EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatus::OKRoundOff); EXPECT_TRUE(isDone); } diff --git a/tst/EnergyPlus/unit/SZVAVModel.unit.cc b/tst/EnergyPlus/unit/SZVAVModel.unit.cc index 63b7716346f..86b9e0032c7 100644 --- a/tst/EnergyPlus/unit/SZVAVModel.unit.cc +++ b/tst/EnergyPlus/unit/SZVAVModel.unit.cc @@ -628,7 +628,7 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; diff --git a/tst/EnergyPlus/unit/SimulationManager.unit.cc b/tst/EnergyPlus/unit/SimulationManager.unit.cc index 9342625200d..67c239fa66b 100644 --- a/tst/EnergyPlus/unit/SimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/SimulationManager.unit.cc @@ -174,8 +174,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); SimulationManager::GetProjectData(*state); - EXPECT_FALSE(DataReportingFlags::DebugOutput); - EXPECT_FALSE(DataReportingFlags::EvenDuringWarmup); + EXPECT_FALSE(state->dataReportFlag->DebugOutput); + EXPECT_FALSE(state->dataReportFlag->EvenDuringWarmup); // no error message from EXPECT_TRUE(compare_err_stream("", true)); @@ -191,8 +191,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); SimulationManager::GetProjectData(*state); - EXPECT_TRUE(DataReportingFlags::DebugOutput); - EXPECT_FALSE(DataReportingFlags::EvenDuringWarmup); + EXPECT_TRUE(state->dataReportFlag->DebugOutput); + EXPECT_FALSE(state->dataReportFlag->EvenDuringWarmup); // no error message from EXPECT_TRUE(compare_err_stream("", true)); @@ -208,8 +208,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); SimulationManager::GetProjectData(*state); - EXPECT_FALSE(DataReportingFlags::DebugOutput); - EXPECT_TRUE(DataReportingFlags::EvenDuringWarmup); + EXPECT_FALSE(state->dataReportFlag->DebugOutput); + EXPECT_TRUE(state->dataReportFlag->EvenDuringWarmup); // no error message from EXPECT_TRUE(compare_err_stream("", true)); @@ -238,8 +238,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) } SimulationManager::GetProjectData(*state); - EXPECT_FALSE(DataReportingFlags::DebugOutput); - EXPECT_TRUE(DataReportingFlags::EvenDuringWarmup); + EXPECT_FALSE(state->dataReportFlag->DebugOutput); + EXPECT_TRUE(state->dataReportFlag->EvenDuringWarmup); { std::string const expectedError = delimited_string({ @@ -267,8 +267,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_DefaultState) EXPECT_FALSE(state->dataGlobal->DisplayUnusedSchedules); EXPECT_FALSE(state->dataGlobal->DisplayAdvancedReportVariables); EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); - EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); - EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredDetachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredAttachedShading); EXPECT_FALSE(state->dataSysVars->ReportDuringWarmup); EXPECT_FALSE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_FALSE(state->dataSysVars->ReportDetailedWarmupConvergence); @@ -303,8 +303,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_SimpleCase) EXPECT_TRUE(state->dataGlobal->DisplayUnusedSchedules); EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); - EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); - EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredDetachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredAttachedShading); EXPECT_FALSE(state->dataSysVars->ReportDuringWarmup); EXPECT_FALSE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_FALSE(state->dataSysVars->ReportDetailedWarmupConvergence); @@ -343,8 +343,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_AllKeys) EXPECT_TRUE(state->dataGlobal->DisplayUnusedSchedules); EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); EXPECT_TRUE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); - EXPECT_FALSE(DataReportingFlags::MakeMirroredDetachedShading); - EXPECT_FALSE(DataReportingFlags::MakeMirroredAttachedShading); + EXPECT_FALSE(state->dataReportFlag->MakeMirroredDetachedShading); + EXPECT_FALSE(state->dataReportFlag->MakeMirroredAttachedShading); EXPECT_TRUE(state->dataSysVars->ReportDuringWarmup); EXPECT_TRUE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_TRUE(state->dataSysVars->ReportDetailedWarmupConvergence); @@ -381,8 +381,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_Unicity) EXPECT_FALSE(state->dataGlobal->DisplayUnusedSchedules); EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); // Only first object has been processed EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); - EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); - EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredDetachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredAttachedShading); EXPECT_FALSE(state->dataSysVars->ReportDuringWarmup); EXPECT_FALSE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_FALSE(state->dataSysVars->ReportDetailedWarmupConvergence); @@ -426,8 +426,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_UndocumentedFlags) EXPECT_FALSE(state->dataGlobal->DisplayUnusedSchedules); EXPECT_FALSE(state->dataGlobal->DisplayAdvancedReportVariables); EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); - EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); - EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredDetachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredAttachedShading); EXPECT_FALSE(state->dataSysVars->ReportDuringWarmup); EXPECT_FALSE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_FALSE(state->dataSysVars->ReportDetailedWarmupConvergence); @@ -465,8 +465,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_HasEmpty) EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); - EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); - EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredDetachedShading); + EXPECT_TRUE(state->dataReportFlag->MakeMirroredAttachedShading); EXPECT_FALSE(state->dataSysVars->ReportDuringWarmup); EXPECT_FALSE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_FALSE(state->dataSysVars->ReportDetailedWarmupConvergence); diff --git a/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc b/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc index fc29ab73d14..39c78eabcb7 100644 --- a/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc +++ b/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc @@ -265,7 +265,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataSingleDuct->sd_airterminal(1).HWLoopNum = 1; @@ -503,7 +503,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataSingleDuct->sd_airterminal(1).HWLoopNum = 1; @@ -740,7 +740,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataSingleDuct->sd_airterminal(1).HWLoopNum = 1; @@ -977,7 +977,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataSingleDuct->sd_airterminal(1).HWLoopNum = 1; @@ -1172,7 +1172,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataSize->PlantSizData(1).DeltaT = 11.0; @@ -1388,7 +1388,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataSingleDuct->sd_airterminal(1).HWLoopNum = 1; diff --git a/tst/EnergyPlus/unit/UnitHeater.unit.cc b/tst/EnergyPlus/unit/UnitHeater.unit.cc index 3ed04a06685..aa198bb2e40 100644 --- a/tst/EnergyPlus/unit/UnitHeater.unit.cc +++ b/tst/EnergyPlus/unit/UnitHeater.unit.cc @@ -1322,7 +1322,7 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; @@ -1341,9 +1341,9 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).Temp = 16.6; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).HumRat = PsyWFnTdbRhPb(*state, 16.6, 0.5, 101325.0, "UnitTest"); - state->dataLoopNodes->Node(Fan(1).InletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(Fan(1).InletNodeNum).Temp, state->dataLoopNodes->Node(Fan(1).InletNodeNum).HumRat); + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).Temp = 16.6; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).HumRat = PsyWFnTdbRhPb(*state, 16.6, 0.5, 101325.0, "UnitTest"); + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).Temp, state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).HumRat); state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); WCWaterInletNode = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; @@ -1357,7 +1357,7 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) UHAirOutletNode = state->dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; SimUnitHeater(*state, state->dataUnitHeaters->UnitHeat(UnitHeatNum).Name, ZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided, state->dataSize->CurZoneEqNum); - // SimUnitHeater does not converge on the first call: the unit heater deliveres more than required heating load. But it meets + // SimUnitHeater does not converge on the first call: the unit heater delivers more than required heating load. But it meets // on the second call (iteration). I suspect it may be an initialization issue related to ControlCompOutput routine SimUnitHeater(*state, state->dataUnitHeaters->UnitHeat(UnitHeatNum).Name, ZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided, state->dataSize->CurZoneEqNum); // verify the total heat rate deleivered by the unit heater diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 16a80f181c6..344a7410640 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -352,8 +352,7 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; @@ -379,7 +378,7 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) state->dataSize->PlantSizData(1).ExitTemp = 5.7; state->dataSize->PlantSizData(1).DeltaT = 5.0; state->dataSize->FinalSysSizing(1).MassFlowAtCoolPeak = state->dataSize->FinalSysSizing(1).DesMainVolFlow * state->dataEnvrn->StdRhoAir; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(CoilNum).Name; state->dataSize->DataWaterLoopNum = 1; FluidProperties::NumOfGlycols = 1; @@ -417,8 +416,7 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; @@ -428,7 +426,7 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(CoilNum).Name; state->dataSize->DataWaterLoopNum = 2; state->dataSize->PlantSizData(2).DeltaT = 5.0; @@ -451,11 +449,11 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) // resize cooling coil with fan on branch CoilNum = 1; - Fans::Fan.allocate(1); - Fans::Fan(1).DeltaPress = 600.0; - Fans::Fan(1).FanEff = 0.9; - Fans::Fan(1).MotEff = 0.7; - Fans::Fan(1).MotInAirFrac = 1.0; + state->dataFans->Fan.allocate(1); + state->dataFans->Fan(1).DeltaPress = 600.0; + state->dataFans->Fan(1).FanEff = 0.9; + state->dataFans->Fan(1).MotEff = 0.7; + state->dataFans->Fan(1).MotInAirFrac = 1.0; state->dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; state->dataAirSystemsData->PrimaryAirSystems(1).supFanVecIndex = 1; @@ -4196,8 +4194,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) state->dataWaterCoils->GetWaterCoilsInputFlag = false; state->dataWaterCoils->WaterCoil(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; state->dataWaterCoils->WaterCoil(1).Name = "Water Heating Coil"; - state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataHVACGlobals::Coil_HeatingWater; - state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = HotWaterMassFlowRate; state->dataWaterCoils->WaterCoil(1).UACoil = 400.0; @@ -4248,7 +4245,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; thisSys.m_HeatingCoilIndex = 1; @@ -4338,9 +4335,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) state->dataWaterCoils->GetWaterCoilsInputFlag = false; state->dataWaterCoils->WaterCoil(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; state->dataWaterCoils->WaterCoil(1).Name = "Water Cooling Coil"; - state->dataWaterCoils->WaterCoil(1).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; - state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_Cooling; - state->dataWaterCoils->WaterCoil(1).WaterCoilModel = state->dataWaterCoils->CoilModel_Cooling; + state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; + state->dataWaterCoils->WaterCoil(1).WaterCoilModel = WaterCoils::iCoilModel::CoolingSimple; state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = ColdWaterMassFlowRate; state->dataWaterCoils->WaterCoil(1).CoolingCoilAnalysisMode = state->dataWaterCoils->SimpleAnalysis; @@ -4402,7 +4398,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; thisSys.m_CoolingCoilIndex = 1; @@ -6081,10 +6077,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils_CyclingFan) EXPECT_DOUBLE_EQ(state->dataLoopNodes->Node(InletNode).MassFlowRate, state->dataLoopNodes->Node(OutletNode).MassFlowRate); // compare fan RTF with fan PLR and global PLF - Real64 FanPLR = state->dataLoopNodes->Node(InletNode).MassFlowRate / Fans::Fan(1).MaxAirMassFlowRate; + Real64 FanPLR = state->dataLoopNodes->Node(InletNode).MassFlowRate / state->dataFans->Fan(1).MaxAirMassFlowRate; Real64 FanRTF = FanPLR / DataHVACGlobals::OnOffFanPartLoadFraction; EXPECT_DOUBLE_EQ(FanRTF, FanPLR); - EXPECT_DOUBLE_EQ(FanRTF, Fans::Fan(1).FanRuntimeFraction); + EXPECT_DOUBLE_EQ(FanRTF, state->dataFans->Fan(1).FanRuntimeFraction); EXPECT_DOUBLE_EQ(DataHVACGlobals::OnOffFanPartLoadFraction, 1.0); state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = -1000.0; // cooling load @@ -6129,11 +6125,11 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils_CyclingFan) EXPECT_DOUBLE_EQ(state->dataLoopNodes->Node(InletNode).MassFlowRate, state->dataLoopNodes->Node(OutletNode).MassFlowRate); // compare fan RTF with fan PLR and global PLF - FanPLR = state->dataLoopNodes->Node(InletNode).MassFlowRate / Fans::Fan(1).MaxAirMassFlowRate; + FanPLR = state->dataLoopNodes->Node(InletNode).MassFlowRate / state->dataFans->Fan(1).MaxAirMassFlowRate; // blow thru fan resets OnOffFanPartLoadFraction = 1 so other equipment not using PLF are not affected. OnOffFanPartLoadFraction = 1 here. // Unitary System also sets OnOffFanPartLoadFraction = 1 (see end of ReportUnitarySystem) so this variable will = 1 EXPECT_EQ(1.0, DataHVACGlobals::OnOffFanPartLoadFraction); - EXPECT_GT(Fans::Fan(1).FanRuntimeFraction, FanPLR); + EXPECT_GT(state->dataFans->Fan(1).FanRuntimeFraction, FanPLR); } TEST_F(EnergyPlusFixture, UnitarySystemModel_GetBadSupplyAirMethodInput) diff --git a/tst/EnergyPlus/unit/WaterCoils.unit.cc b/tst/EnergyPlus/unit/WaterCoils.unit.cc index d7f651e0d42..3730a739c5c 100644 --- a/tst/EnergyPlus/unit/WaterCoils.unit.cc +++ b/tst/EnergyPlus/unit/WaterCoils.unit.cc @@ -210,7 +210,7 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Cooling Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = TypeOf_CoilWaterCooling; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; @@ -292,7 +292,7 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) state->dataAirLoop->AirLoopControlInfo(1).UnitarySys = true; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil"; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; @@ -323,7 +323,7 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) state->dataSize->FinalSysSizing(1).MassFlowAtCoolPeak = state->dataSize->FinalSysSizing(1).DesMainVolFlow * state->dataEnvrn->StdRhoAir; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil 2"; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; @@ -444,9 +444,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::HeatingSimple; state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; @@ -596,9 +595,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::HeatingSimple; state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; @@ -752,9 +750,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::HeatingSimple; state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; @@ -868,9 +865,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Simple Water Cooling Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_Cooling; // Coil:Cooling:Water - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilModel_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::CoolingSimple; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; @@ -969,9 +965,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Detailed Water Cooling Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_DetFlatFinCooling; // Coil:Cooling:Water:DetailedGeometry - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilModel_Detailed; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterCooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::CoolingDetailed; state->dataWaterCoils->WaterCoil(CoilNum).TubeOutsideSurfArea = 6.23816; state->dataWaterCoils->WaterCoil(CoilNum).TotTubeInsideArea = 6.20007018; @@ -1082,9 +1077,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Detailed Water Cooling Coil"; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_DetFlatFinCooling; // Coil:Cooling:Water:DetailedGeometry - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilModel_Detailed; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterDetailedFlatCooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::CoolingDetailed; state->dataWaterCoils->WaterCoil(CoilNum).TubeOutsideSurfArea = 6.23816; state->dataWaterCoils->WaterCoil(CoilNum).TotTubeInsideArea = 6.20007018; @@ -1124,7 +1118,7 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_DetFlatFinCooling; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterDetailedFlatCooling; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; @@ -1264,9 +1258,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Simple Water Heating Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::HeatingSimple; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; @@ -1362,9 +1355,8 @@ TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; - state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::iCoilModel::HeatingSimple; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; @@ -1588,7 +1580,7 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) ProcessScheduleInput(*state); state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); - EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); + EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, state->dataFans->Fan(1).FanType_Num); GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", state->dataFanCoilUnits->FanCoil(1).CapCtrlMeth); @@ -1635,13 +1627,13 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).CoolCoilFluidInletNode).MassFlowRateMaxAvail = 0.14; state->dataLoopNodes->Node(state->dataFanCoilUnits->FanCoil(1).HeatCoilFluidInletNode).MassFlowRateMaxAvail = 0.14; - Fan(1).InletAirMassFlowRate = AirMassFlow; - Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; + state->dataFans->Fan(1).InletAirMassFlowRate = AirMassFlow; + state->dataFans->Fan(1).MaxAirMassFlowRate = MaxAirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; - state->dataLoopNodes->Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRate = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMin = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; + state->dataLoopNodes->Node(state->dataFans->Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; @@ -1701,7 +1693,7 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; state->dataPlnt->PlantLoop(2).LoopSide(1).FlowLock = DataPlant::iFlowLock::Unlocked; @@ -1711,7 +1703,7 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).LoopSide(1).FlowLock = DataPlant::iFlowLock::Unlocked; diff --git a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc index 077297c3893..887d47062dd 100644 --- a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc +++ b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc @@ -1040,8 +1040,8 @@ TEST_F(EnergyPlusFixture, HPWHSizing) state->dataHeatBalFanSys->MAT.allocate(1); state->dataHeatBalFanSys->MAT(1) = 20.0; WaterThermalTanks::SimHeatPumpWaterHeater(*state, "Zone4HeatPumpWaterHeater", true, SenseLoadMet, LatLoadMet, CompIndex); - EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, state->dataWaterThermalTanks->HPWaterHeater(1).OperatingAirFlowRate); - EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1)); + EXPECT_EQ(state->dataFans->Fan(1).MaxAirFlowRate, state->dataWaterThermalTanks->HPWaterHeater(1).OperatingAirFlowRate); + EXPECT_EQ(state->dataFans->Fan(1).MaxAirFlowRate, state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1)); } TEST_F(EnergyPlusFixture, WaterThermalTank_CalcTempIntegral) @@ -2591,7 +2591,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) " 100, ! Maximum Value of z", " 0., ! Minimum Curve Output", " 38.; ! Maximum Curve Output", - + "Curve:QuadLinear,", " TotCoolCapCurve, ! Curve Name", " -3.9160645386, ! CoefficientC1", @@ -2609,7 +2609,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) " 100, ! Maximum Value of z", " 0., ! Minimum Curve Output", " 38.; ! Maximum Curve Output", - + "Curve:QuadLinear,", " CoolPowCurve, ! Curve Name", " -6.2337364523, ! CoefficientC1", diff --git a/tst/EnergyPlus/unit/WeatherManager.unit.cc b/tst/EnergyPlus/unit/WeatherManager.unit.cc index 3034cc38add..36014187897 100644 --- a/tst/EnergyPlus/unit/WeatherManager.unit.cc +++ b/tst/EnergyPlus/unit/WeatherManager.unit.cc @@ -747,7 +747,7 @@ TEST_F(SQLiteFixture, DesignDay_EnthalphyAtMaxDB) state->dataGlobal->MinutesPerTimeStep = 60; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->BeginSimFlag = true; - DataReportingFlags::DoWeatherInitReporting = true; + state->dataReportFlag->DoWeatherInitReporting = true; WeatherManager::SetupInterpolationValues(*state); WeatherManager::AllocateWeatherData(*state);