diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index 55668d06ba5..3718455db03 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -192,7 +192,6 @@ set(SRC DataMoistureBalanceEMPD.hh DataOutputs.cc DataOutputs.hh - DataPhotovoltaics.cc DataPhotovoltaics.hh DataPrecisionGlobals.hh DataReportingFlags.hh diff --git a/src/EnergyPlus/CostEstimateManager.cc b/src/EnergyPlus/CostEstimateManager.cc index ed26521ebe1..caf3b4710dc 100644 --- a/src/EnergyPlus/CostEstimateManager.cc +++ b/src/EnergyPlus/CostEstimateManager.cc @@ -231,11 +231,6 @@ namespace CostEstimateManager { // PURPOSE OF THIS SUBROUTINE: // Calculates the Cost Estimate based on inputs. - // Using/Aliasing - using DataPhotovoltaics::iSimplePVModel; - using DataPhotovoltaics::PVarray; - using HeatingCoils::HeatingCoil; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Item; // do-loop counter for line items int ThisConstructID; // hold result of FindItem searching for Construct name @@ -341,7 +336,8 @@ namespace CostEstimateManager { ErrorsFound = true; } else { // assume name is probably useful - thisCoil = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, HeatingCoil); + thisCoil = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, + state.dataHeatingCoils->HeatingCoil); if (thisCoil == 0) { ShowWarningError(state, "ComponentCost:LineItem: \"" + state.dataCostEstimateManager->CostLineItem(Item).LineName + "\", Coil:Heating:Fuel, invalid coil specified"); @@ -441,9 +437,9 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap != 0.0) { if (!state.dataCostEstimateManager->CostLineItem(Item).ParentObjName.empty()) { - thisPV = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, PVarray); + thisPV = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, state.dataPhotovoltaic->PVarray); if (thisPV > 0) { - if (PVarray(thisPV).PVModelType != iSimplePVModel) { + if (state.dataPhotovoltaic->PVarray(thisPV).PVModelType != DataPhotovoltaics::PVModel::Simple) { ShowSevereError(state, "ComponentCost:LineItem: \"" + state.dataCostEstimateManager->CostLineItem(Item).LineName + "\", Generator:Photovoltaic, only available for model type PhotovoltaicPerformance:Simple"); ErrorsFound = true; @@ -487,12 +483,6 @@ namespace CostEstimateManager { // PURPOSE OF THIS SUBROUTINE: // Calculates the Cost Estimate based on inputs. - // Using/Aliasing - using DataPhotovoltaics::iSimplePVModel; - using DataPhotovoltaics::PVarray; - using HeatingCoils::HeatingCoil; - using HeatingCoils::NumHeatingCoils; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Item; // do-loop counter for line items int ThisConstructID; // hold result of FindItem searching for Construct name @@ -620,13 +610,14 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).ParentObjName == "*") { // wildcard, apply to all such components WildcardObjNames = true; } else if (!state.dataCostEstimateManager->CostLineItem(Item).ParentObjName.empty()) { - thisCoil = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, HeatingCoil); + thisCoil = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, + state.dataHeatingCoils->HeatingCoil); } if (state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : HeatingCoil) + for (auto const &e : state.dataHeatingCoils->HeatingCoil) if (e.HCoilType_Num == 1) Qty += e.NominalCapacity; state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot heat cap.)"; @@ -634,7 +625,8 @@ namespace CostEstimateManager { state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = state.dataCostEstimateManager->CostLineItem(Item).Qty * state.dataCostEstimateManager->CostLineItem(Item).ValuePer; } if (thisCoil > 0) { - state.dataCostEstimateManager->CostLineItem(Item).Qty = HeatingCoil(thisCoil).NominalCapacity / 1000.0; + state.dataCostEstimateManager->CostLineItem(Item).Qty = + state.dataHeatingCoils->HeatingCoil(thisCoil).NominalCapacity / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot heat cap.)"; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = state.dataCostEstimateManager->CostLineItem(Item).Qty * state.dataCostEstimateManager->CostLineItem(Item).ValuePer; @@ -642,7 +634,7 @@ namespace CostEstimateManager { } if (state.dataCostEstimateManager->CostLineItem(Item).PerEach > 0.0) { - if (WildcardObjNames) state.dataCostEstimateManager->CostLineItem(Item).Qty = NumHeatingCoils; + if (WildcardObjNames) state.dataCostEstimateManager->CostLineItem(Item).Qty = state.dataHeatingCoils->NumHeatingCoils; if (thisCoil > 0) state.dataCostEstimateManager->CostLineItem(Item).Qty = 1.0; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerEach; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = state.dataCostEstimateManager->CostLineItem(Item).Qty * state.dataCostEstimateManager->CostLineItem(Item).ValuePer; @@ -652,7 +644,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : HeatingCoil) + for (auto const &e : state.dataHeatingCoils->HeatingCoil) if (e.HCoilType_Num == 1) Qty += e.Efficiency * e.NominalCapacity; state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW*Eff (total, rated) "; @@ -660,7 +652,9 @@ namespace CostEstimateManager { state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = state.dataCostEstimateManager->CostLineItem(Item).Qty * state.dataCostEstimateManager->CostLineItem(Item).ValuePer; } if (thisCoil > 0) { - state.dataCostEstimateManager->CostLineItem(Item).Qty = HeatingCoil(thisCoil).Efficiency * HeatingCoil(thisCoil).NominalCapacity / 1000.0; + state.dataCostEstimateManager->CostLineItem(Item).Qty = state.dataHeatingCoils->HeatingCoil(thisCoil).Efficiency * + state.dataHeatingCoils->HeatingCoil(thisCoil).NominalCapacity / + 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW*Eff (total, rated) "; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = state.dataCostEstimateManager->CostLineItem(Item).Qty * state.dataCostEstimateManager->CostLineItem(Item).ValuePer; @@ -753,17 +747,20 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap != 0.0) { if (!state.dataCostEstimateManager->CostLineItem(Item).ParentObjName.empty()) { - thisPV = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, PVarray); + thisPV = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, + state.dataPhotovoltaic->PVarray); if (thisPV > 0) { - ThisZoneID = UtilityRoutines::FindItem(state.dataSurface->Surface(PVarray(thisPV).SurfacePtr).ZoneName, Zone); + ThisZoneID = UtilityRoutines::FindItem( + state.dataSurface->Surface(state.dataPhotovoltaic->PVarray(thisPV).SurfacePtr).ZoneName, Zone); if (ThisZoneID == 0) { Multipliers = 1.0; } else { Multipliers = Zone(ThisZoneID).Multiplier * Zone(ThisZoneID).ListMultiplier; } - if (PVarray(thisPV).PVModelType == iSimplePVModel) { - state.dataCostEstimateManager->CostLineItem(Item).Qty = 1000.0 * PVarray(thisPV).SimplePVModule.AreaCol * - PVarray(thisPV).SimplePVModule.PVEfficiency * Multipliers / 1000.0; + if (state.dataPhotovoltaic->PVarray(thisPV).PVModelType == DataPhotovoltaics::PVModel::Simple) { + state.dataCostEstimateManager->CostLineItem(Item).Qty = + 1000.0 * state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.AreaCol * + state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.PVEfficiency * Multipliers / 1000.0; } state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (rated)"; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap; diff --git a/src/EnergyPlus/DataPhotovoltaics.cc b/src/EnergyPlus/DataPhotovoltaics.cc deleted file mode 100644 index 03aa3e86273..00000000000 --- a/src/EnergyPlus/DataPhotovoltaics.cc +++ /dev/null @@ -1,146 +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 DataPhotovoltaics { - - // MODULE INFORMATION: - // AUTHOR D. Bradley - // DATE WRITTEN May 2003 - // MODIFIED B. Griffith, Dec. 2003, heavy changes, moved derived types here from Photovoltaics.cc - // B. Griffith, Feb 2008, added BIPV and inverter to one-diode model - // RE-ENGINEERED na - - // PURPOSE OF THIS MODULE: - // This data-only module is a repository for the variables that relate specifically - // to the native EnergyPlus photovoltaics simulation. - - // METHODOLOGY EMPLOYED: - - // 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: - std::string const cPVGeneratorObjectName("Generator:Photovoltaic"); - std::string const cPVSimplePerfObjectName("PhotovoltaicPerformance:Simple"); - std::string const cPVEquiv1DiodePerfObjectName("PhotovoltaicPerformance:EquivalentOne-Diode"); - std::string const cPVSandiaPerfObjectName("PhotovoltaicPerformance:Sandia"); - - int const iNotYetSetPVModel(0); - int const iSimplePVModel(1001); - int const iTRNSYSPVModel(1002); - int const iSandiaPVModel(1003); - - int const iNotYetSetCellIntegration(0); // cell temp method not set - int const iDecoupledCellIntegration(1); // cell temp method based on energy balance - int const iDecoupledUllebergDynamicCellIntegration(2); // cell temp method based on energy bal with capacity - int const iSurfaceOutsideFaceCellIntegration(3); // cell temp method based on coupling to E+'s heat balance - int const iTranspiredCollectorCellIntegration(4); // cell temp method based on coupling to unglazed transpired co - int const iExteriorVentedCavityCellIntegration(5); // cell temp method based on coupling to nat vent exterior cavi - int const iPVTSolarCollectorCellIntegration(6); // cell temp method based on coupling to PVT model - - int const FixedEfficiency(10); // simple PV, constant efficiency - int const ScheduledEfficiency(11); // simpel PV, scheduled efficiency - - int const CrystallineSiPVCells(1); - int const AmorphousSiPVCells(2); - - Real64 const MinIrradiance(0.3); // [W/m2] Assume no operation if Ic is below this number (W/m2) - // DERIVED TYPE DEFINITIONS - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // MODULE VARIABLE DECLARATIONS: - int NumPVs(0); // count of number of PV generators - int Num1DiodePVModuleTypes(0); // count for Equivalent one-diode model - int NumSimplePVModuleTypes(0); // count of number of input objs for simple model - int NumSNLPVModuleTypes(0); // count of number of input objs for Sandia model - - Real64 ShuntResistance(0.0); // old "RSH" in common block of trnsys code - - // Object Data - Array1D PVarray; - - - void clear_state() - { - NumPVs = 0; - Num1DiodePVModuleTypes = 0; - NumSimplePVModuleTypes = 0; - NumSNLPVModuleTypes = 0; - - ShuntResistance = 0; - - PVarray.deallocate(); - } - // ___________________________________________________________________________ - - // EnergyPlus V1.2 and beyond include models for photovoltaic calculations called - // Generator:Photovoltaic:Simple and Generator:PV:Sandia implemented by the Center for - // Buildings and Thermal Systems, National Renewable Energy Laboratory, 1617 Cole Blvd - // MS 2722, Golden, CO, 80401 - // EnergyPlus v1.1.1 and beyond includes model for Photovoltaic calculations, now - // referred to as the Generator:PV:Equivalent One-Diode model developed by Thermal Energy - // System Specialists, 2916 Marketplace Drive, Suite 104, Madison, WI 53719; - // Tel: (608) 274-2577 - -} // namespace DataPhotovoltaics - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/DataPhotovoltaics.hh b/src/EnergyPlus/DataPhotovoltaics.hh index 14de562c02f..d8ff52b35aa 100644 --- a/src/EnergyPlus/DataPhotovoltaics.hh +++ b/src/EnergyPlus/DataPhotovoltaics.hh @@ -60,52 +60,38 @@ namespace EnergyPlus { namespace DataPhotovoltaics { - // 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 std::string const cPVGeneratorObjectName; - extern std::string const cPVSimplePerfObjectName; - extern std::string const cPVEquiv1DiodePerfObjectName; - extern std::string const cPVSandiaPerfObjectName; - - extern int const iNotYetSetPVModel; - extern int const iSimplePVModel; - extern int const iTRNSYSPVModel; - extern int const iSandiaPVModel; - - extern int const iNotYetSetCellIntegration; // cell temp method not set - extern int const iDecoupledCellIntegration; // cell temp method based on energy balance - extern int const iDecoupledUllebergDynamicCellIntegration; // cell temp method based on energy bal with capacity - extern int const iSurfaceOutsideFaceCellIntegration; // cell temp method based on coupling to E+'s heat balance - extern int const iTranspiredCollectorCellIntegration; // cell temp method based on coupling to unglazed transpired co - extern int const iExteriorVentedCavityCellIntegration; // cell temp method based on coupling to nat vent exterior cavi - extern int const iPVTSolarCollectorCellIntegration; // cell temp method based on coupling to PVT model - - extern int const FixedEfficiency; // simple PV, constant efficiency - extern int const ScheduledEfficiency; // simpel PV, scheduled efficiency - - extern int const CrystallineSiPVCells; - extern int const AmorphousSiPVCells; - - extern Real64 const MinIrradiance; // [W/m2] Assume no operation if Ic is below this number (W/m2) - // DERIVED TYPE DEFINITIONS - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // MODULE VARIABLE DECLARATIONS: - extern int NumPVs; // count of number of PV generators - extern int Num1DiodePVModuleTypes; // count for Equivalent one-diode model - extern int NumSimplePVModuleTypes; // count of number of input objs for simple model - extern int NumSNLPVModuleTypes; // count of number of input objs for Sandia model + enum class PVModel + { + Unassigned, + Simple, + TRNSYS, + Sandia + }; - extern Real64 ShuntResistance; // old "RSH" in common block of trnsys code + enum class CellIntegration + { + Unassigned, // cell temp method not set + Decoupled, // cell temp method based on energy balance + DecoupledUllebergDynamic, // cell temp method based on energy bal with capacity + SurfaceOutsideFace, // cell temp method based on coupling to E+'s heat balance + TranspiredCollector, // cell temp method based on coupling to unglazed transpired co + ExteriorVentedCavity, // cell temp method based on coupling to nat vent exterior cavi + PVTSolarCollector // cell temp method based on coupling to PVT model + }; + + enum class Efficiency + { + Unassigned, + Fixed, // simple PV, constant efficiency + Scheduled // simpel PV, scheduled efficiency + }; - // Types + enum class SiPVCells + { + Unassigned, + Crystalline, + Amorphous + }; struct SimplePVParamsStruct { @@ -113,12 +99,12 @@ namespace DataPhotovoltaics { std::string Name; // name as identified in Sandia database Real64 AreaCol; // effective area of solar collection Real64 ActiveFraction; // fraction of parent surface that has active solar cells - int EfficencyInputMode; // to schedule or not + Efficiency EfficencyInputMode; // to schedule or not int EffSchedPtr; // index pointer for efficiency schedule Real64 PVEfficiency; // fixed or current PV efficiency // Default Constructor - SimplePVParamsStruct() : AreaCol(0.0), ActiveFraction(0.0), EfficencyInputMode(0), EffSchedPtr(0), PVEfficiency(0.0) + SimplePVParamsStruct() : AreaCol(0.0), ActiveFraction(0.0), EfficencyInputMode(Efficiency::Unassigned), EffSchedPtr(0), PVEfficiency(0.0) { } }; @@ -128,7 +114,7 @@ namespace DataPhotovoltaics { // Members std::string Name; int CellsInSeries; // cells in series [-] - int CellType; // type of PV cell (crystalline, amorphous ) + SiPVCells CellType; // type of PV cell (crystalline, amorphous ) Real64 Area; // module area [m2] Real64 TauAlpha; // tau alpha product at normal incidence [-] Real64 SemiConductorBandgap; // electron bandgap [eV] @@ -149,7 +135,7 @@ namespace DataPhotovoltaics { // Default Constructor TRNSYSPVModuleParamsStruct() - : CellsInSeries(0), CellType(0), Area(0.0), TauAlpha(0.0), SemiConductorBandgap(0.0), ShuntResistance(0.0), RefIsc(0.0), RefVoc(0.0), + : CellsInSeries(0), CellType(SiPVCells::Unassigned), Area(0.0), TauAlpha(0.0), SemiConductorBandgap(0.0), ShuntResistance(0.0), RefIsc(0.0), RefVoc(0.0), RefTemperature(0.0), RefInsolation(0.0), Imp(0.0), Vmp(0.0), TempCoefIsc(0.0), TempCoefVoc(0.0), NOCTAmbTemp(0.0), NOCTCellTemp(0.0), NOCTInsolation(0.0), HeatLossCoef(0.0), HeatCapacity(0.0) { @@ -316,8 +302,8 @@ namespace DataPhotovoltaics { std::string PerfObjName; int SurfacePtr; // index for named surface int Zone; // index for zone (for getting any zone multipliers) - int PVModelType; // type of performance modeling, Simple, TRNSYS or Equivalent 1-diode, or Sandia/King model - int CellIntegrationMode; // how are PV cells integrated with other E+ modeling + PVModel PVModelType; // type of performance modeling, Simple, TRNSYS or Equivalent 1-diode, or Sandia/King model + CellIntegration CellIntegrationMode; // how are PV cells integrated with other E+ modeling Real64 NumModNSeries; // number of modules in series in one string Real64 NumSeriesNParall; // number of series strings in parallel int UTSCPtr; // pointer to UTSC number for INTEGRATED TRANSPIRED COLLECTOR mode @@ -336,24 +322,35 @@ namespace DataPhotovoltaics { // Default Constructor PVArrayStruct() - : SurfacePtr(0), Zone(0), PVModelType(0), CellIntegrationMode(0), NumModNSeries(1.0), NumSeriesNParall(1.0), UTSCPtr(0), ExtVentCavPtr(0), + : SurfacePtr(0), Zone(0), PVModelType(PVModel::Unassigned), CellIntegrationMode(CellIntegration::Unassigned), NumModNSeries(1.0), NumSeriesNParall(1.0), UTSCPtr(0), ExtVentCavPtr(0), PVTPtr(0), SurfaceSink(0.0) { } }; - - // Object Data - extern Array1D PVarray; - - void clear_state(); - } // namespace DataPhotovoltaics struct PhotovoltaicsData : BaseGlobalStruct { + std::string const cPVGeneratorObjectName = "Generator:Photovoltaic"; + std::string const cPVSimplePerfObjectName = "PhotovoltaicPerformance:Simple"; + std::string const cPVEquiv1DiodePerfObjectName = "PhotovoltaicPerformance:EquivalentOne-Diode"; + std::string const cPVSandiaPerfObjectName = "PhotovoltaicPerformance:Sandia"; + Real64 const MinIrradiance = 0.3; // [W/m2] Assume no operation if Ic is below this number (W/m2) + int NumPVs = 0; // count of number of PV generators + int Num1DiodePVModuleTypes = 0; // count for Equivalent one-diode model + int NumSimplePVModuleTypes = 0; // count of number of input objs for simple model + int NumSNLPVModuleTypes = 0; // count of number of input objs for Sandia model + Real64 ShuntResistance = 0.0; // old "RSH" in common block of trnsys code + Array1D PVarray; + void clear_state() override { - + NumPVs = 0; + Num1DiodePVModuleTypes = 0; + NumSimplePVModuleTypes = 0; + NumSNLPVModuleTypes = 0; + ShuntResistance = 0.0; + PVarray.deallocate(); } }; diff --git a/src/EnergyPlus/DualDuct.cc b/src/EnergyPlus/DualDuct.cc index d70dc202c7e..8ce93903f2c 100644 --- a/src/EnergyPlus/DualDuct.cc +++ b/src/EnergyPlus/DualDuct.cc @@ -103,55 +103,6 @@ namespace DualDuct { using namespace DataSizing; using namespace ScheduleManager; - // MODULE PARAMETER DEFINITIONS - int const DualDuct_ConstantVolume(1); - int const DualDuct_VariableVolume(2); - int const DualDuct_OutdoorAir(3); - std::string const cCMO_DDConstantVolume("AirTerminal:DualDuct:ConstantVolume"); - std::string const cCMO_DDVariableVolume("AirTerminal:DualDuct:VAV"); - std::string const cCMO_DDVarVolOA("AirTerminal:DualDuct:VAV:OutdoorAir"); - - int const DD_OA_ConstantOAMode(11); - int const DD_OA_ScheduleOAMode(12); - int const DD_OA_DynamicOAMode(13); - - int const PerPersonModeNotSet(20); - int const PerPersonDCVByCurrentLevel(21); - int const PerPersonByDesignLevel(22); - - // MODULE VARIABLE DECLARATIONS: - Array1D_bool CheckEquipName; - - int NumDDAirTerminal(0); // The Number of Dampers found in the Input //Autodesk Poss used uninitialized in ReportDualDuctConnections - int NumDualDuctConstVolDampers; - int NumDualDuctVarVolDampers; - int NumDualDuctVarVolOA; - Real64 MassFlowSetToler; - bool GetDualDuctInputFlag(true); // Flag set to make sure you get input once - - // Object Data - Array1D dd_airterminal; - std::unordered_map UniqueDualDuctAirTerminalNames; - bool InitDualDuctMyOneTimeFlag(true); - bool ZoneEquipmentListChecked(false); // True after the Zone Equipment List has been checked for items - bool GetDualDuctOutdoorAirRecircUseFirstTimeOnly(true); - - void clear_state() - { - CheckEquipName.clear(); - NumDDAirTerminal = 0; - NumDualDuctConstVolDampers = 0; - NumDualDuctVarVolDampers = 0; - NumDualDuctVarVolOA = 0; - MassFlowSetToler = 0.0; - GetDualDuctInputFlag = true; - dd_airterminal.clear(); - UniqueDualDuctAirTerminalNames.clear(); - InitDualDuctMyOneTimeFlag = true; - ZoneEquipmentListChecked = false; - GetDualDuctOutdoorAirRecircUseFirstTimeOnly = true; - } - void SimulateDualDuct(EnergyPlusData &state, std::string const &CompName, bool const FirstHVACIteration, int const ZoneNum, int const ZoneNodeNum, int &CompIndex) { @@ -174,40 +125,40 @@ namespace DualDuct { // Obtains and Allocates Damper related parameters from input file - if (GetDualDuctInputFlag) { // First time subroutine has been entered + if (state.dataDualDuct->GetDualDuctInputFlag) { // First time subroutine has been entered GetDualDuctInput(state); - GetDualDuctInputFlag = false; + state.dataDualDuct->GetDualDuctInputFlag = false; } // Find the correct DDNumber with the AirLoop & CompNum from AirLoop Derived Type if (CompIndex == 0) { - DDNum = UtilityRoutines::FindItemInList(CompName, dd_airterminal, &DualDuctAirTerminal::Name); + DDNum = UtilityRoutines::FindItemInList(CompName, state.dataDualDuct->dd_airterminal, &DualDuctAirTerminal::Name); if (DDNum == 0) { ShowFatalError(state, "SimulateDualDuct: Damper not found=" + CompName); } CompIndex = DDNum; } else { DDNum = CompIndex; - if (DDNum > NumDDAirTerminal || DDNum < 1) { + if (DDNum > state.dataDualDuct->NumDDAirTerminal || DDNum < 1) { ShowFatalError(state, format("SimulateDualDuct: Invalid CompIndex passed={}, Number of Dampers={}, Damper name={}", CompIndex, - NumDDAirTerminal, + state.dataDualDuct->NumDDAirTerminal, CompName)); } - if (CheckEquipName(DDNum)) { - if (CompName != dd_airterminal(DDNum).Name) { + if (state.dataDualDuct->CheckEquipName(DDNum)) { + if (CompName != state.dataDualDuct->dd_airterminal(DDNum).Name) { ShowFatalError(state, format("SimulateDualDuct: Invalid CompIndex passed={}, Damper name={}, stored Damper Name for that index={}", CompIndex, CompName, - dd_airterminal(DDNum).Name)); + state.dataDualDuct->dd_airterminal(DDNum).Name)); } - CheckEquipName(DDNum) = false; + state.dataDualDuct->CheckEquipName(DDNum) = false; } } - auto &thisDualDuct(dd_airterminal(DDNum)); + auto &thisDualDuct(state.dataDualDuct->dd_airterminal(DDNum)); if (CompIndex > 0) { state.dataSize->CurTermUnitSizingNum = state.dataDefineEquipment->AirDistUnit(thisDualDuct.ADUNum).TermUnitSizingNum; @@ -218,15 +169,15 @@ namespace DualDuct { { auto const SELECT_CASE_var(thisDualDuct.DamperType); - if (SELECT_CASE_var == DualDuct_ConstantVolume) { // 'AirTerminal:DualDuct:ConstantVolume' + if (SELECT_CASE_var == DualDuctDamper::ConstantVolume) { // 'AirTerminal:DualDuct:ConstantVolume' thisDualDuct.SimDualDuctConstVol(state, ZoneNum, ZoneNodeNum); - } else if (SELECT_CASE_var == DualDuct_VariableVolume) { // 'AirTerminal:DualDuct:VAV' + } else if (SELECT_CASE_var == DualDuctDamper::VariableVolume) { // 'AirTerminal:DualDuct:VAV' thisDualDuct.SimDualDuctVarVol(state, ZoneNum, ZoneNodeNum); - } else if (SELECT_CASE_var == DualDuct_OutdoorAir) { + } else if (SELECT_CASE_var == DualDuctDamper::OutdoorAir) { thisDualDuct.SimDualDuctVAVOutdoorAir(state, ZoneNum, ZoneNodeNum); // 'AirTerminal:DualDuct:VAV:OutdoorAir' } @@ -288,19 +239,20 @@ namespace DualDuct { int ADUNum; // loop control to search Air Distribution Units static Real64 DummyOAFlow(0.0); - NumDualDuctConstVolDampers = inputProcessor->getNumObjectsFound(state, cCMO_DDConstantVolume); - NumDualDuctVarVolDampers = inputProcessor->getNumObjectsFound(state, cCMO_DDVariableVolume); - NumDualDuctVarVolOA = inputProcessor->getNumObjectsFound(state, cCMO_DDVarVolOA); - NumDDAirTerminal = NumDualDuctConstVolDampers + NumDualDuctVarVolDampers + NumDualDuctVarVolOA; - dd_airterminal.allocate(NumDDAirTerminal); - UniqueDualDuctAirTerminalNames.reserve(NumDDAirTerminal); - CheckEquipName.dimension(NumDDAirTerminal, true); + state.dataDualDuct->NumDualDuctConstVolDampers = inputProcessor->getNumObjectsFound(state, state.dataDualDuct->cCMO_DDConstantVolume); + state.dataDualDuct->NumDualDuctVarVolDampers = inputProcessor->getNumObjectsFound(state, state.dataDualDuct->cCMO_DDVariableVolume); + state.dataDualDuct->NumDualDuctVarVolOA = inputProcessor->getNumObjectsFound(state, state.dataDualDuct->cCMO_DDVarVolOA); + state.dataDualDuct->NumDDAirTerminal = + state.dataDualDuct->NumDualDuctConstVolDampers + state.dataDualDuct->NumDualDuctVarVolDampers + state.dataDualDuct->NumDualDuctVarVolOA; + state.dataDualDuct->dd_airterminal.allocate(state.dataDualDuct->NumDDAirTerminal); + state.dataDualDuct->UniqueDualDuctAirTerminalNames.reserve(state.dataDualDuct->NumDDAirTerminal); + state.dataDualDuct->CheckEquipName.dimension(state.dataDualDuct->NumDDAirTerminal, true); - if (NumDualDuctConstVolDampers > 0) { - for (DamperIndex = 1; DamperIndex <= NumDualDuctConstVolDampers; ++DamperIndex) { + if (state.dataDualDuct->NumDualDuctConstVolDampers > 0) { + for (DamperIndex = 1; DamperIndex <= state.dataDualDuct->NumDualDuctConstVolDampers; ++DamperIndex) { // Load the info from the damper - CurrentModuleObject = cCMO_DDConstantVolume; + CurrentModuleObject = state.dataDualDuct->cCMO_DDConstantVolume; inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -317,22 +269,24 @@ namespace DualDuct { // Anything below this line in this control block should use DDNum DDNum = DamperIndex; - GlobalNames::VerifyUniqueInterObjectName(state, - UniqueDualDuctAirTerminalNames, AlphArray(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - dd_airterminal(DDNum).Name = AlphArray(1); - dd_airterminal(DDNum).DamperType = DualDuct_ConstantVolume; - dd_airterminal(DDNum).Schedule = AlphArray(2); + GlobalNames::VerifyUniqueInterObjectName(state, state.dataDualDuct->UniqueDualDuctAirTerminalNames, AlphArray(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); + state.dataDualDuct->dd_airterminal(DDNum).Name = AlphArray(1); + state.dataDualDuct->dd_airterminal(DDNum).DamperType = DualDuctDamper::ConstantVolume; + state.dataDualDuct->dd_airterminal(DDNum).Schedule = AlphArray(2); if (lAlphaBlanks(2)) { - dd_airterminal(DDNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDualDuct->dd_airterminal(DDNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - dd_airterminal(DDNum).SchedPtr = GetScheduleIndex(state, AlphArray(2)); - if (dd_airterminal(DDNum).SchedPtr == 0) { - ShowSevereError(state, CurrentModuleObject + ", \"" + dd_airterminal(DDNum).Name + "\" " + cAlphaFields(2) + " = " + AlphArray(2) + + state.dataDualDuct->dd_airterminal(DDNum).SchedPtr = GetScheduleIndex(state, AlphArray(2)); + if (state.dataDualDuct->dd_airterminal(DDNum).SchedPtr == 0) { + ShowSevereError(state, + CurrentModuleObject + ", \"" + state.dataDualDuct->dd_airterminal(DDNum).Name + "\" " + cAlphaFields(2) + + " = " + AlphArray(2) + " not found."); ErrorsFound = true; } } - dd_airterminal(DDNum).OutletNodeNum = GetOnlySingleNode(state, AlphArray(3), + state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum = GetOnlySingleNode(state, + AlphArray(3), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -341,7 +295,8 @@ namespace DualDuct { 1, ObjectIsNotParent, cAlphaFields(3)); - dd_airterminal(DDNum).HotAirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), + state.dataDualDuct->dd_airterminal(DDNum).HotAirInletNodeNum = GetOnlySingleNode(state, + AlphArray(4), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -350,7 +305,8 @@ namespace DualDuct { 1, ObjectIsNotParent, cAlphaFields(4)); - dd_airterminal(DDNum).ColdAirInletNodeNum = GetOnlySingleNode(state, AlphArray(5), + state.dataDualDuct->dd_airterminal(DDNum).ColdAirInletNodeNum = GetOnlySingleNode(state, + AlphArray(5), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -360,35 +316,38 @@ namespace DualDuct { ObjectIsNotParent, cAlphaFields(5)); - dd_airterminal(DDNum).MaxAirVolFlowRate = NumArray(1); - dd_airterminal(DDNum).ZoneMinAirFracDes = 0.0; + state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate = NumArray(1); + state.dataDualDuct->dd_airterminal(DDNum).ZoneMinAirFracDes = 0.0; // Register component set data - one for heat and one for cool - TestCompSet(state, CurrentModuleObject + ":HEAT", dd_airterminal(DDNum).Name, AlphArray(4), AlphArray(3), "Air Nodes"); - TestCompSet(state, CurrentModuleObject + ":COOL", dd_airterminal(DDNum).Name, AlphArray(5), AlphArray(3), "Air Nodes"); + TestCompSet( + state, CurrentModuleObject + ":HEAT", state.dataDualDuct->dd_airterminal(DDNum).Name, AlphArray(4), AlphArray(3), "Air Nodes"); + TestCompSet( + state, CurrentModuleObject + ":COOL", state.dataDualDuct->dd_airterminal(DDNum).Name, AlphArray(5), AlphArray(3), "Air Nodes"); for (ADUNum = 1; ADUNum <= state.dataDefineEquipment->NumAirDistUnits; ++ADUNum) { - if (dd_airterminal(DDNum).OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = dd_airterminal(DDNum).ColdAirInletNodeNum; - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum2 = dd_airterminal(DDNum).HotAirInletNodeNum; - dd_airterminal(DDNum).ADUNum = ADUNum; + if (state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = state.dataDualDuct->dd_airterminal(DDNum).ColdAirInletNodeNum; + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum2 = state.dataDualDuct->dd_airterminal(DDNum).HotAirInletNodeNum; + state.dataDualDuct->dd_airterminal(DDNum).ADUNum = ADUNum; } } // one assumes if there isn't one assigned, it's an error? - if (dd_airterminal(DDNum).ADUNum == 0) { + if (state.dataDualDuct->dd_airterminal(DDNum).ADUNum == 0) { // convenient String - if (dd_airterminal(DDNum).DamperType == DualDuct_ConstantVolume) { + if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::ConstantVolume) { CurrentModuleObject = "ConstantVolume"; - } else if (dd_airterminal(DDNum).DamperType == DualDuct_VariableVolume) { + } else if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::VariableVolume) { CurrentModuleObject = "VAV"; - } else if (dd_airterminal(DDNum).DamperType == DualDuct_OutdoorAir) { + } else if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::OutdoorAir) { CurrentModuleObject = "VAV:OutdoorAir"; } else { CurrentModuleObject = "*invalid*"; } ShowSevereError(state, RoutineName + "No matching List:Zone:AirTerminal for AirTerminal:DualDuct = [" + CurrentModuleObject + ',' + - dd_airterminal(DDNum).Name + "]."); - ShowContinueError(state, "...should have outlet node=" + state.dataLoopNodes->NodeID(dd_airterminal(DDNum).OutletNodeNum)); + state.dataDualDuct->dd_airterminal(DDNum).Name + "]."); + ShowContinueError( + state, "...should have outlet node=" + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum)); ErrorsFound = true; } else { @@ -396,27 +355,34 @@ namespace DualDuct { for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (dd_airterminal(DDNum).OutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum == + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, - state.dataLoopNodes->NodeID(dd_airterminal(DDNum).OutletNodeNum) + + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum) + " already connects to another zone"); - ShowContinueError(state, "Occurs for terminal unit " + CurrentModuleObject + " = " + dd_airterminal(DDNum).Name); + ShowContinueError(state, + "Occurs for terminal unit " + CurrentModuleObject + " = " + + state.dataDualDuct->dd_airterminal(DDNum).Name); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = dd_airterminal(DDNum).ColdAirInletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).InNode = dd_airterminal(DDNum).HotAirInletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = dd_airterminal(DDNum).OutletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).OutNode = dd_airterminal(DDNum).OutletNodeNum; - state.dataDefineEquipment->AirDistUnit(dd_airterminal(DDNum).ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = + state.dataDualDuct->dd_airterminal(DDNum).ColdAirInletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).InNode = + state.dataDualDuct->dd_airterminal(DDNum).HotAirInletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = + state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).OutNode = + state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum; + state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(DDNum).ADUNum).TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(dd_airterminal(DDNum).ADUNum).ZoneEqNum = CtrlZone; + state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(DDNum).ADUNum).ZoneEqNum = CtrlZone; } - dd_airterminal(DDNum).CtrlZoneNum = CtrlZone; - dd_airterminal(DDNum).ActualZoneNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ActualZoneNum; - dd_airterminal(DDNum).CtrlZoneInNodeIndex = SupAirIn; + state.dataDualDuct->dd_airterminal(DDNum).CtrlZoneNum = CtrlZone; + state.dataDualDuct->dd_airterminal(DDNum).ActualZoneNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ActualZoneNum; + state.dataDualDuct->dd_airterminal(DDNum).CtrlZoneInNodeIndex = SupAirIn; } } } @@ -425,25 +391,25 @@ namespace DualDuct { // CurrentModuleObject='AirTerminal:DualDuct:ConstantVolume' SetupOutputVariable(state, "Zone Air Terminal Cold Supply Duct Damper Position", OutputProcessor::Unit::None, - dd_airterminal(DDNum).ColdAirDamperPosition, + state.dataDualDuct->dd_airterminal(DDNum).ColdAirDamperPosition, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); SetupOutputVariable(state, "Zone Air Terminal Hot Supply Duct Damper Position", OutputProcessor::Unit::None, - dd_airterminal(DDNum).HotAirDamperPosition, + state.dataDualDuct->dd_airterminal(DDNum).HotAirDamperPosition, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); } // end Number of Damper Loop } - if (NumDualDuctVarVolDampers > 0) { - for (DamperIndex = 1; DamperIndex <= NumDualDuctVarVolDampers; ++DamperIndex) { + if (state.dataDualDuct->NumDualDuctVarVolDampers > 0) { + for (DamperIndex = 1; DamperIndex <= state.dataDualDuct->NumDualDuctVarVolDampers; ++DamperIndex) { // Load the info from the damper - CurrentModuleObject = cCMO_DDVariableVolume; + CurrentModuleObject = state.dataDualDuct->cCMO_DDVariableVolume; inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -459,23 +425,25 @@ namespace DualDuct { cNumericFields); // Anything below this line in this control block should use DDNum - DDNum = DamperIndex + NumDualDuctConstVolDampers; - GlobalNames::VerifyUniqueInterObjectName(state, - UniqueDualDuctAirTerminalNames, AlphArray(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - dd_airterminal(DDNum).Name = AlphArray(1); - dd_airterminal(DDNum).DamperType = DualDuct_VariableVolume; - dd_airterminal(DDNum).Schedule = AlphArray(2); + DDNum = DamperIndex + state.dataDualDuct->NumDualDuctConstVolDampers; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataDualDuct->UniqueDualDuctAirTerminalNames, AlphArray(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); + state.dataDualDuct->dd_airterminal(DDNum).Name = AlphArray(1); + state.dataDualDuct->dd_airterminal(DDNum).DamperType = DualDuctDamper::VariableVolume; + state.dataDualDuct->dd_airterminal(DDNum).Schedule = AlphArray(2); if (lAlphaBlanks(2)) { - dd_airterminal(DDNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDualDuct->dd_airterminal(DDNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - dd_airterminal(DDNum).SchedPtr = GetScheduleIndex(state, AlphArray(2)); - if (dd_airterminal(DDNum).SchedPtr == 0) { - ShowSevereError(state, CurrentModuleObject + ", \"" + dd_airterminal(DDNum).Name + "\" " + cAlphaFields(2) + " = " + AlphArray(2) + + state.dataDualDuct->dd_airterminal(DDNum).SchedPtr = GetScheduleIndex(state, AlphArray(2)); + if (state.dataDualDuct->dd_airterminal(DDNum).SchedPtr == 0) { + ShowSevereError(state, + CurrentModuleObject + ", \"" + state.dataDualDuct->dd_airterminal(DDNum).Name + "\" " + cAlphaFields(2) + + " = " + AlphArray(2) + " not found."); ErrorsFound = true; } } - dd_airterminal(DDNum).OutletNodeNum = GetOnlySingleNode(state, AlphArray(3), + state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum = GetOnlySingleNode(state, + AlphArray(3), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -484,7 +452,8 @@ namespace DualDuct { 1, ObjectIsNotParent, cAlphaFields(3)); - dd_airterminal(DDNum).HotAirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), + state.dataDualDuct->dd_airterminal(DDNum).HotAirInletNodeNum = GetOnlySingleNode(state, + AlphArray(4), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -493,7 +462,8 @@ namespace DualDuct { 1, ObjectIsNotParent, cAlphaFields(4)); - dd_airterminal(DDNum).ColdAirInletNodeNum = GetOnlySingleNode(state, AlphArray(5), + state.dataDualDuct->dd_airterminal(DDNum).ColdAirInletNodeNum = GetOnlySingleNode(state, + AlphArray(5), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -503,35 +473,36 @@ namespace DualDuct { ObjectIsNotParent, cAlphaFields(5)); - dd_airterminal(DDNum).MaxAirVolFlowRate = NumArray(1); - dd_airterminal(DDNum).ZoneMinAirFracDes = NumArray(2); + state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate = NumArray(1); + state.dataDualDuct->dd_airterminal(DDNum).ZoneMinAirFracDes = NumArray(2); // Register component set data - one for heat and one for cool - TestCompSet(state, CurrentModuleObject + ":HEAT", dd_airterminal(DDNum).Name, AlphArray(4), AlphArray(3), "Air Nodes"); - TestCompSet(state, CurrentModuleObject + ":COOL", dd_airterminal(DDNum).Name, AlphArray(5), AlphArray(3), "Air Nodes"); + TestCompSet(state, CurrentModuleObject + ":HEAT", state.dataDualDuct->dd_airterminal(DDNum).Name, AlphArray(4), AlphArray(3), "Air Nodes"); + TestCompSet(state, CurrentModuleObject + ":COOL", state.dataDualDuct->dd_airterminal(DDNum).Name, AlphArray(5), AlphArray(3), "Air Nodes"); for (ADUNum = 1; ADUNum <= state.dataDefineEquipment->NumAirDistUnits; ++ADUNum) { - if (dd_airterminal(DDNum).OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = dd_airterminal(DDNum).ColdAirInletNodeNum; - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum2 = dd_airterminal(DDNum).HotAirInletNodeNum; - dd_airterminal(DDNum).ADUNum = ADUNum; + if (state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = state.dataDualDuct->dd_airterminal(DDNum).ColdAirInletNodeNum; + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum2 = state.dataDualDuct->dd_airterminal(DDNum).HotAirInletNodeNum; + state.dataDualDuct->dd_airterminal(DDNum).ADUNum = ADUNum; } } // one assumes if there isn't one assigned, it's an error? - if (dd_airterminal(DDNum).ADUNum == 0) { + if (state.dataDualDuct->dd_airterminal(DDNum).ADUNum == 0) { // convenient String - if (dd_airterminal(DDNum).DamperType == DualDuct_ConstantVolume) { + if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::ConstantVolume) { CurrentModuleObject = "ConstantVolume"; - } else if (dd_airterminal(DDNum).DamperType == DualDuct_VariableVolume) { + } else if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::VariableVolume) { CurrentModuleObject = "VAV"; - } else if (dd_airterminal(DDNum).DamperType == DualDuct_OutdoorAir) { + } else if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::OutdoorAir) { CurrentModuleObject = "VAV:OutdoorAir"; } else { CurrentModuleObject = "*invalid*"; } ShowSevereError(state, RoutineName + "No matching List:Zone:AirTerminal for AirTerminal:DualDuct = [" + CurrentModuleObject + ',' + - dd_airterminal(DDNum).Name + "]."); - ShowContinueError(state, "...should have outlet node=" + state.dataLoopNodes->NodeID(dd_airterminal(DDNum).OutletNodeNum)); + state.dataDualDuct->dd_airterminal(DDNum).Name + "]."); + ShowContinueError( + state, "...should have outlet node=" + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum)); ErrorsFound = true; } else { @@ -539,74 +510,78 @@ namespace DualDuct { for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (dd_airterminal(DDNum).OutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = dd_airterminal(DDNum).ColdAirInletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).InNode = dd_airterminal(DDNum).HotAirInletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = dd_airterminal(DDNum).OutletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).OutNode = dd_airterminal(DDNum).OutletNodeNum; - state.dataDefineEquipment->AirDistUnit(dd_airterminal(DDNum).ADUNum).TermUnitSizingNum = + if (state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum == + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = state.dataDualDuct->dd_airterminal(DDNum).ColdAirInletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).InNode = state.dataDualDuct->dd_airterminal(DDNum).HotAirInletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).OutNode = state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum; + state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(DDNum).ADUNum).TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(dd_airterminal(DDNum).ADUNum).ZoneEqNum = CtrlZone; + state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(DDNum).ADUNum).ZoneEqNum = CtrlZone; - dd_airterminal(DDNum).CtrlZoneNum = CtrlZone; - dd_airterminal(DDNum).ActualZoneNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ActualZoneNum; - dd_airterminal(DDNum).CtrlZoneInNodeIndex = SupAirIn; + state.dataDualDuct->dd_airterminal(DDNum).CtrlZoneNum = CtrlZone; + state.dataDualDuct->dd_airterminal(DDNum).ActualZoneNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ActualZoneNum; + state.dataDualDuct->dd_airterminal(DDNum).CtrlZoneInNodeIndex = SupAirIn; } } } } if (!lAlphaBlanks(6)) { - dd_airterminal(DDNum).OARequirementsPtr = UtilityRoutines::FindItemInList(AlphArray(6), state.dataSize->OARequirements); - if (dd_airterminal(DDNum).OARequirementsPtr == 0) { + state.dataDualDuct->dd_airterminal(DDNum).OARequirementsPtr = + UtilityRoutines::FindItemInList(AlphArray(6), state.dataSize->OARequirements); + if (state.dataDualDuct->dd_airterminal(DDNum).OARequirementsPtr == 0) { ShowSevereError(state, cAlphaFields(6) + " = " + AlphArray(6) + " not found."); - ShowContinueError(state, "Occurs in " + cCMO_DDVariableVolume + " = " + dd_airterminal(DDNum).Name); + ShowContinueError( + state, "Occurs in " + state.dataDualDuct->cCMO_DDVariableVolume + " = " + state.dataDualDuct->dd_airterminal(DDNum).Name); ErrorsFound = true; } else { - dd_airterminal(DDNum).NoOAFlowInputFromUser = false; + state.dataDualDuct->dd_airterminal(DDNum).NoOAFlowInputFromUser = false; } } if (lAlphaBlanks(7)) { - dd_airterminal(DDNum).ZoneTurndownMinAirFrac = 1.0; - dd_airterminal(DDNum).ZoneTurndownMinAirFracSchExist = false; + state.dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFrac = 1.0; + state.dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchExist = false; } else { - dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, AlphArray(7)); - if (dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr == 0) { + state.dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, AlphArray(7)); + if (state.dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr == 0) { ShowSevereError(state, cAlphaFields(7) + " = " + AlphArray(7) + " not found."); - ShowContinueError(state, "Occurs in " + cCMO_DDVariableVolume + " = " + dd_airterminal(DDNum).Name); + ShowContinueError( + state, "Occurs in " + state.dataDualDuct->cCMO_DDVariableVolume + " = " + state.dataDualDuct->dd_airterminal(DDNum).Name); ErrorsFound = true; } - dd_airterminal(DDNum).ZoneTurndownMinAirFracSchExist = true; + state.dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchExist = true; } // Setup the Average damper Position output variable // CurrentModuleObject='AirTerminal:DualDuct:VAV' SetupOutputVariable(state, "Zone Air Terminal Cold Supply Duct Damper Position", OutputProcessor::Unit::None, - dd_airterminal(DDNum).ColdAirDamperPosition, + state.dataDualDuct->dd_airterminal(DDNum).ColdAirDamperPosition, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); SetupOutputVariable(state, "Zone Air Terminal Hot Supply Duct Damper Position", OutputProcessor::Unit::None, - dd_airterminal(DDNum).HotAirDamperPosition, + state.dataDualDuct->dd_airterminal(DDNum).HotAirDamperPosition, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); SetupOutputVariable(state, "Zone Air Terminal Outdoor Air Volume Flow Rate", OutputProcessor::Unit::m3_s, - dd_airterminal(DDNum).OutdoorAirFlowRate, + state.dataDualDuct->dd_airterminal(DDNum).OutdoorAirFlowRate, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); } // end Number of Damper Loop } - if (NumDualDuctVarVolOA > 0) { - for (DamperIndex = 1; DamperIndex <= NumDualDuctVarVolOA; ++DamperIndex) { + if (state.dataDualDuct->NumDualDuctVarVolOA > 0) { + for (DamperIndex = 1; DamperIndex <= state.dataDualDuct->NumDualDuctVarVolOA; ++DamperIndex) { // Load the info from the damper - CurrentModuleObject = cCMO_DDVarVolOA; + CurrentModuleObject = state.dataDualDuct->cCMO_DDVarVolOA; inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -622,23 +597,25 @@ namespace DualDuct { cNumericFields); // Anything below this line in this control block should use DDNum - DDNum = DamperIndex + NumDualDuctConstVolDampers + NumDualDuctVarVolDampers; - GlobalNames::VerifyUniqueInterObjectName(state, - UniqueDualDuctAirTerminalNames, AlphArray(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - dd_airterminal(DDNum).Name = AlphArray(1); - dd_airterminal(DDNum).DamperType = DualDuct_OutdoorAir; - dd_airterminal(DDNum).Schedule = AlphArray(2); + DDNum = DamperIndex + state.dataDualDuct->NumDualDuctConstVolDampers + state.dataDualDuct->NumDualDuctVarVolDampers; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataDualDuct->UniqueDualDuctAirTerminalNames, AlphArray(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); + state.dataDualDuct->dd_airterminal(DDNum).Name = AlphArray(1); + state.dataDualDuct->dd_airterminal(DDNum).DamperType = DualDuctDamper::OutdoorAir; + state.dataDualDuct->dd_airterminal(DDNum).Schedule = AlphArray(2); if (lAlphaBlanks(2)) { - dd_airterminal(DDNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDualDuct->dd_airterminal(DDNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - dd_airterminal(DDNum).SchedPtr = GetScheduleIndex(state, AlphArray(2)); - if (dd_airterminal(DDNum).SchedPtr == 0) { - ShowSevereError(state, CurrentModuleObject + ", \"" + dd_airterminal(DDNum).Name + "\" " + cAlphaFields(2) + " = " + AlphArray(2) + + state.dataDualDuct->dd_airterminal(DDNum).SchedPtr = GetScheduleIndex(state, AlphArray(2)); + if (state.dataDualDuct->dd_airterminal(DDNum).SchedPtr == 0) { + ShowSevereError(state, + CurrentModuleObject + ", \"" + state.dataDualDuct->dd_airterminal(DDNum).Name + "\" " + cAlphaFields(2) + + " = " + AlphArray(2) + " not found."); ErrorsFound = true; } } - dd_airterminal(DDNum).OutletNodeNum = GetOnlySingleNode(state, AlphArray(3), + state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum = GetOnlySingleNode(state, + AlphArray(3), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -647,7 +624,8 @@ namespace DualDuct { 1, ObjectIsNotParent, cAlphaFields(3)); - dd_airterminal(DDNum).OAInletNodeNum = GetOnlySingleNode(state, AlphArray(4), + state.dataDualDuct->dd_airterminal(DDNum).OAInletNodeNum = GetOnlySingleNode(state, + AlphArray(4), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -658,7 +636,8 @@ namespace DualDuct { cAlphaFields(4)); if (!lAlphaBlanks(5)) { - dd_airterminal(DDNum).RecircAirInletNodeNum = GetOnlySingleNode(state, AlphArray(5), + state.dataDualDuct->dd_airterminal(DDNum).RecircAirInletNodeNum = GetOnlySingleNode(state, + AlphArray(5), ErrorsFound, CurrentModuleObject, AlphArray(1), @@ -669,51 +648,64 @@ namespace DualDuct { cAlphaFields(5)); } else { // for this model, we intentionally allow not using the recirc side - dd_airterminal(DDNum).RecircIsUsed = false; + state.dataDualDuct->dd_airterminal(DDNum).RecircIsUsed = false; } - dd_airterminal(DDNum).MaxAirVolFlowRate = NumArray(1); - dd_airterminal(DDNum).MaxAirMassFlowRate = dd_airterminal(DDNum).MaxAirVolFlowRate * state.dataEnvrn->StdRhoAir; + state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate = NumArray(1); + state.dataDualDuct->dd_airterminal(DDNum).MaxAirMassFlowRate = + state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate * state.dataEnvrn->StdRhoAir; // Register component set data - one for OA and one for RA - TestCompSet(state, CurrentModuleObject + ":OutdoorAir", dd_airterminal(DDNum).Name, AlphArray(4), AlphArray(3), "Air Nodes"); - if (dd_airterminal(DDNum).RecircIsUsed) { - TestCompSet(state, CurrentModuleObject + ":RecirculatedAir", dd_airterminal(DDNum).Name, AlphArray(5), AlphArray(3), "Air Nodes"); + TestCompSet(state, + CurrentModuleObject + ":OutdoorAir", + state.dataDualDuct->dd_airterminal(DDNum).Name, + AlphArray(4), + AlphArray(3), + "Air Nodes"); + if (state.dataDualDuct->dd_airterminal(DDNum).RecircIsUsed) { + TestCompSet(state, + CurrentModuleObject + ":RecirculatedAir", + state.dataDualDuct->dd_airterminal(DDNum).Name, + AlphArray(5), + AlphArray(3), + "Air Nodes"); } { auto const SELECT_CASE_var(AlphArray(7)); if (SELECT_CASE_var == "CURRENTOCCUPANCY") { - dd_airterminal(DDNum).OAPerPersonMode = PerPersonDCVByCurrentLevel; + state.dataDualDuct->dd_airterminal(DDNum).OAPerPersonMode = PerPersonMode::DCVByCurrentLevel; } else if (SELECT_CASE_var == "DESIGNOCCUPANCY") { - dd_airterminal(DDNum).OAPerPersonMode = PerPersonByDesignLevel; + state.dataDualDuct->dd_airterminal(DDNum).OAPerPersonMode = PerPersonMode::ByDesignLevel; } } // checks on this are done later for (ADUNum = 1; ADUNum <= state.dataDefineEquipment->NumAirDistUnits; ++ADUNum) { - if (dd_airterminal(DDNum).OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = dd_airterminal(DDNum).OAInletNodeNum; - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum2 = dd_airterminal(DDNum).RecircAirInletNodeNum; - dd_airterminal(DDNum).ADUNum = ADUNum; + if (state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = state.dataDualDuct->dd_airterminal(DDNum).OAInletNodeNum; + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum2 = + state.dataDualDuct->dd_airterminal(DDNum).RecircAirInletNodeNum; + state.dataDualDuct->dd_airterminal(DDNum).ADUNum = ADUNum; } } // one assumes if there isn't one assigned, it's an error? - if (dd_airterminal(DDNum).ADUNum == 0) { + if (state.dataDualDuct->dd_airterminal(DDNum).ADUNum == 0) { // convenient String - if (dd_airterminal(DDNum).DamperType == DualDuct_ConstantVolume) { + if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::ConstantVolume) { CurrentModuleObject = "ConstantVolume"; - } else if (dd_airterminal(DDNum).DamperType == DualDuct_VariableVolume) { + } else if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::VariableVolume) { CurrentModuleObject = "VAV"; - } else if (dd_airterminal(DDNum).DamperType == DualDuct_OutdoorAir) { + } else if (state.dataDualDuct->dd_airterminal(DDNum).DamperType == DualDuctDamper::OutdoorAir) { CurrentModuleObject = "VAV:OutdoorAir"; } else { CurrentModuleObject = "*invalid*"; } ShowSevereError(state, RoutineName + "No matching List:Zone:AirTerminal for AirTerminal:DualDuct = [" + CurrentModuleObject + ',' + - dd_airterminal(DDNum).Name + "]."); - ShowContinueError(state, "...should have outlet node=" + state.dataLoopNodes->NodeID(dd_airterminal(DDNum).OutletNodeNum)); + state.dataDualDuct->dd_airterminal(DDNum).Name + "]."); + ShowContinueError( + state, "...should have outlet node=" + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum)); ErrorsFound = true; } else { @@ -721,78 +713,96 @@ namespace DualDuct { for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (dd_airterminal(DDNum).OutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { - if (dd_airterminal(DDNum).RecircIsUsed) { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = dd_airterminal(DDNum).RecircAirInletNodeNum; + if (state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum == + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (state.dataDualDuct->dd_airterminal(DDNum).RecircIsUsed) { + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = + state.dataDualDuct->dd_airterminal(DDNum).RecircAirInletNodeNum; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = dd_airterminal(DDNum).OAInletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = + state.dataDualDuct->dd_airterminal(DDNum).OAInletNodeNum; } - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).InNode = dd_airterminal(DDNum).OAInletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = dd_airterminal(DDNum).OutletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).OutNode = dd_airterminal(DDNum).OutletNodeNum; - state.dataDefineEquipment->AirDistUnit(dd_airterminal(DDNum).ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).InNode = + state.dataDualDuct->dd_airterminal(DDNum).OAInletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = + state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitHeat(SupAirIn).OutNode = + state.dataDualDuct->dd_airterminal(DDNum).OutletNodeNum; + state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(DDNum).ADUNum).TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(dd_airterminal(DDNum).ADUNum).ZoneEqNum = CtrlZone; + state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(DDNum).ADUNum).ZoneEqNum = CtrlZone; - dd_airterminal(DDNum).CtrlZoneNum = CtrlZone; - dd_airterminal(DDNum).ActualZoneNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ActualZoneNum; - dd_airterminal(DDNum).CtrlZoneInNodeIndex = SupAirIn; + state.dataDualDuct->dd_airterminal(DDNum).CtrlZoneNum = CtrlZone; + state.dataDualDuct->dd_airterminal(DDNum).ActualZoneNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ActualZoneNum; + state.dataDualDuct->dd_airterminal(DDNum).CtrlZoneInNodeIndex = SupAirIn; } } } } - dd_airterminal(DDNum).OARequirementsPtr = UtilityRoutines::FindItemInList(AlphArray(6), state.dataSize->OARequirements); - if (dd_airterminal(DDNum).OARequirementsPtr == 0) { + state.dataDualDuct->dd_airterminal(DDNum).OARequirementsPtr = + UtilityRoutines::FindItemInList(AlphArray(6), state.dataSize->OARequirements); + if (state.dataDualDuct->dd_airterminal(DDNum).OARequirementsPtr == 0) { ShowSevereError(state, cAlphaFields(6) + " = " + AlphArray(6) + " not found."); - ShowContinueError(state, "Occurs in " + cCMO_DDVarVolOA + " = " + dd_airterminal(DDNum).Name); + ShowContinueError(state, + "Occurs in " + state.dataDualDuct->cCMO_DDVarVolOA + " = " + state.dataDualDuct->dd_airterminal(DDNum).Name); ErrorsFound = true; } else { - dd_airterminal(DDNum).NoOAFlowInputFromUser = false; + state.dataDualDuct->dd_airterminal(DDNum).NoOAFlowInputFromUser = false; // now fill design OA rate - dd_airterminal(DDNum).CalcOAOnlyMassFlow(state, DummyOAFlow, dd_airterminal(DDNum).DesignOAFlowRate); + state.dataDualDuct->dd_airterminal(DDNum).CalcOAOnlyMassFlow( + state, DummyOAFlow, state.dataDualDuct->dd_airterminal(DDNum).DesignOAFlowRate); - if (dd_airterminal(DDNum).MaxAirVolFlowRate != AutoSize) { + if (state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate != AutoSize) { BaseSizer::reportSizerOutput(state, CurrentModuleObject, - dd_airterminal(DDNum).Name, + state.dataDualDuct->dd_airterminal(DDNum).Name, "Maximum Outdoor Air Flow Rate [m3/s]", - dd_airterminal(DDNum).DesignOAFlowRate); - - if (dd_airterminal(DDNum).RecircIsUsed) { - dd_airterminal(DDNum).DesignRecircFlowRate = - dd_airterminal(DDNum).MaxAirVolFlowRate - dd_airterminal(DDNum).DesignOAFlowRate; - dd_airterminal(DDNum).DesignRecircFlowRate = max(0.0, dd_airterminal(DDNum).DesignRecircFlowRate); + state.dataDualDuct->dd_airterminal(DDNum).DesignOAFlowRate); + + if (state.dataDualDuct->dd_airterminal(DDNum).RecircIsUsed) { + state.dataDualDuct->dd_airterminal(DDNum).DesignRecircFlowRate = + state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate - + state.dataDualDuct->dd_airterminal(DDNum).DesignOAFlowRate; + state.dataDualDuct->dd_airterminal(DDNum).DesignRecircFlowRate = + max(0.0, state.dataDualDuct->dd_airterminal(DDNum).DesignRecircFlowRate); BaseSizer::reportSizerOutput(state, CurrentModuleObject, - dd_airterminal(DDNum).Name, + state.dataDualDuct->dd_airterminal(DDNum).Name, "Maximum Recirculated Air Flow Rate [m3/s]", - dd_airterminal(DDNum).DesignRecircFlowRate); + state.dataDualDuct->dd_airterminal(DDNum).DesignRecircFlowRate); } else { - if (dd_airterminal(DDNum).MaxAirVolFlowRate < dd_airterminal(DDNum).DesignOAFlowRate) { + if (state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate < + state.dataDualDuct->dd_airterminal(DDNum).DesignOAFlowRate) { ShowSevereError(state, format("The value {:.5R} in {}is lower than the outdoor air requirement.", - dd_airterminal(DDNum).MaxAirVolFlowRate, + state.dataDualDuct->dd_airterminal(DDNum).MaxAirVolFlowRate, cNumericFields(1))); - ShowContinueError(state, "Occurs in " + cCMO_DDVarVolOA + " = " + dd_airterminal(DDNum).Name); ShowContinueError(state, - format("The design outdoor air requirement is {:.5R}", dd_airterminal(DDNum).DesignOAFlowRate)); + "Occurs in " + state.dataDualDuct->cCMO_DDVarVolOA + " = " + + state.dataDualDuct->dd_airterminal(DDNum).Name); + ShowContinueError(state, + format("The design outdoor air requirement is {:.5R}", + state.dataDualDuct->dd_airterminal(DDNum).DesignOAFlowRate)); ErrorsFound = true; } } } } - if (dd_airterminal(DDNum).OAPerPersonMode == PerPersonModeNotSet) { - DummyOAFlow = state.dataSize->OARequirements(dd_airterminal(DDNum).OARequirementsPtr).OAFlowPerPerson; + if (state.dataDualDuct->dd_airterminal(DDNum).OAPerPersonMode == PerPersonMode::ModeNotSet) { + DummyOAFlow = state.dataSize->OARequirements(state.dataDualDuct->dd_airterminal(DDNum).OARequirementsPtr).OAFlowPerPerson; if ((DummyOAFlow == 0.0) && (lAlphaBlanks(7))) { // no worries // do nothing, okay since no per person requirement involved } else if ((DummyOAFlow > 0.0) && (lAlphaBlanks(7))) { // missing input ShowSevereError(state, cAlphaFields(7) + " was blank."); - ShowContinueError(state, "Occurs in " + cCMO_DDVarVolOA + " = " + dd_airterminal(DDNum).Name); + ShowContinueError( + state, "Occurs in " + state.dataDualDuct->cCMO_DDVarVolOA + " = " + state.dataDualDuct->dd_airterminal(DDNum).Name); ShowContinueError(state, "Valid choices are \"CurrentOccupancy\" or \"DesignOccupancy\""); ErrorsFound = true; } else if ((DummyOAFlow > 0.0) && !(lAlphaBlanks(7))) { // incorrect input ShowSevereError(state, cAlphaFields(7) + " = " + AlphArray(7) + " not a valid key choice."); - ShowContinueError(state, "Occurs in " + cCMO_DDVarVolOA + " = " + dd_airterminal(DDNum).Name); + ShowContinueError( + state, "Occurs in " + state.dataDualDuct->cCMO_DDVarVolOA + " = " + state.dataDualDuct->dd_airterminal(DDNum).Name); ShowContinueError(state, "Valid choices are \"CurrentOccupancy\" or \"DesignOccupancy\""); ErrorsFound = true; } @@ -801,22 +811,22 @@ namespace DualDuct { // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal Outdoor Air Duct Damper Position", OutputProcessor::Unit::None, - dd_airterminal(DDNum).OADamperPosition, + state.dataDualDuct->dd_airterminal(DDNum).OADamperPosition, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); SetupOutputVariable(state, "Zone Air Terminal Recirculated Air Duct Damper Position", OutputProcessor::Unit::None, - dd_airterminal(DDNum).RecircAirDamperPosition, + state.dataDualDuct->dd_airterminal(DDNum).RecircAirDamperPosition, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); SetupOutputVariable(state, "Zone Air Terminal Outdoor Air Fraction", OutputProcessor::Unit::None, - dd_airterminal(DDNum).OAFraction, + state.dataDualDuct->dd_airterminal(DDNum).OAFraction, "System", "Average", - dd_airterminal(DDNum).Name); + state.dataDualDuct->dd_airterminal(DDNum).Name); } // end Number of Damper Loop } @@ -865,32 +875,35 @@ namespace DualDuct { // Do the Begin Simulation initializations - if (InitDualDuctMyOneTimeFlag) { + if (state.dataDualDuct->InitDualDuctMyOneTimeFlag) { // MyEnvrnFlag.allocate(NumDDAirTerminal); // MySizeFlag.allocate(NumDDAirTerminal); // MyAirLoopFlag.dimension(NumDDAirTerminal, true); // MyEnvrnFlag = true; // MySizeFlag = true; - MassFlowSetToler = DataConvergParams::HVACFlowRateToler * 0.00001; + state.dataDualDuct->MassFlowSetToler = DataConvergParams::HVACFlowRateToler * 0.00001; - InitDualDuctMyOneTimeFlag = false; + state.dataDualDuct->InitDualDuctMyOneTimeFlag = false; } - if (!ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { - ZoneEquipmentListChecked = true; + if (!state.dataDualDuct->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { + state.dataDualDuct->ZoneEquipmentListChecked = true; // Check to see if there is a Air Distribution Unit on the Zone Equipment List - for (Loop = 1; Loop <= NumDDAirTerminal; ++Loop) { + for (Loop = 1; Loop <= state.dataDualDuct->NumDDAirTerminal; ++Loop) { if (this->ADUNum == 0) continue; if (CheckZoneEquipmentList(state, "ZONEHVAC:AIRDISTRIBUTIONUNIT", state.dataDefineEquipment->AirDistUnit(this->ADUNum).Name)) continue; ShowSevereError(state, "InitDualDuct: ADU=[Air Distribution Unit," + state.dataDefineEquipment->AirDistUnit(this->ADUNum).Name + "] is not on any ZoneHVAC:EquipmentList."); - if (this->DamperType == DualDuct_ConstantVolume) { - ShowContinueError(state, "...Dual Duct Damper=[" + cCMO_DDConstantVolume + ',' + this->Name + "] will not be simulated."); - } else if (this->DamperType == DualDuct_VariableVolume) { - ShowContinueError(state, "...Dual Duct Damper=[" + cCMO_DDVariableVolume + ',' + this->Name + "] will not be simulated."); - } else if (this->DamperType == DualDuct_OutdoorAir) { - ShowContinueError(state, "...Dual Duct Damper=[" + cCMO_DDVarVolOA + ',' + this->Name + "] will not be simulated."); + if (this->DamperType == DualDuctDamper::ConstantVolume) { + ShowContinueError( + state, "...Dual Duct Damper=[" + state.dataDualDuct->cCMO_DDConstantVolume + ',' + this->Name + "] will not be simulated."); + } else if (this->DamperType == DualDuctDamper::VariableVolume) { + ShowContinueError( + state, "...Dual Duct Damper=[" + state.dataDualDuct->cCMO_DDVariableVolume + ',' + this->Name + "] will not be simulated."); + } else if (this->DamperType == DualDuctDamper::OutdoorAir) { + ShowContinueError(state, + "...Dual Duct Damper=[" + state.dataDualDuct->cCMO_DDVarVolOA + ',' + this->Name + "] will not be simulated."); } else { ShowContinueError(state, "...Dual Duct Damper=[unknown/invalid," + this->Name + "] will not be simulated."); } @@ -907,14 +920,14 @@ namespace DualDuct { // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && this->MyEnvrnFlag) { - if (this->DamperType == DualDuct_ConstantVolume || this->DamperType == DualDuct_VariableVolume) { + if (this->DamperType == DualDuctDamper::ConstantVolume || this->DamperType == DualDuctDamper::VariableVolume) { OutNode = this->OutletNodeNum; HotInNode = this->HotAirInletNodeNum; ColdInNode = this->ColdAirInletNodeNum; state.dataLoopNodes->Node(OutNode).MassFlowRateMax = this->MaxAirVolFlowRate * state.dataEnvrn->StdRhoAir; - if (this->DamperType == DualDuct_ConstantVolume) { + if (this->DamperType == DualDuctDamper::ConstantVolume) { state.dataLoopNodes->Node(OutNode).MassFlowRateMin = 0.0; - } else if (this->DamperType == DualDuct_VariableVolume) { + } else if (this->DamperType == DualDuctDamper::VariableVolume) { // get dual duct air terminal box minimum flow fraction value if (this->ZoneTurndownMinAirFracSchExist) { this->ZoneTurndownMinAirFrac = ScheduleManager::GetScheduleMinValue(state, this->ZoneTurndownMinAirFracSchPtr); @@ -934,7 +947,7 @@ namespace DualDuct { state.dataLoopNodes->Node(ColdInNode).MassFlowRateMin = 0.0; this->MyEnvrnFlag = false; - } else if (this->DamperType == DualDuct_OutdoorAir) { + } else if (this->DamperType == DualDuctDamper::OutdoorAir) { // Initialize for DualDuct:VAV:OutdoorAir OutNode = this->OutletNodeNum; OAInNode = this->OAInletNodeNum; @@ -983,11 +996,11 @@ namespace DualDuct { } // Initialize the Inlet Nodes of the Sys - if (this->DamperType == DualDuct_ConstantVolume || this->DamperType == DualDuct_VariableVolume) { + if (this->DamperType == DualDuctDamper::ConstantVolume || this->DamperType == DualDuctDamper::VariableVolume) { HotInNode = this->HotAirInletNodeNum; ColdInNode = this->ColdAirInletNodeNum; OutNode = this->OutletNodeNum; - } else if (this->DamperType == DualDuct_OutdoorAir) { + } else if (this->DamperType == DualDuctDamper::OutdoorAir) { OAInNode = this->OAInletNodeNum; if (this->RecircIsUsed) RAInNode = this->RecircAirInletNodeNum; OutNode = this->OutletNodeNum; @@ -997,7 +1010,7 @@ namespace DualDuct { // CALL DisplayString('Init First HVAC Iteration {'//TRIM( dd_airterminal(DDNum)%DamperName)//'}') !-For debugging - REMOVE // The first time through set the mass flow rate to the Max // Take care of the flow rates first. For Const Vol and VAV. - if (this->DamperType == DualDuct_ConstantVolume || this->DamperType == DualDuct_VariableVolume) { + if (this->DamperType == DualDuctDamper::ConstantVolume || this->DamperType == DualDuctDamper::VariableVolume) { if ((state.dataLoopNodes->Node(HotInNode).MassFlowRate > 0.0) && (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { state.dataLoopNodes->Node(HotInNode).MassFlowRate = this->dd_airterminalHotAirInlet.AirMassFlowRateMax; } else { @@ -1041,7 +1054,7 @@ namespace DualDuct { state.dataLoopNodes->Node(ColdInNode).MassFlowRateMinAvail = 0.0; } - } else if (this->DamperType == DualDuct_OutdoorAir) { + } else if (this->DamperType == DualDuctDamper::OutdoorAir) { // The first time through set the mass flow rate to the Max for VAV:OutdoorAir if ((state.dataLoopNodes->Node(OAInNode).MassFlowRate > 0.0) && (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { state.dataLoopNodes->Node(OAInNode).MassFlowRate = this->dd_airterminalOAInlet.AirMassFlowRateMax; @@ -1079,7 +1092,7 @@ namespace DualDuct { } // Initialize the Inlet Nodes of the Dampers for Const. Vol and VAV - if (this->DamperType == DualDuct_ConstantVolume || this->DamperType == DualDuct_VariableVolume) { + if (this->DamperType == DualDuctDamper::ConstantVolume || this->DamperType == DualDuctDamper::VariableVolume) { this->dd_airterminalHotAirInlet.AirMassFlowRateMaxAvail = min(state.dataLoopNodes->Node(OutNode).MassFlowRateMax, state.dataLoopNodes->Node(HotInNode).MassFlowRateMaxAvail); @@ -1105,7 +1118,7 @@ namespace DualDuct { this->dd_airterminalColdAirInlet.AirEnthalpy = state.dataLoopNodes->Node(ColdInNode).Enthalpy; // Initialize the Inlet Nodes of the Dampers for VAV:OutdoorAir - } else if (this->DamperType == DualDuct_OutdoorAir) { + } else if (this->DamperType == DualDuctDamper::OutdoorAir) { this->dd_airterminalOAInlet.AirMassFlowRateMaxAvail = state.dataLoopNodes->Node(OAInNode).MassFlowRateMaxAvail; this->dd_airterminalOAInlet.AirMassFlowRateMinAvail = state.dataLoopNodes->Node(OAInNode).MassFlowRateMinAvail; @@ -1149,19 +1162,19 @@ namespace DualDuct { if (this->MaxAirVolFlowRate == AutoSize) { if ((state.dataSize->CurZoneEqNum > 0) && (state.dataSize->CurTermUnitSizingNum > 0)) { - if (this->DamperType == DualDuct_ConstantVolume) { - DamperType = cCMO_DDConstantVolume; - } else if (this->DamperType == DualDuct_VariableVolume) { - DamperType = cCMO_DDVariableVolume; - } else if (this->DamperType == DualDuct_OutdoorAir) { - DamperType = cCMO_DDVarVolOA; + if (this->DamperType == DualDuctDamper::ConstantVolume) { + DamperType = state.dataDualDuct->cCMO_DDConstantVolume; + } else if (this->DamperType == DualDuctDamper::VariableVolume) { + DamperType = state.dataDualDuct->cCMO_DDVariableVolume; + } else if (this->DamperType == DualDuctDamper::OutdoorAir) { + DamperType = state.dataDualDuct->cCMO_DDVarVolOA; } else { DamperType = "Invalid/Unknown"; } CheckZoneSizing(state, DamperType, this->Name); this->MaxAirVolFlowRate = max(state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesCoolVolFlow, state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesHeatVolFlow); - if (this->DamperType == DualDuct_OutdoorAir) { + if (this->DamperType == DualDuctDamper::OutdoorAir) { if (this->RecircIsUsed) { this->DesignRecircFlowRate = max(state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesCoolVolFlow, state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesHeatVolFlow); @@ -1180,7 +1193,7 @@ namespace DualDuct { this->DesignRecircFlowRate = 0.0; } BaseSizer::reportSizerOutput(state, DamperType, this->Name, "Maximum Air Flow Rate [m3/s]", this->MaxAirVolFlowRate); - if (this->DamperType == DualDuct_OutdoorAir) { + if (this->DamperType == DualDuctDamper::OutdoorAir) { BaseSizer::reportSizerOutput(state, DamperType, this->Name, "Maximum Outdoor Air Flow Rate [m3/s]", this->DesignOAFlowRate); if (this->RecircIsUsed) { BaseSizer::reportSizerOutput(state, DamperType, this->Name, "Maximum Recirculated Air Flow Rate [m3/s]", this->DesignRecircFlowRate); @@ -1512,10 +1525,10 @@ namespace DualDuct { // Using Mass Continuity to determine the other duct flow quantity this->dd_airterminalHotAirInlet.AirMassFlowRate = MassFlow - this->dd_airterminalColdAirInlet.AirMassFlowRate; - if (this->dd_airterminalHotAirInlet.AirMassFlowRate < MassFlowSetToler) { + if (this->dd_airterminalHotAirInlet.AirMassFlowRate < state.dataDualDuct->MassFlowSetToler) { this->dd_airterminalHotAirInlet.AirMassFlowRate = 0.0; this->dd_airterminalColdAirInlet.AirMassFlowRate = MassFlow; - } else if (this->dd_airterminalColdAirInlet.AirMassFlowRate < MassFlowSetToler) { + } else if (this->dd_airterminalColdAirInlet.AirMassFlowRate < state.dataDualDuct->MassFlowSetToler) { this->dd_airterminalColdAirInlet.AirMassFlowRate = 0.0; this->dd_airterminalHotAirInlet.AirMassFlowRate = MassFlow; } @@ -1931,13 +1944,13 @@ namespace DualDuct { return; } - if (this->OAPerPersonMode == PerPersonDCVByCurrentLevel) { + if (this->OAPerPersonMode == PerPersonMode::DCVByCurrentLevel) { UseOccSchFlag = true; PerPersonNotSet = false; } else { UseOccSchFlag = false; PerPersonNotSet = false; - if (this->OAPerPersonMode == PerPersonModeNotSet) PerPersonNotSet = true; + if (this->OAPerPersonMode == PerPersonMode::ModeNotSet) PerPersonNotSet = true; } OAVolumeFlowRate = @@ -1980,7 +1993,7 @@ namespace DualDuct { int OAInletNode; // Outdoor Air Duct Inlet Node - for DualDuctOutdoorAir int RAInletNode; // Recirculated Air Duct Inlet Node - for DualDuctOutdoorAir - if (this->DamperType == DualDuct_ConstantVolume || this->DamperType == DualDuct_VariableVolume) { + if (this->DamperType == DualDuctDamper::ConstantVolume || this->DamperType == DualDuctDamper::VariableVolume) { OutletNode = this->OutletNodeNum; HotInletNode = this->HotAirInletNodeNum; @@ -2025,7 +2038,7 @@ namespace DualDuct { this->CalcOutdoorAirVolumeFlowRate(state); - } else if (this->DamperType == DualDuct_OutdoorAir) { + } else if (this->DamperType == DualDuctDamper::OutdoorAir) { OutletNode = this->OutletNodeNum; OAInletNode = this->OAInletNodeNum; @@ -2146,17 +2159,17 @@ namespace DualDuct { static constexpr auto Format_102("! ,,,,,,"); - if (!allocated(dd_airterminal)) + if (!allocated(state.dataDualDuct->dd_airterminal)) return; // Autodesk Bug: Can arrive here with Damper unallocated (SimulateDualDuct not yet called) with NumDDAirTerminal either set >0 or // uninitialized // Report Dual Duct Dampers to BND File print(state.files.bnd, "{}\n", "! ==============================================================="); print(state.files.bnd, "{}\n", Format_100); - print(state.files.bnd, " #Dual Duct Damper Connections,{}\n", NumDDAirTerminal * 2); + print(state.files.bnd, " #Dual Duct Damper Connections,{}\n", state.dataDualDuct->NumDDAirTerminal * 2); print(state.files.bnd, "{}\n", Format_102); - for (int Count1 = 1; Count1 <= NumDDAirTerminal; ++Count1) { + for (int Count1 = 1; Count1 <= state.dataDualDuct->NumDDAirTerminal; ++Count1) { // Determine if this damper is connected to a supply air path int Found = 0; @@ -2165,10 +2178,10 @@ namespace DualDuct { SupplyAirPathNum = Count2; Found = 0; for (int Count3 = 1; Count3 <= state.dataZoneEquip->SupplyAirPath(Count2).NumOutletNodes; ++Count3) { - if (dd_airterminal(Count1).HotAirInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; - if (dd_airterminal(Count1).ColdAirInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; - if (dd_airterminal(Count1).OAInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; - if (dd_airterminal(Count1).RecircAirInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).HotAirInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).ColdAirInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).OAInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).RecircAirInletNodeNum == state.dataZoneEquip->SupplyAirPath(Count2).OutletNode(Count3)) Found = Count3; } if (Found != 0) break; } @@ -2184,10 +2197,10 @@ namespace DualDuct { if (SupplyAirPathNum != 0) { if (state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).InletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; } else { - if (dd_airterminal(Count1).HotAirInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; - if (dd_airterminal(Count1).ColdAirInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; - if (dd_airterminal(Count1).OAInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; - if (dd_airterminal(Count1).RecircAirInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).HotAirInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).ColdAirInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).OAInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; + if (state.dataDualDuct->dd_airterminal(Count1).RecircAirInletNodeNum == state.dataAirLoop->AirToZoneNodeInfo(Count2).ZoneEquipSupplyNodeNum(Count3)) Found = Count3; } } if (Found != 0) break; @@ -2195,51 +2208,52 @@ namespace DualDuct { if (Found == 0) ChrName = "**Unknown**"; std::string DamperType; - if (dd_airterminal(Count1).DamperType == DualDuct_ConstantVolume) { - DamperType = cCMO_DDConstantVolume; - } else if (dd_airterminal(Count1).DamperType == DualDuct_VariableVolume) { - DamperType = cCMO_DDVariableVolume; - } else if (dd_airterminal(Count1).DamperType == DualDuct_OutdoorAir) { - DamperType = cCMO_DDVarVolOA; + if (state.dataDualDuct->dd_airterminal(Count1).DamperType == DualDuctDamper::ConstantVolume) { + DamperType = state.dataDualDuct->cCMO_DDConstantVolume; + } else if (state.dataDualDuct->dd_airterminal(Count1).DamperType == DualDuctDamper::VariableVolume) { + DamperType = state.dataDualDuct->cCMO_DDVariableVolume; + } else if (state.dataDualDuct->dd_airterminal(Count1).DamperType == DualDuctDamper::OutdoorAir) { + DamperType = state.dataDualDuct->cCMO_DDVarVolOA; } else { DamperType = "Invalid/Unknown"; } - if ((dd_airterminal(Count1).DamperType == DualDuct_ConstantVolume) || (dd_airterminal(Count1).DamperType == DualDuct_VariableVolume)) { + if ((state.dataDualDuct->dd_airterminal(Count1).DamperType == DualDuctDamper::ConstantVolume) || + (state.dataDualDuct->dd_airterminal(Count1).DamperType == DualDuctDamper::VariableVolume)) { print(state.files.bnd, " Dual Duct Damper,{},{},{},{},{},Hot Air,{}\n", Count1, DamperType, - dd_airterminal(Count1).Name, - state.dataLoopNodes->NodeID(dd_airterminal(Count1).HotAirInletNodeNum), - state.dataLoopNodes->NodeID(dd_airterminal(Count1).OutletNodeNum), + state.dataDualDuct->dd_airterminal(Count1).Name, + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).HotAirInletNodeNum), + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).OutletNodeNum), ChrName); print(state.files.bnd, " Dual Duct Damper,{},{},{},{},{},Cold Air,{}\n", Count1, DamperType, - dd_airterminal(Count1).Name, - state.dataLoopNodes->NodeID(dd_airterminal(Count1).ColdAirInletNodeNum), - state.dataLoopNodes->NodeID(dd_airterminal(Count1).OutletNodeNum), + state.dataDualDuct->dd_airterminal(Count1).Name, + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).ColdAirInletNodeNum), + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).OutletNodeNum), ChrName); - } else if (dd_airterminal(Count1).DamperType == DualDuct_OutdoorAir) { + } else if (state.dataDualDuct->dd_airterminal(Count1).DamperType == DualDuctDamper::OutdoorAir) { print(state.files.bnd, "Dual Duct Damper, {},{},{},{},{},Outdoor Air,{}\n", Count1, DamperType, - dd_airterminal(Count1).Name, - state.dataLoopNodes->NodeID(dd_airterminal(Count1).OAInletNodeNum), - state.dataLoopNodes->NodeID(dd_airterminal(Count1).OutletNodeNum), + state.dataDualDuct->dd_airterminal(Count1).Name, + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).OAInletNodeNum), + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).OutletNodeNum), ChrName); print(state.files.bnd, "Dual Duct Damper, {},{},{},{},{},Recirculated Air,{}\n", Count1, DamperType, - dd_airterminal(Count1).Name, - state.dataLoopNodes->NodeID(dd_airterminal(Count1).RecircAirInletNodeNum), - state.dataLoopNodes->NodeID(dd_airterminal(Count1).OutletNodeNum), + state.dataDualDuct->dd_airterminal(Count1).Name, + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).RecircAirInletNodeNum), + state.dataLoopNodes->NodeID(state.dataDualDuct->dd_airterminal(Count1).OutletNodeNum), ChrName); } } @@ -2283,14 +2297,14 @@ namespace DualDuct { // GetDualDuctInputFlag=.FALSE. // END IF - if (GetDualDuctOutdoorAirRecircUseFirstTimeOnly) { - NumDualDuctVarVolOA = inputProcessor->getNumObjectsFound(state, cCMO_DDVarVolOA); - RecircIsUsedARR.allocate(NumDualDuctVarVolOA); - DamperNamesARR.allocate(NumDualDuctVarVolOA); - if (NumDualDuctVarVolOA > 0) { - for (DamperIndex = 1; DamperIndex <= NumDualDuctVarVolOA; ++DamperIndex) { + if (state.dataDualDuct->GetDualDuctOutdoorAirRecircUseFirstTimeOnly) { + state.dataDualDuct->NumDualDuctVarVolOA = inputProcessor->getNumObjectsFound(state, state.dataDualDuct->cCMO_DDVarVolOA); + RecircIsUsedARR.allocate(state.dataDualDuct->NumDualDuctVarVolOA); + DamperNamesARR.allocate(state.dataDualDuct->NumDualDuctVarVolOA); + if (state.dataDualDuct->NumDualDuctVarVolOA > 0) { + for (DamperIndex = 1; DamperIndex <= state.dataDualDuct->NumDualDuctVarVolOA; ++DamperIndex) { - CurrentModuleObject = cCMO_DDVarVolOA; + CurrentModuleObject = state.dataDualDuct->cCMO_DDVarVolOA; inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -2312,10 +2326,10 @@ namespace DualDuct { } } } - GetDualDuctOutdoorAirRecircUseFirstTimeOnly = false; + state.dataDualDuct->GetDualDuctOutdoorAirRecircUseFirstTimeOnly = false; } - DamperIndex = UtilityRoutines::FindItemInList(CompName, DamperNamesARR, NumDualDuctVarVolOA); + DamperIndex = UtilityRoutines::FindItemInList(CompName, DamperNamesARR, state.dataDualDuct->NumDualDuctVarVolOA); if (DamperIndex > 0) { RecircIsUsed = RecircIsUsedARR(DamperIndex); } diff --git a/src/EnergyPlus/DualDuct.hh b/src/EnergyPlus/DualDuct.hh index 4948f41b8ac..4468e977b4b 100644 --- a/src/EnergyPlus/DualDuct.hh +++ b/src/EnergyPlus/DualDuct.hh @@ -68,47 +68,33 @@ namespace DualDuct { // Data // MODULE PARAMETER DEFINITIONS - extern int const DualDuct_ConstantVolume; - extern int const DualDuct_VariableVolume; - extern int const DualDuct_OutdoorAir; - extern std::string const cCMO_DDConstantVolume; - extern std::string const cCMO_DDVariableVolume; - extern std::string const cCMO_DDVarVolOA; + enum class DualDuctDamper + { + Unassigned, + ConstantVolume, + VariableVolume, + OutdoorAir + }; - extern int const DD_OA_ConstantOAMode; - extern int const DD_OA_ScheduleOAMode; - extern int const DD_OA_DynamicOAMode; + enum class DualDuctOAMode + { + Unassigned, + ConstantOAMode = 11, + ScheduleOAMode = 12, + DynamicOAMode = 13 + }; - extern int const PerPersonModeNotSet; - extern int const PerPersonDCVByCurrentLevel; - extern int const PerPersonByDesignLevel; + enum class PerPersonMode + { + ModeNotSet = 20, + DCVByCurrentLevel = 21, + ByDesignLevel = 22 + }; // DERIVED TYPE DEFINITIONS // MODULE VARIABLE DECLARATIONS: - extern Array1D_bool CheckEquipName; - - extern int NumDDAirTerminal; // The Number of dual duct air terminals found in the Input - extern int NumDualDuctConstVolDampers; - extern int NumDualDuctVarVolDampers; - extern int NumDualDuctVarVolOA; - extern Real64 MassFlowSetToler; - extern bool GetDualDuctInputFlag; // Flag set to make sure you get input once - - // 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 - - // Types struct DualDuctAirTerminalFlowConditions { @@ -137,7 +123,7 @@ namespace DualDuct { { // Members std::string Name; // Name of the Damper - int DamperType; // Type of Damper ie. VAV, Mixing, Inducing, etc. + DualDuctDamper DamperType; // Type of Damper ie. VAV, Mixing, Inducing, etc. std::string Schedule; // Damper Operation Schedule int SchedPtr; // Pointer to the correct schedule Real64 MaxAirVolFlowRate; // Max Specified Volume Flow Rate of Damper [m3/sec] @@ -165,7 +151,7 @@ namespace DualDuct { Real64 OutdoorAirFlowRate; // report variable for TU outdoor air flow rate bool NoOAFlowInputFromUser; // avoids OA calculation if no input specified by user int OARequirementsPtr; // - Index to DesignSpecification:OutdoorAir object - int OAPerPersonMode; // mode for how per person rates are determined, DCV or design. + PerPersonMode OAPerPersonMode; // mode for how per person rates are determined, DCV or design. Real64 OAPerPersonByDesignLevel; // store sum of people and per person rate, constant, m3/s int AirLoopNum; // index to airloop that this terminal unit is connected to int ZoneTurndownMinAirFracSchPtr; // pointer to the schedule for turndown minimum airflow fraction @@ -182,11 +168,11 @@ namespace DualDuct { // Default Constructor DualDuctAirTerminal() - : DamperType(0), SchedPtr(0), MaxAirVolFlowRate(0.0), MaxAirMassFlowRate(0.0), HotAirInletNodeNum(0), ColdAirInletNodeNum(0), + : DamperType(DualDuctDamper::Unassigned), SchedPtr(0), MaxAirVolFlowRate(0.0), MaxAirMassFlowRate(0.0), HotAirInletNodeNum(0), ColdAirInletNodeNum(0), OutletNodeNum(0), ZoneMinAirFracDes(0.0), ZoneMinAirFrac(0.0), ColdAirDamperPosition(0.0), HotAirDamperPosition(0.0), OAInletNodeNum(0), RecircAirInletNodeNum(0), RecircIsUsed(true), DesignOAFlowRate(0.0), DesignRecircFlowRate(0.0), OAControlMode(0), RecircAirDamperPosition(0.0), OADamperPosition(0.0), OAFraction(0.0), ADUNum(0), CtrlZoneNum(0), CtrlZoneInNodeIndex(0), - ActualZoneNum(0), OutdoorAirFlowRate(0.0), NoOAFlowInputFromUser(true), OARequirementsPtr(0), OAPerPersonMode(PerPersonModeNotSet), + ActualZoneNum(0), OutdoorAirFlowRate(0.0), NoOAFlowInputFromUser(true), OARequirementsPtr(0), OAPerPersonMode(PerPersonMode::ModeNotSet), OAPerPersonByDesignLevel(0.0), AirLoopNum(0), ZoneTurndownMinAirFracSchPtr(0), ZoneTurndownMinAirFrac(1.0), ZoneTurndownMinAirFracSchExist(false), MyEnvrnFlag(true), MySizeFlag(true), MyAirLoopFlag(true) { @@ -238,9 +224,6 @@ namespace DualDuct { }; - // Object Data - extern Array1D dd_airterminal; - // Functions void SimulateDualDuct(EnergyPlusData &state, std::string const &CompName, bool const FirstHVACIteration, int const ZoneNum, int const ZoneNodeNum, int &CompIndex); @@ -262,15 +245,42 @@ namespace DualDuct { // Clears the global data in DualDuct. // Needed for unit tests, should not be normally called. - void clear_state(); } // namespace DualDuct struct DualDuctData : BaseGlobalStruct { + Array1D_bool CheckEquipName; + int NumDDAirTerminal = 0; // The Number of Dampers found in the Input //Autodesk Poss used uninitialized in ReportDualDuctConnections + int NumDualDuctConstVolDampers = 0; + int NumDualDuctVarVolDampers = 0; + int NumDualDuctVarVolOA = 0; + Real64 MassFlowSetToler = 0.0; + bool GetDualDuctInputFlag = true; // Flag set to make sure you get input once + Array1D dd_airterminal; + std::unordered_map UniqueDualDuctAirTerminalNames; + bool InitDualDuctMyOneTimeFlag = true; + bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items + bool GetDualDuctOutdoorAirRecircUseFirstTimeOnly = true; + + std::string const cCMO_DDConstantVolume = "AirTerminal:DualDuct:ConstantVolume"; + std::string const cCMO_DDVariableVolume = "AirTerminal:DualDuct:VAV"; + std::string const cCMO_DDVarVolOA = "AirTerminal:DualDuct:VAV:OutdoorAir"; + void clear_state() override { - + this->CheckEquipName.clear(); + this->NumDDAirTerminal = 0; + this->NumDualDuctConstVolDampers = 0; + this->NumDualDuctVarVolDampers = 0; + this->NumDualDuctVarVolOA = 0; + this->MassFlowSetToler = 0.0; + this->GetDualDuctInputFlag = true; + this->dd_airterminal.clear(); + this->UniqueDualDuctAirTerminalNames.clear(); + this->InitDualDuctMyOneTimeFlag = true; + this->ZoneEquipmentListChecked = false; + this->GetDualDuctOutdoorAirRecircUseFirstTimeOnly = true; } }; diff --git a/src/EnergyPlus/ElectricPowerServiceManager.cc b/src/EnergyPlus/ElectricPowerServiceManager.cc index efdd5288fd2..2194ea649d0 100644 --- a/src/EnergyPlus/ElectricPowerServiceManager.cc +++ b/src/EnergyPlus/ElectricPowerServiceManager.cc @@ -2144,7 +2144,7 @@ void GeneratorController::simGeneratorGetPowerOutput(EnergyPlusData &state, case GeneratorType::PV: { Photovoltaics::SimPVGenerator(state, GeneratorType::PV, name, generatorIndex, runFlag, myElecLoadRequest); Photovoltaics::GetPVGeneratorResults( - GeneratorType::PV, generatorIndex, dCElectProdRate, dCElectricityProd, thermProdRate, thermalProd); + state, GeneratorType::PV, generatorIndex, dCElectProdRate, dCElectricityProd, thermProdRate, thermalProd); electricPowerOutput = dCElectProdRate; thermalPowerOutput = thermProdRate; break; diff --git a/src/EnergyPlus/FaultsManager.cc b/src/EnergyPlus/FaultsManager.cc index 2b6299102a2..cb33e42be14 100644 --- a/src/EnergyPlus/FaultsManager.cc +++ b/src/EnergyPlus/FaultsManager.cc @@ -804,20 +804,21 @@ namespace FaultsManager { UtilityRoutines::SameString(SELECT_CASE_VAR, "Coil:Heating:Fuel") || UtilityRoutines::SameString(SELECT_CASE_VAR, "Coil:Heating:Desuperheater")) { // Read in coil input if not done yet - if (HeatingCoils::GetCoilsInputFlag) { + if (state.dataHeatingCoils->GetCoilsInputFlag) { HeatingCoils::GetHeatingCoilInput(state); - HeatingCoils::GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } // Check the coil name and coil type - int CoilNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName, HeatingCoils::HeatingCoil); + int CoilNum = UtilityRoutines::FindItemInList(state.dataFaultsMgr->FaultsCoilSATSensor(jFault_CoilSAT).CoilName, + state.dataHeatingCoils->HeatingCoil); if (CoilNum <= 0) { ShowSevereError(state, cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" + cAlphaArgs(5) + "\" not found."); state.dataFaultsMgr->ErrorsFound = true; } else { // Link the coil with the fault model - HeatingCoils::HeatingCoil(CoilNum).FaultyCoilSATFlag = true; - HeatingCoils::HeatingCoil(CoilNum).FaultyCoilSATIndex = jFault_CoilSAT; + state.dataHeatingCoils->HeatingCoil(CoilNum).FaultyCoilSATFlag = true; + state.dataHeatingCoils->HeatingCoil(CoilNum).FaultyCoilSATIndex = jFault_CoilSAT; } } else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "Coil:Heating:Steam")) { diff --git a/src/EnergyPlus/HeatingCoils.cc b/src/EnergyPlus/HeatingCoils.cc index ceea1a4e70b..366353875f1 100644 --- a/src/EnergyPlus/HeatingCoils.cc +++ b/src/EnergyPlus/HeatingCoils.cc @@ -121,59 +121,6 @@ namespace HeatingCoils { using DXCoils::GetDXCoilIndex; using RefrigeratedCase::GetRefrigeratedRackIndex; - // Data - // MODULE PARAMETER DEFINITIONS - Real64 const MinAirMassFlow(0.001); - int NumDesuperheaterCoil; // Total number of desuperheater heating coil objects in input - int NumElecCoil; - int NumElecCoilMultiStage; - int NumFuelCoil; - int NumGasCoilMultiStage; - - // reclaim heat object types - int const COMPRESSORRACK_REFRIGERATEDCASE(1); - int const COIL_DX_COOLING(2); // single speed DX - int const COIL_DX_MULTISPEED(3); - int const COIL_DX_MULTIMODE(4); - int const CONDENSER_REFRIGERATION(5); - int const COIL_DX_VARIABLE_COOLING(6); - - // DERIVED TYPE DEFINITIONS - - // MODULE VARIABLE DECLARATIONS: - int NumHeatingCoils(0); // The Number of HeatingCoils found in the Input - Array1D_bool MySizeFlag; - Array1D_bool ValidSourceType; // Used to determine if a source for a desuperheater heating coil is valid - bool GetCoilsInputFlag(true); // Flag set to make sure you get input once - bool CoilIsSuppHeater(false); // Flag set to indicate the heating coil is a supplemental heater - bool MyOneTimeFlag(true); // one time initialization flag - Array1D_bool CheckEquipName; - bool InputErrorsFound(false); - - // 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 HeatingCoil; - Array1D HeatingCoilNumericFields; - - // MODULE SUBROUTINES: - //************************************************************************* - - // Functions - void SimulateHeatingCoilComponents(EnergyPlusData &state, std::string const &CompName, bool const FirstHVACIteration, @@ -212,38 +159,38 @@ namespace HeatingCoils { // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } // Find the correct HeatingCoilNumber with the Coil Name if (present(CompIndex)) { if (CompIndex == 0) { - CoilNum = UtilityRoutines::FindItemInList(CompName, HeatingCoil); + CoilNum = UtilityRoutines::FindItemInList(CompName, state.dataHeatingCoils->HeatingCoil); if (CoilNum == 0) { ShowFatalError(state, "SimulateHeatingCoilComponents: Coil not found=" + CompName); } // CompIndex=CoilNum } else { CoilNum = CompIndex; - if (CoilNum > NumHeatingCoils || CoilNum < 1) { + if (CoilNum > state.dataHeatingCoils->NumHeatingCoils || CoilNum < 1) { ShowFatalError(state, format("SimulateHeatingCoilComponents: Invalid CompIndex passed={}, Number of Heating Coils={}, Coil name={}", CoilNum, - NumHeatingCoils, + state.dataHeatingCoils->NumHeatingCoils, CompName)); } - if (CheckEquipName(CoilNum)) { - if (!CompName.empty() && CompName != HeatingCoil(CoilNum).Name) { + if (state.dataHeatingCoils->CheckEquipName(CoilNum)) { + if (!CompName.empty() && CompName != state.dataHeatingCoils->HeatingCoil(CoilNum).Name) { ShowFatalError( state, format("SimulateHeatingCoilComponents: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", CoilNum, CompName, - HeatingCoil(CoilNum).Name)); + state.dataHeatingCoils->HeatingCoil(CoilNum).Name)); } - CheckEquipName(CoilNum) = false; + state.dataHeatingCoils->CheckEquipName(CoilNum) = false; } } } else { @@ -253,9 +200,9 @@ namespace HeatingCoils { } if (present(SuppHeat)) { - CoilIsSuppHeater = SuppHeat; + state.dataHeatingCoils->CoilIsSuppHeater = SuppHeat; } else { - CoilIsSuppHeater = false; + state.dataHeatingCoils->CoilIsSuppHeater = false; } if (present(FanOpMode)) { @@ -280,24 +227,24 @@ namespace HeatingCoils { InitHeatingCoil(state, CoilNum, FirstHVACIteration, QCoilRequired); // Initialize all HeatingCoil related parameters // Calculate the Correct HeatingCoil Model with the current CoilNum - if (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingElectric) { + if (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingElectric) { CalcElectricHeatingCoil(state, CoilNum, QCoilRequired, QCoilActual2, OpMode, PartLoadFrac); - } else if (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingElectric_MultiStage) { + } else if (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingElectric_MultiStage) { CalcMultiStageElectricHeatingCoil(state, CoilNum, SpeedRatio, PartLoadRatio, StageNum, OpMode); // Autodesk:OPTIONAL SpeedRatio, PartLoadRatio, StageNum used without PRESENT check - } else if (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingGasOrOtherFuel) { + } else if (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingGasOrOtherFuel) { CalcFuelHeatingCoil(state, CoilNum, QCoilRequired, QCoilActual2, OpMode, PartLoadFrac); - } else if (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingGas_MultiStage) { + } else if (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingGas_MultiStage) { CalcMultiStageGasHeatingCoil(state, CoilNum, SpeedRatio, PartLoadRatio, StageNum, OpMode); // Autodesk:OPTIONAL SpeedRatio, PartLoadRatio, StageNum used without PRESENT check - } else if (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingDesuperheater) { + } else if (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingDesuperheater) { CalcDesuperheaterHeatingCoil(state, CoilNum, QCoilRequired, QCoilActual2); } else { QCoilActual2 = 0.0; @@ -307,7 +254,7 @@ namespace HeatingCoils { UpdateHeatingCoil(state, CoilNum); // Report the current HeatingCoil - ReportHeatingCoil(state, CoilNum, CoilIsSuppHeater); + ReportHeatingCoil(state, CoilNum, state.dataHeatingCoils->CoilIsSuppHeater); if (present(QCoilActual)) { QCoilActual = QCoilActual2; @@ -355,10 +302,6 @@ namespace HeatingCoils { Array1D Numbers; // Numeric input items for object Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. - static int MaxNums(0); // Maximum number of numeric input fields - static int MaxAlphas(0); // Maximum number of alpha input fields - static int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a - // certain object in the input file int NumAlphas; int NumNums; int IOStat; @@ -366,44 +309,49 @@ namespace HeatingCoils { bool DXCoilErrFlag; // Used in GetDXCoil mining functions bool errFlag; - NumElecCoil = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Electric"); - NumElecCoilMultiStage = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Electric:MultiStage"); - NumFuelCoil = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Fuel"); - NumGasCoilMultiStage = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Gas:MultiStage"); - NumDesuperheaterCoil = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Desuperheater"); - NumHeatingCoils = NumElecCoil + NumElecCoilMultiStage + NumFuelCoil + NumGasCoilMultiStage + NumDesuperheaterCoil; - if (NumHeatingCoils > 0) { - HeatingCoil.allocate(NumHeatingCoils); - HeatingCoilNumericFields.allocate(NumHeatingCoils); - ValidSourceType.dimension(NumHeatingCoils, false); - CheckEquipName.dimension(NumHeatingCoils, true); - } - - inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Electric", TotalArgs, NumAlphas, NumNums); - MaxNums = max(MaxNums, NumNums); - MaxAlphas = max(MaxAlphas, NumAlphas); - inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Electric:MultiStage", TotalArgs, NumAlphas, NumNums); - MaxNums = max(MaxNums, NumNums); - MaxAlphas = max(MaxAlphas, NumAlphas); - inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Fuel", TotalArgs, NumAlphas, NumNums); - MaxNums = max(MaxNums, NumNums); - MaxAlphas = max(MaxAlphas, NumAlphas); - inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Gas:MultiStage", TotalArgs, NumAlphas, NumNums); - MaxNums = max(MaxNums, NumNums); - MaxAlphas = max(MaxAlphas, NumAlphas); - inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Desuperheater", TotalArgs, NumAlphas, NumNums); - MaxNums = max(MaxNums, NumNums); - MaxAlphas = max(MaxAlphas, NumAlphas); - - Alphas.allocate(MaxAlphas); - cAlphaFields.allocate(MaxAlphas); - cNumericFields.allocate(MaxNums); - Numbers.dimension(MaxNums, 0.0); - lAlphaBlanks.dimension(MaxAlphas, true); - lNumericBlanks.dimension(MaxNums, true); + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); + + state.dataHeatingCoils->NumElecCoil = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Electric"); + state.dataHeatingCoils->NumElecCoilMultiStage = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Electric:MultiStage"); + state.dataHeatingCoils->NumFuelCoil = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Fuel"); + state.dataHeatingCoils->NumGasCoilMultiStage = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Gas:MultiStage"); + state.dataHeatingCoils->NumDesuperheaterCoil = inputProcessor->getNumObjectsFound(state, "Coil:Heating:Desuperheater"); + state.dataHeatingCoils->NumHeatingCoils = state.dataHeatingCoils->NumElecCoil + state.dataHeatingCoils->NumElecCoilMultiStage + + state.dataHeatingCoils->NumFuelCoil + + state.dataHeatingCoils->NumGasCoilMultiStage + + state.dataHeatingCoils->NumDesuperheaterCoil; + if (state.dataHeatingCoils->NumHeatingCoils > 0) { + HeatingCoil.allocate(state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->HeatingCoilNumericFields.allocate(state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->ValidSourceType.dimension(state.dataHeatingCoils->NumHeatingCoils, false); + state.dataHeatingCoils->CheckEquipName.dimension(state.dataHeatingCoils->NumHeatingCoils, true); + } + + inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Electric", state.dataHeatingCoils->TotalArgs, NumAlphas, NumNums); + state.dataHeatingCoils->MaxNums = max(state.dataHeatingCoils->MaxNums, NumNums); + state.dataHeatingCoils->MaxAlphas = max(state.dataHeatingCoils->MaxAlphas, NumAlphas); + inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Electric:MultiStage", state.dataHeatingCoils->TotalArgs, NumAlphas, NumNums); + state.dataHeatingCoils->MaxNums = max(state.dataHeatingCoils->MaxNums, NumNums); + state.dataHeatingCoils->MaxAlphas = max(state.dataHeatingCoils->MaxAlphas, NumAlphas); + inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Fuel", state.dataHeatingCoils->TotalArgs, NumAlphas, NumNums); + state.dataHeatingCoils->MaxNums = max(state.dataHeatingCoils->MaxNums, NumNums); + state.dataHeatingCoils->MaxAlphas = max(state.dataHeatingCoils->MaxAlphas, NumAlphas); + inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Gas:MultiStage", state.dataHeatingCoils->TotalArgs, NumAlphas, NumNums); + state.dataHeatingCoils->MaxNums = max(state.dataHeatingCoils->MaxNums, NumNums); + state.dataHeatingCoils->MaxAlphas = max(state.dataHeatingCoils->MaxAlphas, NumAlphas); + inputProcessor->getObjectDefMaxArgs(state, "Coil:Heating:Desuperheater", state.dataHeatingCoils->TotalArgs, NumAlphas, NumNums); + state.dataHeatingCoils->MaxNums = max(state.dataHeatingCoils->MaxNums, NumNums); + state.dataHeatingCoils->MaxAlphas = max(state.dataHeatingCoils->MaxAlphas, NumAlphas); + + Alphas.allocate(state.dataHeatingCoils->MaxAlphas); + cAlphaFields.allocate(state.dataHeatingCoils->MaxAlphas); + cNumericFields.allocate(state.dataHeatingCoils->MaxNums); + Numbers.dimension(state.dataHeatingCoils->MaxNums, 0.0); + lAlphaBlanks.dimension(state.dataHeatingCoils->MaxAlphas, true); + lNumericBlanks.dimension(state.dataHeatingCoils->MaxNums, true); // Get the data for electric heating coils - for (ElecCoilNum = 1; ElecCoilNum <= NumElecCoil; ++ElecCoilNum) { + for (ElecCoilNum = 1; ElecCoilNum <= state.dataHeatingCoils->NumElecCoil; ++ElecCoilNum) { CoilNum = ElecCoilNum; @@ -423,14 +371,14 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); - HeatingCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); - HeatingCoilNumericFields(CoilNum).FieldNames = ""; - HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames.allocate(state.dataHeatingCoils->MaxNums); + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = ""; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; - UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, InputErrorsFound); + UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, state.dataHeatingCoils->InputErrorsFound); // InputErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), InputErrorsFound, CurrentModuleObject + " Name"); + VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); HeatingCoil(CoilNum).Name = Alphas(1); HeatingCoil(CoilNum).Schedule = Alphas(2); @@ -441,7 +389,7 @@ namespace HeatingCoils { if (HeatingCoil(CoilNum).SchedPtr == 0) { ShowSevereError(state, RoutineName + CurrentModuleObject + ": Invalid " + cAlphaFields(2) + " entered =" + Alphas(2) + " for " + cAlphaFields(1) + '=' + Alphas(1)); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } @@ -454,18 +402,18 @@ namespace HeatingCoils { errFlag = false; HeatingCoil(CoilNum).AirInletNodeNum = GetOnlySingleNode(state, Alphas(3), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Inlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; errFlag = false; HeatingCoil(CoilNum).AirOutletNodeNum = GetOnlySingleNode(state, Alphas(4), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Outlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); errFlag = false; HeatingCoil(CoilNum).TempSetPointNodeNum = GetOnlySingleNode(state, Alphas(5), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Sensor, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; // Setup Report variables for the Electric Coils // CurrentModuleObject = "Coil:Heating:Electric" @@ -506,9 +454,9 @@ namespace HeatingCoils { } // Get the data for electric heating coils - for (ElecCoilNum = 1; ElecCoilNum <= NumElecCoilMultiStage; ++ElecCoilNum) { + for (ElecCoilNum = 1; ElecCoilNum <= state.dataHeatingCoils->NumElecCoilMultiStage; ++ElecCoilNum) { - CoilNum = NumElecCoil + ElecCoilNum; + CoilNum = state.dataHeatingCoils->NumElecCoil + ElecCoilNum; CurrentModuleObject = "Coil:Heating:Electric:MultiStage"; HeatingCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Electricity; @@ -526,13 +474,13 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); - HeatingCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); - HeatingCoilNumericFields(CoilNum).FieldNames = ""; - HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames.allocate(state.dataHeatingCoils->MaxNums); + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = ""; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; - UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, InputErrorsFound); + UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, state.dataHeatingCoils->InputErrorsFound); // InputErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), InputErrorsFound, CurrentModuleObject + " Name"); + VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); HeatingCoil(CoilNum).Name = Alphas(1); HeatingCoil(CoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -542,7 +490,7 @@ namespace HeatingCoils { if (HeatingCoil(CoilNum).SchedPtr == 0) { ShowSevereError(state, RoutineName + CurrentModuleObject + ": Invalid " + cAlphaFields(2) + " entered =" + Alphas(2) + " for " + cAlphaFields(1) + '=' + Alphas(1)); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } @@ -564,18 +512,18 @@ namespace HeatingCoils { errFlag = false; HeatingCoil(CoilNum).AirInletNodeNum = GetOnlySingleNode(state, Alphas(3), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Inlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; errFlag = false; HeatingCoil(CoilNum).AirOutletNodeNum = GetOnlySingleNode(state, Alphas(4), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Outlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); errFlag = false; HeatingCoil(CoilNum).TempSetPointNodeNum = GetOnlySingleNode(state, Alphas(5), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Sensor, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; // Setup Report variables for the Electric Coils // CurrentModuleObject = "Coil:Heating:Electric:MultiStage" @@ -616,9 +564,9 @@ namespace HeatingCoils { } // Get the data for for fuel heating coils - for (FuelCoilNum = 1; FuelCoilNum <= NumFuelCoil; ++FuelCoilNum) { + for (FuelCoilNum = 1; FuelCoilNum <= state.dataHeatingCoils->NumFuelCoil; ++FuelCoilNum) { - CoilNum = NumElecCoil + NumElecCoilMultiStage + FuelCoilNum; + CoilNum = state.dataHeatingCoils->NumElecCoil + state.dataHeatingCoils->NumElecCoilMultiStage + FuelCoilNum; HeatingCoilEquipConditions &coil = HeatingCoil(CoilNum); CurrentModuleObject = "Coil:Heating:Fuel"; @@ -636,13 +584,13 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); - HeatingCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); - HeatingCoilNumericFields(CoilNum).FieldNames = ""; - HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames.allocate(state.dataHeatingCoils->MaxNums); + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = ""; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; - UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, InputErrorsFound); + UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, state.dataHeatingCoils->InputErrorsFound); // InputErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), InputErrorsFound, CurrentModuleObject + " Name"); + VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); coil.Name = Alphas(1); coil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -652,7 +600,7 @@ namespace HeatingCoils { if (coil.SchedPtr == 0) { ShowSevereError(state, RoutineName + CurrentModuleObject + ": Invalid " + cAlphaFields(2) + " entered =" + Alphas(2) + " for " + cAlphaFields(1) + '=' + Alphas(1)); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } @@ -667,7 +615,7 @@ namespace HeatingCoils { coil.FuelType_Num == DataGlobalConstants::ResourceType::None) { ShowSevereError(state, RoutineName + CurrentModuleObject + ": Invalid " + cAlphaFields(3) + " entered =" + Alphas(3) + " for " + cAlphaFields(1) + '=' + Alphas(1)); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } std::string const FuelType(GetResourceTypeChar(coil.FuelType_Num)); @@ -676,18 +624,18 @@ namespace HeatingCoils { errFlag = false; coil.AirInletNodeNum = GetOnlySingleNode(state, Alphas(4), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Inlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; errFlag = false; coil.AirOutletNodeNum = GetOnlySingleNode(state, Alphas(5), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Outlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(4), Alphas(5), "Air Nodes"); errFlag = false; coil.TempSetPointNodeNum = GetOnlySingleNode(state, Alphas(6), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Sensor, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; // parasitic electric load associated with the fuel heating coil coil.ParasiticElecLoad = Numbers(3); @@ -753,9 +701,10 @@ namespace HeatingCoils { } // Get the data for for gas multistage heating coils - for (FuelCoilNum = 1; FuelCoilNum <= NumGasCoilMultiStage; ++FuelCoilNum) { + for (FuelCoilNum = 1; FuelCoilNum <= state.dataHeatingCoils->NumGasCoilMultiStage; ++FuelCoilNum) { - CoilNum = NumElecCoil + NumElecCoilMultiStage + NumFuelCoil + FuelCoilNum; + CoilNum = state.dataHeatingCoils->NumElecCoil + state.dataHeatingCoils->NumElecCoilMultiStage + state.dataHeatingCoils->NumFuelCoil + + FuelCoilNum; CurrentModuleObject = "Coil:Heating:Gas:MultiStage"; HeatingCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Natural_Gas; @@ -773,13 +722,13 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); - HeatingCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); - HeatingCoilNumericFields(CoilNum).FieldNames = ""; - HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames.allocate(state.dataHeatingCoils->MaxNums); + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = ""; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; - UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, InputErrorsFound); + UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, state.dataHeatingCoils->InputErrorsFound); // InputErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), InputErrorsFound, CurrentModuleObject + " Name"); + VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); HeatingCoil(CoilNum).Name = Alphas(1); HeatingCoil(CoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -789,7 +738,7 @@ namespace HeatingCoils { if (HeatingCoil(CoilNum).SchedPtr == 0) { ShowSevereError(state, RoutineName + CurrentModuleObject + ": Invalid " + cAlphaFields(2) + " entered =" + Alphas(2) + " for " + cAlphaFields(1) + '=' + Alphas(1)); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } @@ -815,18 +764,18 @@ namespace HeatingCoils { errFlag = false; HeatingCoil(CoilNum).AirInletNodeNum = GetOnlySingleNode(state, Alphas(3), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Inlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; errFlag = false; HeatingCoil(CoilNum).AirOutletNodeNum = GetOnlySingleNode(state, Alphas(4), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Outlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); errFlag = false; HeatingCoil(CoilNum).TempSetPointNodeNum = GetOnlySingleNode(state, Alphas(5), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Sensor, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; // parasitic electric load associated with the gas heating coil HeatingCoil(CoilNum).ParasiticElecLoad = Numbers(10); @@ -914,9 +863,11 @@ namespace HeatingCoils { } // Get the data for for desuperheater heating coils - for (DesuperheaterCoilNum = 1; DesuperheaterCoilNum <= NumDesuperheaterCoil; ++DesuperheaterCoilNum) { + for (DesuperheaterCoilNum = 1; DesuperheaterCoilNum <= state.dataHeatingCoils->NumDesuperheaterCoil; ++DesuperheaterCoilNum) { - CoilNum = NumElecCoil + NumElecCoilMultiStage + NumFuelCoil + NumGasCoilMultiStage + DesuperheaterCoilNum; + CoilNum = state.dataHeatingCoils->NumElecCoil + state.dataHeatingCoils->NumElecCoilMultiStage + state.dataHeatingCoils->NumFuelCoil + + state.dataHeatingCoils->NumGasCoilMultiStage + + DesuperheaterCoilNum; CurrentModuleObject = "Coil:Heating:Desuperheater"; HeatingCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Electricity; @@ -934,13 +885,13 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); - HeatingCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); - HeatingCoilNumericFields(CoilNum).FieldNames = ""; - HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames.allocate(state.dataHeatingCoils->MaxNums); + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = ""; + state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames = cNumericFields; - UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, InputErrorsFound); + UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, state.dataHeatingCoils->InputErrorsFound); // InputErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), InputErrorsFound, CurrentModuleObject + " Name"); + VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); HeatingCoil(CoilNum).Name = Alphas(1); HeatingCoil(CoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { @@ -950,7 +901,7 @@ namespace HeatingCoils { if (HeatingCoil(CoilNum).SchedPtr == 0) { ShowSevereError(state, RoutineName + CurrentModuleObject + ": Invalid " + cAlphaFields(2) + " entered =" + Alphas(2) + " for " + cAlphaFields(1) + '=' + Alphas(1)); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } @@ -960,7 +911,7 @@ namespace HeatingCoils { ShowSevereError(state, CurrentModuleObject + " = \"" + HeatingCoil(CoilNum).Name + "\""); ShowContinueError(state, "Error found in " + cAlphaFields(2) + " = " + Alphas(2)); ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } @@ -975,11 +926,11 @@ namespace HeatingCoils { errFlag = false; HeatingCoil(CoilNum).AirInletNodeNum = GetOnlySingleNode(state, Alphas(3), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Inlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; errFlag = false; HeatingCoil(CoilNum).AirOutletNodeNum = GetOnlySingleNode(state, Alphas(4), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Outlet, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); @@ -993,7 +944,7 @@ namespace HeatingCoils { if (Numbers(1) < 0.0 || Numbers(1) > 0.9) { ShowSevereError(state, CurrentModuleObject + ", \"" + HeatingCoil(CoilNum).Name + "\" heat reclaim recovery efficiency must be >= 0 and <=0.9"); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } } else { @@ -1004,7 +955,7 @@ namespace HeatingCoils { if (Numbers(1) < 0.0 || Numbers(1) > 0.3) { ShowSevereError(state, CurrentModuleObject + ", \"" + HeatingCoil(CoilNum).Name + "\" heat reclaim recovery efficiency must be >= 0 and <=0.3"); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } } } @@ -1013,7 +964,7 @@ namespace HeatingCoils { // The CoilNum may not be found here when zone heating equip. exists. Check again in InitHeatingCoil. // (when zone equipment heating coils are included in the input, the air loop DX equipment has not yet been read in) if (UtilityRoutines::SameString(Alphas(5), "Refrigeration:CompressorRack")) { - HeatingCoil(CoilNum).ReclaimHeatingSource = COMPRESSORRACK_REFRIGERATEDCASE; + HeatingCoil(CoilNum).ReclaimHeatingSource = HeatObjTypes::COMPRESSORRACK_REFRIGERATEDCASE; GetRefrigeratedRackIndex( state, Alphas(6), HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum, RefrigSystemTypeRack, DXCoilErrFlag, Alphas(5)); if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) { @@ -1021,7 +972,7 @@ namespace HeatingCoils { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimRefrigeratedRack(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; } @@ -1031,13 +982,13 @@ namespace HeatingCoils { "\" sum of heat reclaim recovery efficiencies from the same source coil: \"" + HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } } } else if ((UtilityRoutines::SameString(Alphas(5), "Refrigeration:Condenser:AirCooled")) || (UtilityRoutines::SameString(Alphas(5), "Refrigeration:Condenser:EvaporativeCooled")) || (UtilityRoutines::SameString(Alphas(5), "Refrigeration:Condenser:WaterCooled"))) { - HeatingCoil(CoilNum).ReclaimHeatingSource = CONDENSER_REFRIGERATION; + HeatingCoil(CoilNum).ReclaimHeatingSource = HeatObjTypes::CONDENSER_REFRIGERATION; GetRefrigeratedRackIndex( state, Alphas(6), HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum, RefrigSystemTypeDetailed, DXCoilErrFlag, Alphas(5)); if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) { @@ -1045,7 +996,7 @@ namespace HeatingCoils { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimRefrigCondenser(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; } @@ -1055,18 +1006,18 @@ namespace HeatingCoils { "\" sum of heat reclaim recovery efficiencies from the same source coil: \"" + HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.9"); } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } } } else if (UtilityRoutines::SameString(Alphas(5), "Coil:Cooling:DX:SingleSpeed")) { - HeatingCoil(CoilNum).ReclaimHeatingSource = COIL_DX_COOLING; + HeatingCoil(CoilNum).ReclaimHeatingSource = HeatObjTypes::COIL_DX_COOLING; GetDXCoilIndex( state, Alphas(6), HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum, DXCoilErrFlag, Alphas(5), ObjexxFCL::Optional_bool_const()); if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) { if (allocated(state.dataHeatBal->HeatReclaimDXCoil)) { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimDXCoil(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; } @@ -1076,12 +1027,12 @@ namespace HeatingCoils { "\" sum of heat reclaim recovery efficiencies from the same source coil: \"" + HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } } - if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) ValidSourceType(CoilNum) = true; + if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } else if (UtilityRoutines::SameString(Alphas(5), "Coil:Cooling:DX:VariableSpeed")) { - HeatingCoil(CoilNum).ReclaimHeatingSource = COIL_DX_VARIABLE_COOLING; + HeatingCoil(CoilNum).ReclaimHeatingSource = HeatObjTypes::COIL_DX_VARIABLE_COOLING; HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, Alphas(5), Alphas(6), DXCoilErrFlag); if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) { @@ -1089,7 +1040,7 @@ namespace HeatingCoils { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimVS_DXCoil(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; } @@ -1099,18 +1050,18 @@ namespace HeatingCoils { "\" sum of heat reclaim recovery efficiencies from the same source coil: \"" + HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } } } else if (UtilityRoutines::SameString(Alphas(5), "Coil:Cooling:DX:TwoSpeed")) { - HeatingCoil(CoilNum).ReclaimHeatingSource = COIL_DX_MULTISPEED; + HeatingCoil(CoilNum).ReclaimHeatingSource = HeatObjTypes::COIL_DX_MULTISPEED; GetDXCoilIndex( state, Alphas(6), HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum, DXCoilErrFlag, Alphas(5), ObjexxFCL::Optional_bool_const()); if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) { if (allocated(state.dataHeatBal->HeatReclaimDXCoil)) { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimDXCoil(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; } @@ -1120,18 +1071,18 @@ namespace HeatingCoils { "\" sum of heat reclaim recovery efficiencies from the same source coil: \"" + HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } } } else if (UtilityRoutines::SameString(Alphas(5), "Coil:Cooling:DX:TwoStageWithHumidityControlMode")) { - HeatingCoil(CoilNum).ReclaimHeatingSource = COIL_DX_MULTIMODE; + HeatingCoil(CoilNum).ReclaimHeatingSource = HeatObjTypes::COIL_DX_MULTIMODE; GetDXCoilIndex( state, Alphas(6), HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum, DXCoilErrFlag, Alphas(5), ObjexxFCL::Optional_bool_const()); if (HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum > 0) { if (allocated(state.dataHeatBal->HeatReclaimDXCoil)) { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimDXCoil(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; } @@ -1141,7 +1092,7 @@ namespace HeatingCoils { "\" sum of heat reclaim recovery efficiencies from the same source coil: \"" + HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } } } else { @@ -1151,7 +1102,7 @@ namespace HeatingCoils { ShowContinueError(state, "Refrigeration:CompressorRack, Coil:Cooling:DX:SingleSpeed, Refrigeration:Condenser:AirCooled, " "Refrigeration:Condenser:EvaporativeCooled, Refrigeration:Condenser:WaterCooled,Coil:Cooling:DX:TwoSpeed, and " "Coil:Cooling:DX:TwoStageWithHumidityControlMode"); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } HeatingCoil(CoilNum).ReclaimHeatingCoilName = Alphas(6); @@ -1159,14 +1110,14 @@ namespace HeatingCoils { errFlag = false; HeatingCoil(CoilNum).TempSetPointNodeNum = GetOnlySingleNode(state, Alphas(7), errFlag, CurrentModuleObject, Alphas(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::NodeConnectionType::Sensor, 1, ObjectIsNotParent); - InputErrorsFound = errFlag || InputErrorsFound; + state.dataHeatingCoils->InputErrorsFound = errFlag || state.dataHeatingCoils->InputErrorsFound; // parasitic electric load associated with the desuperheater heating coil HeatingCoil(CoilNum).ParasiticElecLoad = Numbers(2); if (Numbers(2) < 0.0) { ShowSevereError(state, CurrentModuleObject + ", \"" + HeatingCoil(CoilNum).Name + "\" parasitic electric load must be >= 0"); - InputErrorsFound = true; + state.dataHeatingCoils->InputErrorsFound = true; } // Setup Report variables for the Desuperheater Heating Coils @@ -1209,7 +1160,7 @@ namespace HeatingCoils { "Heating Coil Runtime Fraction", OutputProcessor::Unit::None, HeatingCoil(CoilNum).RTF, "HVAC", "Average", HeatingCoil(CoilNum).Name); } - if (InputErrorsFound) { + if (state.dataHeatingCoils->InputErrorsFound) { ShowFatalError(state, RoutineName + "Errors found in input. Program terminates."); } @@ -1252,30 +1203,27 @@ namespace HeatingCoils { int RackNum; // Index to refrigerated case compressor rack int CondNum; // Index to refrigeration condenser int DXCoilNum; // Index to DX cooling coil - static int ValidSourceTypeCounter(0); // Counter used to determine if desuperheater source name is valid - static bool HeatingCoilFatalError(false); // used for error checking - static Array1D_bool MySPTestFlag; // used for error checking - static Array1D_bool ShowSingleWarning; // Used for single warning message for desuperheater coil - static Array1D_bool MyEnvrnFlag; // one time environment flag + + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); - if (MyOneTimeFlag) { + if (state.dataHeatingCoils->MyOneTimeFlag) { // initialize the environment and sizing flags - MyEnvrnFlag.allocate(NumHeatingCoils); - MySizeFlag.allocate(NumHeatingCoils); - ShowSingleWarning.allocate(NumHeatingCoils); - MySPTestFlag.allocate(NumHeatingCoils); - MyEnvrnFlag = true; - MySizeFlag = true; - ShowSingleWarning = true; - MyOneTimeFlag = false; - MySPTestFlag = true; - } - - if (!state.dataGlobal->SysSizingCalc && MySizeFlag(CoilNum)) { + state.dataHeatingCoils->MyEnvrnFlag.allocate(state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->MySizeFlag.allocate(state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->ShowSingleWarning.allocate(state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->MySPTestFlag.allocate(state.dataHeatingCoils->NumHeatingCoils); + state.dataHeatingCoils->MyEnvrnFlag = true; + state.dataHeatingCoils->MySizeFlag = true; + state.dataHeatingCoils->ShowSingleWarning = true; + state.dataHeatingCoils->MyOneTimeFlag = false; + state.dataHeatingCoils->MySPTestFlag = true; + } + + if (!state.dataGlobal->SysSizingCalc && state.dataHeatingCoils->MySizeFlag(CoilNum)) { // for each coil, do the sizing once. SizeHeatingCoil(state, CoilNum); - MySizeFlag(CoilNum) = false; + state.dataHeatingCoils->MySizeFlag(CoilNum) = false; } // Do the following initializations (every time step): This should be the info from @@ -1304,7 +1252,8 @@ namespace HeatingCoils { HeatingCoil(CoilNum).DesiredOutletTemp = state.dataLoopNodes->Node(ControlNode).TempSetPoint - (state.dataLoopNodes->Node(ControlNode).Temp - state.dataLoopNodes->Node(AirOutletNode).Temp); } - if (QCoilRequired == SensedLoadFlagValue && MySPTestFlag(CoilNum) && HeatingCoil(CoilNum).HCoilType_Num != Coil_HeatingElectric_MultiStage && + if (QCoilRequired == SensedLoadFlagValue && state.dataHeatingCoils->MySPTestFlag(CoilNum) && + HeatingCoil(CoilNum).HCoilType_Num != Coil_HeatingElectric_MultiStage && HeatingCoil(CoilNum).HCoilType_Num != Coil_HeatingGas_MultiStage) { // If the coil is temperature controlled (QCoilReq == -999.0), both a control node and setpoint are required. @@ -1319,7 +1268,7 @@ namespace HeatingCoils { ShowContinueError(state, "... Missing control node for heating coil."); ShowContinueError(state, "... enter a control node name in the coil temperature setpoint node field for this heating coil."); ShowContinueError(state, "... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node."); - HeatingCoilFatalError = true; + state.dataHeatingCoils->HeatingCoilFatalError = true; // test 3) here (fatal message) } else { // IF(ControlNode .GT. 0)THEN if (state.dataLoopNodes->Node(ControlNode).TempSetPoint == SensedNodeFlagValue) { @@ -1327,10 +1276,11 @@ namespace HeatingCoils { ShowSevereError(state, cAllCoilTypes(HeatingCoil(CoilNum).HCoilType_Num) + " \"" + HeatingCoil(CoilNum).Name + "\""); ShowContinueError(state, "... Missing temperature setpoint for heating coil."); ShowContinueError(state, "... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node."); - HeatingCoilFatalError = true; + state.dataHeatingCoils->HeatingCoilFatalError = true; } else { - CheckIfNodeSetPointManagedByEMS(state, ControlNode, EMSManager::SPControlType::iTemperatureSetPoint, HeatingCoilFatalError); - if (HeatingCoilFatalError) { + CheckIfNodeSetPointManagedByEMS( + state, ControlNode, EMSManager::SPControlType::iTemperatureSetPoint, state.dataHeatingCoils->HeatingCoilFatalError); + if (state.dataHeatingCoils->HeatingCoilFatalError) { ShowSevereError(state, cAllCoilTypes(HeatingCoil(CoilNum).HCoilType_Num) + " \"" + HeatingCoil(CoilNum).Name + "\""); ShowContinueError(state, "... Missing temperature setpoint for heating coil."); ShowContinueError(state, "... use a Setpoint Manager to establish a setpoint at the coil temperature setpoint node."); @@ -1339,9 +1289,9 @@ namespace HeatingCoils { } } } - MySPTestFlag(CoilNum) = false; + state.dataHeatingCoils->MySPTestFlag(CoilNum) = false; } - } else if (MySPTestFlag(CoilNum)) { + } else if (state.dataHeatingCoils->MySPTestFlag(CoilNum)) { // If QCoilReq /= SensedLoadFlagValue, the coil is load controlled and does not require a control node // 4 possibilities here: // 1) TempSetPointNodeNum .EQ. 0 and TempSetPoint == SensedNodeFlagValue, this is correct @@ -1355,20 +1305,21 @@ namespace HeatingCoils { ShowContinueError(state, " The \"Temperature Setpoint Node Name\" input is not required for this heating coil."); ShowContinueError(state, " Leaving the input field \"Temperature Setpoint Node Name\" blank will eliminate this warning."); } - MySPTestFlag(CoilNum) = false; + state.dataHeatingCoils->MySPTestFlag(CoilNum) = false; } // delay fatal error until all coils are called - if (!FirstHVACIteration && HeatingCoilFatalError) { + if (!FirstHVACIteration && state.dataHeatingCoils->HeatingCoilFatalError) { ShowFatalError(state, "... errors found in heating coil input."); } // Find the heating source index for the desuperheater heating coil if not already found. This occurs when zone heating // equip. exists. (when zone equipment heating coils are included in the input, the air loop DX equipment has not yet been read) // Issue a single warning if the coil is not found and continue the simulation - if (!ValidSourceType(CoilNum) && (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingDesuperheater) && ShowSingleWarning(CoilNum)) { - ++ValidSourceTypeCounter; - if (HeatingCoil(CoilNum).ReclaimHeatingSource == COMPRESSORRACK_REFRIGERATEDCASE) { + if (!state.dataHeatingCoils->ValidSourceType(CoilNum) && (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingDesuperheater) && + state.dataHeatingCoils->ShowSingleWarning(CoilNum)) { + ++state.dataHeatingCoils->ValidSourceTypeCounter; + if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COMPRESSORRACK_REFRIGERATEDCASE) { for (RackNum = 1; RackNum <= state.dataRefrigCase->NumRefrigeratedRacks; ++RackNum) { if (!UtilityRoutines::SameString(state.dataHeatBal->HeatReclaimRefrigeratedRack(RackNum).Name, HeatingCoil(CoilNum).ReclaimHeatingCoilName)) continue; @@ -1377,7 +1328,7 @@ namespace HeatingCoils { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimRefrigeratedRack(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; HeatReclaim.ReclaimEfficiencyTotal += HeatingCoil(CoilNum).Efficiency; @@ -1387,11 +1338,11 @@ namespace HeatingCoils { HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } break; } - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == CONDENSER_REFRIGERATION) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::CONDENSER_REFRIGERATION) { for (CondNum = 1; CondNum <= state.dataRefrigCase->NumRefrigCondensers; ++CondNum) { if (!UtilityRoutines::SameString(state.dataHeatBal->HeatReclaimRefrigCondenser(CondNum).Name, HeatingCoil(CoilNum).ReclaimHeatingCoilName)) continue; HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum = CondNum; @@ -1399,7 +1350,7 @@ namespace HeatingCoils { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimRefrigCondenser(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; HeatReclaim.ReclaimEfficiencyTotal += HeatingCoil(CoilNum).Efficiency; @@ -1409,20 +1360,20 @@ namespace HeatingCoils { HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.9"); } } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } break; } - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_COOLING || - HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTISPEED || - HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTIMODE) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_COOLING || + HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_MULTISPEED || + HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_MULTIMODE) { for (DXCoilNum = 1; DXCoilNum <= state.dataDXCoils->NumDXCoils; ++DXCoilNum) { if (!UtilityRoutines::SameString(state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).Name, HeatingCoil(CoilNum).ReclaimHeatingCoilName)) continue; HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum = DXCoilNum; if (allocated(state.dataHeatBal->HeatReclaimDXCoil)) { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimDXCoil(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; HeatReclaim.ReclaimEfficiencyTotal += HeatingCoil(CoilNum).Efficiency; @@ -1432,11 +1383,11 @@ namespace HeatingCoils { HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } break; } - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_VARIABLE_COOLING) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_VARIABLE_COOLING) { for (DXCoilNum = 1; DXCoilNum <= state.dataVariableSpeedCoils->NumVarSpeedCoils; ++DXCoilNum) { if (!UtilityRoutines::SameString(state.dataHeatBal->HeatReclaimVS_DXCoil(DXCoilNum).Name, HeatingCoil(CoilNum).ReclaimHeatingCoilName)) @@ -1446,7 +1397,7 @@ namespace HeatingCoils { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimVS_DXCoil(HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum); if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { - HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(NumDesuperheaterCoil); + HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); for (auto &num : HeatReclaim.HVACDesuperheaterReclaimedHeat) num = 0.0; HeatReclaim.ReclaimEfficiencyTotal += HeatingCoil(CoilNum).Efficiency; @@ -1456,16 +1407,18 @@ namespace HeatingCoils { HeatingCoil(CoilNum).ReclaimHeatingCoilName + "\" cannot be over 0.3"); } } - ValidSourceType(CoilNum) = true; + state.dataHeatingCoils->ValidSourceType(CoilNum) = true; } break; } } - if ((ValidSourceTypeCounter > NumDesuperheaterCoil * 2) && ShowSingleWarning(CoilNum) && !ValidSourceType(CoilNum)) { + if ((state.dataHeatingCoils->ValidSourceTypeCounter > state.dataHeatingCoils->NumDesuperheaterCoil * 2) && + state.dataHeatingCoils->ShowSingleWarning(CoilNum) && + !state.dataHeatingCoils->ValidSourceType(CoilNum)) { ShowWarningError(state, "Coil:Heating:Desuperheater, \"" + HeatingCoil(CoilNum).Name + "\" desuperheater heat source object name not found: " + HeatingCoil(CoilNum).ReclaimHeatingCoilName); ShowContinueError(state, " Desuperheater heating coil is not modeled and simulation continues."); - ShowSingleWarning(CoilNum) = false; + state.dataHeatingCoils->ShowSingleWarning(CoilNum) = false; } } } @@ -1513,6 +1466,8 @@ namespace HeatingCoils { int NumCoilsSized = 0; // counter used to deallocate temporary string array after all coils have been sized auto &OASysEqSizing(state.dataSize->OASysEqSizing); + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); + if (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingElectric_MultiStage) { FieldNum = 1 + (HeatingCoil(CoilNum).NumOfStages * 2); @@ -1526,10 +1481,10 @@ namespace HeatingCoils { FieldNum = 2; TempCap = HeatingCoil(CoilNum).NominalCapacity; } - SizingString = HeatingCoilNumericFields(CoilNum).FieldNames(FieldNum) + " [W]"; + SizingString = state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames(FieldNum) + " [W]"; CompType = "Coil:" + HeatingCoil(CoilNum).HeatingCoilType + ':' + HeatingCoil(CoilNum).HeatingCoilModel; CompName = HeatingCoil(CoilNum).Name; - state.dataSize->DataCoilIsSuppHeater = CoilIsSuppHeater; // set global instead of using optional argument + state.dataSize->DataCoilIsSuppHeater = state.dataHeatingCoils->CoilIsSuppHeater; // set global instead of using optional argument state.dataSize->DataCoolCoilCap = 0.0; // global only used for heat pump heating coils, non-HP heating coils are sized with other global variables if (TempCap == AutoSize) { @@ -1580,7 +1535,7 @@ namespace HeatingCoils { } else { FieldNum = 1 + (StageNum * 3); } - SizingString = HeatingCoilNumericFields(CoilNum).FieldNames(FieldNum) + " [W]"; + SizingString = state.dataHeatingCoils->HeatingCoilNumericFields(CoilNum).FieldNames(FieldNum) + " [W]"; if (HeatingCoil(CoilNum).MSNominalCapacity(StageNum) == AutoSize) { ThisStageAutoSize = true; } @@ -1637,7 +1592,8 @@ namespace HeatingCoils { HeatingCoil(CoilNum).NominalCapacity = TempCap; } - if (++NumCoilsSized == NumHeatingCoils) HeatingCoilNumericFields.deallocate(); // remove temporary array for field names at end of sizing + if (++NumCoilsSized == state.dataHeatingCoils->NumHeatingCoils) + state.dataHeatingCoils->HeatingCoilNumericFields.deallocate(); // remove temporary array for field names at end of sizing // create predefined report entries { @@ -1723,6 +1679,8 @@ namespace HeatingCoils { Real64 TempSetPoint; int Control; + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); + Effic = HeatingCoil(CoilNum).Efficiency; TempAirIn = HeatingCoil(CoilNum).InletAirTemp; Win = HeatingCoil(CoilNum).InletAirHumRat; @@ -1914,6 +1872,7 @@ namespace HeatingCoils { Real64 HSElecHeatingPower; // Full load power at high stage Real64 PartLoadRat; // part load ratio + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); if (StageNum > 1) { StageNumLS = StageNum - 1; @@ -2106,6 +2065,8 @@ namespace HeatingCoils { Real64 PartLoadRat; Real64 PLF; + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); + Effic = HeatingCoil(CoilNum).Efficiency; TempAirIn = HeatingCoil(CoilNum).InletAirTemp; Win = HeatingCoil(CoilNum).InletAirHumRat; @@ -2341,6 +2302,7 @@ namespace HeatingCoils { Real64 PartLoadRat(0.0); // part load ratio Real64 PLF; // part load factor used to calculate RTF + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); if (StageNum > 1) { StageNumLS = StageNum - 1; @@ -2595,6 +2557,8 @@ namespace HeatingCoils { Real64 TempSetPoint; // setpoint temperature to be met when using temperature based control [C] int SourceID; // waste heat source id number + auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil); + Effic = HeatingCoil(CoilNum).Efficiency; AirMassFlow = HeatingCoil(CoilNum).InletAirMassFlowRate; TempAirIn = HeatingCoil(CoilNum).InletAirTemp; @@ -2614,15 +2578,15 @@ namespace HeatingCoils { // Access the appropriate structure to find the available heating capacity of the desuperheater heating coil // The nominal capacity of the desuperheater heating coil varies based on the amount of heat rejected by the source // Stovall 2011, add comparison to available temperature of heat reclaim source - if (ValidSourceType(CoilNum)) { + if (state.dataHeatingCoils->ValidSourceType(CoilNum)) { SourceID = HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum; - if (HeatingCoil(CoilNum).ReclaimHeatingSource == COMPRESSORRACK_REFRIGERATEDCASE) { + if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COMPRESSORRACK_REFRIGERATEDCASE) { // Added last term to available energy equations to avoid double counting reclaimed energy // because refrigeration systems are solved outside the hvac time step iterations HeatingCoil(CoilNum).RTF = 1.0; HeatingCoil(CoilNum).NominalCapacity = state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).AvailCapacity * Effic - state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal; - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == CONDENSER_REFRIGERATION) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::CONDENSER_REFRIGERATION) { AvailTemp = state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).AvailTemperature; HeatingCoil(CoilNum).RTF = 1.0; if (AvailTemp <= TempAirIn) { @@ -2634,13 +2598,13 @@ namespace HeatingCoils { HeatingCoil(CoilNum).NominalCapacity = state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).AvailCapacity * Effic - state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal; } - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_COOLING || - HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTISPEED || - HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTIMODE) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_COOLING || + HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_MULTISPEED || + HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_MULTIMODE) { HeatingCoil(CoilNum).RTF = state.dataDXCoils->DXCoil(SourceID).CoolingCoilRuntimeFraction; HeatingCoil(CoilNum).NominalCapacity = state.dataHeatBal->HeatReclaimDXCoil(SourceID).AvailCapacity * Effic - state.dataHeatBal->HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal; - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_VARIABLE_COOLING) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_VARIABLE_COOLING) { // condenser heat rejection HeatingCoil(CoilNum).RTF = state.dataVariableSpeedCoils->VarSpeedCoil(SourceID).RunFrac; HeatingCoil(CoilNum).NominalCapacity = state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).AvailCapacity * Effic - @@ -2715,29 +2679,31 @@ namespace HeatingCoils { QCoilActual = HeatingCoilLoad; // Update remaining waste heat (just in case multiple users of waste heat use same source) - if (ValidSourceType(CoilNum)) { + if (state.dataHeatingCoils->ValidSourceType(CoilNum)) { SourceID = HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum; // Refrigerated cases are simulated at the zone time step, do not decrement available capacity // (the heat reclaim available capacity will not get reinitialized as the air loop iterates) - int DesuperheaterNum = CoilNum - NumElecCoil - NumElecCoilMultiStage - NumFuelCoil - NumGasCoilMultiStage; - if (HeatingCoil(CoilNum).ReclaimHeatingSource == COMPRESSORRACK_REFRIGERATEDCASE) { + int DesuperheaterNum = CoilNum - state.dataHeatingCoils->NumElecCoil - state.dataHeatingCoils->NumElecCoilMultiStage - + state.dataHeatingCoils->NumFuelCoil - + state.dataHeatingCoils->NumGasCoilMultiStage; + if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COMPRESSORRACK_REFRIGERATEDCASE) { state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).HVACDesuperheaterReclaimedHeat(DesuperheaterNum) = HeatingCoilLoad; state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).HVACDesuperheaterReclaimedHeatTotal = 0.0; for (auto &num : state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).HVACDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).HVACDesuperheaterReclaimedHeatTotal += num; - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == CONDENSER_REFRIGERATION) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::CONDENSER_REFRIGERATION) { state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).HVACDesuperheaterReclaimedHeat(DesuperheaterNum) = HeatingCoilLoad; state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).HVACDesuperheaterReclaimedHeatTotal = 0.0; for (auto &num : state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).HVACDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).HVACDesuperheaterReclaimedHeatTotal += num; - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_COOLING || - HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTISPEED || - HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTIMODE) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_COOLING || + HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_MULTISPEED || + HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_MULTIMODE) { state.dataHeatBal->HeatReclaimDXCoil(SourceID).HVACDesuperheaterReclaimedHeat(DesuperheaterNum) = HeatingCoilLoad; state.dataHeatBal->HeatReclaimDXCoil(SourceID).HVACDesuperheaterReclaimedHeatTotal = 0.0; for (auto &num : state.dataHeatBal->HeatReclaimDXCoil(SourceID).HVACDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimDXCoil(SourceID).HVACDesuperheaterReclaimedHeatTotal += num; - } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_VARIABLE_COOLING) { + } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == HeatObjTypes::COIL_DX_VARIABLE_COOLING) { state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).HVACDesuperheaterReclaimedHeat(DesuperheaterNum) = HeatingCoilLoad; state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).HVACDesuperheaterReclaimedHeatTotal = 0.0; for (auto &num : state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).HVACDesuperheaterReclaimedHeat) @@ -2786,14 +2752,14 @@ namespace HeatingCoils { int AirInletNode; int AirOutletNode; - AirInletNode = HeatingCoil(CoilNum).AirInletNodeNum; - AirOutletNode = HeatingCoil(CoilNum).AirOutletNodeNum; + AirInletNode = state.dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum; + AirOutletNode = state.dataHeatingCoils->HeatingCoil(CoilNum).AirOutletNodeNum; // Set the outlet air nodes of the HeatingCoil - state.dataLoopNodes->Node(AirOutletNode).MassFlowRate = HeatingCoil(CoilNum).OutletAirMassFlowRate; - state.dataLoopNodes->Node(AirOutletNode).Temp = HeatingCoil(CoilNum).OutletAirTemp; - state.dataLoopNodes->Node(AirOutletNode).HumRat = HeatingCoil(CoilNum).OutletAirHumRat; - state.dataLoopNodes->Node(AirOutletNode).Enthalpy = HeatingCoil(CoilNum).OutletAirEnthalpy; + state.dataLoopNodes->Node(AirOutletNode).MassFlowRate = state.dataHeatingCoils->HeatingCoil(CoilNum).OutletAirMassFlowRate; + state.dataLoopNodes->Node(AirOutletNode).Temp = state.dataHeatingCoils->HeatingCoil(CoilNum).OutletAirTemp; + state.dataLoopNodes->Node(AirOutletNode).HumRat = state.dataHeatingCoils->HeatingCoil(CoilNum).OutletAirHumRat; + state.dataLoopNodes->Node(AirOutletNode).Enthalpy = state.dataHeatingCoils->HeatingCoil(CoilNum).OutletAirEnthalpy; // Set the outlet nodes for properties that just pass through & not used state.dataLoopNodes->Node(AirOutletNode).Quality = state.dataLoopNodes->Node(AirInletNode).Quality; @@ -2830,50 +2796,33 @@ namespace HeatingCoils { // PURPOSE OF THIS SUBROUTINE: // This subroutine updates the report variable for the coils. - // METHODOLOGY EMPLOYED: - // NA - - // REFERENCES: - // na - // Using/Aliasing auto & TimeStepSys = state.dataHVACGlobal->TimeStepSys; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ReportingConstant; ReportingConstant = TimeStepSys * DataGlobalConstants::SecInHour; // report the HeatingCoil energy from this component - HeatingCoil(CoilNum).HeatingCoilRate = HeatingCoil(CoilNum).HeatingCoilLoad; - HeatingCoil(CoilNum).HeatingCoilLoad *= ReportingConstant; + state.dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilRate = state.dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilLoad; + state.dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilLoad *= ReportingConstant; - HeatingCoil(CoilNum).FuelUseRate = HeatingCoil(CoilNum).FuelUseLoad; - HeatingCoil(CoilNum).ElecUseRate = HeatingCoil(CoilNum).ElecUseLoad; + state.dataHeatingCoils->HeatingCoil(CoilNum).FuelUseRate = state.dataHeatingCoils->HeatingCoil(CoilNum).FuelUseLoad; + state.dataHeatingCoils->HeatingCoil(CoilNum).ElecUseRate = state.dataHeatingCoils->HeatingCoil(CoilNum).ElecUseLoad; if (coilIsSuppHeater) { - state.dataHVACGlobal->SuppHeatingCoilPower = HeatingCoil(CoilNum).ElecUseLoad; + state.dataHVACGlobal->SuppHeatingCoilPower = state.dataHeatingCoils->HeatingCoil(CoilNum).ElecUseLoad; } else { - state.dataHVACGlobal->ElecHeatingCoilPower = HeatingCoil(CoilNum).ElecUseLoad; + state.dataHVACGlobal->ElecHeatingCoilPower = state.dataHeatingCoils->HeatingCoil(CoilNum).ElecUseLoad; } - HeatingCoil(CoilNum).FuelUseLoad *= ReportingConstant; - HeatingCoil(CoilNum).ElecUseLoad *= ReportingConstant; + state.dataHeatingCoils->HeatingCoil(CoilNum).FuelUseLoad *= ReportingConstant; + state.dataHeatingCoils->HeatingCoil(CoilNum).ElecUseLoad *= ReportingConstant; - HeatingCoil(CoilNum).ParasiticFuelLoad = HeatingCoil(CoilNum).ParasiticFuelRate * ReportingConstant; + state.dataHeatingCoils->HeatingCoil(CoilNum).ParasiticFuelLoad = + state.dataHeatingCoils->HeatingCoil(CoilNum).ParasiticFuelRate * ReportingConstant; std::string coilObjClassName; { - auto const SELECT_CASE_var(HeatingCoil(CoilNum).HCoilType_Num); + auto const SELECT_CASE_var(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num); if (SELECT_CASE_var == Coil_HeatingElectric) { coilObjClassName = "Coil:Heating:Electric"; } else if (SELECT_CASE_var == Coil_HeatingElectric_MultiStage) { @@ -2886,16 +2835,16 @@ namespace HeatingCoils { coilObjClassName = "Coil:Heating:Desuperheater"; } } - if (HeatingCoil(CoilNum).reportCoilFinalSizes) { + if (state.dataHeatingCoils->HeatingCoil(CoilNum).reportCoilFinalSizes) { if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(state, - HeatingCoil(CoilNum).Name, + state.dataHeatingCoils->HeatingCoil(CoilNum).Name, coilObjClassName, - HeatingCoil(CoilNum).NominalCapacity, - HeatingCoil(CoilNum).NominalCapacity, + state.dataHeatingCoils->HeatingCoil(CoilNum).NominalCapacity, + state.dataHeatingCoils->HeatingCoil(CoilNum).NominalCapacity, -999.0, -999.0); - HeatingCoil(CoilNum).reportCoilFinalSizes = false; + state.dataHeatingCoils->HeatingCoil(CoilNum).reportCoilFinalSizes = false; } } } @@ -2916,12 +2865,12 @@ namespace HeatingCoils { // DX Coil is not a legal DX Coil. // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } - HeatingCoilIndex = UtilityRoutines::FindItem(HeatingCoilName, HeatingCoil); + HeatingCoilIndex = UtilityRoutines::FindItem(HeatingCoilName, state.dataHeatingCoils->HeatingCoil); if (HeatingCoilIndex == 0) { ShowSevereError(state, "GetCoilIndex: Heating coil not found=" + HeatingCoilName); ErrorsFound = true; @@ -2951,45 +2900,49 @@ namespace HeatingCoils { int CoilNum; // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } // Find the correct Coil number if (CompIndex == 0) { - CoilNum = UtilityRoutines::FindItem(CompName, HeatingCoil); + CoilNum = UtilityRoutines::FindItem(CompName, state.dataHeatingCoils->HeatingCoil); if (CoilNum == 0) { ShowFatalError(state, "CheckHeatingCoilSchedule: Coil not found=\"" + CompName + "\"."); } - if (!UtilityRoutines::SameString(CompType, cAllCoilTypes(HeatingCoil(CoilNum).HCoilType_Num))) { + if (!UtilityRoutines::SameString(CompType, cAllCoilTypes(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num))) { ShowSevereError(state, "CheckHeatingCoilSchedule: Coil=\"" + CompName + "\""); - ShowContinueError(state, "...expected type=\"" + CompType + "\", actual type=\"" + cAllCoilTypes(HeatingCoil(CoilNum).HCoilType_Num) + + ShowContinueError(state, + "...expected type=\"" + CompType + "\", actual type=\"" + + cAllCoilTypes(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num) + "\"."); ShowFatalError(state, "Program terminates due to preceding conditions."); } CompIndex = CoilNum; - Value = GetCurrentScheduleValue(state, HeatingCoil(CoilNum).SchedPtr); // not scheduled? + Value = GetCurrentScheduleValue(state, state.dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr); // not scheduled? } else { CoilNum = CompIndex; - if (CoilNum > NumHeatingCoils || CoilNum < 1) { + if (CoilNum > state.dataHeatingCoils->NumHeatingCoils || CoilNum < 1) { ShowFatalError(state, format("CheckHeatingCoilSchedule: Invalid CompIndex passed={}, Number of Heating Coils={}, Coil name={}", CoilNum, - NumHeatingCoils, + state.dataHeatingCoils->NumHeatingCoils, CompName)); } - if (CompName != HeatingCoil(CoilNum).Name) { + if (CompName != state.dataHeatingCoils->HeatingCoil(CoilNum).Name) { ShowSevereError(state, format("CheckHeatingCoilSchedule: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", CoilNum, CompName, - HeatingCoil(CoilNum).Name)); - ShowContinueError(state, "...expected type=\"" + CompType + "\", actual type=\"" + cAllCoilTypes(HeatingCoil(CoilNum).HCoilType_Num) + + state.dataHeatingCoils->HeatingCoil(CoilNum).Name)); + ShowContinueError(state, + "...expected type=\"" + CompType + "\", actual type=\"" + + cAllCoilTypes(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num) + "\"."); ShowFatalError(state, "Program terminates due to preceding conditions."); } - Value = GetCurrentScheduleValue(state, HeatingCoil(CoilNum).SchedPtr); // not scheduled? + Value = GetCurrentScheduleValue(state, state.dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr); // not scheduled? } } @@ -3019,21 +2972,22 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - CoilCapacity = HeatingCoil(WhichCoil).NominalCapacity; + CoilCapacity = state.dataHeatingCoils->HeatingCoil(WhichCoil).NominalCapacity; } } else if (FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGas_MultiStage) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - CoilCapacity = HeatingCoil(WhichCoil).MSNominalCapacity(HeatingCoil(WhichCoil).NumOfStages); + CoilCapacity = + state.dataHeatingCoils->HeatingCoil(WhichCoil).MSNominalCapacity(state.dataHeatingCoils->HeatingCoil(WhichCoil).NumOfStages); } } else { WhichCoil = 0; @@ -3081,9 +3035,9 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } WhichCoil = 0; @@ -3091,9 +3045,9 @@ namespace HeatingCoils { FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingGas_MultiStage || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - AvailSchIndex = HeatingCoil(WhichCoil).SchedPtr; + AvailSchIndex = state.dataHeatingCoils->HeatingCoil(WhichCoil).SchedPtr; } } else { WhichCoil = 0; @@ -3134,9 +3088,9 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } WhichCoil = 0; @@ -3144,9 +3098,9 @@ namespace HeatingCoils { FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingGas_MultiStage || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - NodeNumber = HeatingCoil(WhichCoil).AirInletNodeNum; + NodeNumber = state.dataHeatingCoils->HeatingCoil(WhichCoil).AirInletNodeNum; } } else { WhichCoil = 0; @@ -3187,9 +3141,9 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } WhichCoil = 0; @@ -3197,9 +3151,9 @@ namespace HeatingCoils { FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingGas_MultiStage || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - NodeNumber = HeatingCoil(WhichCoil).AirOutletNodeNum; + NodeNumber = state.dataHeatingCoils->HeatingCoil(WhichCoil).AirOutletNodeNum; } } else { WhichCoil = 0; @@ -3242,9 +3196,9 @@ namespace HeatingCoils { int CoilNum(0); // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } SuppressWarning = true; @@ -3255,17 +3209,20 @@ namespace HeatingCoils { UtilityRoutines::SameString(CoilType, "COIL:COOLING:DX:TWOSPEED") || UtilityRoutines::SameString(CoilType, "COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE")) { GetDXCoilIndex(state, CoilName, CoilNum, GetCoilErrFlag, CoilType, SuppressWarning); - for (NumCoil = 1; NumCoil <= NumHeatingCoils; ++NumCoil) { - if (HeatingCoil(NumCoil).ReclaimHeatingSource != COIL_DX_COOLING && HeatingCoil(NumCoil).ReclaimHeatingSource != COIL_DX_MULTISPEED && - HeatingCoil(NumCoil).ReclaimHeatingSource != COIL_DX_MULTIMODE && HeatingCoil(NumCoil).ReclaimHeatingCoilName != CoilName) + for (NumCoil = 1; NumCoil <= state.dataHeatingCoils->NumHeatingCoils; ++NumCoil) { + if (state.dataHeatingCoils->HeatingCoil(NumCoil).ReclaimHeatingSource != HeatObjTypes::COIL_DX_COOLING && + state.dataHeatingCoils->HeatingCoil(NumCoil).ReclaimHeatingSource != HeatObjTypes::COIL_DX_MULTISPEED && + state.dataHeatingCoils->HeatingCoil(NumCoil).ReclaimHeatingSource != HeatObjTypes::COIL_DX_MULTIMODE && + state.dataHeatingCoils->HeatingCoil(NumCoil).ReclaimHeatingCoilName != CoilName) continue; CoilFound = CoilNum; break; } } else if (UtilityRoutines::SameString(CoilType, "COIL:COOLING:DX:VARIABLESPEED")) { CoilNum = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, CoilType, CoilName, GetCoilErrFlag); - for (NumCoil = 1; NumCoil <= NumHeatingCoils; ++NumCoil) { - if (HeatingCoil(NumCoil).ReclaimHeatingSource != COIL_DX_VARIABLE_COOLING && HeatingCoil(NumCoil).ReclaimHeatingCoilName != CoilName) + for (NumCoil = 1; NumCoil <= state.dataHeatingCoils->NumHeatingCoils; ++NumCoil) { + if (state.dataHeatingCoils->HeatingCoil(NumCoil).ReclaimHeatingSource != HeatObjTypes::COIL_DX_VARIABLE_COOLING && + state.dataHeatingCoils->HeatingCoil(NumCoil).ReclaimHeatingCoilName != CoilName) continue; CoilFound = CoilNum; break; @@ -3305,9 +3262,9 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } WhichCoil = 0; @@ -3315,9 +3272,9 @@ namespace HeatingCoils { FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingGas_MultiStage || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - NodeNumber = HeatingCoil(WhichCoil).TempSetPointNodeNum; + NodeNumber = state.dataHeatingCoils->HeatingCoil(WhichCoil).TempSetPointNodeNum; } } else { WhichCoil = 0; @@ -3358,9 +3315,9 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } WhichCoil = 0; @@ -3368,9 +3325,9 @@ namespace HeatingCoils { FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingGas_MultiStage || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - TypeNum = HeatingCoil(WhichCoil).HCoilType_Num; + TypeNum = state.dataHeatingCoils->HeatingCoil(WhichCoil).HCoilType_Num; } } else { WhichCoil = 0; @@ -3410,16 +3367,16 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } WhichCoil = 0; FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingGas_MultiStage || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); } else { WhichCoil = 0; } @@ -3459,17 +3416,17 @@ namespace HeatingCoils { int FoundType; // Integer equivalent of coil type // Obtains and Allocates HeatingCoil related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } FoundType = UtilityRoutines::FindItem(CoilType, cAllCoilTypes, NumAllCoilTypes); if (FoundType == Coil_HeatingElectric || FoundType == Coil_HeatingElectric_MultiStage || FoundType == Coil_HeatingGasOrOtherFuel || FoundType == Coil_HeatingGas_MultiStage || FoundType == Coil_HeatingDesuperheater) { - WhichCoil = UtilityRoutines::FindItem(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - IndexNum = HeatingCoil(WhichCoil).PLFCurveIndex; + IndexNum = state.dataHeatingCoils->HeatingCoil(WhichCoil).PLFCurveIndex; } else { ShowSevereError(state, "GetHeatingCoilPLFCurveIndex: Could not find Coil, Type=\"" + CoilType + "\" Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -3506,14 +3463,14 @@ namespace HeatingCoils { int WhichCoil; // Obtains and Allocates HeatingCoils - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, HeatingCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - NumberOfStages = HeatingCoil(WhichCoil).NumOfStages; + NumberOfStages = state.dataHeatingCoils->HeatingCoil(WhichCoil).NumOfStages; } else { ShowSevereError(state, "GetHeatingCoilNumberOfSpeeds: Invalid Heating Coil Type=\"" + CoilType + "\" Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -3523,24 +3480,6 @@ namespace HeatingCoils { return NumberOfStages; } - // Clears the global data in HeatingCoils. - // Needed for unit tests, should not be normally called. - void clear_state() - { - - NumHeatingCoils = 0; - GetCoilsInputFlag = true; - CoilIsSuppHeater = false; - MyOneTimeFlag = true; - InputErrorsFound = false; - - MySizeFlag.deallocate(); - ValidSourceType.deallocate(); - CheckEquipName.deallocate(); - HeatingCoil.deallocate(); - HeatingCoilNumericFields.deallocate(); - } - void SetHeatingCoilData(EnergyPlusData &state, int const CoilNum, // Number of electric or gas heating Coil bool &ErrorsFound, // Set to true if certain errors found @@ -3560,24 +3499,26 @@ namespace HeatingCoils { // Using/Aliasing - if (GetCoilsInputFlag) { + if (state.dataHeatingCoils->GetCoilsInputFlag) { GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } - if (CoilNum <= 0 || CoilNum > NumHeatingCoils) { - ShowSevereError( - state, format("SetHeatingCoilData: called with heating coil Number out of range={} should be >0 and <{}", CoilNum, NumHeatingCoils)); + if (CoilNum <= 0 || CoilNum > state.dataHeatingCoils->NumHeatingCoils) { + ShowSevereError(state, + format("SetHeatingCoilData: called with heating coil Number out of range={} should be >0 and <{}", + CoilNum, + state.dataHeatingCoils->NumHeatingCoils)); ErrorsFound = true; return; } if (present(DesiccantRegenerationCoil)) { - HeatingCoil(CoilNum).DesiccantRegenerationCoil = DesiccantRegenerationCoil; + state.dataHeatingCoils->HeatingCoil(CoilNum).DesiccantRegenerationCoil = DesiccantRegenerationCoil; } if (present(DesiccantDehumIndex)) { - HeatingCoil(CoilNum).DesiccantDehumNum = DesiccantDehumIndex; + state.dataHeatingCoils->HeatingCoil(CoilNum).DesiccantDehumNum = DesiccantDehumIndex; } } @@ -3592,17 +3533,17 @@ namespace HeatingCoils { int HeatingCoilIndex; - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataHeatingCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetHeatingCoilInput(state); - GetCoilsInputFlag = false; + state.dataHeatingCoils->GetCoilsInputFlag = false; } - HeatingCoilIndex = UtilityRoutines::FindItem(HeatingCoilName, HeatingCoil); + HeatingCoilIndex = UtilityRoutines::FindItem(HeatingCoilName, state.dataHeatingCoils->HeatingCoil); if (HeatingCoilIndex == 0) { ShowSevereError(state, "GetCoilIndex: Heating coil not found=" + HeatingCoilName); ErrorsFound = true; } else { - HeatingCoil(HeatingCoilIndex).AirLoopNum = AirLoopNum; + state.dataHeatingCoils->HeatingCoil(HeatingCoilIndex).AirLoopNum = AirLoopNum; } } } // namespace HeatingCoils diff --git a/src/EnergyPlus/HeatingCoils.hh b/src/EnergyPlus/HeatingCoils.hh index 07fe1bde56b..68bda854168 100644 --- a/src/EnergyPlus/HeatingCoils.hh +++ b/src/EnergyPlus/HeatingCoils.hh @@ -64,51 +64,19 @@ struct EnergyPlusData; namespace HeatingCoils { - // Using/Aliasing - - // Data // MODULE PARAMETER DEFINITIONS - extern Real64 const MinAirMassFlow; - extern int NumDesuperheaterCoil; // Total number of desuperheater heating coil objects in input - extern int NumElecCoil; - extern int NumElecCoilMultiStage; - extern int NumFuelCoil; - extern int NumGasCoilMultiStage; - - // reclaim heat object types - extern int const COMPRESSORRACK_REFRIGERATEDCASE; - extern int const COIL_DX_COOLING; - extern int const COIL_DX_MULTISPEED; - extern int const COIL_DX_MULTIMODE; - extern int const CONDENSER_REFRIGERATION; - extern int const COIL_DX_VARIABLE_COOLING; - - // DERIVED TYPE DEFINITIONS - - // MODULE VARIABLE DECLARATIONS: - extern int NumHeatingCoils; // The Number of HeatingCoils found in the Input - extern Array1D_bool MySizeFlag; - extern Array1D_bool ValidSourceType; // Used to determine if a source for a desuperheater heating coil is valid - extern bool GetCoilsInputFlag; // Flag set to make sure you get input once - extern bool CoilIsSuppHeater; // Flag set to indicate the heating coil is a supplemental heater - extern Array1D_bool CheckEquipName; - - // 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 + Real64 constexpr MinAirMassFlow(0.001); - // Reporting routines for module - - // Utility routines for module - - // Types + enum class HeatObjTypes // reclaim heat object types + { + Unassigned, + COMPRESSORRACK_REFRIGERATEDCASE, + COIL_DX_COOLING,// single speed DX + COIL_DX_MULTISPEED, + COIL_DX_MULTIMODE, + CONDENSER_REFRIGERATION, + COIL_DX_VARIABLE_COOLING + }; struct HeatingCoilEquipConditions { @@ -158,7 +126,7 @@ namespace HeatingCoils { int PLFErrorCount; // used in recurring error warnings std::string ReclaimHeatingCoilName; // Name of reclaim heating coil int ReclaimHeatingSourceIndexNum; // Index to reclaim heating source (condenser) of a specific type - int ReclaimHeatingSource; // The source for the Reclaim Heating Coil + HeatObjTypes ReclaimHeatingSource; // The source for the Reclaim Heating Coil // COMPRESSOR RACK:REFRIGERATED CASE = 1 // COIL:DX:COOLINGBYPASSFACTOREMPIRICAL = 2 // COIL:DX:MULTISPEED:COOLINGEMPIRICAL = 3 @@ -183,8 +151,8 @@ namespace HeatingCoils { HeatingCoilLoad(0.0), HeatingCoilRate(0.0), FuelUseLoad(0.0), ElecUseLoad(0.0), FuelUseRate(0.0), ElecUseRate(0.0), Efficiency(0.0), NominalCapacity(0.0), DesiredOutletTemp(0.0), DesiredOutletHumRat(0.0), AvailTemperature(0.0), AirInletNodeNum(0), AirOutletNodeNum(0), TempSetPointNodeNum(0), Control(0), PLFCurveIndex(0), ParasiticElecLoad(0.0), ParasiticFuelLoad(0.0), ParasiticFuelRate(0.0), - ParasiticFuelCapacity(0.0), RTF(0.0), RTFErrorIndex(0), RTFErrorCount(0), PLFErrorIndex(0), PLFErrorCount(0), - ReclaimHeatingSourceIndexNum(0), ReclaimHeatingSource(0), NumOfStages(0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), + ParasiticFuelCapacity(0.0), RTF(0.0), RTFErrorIndex(0), RTFErrorCount(0), PLFErrorIndex(0), PLFErrorCount(0), ReclaimHeatingSourceIndexNum(0), + ReclaimHeatingSource(HeatObjTypes::Unassigned), NumOfStages(0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0), reportCoilFinalSizes(true), AirLoopNum(0) { } @@ -200,11 +168,6 @@ namespace HeatingCoils { } }; - // Object Data - extern Array1D HeatingCoil; - extern Array1D HeatingCoilNumericFields; - - // Functions void SimulateHeatingCoilComponents(EnergyPlusData &state, std::string const &CompName, bool const FirstHVACIteration, @@ -351,10 +314,6 @@ namespace HeatingCoils { bool &ErrorsFound // set to true if problem ); - // Clears the global data in HeatingCoils. - // Needed for unit tests, should not be normally called. - void clear_state(); - // sets data to a coil that is used as a regeneration air heating coil in // desiccant dehumidification system void SetHeatingCoilData(EnergyPlusData &state, int const CoilNum, // Number of electric or gas heating Coil @@ -371,9 +330,56 @@ namespace HeatingCoils { struct HeatingCoilsData : BaseGlobalStruct { + int NumDesuperheaterCoil = 0; // Total number of desuperheater heating coil objects in input + int NumElecCoil = 0; + int NumElecCoilMultiStage = 0; + int NumFuelCoil = 0; + int NumGasCoilMultiStage = 0; + int NumHeatingCoils = 0; // The Number of HeatingCoils found in the Input + Array1D_bool MySizeFlag; + Array1D_bool ValidSourceType; // Used to determine if a source for a desuperheater heating coil is valid + bool GetCoilsInputFlag = true; // Flag set to make sure you get input once + bool CoilIsSuppHeater = false; // Flag set to indicate the heating coil is a supplemental heater + Array1D_bool CheckEquipName; + Array1D HeatingCoil; + Array1D HeatingCoilNumericFields; + bool MyOneTimeFlag = true; // one time initialization flag + bool InputErrorsFound = false; + + int MaxNums = 0; // Maximum number of numeric input fields + int MaxAlphas = 0; // Maximum number of alpha input fields + int TotalArgs = 0; // Total number of alpha and numeric arguments (max) for a certain object in the input file + int ValidSourceTypeCounter = 0; // Counter used to determine if desuperheater source name is valid + bool HeatingCoilFatalError = false; // used for error checking + Array1D_bool MySPTestFlag; // used for error checking + Array1D_bool ShowSingleWarning; // Used for single warning message for desuperheater coil + Array1D_bool MyEnvrnFlag; // one time environment flag + void clear_state() override { - + this->NumDesuperheaterCoil = 0; + this->NumElecCoil = 0; + this->NumElecCoilMultiStage = 0; + this->NumFuelCoil = 0; + this->NumGasCoilMultiStage = 0; + this->NumHeatingCoils = 0; + this->MySizeFlag.deallocate(); + this->ValidSourceType.deallocate(); + this->GetCoilsInputFlag = true; + this->CoilIsSuppHeater = false; + this->CheckEquipName.deallocate(); + this->HeatingCoil.deallocate(); + this->HeatingCoilNumericFields.deallocate(); + this->MyOneTimeFlag = true; + this->InputErrorsFound = false; + this->MaxNums = 0; + this->MaxAlphas = 0; + this->TotalArgs = 0; + this->ValidSourceTypeCounter = 0; + this->HeatingCoilFatalError = false; + this->MySPTestFlag.clear(); + this->ShowSingleWarning.clear(); + this->MyEnvrnFlag.clear(); } }; diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 05431ccb567..be75d49fae4 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -4275,8 +4275,6 @@ namespace EnergyPlus::OutputReportTabular { using DataHVACGlobals::WaterCooled; using EvaporativeFluidCoolers::NumSimpleEvapFluidCoolers; using EvaporativeFluidCoolers::SimpleEvapFluidCooler; - using HeatingCoils::HeatingCoil; - using HeatingCoils::NumHeatingCoils; static Real64 H2OHtOfVap_HVAC = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, state.dataEnvrn->OutDryBulbTemp); static Real64 RhoWater = Psychrometrics::RhoH2O(state.dataEnvrn->OutDryBulbTemp); @@ -4385,11 +4383,12 @@ namespace EnergyPlus::OutputReportTabular { } // Heating coils - fuel - for (int iCoil = 1; iCoil <= NumHeatingCoils; ++iCoil) { - if (HeatingCoil(iCoil).HCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage || - HeatingCoil(iCoil).HCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel) { - state.dataHeatBal->SysTotalHVACRejectHeatLoss += - HeatingCoil(iCoil).FuelUseLoad + HeatingCoil(iCoil).ParasiticFuelLoad - HeatingCoil(iCoil).HeatingCoilLoad; + for (int iCoil = 1; iCoil <= state.dataHeatingCoils->NumHeatingCoils; ++iCoil) { + if (state.dataHeatingCoils->HeatingCoil(iCoil).HCoilType_Num == DataHVACGlobals::Coil_HeatingGas_MultiStage || + state.dataHeatingCoils->HeatingCoil(iCoil).HCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel) { + state.dataHeatBal->SysTotalHVACRejectHeatLoss += state.dataHeatingCoils->HeatingCoil(iCoil).FuelUseLoad + + state.dataHeatingCoils->HeatingCoil(iCoil).ParasiticFuelLoad - + state.dataHeatingCoils->HeatingCoil(iCoil).HeatingCoilLoad; } } diff --git a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc index 7595236ca36..e056e381aff 100644 --- a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc +++ b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc @@ -298,8 +298,8 @@ namespace PhotovoltaicThermalCollectors { ErrorsFound = true; } } - if (allocated(DataPhotovoltaics::PVarray)) { // then PV input gotten... but don't expect this to be true. - PVT(Item).PVnum = UtilityRoutines::FindItemInList(DataIPShortCuts::cAlphaArgs(4), DataPhotovoltaics::PVarray); + if (allocated(state.dataPhotovoltaic->PVarray)) { // then PV input gotten... but don't expect this to be true. + PVT(Item).PVnum = UtilityRoutines::FindItemInList(DataIPShortCuts::cAlphaArgs(4), state.dataPhotovoltaic->PVarray); // check PV if (PVT(Item).PVnum == 0) { ShowSevereError(state, "Invalid " + DataIPShortCuts::cAlphaFieldNames(4) + " = " + DataIPShortCuts::cAlphaArgs(4)); @@ -494,8 +494,8 @@ namespace PhotovoltaicThermalCollectors { // finish set up of PV, because PV get-input follows PVT's get input. if (!this->PVfound) { - if (allocated(DataPhotovoltaics::PVarray)) { - this->PVnum = UtilityRoutines::FindItemInList(this->PVname, DataPhotovoltaics::PVarray); + if (allocated(state.dataPhotovoltaic->PVarray)) { + this->PVnum = UtilityRoutines::FindItemInList(this->PVname, state.dataPhotovoltaic->PVarray); if (this->PVnum == 0) { ShowSevereError(state, "Invalid name for photovoltaic generator = " + this->PVname); ShowContinueError(state, "Entered in flat plate photovoltaic-thermal collector = " + this->Name); @@ -611,7 +611,7 @@ namespace PhotovoltaicThermalCollectors { if (SELECT_CASE_var == WorkingFluidEnum::LIQUID) { // heating only right now, so control flow requests based on incident solar; - if (state.dataHeatBal->SurfQRadSWOutIncident(this->SurfNum) > DataPhotovoltaics::MinIrradiance) { + if (state.dataHeatBal->SurfQRadSWOutIncident(this->SurfNum) > state.dataPhotovoltaic->MinIrradiance) { this->MassFlowRate = this->MaxMassFlowRate; } else { this->MassFlowRate = 0.0; @@ -817,7 +817,7 @@ namespace PhotovoltaicThermalCollectors { if (this->WorkingFluidType == WorkingFluidEnum::AIR) { if (this->PVTModelType == SimplePVTmodel) { - if (state.dataHeatBal->SurfQRadSWOutIncident(this->SurfNum) > DataPhotovoltaics::MinIrradiance) { + if (state.dataHeatBal->SurfQRadSWOutIncident(this->SurfNum) > state.dataPhotovoltaic->MinIrradiance) { // is heating wanted? // Outlet node is required to have a setpoint. if (state.dataLoopNodes->Node(this->HVACOutletNodeNum).TempSetPoint > state.dataLoopNodes->Node(this->HVACInletNodeNum).Temp) { @@ -845,7 +845,7 @@ namespace PhotovoltaicThermalCollectors { } else if (this->WorkingFluidType == WorkingFluidEnum::LIQUID) { if (this->PVTModelType == SimplePVTmodel) { - if (state.dataHeatBal->SurfQRadSWOutIncident(this->SurfNum) > DataPhotovoltaics::MinIrradiance) { + if (state.dataHeatBal->SurfQRadSWOutIncident(this->SurfNum) > state.dataPhotovoltaic->MinIrradiance) { // is heating wanted? this->HeatingUseful = true; this->BypassDamperOff = true; diff --git a/src/EnergyPlus/Photovoltaics.cc b/src/EnergyPlus/Photovoltaics.cc index b46f879a73d..6ce9def72b4 100644 --- a/src/EnergyPlus/Photovoltaics.cc +++ b/src/EnergyPlus/Photovoltaics.cc @@ -153,48 +153,48 @@ namespace Photovoltaics { } if (GeneratorIndex == 0) { - PVnum = UtilityRoutines::FindItemInList(GeneratorName, PVarray); + PVnum = UtilityRoutines::FindItemInList(GeneratorName, state.dataPhotovoltaic->PVarray); if (PVnum == 0) { ShowFatalError(state, "SimPhotovoltaicGenerator: Specified PV not one of valid Photovoltaic Generators " + GeneratorName); } GeneratorIndex = PVnum; } else { PVnum = GeneratorIndex; - if (PVnum > NumPVs || PVnum < 1) { + if (PVnum > state.dataPhotovoltaic->NumPVs || PVnum < 1) { ShowFatalError(state, format("SimPhotovoltaicGenerator: Invalid GeneratorIndex passed={}, Number of PVs={}, Generator name={}", PVnum, - NumPVs, + state.dataPhotovoltaic->NumPVs, GeneratorName)); } if (CheckEquipName(PVnum)) { - if (GeneratorName != PVarray(PVnum).Name) { + if (GeneratorName != state.dataPhotovoltaic->PVarray(PVnum).Name) { ShowFatalError( state, format("SimPhotovoltaicGenerator: Invalid GeneratorIndex passed={}, Generator name={}, stored PV Name for that index={}", PVnum, GeneratorName, - PVarray(PVnum).Name)); + state.dataPhotovoltaic->PVarray(PVnum).Name)); } CheckEquipName(PVnum) = false; } } { - auto const SELECT_CASE_var(PVarray(PVnum).PVModelType); // SELECT and CALL MODELS based on model type + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(PVnum).PVModelType); // SELECT and CALL MODELS based on model type - if (SELECT_CASE_var == iSimplePVModel) { + if (SELECT_CASE_var == PVModel::Simple) { CalcSimplePV(state, PVnum); - } else if (SELECT_CASE_var == iTRNSYSPVModel) { + } else if (SELECT_CASE_var == PVModel::TRNSYS) { // 'PhotovoltaicPeformance:EquivalentOne-Diode' (aka. 5-parameter TRNSYS type 180 model) InitTRNSYSPV(state, PVnum); CalcTRNSYSPV(state, PVnum, RunFlag); - } else if (SELECT_CASE_var == iSandiaPVModel) { + } else if (SELECT_CASE_var == PVModel::Sandia) { // 'PhotovoltaicPerformance:Sandia' (aka. King model, Sandia Nat. Labs.) CalcSandiaPV(state, PVnum, RunFlag); @@ -208,7 +208,8 @@ namespace Photovoltaics { ReportPV(state, PVnum); } - void GetPVGeneratorResults([[maybe_unused]] GeneratorType const GeneratorType, // type of Generator !unused1208 + void GetPVGeneratorResults(EnergyPlusData &state, + [[maybe_unused]] GeneratorType const GeneratorType, // type of Generator !unused1208 int const GeneratorIndex, Real64 &GeneratorPower, // electrical power Real64 &GeneratorEnergy, // electrical energy @@ -228,10 +229,10 @@ namespace Photovoltaics { // Using/Aliasing using PhotovoltaicThermalCollectors::GetPVTThermalPowerProduction; - GeneratorPower = PVarray(GeneratorIndex).Report.DCPower; - GeneratorEnergy = PVarray(GeneratorIndex).Report.DCEnergy; + GeneratorPower = state.dataPhotovoltaic->PVarray(GeneratorIndex).Report.DCPower; + GeneratorEnergy = state.dataPhotovoltaic->PVarray(GeneratorIndex).Report.DCEnergy; // PVT may add thermal - if (PVarray(GeneratorIndex).CellIntegrationMode == iPVTSolarCollectorCellIntegration) { + if (state.dataPhotovoltaic->PVarray(GeneratorIndex).CellIntegrationMode == CellIntegration::PVTSolarCollector) { // get result for thermal power generation GetPVTThermalPowerProduction(GeneratorIndex, ThermalPower, ThermalEnergy); } else { @@ -284,21 +285,22 @@ namespace Photovoltaics { Array1D tmpSNLModuleParams; // temporary, for processing input data // count how many photovoltaic arrays of different types are in the .idf - NumPVs = inputProcessor->getNumObjectsFound(state, cPVGeneratorObjectName); - NumSimplePVModuleTypes = inputProcessor->getNumObjectsFound(state, cPVSimplePerfObjectName); - Num1DiodePVModuleTypes = inputProcessor->getNumObjectsFound(state, cPVEquiv1DiodePerfObjectName); - NumSNLPVModuleTypes = inputProcessor->getNumObjectsFound(state, cPVSandiaPerfObjectName); - - if (NumPVs <= 0) { - ShowSevereError(state, "Did not find any " + cPVGeneratorObjectName); + state.dataPhotovoltaic->NumPVs = inputProcessor->getNumObjectsFound(state, state.dataPhotovoltaic->cPVGeneratorObjectName); + state.dataPhotovoltaic->NumSimplePVModuleTypes = inputProcessor->getNumObjectsFound(state, state.dataPhotovoltaic->cPVSimplePerfObjectName); + state.dataPhotovoltaic->Num1DiodePVModuleTypes = + inputProcessor->getNumObjectsFound(state, state.dataPhotovoltaic->cPVEquiv1DiodePerfObjectName); + state.dataPhotovoltaic->NumSNLPVModuleTypes = inputProcessor->getNumObjectsFound(state, state.dataPhotovoltaic->cPVSandiaPerfObjectName); + + if (state.dataPhotovoltaic->NumPVs <= 0) { + ShowSevereError(state, "Did not find any " + state.dataPhotovoltaic->cPVGeneratorObjectName); return; } - if (!allocated(PVarray)) PVarray.allocate(NumPVs); - CheckEquipName.dimension(NumPVs, true); + if (!allocated(state.dataPhotovoltaic->PVarray)) state.dataPhotovoltaic->PVarray.allocate(state.dataPhotovoltaic->NumPVs); + CheckEquipName.dimension(state.dataPhotovoltaic->NumPVs, true); - cCurrentModuleObject = cPVGeneratorObjectName; - for (PVnum = 1; PVnum <= NumPVs; ++PVnum) { + cCurrentModuleObject = state.dataPhotovoltaic->cPVGeneratorObjectName; + for (PVnum = 1; PVnum <= state.dataPhotovoltaic->NumPVs; ++PVnum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, PVnum, @@ -312,10 +314,10 @@ namespace Photovoltaics { cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - PVarray(PVnum).Name = cAlphaArgs(1); + state.dataPhotovoltaic->PVarray(PVnum).Name = cAlphaArgs(1); - PVarray(PVnum).SurfaceName = cAlphaArgs(2); - PVarray(PVnum).SurfacePtr = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataSurface->Surface); + state.dataPhotovoltaic->PVarray(PVnum).SurfaceName = cAlphaArgs(2); + state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataSurface->Surface); // required-surface if (lAlphaFieldBlanks(2)) { ShowSevereError(state, "Invalid " + cAlphaFieldNames(2) + " = " + cAlphaArgs(2)); @@ -323,13 +325,13 @@ namespace Photovoltaics { ShowContinueError(state, "Surface name cannot be blank"); ErrorsFound = true; } - if (PVarray(PVnum).SurfacePtr == 0) { + if (state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr == 0) { ShowSevereError(state, "Invalid " + cAlphaFieldNames(2) + " = " + cAlphaArgs(2)); ShowContinueError(state, "Entered in " + cCurrentModuleObject + " = " + cAlphaArgs(1)); ErrorsFound = true; } else { // Found one -- make sure has right parameters for PV - SurfNum = PVarray(PVnum).SurfacePtr; + SurfNum = state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr; state.dataSurface->Surface(SurfNum).IsPV = true; if (!state.dataSurface->Surface(SurfNum).ExtSolar) { @@ -337,7 +339,7 @@ namespace Photovoltaics { ShowContinueError(state, "Entered in " + cCurrentModuleObject + " = " + cAlphaArgs(1)); ShowContinueError(state, "Surface is not exposed to solar, check surface bounday condition"); } - PVarray(PVnum).Zone = GetPVZone(state, PVarray(PVnum).SurfacePtr); + state.dataPhotovoltaic->PVarray(PVnum).Zone = GetPVZone(state, state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr); // check surface orientation, warn if upside down if ((state.dataSurface->Surface(SurfNum).Tilt < -95.0) || (state.dataSurface->Surface(SurfNum).Tilt > 95.0)) { @@ -348,13 +350,13 @@ namespace Photovoltaics { } } - PVarray(PVnum).PVModelType = iNotYetSetPVModel; - if (UtilityRoutines::SameString(cAlphaArgs(3), cPVSimplePerfObjectName)) { - PVarray(PVnum).PVModelType = iSimplePVModel; - } else if (UtilityRoutines::SameString(cAlphaArgs(3), cPVEquiv1DiodePerfObjectName)) { - PVarray(PVnum).PVModelType = iTRNSYSPVModel; - } else if (UtilityRoutines::SameString(cAlphaArgs(3), cPVSandiaPerfObjectName)) { - PVarray(PVnum).PVModelType = iSandiaPVModel; + state.dataPhotovoltaic->PVarray(PVnum).PVModelType = PVModel::Unassigned; + if (UtilityRoutines::SameString(cAlphaArgs(3), state.dataPhotovoltaic->cPVSimplePerfObjectName)) { + state.dataPhotovoltaic->PVarray(PVnum).PVModelType = PVModel::Simple; + } else if (UtilityRoutines::SameString(cAlphaArgs(3), state.dataPhotovoltaic->cPVEquiv1DiodePerfObjectName)) { + state.dataPhotovoltaic->PVarray(PVnum).PVModelType = PVModel::TRNSYS; + } else if (UtilityRoutines::SameString(cAlphaArgs(3), state.dataPhotovoltaic->cPVSandiaPerfObjectName)) { + state.dataPhotovoltaic->PVarray(PVnum).PVModelType = PVModel::Sandia; } else { // throw error, did not find module performance type if (lAlphaFieldBlanks(3)) { ShowSevereError(state, "Invalid " + cAlphaFieldNames(3) + " = " + cAlphaArgs(3)); @@ -368,21 +370,21 @@ namespace Photovoltaics { ErrorsFound = true; } } - PVarray(PVnum).PerfObjName = cAlphaArgs(4); // check later once perf objects are loaded + state.dataPhotovoltaic->PVarray(PVnum).PerfObjName = cAlphaArgs(4); // check later once perf objects are loaded - PVarray(PVnum).CellIntegrationMode = iNotYetSetCellIntegration; + state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode = CellIntegration::Unassigned; if (UtilityRoutines::SameString(cAlphaArgs(5), "Decoupled")) { - PVarray(PVnum).CellIntegrationMode = iDecoupledCellIntegration; + state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode = CellIntegration::Decoupled; } else if (UtilityRoutines::SameString(cAlphaArgs(5), "DecoupledUllebergDynamic")) { - PVarray(PVnum).CellIntegrationMode = iDecoupledUllebergDynamicCellIntegration; + state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode = CellIntegration::DecoupledUllebergDynamic; } else if (UtilityRoutines::SameString(cAlphaArgs(5), "IntegratedSurfaceOutsideFace")) { - PVarray(PVnum).CellIntegrationMode = iSurfaceOutsideFaceCellIntegration; + state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode = CellIntegration::SurfaceOutsideFace; } else if (UtilityRoutines::SameString(cAlphaArgs(5), "IntegratedTranspiredCollector")) { - PVarray(PVnum).CellIntegrationMode = iTranspiredCollectorCellIntegration; + state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode = CellIntegration::TranspiredCollector; } else if (UtilityRoutines::SameString(cAlphaArgs(5), "IntegratedExteriorVentedCavity")) { - PVarray(PVnum).CellIntegrationMode = iExteriorVentedCavityCellIntegration; + state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode = CellIntegration::ExteriorVentedCavity; } else if (UtilityRoutines::SameString(cAlphaArgs(5), "PhotovoltaicThermalSolarCollector")) { - PVarray(PVnum).CellIntegrationMode = iPVTSolarCollectorCellIntegration; + state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode = CellIntegration::PVTSolarCollector; } else { if (lAlphaFieldBlanks(5)) { ShowSevereError(state, "Invalid " + cAlphaFieldNames(5) + " = " + cAlphaArgs(5)); @@ -397,38 +399,44 @@ namespace Photovoltaics { } } - PVarray(PVnum).NumSeriesNParall = rNumericArgs(1); - PVarray(PVnum).NumModNSeries = rNumericArgs(2); + state.dataPhotovoltaic->PVarray(PVnum).NumSeriesNParall = rNumericArgs(1); + state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries = rNumericArgs(2); } // main PV array objects // search for duplicate PV arrays on integrated heat transfer surfaces, accumulating source terms across arrays is not supported - for (PVnum = 1; PVnum <= NumPVs; ++PVnum) { + for (PVnum = 1; PVnum <= state.dataPhotovoltaic->NumPVs; ++PVnum) { { - auto const SELECT_CASE_var(PVarray(PVnum).CellIntegrationMode); + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode); - if ((SELECT_CASE_var == iSurfaceOutsideFaceCellIntegration) || (SELECT_CASE_var == iTranspiredCollectorCellIntegration) || - (SELECT_CASE_var == iExteriorVentedCavityCellIntegration)) { - dupPtr = UtilityRoutines::FindItemInList(PVarray(PVnum).SurfaceName, PVarray({PVnum + 1, NumPVs}), &PVArrayStruct::SurfaceName); + if ((SELECT_CASE_var == CellIntegration::SurfaceOutsideFace) || (SELECT_CASE_var == CellIntegration::TranspiredCollector) || + (SELECT_CASE_var == CellIntegration::ExteriorVentedCavity)) { + dupPtr = UtilityRoutines::FindItemInList(state.dataPhotovoltaic->PVarray(PVnum).SurfaceName, + state.dataPhotovoltaic->PVarray({PVnum + 1, state.dataPhotovoltaic->NumPVs}), + &PVArrayStruct::SurfaceName); if (dupPtr != 0) dupPtr += PVnum; // to correct for shortened array in find item if (dupPtr != 0) { - if (PVarray(dupPtr).CellIntegrationMode == iSurfaceOutsideFaceCellIntegration) { + if (state.dataPhotovoltaic->PVarray(dupPtr).CellIntegrationMode == CellIntegration::SurfaceOutsideFace) { ShowSevereError(state, cCurrentModuleObject + ": problem detected with multiple PV arrays."); ShowContinueError(state, "When using IntegratedSurfaceOutsideFace heat transfer mode, only one PV array can be coupled"); - ShowContinueError(state, "Both " + PVarray(PVnum).Name + " and " + PVarray(dupPtr).Name + " are using surface " + - PVarray(PVnum).SurfaceName); + ShowContinueError(state, + "Both " + state.dataPhotovoltaic->PVarray(PVnum).Name + " and " + + state.dataPhotovoltaic->PVarray(dupPtr).Name + + " are using surface " + + state.dataPhotovoltaic->PVarray(PVnum).SurfaceName); ErrorsFound = true; - } else if (PVarray(dupPtr).CellIntegrationMode == iTranspiredCollectorCellIntegration) { + } else if (state.dataPhotovoltaic->PVarray(dupPtr).CellIntegrationMode == CellIntegration::TranspiredCollector) { ShowSevereError(state, cCurrentModuleObject + ": problem detected with multiple PV arrays."); ShowContinueError(state, "When using IntegratedTranspiredCollector heat transfer mode, only one PV array can be coupled"); - ShowContinueError(state, "Both " + PVarray(PVnum).Name + " and " + PVarray(dupPtr).Name + - " are using UTSC surface = " + PVarray(PVnum).SurfaceName); + ShowContinueError(state, + "Both " + state.dataPhotovoltaic->PVarray(PVnum).Name + " and " + state.dataPhotovoltaic->PVarray(dupPtr).Name + + " are using UTSC surface = " + state.dataPhotovoltaic->PVarray(PVnum).SurfaceName); ErrorsFound = true; - } else if (PVarray(dupPtr).CellIntegrationMode == iExteriorVentedCavityCellIntegration) { + } else if (state.dataPhotovoltaic->PVarray(dupPtr).CellIntegrationMode == CellIntegration::ExteriorVentedCavity) { ShowSevereError(state, cCurrentModuleObject + ": problem detected with multiple PV arrays."); ShowContinueError(state, "When using IntegratedExteriorVentedCavity heat transfer mode, only one PV array can be coupled"); - ShowContinueError(state, "Both " + PVarray(PVnum).Name + " and " + PVarray(dupPtr).Name + - " are using exterior vented surface = " + PVarray(PVnum).SurfaceName); + ShowContinueError(state, "Both " + state.dataPhotovoltaic->PVarray(PVnum).Name + " and " + state.dataPhotovoltaic->PVarray(dupPtr).Name + + " are using exterior vented surface = " + state.dataPhotovoltaic->PVarray(PVnum).SurfaceName); ErrorsFound = true; } } @@ -436,10 +444,10 @@ namespace Photovoltaics { } } - if (NumSimplePVModuleTypes > 0) { - tmpSimpleModuleParams.allocate(NumSimplePVModuleTypes); - cCurrentModuleObject = cPVSimplePerfObjectName; - for (ModNum = 1; ModNum <= NumSimplePVModuleTypes; ++ModNum) { + if (state.dataPhotovoltaic->NumSimplePVModuleTypes > 0) { + tmpSimpleModuleParams.allocate(state.dataPhotovoltaic->NumSimplePVModuleTypes); + cCurrentModuleObject = state.dataPhotovoltaic->cPVSimplePerfObjectName; + for (ModNum = 1; ModNum <= state.dataPhotovoltaic->NumSimplePVModuleTypes; ++ModNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, ModNum, @@ -459,9 +467,9 @@ namespace Photovoltaics { tmpSimpleModuleParams(ModNum).ActiveFraction = rNumericArgs(1); if (UtilityRoutines::SameString(cAlphaArgs(2), "Fixed")) { - tmpSimpleModuleParams(ModNum).EfficencyInputMode = FixedEfficiency; + tmpSimpleModuleParams(ModNum).EfficencyInputMode = Efficiency::Fixed; } else if (UtilityRoutines::SameString(cAlphaArgs(2), "Scheduled")) { - tmpSimpleModuleParams(ModNum).EfficencyInputMode = ScheduledEfficiency; + tmpSimpleModuleParams(ModNum).EfficencyInputMode = Efficiency::Scheduled; } else { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, "Invalid " + cAlphaFieldNames(2) + " = " + cAlphaArgs(2)); @@ -478,7 +486,7 @@ namespace Photovoltaics { tmpSimpleModuleParams(ModNum).PVEfficiency = rNumericArgs(2); tmpSimpleModuleParams(ModNum).EffSchedPtr = GetScheduleIndex(state, cAlphaArgs(3)); - if ((tmpSimpleModuleParams(ModNum).EffSchedPtr == 0) && (tmpSimpleModuleParams(ModNum).EfficencyInputMode == ScheduledEfficiency)) { + if ((tmpSimpleModuleParams(ModNum).EffSchedPtr == 0) && (tmpSimpleModuleParams(ModNum).EfficencyInputMode == Efficiency::Scheduled)) { ShowSevereError(state, "Invalid " + cAlphaFieldNames(3) + " = " + cAlphaArgs(3)); ShowContinueError(state, "Entered in " + cCurrentModuleObject + " = " + cAlphaArgs(1)); ShowContinueError(state, "Did not find schedule"); @@ -487,10 +495,10 @@ namespace Photovoltaics { } } - if (Num1DiodePVModuleTypes > 0) { - tmpTNRSYSModuleParams.allocate(Num1DiodePVModuleTypes); - cCurrentModuleObject = cPVEquiv1DiodePerfObjectName; - for (ModNum = 1; ModNum <= Num1DiodePVModuleTypes; ++ModNum) { + if (state.dataPhotovoltaic->Num1DiodePVModuleTypes > 0) { + tmpTNRSYSModuleParams.allocate(state.dataPhotovoltaic->Num1DiodePVModuleTypes); + cCurrentModuleObject = state.dataPhotovoltaic->cPVEquiv1DiodePerfObjectName; + for (ModNum = 1; ModNum <= state.dataPhotovoltaic->Num1DiodePVModuleTypes; ++ModNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, ModNum, @@ -508,9 +516,9 @@ namespace Photovoltaics { } tmpTNRSYSModuleParams(ModNum).Name = cAlphaArgs(1); if (UtilityRoutines::SameString(cAlphaArgs(2), "CrystallineSilicon")) { - tmpTNRSYSModuleParams(ModNum).CellType = CrystallineSiPVCells; + tmpTNRSYSModuleParams(ModNum).CellType = SiPVCells::Crystalline; } else if (UtilityRoutines::SameString(cAlphaArgs(2), "AmorphousSilicon")) { - tmpTNRSYSModuleParams(ModNum).CellType = AmorphousSiPVCells; + tmpTNRSYSModuleParams(ModNum).CellType = SiPVCells::Amorphous; } else { if (lAlphaFieldBlanks(2)) { ShowSevereError(state, "Invalid " + cAlphaFieldNames(2) + " = " + cAlphaArgs(2)); @@ -546,10 +554,10 @@ namespace Photovoltaics { } } - if (NumSNLPVModuleTypes > 0) { - tmpSNLModuleParams.allocate(NumSNLPVModuleTypes); - cCurrentModuleObject = cPVSandiaPerfObjectName; - for (ModNum = 1; ModNum <= NumSNLPVModuleTypes; ++ModNum) { + if (state.dataPhotovoltaic->NumSNLPVModuleTypes > 0) { + tmpSNLModuleParams.allocate(state.dataPhotovoltaic->NumSNLPVModuleTypes); + cCurrentModuleObject = state.dataPhotovoltaic->cPVSandiaPerfObjectName; + for (ModNum = 1; ModNum <= state.dataPhotovoltaic->NumSNLPVModuleTypes; ++ModNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -611,45 +619,51 @@ namespace Photovoltaics { } // now fill collector performance data into main PV structure - for (PVnum = 1; PVnum <= NumPVs; ++PVnum) { + for (PVnum = 1; PVnum <= state.dataPhotovoltaic->NumPVs; ++PVnum) { { - auto const SELECT_CASE_var(PVarray(PVnum).PVModelType); + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(PVnum).PVModelType); - if (SELECT_CASE_var == iSimplePVModel) { + if (SELECT_CASE_var == PVModel::Simple) { - ThisParamObj = UtilityRoutines::FindItemInList(PVarray(PVnum).PerfObjName, tmpSimpleModuleParams); + ThisParamObj = UtilityRoutines::FindItemInList(state.dataPhotovoltaic->PVarray(PVnum).PerfObjName, tmpSimpleModuleParams); if (ThisParamObj > 0) { - PVarray(PVnum).SimplePVModule = tmpSimpleModuleParams(ThisParamObj); // entire structure assignment + state.dataPhotovoltaic->PVarray(PVnum).SimplePVModule = tmpSimpleModuleParams(ThisParamObj); // entire structure assignment // do one-time setups on input data - PVarray(PVnum).SimplePVModule.AreaCol = - state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).Area * PVarray(PVnum).SimplePVModule.ActiveFraction; + state.dataPhotovoltaic->PVarray(PVnum).SimplePVModule.AreaCol = + state.dataSurface->Surface(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr).Area * state.dataPhotovoltaic->PVarray(PVnum).SimplePVModule.ActiveFraction; } else { - ShowSevereError(state, "Invalid PV performance object name of " + PVarray(PVnum).PerfObjName); - ShowContinueError(state, "Entered in " + cPVGeneratorObjectName + " = " + PVarray(PVnum).Name); + ShowSevereError(state, "Invalid PV performance object name of " + state.dataPhotovoltaic->PVarray(PVnum).PerfObjName); + ShowContinueError(state, + "Entered in " + state.dataPhotovoltaic->cPVGeneratorObjectName + " = " + + state.dataPhotovoltaic->PVarray(PVnum).Name); ErrorsFound = true; } - } else if (SELECT_CASE_var == iTRNSYSPVModel) { + } else if (SELECT_CASE_var == PVModel::TRNSYS) { - ThisParamObj = UtilityRoutines::FindItemInList(PVarray(PVnum).PerfObjName, tmpTNRSYSModuleParams); + ThisParamObj = UtilityRoutines::FindItemInList(state.dataPhotovoltaic->PVarray(PVnum).PerfObjName, tmpTNRSYSModuleParams); if (ThisParamObj > 0) { - PVarray(PVnum).TRNSYSPVModule = tmpTNRSYSModuleParams(ThisParamObj); // entire structure assignment + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule = tmpTNRSYSModuleParams(ThisParamObj); // entire structure assignment } else { - ShowSevereError(state, "Invalid PV performance object name of " + PVarray(PVnum).PerfObjName); - ShowContinueError(state, "Entered in " + cPVGeneratorObjectName + " = " + PVarray(PVnum).Name); + ShowSevereError(state, "Invalid PV performance object name of " + state.dataPhotovoltaic->PVarray(PVnum).PerfObjName); + ShowContinueError(state, + "Entered in " + state.dataPhotovoltaic->cPVGeneratorObjectName + " = " + + state.dataPhotovoltaic->PVarray(PVnum).Name); ErrorsFound = true; } - } else if (SELECT_CASE_var == iSandiaPVModel) { + } else if (SELECT_CASE_var == PVModel::Sandia) { - ThisParamObj = UtilityRoutines::FindItemInList(PVarray(PVnum).PerfObjName, tmpSNLModuleParams, &SNLModuleParamsStuct::name); + ThisParamObj = UtilityRoutines::FindItemInList(state.dataPhotovoltaic->PVarray(PVnum).PerfObjName, tmpSNLModuleParams, &SNLModuleParamsStuct::name); if (ThisParamObj > 0) { - PVarray(PVnum).SNLPVModule = tmpSNLModuleParams(ThisParamObj); // entire structure assignment + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule = tmpSNLModuleParams(ThisParamObj); // entire structure assignment } else { - ShowSevereError(state, "Invalid PV performance object name of " + PVarray(PVnum).PerfObjName); - ShowContinueError(state, "Entered in " + cPVGeneratorObjectName + " = " + PVarray(PVnum).Name); + ShowSevereError(state, "Invalid PV performance object name of " + state.dataPhotovoltaic->PVarray(PVnum).PerfObjName); + ShowContinueError(state, + "Entered in " + state.dataPhotovoltaic->cPVGeneratorObjectName + " = " + + state.dataPhotovoltaic->PVarray(PVnum).Name); ErrorsFound = true; } } @@ -659,16 +673,16 @@ namespace Photovoltaics { SetupOutputVariable(state, "Generator Produced DC Electricity Rate", OutputProcessor::Unit::W, - PVarray(PVnum).Report.DCPower, + state.dataPhotovoltaic->PVarray(PVnum).Report.DCPower, "System", "Average", - PVarray(PVnum).Name); + state.dataPhotovoltaic->PVarray(PVnum).Name); SetupOutputVariable(state, "Generator Produced DC Electricity Energy", OutputProcessor::Unit::J, - PVarray(PVnum).Report.DCEnergy, + state.dataPhotovoltaic->PVarray(PVnum).Report.DCEnergy, "System", "Sum", - PVarray(PVnum).Name, + state.dataPhotovoltaic->PVarray(PVnum).Name, _, "ElectricityProduced", "Photovoltaics", @@ -676,56 +690,56 @@ namespace Photovoltaics { "Plant"); SetupOutputVariable(state, "Generator PV Array Efficiency", OutputProcessor::Unit::None, - PVarray(PVnum).Report.ArrayEfficiency, + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayEfficiency, "System", "Average", - PVarray(PVnum).Name); + state.dataPhotovoltaic->PVarray(PVnum).Name); // CurrentModuleObject='Equiv1Diode or Sandia Photovoltaics' - if ((PVarray(PVnum).PVModelType == iTRNSYSPVModel) || (PVarray(PVnum).PVModelType == iSandiaPVModel)) { + if ((state.dataPhotovoltaic->PVarray(PVnum).PVModelType == PVModel::TRNSYS) || (state.dataPhotovoltaic->PVarray(PVnum).PVModelType == PVModel::Sandia)) { SetupOutputVariable(state, "Generator PV Cell Temperature", OutputProcessor::Unit::C, - PVarray(PVnum).Report.CellTemp, + state.dataPhotovoltaic->PVarray(PVnum).Report.CellTemp, "System", "Average", - PVarray(PVnum).Name); + state.dataPhotovoltaic->PVarray(PVnum).Name); SetupOutputVariable(state, "Generator PV Short Circuit Current", OutputProcessor::Unit::A, - PVarray(PVnum).Report.ArrayIsc, + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayIsc, "System", "Average", - PVarray(PVnum).Name); + state.dataPhotovoltaic->PVarray(PVnum).Name); SetupOutputVariable(state, "Generator PV Open Circuit Voltage", OutputProcessor::Unit::V, - PVarray(PVnum).Report.ArrayVoc, + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayVoc, "System", "Average", - PVarray(PVnum).Name); + state.dataPhotovoltaic->PVarray(PVnum).Name); } // do some checks and setup - if (PVarray(PVnum).PVModelType == iSurfaceOutsideFaceCellIntegration) { + if (state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode == CellIntegration::SurfaceOutsideFace) { // check that surface is HeatTransfer and a Construction with Internal Source was used - if (!state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).HeatTransSurf) { - ShowSevereError(state, "Must use a surface with heat transfer for IntegratedSurfaceOutsideFace mode in " + PVarray(PVnum).Name); + if (!state.dataSurface->Surface(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr).HeatTransSurf) { + ShowSevereError(state, "Must use a surface with heat transfer for IntegratedSurfaceOutsideFace mode in " + state.dataPhotovoltaic->PVarray(PVnum).Name); ErrorsFound = true; - } else if (!state.dataConstruction->Construct(state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).Construction).SourceSinkPresent) { + } else if (!state.dataConstruction->Construct(state.dataSurface->Surface(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr).Construction).SourceSinkPresent) { ShowSevereError(state, "Must use a surface with internal source construction for IntegratedSurfaceOutsideFace mode in " + - PVarray(PVnum).Name); + state.dataPhotovoltaic->PVarray(PVnum).Name); ErrorsFound = true; } } - if (PVarray(PVnum).CellIntegrationMode == iTranspiredCollectorCellIntegration) { - GetTranspiredCollectorIndex(state, PVarray(PVnum).SurfacePtr, PVarray(PVnum).UTSCPtr); + if (state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode == CellIntegration::TranspiredCollector) { + GetTranspiredCollectorIndex(state, state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr, state.dataPhotovoltaic->PVarray(PVnum).UTSCPtr); } - if (PVarray(PVnum).CellIntegrationMode == iExteriorVentedCavityCellIntegration) { - GetExtVentedCavityIndex(state, PVarray(PVnum).SurfacePtr, PVarray(PVnum).ExtVentCavPtr); + if (state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode == CellIntegration::ExteriorVentedCavity) { + GetExtVentedCavityIndex(state, state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr, state.dataPhotovoltaic->PVarray(PVnum).ExtVentCavPtr); } - if (PVarray(PVnum).CellIntegrationMode == iPVTSolarCollectorCellIntegration) { - // Call GetPVTmodelIndex( PVarray(PVNum)%SurfacePtr , PVarray(PVNum)%PVTPtr ) + if (state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode == CellIntegration::PVTSolarCollector) { + // Call GetPVTmodelIndex( state.dataPhotovoltaic->PVarray(PVNum)%SurfacePtr , state.dataPhotovoltaic->PVarray(PVNum)%PVTPtr ) } } @@ -777,22 +791,22 @@ namespace Photovoltaics { int ThisSurf; // working index ptr to Surface arrays Real64 Eff; // working variable for solar electric efficiency - ThisSurf = PVarray(thisPV).SurfacePtr; + ThisSurf = state.dataPhotovoltaic->PVarray(thisPV).SurfacePtr; - if (state.dataHeatBal->SurfQRadSWOutIncident(ThisSurf) > MinIrradiance) { + if (state.dataHeatBal->SurfQRadSWOutIncident(ThisSurf) > state.dataPhotovoltaic->MinIrradiance) { // get efficiency { - auto const SELECT_CASE_var(PVarray(thisPV).SimplePVModule.EfficencyInputMode); + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.EfficencyInputMode); - if (SELECT_CASE_var == FixedEfficiency) { + if (SELECT_CASE_var == Efficiency::Fixed) { - Eff = PVarray(thisPV).SimplePVModule.PVEfficiency; + Eff = state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.PVEfficiency; - } else if (SELECT_CASE_var == ScheduledEfficiency) { // get from schedule + } else if (SELECT_CASE_var == Efficiency::Scheduled) { // get from schedule - Eff = GetCurrentScheduleValue(state, PVarray(thisPV).SimplePVModule.EffSchedPtr); - PVarray(thisPV).SimplePVModule.PVEfficiency = Eff; + Eff = GetCurrentScheduleValue(state, state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.EffSchedPtr); + state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.PVEfficiency = Eff; } else { Eff = 0.0; // Suppress uninitialized warning @@ -800,22 +814,22 @@ namespace Photovoltaics { } } - PVarray(thisPV).Report.DCPower = - PVarray(thisPV).SimplePVModule.AreaCol * Eff * + state.dataPhotovoltaic->PVarray(thisPV).Report.DCPower = + state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.AreaCol * Eff * state.dataHeatBal->SurfQRadSWOutIncident(ThisSurf); // active solar cellsurface net area | solar conversion efficiency | solar incident // store sink term in appropriate place for surface heat transfer itegration - PVarray(thisPV).SurfaceSink = PVarray(thisPV).Report.DCPower; + state.dataPhotovoltaic->PVarray(thisPV).SurfaceSink = state.dataPhotovoltaic->PVarray(thisPV).Report.DCPower; // array energy, power * timestep - PVarray(thisPV).Report.DCEnergy = PVarray(thisPV).Report.DCPower * (TimeStepSys * DataGlobalConstants::SecInHour); - PVarray(thisPV).Report.ArrayEfficiency = Eff; + state.dataPhotovoltaic->PVarray(thisPV).Report.DCEnergy = state.dataPhotovoltaic->PVarray(thisPV).Report.DCPower * (TimeStepSys * DataGlobalConstants::SecInHour); + state.dataPhotovoltaic->PVarray(thisPV).Report.ArrayEfficiency = Eff; } else { // not enough incident solar, zero things out - PVarray(thisPV).SurfaceSink = 0.0; - PVarray(thisPV).Report.DCEnergy = 0.0; - PVarray(thisPV).Report.DCPower = 0.0; - PVarray(thisPV).Report.ArrayEfficiency = 0.0; + state.dataPhotovoltaic->PVarray(thisPV).SurfaceSink = 0.0; + state.dataPhotovoltaic->PVarray(thisPV).Report.DCEnergy = 0.0; + state.dataPhotovoltaic->PVarray(thisPV).Report.DCPower = 0.0; + state.dataPhotovoltaic->PVarray(thisPV).Report.ArrayEfficiency = 0.0; } } @@ -836,30 +850,30 @@ namespace Photovoltaics { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int thisZone; // working index for zones - PVarray(PVnum).Report.DCEnergy = PVarray(PVnum).Report.DCPower * (state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour); + state.dataPhotovoltaic->PVarray(PVnum).Report.DCEnergy = state.dataPhotovoltaic->PVarray(PVnum).Report.DCPower * (state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour); // add check for multiplier. if surface is attached to a zone that is on a multiplier // then PV production should be multiplied out as well - thisZone = PVarray(PVnum).Zone; + thisZone = state.dataPhotovoltaic->PVarray(PVnum).Zone; if (thisZone != 0) { // might need to apply multiplier - PVarray(PVnum).Report.DCEnergy *= (state.dataHeatBal->Zone(thisZone).Multiplier * state.dataHeatBal->Zone(thisZone).ListMultiplier); - PVarray(PVnum).Report.DCPower *= (state.dataHeatBal->Zone(thisZone).Multiplier * state.dataHeatBal->Zone(thisZone).ListMultiplier); + state.dataPhotovoltaic->PVarray(PVnum).Report.DCEnergy *= (state.dataHeatBal->Zone(thisZone).Multiplier * state.dataHeatBal->Zone(thisZone).ListMultiplier); + state.dataPhotovoltaic->PVarray(PVnum).Report.DCPower *= (state.dataHeatBal->Zone(thisZone).Multiplier * state.dataHeatBal->Zone(thisZone).ListMultiplier); } { - auto const SELECT_CASE_var(PVarray(PVnum).CellIntegrationMode); + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode); // SurfaceSink is not multiplied... - if (SELECT_CASE_var == iSurfaceOutsideFaceCellIntegration) { - state.dataHeatBalFanSys->QPVSysSource(PVarray(PVnum).SurfacePtr) = -1.0 * PVarray(PVnum).SurfaceSink; + if (SELECT_CASE_var == CellIntegration::SurfaceOutsideFace) { + state.dataHeatBalFanSys->QPVSysSource(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr) = -1.0 * state.dataPhotovoltaic->PVarray(PVnum).SurfaceSink; - } else if (SELECT_CASE_var == iTranspiredCollectorCellIntegration) { - SetUTSCQdotSource(state, PVarray(PVnum).UTSCPtr, -1.0 * PVarray(PVnum).SurfaceSink); + } else if (SELECT_CASE_var == CellIntegration::TranspiredCollector) { + SetUTSCQdotSource(state, state.dataPhotovoltaic->PVarray(PVnum).UTSCPtr, -1.0 * state.dataPhotovoltaic->PVarray(PVnum).SurfaceSink); - } else if (SELECT_CASE_var == iExteriorVentedCavityCellIntegration) { - SetVentedModuleQdotSource(state, PVarray(PVnum).ExtVentCavPtr, -1.0 * PVarray(PVnum).SurfaceSink); + } else if (SELECT_CASE_var == CellIntegration::ExteriorVentedCavity) { + SetVentedModuleQdotSource(state, state.dataPhotovoltaic->PVarray(PVnum).ExtVentCavPtr, -1.0 * state.dataPhotovoltaic->PVarray(PVnum).SurfaceSink); - } else if (SELECT_CASE_var == iPVTSolarCollectorCellIntegration) { + } else if (SELECT_CASE_var == CellIntegration::PVTSolarCollector) { } } } @@ -899,204 +913,204 @@ namespace Photovoltaics { int ThisSurf; // working variable for indexing surfaces Real64 Ee; - ThisSurf = PVarray(PVnum).SurfacePtr; + ThisSurf = state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr; // get input from elsewhere in Energyplus for the current point in the simulation - PVarray(PVnum).SNLPVinto.IcBeam = state.dataHeatBal->SurfQRadSWOutIncidentBeam(ThisSurf); //(W/m2)from DataHeatBalance - PVarray(PVnum).SNLPVinto.IcDiffuse = state.dataHeatBal->SurfQRadSWOutIncident(ThisSurf) - state.dataHeatBal->SurfQRadSWOutIncidentBeam(ThisSurf); //(W/ m2)(was kJ/hr m2) - PVarray(PVnum).SNLPVinto.IncidenceAngle = std::acos(state.dataHeatBal->SurfCosIncidenceAngle(ThisSurf)) / DataGlobalConstants::DegToRadians; // (deg) from dataHeatBalance - PVarray(PVnum).SNLPVinto.ZenithAngle = std::acos(state.dataEnvrn->SOLCOS(3)) / DataGlobalConstants::DegToRadians; //(degrees), - PVarray(PVnum).SNLPVinto.Tamb = state.dataSurface->Surface(ThisSurf).OutDryBulbTemp; //(deg. C) - PVarray(PVnum).SNLPVinto.WindSpeed = state.dataSurface->Surface(ThisSurf).WindSpeed; // (m/s) - PVarray(PVnum).SNLPVinto.Altitude = state.dataEnvrn->Elevation; // from DataEnvironment via USE + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam = state.dataHeatBal->SurfQRadSWOutIncidentBeam(ThisSurf); //(W/m2)from DataHeatBalance + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse = state.dataHeatBal->SurfQRadSWOutIncident(ThisSurf) - state.dataHeatBal->SurfQRadSWOutIncidentBeam(ThisSurf); //(W/ m2)(was kJ/hr m2) + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IncidenceAngle = std::acos(state.dataHeatBal->SurfCosIncidenceAngle(ThisSurf)) / DataGlobalConstants::DegToRadians; // (deg) from dataHeatBalance + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.ZenithAngle = std::acos(state.dataEnvrn->SOLCOS(3)) / DataGlobalConstants::DegToRadians; //(degrees), + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.Tamb = state.dataSurface->Surface(ThisSurf).OutDryBulbTemp; //(deg. C) + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.WindSpeed = state.dataSurface->Surface(ThisSurf).WindSpeed; // (m/s) + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.Altitude = state.dataEnvrn->Elevation; // from DataEnvironment via USE - if (((PVarray(PVnum).SNLPVinto.IcBeam + PVarray(PVnum).SNLPVinto.IcDiffuse) > MinIrradiance) && (RunFlag)) { + if (((state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse) > state.dataPhotovoltaic->MinIrradiance) && (RunFlag)) { // first determine PV cell temperatures depending on model { - auto const SELECT_CASE_var(PVarray(PVnum).CellIntegrationMode); + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode); - if (SELECT_CASE_var == iDecoupledCellIntegration) { // Sandia module temperature model for rack mounted PVs + if (SELECT_CASE_var == CellIntegration::Decoupled) { // Sandia module temperature model for rack mounted PVs // Calculate back-of-module temperature: - PVarray(PVnum).SNLPVCalc.Tback = SandiaModuleTemperature(PVarray(PVnum).SNLPVinto.IcBeam, - PVarray(PVnum).SNLPVinto.IcDiffuse, - PVarray(PVnum).SNLPVinto.WindSpeed, - PVarray(PVnum).SNLPVinto.Tamb, - PVarray(PVnum).SNLPVModule.fd, - PVarray(PVnum).SNLPVModule.a, - PVarray(PVnum).SNLPVModule.b); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback = SandiaModuleTemperature(state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.WindSpeed, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.Tamb, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.fd, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.a, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.b); // Calculate cell temperature: - PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(PVarray(PVnum).SNLPVCalc.Tback, - PVarray(PVnum).SNLPVinto.IcBeam, - PVarray(PVnum).SNLPVinto.IcDiffuse, - PVarray(PVnum).SNLPVModule.fd, - PVarray(PVnum).SNLPVModule.DT0); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.fd, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.DT0); - } else if (SELECT_CASE_var == iSurfaceOutsideFaceCellIntegration) { + } else if (SELECT_CASE_var == CellIntegration::SurfaceOutsideFace) { // get back-of-module temperature from elsewhere in EnergyPlus - PVarray(PVnum).SNLPVCalc.Tback = state.dataHeatBalSurf->SurfTempOut(PVarray(PVnum).SurfacePtr); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback = state.dataHeatBalSurf->SurfTempOut(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr); - PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(PVarray(PVnum).SNLPVCalc.Tback, - PVarray(PVnum).SNLPVinto.IcBeam, - PVarray(PVnum).SNLPVinto.IcDiffuse, - PVarray(PVnum).SNLPVModule.fd, - PVarray(PVnum).SNLPVModule.DT0); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.fd, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.DT0); - } else if (SELECT_CASE_var == iTranspiredCollectorCellIntegration) { - GetUTSCTsColl(state, PVarray(PVnum).UTSCPtr, PVarray(PVnum).SNLPVCalc.Tback); + } else if (SELECT_CASE_var == CellIntegration::TranspiredCollector) { + GetUTSCTsColl(state, state.dataPhotovoltaic->PVarray(PVnum).UTSCPtr, state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback); - PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(PVarray(PVnum).SNLPVCalc.Tback, - PVarray(PVnum).SNLPVinto.IcBeam, - PVarray(PVnum).SNLPVinto.IcDiffuse, - PVarray(PVnum).SNLPVModule.fd, - PVarray(PVnum).SNLPVModule.DT0); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.fd, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.DT0); - } else if (SELECT_CASE_var == iExteriorVentedCavityCellIntegration) { - GetExtVentedCavityTsColl(state, PVarray(PVnum).ExtVentCavPtr, PVarray(PVnum).SNLPVCalc.Tback); + } else if (SELECT_CASE_var == CellIntegration::ExteriorVentedCavity) { + GetExtVentedCavityTsColl(state, state.dataPhotovoltaic->PVarray(PVnum).ExtVentCavPtr, state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback); - PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(PVarray(PVnum).SNLPVCalc.Tback, - PVarray(PVnum).SNLPVinto.IcBeam, - PVarray(PVnum).SNLPVinto.IcDiffuse, - PVarray(PVnum).SNLPVModule.fd, - PVarray(PVnum).SNLPVModule.DT0); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell = SandiaTcellFromTmodule(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.fd, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.DT0); - } else if (SELECT_CASE_var == iPVTSolarCollectorCellIntegration) { + } else if (SELECT_CASE_var == CellIntegration::PVTSolarCollector) { // add calls to PVT models here } else { - ShowSevereError(state, "Sandia PV Simulation Temperature Modeling Mode Error in " + PVarray(PVnum).Name); + ShowSevereError(state, "Sandia PV Simulation Temperature Modeling Mode Error in " + state.dataPhotovoltaic->PVarray(PVnum).Name); } } // Calculate Air Mass function - PVarray(PVnum).SNLPVCalc.AMa = AbsoluteAirMass(PVarray(PVnum).SNLPVinto.ZenithAngle, PVarray(PVnum).SNLPVinto.Altitude); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.AMa = AbsoluteAirMass(state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.ZenithAngle, state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.Altitude); // Calculate F1 polynomial function: - PVarray(PVnum).SNLPVCalc.F1 = SandiaF1(PVarray(PVnum).SNLPVCalc.AMa, - PVarray(PVnum).SNLPVModule.a_0, - PVarray(PVnum).SNLPVModule.a_1, - PVarray(PVnum).SNLPVModule.a_2, - PVarray(PVnum).SNLPVModule.a_3, - PVarray(PVnum).SNLPVModule.a_4); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.F1 = SandiaF1(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.AMa, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.a_0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.a_1, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.a_2, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.a_3, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.a_4); // Calculate F2 polynomial function: - PVarray(PVnum).SNLPVCalc.F2 = SandiaF2(PVarray(PVnum).SNLPVinto.IncidenceAngle, - PVarray(PVnum).SNLPVModule.b_0, - PVarray(PVnum).SNLPVModule.b_1, - PVarray(PVnum).SNLPVModule.b_2, - PVarray(PVnum).SNLPVModule.b_3, - PVarray(PVnum).SNLPVModule.b_4, - PVarray(PVnum).SNLPVModule.b_5); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.F2 = SandiaF2(state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IncidenceAngle, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.b_0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.b_1, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.b_2, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.b_3, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.b_4, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.b_5); // Calculate short-circuit current function: - PVarray(PVnum).SNLPVCalc.Isc = SandiaIsc(PVarray(PVnum).SNLPVCalc.Tcell, - PVarray(PVnum).SNLPVModule.Isc0, - PVarray(PVnum).SNLPVinto.IcBeam, - PVarray(PVnum).SNLPVinto.IcDiffuse, - PVarray(PVnum).SNLPVCalc.F1, - PVarray(PVnum).SNLPVCalc.F2, - PVarray(PVnum).SNLPVModule.fd, - PVarray(PVnum).SNLPVModule.aIsc); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Isc = SandiaIsc(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Isc0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.F1, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.F2, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.fd, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.aIsc); // Calculate effective irradiance function: Ee = SandiaEffectiveIrradiance( - PVarray(PVnum).SNLPVCalc.Tcell, PVarray(PVnum).SNLPVCalc.Isc, PVarray(PVnum).SNLPVModule.Isc0, PVarray(PVnum).SNLPVModule.aIsc); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell, state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Isc, state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Isc0, state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.aIsc); // Calculate Imp function: - PVarray(PVnum).SNLPVCalc.Imp = SandiaImp(PVarray(PVnum).SNLPVCalc.Tcell, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Imp = SandiaImp(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell, Ee, - PVarray(PVnum).SNLPVModule.Imp0, - PVarray(PVnum).SNLPVModule.aImp, - PVarray(PVnum).SNLPVModule.c_0, - PVarray(PVnum).SNLPVModule.c_1); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Imp0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.aImp, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_1); // Calculate Voc function: - PVarray(PVnum).SNLPVCalc.Voc = SandiaVoc(PVarray(PVnum).SNLPVCalc.Tcell, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Voc = SandiaVoc(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell, Ee, - PVarray(PVnum).SNLPVModule.Voc0, - PVarray(PVnum).SNLPVModule.NcellSer, - PVarray(PVnum).SNLPVModule.DiodeFactor, - PVarray(PVnum).SNLPVModule.BVoc0, - PVarray(PVnum).SNLPVModule.mBVoc); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Voc0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.NcellSer, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.DiodeFactor, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.BVoc0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.mBVoc); // Calculate Vmp: voltagea at maximum powerpoint - PVarray(PVnum).SNLPVCalc.Vmp = SandiaVmp(PVarray(PVnum).SNLPVCalc.Tcell, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vmp = SandiaVmp(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell, Ee, - PVarray(PVnum).SNLPVModule.Vmp0, - PVarray(PVnum).SNLPVModule.NcellSer, - PVarray(PVnum).SNLPVModule.DiodeFactor, - PVarray(PVnum).SNLPVModule.BVmp0, - PVarray(PVnum).SNLPVModule.mBVmp, - PVarray(PVnum).SNLPVModule.c_2, - PVarray(PVnum).SNLPVModule.c_3); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Vmp0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.NcellSer, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.DiodeFactor, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.BVmp0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.mBVmp, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_2, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_3); // Calculate Ix function: - PVarray(PVnum).SNLPVCalc.Ix = SandiaIx(PVarray(PVnum).SNLPVCalc.Tcell, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Ix = SandiaIx(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell, Ee, - PVarray(PVnum).SNLPVModule.Ix0, - PVarray(PVnum).SNLPVModule.aIsc, - PVarray(PVnum).SNLPVModule.aImp, - PVarray(PVnum).SNLPVModule.c_4, - PVarray(PVnum).SNLPVModule.c_5); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Ix0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.aIsc, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.aImp, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_4, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_5); // Calculate Vx function: - PVarray(PVnum).SNLPVCalc.Vx = PVarray(PVnum).SNLPVCalc.Voc / 2.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vx = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Voc / 2.0; // Calculate Ixx function: - PVarray(PVnum).SNLPVCalc.Ixx = SandiaIxx(PVarray(PVnum).SNLPVCalc.Tcell, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Ixx = SandiaIxx(state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell, Ee, - PVarray(PVnum).SNLPVModule.Ixx0, - PVarray(PVnum).SNLPVModule.aImp, - PVarray(PVnum).SNLPVModule.c_6, - PVarray(PVnum).SNLPVModule.c_7); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Ixx0, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.aImp, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_6, + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.c_7); // Calculate Vxx : - PVarray(PVnum).SNLPVCalc.Vxx = 0.5 * (PVarray(PVnum).SNLPVCalc.Voc + PVarray(PVnum).SNLPVCalc.Vmp); + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vxx = 0.5 * (state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Voc + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vmp); // Calculate Pmp, single module: power at maximum powerpoint - PVarray(PVnum).SNLPVCalc.Pmp = PVarray(PVnum).SNLPVCalc.Imp * PVarray(PVnum).SNLPVCalc.Vmp; // W + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Pmp = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Imp * state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vmp; // W // Calculate PV efficiency at maximum power point - PVarray(PVnum).SNLPVCalc.EffMax = PVarray(PVnum).SNLPVCalc.Pmp / (PVarray(PVnum).SNLPVinto.IcBeam + PVarray(PVnum).SNLPVinto.IcDiffuse) / - PVarray(PVnum).SNLPVModule.Acoll; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.EffMax = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Pmp / (state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcBeam + state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.IcDiffuse) / + state.dataPhotovoltaic->PVarray(PVnum).SNLPVModule.Acoll; // Scale to NumStrings and NumSeries: - PVarray(PVnum).SNLPVCalc.Pmp *= PVarray(PVnum).NumSeriesNParall * PVarray(PVnum).NumModNSeries; - PVarray(PVnum).SNLPVCalc.Imp *= PVarray(PVnum).NumModNSeries; - PVarray(PVnum).SNLPVCalc.Vmp *= PVarray(PVnum).NumModNSeries; - PVarray(PVnum).SNLPVCalc.Isc *= PVarray(PVnum).NumSeriesNParall; - PVarray(PVnum).SNLPVCalc.Voc *= PVarray(PVnum).NumModNSeries; - PVarray(PVnum).SNLPVCalc.Ix *= PVarray(PVnum).NumSeriesNParall; - PVarray(PVnum).SNLPVCalc.Ixx *= PVarray(PVnum).NumSeriesNParall; - PVarray(PVnum).SNLPVCalc.Vx *= PVarray(PVnum).NumModNSeries; - PVarray(PVnum).SNLPVCalc.Vxx *= PVarray(PVnum).NumModNSeries; - PVarray(PVnum).SNLPVCalc.SurfaceSink = PVarray(PVnum).SNLPVCalc.Pmp; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Pmp *= state.dataPhotovoltaic->PVarray(PVnum).NumSeriesNParall * state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Imp *= state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vmp *= state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Isc *= state.dataPhotovoltaic->PVarray(PVnum).NumSeriesNParall; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Voc *= state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Ix *= state.dataPhotovoltaic->PVarray(PVnum).NumSeriesNParall; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Ixx *= state.dataPhotovoltaic->PVarray(PVnum).NumSeriesNParall; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vx *= state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vxx *= state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.SurfaceSink = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Pmp; } else { // Ibeam+Idiff < MaxIrradiance or not RunFlag // so zero things. - PVarray(PVnum).SNLPVCalc.Vmp = 0.0; - PVarray(PVnum).SNLPVCalc.Imp = 0.0; - PVarray(PVnum).SNLPVCalc.Pmp = 0.0; - PVarray(PVnum).SNLPVCalc.EffMax = 0.0; - PVarray(PVnum).SNLPVCalc.Isc = 0.0; - PVarray(PVnum).SNLPVCalc.Voc = 0.0; - PVarray(PVnum).SNLPVCalc.Tcell = PVarray(PVnum).SNLPVinto.Tamb; - PVarray(PVnum).SNLPVCalc.Tback = PVarray(PVnum).SNLPVinto.Tamb; - PVarray(PVnum).SNLPVCalc.AMa = 999.0; - PVarray(PVnum).SNLPVCalc.F1 = 0.0; - PVarray(PVnum).SNLPVCalc.F2 = 0.0; - PVarray(PVnum).SNLPVCalc.Ix = 0.0; - PVarray(PVnum).SNLPVCalc.Vx = 0.0; - PVarray(PVnum).SNLPVCalc.Ixx = 0.0; - PVarray(PVnum).SNLPVCalc.Vxx = 0.0; - PVarray(PVnum).SNLPVCalc.SurfaceSink = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vmp = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Imp = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Pmp = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.EffMax = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Isc = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Voc = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell = state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.Tamb; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tback = state.dataPhotovoltaic->PVarray(PVnum).SNLPVinto.Tamb; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.AMa = 999.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.F1 = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.F2 = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Ix = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vx = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Ixx = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Vxx = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.SurfaceSink = 0.0; } // Ibeam+Idiff > MinIrradiance and runflag // update calculations to report variables - PVarray(PVnum).Report.DCPower = PVarray(PVnum).SNLPVCalc.Pmp; - PVarray(PVnum).Report.ArrayIsc = PVarray(PVnum).SNLPVCalc.Isc; - PVarray(PVnum).Report.ArrayVoc = PVarray(PVnum).SNLPVCalc.Voc; - PVarray(PVnum).Report.CellTemp = PVarray(PVnum).SNLPVCalc.Tcell; - PVarray(PVnum).Report.ArrayEfficiency = PVarray(PVnum).SNLPVCalc.EffMax; - PVarray(PVnum).SurfaceSink = PVarray(PVnum).SNLPVCalc.SurfaceSink; + state.dataPhotovoltaic->PVarray(PVnum).Report.DCPower = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Pmp; + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayIsc = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Isc; + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayVoc = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Voc; + state.dataPhotovoltaic->PVarray(PVnum).Report.CellTemp = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.Tcell; + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayEfficiency = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.EffMax; + state.dataPhotovoltaic->PVarray(PVnum).SurfaceSink = state.dataPhotovoltaic->PVarray(PVnum).SNLPVCalc.SurfaceSink; } // ******************** @@ -1127,15 +1141,15 @@ namespace Photovoltaics { // perform the one time initializations if (MyOneTimeFlag) { // initialize the environment and sizing flags - MyEnvrnFlag.dimension(NumPVs, true); + MyEnvrnFlag.dimension(state.dataPhotovoltaic->NumPVs, true); MyOneTimeFlag = false; } // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && MyEnvrnFlag(PVnum)) { - PVarray(PVnum).TRNSYSPVcalc.CellTempK = state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv; - PVarray(PVnum).TRNSYSPVcalc.LastCellTempK = state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.CellTempK = state.dataSurface->Surface(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.LastCellTempK = state.dataSurface->Surface(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv; MyEnvrnFlag(PVnum) = false; } @@ -1145,17 +1159,17 @@ namespace Photovoltaics { // Do the beginning of every time step initializations TimeElapsed = state.dataGlobal->HourOfDay + state.dataGlobal->TimeStep * state.dataGlobal->TimeStepZone + SysTimeElapsed; - if (PVarray(PVnum).TRNSYSPVcalc.TimeElapsed != TimeElapsed) { + if (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.TimeElapsed != TimeElapsed) { // The simulation has advanced to the next system timestep. Save conditions from the end of the previous system - PVarray(PVnum).TRNSYSPVcalc.LastCellTempK = PVarray(PVnum).TRNSYSPVcalc.CellTempK; - PVarray(PVnum).TRNSYSPVcalc.TimeElapsed = TimeElapsed; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.LastCellTempK = state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.CellTempK; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.TimeElapsed = TimeElapsed; } if (any_gt(state.dataHeatBal->SurfQRadSWOutIncident, 0.0)) { // Determine the amount of radiation incident on each PV - PVarray(PVnum).TRNSYSPVcalc.Insolation = state.dataHeatBal->SurfQRadSWOutIncident(PVarray(PVnum).SurfacePtr); //[W/m2] + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation = state.dataHeatBal->SurfQRadSWOutIncident(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr); //[W/m2] } else { - PVarray(PVnum).TRNSYSPVcalc.Insolation = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation = 0.0; } } @@ -1219,18 +1233,18 @@ namespace Photovoltaics { // unused1208 INTEGER :: thisZone // if the cell temperature mode is 2, convert the timestep to seconds - if (firstTime && PVarray(PVnum).CellIntegrationMode == iDecoupledUllebergDynamicCellIntegration) { + if (firstTime && state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode == CellIntegration::DecoupledUllebergDynamic) { PVTimeStep = double(state.dataGlobal->MinutesPerTimeStep) * 60.0; // Seconds per time step } firstTime = false; // place the shunt resistance into its common block - ShuntResistance = PVarray(PVnum).TRNSYSPVModule.ShuntResistance; + state.dataPhotovoltaic->ShuntResistance = state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.ShuntResistance; // convert ambient temperature from C to K - Tambient = state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv; + Tambient = state.dataSurface->Surface(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv; - if ((PVarray(PVnum).TRNSYSPVcalc.Insolation > MinInsolation) && (RunFlag)) { + if ((state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation > MinInsolation) && (RunFlag)) { // set initial values for eta iteration loop DummyErr = 2.0 * ERR; @@ -1242,59 +1256,59 @@ namespace Photovoltaics { while (DummyErr > ERR) { { - auto const SELECT_CASE_var(PVarray(PVnum).CellIntegrationMode); - if (SELECT_CASE_var == iDecoupledCellIntegration) { + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode); + if (SELECT_CASE_var == CellIntegration::Decoupled) { // cell temperature based on energy balance - PVarray(PVnum).TRNSYSPVModule.HeatLossCoef = - PVarray(PVnum).TRNSYSPVModule.TauAlpha * PVarray(PVnum).TRNSYSPVModule.NOCTInsolation / - (PVarray(PVnum).TRNSYSPVModule.NOCTCellTemp - PVarray(PVnum).TRNSYSPVModule.NOCTAmbTemp); - CellTemp = Tambient + (PVarray(PVnum).TRNSYSPVcalc.Insolation * PVarray(PVnum).TRNSYSPVModule.TauAlpha / - PVarray(PVnum).TRNSYSPVModule.HeatLossCoef) * - (1.0 - ETA / PVarray(PVnum).TRNSYSPVModule.TauAlpha); - } else if (SELECT_CASE_var == iDecoupledUllebergDynamicCellIntegration) { + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatLossCoef = + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TauAlpha * state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.NOCTInsolation / + (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.NOCTCellTemp - state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.NOCTAmbTemp); + CellTemp = Tambient + (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation * state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TauAlpha / + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatLossCoef) * + (1.0 - ETA / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TauAlpha); + } else if (SELECT_CASE_var == CellIntegration::DecoupledUllebergDynamic) { // cell temperature based on energy balance with thermal capacity effects CellTemp = Tambient + - (PVarray(PVnum).TRNSYSPVcalc.LastCellTempK - Tambient) * - std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep) + - (PVarray(PVnum).TRNSYSPVModule.TauAlpha - ETA) * PVarray(PVnum).TRNSYSPVcalc.Insolation / - PVarray(PVnum).TRNSYSPVModule.HeatLossCoef * + (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.LastCellTempK - Tambient) * + std::exp(-state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep) + + (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TauAlpha - ETA) * state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation / + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatLossCoef * (1.0 - - std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep)); - } else if (SELECT_CASE_var == iSurfaceOutsideFaceCellIntegration) { - CellTemp = state.dataHeatBalSurf->SurfTempOut(PVarray(PVnum).SurfacePtr) + DataGlobalConstants::KelvinConv; - } else if (SELECT_CASE_var == iTranspiredCollectorCellIntegration) { - GetUTSCTsColl(state, PVarray(PVnum).UTSCPtr, CellTemp); + std::exp(-state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep)); + } else if (SELECT_CASE_var == CellIntegration::SurfaceOutsideFace) { + CellTemp = state.dataHeatBalSurf->SurfTempOut(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr) + DataGlobalConstants::KelvinConv; + } else if (SELECT_CASE_var == CellIntegration::TranspiredCollector) { + GetUTSCTsColl(state, state.dataPhotovoltaic->PVarray(PVnum).UTSCPtr, CellTemp); CellTemp += DataGlobalConstants::KelvinConv; - } else if (SELECT_CASE_var == iExteriorVentedCavityCellIntegration) { - GetExtVentedCavityTsColl(state, PVarray(PVnum).ExtVentCavPtr, CellTemp); + } else if (SELECT_CASE_var == CellIntegration::ExteriorVentedCavity) { + GetExtVentedCavityTsColl(state, state.dataPhotovoltaic->PVarray(PVnum).ExtVentCavPtr, CellTemp); CellTemp += DataGlobalConstants::KelvinConv; - } else if (SELECT_CASE_var == iPVTSolarCollectorCellIntegration) { + } else if (SELECT_CASE_var == CellIntegration::PVTSolarCollector) { // get PVT model result for cell temp.. } } // reference parameters - ILRef = PVarray(PVnum).TRNSYSPVModule.RefIsc; + ILRef = state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefIsc; AARef = - (PVarray(PVnum).TRNSYSPVModule.TempCoefVoc * PVarray(PVnum).TRNSYSPVModule.RefTemperature - PVarray(PVnum).TRNSYSPVModule.RefVoc + - PVarray(PVnum).TRNSYSPVModule.SemiConductorBandgap * PVarray(PVnum).TRNSYSPVModule.CellsInSeries) / - (PVarray(PVnum).TRNSYSPVModule.TempCoefIsc * PVarray(PVnum).TRNSYSPVModule.RefTemperature / ILRef - 3.0); - IORef = ILRef * std::exp(-PVarray(PVnum).TRNSYSPVModule.RefVoc / AARef); + (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TempCoefVoc * state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefTemperature - state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefVoc + + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.SemiConductorBandgap * state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.CellsInSeries) / + (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TempCoefIsc * state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefTemperature / ILRef - 3.0); + IORef = ILRef * std::exp(-state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefVoc / AARef); // series resistance - SeriesResistance = (AARef * std::log(1.0 - PVarray(PVnum).TRNSYSPVModule.Imp / ILRef) - PVarray(PVnum).TRNSYSPVModule.Vmp + - PVarray(PVnum).TRNSYSPVModule.RefVoc) / - PVarray(PVnum).TRNSYSPVModule.Imp; + SeriesResistance = (AARef * std::log(1.0 - state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.Imp / ILRef) - state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.Vmp + + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefVoc) / + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.Imp; // temperature depencence - IL = PVarray(PVnum).TRNSYSPVcalc.Insolation / PVarray(PVnum).TRNSYSPVModule.RefInsolation * - (ILRef + PVarray(PVnum).TRNSYSPVModule.TempCoefIsc * (CellTemp - PVarray(PVnum).TRNSYSPVModule.RefTemperature)); - Real64 const cell_temp_ratio(CellTemp / PVarray(PVnum).TRNSYSPVModule.RefTemperature); + IL = state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefInsolation * + (ILRef + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TempCoefIsc * (CellTemp - state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefTemperature)); + Real64 const cell_temp_ratio(CellTemp / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefTemperature); AA = AARef * cell_temp_ratio; IO = IORef * pow_3(cell_temp_ratio) * - std::exp(PVarray(PVnum).TRNSYSPVModule.SemiConductorBandgap * PVarray(PVnum).TRNSYSPVModule.CellsInSeries / AARef * - (1.0 - PVarray(PVnum).TRNSYSPVModule.RefTemperature / CellTemp)); + std::exp(state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.SemiConductorBandgap * state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.CellsInSeries / AARef * + (1.0 - state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefTemperature / CellTemp)); // compute short curcuit current and open circuit voltage @@ -1317,7 +1331,7 @@ namespace Photovoltaics { POWER(state, IO, IL, SeriesResistance, AA, EPS, IM, VM, PM); // calculate overall PV module efficiency - ETA = PM / PVarray(PVnum).TRNSYSPVcalc.Insolation / PVarray(PVnum).TRNSYSPVModule.Area; + ETA = PM / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.Area; DummyErr = std::abs((ETA - EtaOld) / EtaOld); EtaOld = ETA; ++CC; @@ -1327,29 +1341,29 @@ namespace Photovoltaics { } else { // if there is no incident radiation or if the control switch is 'Off' { - auto const SELECT_CASE_var(PVarray(PVnum).CellIntegrationMode); - if (SELECT_CASE_var == iDecoupledCellIntegration) { + auto const SELECT_CASE_var(state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode); + if (SELECT_CASE_var == CellIntegration::Decoupled) { CellTemp = Tambient; - } else if (SELECT_CASE_var == iDecoupledUllebergDynamicCellIntegration) { + } else if (SELECT_CASE_var == CellIntegration::DecoupledUllebergDynamic) { CellTemp = Tambient + - (PVarray(PVnum).TRNSYSPVcalc.LastCellTempK - Tambient) * - std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep); - } else if (SELECT_CASE_var == iSurfaceOutsideFaceCellIntegration) { - CellTemp = state.dataHeatBalSurf->SurfTempOut(PVarray(PVnum).SurfacePtr) + DataGlobalConstants::KelvinConv; - } else if (SELECT_CASE_var == iTranspiredCollectorCellIntegration) { - GetUTSCTsColl(state, PVarray(PVnum).UTSCPtr, CellTemp); + (state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.LastCellTempK - Tambient) * + std::exp(-state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep); + } else if (SELECT_CASE_var == CellIntegration::SurfaceOutsideFace) { + CellTemp = state.dataHeatBalSurf->SurfTempOut(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr) + DataGlobalConstants::KelvinConv; + } else if (SELECT_CASE_var == CellIntegration::TranspiredCollector) { + GetUTSCTsColl(state, state.dataPhotovoltaic->PVarray(PVnum).UTSCPtr, CellTemp); CellTemp += DataGlobalConstants::KelvinConv; - } else if (SELECT_CASE_var == iExteriorVentedCavityCellIntegration) { - GetExtVentedCavityTsColl(state, PVarray(PVnum).ExtVentCavPtr, CellTemp); + } else if (SELECT_CASE_var == CellIntegration::ExteriorVentedCavity) { + GetExtVentedCavityTsColl(state, state.dataPhotovoltaic->PVarray(PVnum).ExtVentCavPtr, CellTemp); CellTemp += DataGlobalConstants::KelvinConv; - } else if (SELECT_CASE_var == iPVTSolarCollectorCellIntegration) { + } else if (SELECT_CASE_var == CellIntegration::PVTSolarCollector) { // get PVT model result for cell temp.. //Bug CellTemp not set but used below } else { assert(false); } } - PVarray(PVnum).TRNSYSPVcalc.Insolation = 0.0; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation = 0.0; IM = 0.0; // module current VM = 0.0; // module voltage PM = 0.0; // module power @@ -1362,27 +1376,27 @@ namespace Photovoltaics { CellTempC = CellTemp - DataGlobalConstants::KelvinConv; // calculate array based outputs (so far, the outputs are module based - IA = PVarray(PVnum).NumSeriesNParall * IM; - ISCA = PVarray(PVnum).NumSeriesNParall * ISC; - VA = PVarray(PVnum).NumModNSeries * VM; - VOCA = PVarray(PVnum).NumModNSeries * VOC; + IA = state.dataPhotovoltaic->PVarray(PVnum).NumSeriesNParall * IM; + ISCA = state.dataPhotovoltaic->PVarray(PVnum).NumSeriesNParall * ISC; + VA = state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries * VM; + VOCA = state.dataPhotovoltaic->PVarray(PVnum).NumModNSeries * VOC; PA = IA * VA; // Place local variables into the reporting structure - PVarray(PVnum).TRNSYSPVcalc.ArrayCurrent = IA; - PVarray(PVnum).TRNSYSPVcalc.ArrayVoltage = VA; - PVarray(PVnum).TRNSYSPVcalc.ArrayPower = PA; - PVarray(PVnum).Report.DCPower = PA; - PVarray(PVnum).TRNSYSPVcalc.ArrayEfficiency = ETA; - PVarray(PVnum).Report.ArrayEfficiency = ETA; - PVarray(PVnum).TRNSYSPVcalc.CellTemp = CellTempC; - PVarray(PVnum).Report.CellTemp = CellTempC; - PVarray(PVnum).TRNSYSPVcalc.CellTempK = CellTemp; - PVarray(PVnum).TRNSYSPVcalc.ArrayIsc = ISCA; - PVarray(PVnum).Report.ArrayIsc = ISCA; - PVarray(PVnum).TRNSYSPVcalc.ArrayVoc = VOCA; - PVarray(PVnum).Report.ArrayVoc = VOCA; - PVarray(PVnum).SurfaceSink = PA; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.ArrayCurrent = IA; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.ArrayVoltage = VA; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.ArrayPower = PA; + state.dataPhotovoltaic->PVarray(PVnum).Report.DCPower = PA; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.ArrayEfficiency = ETA; + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayEfficiency = ETA; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.CellTemp = CellTempC; + state.dataPhotovoltaic->PVarray(PVnum).Report.CellTemp = CellTempC; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.CellTempK = CellTemp; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.ArrayIsc = ISCA; + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayIsc = ISCA; + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.ArrayVoc = VOCA; + state.dataPhotovoltaic->PVarray(PVnum).Report.ArrayVoc = VOCA; + state.dataPhotovoltaic->PVarray(PVnum).SurfaceSink = PA; } void POWER(EnergyPlusData &state, @@ -1557,11 +1571,11 @@ namespace Photovoltaics { Real64 FUN(0.0); if (((VV + II * RSER) / AA) < 700.0) { - FUN = II - IL + IO * (std::exp((VV + II * RSER) / AA) - 1.0) - ((VV + II * RSER) / ShuntResistance); + FUN = II - IL + IO * (std::exp((VV + II * RSER) / AA) - 1.0) - ((VV + II * RSER) / state.dataPhotovoltaic->ShuntResistance); } else { ShowSevereError(state, "EquivalentOneDiode Photovoltaic model failed to find maximum power point"); ShowContinueError(state, "Numerical solver failed trying to take exponential of too large a number"); - ShowContinueError(state, "Check input data in " + cPVEquiv1DiodePerfObjectName); + ShowContinueError(state, "Check input data in " + state.dataPhotovoltaic->cPVEquiv1DiodePerfObjectName); ShowContinueError(state, format("VV (voltage) = {:.5R}", VV)); ShowContinueError(state, format("II (current) = {:.5R}", II)); ShowFatalError(state, "FUN: EnergyPlus terminates because of numerical problem in EquivalentOne-Diode PV model"); @@ -1590,11 +1604,11 @@ namespace Photovoltaics { Real64 FI(0.0); if (((VV + II * RSER) / AA) < 700.0) { - FI = 1.0 + IO * std::exp((VV + II * RSER) / AA) * RSER / AA + (RSER / ShuntResistance); + FI = 1.0 + IO * std::exp((VV + II * RSER) / AA) * RSER / AA + (RSER / state.dataPhotovoltaic->ShuntResistance); } else { ShowSevereError(state, "EquivalentOneDiode Photovoltaic model failed to find maximum power point"); ShowContinueError(state, "Numerical solver failed trying to take exponential of too large a number"); - ShowContinueError(state, "Check input data in " + cPVEquiv1DiodePerfObjectName); + ShowContinueError(state, "Check input data in " + state.dataPhotovoltaic->cPVEquiv1DiodePerfObjectName); ShowContinueError(state, format("VV (voltage) = {:.5R}", VV)); ShowContinueError(state, format("II (current) = {:.5R}", II)); ShowFatalError(state, "FI: EnergyPlus terminates because of numerical problem in EquivalentOne-Diode PV model"); @@ -1623,11 +1637,11 @@ namespace Photovoltaics { Real64 FV(0.0); if (((VV + II * RSER) / AA) < 700.0) { - FV = IO * std::exp((VV + II * RSER) / AA) / AA + (1.0 / ShuntResistance); + FV = IO * std::exp((VV + II * RSER) / AA) / AA + (1.0 / state.dataPhotovoltaic->ShuntResistance); } else { ShowSevereError(state, "EquivalentOneDiode Photovoltaic model failed to find maximum power point"); ShowContinueError(state, "Numerical solver failed trying to take exponential of too large a number"); - ShowContinueError(state, "Check input data in " + cPVEquiv1DiodePerfObjectName); + ShowContinueError(state, "Check input data in " + state.dataPhotovoltaic->cPVEquiv1DiodePerfObjectName); ShowContinueError(state, format("VV (voltage) = {:.5R}", VV)); ShowContinueError(state, format("II (current) = {:.5R}", II)); ShowFatalError(state, "FI: EnergyPlus terminates because of numerical problem in EquivalentOne-Diode PV model"); diff --git a/src/EnergyPlus/Photovoltaics.hh b/src/EnergyPlus/Photovoltaics.hh index 66fd10c69f7..8ff0b00368c 100644 --- a/src/EnergyPlus/Photovoltaics.hh +++ b/src/EnergyPlus/Photovoltaics.hh @@ -85,7 +85,8 @@ namespace Photovoltaics { Real64 const PVLoad // electrical load on the PV (not really used... PV models assume "full on" ); - void GetPVGeneratorResults(GeneratorType const GeneratorType, // type of Generator + void GetPVGeneratorResults(EnergyPlusData &state, + GeneratorType const GeneratorType, // type of Generator int const GeneratorIndex, Real64 &GeneratorPower, // electrical power Real64 &GeneratorEnergy, // electrical energy diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index 0f9bc6a476f..bb58f7fe512 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -930,54 +930,54 @@ namespace EnergyPlus::SizingManager { } // sum up heating and max flows for any dual duct air terminals - if (allocated(DualDuct::dd_airterminal) && DualDuct::NumDDAirTerminal > 0) { - for (int dualDuctATUNum = 1; dualDuctATUNum <= DualDuct::NumDDAirTerminal; ++dualDuctATUNum) { - if (AirLoopNum == DualDuct::dd_airterminal(dualDuctATUNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(DualDuct::dd_airterminal(dualDuctATUNum).ADUNum).TermUnitSizingNum; - airLoopMaxFlowRateSum += DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; + if (allocated(state.dataDualDuct->dd_airterminal) && state.dataDualDuct->NumDDAirTerminal > 0) { + for (int dualDuctATUNum = 1; dualDuctATUNum <= state.dataDualDuct->NumDDAirTerminal; ++dualDuctATUNum) { + if (AirLoopNum == state.dataDualDuct->dd_airterminal(dualDuctATUNum).AirLoopNum) { + int termUnitSizingIndex = AirDistUnit(state.dataDualDuct->dd_airterminal(dualDuctATUNum).ADUNum).TermUnitSizingNum; + airLoopMaxFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; state.dataSize->VpzClgByZone(termUnitSizingIndex) = - DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value + state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value - if (DualDuct::dd_airterminal(dualDuctATUNum).DamperType == DualDuct::DualDuct_ConstantVolume) { - airLoopHeatingMaximumFlowRateSum += DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; - airLoopHeatingMinimumFlowRateSum += DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; + if (state.dataDualDuct->dd_airterminal(dualDuctATUNum).DamperType == DualDuct::DualDuctDamper::ConstantVolume) { + airLoopHeatingMaximumFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; + airLoopHeatingMinimumFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; state.dataSize->VpzMinClgByZone(termUnitSizingIndex) = - DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value + state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value state.dataSize->VpzHtgByZone(termUnitSizingIndex) = - DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value + state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value state.dataSize->VpzMinHtgByZone(termUnitSizingIndex) = - DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value + state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value state.dataSize->VdzClgByZone(termUnitSizingIndex) = state.dataSize->VpzClgByZone(termUnitSizingIndex); state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = state.dataSize->VpzMinClgByZone(termUnitSizingIndex); state.dataSize->VdzHtgByZone(termUnitSizingIndex) = state.dataSize->VpzHtgByZone(termUnitSizingIndex); state.dataSize->VdzMinHtgByZone(termUnitSizingIndex) = state.dataSize->VpzMinHtgByZone(termUnitSizingIndex); - } else if (DualDuct::dd_airterminal(dualDuctATUNum).DamperType == DualDuct::DualDuct_VariableVolume) { - airLoopHeatingMaximumFlowRateSum += DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; - airLoopHeatingMinimumFlowRateSum += DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate * - DualDuct::dd_airterminal(dualDuctATUNum).ZoneMinAirFrac; + } else if (state.dataDualDuct->dd_airterminal(dualDuctATUNum).DamperType == DualDuct::DualDuctDamper::VariableVolume) { + airLoopHeatingMaximumFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; + airLoopHeatingMinimumFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate * + state.dataDualDuct->dd_airterminal(dualDuctATUNum).ZoneMinAirFrac; state.dataSize->VpzMinClgByZone(termUnitSizingIndex) = - DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate * - DualDuct::dd_airterminal(dualDuctATUNum).ZoneMinAirFrac; // store std 62.1 value + state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate * + state.dataDualDuct->dd_airterminal(dualDuctATUNum).ZoneMinAirFrac; // store std 62.1 value state.dataSize->VpzHtgByZone(termUnitSizingIndex) = - DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value + state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value state.dataSize->VpzMinHtgByZone(termUnitSizingIndex) = - DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate * - DualDuct::dd_airterminal(dualDuctATUNum).ZoneMinAirFrac; // store std 62.1 value + state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate * + state.dataDualDuct->dd_airterminal(dualDuctATUNum).ZoneMinAirFrac; // store std 62.1 value state.dataSize->VdzClgByZone(termUnitSizingIndex) = state.dataSize->VpzClgByZone(termUnitSizingIndex); state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = state.dataSize->VpzMinClgByZone(termUnitSizingIndex); state.dataSize->VdzHtgByZone(termUnitSizingIndex) = state.dataSize->VpzHtgByZone(termUnitSizingIndex); state.dataSize->VdzMinHtgByZone(termUnitSizingIndex) = state.dataSize->VpzMinHtgByZone(termUnitSizingIndex); - } else if (DualDuct::dd_airterminal(dualDuctATUNum).DamperType == DualDuct::DualDuct_OutdoorAir) { - airLoopHeatingMaximumFlowRateSum += DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; + } else if (state.dataDualDuct->dd_airterminal(dualDuctATUNum).DamperType == DualDuct::DualDuctDamper::OutdoorAir) { + airLoopHeatingMaximumFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // Calculate the design OA flow rate for this zone bool UseOccSchFlag = false; bool UseMinOASchFlag = false; Real64 designOAductFlow(0.0); designOAductFlow = DataZoneEquipment::CalcDesignSpecificationOutdoorAir(state, - DualDuct::dd_airterminal(dualDuctATUNum).OARequirementsPtr, - DualDuct::dd_airterminal(dualDuctATUNum).ActualZoneNum, + state.dataDualDuct->dd_airterminal(dualDuctATUNum).OARequirementsPtr, + state.dataDualDuct->dd_airterminal(dualDuctATUNum).ActualZoneNum, UseOccSchFlag, UseMinOASchFlag); airLoopHeatingMinimumFlowRateSum += designOAductFlow; @@ -986,7 +986,7 @@ namespace EnergyPlus::SizingManager { state.dataSize->VpzMinClgByZone(termUnitSizingIndex) = designOAductFlow; // not sure about this state.dataSize->VpzHtgByZone(termUnitSizingIndex) = designOAductFlow; // no heating for this terminal state.dataSize->VpzMinHtgByZone(termUnitSizingIndex) = designOAductFlow; - state.dataSize->VdzClgByZone(termUnitSizingIndex) = DualDuct::dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; + state.dataSize->VdzClgByZone(termUnitSizingIndex) = state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = designOAductFlow; state.dataSize->VdzHtgByZone(termUnitSizingIndex) = designOAductFlow; state.dataSize->VdzMinHtgByZone(termUnitSizingIndex) = designOAductFlow; diff --git a/src/EnergyPlus/StateManagement.cc b/src/EnergyPlus/StateManagement.cc index bcd6a5b01ca..b61aba03f91 100644 --- a/src/EnergyPlus/StateManagement.cc +++ b/src/EnergyPlus/StateManagement.cc @@ -57,11 +57,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include @@ -76,7 +74,6 @@ #include #include #include -#include #include #include #include @@ -101,11 +98,9 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) AirflowNetwork::clear_state(); DataIPShortCuts::clear_state(); DataOutputs::clear_state(); - DataPhotovoltaics::clear_state(); DataStringGlobals::clear_state(); DataViewFactorInformation::clear_state(); DesiccantDehumidifiers::clear_state(); - DualDuct::clear_state(); ElectricBaseboardRadiator::clear_state(); EvaporativeFluidCoolers::clear_state(); FluidProperties::clear_state(); @@ -113,7 +108,6 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) HeatBalanceIntRadExchange::clear_state(); HeatBalanceManager::clear_state(); HeatBalFiniteDiffManager::clear_state(); - HeatingCoils::clear_state(); Humidifiers::clear_state(); HVACCooledBeam::clear_state(); HVACDuct::clear_state(); diff --git a/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc b/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc index dc6a29b1334..6d3a6955470 100644 --- a/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc +++ b/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc @@ -2840,12 +2840,12 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_OnOASystemTest) RegCoilInletAirMassFlowRate = state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesOutAirVolFlow * state->dataEnvrn->StdRhoAir; RegCoilCapacity = RegCoilInletAirMassFlowRate * PsyCpAirFnW(0.0) * (RegCoilDesOutletTemp - RegCoilDesInletTemp); - for (loop = 1; loop <= NumHeatingCoils; ++loop) { - if (HeatingCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { + for (loop = 1; loop <= state->dataHeatingCoils->NumHeatingCoils; ++loop) { + if (state->dataHeatingCoils->HeatingCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { CoilIndex = loop; } } - EXPECT_EQ(RegCoilCapacity, HeatingCoil(CoilIndex).NominalCapacity); + EXPECT_EQ(RegCoilCapacity, state->dataHeatingCoils->HeatingCoil(CoilIndex).NominalCapacity); } TEST_F(EnergyPlusFixture, DesiccantDehum_OnPrimaryAirSystemTest) @@ -4020,12 +4020,12 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_OnPrimaryAirSystemTest) RegCoilInletAirMassFlowRate = state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesMainVolFlow * state->dataEnvrn->StdRhoAir; RegCoilCapacity = RegCoilInletAirMassFlowRate * PsyCpAirFnW(0.0) * (RegCoilDesOutletTemp - RegCoilDesInletTemp); - for (loop = 1; loop <= NumHeatingCoils; ++loop) { - if (HeatingCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { + for (loop = 1; loop <= state->dataHeatingCoils->NumHeatingCoils; ++loop) { + if (state->dataHeatingCoils->HeatingCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { CoilIndex = loop; } } - EXPECT_EQ(RegCoilCapacity, HeatingCoil(CoilIndex).NominalCapacity); + EXPECT_EQ(RegCoilCapacity, state->dataHeatingCoils->HeatingCoil(CoilIndex).NominalCapacity); } TEST_F(EnergyPlusFixture, DesiccantDehum_RegenAirHeaterHWCoilSizingTest) @@ -6685,11 +6685,11 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_VSCoolingCoilOnPrimaryAirSystemTest) RegCoilInletAirMassFlowRate = state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesMainVolFlow * state->dataEnvrn->StdRhoAir; RegCoilCapacity = RegCoilInletAirMassFlowRate * PsyCpAirFnW(0.0) * (RegCoilDesOutletTemp - RegCoilDesInletTemp); - for (loop = 1; loop <= NumHeatingCoils; ++loop) { - if (HeatingCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { + for (loop = 1; loop <= state->dataHeatingCoils->NumHeatingCoils; ++loop) { + if (state->dataHeatingCoils->HeatingCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { CoilIndex = loop; } } - EXPECT_EQ(RegCoilCapacity, HeatingCoil(CoilIndex).NominalCapacity); + EXPECT_EQ(RegCoilCapacity, state->dataHeatingCoils->HeatingCoil(CoilIndex).NominalCapacity); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/DualDuct.unit.cc b/tst/EnergyPlus/unit/DualDuct.unit.cc index b523cac0d4a..f425707cfae 100644 --- a/tst/EnergyPlus/unit/DualDuct.unit.cc +++ b/tst/EnergyPlus/unit/DualDuct.unit.cc @@ -94,17 +94,17 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) state->dataHeatBal->Zone(1).FloorArea = 10.0; - dd_airterminal.allocate(numOfdd_airterminals); - dd_airterminal(1).CtrlZoneNum = 1; - dd_airterminal(1).OARequirementsPtr = 1; - dd_airterminal(1).NoOAFlowInputFromUser = false; - dd_airterminal(1).ActualZoneNum = 1; - dd_airterminal(1).AirLoopNum = 1; - dd_airterminal(2).CtrlZoneNum = 1; - dd_airterminal(2).NoOAFlowInputFromUser = false; - dd_airterminal(2).OARequirementsPtr = 1; - dd_airterminal(2).ActualZoneNum = 1; - dd_airterminal(2).AirLoopNum = 1; + state->dataDualDuct->dd_airterminal.allocate(numOfdd_airterminals); + state->dataDualDuct->dd_airterminal(1).CtrlZoneNum = 1; + state->dataDualDuct->dd_airterminal(1).OARequirementsPtr = 1; + state->dataDualDuct->dd_airterminal(1).NoOAFlowInputFromUser = false; + state->dataDualDuct->dd_airterminal(1).ActualZoneNum = 1; + state->dataDualDuct->dd_airterminal(1).AirLoopNum = 1; + state->dataDualDuct->dd_airterminal(2).CtrlZoneNum = 1; + state->dataDualDuct->dd_airterminal(2).NoOAFlowInputFromUser = false; + state->dataDualDuct->dd_airterminal(2).OARequirementsPtr = 1; + state->dataDualDuct->dd_airterminal(2).ActualZoneNum = 1; + state->dataDualDuct->dd_airterminal(2).AirLoopNum = 1; state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); @@ -121,11 +121,11 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) state->dataEnvrn->StdRhoAir = 1.20; state->dataHeatBal->ZoneIntGain(1).NOFOCC = 0.1; - DualDuct::dd_airterminal(1).CalcOAMassFlow(*state, SAMassFlow, AirLoopOAFrac); + state->dataDualDuct->dd_airterminal(1).CalcOAMassFlow(*state, SAMassFlow, AirLoopOAFrac); EXPECT_NEAR(0.01052376, SAMassFlow, 0.00001); EXPECT_NEAR(0.5, AirLoopOAFrac, 0.00001); - DualDuct::dd_airterminal(2).CalcOAOnlyMassFlow(*state, OAMassFlow); + state->dataDualDuct->dd_airterminal(2).CalcOAOnlyMassFlow(*state, OAMassFlow); EXPECT_NEAR(0.004884, OAMassFlow, 0.00001); // Cleanup @@ -134,7 +134,7 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) state->dataAirLoop->AirLoopControlInfo.deallocate(); state->dataHeatBal->ZoneIntGain.deallocate(); - dd_airterminal.deallocate(); + state->dataDualDuct->dd_airterminal.deallocate(); state->dataZoneEquip->ZoneEquipConfig.deallocate(); state->dataAirLoop->AirLoopFlow.deallocate(); } @@ -351,11 +351,11 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_GetInputs) DualDuct::GetDualDuctInput(*state); //dual duct VAV air terminal get input test - EXPECT_EQ(dd_airterminal(1).DamperType, DualDuct_VariableVolume); // dual duct VAV Type - EXPECT_EQ(dd_airterminal(1).Name, "VAV DUAL DUCT AT"); // dual duct VAV Name - EXPECT_TRUE(dd_airterminal(1).ZoneTurndownMinAirFracSchExist); // turndown schdule exists - EXPECT_EQ(dd_airterminal(1).ZoneTurndownMinAirFrac, 1.0); // turndown fraction initialized to 1.0 - EXPECT_EQ(dd_airterminal(1).ZoneMinAirFracDes, 0.3); // design minimum flow fraction + EXPECT_EQ(state->dataDualDuct->dd_airterminal(1).DamperType, DualDuctDamper::VariableVolume); // dual duct VAV Type + EXPECT_EQ(state->dataDualDuct->dd_airterminal(1).Name, "VAV DUAL DUCT AT"); // dual duct VAV Name + EXPECT_TRUE(state->dataDualDuct->dd_airterminal(1).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_EQ(state->dataDualDuct->dd_airterminal(1).ZoneTurndownMinAirFrac, 1.0); // turndown fraction initialized to 1.0 + EXPECT_EQ(state->dataDualDuct->dd_airterminal(1).ZoneMinAirFracDes, 0.3); // design minimum flow fraction } TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) @@ -451,10 +451,10 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); DualDuct::GetDualDuctInput(*state); - auto &thisDDAirTerminal = DualDuct::dd_airterminal(DDNum); + auto &thisDDAirTerminal = state->dataDualDuct->dd_airterminal(DDNum); //dual duct VAV air terminal get input test - EXPECT_EQ(thisDDAirTerminal.DamperType, DualDuct_VariableVolume); // dual duct VAV Type + EXPECT_EQ(thisDDAirTerminal.DamperType, DualDuctDamper::VariableVolume); // dual duct VAV Type EXPECT_EQ(thisDDAirTerminal.Name, "VAV DUAL DUCT AT"); // dual duct VAV Name EXPECT_TRUE(thisDDAirTerminal.ZoneTurndownMinAirFracSchExist); // turndown schdule exists EXPECT_EQ(thisDDAirTerminal.ZoneTurndownMinAirFrac, 1.0); // turndown fraction initialized to 1.0 @@ -475,13 +475,13 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) state->dataLoopNodes->Node(HotInNode).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(HotInNode).Temp, state->dataLoopNodes->Node(HotInNode).HumRat); // test with heating load and turndown fraction schedule value set 1.0 - DualDuct::dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = 1; // + state->dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = 1; // state->dataLoopNodes->Node(OutNode).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(HotInNode).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(HotInNode).MassFlowRateMaxAvail = SysMaxMassFlowRes; state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - DualDuct::dd_airterminal(DDNum).InitDualDuct(*state, FirstHVACIteration); + state->dataDualDuct->dd_airterminal(DDNum).InitDualDuct(*state, FirstHVACIteration); state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; thisDDAirTerminal.InitDualDuct(*state, FirstHVACIteration); @@ -498,14 +498,14 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) EXPECT_EQ(0.0, state->dataLoopNodes->Node(ColdInNode).MassFlowRate); // test with heating load and turndown fraction schedule value set 0.5 - DualDuct::dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = 2; + state->dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = 2; SysMinMassFlowRes = 1.0 * state->dataEnvrn->StdRhoAir * 0.30 * 0.5; // min flow rate at 0.5 turndown fraction state->dataLoopNodes->Node(OutNode).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(HotInNode).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(HotInNode).MassFlowRateMaxAvail = SysMaxMassFlowRes; state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - DualDuct::dd_airterminal(DDNum).InitDualDuct(*state, FirstHVACIteration); + state->dataDualDuct->dd_airterminal(DDNum).InitDualDuct(*state, FirstHVACIteration); state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; thisDDAirTerminal.InitDualDuct(*state, FirstHVACIteration); diff --git a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc index 175510cccaa..25ada78dd0f 100644 --- a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc +++ b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc @@ -3515,7 +3515,7 @@ namespace EnergyPlus { CWCoil.WaterLoopBranchNum = 1; CWCoil.WaterLoopCompNum = 1; // electric heating coil - auto &eHCoil(HeatingCoils::HeatingCoil(1)); + auto &eHCoil(state->dataHeatingCoils->HeatingCoil(1)); state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRate = AirMassFlow; state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; @@ -3882,7 +3882,7 @@ namespace EnergyPlus { CWCoil.WaterLoopBranchNum = 1; CWCoil.WaterLoopCompNum = 1; // electric heating coil - auto &eHCoil(HeatingCoils::HeatingCoil(1)); + auto &eHCoil(state->dataHeatingCoils->HeatingCoil(1)); state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRate = AirMassFlow; state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; @@ -4249,7 +4249,7 @@ namespace EnergyPlus { CWCoil.WaterLoopBranchNum = 1; CWCoil.WaterLoopCompNum = 1; // electric heating coil - auto &eHCoil(HeatingCoils::HeatingCoil(1)); + auto &eHCoil(state->dataHeatingCoils->HeatingCoil(1)); state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRate = AirMassFlow; state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; @@ -4561,7 +4561,7 @@ namespace EnergyPlus { CWCoil.WaterLoopBranchNum = 1; CWCoil.WaterLoopCompNum = 1; // electric heating coil - auto &eHCoil(HeatingCoils::HeatingCoil(1)); + auto &eHCoil(state->dataHeatingCoils->HeatingCoil(1)); state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRate = AirMassFlow; state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; diff --git a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc index c314303d525..d409cef2d05 100644 --- a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc +++ b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc @@ -232,14 +232,14 @@ class CBVAVSys : public EnergyPlusFixture cbvav.DXCoolCoilName = "MyDXCoolCoil"; state->dataDXCoils->DXCoil(1).DXCoilType_Num = DataHVACGlobals::CoilDX_CoolingSingleSpeed; - HeatingCoils::HeatingCoil.allocate(1); - HeatingCoils::HeatingCoilNumericFields.allocate(1); - HeatingCoils::HeatingCoilNumericFields(1).FieldNames.allocate(20); - HeatingCoils::HeatingCoil(1).Name = "MyHeatingCoil"; - HeatingCoils::HeatingCoil(1).HCoilType_Num = DataHVACGlobals::Coil_HeatingElectric; - HeatingCoils::NumHeatingCoils = 1; - HeatingCoils::ValidSourceType.dimension(HeatingCoils::NumHeatingCoils, false); - HeatingCoils::GetCoilsInputFlag = false; + state->dataHeatingCoils->HeatingCoil.allocate(1); + state->dataHeatingCoils->HeatingCoilNumericFields.allocate(1); + state->dataHeatingCoils->HeatingCoilNumericFields(1).FieldNames.allocate(20); + state->dataHeatingCoils->HeatingCoil(1).Name = "MyHeatingCoil"; + state->dataHeatingCoils->HeatingCoil(1).HCoilType_Num = DataHVACGlobals::Coil_HeatingElectric; + state->dataHeatingCoils->NumHeatingCoils = 1; + state->dataHeatingCoils->ValidSourceType.dimension(state->dataHeatingCoils->NumHeatingCoils, false); + state->dataHeatingCoils->GetCoilsInputFlag = false; state->dataSize->UnitarySysEqSizing.allocate(1); cbvav.HeatCoilName = "MyHeatingCoil"; cbvav.DXCoolCoilType_Num = DataHVACGlobals::CoilDX_CoolingSingleSpeed; @@ -273,14 +273,14 @@ class CBVAVSys : public EnergyPlusFixture cbvav.DXCoilInletNode = state->dataDXCoils->DXCoil(1).AirInNode; state->dataDXCoils->DXCoil(1).AirOutNode = 8; cbvav.DXCoilOutletNode = state->dataDXCoils->DXCoil(1).AirOutNode; - HeatingCoils::HeatingCoil(1).AirInletNodeNum = 8; - cbvav.HeatingCoilInletNode = HeatingCoils::HeatingCoil(1).AirInletNodeNum; - HeatingCoils::HeatingCoil(1).AirOutletNodeNum = 9; - HeatingCoils::HeatingCoil(1).TempSetPointNodeNum = 9; - cbvav.HeatingCoilOutletNode = HeatingCoils::HeatingCoil(1).AirOutletNodeNum; - HeatingCoils::HeatingCoil(1).NominalCapacity = 10000.0; - HeatingCoils::HeatingCoil(1).Efficiency = 1.0; - HeatingCoils::HeatingCoil(1).SchedPtr = -1; + state->dataHeatingCoils->HeatingCoil(1).AirInletNodeNum = 8; + cbvav.HeatingCoilInletNode = state->dataHeatingCoils->HeatingCoil(1).AirInletNodeNum; + state->dataHeatingCoils->HeatingCoil(1).AirOutletNodeNum = 9; + state->dataHeatingCoils->HeatingCoil(1).TempSetPointNodeNum = 9; + cbvav.HeatingCoilOutletNode = state->dataHeatingCoils->HeatingCoil(1).AirOutletNodeNum; + state->dataHeatingCoils->HeatingCoil(1).NominalCapacity = 10000.0; + state->dataHeatingCoils->HeatingCoil(1).Efficiency = 1.0; + state->dataHeatingCoils->HeatingCoil(1).SchedPtr = -1; cbvav.CBVAVBoxOutletNode.allocate(1); cbvav.CBVAVBoxOutletNode(1) = 11; @@ -731,7 +731,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_AutoSize) cbvav.CoolOutAirVolFlow = DataSizing::AutoSize; cbvav.HeatOutAirVolFlow = DataSizing::AutoSize; cbvav.NoCoolHeatOutAirVolFlow = DataSizing::AutoSize; - HeatingCoils::HeatingCoil(1).NominalCapacity = DataSizing::AutoSize; + state->dataHeatingCoils->HeatingCoil(1).NominalCapacity = DataSizing::AutoSize; state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1) = DataSizing::AutoSize; state->dataDXCoils->DXCoil(1).RatedTotCap(1) = DataSizing::AutoSize; @@ -754,7 +754,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_AutoSize) // expect coils to size appropriately based on sizing inputs EXPECT_EQ(state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1), finalSysSizing.DesMainVolFlow); EXPECT_GT(state->dataDXCoils->DXCoil(1).RatedTotCap(1), 30000.0); - EXPECT_GT(HeatingCoils::HeatingCoil(1).NominalCapacity, 45000.0); + EXPECT_GT(state->dataHeatingCoils->HeatingCoil(1).NominalCapacity, 45000.0); } TEST_F(CBVAVSys, UnitaryBypassVAV_NoOASys) diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 3f62512c78c..cd13f2e3817 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -7941,30 +7941,31 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilElectric) int CoilNum(1); state->dataLoopNodes->Node.allocate(2); - HeatingCoils::NumHeatingCoils = 1; - HeatingCoils::GetCoilsInputFlag = false; - HeatingCoils::HeatingCoil.allocate(NumHeatingCoils); - HeatingCoils::CoilIsSuppHeater = true; - HeatingCoils::HeatingCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; - HeatingCoils::HeatingCoil(CoilNum).HeatingCoilType = thisVRFTU.SuppHeatCoilType; - HeatingCoils::HeatingCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Electricity; - HeatingCoils::HeatingCoil(CoilNum).HCoilType_Num = thisVRFTU.SuppHeatCoilType_Num; - HeatingCoils::HeatingCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; - HeatingCoils::HeatingCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; - HeatingCoils::HeatingCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; // fan is always on - HeatingCoils::HeatingCoil(CoilNum).NominalCapacity = 10000.0; - HeatingCoils::HeatingCoil(CoilNum).Efficiency = 1.0; - HeatingCoils::CheckEquipName.dimension(HeatingCoils::NumHeatingCoils, true); - HeatingCoils::ValidSourceType.dimension(HeatingCoils::NumHeatingCoils, true); + state->dataHeatingCoils->NumHeatingCoils = 1; + state->dataHeatingCoils->GetCoilsInputFlag = false; + state->dataHeatingCoils->HeatingCoil.allocate(state->dataHeatingCoils->NumHeatingCoils); + state->dataHeatingCoils->CoilIsSuppHeater = true; + state->dataHeatingCoils->HeatingCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; + state->dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilType = thisVRFTU.SuppHeatCoilType; + state->dataHeatingCoils->HeatingCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Electricity; + state->dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num = thisVRFTU.SuppHeatCoilType_Num; + state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; + state->dataHeatingCoils->HeatingCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; + state->dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; // fan is always on + state->dataHeatingCoils->HeatingCoil(CoilNum).NominalCapacity = 10000.0; + state->dataHeatingCoils->HeatingCoil(CoilNum).Efficiency = 1.0; + state->dataHeatingCoils->CheckEquipName.dimension(state->dataHeatingCoils->NumHeatingCoils, true); + state->dataHeatingCoils->ValidSourceType.dimension(state->dataHeatingCoils->NumHeatingCoils, true); state->dataGlobal->SysSizingCalc = true; state->dataEnvrn->OutDryBulbTemp = 5.0; // init coil inlet condition - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).Temp = 15.0; - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW( - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).Temp, state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).HumRat); + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).Temp = 15.0; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).Enthalpy = + Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).Temp, + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).HumRat); bool FirstHVACIteration(false); Real64 SuppHeatCoilLoad = 10000.0; @@ -7972,14 +7973,14 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilElectric) thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // check the coil load delivered EXPECT_EQ(10000.0, SuppHeatCoilLoad); - EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).ElecUseRate); + EXPECT_EQ(10000.0, state->dataHeatingCoils->HeatingCoil(CoilNum).ElecUseRate); // test heating load larger than coil nominal capacity - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; SuppHeatCoilLoad = 12000.0; thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // delivered heat cannot exceed coil capacity EXPECT_EQ(10000.0, SuppHeatCoilLoad); - EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).ElecUseRate); + EXPECT_EQ(10000.0, state->dataHeatingCoils->HeatingCoil(CoilNum).ElecUseRate); } TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilFuel) @@ -8005,30 +8006,31 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilFuel) int CoilNum(1); state->dataLoopNodes->Node.allocate(2); - HeatingCoils::NumHeatingCoils = 1; - HeatingCoils::GetCoilsInputFlag = false; - HeatingCoils::HeatingCoil.allocate(NumHeatingCoils); - HeatingCoils::CoilIsSuppHeater = true; - HeatingCoils::HeatingCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; - HeatingCoils::HeatingCoil(CoilNum).HeatingCoilType = thisVRFTU.SuppHeatCoilType; - HeatingCoils::HeatingCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Natural_Gas; - HeatingCoils::HeatingCoil(CoilNum).HCoilType_Num = thisVRFTU.SuppHeatCoilType_Num; - HeatingCoils::HeatingCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; - HeatingCoils::HeatingCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; - HeatingCoils::HeatingCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; // fan is always on - HeatingCoils::HeatingCoil(CoilNum).NominalCapacity = 10000.0; - HeatingCoils::HeatingCoil(CoilNum).Efficiency = 1.0; - HeatingCoils::CheckEquipName.dimension(HeatingCoils::NumHeatingCoils, true); - HeatingCoils::ValidSourceType.dimension(HeatingCoils::NumHeatingCoils, true); + state->dataHeatingCoils->NumHeatingCoils = 1; + state->dataHeatingCoils->GetCoilsInputFlag = false; + state->dataHeatingCoils->HeatingCoil.allocate(state->dataHeatingCoils->NumHeatingCoils); + state->dataHeatingCoils->CoilIsSuppHeater = true; + state->dataHeatingCoils->HeatingCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; + state->dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilType = thisVRFTU.SuppHeatCoilType; + state->dataHeatingCoils->HeatingCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Natural_Gas; + state->dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num = thisVRFTU.SuppHeatCoilType_Num; + state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; + state->dataHeatingCoils->HeatingCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; + state->dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; // fan is always on + state->dataHeatingCoils->HeatingCoil(CoilNum).NominalCapacity = 10000.0; + state->dataHeatingCoils->HeatingCoil(CoilNum).Efficiency = 1.0; + state->dataHeatingCoils->CheckEquipName.dimension(state->dataHeatingCoils->NumHeatingCoils, true); + state->dataHeatingCoils->ValidSourceType.dimension(state->dataHeatingCoils->NumHeatingCoils, true); state->dataGlobal->SysSizingCalc = true; state->dataEnvrn->OutDryBulbTemp = 5.0; // init coil inlet condition - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).Temp = 15.0; - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW( - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).Temp, state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).HumRat); + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).Temp = 15.0; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).Enthalpy = + Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).Temp, + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).HumRat); bool FirstHVACIteration(false); Real64 SuppHeatCoilLoad = 10000.0; @@ -8036,14 +8038,14 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilFuel) thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // check the coil load delivered EXPECT_EQ(10000.0, SuppHeatCoilLoad); - EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).FuelUseRate); + EXPECT_EQ(10000.0, state->dataHeatingCoils->HeatingCoil(CoilNum).FuelUseRate); // test heating load larger than coil nominal capacity - state->dataLoopNodes->Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; + state->dataLoopNodes->Node(state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; SuppHeatCoilLoad = 12000.0; thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // delivered heat cannot exceed coil capacity EXPECT_EQ(10000.0, SuppHeatCoilLoad); - EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).FuelUseRate); + EXPECT_EQ(10000.0, state->dataHeatingCoils->HeatingCoil(CoilNum).FuelUseRate); } TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) @@ -8286,9 +8288,9 @@ TEST_F(EnergyPlusFixture, VRFTU_SupplementalHeatingCoilCapacityLimitTest) thisVRFTU.SuppHeatCoilAirOutletNode = 2; state->dataLoopNodes->Node.allocate(2); - HeatingCoils::HeatingCoil.allocate(1); - HeatingCoils::HeatingCoil(1).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; - HeatingCoils::HeatingCoil(1).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; + state->dataHeatingCoils->HeatingCoil.allocate(1); + state->dataHeatingCoils->HeatingCoil(1).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; + state->dataHeatingCoils->HeatingCoil(1).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; state->dataLoopNodes->Node(thisVRFTU.SuppHeatCoilAirInletNode).MassFlowRate = 1.0; state->dataLoopNodes->Node(thisVRFTU.SuppHeatCoilAirInletNode).Temp = 20.0; @@ -13666,11 +13668,11 @@ TEST_F(EnergyPlusFixture, VRF_BlowthroughFanPlacement_InputTest) auto &thisVRFTU(state->dataHVACVarRefFlow->VRFTU(1)); auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); - auto &thisSuppHeatingCoil(HeatingCoil(1)); + auto &thisSuppHeatingCoil(state->dataHeatingCoils->HeatingCoil(1)); // check model inputs ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFTU); ASSERT_EQ(2, state->dataDXCoils->NumDXCoils); - ASSERT_EQ(1, NumHeatingCoils); + ASSERT_EQ(1, state->dataHeatingCoils->NumHeatingCoils); EXPECT_TRUE(thisVRFTU.OAMixerUsed); ASSERT_EQ("TU1 OA MIXER", thisVRFTU.OAMixerName); ASSERT_EQ(thisVRFTU.fanType_Num, DataHVACGlobals::FanType_SystemModelObject); diff --git a/tst/EnergyPlus/unit/HeatingCoils.unit.cc b/tst/EnergyPlus/unit/HeatingCoils.unit.cc index ccb1d6d8b84..6690c76b71d 100644 --- a/tst/EnergyPlus/unit/HeatingCoils.unit.cc +++ b/tst/EnergyPlus/unit/HeatingCoils.unit.cc @@ -75,7 +75,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeInput) ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); - EXPECT_EQ(HeatingCoils::HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::OtherFuel1); + EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::OtherFuel1); } TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeInputError) @@ -115,7 +115,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeCoal) ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); - EXPECT_EQ(HeatingCoils::HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::Coal); + EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::Coal); } TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypePropaneGas) @@ -129,7 +129,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypePropaneGas) ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); - EXPECT_EQ(HeatingCoils::HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::Propane); + EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::Propane); } TEST_F(EnergyPlusFixture, HeatingCoils_OutletAirPropertiesTest) @@ -139,51 +139,55 @@ TEST_F(EnergyPlusFixture, HeatingCoils_OutletAirPropertiesTest) Real64 OffMassFlowrate = 0.2; Real64 OnMassFlowrate = 0.6; - HeatingCoils::HeatingCoil.allocate(CoilNum); - HeatingCoils::HeatingCoil(CoilNum).InletAirTemp = 0.0; - HeatingCoils::HeatingCoil(CoilNum).InletAirHumRat = 0.001; - HeatingCoils::HeatingCoil(CoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(HeatingCoils::HeatingCoil(CoilNum).InletAirTemp, HeatingCoils::HeatingCoil(CoilNum).InletAirHumRat); + state->dataHeatingCoils->HeatingCoil.allocate(CoilNum); + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirTemp = 0.0; + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirHumRat = 0.001; + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW( + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirTemp, state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirHumRat); state->dataEnvrn->OutBaroPress = 101325.0; - HeatingCoils::HeatingCoil(CoilNum).SchedPtr = 1; + state->dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr = 1; state->dataScheduleMgr->Schedule.allocate(1); state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHVACGlobal->MSHPMassFlowRateLow = OnMassFlowrate; - HeatingCoils::HeatingCoil(CoilNum).MSNominalCapacity.allocate(1); - HeatingCoils::HeatingCoil(CoilNum).MSNominalCapacity(1) = 10000; - HeatingCoils::HeatingCoil(CoilNum).MSEfficiency.allocate(1); - HeatingCoils::HeatingCoil(CoilNum).MSEfficiency(1) = 0.9; - HeatingCoils::HeatingCoil(CoilNum).AirInletNodeNum = 1; - HeatingCoils::HeatingCoil(CoilNum).AirOutletNodeNum = 2; + state->dataHeatingCoils->HeatingCoil(CoilNum).MSNominalCapacity.allocate(1); + state->dataHeatingCoils->HeatingCoil(CoilNum).MSNominalCapacity(1) = 10000; + state->dataHeatingCoils->HeatingCoil(CoilNum).MSEfficiency.allocate(1); + state->dataHeatingCoils->HeatingCoil(CoilNum).MSEfficiency(1) = 0.9; + state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum = 1; + state->dataHeatingCoils->HeatingCoil(CoilNum).AirOutletNodeNum = 2; state->dataLoopNodes->Node.allocate(2); - HeatingCoils::HeatingCoil(CoilNum).MSParasiticElecLoad.allocate(1); - HeatingCoils::HeatingCoil(CoilNum).MSParasiticElecLoad(1) = 0.0; + state->dataHeatingCoils->HeatingCoil(CoilNum).MSParasiticElecLoad.allocate(1); + state->dataHeatingCoils->HeatingCoil(CoilNum).MSParasiticElecLoad(1) = 0.0; - HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate = OffMassFlowrate; + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirMassFlowRate = OffMassFlowrate; HeatingCoils::CalcMultiStageGasHeatingCoil(*state, CoilNum, 0.0, 0.0, 1, 2); Real64 HeatLoad00 = - HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate * - (Psychrometrics::PsyHFnTdbW(HeatingCoils::HeatingCoil(CoilNum).OutletAirTemp, HeatingCoils::HeatingCoil(CoilNum).OutletAirHumRat) - - HeatingCoils::HeatingCoil(CoilNum).InletAirEnthalpy); - EXPECT_NEAR(HeatLoad00, HeatingCoils::HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirMassFlowRate * + (Psychrometrics::PsyHFnTdbW(state->dataHeatingCoils->HeatingCoil(CoilNum).OutletAirTemp, + state->dataHeatingCoils->HeatingCoil(CoilNum).OutletAirHumRat) - + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirEnthalpy); + EXPECT_NEAR(HeatLoad00, state->dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); - HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate = 0.5 * OnMassFlowrate + (1.0 - 0.5) * OffMassFlowrate; + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirMassFlowRate = 0.5 * OnMassFlowrate + (1.0 - 0.5) * OffMassFlowrate; HeatingCoils::CalcMultiStageGasHeatingCoil(*state, CoilNum, 0.0, 0.5, 1, 2); Real64 HeatLoad05 = - HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate * - (Psychrometrics::PsyHFnTdbW(HeatingCoils::HeatingCoil(CoilNum).OutletAirTemp, HeatingCoils::HeatingCoil(CoilNum).OutletAirHumRat) - - HeatingCoils::HeatingCoil(CoilNum).InletAirEnthalpy); - EXPECT_NEAR(HeatLoad05, HeatingCoils::HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirMassFlowRate * + (Psychrometrics::PsyHFnTdbW(state->dataHeatingCoils->HeatingCoil(CoilNum).OutletAirTemp, + state->dataHeatingCoils->HeatingCoil(CoilNum).OutletAirHumRat) - + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirEnthalpy); + EXPECT_NEAR(HeatLoad05, state->dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); - HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate = OnMassFlowrate; + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirMassFlowRate = OnMassFlowrate; HeatingCoils::CalcMultiStageGasHeatingCoil(*state, CoilNum, 0.0, 1.0, 1, 2); Real64 HeatLoad10 = - HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate * - (Psychrometrics::PsyHFnTdbW(HeatingCoils::HeatingCoil(CoilNum).OutletAirTemp, HeatingCoils::HeatingCoil(CoilNum).OutletAirHumRat) - - HeatingCoils::HeatingCoil(CoilNum).InletAirEnthalpy); - EXPECT_NEAR(HeatLoad10, HeatingCoils::HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirMassFlowRate * + (Psychrometrics::PsyHFnTdbW(state->dataHeatingCoils->HeatingCoil(CoilNum).OutletAirTemp, + state->dataHeatingCoils->HeatingCoil(CoilNum).OutletAirHumRat) - + state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirEnthalpy); + EXPECT_NEAR(HeatLoad10, state->dataHeatingCoils->HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); // check linear relationship at PLR = 0.5 - EXPECT_NEAR(HeatLoad05, 0.5 * HeatingCoils::HeatingCoil(CoilNum).MSNominalCapacity(1), 0.0001); + EXPECT_NEAR(HeatLoad05, 0.5 * state->dataHeatingCoils->HeatingCoil(CoilNum).MSNominalCapacity(1), 0.0001); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index 32e9dd61bf6..50d416b1459 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -810,7 +810,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) ASSERT_EQ(1, state->dataPTHP->NumPTAC); EXPECT_EQ("ZoneHVAC:PackagedTerminalAirConditioner", state->dataPTHP->PTUnit(1).UnitType); // zoneHVAC equipment type EXPECT_EQ("COIL:HEATING:FUEL", state->dataPTHP->PTUnit(1).ACHeatCoilType); // PTAC heating coil type - EXPECT_EQ(HeatingCoil(1).HCoilType_Num, Coil_HeatingGasOrOtherFuel); // gas heating coil type + EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(1).HCoilType_Num, Coil_HeatingGasOrOtherFuel); // gas heating coil type state->dataGlobal->BeginEnvrnFlag = false; @@ -908,13 +908,13 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) // no net heating delivered to the zone ASSERT_DOUBLE_EQ(QUnitOut, 0.0); // heating coil inlet air temperature - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).InletAirTemp, 16.74764, 0.00001); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).InletAirTemp, 16.74764, 0.00001); // heating coil tempers cold ventilation air to neutral (zone air temp) - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).OutletAirTemp, 21.1, 0.00001); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).OutletAirTemp, 21.1, 0.00001); // heating coil air flow rate, continuous fan operation - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).OutletAirMassFlowRate, 0.50, 0.00001); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).OutletAirMassFlowRate, 0.50, 0.00001); // heating coil load due to cold ventilation air - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).HeatingCoilRate, 2217.0, 1.0); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).HeatingCoilRate, 2217.0, 1.0); } TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) @@ -1257,13 +1257,13 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) // no net heating delivered to the zone EXPECT_NEAR(QUnitOut, 0.0, 0.0000001); // heating coil inlet air temperature - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).InletAirTemp, 14.560774, 0.00001); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).InletAirTemp, 14.560774, 0.00001); // heating coil tempers cold ventilation air to neutral (zone air temp, otherwise QUnitOut out would be non-zero above) - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).OutletAirTemp, 21.1, 0.00001); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).OutletAirTemp, 21.1, 0.00001); // heating coil air flow rate, operate at minimum air flow rate - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).OutletAirMassFlowRate, 0.40200, 0.00001); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).OutletAirMassFlowRate, 0.40200, 0.00001); // heating coil load due to cold ventilation air (but total load delivered by PTUnit is 0) - ASSERT_NEAR(HeatingCoils::HeatingCoil(1).HeatingCoilRate, 2678.1427, 0.0001); + ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).HeatingCoilRate, 2678.1427, 0.0001); // Boundary load for this system in Region 1 at minimum air flow rate is 2006.8 W (lower boundary load in Region 1) // loads below the bounday load should operate at the minimum air flow rate @@ -1271,19 +1271,19 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); ASSERT_NEAR(state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).AirInNode).MassFlowRate, state->dataPTHP->PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow, 0.001); - ASSERT_GT(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp); + ASSERT_GT(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, state->dataHeatingCoils->HeatingCoil(1).OutletAirTemp); state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2000.0; // set heating load to just below lower boundary load QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); ASSERT_NEAR(state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).AirInNode).MassFlowRate, state->dataPTHP->PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow, 0.001); - ASSERT_GT(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp); + ASSERT_GT(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, state->dataHeatingCoils->HeatingCoil(1).OutletAirTemp); // loads above the lower bounday load should operate above the minimum air flow rate state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2010.0; // set heating load to just above lower boundary load QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); - ASSERT_NEAR(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp, 0.1); + ASSERT_NEAR(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, state->dataHeatingCoils->HeatingCoil(1).OutletAirTemp, 0.1); ASSERT_GT(state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).AirInNode).MassFlowRate, state->dataPTHP->PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow); // Boundary load for this system in Region 1 at maximum air flow rate is 2995.2 W (upper boundary load of Region 1) @@ -1291,7 +1291,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2990.0; // set heating load to just below upper boundary load QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); - ASSERT_NEAR(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp, 0.1); + ASSERT_NEAR(state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp, state->dataHeatingCoils->HeatingCoil(1).OutletAirTemp, 0.1); ASSERT_GT(state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).AirInNode).MassFlowRate, state->dataPTHP->PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow); ASSERT_LT(state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).AirInNode).MassFlowRate, state->dataPTHP->PTUnit(PTUnitNum).MaxHeatAirMassFlow); @@ -1301,7 +1301,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 3000.0; // set heating load to just above upper boundary load QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); - ASSERT_GT(HeatingCoils::HeatingCoil(1).OutletAirTemp, state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp); + ASSERT_GT(state->dataHeatingCoils->HeatingCoil(1).OutletAirTemp, state->dataPTHP->PTUnit(PTUnitNum).DesignMaxOutletTemp); ASSERT_NEAR(state->dataLoopNodes->Node(state->dataPTHP->PTUnit(PTUnitNum).AirInNode).MassFlowRate, state->dataPTHP->PTUnit(PTUnitNum).MaxHeatAirMassFlow, 0.0001); } diff --git a/tst/EnergyPlus/unit/Photovoltaics.unit.cc b/tst/EnergyPlus/unit/Photovoltaics.unit.cc index 7a4bc367ec3..b70b2dc50cf 100644 --- a/tst/EnergyPlus/unit/Photovoltaics.unit.cc +++ b/tst/EnergyPlus/unit/Photovoltaics.unit.cc @@ -81,11 +81,11 @@ TEST_F(EnergyPlusFixture, PV_ReportPV_ZoneIndexNonZero) { // unit test for issue #6222, test to make sure zone index in surface on which PV is placed is not zero so zone multiplier is applied properly - EnergyPlus::DataPhotovoltaics::PVarray.deallocate(); + state->dataPhotovoltaic->PVarray.deallocate(); state->dataHeatBal->Zone.deallocate(); state->dataSurface->Surface.deallocate(); - EnergyPlus::DataPhotovoltaics::PVarray.allocate(3); + state->dataPhotovoltaic->PVarray.allocate(3); state->dataHeatBal->Zone.allocate(2); state->dataSurface->Surface.allocate(3); @@ -97,13 +97,13 @@ TEST_F(EnergyPlusFixture, PV_ReportPV_ZoneIndexNonZero) state->dataHeatBal->Zone(2).ListMultiplier = 10.0; state->dataHeatBal->Zone(2).Multiplier = 1.0; - EnergyPlus::DataPhotovoltaics::NumPVs = 3; - EnergyPlus::DataPhotovoltaics::PVarray(1).SurfacePtr = 1; - EnergyPlus::DataPhotovoltaics::PVarray(1).CellIntegrationMode = -9999; - EnergyPlus::DataPhotovoltaics::PVarray(2).SurfacePtr = 2; - EnergyPlus::DataPhotovoltaics::PVarray(2).CellIntegrationMode = -9999; - EnergyPlus::DataPhotovoltaics::PVarray(3).SurfacePtr = 3; - EnergyPlus::DataPhotovoltaics::PVarray(3).CellIntegrationMode = -9999; + state->dataPhotovoltaic->NumPVs = 3; + state->dataPhotovoltaic->PVarray(1).SurfacePtr = 1; + state->dataPhotovoltaic->PVarray(1).CellIntegrationMode = EnergyPlus::DataPhotovoltaics::CellIntegration::Unassigned; + state->dataPhotovoltaic->PVarray(2).SurfacePtr = 2; + state->dataPhotovoltaic->PVarray(2).CellIntegrationMode = EnergyPlus::DataPhotovoltaics::CellIntegration::Unassigned; + state->dataPhotovoltaic->PVarray(3).SurfacePtr = 3; + state->dataPhotovoltaic->PVarray(3).CellIntegrationMode = EnergyPlus::DataPhotovoltaics::CellIntegration::Unassigned; state->dataSurface->Surface(1).Zone = 1; state->dataSurface->Surface(1).ZoneName = "Zone1"; @@ -113,23 +113,23 @@ TEST_F(EnergyPlusFixture, PV_ReportPV_ZoneIndexNonZero) state->dataSurface->Surface(3).ZoneName = "None"; // Test 1: Zone 1--PV has multiplier, Zone index already set - EnergyPlus::DataPhotovoltaics::PVarray(1).Report.DCPower = 1000.0; - EnergyPlus::DataPhotovoltaics::PVarray(1).Zone = Photovoltaics::GetPVZone(*state, EnergyPlus::DataPhotovoltaics::PVarray(1).SurfacePtr); + state->dataPhotovoltaic->PVarray(1).Report.DCPower = 1000.0; + state->dataPhotovoltaic->PVarray(1).Zone = Photovoltaics::GetPVZone(*state, state->dataPhotovoltaic->PVarray(1).SurfacePtr); Photovoltaics::ReportPV(*state, 1); - EXPECT_EQ(EnergyPlus::DataPhotovoltaics::PVarray(1).Zone, 1); - EXPECT_NEAR(EnergyPlus::DataPhotovoltaics::PVarray(1).Report.DCPower, 5000.0, 0.1); + EXPECT_EQ(state->dataPhotovoltaic->PVarray(1).Zone, 1); + EXPECT_NEAR(state->dataPhotovoltaic->PVarray(1).Report.DCPower, 5000.0, 0.1); // Test 2: Zone 2--PV has multiplier, Zone index not set yet - EnergyPlus::DataPhotovoltaics::PVarray(2).Report.DCPower = 1000.0; - EnergyPlus::DataPhotovoltaics::PVarray(2).Zone = Photovoltaics::GetPVZone(*state, EnergyPlus::DataPhotovoltaics::PVarray(2).SurfacePtr); + state->dataPhotovoltaic->PVarray(2).Report.DCPower = 1000.0; + state->dataPhotovoltaic->PVarray(2).Zone = Photovoltaics::GetPVZone(*state, state->dataPhotovoltaic->PVarray(2).SurfacePtr); Photovoltaics::ReportPV(*state, 2); - EXPECT_EQ(EnergyPlus::DataPhotovoltaics::PVarray(2).Zone, 2); - EXPECT_NEAR(EnergyPlus::DataPhotovoltaics::PVarray(2).Report.DCPower, 10000.0, 0.1); + EXPECT_EQ(state->dataPhotovoltaic->PVarray(2).Zone, 2); + EXPECT_NEAR(state->dataPhotovoltaic->PVarray(2).Report.DCPower, 10000.0, 0.1); // Test 3: Zone 3--PV not attached to any zone, Zone Index does not get set - EnergyPlus::DataPhotovoltaics::PVarray(3).Report.DCPower = 1000.0; - EnergyPlus::DataPhotovoltaics::PVarray(3).Zone = Photovoltaics::GetPVZone(*state, EnergyPlus::DataPhotovoltaics::PVarray(3).SurfacePtr); + state->dataPhotovoltaic->PVarray(3).Report.DCPower = 1000.0; + state->dataPhotovoltaic->PVarray(3).Zone = Photovoltaics::GetPVZone(*state, state->dataPhotovoltaic->PVarray(3).SurfacePtr); Photovoltaics::ReportPV(*state, 3); - EXPECT_EQ(EnergyPlus::DataPhotovoltaics::PVarray(3).Zone, 0); - EXPECT_NEAR(EnergyPlus::DataPhotovoltaics::PVarray(3).Report.DCPower, 1000.0, 0.1); + EXPECT_EQ(state->dataPhotovoltaic->PVarray(3).Zone, 0); + EXPECT_NEAR(state->dataPhotovoltaic->PVarray(3).Report.DCPower, 1000.0, 0.1); } diff --git a/tst/EnergyPlus/unit/SZVAVModel.unit.cc b/tst/EnergyPlus/unit/SZVAVModel.unit.cc index 2d6d3d9a74d..d52c47e1baf 100644 --- a/tst/EnergyPlus/unit/SZVAVModel.unit.cc +++ b/tst/EnergyPlus/unit/SZVAVModel.unit.cc @@ -607,7 +607,7 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) CWCoil.WaterLoopBranchNum = 1; CWCoil.WaterLoopCompNum = 1; // electric heating coil - auto &eHCoil(HeatingCoils::HeatingCoil(1)); + auto &eHCoil(state->dataHeatingCoils->HeatingCoil(1)); state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRate = AirMassFlow; state->dataLoopNodes->Node(eHCoil.AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; diff --git a/tst/EnergyPlus/unit/UnitHeater.unit.cc b/tst/EnergyPlus/unit/UnitHeater.unit.cc index fb25eb43f0e..1f6b2f82666 100644 --- a/tst/EnergyPlus/unit/UnitHeater.unit.cc +++ b/tst/EnergyPlus/unit/UnitHeater.unit.cc @@ -2426,15 +2426,15 @@ TEST_F(EnergyPlusFixture, UnitHeater_SecondPriorityZoneEquipment) // first priority zone equipment is zone ADU EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(1).EquipType, "ZONEHVAC:AIRDISTRIBUTIONUNIT"); EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(1).EquipName, "MAIN ZONE ATU"); - EXPECT_EQ(HeatingCoils::HeatingCoil(1).Name, "MAIN ZONE REHEAT COIL"); + EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(1).Name, "MAIN ZONE REHEAT COIL"); // second priority zone equipment is unit heater EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(2).EquipType, "ZONEHVAC:UNITHEATER"); EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(2).EquipName, "UNITHEATER"); - EXPECT_EQ(HeatingCoils::HeatingCoil(2).Name, "UNITHEATER_ELECTRICHEATER"); + EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(2).Name, "UNITHEATER_ELECTRICHEATER"); // check the reheat coil output - EXPECT_NEAR(HeatingCoils::HeatingCoil(1).HeatingCoilRate, 7028.9, 1.0); + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(1).HeatingCoilRate, 7028.9, 1.0); // check the unit heater heating coil output - EXPECT_EQ(HeatingCoils::HeatingCoil(2).HeatingCoilRate, 0.0); + EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(2).HeatingCoilRate, 0.0); // re-set the hour of the day state->dataGlobal->TimeStep = 1; @@ -2456,11 +2456,11 @@ TEST_F(EnergyPlusFixture, UnitHeater_SecondPriorityZoneEquipment) // re-simulate the zone HVAC equipment per the priority order ZoneEquipmentManager::ManageZoneEquipment(*state, FirstHVACIteration, SimZoneEquipment, SimAirLoops); // check the reheat coil nominal capacity - EXPECT_NEAR(HeatingCoils::HeatingCoil(1).NominalCapacity, 17542.3, 1.0); + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(1).NominalCapacity, 17542.3, 1.0); // check the reheat coil outputis the full capacity - EXPECT_NEAR(HeatingCoils::HeatingCoil(1).HeatingCoilRate, 17542.3, 1.0); + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(1).HeatingCoilRate, 17542.3, 1.0); // check the unit heater heating coil is handling the remaining load - EXPECT_NEAR(HeatingCoils::HeatingCoil(2).HeatingCoilRate, 213.9, 1.0); + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(2).HeatingCoilRate, 213.9, 1.0); // finaly check that RemaingingOutputRequired is zero EXPECT_EQ(state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired, 0.0); } diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 27b7ebc6f6f..019cefd5fde 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -287,7 +287,6 @@ class AirloopUnitarySysTest : public EnergyPlusFixture { EnergyPlusFixture::TearDown(); // Remember to tear down the base fixture after cleaning up derived fixture! - state->dataHVACGlobal->NumPrimaryAirSys = 0; Psychrometrics::cached_Twb.clear(); Psychrometrics::cached_Psat.clear(); } @@ -6306,8 +6305,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetBadSupplyAirMethodInput) DataZoneEquipment::GetZoneEquipmentData(*state); // read zone equipment configuration and list objects - HeatingCoils::GetCoilsInputFlag = true; - HeatingCoils::HeatingCoil.deallocate(); + state->dataHeatingCoils->GetCoilsInputFlag = true; + state->dataHeatingCoils->HeatingCoil.deallocate(); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -6491,8 +6490,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetBadSupplyAirMethodInputSZVAV) DataZoneEquipment::GetZoneEquipmentData(*state); // read zone equipment configuration and list objects - HeatingCoils::GetCoilsInputFlag = true; - HeatingCoils::HeatingCoil.deallocate(); + state->dataHeatingCoils->GetCoilsInputFlag = true; + state->dataHeatingCoils->HeatingCoil.deallocate(); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -13087,7 +13086,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_AllFlowFieldsBlankInputTest) EXPECT_TRUE(thisSys->m_HeatCoilExists); auto &thisClgCoil = state->dataDXCoils->DXCoil(1); - auto &thisHtgCoil = HeatingCoils::HeatingCoil(1); + auto &thisHtgCoil = state->dataHeatingCoils->HeatingCoil(1); EXPECT_EQ(thisClgCoil.RatedTotCap(1), DataSizing::AutoSize); EXPECT_EQ(thisHtgCoil.NominalCapacity, DataSizing::AutoSize);