diff --git a/src/EnergyPlus/CostEstimateManager.cc b/src/EnergyPlus/CostEstimateManager.cc index 7328b2b8c56..0edd9ab3a25 100644 --- a/src/EnergyPlus/CostEstimateManager.cc +++ b/src/EnergyPlus/CostEstimateManager.cc @@ -237,7 +237,6 @@ namespace CostEstimateManager { using DataPhotovoltaics::iSimplePVModel; using DataPhotovoltaics::PVarray; using DataSurfaces::Surface; - using DXCoils::DXCoil; using HeatingCoils::HeatingCoil; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -309,7 +308,7 @@ namespace CostEstimateManager { ErrorsFound = true; } else { // assume name is probably useful - thisCoil = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, DXCoil); + thisCoil = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, state.dataDXCoils->DXCoil); if (thisCoil == 0) { ShowWarningError(state, "ComponentCost:LineItem: \"" + state.dataCostEstimateManager->CostLineItem(Item).LineName + "\", Coil:DX, invalid coil specified"); ShowContinueError(state, "Coil Specified=\"" + state.dataCostEstimateManager->CostLineItem(Item).ParentObjName + @@ -497,8 +496,6 @@ namespace CostEstimateManager { using DataPhotovoltaics::PVarray; using DataSurfaces::Surface; using DataSurfaces::TotSurfaces; - using DXCoils::DXCoil; - using DXCoils::NumDXCoils; using HeatingCoils::HeatingCoil; using HeatingCoils::NumHeatingCoils; @@ -574,13 +571,13 @@ 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, DXCoil); + thisCoil = UtilityRoutines::FindItem(state.dataCostEstimateManager->CostLineItem(Item).ParentObjName, state.dataDXCoils->DXCoil); } if (state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : DXCoil) + for (auto const &e : state.dataDXCoils->DXCoil) Qty += e.RatedTotCap(1); state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot cool cap.)"; @@ -588,7 +585,7 @@ 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 = DXCoil(thisCoil).RatedTotCap(1) / 1000.0; + state.dataCostEstimateManager->CostLineItem(Item).Qty = state.dataDXCoils->DXCoil(thisCoil).RatedTotCap(1) / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot cool 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; @@ -596,7 +593,7 @@ namespace CostEstimateManager { } if (state.dataCostEstimateManager->CostLineItem(Item).PerEach > 0.0) { - if (WildcardObjNames) state.dataCostEstimateManager->CostLineItem(Item).Qty = double(NumDXCoils); + if (WildcardObjNames) state.dataCostEstimateManager->CostLineItem(Item).Qty = double(state.dataDXCoils->NumDXCoils); 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; @@ -606,7 +603,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : DXCoil) + for (auto const &e : state.dataDXCoils->DXCoil) Qty += e.RatedCOP(1) * e.RatedTotCap(1); state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW*COP (total, rated) "; @@ -614,7 +611,7 @@ 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 = DXCoil(thisCoil).RatedCOP(1) * DXCoil(thisCoil).RatedTotCap(1) / 1000.0; + state.dataCostEstimateManager->CostLineItem(Item).Qty = state.dataDXCoils->DXCoil(thisCoil).RatedCOP(1) * state.dataDXCoils->DXCoil(thisCoil).RatedTotCap(1) / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW*COP (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; diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index db1e99e1c13..559207cba58 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -96,9 +96,7 @@ #include #include -namespace EnergyPlus { - -namespace DXCoils { +namespace EnergyPlus::DXCoils { // Module containing the DX coil simulation routines @@ -133,104 +131,6 @@ namespace DXCoils { // Use statements for access to subroutines in other modules using namespace ScheduleManager; - // Data - // MODULE PARAMETER DEFINITIONS - // Defrost strategy (heat pump only) - int const ReverseCycle(1); // uses reverse cycle defrost strategy - int const Resistive(2); // uses electric resistance heater for defrost - // Defrost control (heat pump only) - int const Timed(1); // defrost cycle is timed - int const OnDemand(2); // defrost cycle occurs only when required - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run - - Real64 const RatedInletAirTemp(26.6667); // 26.6667C or 80F - Real64 const RatedInletWetBulbTemp(19.4444); // 19.44 or 67F - Real64 const RatedInletAirHumRat(0.0111847); // Humidity ratio corresponding to 80F dry bulb/67F wet bulb - Real64 const RatedOutdoorAirTemp(35.0); // 35 C or 95F - Real64 const RatedInletAirTempHeat(21.1111); // 21.11C or 70F - Real64 const RatedOutdoorAirTempHeat(8.3333); // 8.33 C or 47F - Real64 const RatedOutdoorWetBulbTempHeat(6.1111); // 6.11 C or 43F - Real64 const RatedInletWetBulbTempHeat(15.5556); // 15.55 or 60F - - Real64 const DryCoilOutletHumRatioMin(0.00001); // dry coil outlet minimum hum ratio kgWater/kgDryAir - - // Multimode DX Coil - int const MaxCapacityStages(2); // Maximum number of capacity stages supported - int const MaxDehumidModes(1); // Maximum number of enhanced dehumidification modes supported - int const MaxModes(MaxCapacityStages *(MaxDehumidModes + 1)); // Maximum number of performance modes - - // Water Systems - int const CondensateDiscarded(1001); // default mode where water is "lost" - int const CondensateToTank(1002); // collect coil condensate from air and store in water storage tank - - int const WaterSupplyFromMains(101); - int const WaterSupplyFromTank(102); - - // MODULE VARIABLE DECLARATIONS: - Array1D DXCoilOutletTemp; // DX coil outlet dry bulb temperature [C] - Array1D DXCoilOutletHumRat; // DX coil outlet humidity ratio [kgWater/kgDryAir] - Array1D DXCoilPartLoadRatio; // DX coil part-load ratio - Array1D_int DXCoilFanOpMode; // supply air fan operating mode - Array1D DXCoilFullLoadOutAirTemp; // DX coil full load outlet dry bulb temperature [C] - Array1D DXCoilFullLoadOutAirHumRat; // DX coil full load outlet humidity ratio [kgWater/kgDryAir] - Array1D DXCoilTotalCooling; // DX cooling coil total cooling output [W] - Array1D DXCoilTotalHeating; // DX heating coil total heating output [W] - Array1D DXCoilCoolInletAirWBTemp; // DX cooling coil inlet air wet-bulb temp [C] - Array1D DXCoilHeatInletAirDBTemp; // DX heating coil inlet air dry-bulb temp [C] - Array1D DXCoilHeatInletAirWBTemp; // DX heating coil inlet air wet-bulb temp [C] - - int CurDXCoilNum(0); - - int NumDXCoils(0); // Total number of DX coils - Real64 HPWHHeatingCapacity(0.0); // Used by Heat Pump:Water Heater object as total water heating capacity [W] - Real64 HPWHHeatingCOP(0.0); // Used by Heat Pump:Water Heater object as water heating COP [W/W] - bool GetCoilsInputFlag(true); // First time, input is "gotten" - bool MyOneTimeFlag(true); // One time flag used to allocate MyEnvrnFlag and MySizeFlag - int NumVRFHeatingCoils(0); // number of VRF heat pump heating coils - int NumVRFCoolingCoils(0); // number of VRF heat pump cooling coils - int NumVRFHeatingFluidTCtrlCoils(0); // number of VRF heat pump heating coils for FluidTCtrl Model - int NumVRFCoolingFluidTCtrlCoils(0); // number of VRF heat pump cooling coils for FluidTCtrl Model - int NumDXHeatingCoils(0); // number of DX heat pump heating coils - int NumDoe2DXCoils(0); // number of doe2 DX coils - int NumDXHeatPumpWaterHeaterPumpedCoils(0); // number of DX water heater coils, pumped - int NumDXHeatPumpWaterHeaterWrappedCoils(0); // number of DX water heater coils, pumped - int NumDXMulSpeedCoils(0); // number of DX coils with multi-speed compressor - int NumDXMulModeCoils(0); // number of DX coils with multi-mode performance - - int NumDXMulSpeedCoolCoils(0); // number of multispeed DX cooling coils - int NumDXMulSpeedHeatCoils(0); // number of multispeed DX heating coils - Array1D_bool CheckEquipName; - bool CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite(true); - - // SUBROUTINE SPECIFICATIONS FOR MODULE - - // Driver/Manager Routines - - // Get Input routines for module - - // Initialization routines for module - - // Update routines to check convergence and update nodes - - // Common routines - - // External function calls - - // Object Data - Array1D DXCoil; - Array1D DXCoilNumericFields; - - // bool CrankcaseHeaterReportVarFlag( true ); // One time flag used to report crankcase heater power for non-HP coils - namespace { - // These were static variables within different functions. They were pulled out into the namespace - // to facilitate easier unit testing of those functions. - // These are purposefully not in the header file as an extern variable. No one outside of this should - // use these. They are cleared by clear_state() for use by unit tests, but normal simulations should be unaffected. - // This is purposefully in an anonymous namespace so nothing outside this implementation file can use it. - bool CrankcaseHeaterReportVarFlag(true); - } // namespace // Functions void SimDXCoil(EnergyPlusData &state, @@ -263,32 +163,32 @@ namespace DXCoils { Real64 CompCycRatio; // compressor cycling ratio of VRF condenser // First time SimDXCoil is called, get the input for all the DX coils (condensing units) - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; // Set GetInputFlag false so you don't get coil inputs again + state.dataDXCoils->GetCoilsInputFlag = false; // Set GetInputFlag false so you don't get coil inputs again } if (CompIndex == 0) { - DXCoilNum = UtilityRoutines::FindItemInList(CompName, DXCoil); + DXCoilNum = UtilityRoutines::FindItemInList(CompName, state.dataDXCoils->DXCoil); if (DXCoilNum == 0) { ShowFatalError(state, "DX Coil not found=" + CompName); } CompIndex = DXCoilNum; } else { DXCoilNum = CompIndex; - if (DXCoilNum > NumDXCoils || DXCoilNum < 1) { + if (DXCoilNum > state.dataDXCoils->NumDXCoils || DXCoilNum < 1) { ShowFatalError( - state, format("SimDXCoil: Invalid CompIndex passed={}, Number of DX Coils={}, Coil name={}", DXCoilNum, NumDXCoils, CompName)); + state, format("SimDXCoil: Invalid CompIndex passed={}, Number of DX Coils={}, Coil name={}", DXCoilNum, state.dataDXCoils->NumDXCoils, CompName)); } - if (CheckEquipName(DXCoilNum)) { - if (!CompName.empty() && CompName != DXCoil(DXCoilNum).Name) { + if (state.dataDXCoils->CheckEquipName(DXCoilNum)) { + if (!CompName.empty() && CompName != state.dataDXCoils->DXCoil(DXCoilNum).Name) { ShowFatalError(state, format("SimDXCoil: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", DXCoilNum, CompName, - DXCoil(DXCoilNum).Name)); + state.dataDXCoils->DXCoil(DXCoilNum).Name)); } - CheckEquipName(DXCoilNum) = false; + state.dataDXCoils->CheckEquipName(DXCoilNum) = false; } } @@ -304,15 +204,13 @@ namespace DXCoils { CompCycRatio = 1.0; } - CurDXCoilNum = DXCoilNum; - // Initialize the DX coil unit InitDXCoil(state, DXCoilNum); // Select the correct unit type { auto const SELECT_CASE_var( - DXCoil(DXCoilNum).DXCoilType_Num); // Autodesk:OPTIONAL PartLoadRatio, MaxCap used in this block without PRESENT check + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num); // Autodesk:OPTIONAL PartLoadRatio, MaxCap used in this block without PRESENT check if (SELECT_CASE_var == CoilDX_CoolingSingleSpeed) { @@ -351,7 +249,7 @@ namespace DXCoils { } else { ShowSevereError(state, "Error detected in DX Coil=" + CompName); - ShowContinueError(state, "Invalid DX Coil Type=" + DXCoil(DXCoilNum).DXCoilType); + ShowContinueError(state, "Invalid DX Coil Type=" + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType); ShowFatalError(state, "Preceding condition causes termination."); } } @@ -398,35 +296,35 @@ namespace DXCoils { // FLOW // First time SimDXCoil is called, get the input for all the DX coils (condensing units) - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; // Set GetInputFlag false so you don't get coil inputs again + state.dataDXCoils->GetCoilsInputFlag = false; // Set GetInputFlag false so you don't get coil inputs again } // find correct DX Coil if (CompIndex == 0) { - DXCoilNum = UtilityRoutines::FindItemInList(CompName, DXCoil); + DXCoilNum = UtilityRoutines::FindItemInList(CompName, state.dataDXCoils->DXCoil); if (DXCoilNum == 0) { ShowFatalError(state, "DX Coil not found=" + CompName); } CompIndex = DXCoilNum; } else { DXCoilNum = CompIndex; - if (DXCoilNum > NumDXCoils || DXCoilNum < 1) { + if (DXCoilNum > state.dataDXCoils->NumDXCoils || DXCoilNum < 1) { ShowFatalError( state, - format("SimDXCoilMultiSpeed: Invalid CompIndex passed={}, Number of DX Coils={}, Coil name={}", DXCoilNum, NumDXCoils, CompName)); + format("SimDXCoilMultiSpeed: Invalid CompIndex passed={}, Number of DX Coils={}, Coil name={}", DXCoilNum, state.dataDXCoils->NumDXCoils, CompName)); } - if (CheckEquipName(DXCoilNum)) { - if (!CompName.empty() && CompName != DXCoil(DXCoilNum).Name) { + if (state.dataDXCoils->CheckEquipName(DXCoilNum)) { + if (!CompName.empty() && CompName != state.dataDXCoils->DXCoil(DXCoilNum).Name) { ShowFatalError(state, format("SimDXCoilMultiSpeed: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", DXCoilNum, CompName, - DXCoil(DXCoilNum).Name)); + state.dataDXCoils->DXCoil(DXCoilNum).Name)); } - CheckEquipName(DXCoilNum) = false; + state.dataDXCoils->CheckEquipName(DXCoilNum) = false; } } @@ -436,14 +334,12 @@ namespace DXCoils { SingleModeOper = 0; } - CurDXCoilNum = DXCoilNum; - // Initialize the DX coil unit InitDXCoil(state, DXCoilNum); // Select the correct unit type { - auto const SELECT_CASE_var(DXCoil(DXCoilNum).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num); if (SELECT_CASE_var == CoilDX_CoolingTwoSpeed) { @@ -451,7 +347,8 @@ namespace DXCoils { } else if (SELECT_CASE_var == CoilDX_MultiSpeedCooling) { if (present(SpeedNum)) - CalcMultiSpeedDXCoilCooling(state, DXCoilNum, + CalcMultiSpeedDXCoilCooling(state, + DXCoilNum, SpeedRatio, CycRatio, SpeedNum, @@ -471,7 +368,7 @@ namespace DXCoils { } else { ShowSevereError(state, "Error detected in DX Coil=" + CompName); - ShowContinueError(state, "Invalid DX Coil Type=" + DXCoil(DXCoilNum).DXCoilType); + ShowContinueError(state, "Invalid DX Coil Type=" + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType); ShowFatalError(state, "Preceding condition causes termination."); } } @@ -551,53 +448,51 @@ namespace DXCoils { // FLOW // First time SimDXCoil is called, get the input for all the DX coils (condensing units) - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; // Set GetInputFlag false so you don't get coil inputs again + state.dataDXCoils->GetCoilsInputFlag = false; // Set GetInputFlag false so you don't get coil inputs again } // find correct DX Coil if (CompIndex == 0) { - DXCoilNum = UtilityRoutines::FindItemInList(CompName, DXCoil); + DXCoilNum = UtilityRoutines::FindItemInList(CompName, state.dataDXCoils->DXCoil); if (DXCoilNum == 0) { ShowFatalError(state, "DX Coil not found=" + CompName); } CompIndex = DXCoilNum; } else { DXCoilNum = CompIndex; - if (DXCoilNum > NumDXCoils || DXCoilNum < 1) { + if (DXCoilNum > state.dataDXCoils->NumDXCoils || DXCoilNum < 1) { ShowFatalError( state, - format("SimDXCoilMultiMode: Invalid CompIndex passed={}, Number of DX Coils={}, Coil name={}", DXCoilNum, NumDXCoils, CompName)); + format("SimDXCoilMultiMode: Invalid CompIndex passed={}, Number of DX Coils={}, Coil name={}", DXCoilNum, state.dataDXCoils->NumDXCoils, CompName)); } - if (CheckEquipName(DXCoilNum)) { - if ((CompName != "") && (CompName != DXCoil(DXCoilNum).Name)) { + if (state.dataDXCoils->CheckEquipName(DXCoilNum)) { + if ((CompName != "") && (CompName != state.dataDXCoils->DXCoil(DXCoilNum).Name)) { ShowFatalError(state, format("SimDXCoilMultiMode: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}", DXCoilNum, CompName, - DXCoil(DXCoilNum).Name)); + state.dataDXCoils->DXCoil(DXCoilNum).Name)); } - CheckEquipName(DXCoilNum) = false; + state.dataDXCoils->CheckEquipName(DXCoilNum) = false; } } - CurDXCoilNum = DXCoilNum; - // Initialize the DX coil unit InitDXCoil(state, DXCoilNum); // Select the correct unit type { - auto const SELECT_CASE_var(DXCoil(DXCoilNum).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num); if (SELECT_CASE_var == CoilDX_CoolingTwoStageWHumControl) { // Initialize local variables S1RuntimeFraction = 0.0; - S1OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - S1OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - S1OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + S1OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + S1OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + S1OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; S1ElecCoolingPower = 0.0; S1TotalCoolingEnergyRate = 0.0; S1SensCoolingEnergyRate = 0.0; @@ -607,9 +502,9 @@ namespace DXCoils { S1EvapCondPumpElecPower = 0.0; S12RuntimeFraction = 0.0; - S12OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - S12OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - S12OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + S12OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + S12OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + S12OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; S12ElecCoolingPower = 0.0; S12TotalCoolingEnergyRate = 0.0; S12SensCoolingEnergyRate = 0.0; @@ -618,15 +513,15 @@ namespace DXCoils { S12EvapWaterConsumpRate = 0.0; S12EvapCondPumpElecPower = 0.0; - DXCoil(DXCoilNum).DehumidificationMode = DehumidMode; - if (DehumidMode > DXCoil(DXCoilNum).NumDehumidModes) { - ShowFatalError(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + state.dataDXCoils->DXCoil(DXCoilNum).DehumidificationMode = DehumidMode; + if (DehumidMode > state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes) { + ShowFatalError(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Requested enhanced dehumidification mode not available."); } // If a single-stage coil OR If part load is zero, // run stage 1 at zero part load to set leaving conditions - if ((DXCoil(DXCoilNum).NumCapacityStages == 1) || (PartLoadRatio <= 0.0)) { + if ((state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages == 1) || (PartLoadRatio <= 0.0)) { // Run stage 1 at its part load PerfMode = DehumidMode * 2 + 1; CalcDoe2DXCoil(state, DXCoilNum, On, FirstHVACIteration, PartLoadRatio, FanOpMode, PerfMode); @@ -637,18 +532,18 @@ namespace DXCoils { // Run stage 1 at full load PerfMode = DehumidMode * 2 + 1; CalcDoe2DXCoil(state, DXCoilNum, On, FirstHVACIteration, 1.0, FanOpMode, PerfMode); - S1SensCoolingEnergyRate = DXCoil(DXCoilNum).SensCoolingEnergyRate; + S1SensCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate; if (S1SensCoolingEnergyRate > 0.0) { S1PLR = PartLoadRatio; } else { S1PLR = 0.0; } // Run stage 1+2 at full load - if (DXCoil(DXCoilNum).NumCapacityStages >= 2) { + if (state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages >= 2) { PerfMode = DehumidMode * 2 + 2; CalcDoe2DXCoil(state, DXCoilNum, On, FirstHVACIteration, 1.0, FanOpMode, PerfMode); - S12SensCoolingEnergyRate = DXCoil(DXCoilNum).SensCoolingEnergyRate; - S12ElecCoolFullLoadPower = DXCoil(DXCoilNum).ElecCoolingPower; + S12SensCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate; + S12ElecCoolFullLoadPower = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; } // Determine run-time fractions for each stage based on sensible capacities @@ -685,67 +580,67 @@ namespace DXCoils { // No further adjustments are necessary. // Run stage 2 if needed and available - if ((S2PLR > 0.0) && (DXCoil(DXCoilNum).NumCapacityStages >= 2)) { + if ((S2PLR > 0.0) && (state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages >= 2)) { // Store stage 1 outputs - S1RuntimeFraction = DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; - S1OutletAirEnthalpy = DXCoil(DXCoilNum).OutletAirEnthalpy; - S1OutletAirHumRat = DXCoil(DXCoilNum).OutletAirHumRat; - S1OutletAirTemp = DXCoil(DXCoilNum).OutletAirTemp; - S1ElecCoolingPower = DXCoil(DXCoilNum).ElecCoolingPower; - S1TotalCoolingEnergyRate = DXCoil(DXCoilNum).TotalCoolingEnergyRate; - S1SensCoolingEnergyRate = DXCoil(DXCoilNum).SensCoolingEnergyRate; - S1LatCoolingEnergyRate = DXCoil(DXCoilNum).LatCoolingEnergyRate; - S1CrankcaseHeaterPower = DXCoil(DXCoilNum).CrankcaseHeaterPower; - S1EvapWaterConsumpRate = DXCoil(DXCoilNum).EvapWaterConsumpRate; - S1EvapCondPumpElecPower = DXCoil(DXCoilNum).EvapCondPumpElecPower; + S1RuntimeFraction = state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + S1OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy; + S1OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + S1OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + S1ElecCoolingPower = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + S1TotalCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate; + S1SensCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate; + S1LatCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate; + S1CrankcaseHeaterPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower; + S1EvapWaterConsumpRate = state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate; + S1EvapCondPumpElecPower = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower; // Save first stage full load outlet conditions to pass to heat recovery - S1FFullLoadOutAirTemp = DXCoilFullLoadOutAirTemp(DXCoilNum); - S1FullLoadOutAirHumRat = DXCoilFullLoadOutAirHumRat(DXCoilNum); + S1FFullLoadOutAirTemp = state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum); + S1FullLoadOutAirHumRat = state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum); // Run stage 1+2 at its part load PerfMode = DehumidMode * 2 + 2; CalcDoe2DXCoil(state, DXCoilNum, On, FirstHVACIteration, S2PLR, FanOpMode, PerfMode); - S12RuntimeFraction = DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; - S12OutletAirEnthalpy = DXCoil(DXCoilNum).OutletAirEnthalpy; - S12OutletAirHumRat = DXCoil(DXCoilNum).OutletAirHumRat; - S12OutletAirTemp = DXCoil(DXCoilNum).OutletAirTemp; - S12ElecCoolingPower = DXCoil(DXCoilNum).ElecCoolingPower; - S12TotalCoolingEnergyRate = DXCoil(DXCoilNum).TotalCoolingEnergyRate; - S12SensCoolingEnergyRate = DXCoil(DXCoilNum).SensCoolingEnergyRate; - S12LatCoolingEnergyRate = DXCoil(DXCoilNum).LatCoolingEnergyRate; - S12CrankcaseHeaterPower = DXCoil(DXCoilNum).CrankcaseHeaterPower; - S12EvapWaterConsumpRate = DXCoil(DXCoilNum).EvapWaterConsumpRate; - S12EvapCondPumpElecPower = DXCoil(DXCoilNum).EvapCondPumpElecPower; + S12RuntimeFraction = state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + S12OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy; + S12OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + S12OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + S12ElecCoolingPower = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + S12TotalCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate; + S12SensCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate; + S12LatCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate; + S12CrankcaseHeaterPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower; + S12EvapWaterConsumpRate = state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate; + S12EvapCondPumpElecPower = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower; // Determine combined performance - DXCoil(DXCoilNum).OutletAirEnthalpy = + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = (1.0 - S12RuntimeFraction) * S1OutletAirEnthalpy + S12RuntimeFraction * S12OutletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = (1.0 - S12RuntimeFraction) * S1OutletAirHumRat + S12RuntimeFraction * S12OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = PsyTdbFnHW(DXCoil(DXCoilNum).OutletAirEnthalpy, DXCoil(DXCoilNum).OutletAirHumRat); + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = (1.0 - S12RuntimeFraction) * S1OutletAirHumRat + S12RuntimeFraction * S12OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = PsyTdbFnHW(state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat); // Check for saturation error and modify temperature at constant enthalpy - if (DXCoil(DXCoilNum).CondenserInletNodeNum(PerfMode) != 0) { - NodePress = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(PerfMode)).Press; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(PerfMode) != 0) { + NodePress = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(PerfMode)).Press; // If node is not connected to anything, pressure = default, use weather data if (NodePress == DefaultNodeValues.Press) NodePress = state.dataEnvrn->OutBaroPress; - TSat = PsyTsatFnHPb(state, DXCoil(DXCoilNum).OutletAirEnthalpy, NodePress, RoutineName); - if (DXCoil(DXCoilNum).OutletAirTemp < TSat) { - DXCoil(DXCoilNum).OutletAirTemp = TSat; + TSat = PsyTsatFnHPb(state, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy, NodePress, RoutineName); + if (state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp < TSat) { + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = TSat; } - DXCoil(DXCoilNum).OutletAirHumRat = - PsyWFnTdbH(state, DXCoil(DXCoilNum).OutletAirTemp, DXCoil(DXCoilNum).OutletAirEnthalpy, RoutineName); + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = + PsyWFnTdbH(state, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy, RoutineName); } else { - TSat = PsyTsatFnHPb(state, DXCoil(DXCoilNum).OutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName); - if (DXCoil(DXCoilNum).OutletAirTemp < TSat) { - DXCoil(DXCoilNum).OutletAirTemp = TSat; + TSat = PsyTsatFnHPb(state, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy, state.dataEnvrn->OutBaroPress, RoutineName); + if (state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp < TSat) { + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = TSat; } // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // IF(DXCoil(DXCoilNum)%OutletAirTemp .LT. PsyTsatFnHPb(DXCoil(DXCoilNum)%OutletAirEnthalpy, & // Node(DXCoil(DXCoilNum)%AirInNode)%Press)) THEN // DXCoil(DXCoilNum)%OutletAirTemp = PsyTsatFnHPb(DXCoil(DXCoilNum)%OutletAirEnthalpy, & // Node(DXCoil(DXCoilNum)%AirInNode)%Press) - DXCoil(DXCoilNum).OutletAirHumRat = - PsyWFnTdbH(state, DXCoil(DXCoilNum).OutletAirTemp, DXCoil(DXCoilNum).OutletAirEnthalpy, RoutineName); + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = + PsyWFnTdbH(state, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy, RoutineName); } // DXCoil(DXCoilNum)%ElecCoolingPower = (1-S12RuntimeFraction)*S1ElecCoolingPower & @@ -754,57 +649,57 @@ namespace DXCoils { // So, must make an adjustment for S12ElecCoolingPower/S12ElecCoolFullLoadPower // when subtracting off S1ElecCoolingPower if (S12ElecCoolFullLoadPower > 0.0) { - DXCoil(DXCoilNum).ElecCoolingPower = + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = S1RuntimeFraction * S1ElecCoolingPower + S12RuntimeFraction * (S12ElecCoolingPower - S1ElecCoolingPower * S12ElecCoolingPower / S12ElecCoolFullLoadPower); } else { - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; } - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = S1RuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = S1RuntimeFraction; - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; CalcComponentSensibleLatentOutput(AirMassFlow, - DXCoil(DXCoilNum).InletAirTemp, - DXCoil(DXCoilNum).InletAirHumRat, - DXCoil(DXCoilNum).OutletAirTemp, - DXCoil(DXCoilNum).OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); - - DXCoil(DXCoilNum).EvapWaterConsumpRate = + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); + + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = (1.0 - S12RuntimeFraction) * S1EvapWaterConsumpRate + S12RuntimeFraction * S12EvapWaterConsumpRate; - DXCoil(DXCoilNum).EvapCondPumpElecPower = + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = (1.0 - S12RuntimeFraction) * S1EvapCondPumpElecPower + S12RuntimeFraction * S12EvapCondPumpElecPower; // Stage 1 runtime sets the crankcase heater power - DXCoil(DXCoilNum).CrankcaseHeaterPower = S1CrankcaseHeaterPower; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = S1CrankcaseHeaterPower; - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; // calculate average full load outlet conditions for second stage operation - DXCoilFullLoadOutAirTemp(DXCoilNum) = (1.0 - S2PLR) * S1FFullLoadOutAirTemp + S2PLR * DXCoilFullLoadOutAirTemp(DXCoilNum); - DXCoilFullLoadOutAirHumRat(DXCoilNum) = (1.0 - S2PLR) * S1FullLoadOutAirHumRat + S2PLR * DXCoilFullLoadOutAirHumRat(DXCoilNum); + state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum) = (1.0 - S2PLR) * S1FFullLoadOutAirTemp + S2PLR * state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum); + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum) = (1.0 - S2PLR) * S1FullLoadOutAirHumRat + S2PLR * state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum); } // End if stage 2 is operating // set the part load ratio and heat reclaim capacity for use by desuperheater heating coils - DXCoil(DXCoilNum).PartLoadRatio = S1PLR; - DXCoilPartLoadRatio(DXCoilNum) = S1PLR; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = S1PLR; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = S1PLR; // Calculation for heat reclaim needs to be corrected to use compressor power (not including condenser fan power) - HeatReclaimDXCoil(DXCoilNum).AvailCapacity = DXCoil(DXCoilNum).TotalCoolingEnergyRate + DXCoil(DXCoilNum).ElecCoolingPower; + HeatReclaimDXCoil(DXCoilNum).AvailCapacity = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).CoolingCoilStg2RuntimeFrac = S12RuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilStg2RuntimeFrac = S12RuntimeFraction; // Calculate basin heater power CalcBasinHeaterPowerForMultiModeDXCoil(state, DXCoilNum, DehumidMode); } else { ShowSevereError(state, "Error detected in DX Coil=" + CompName); - ShowContinueError(state, "Invalid DX Coil Type=" + DXCoil(DXCoilNum).DXCoilType); + ShowContinueError(state, "Invalid DX Coil Type=" + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType); ShowFatalError(state, "Preceding condition causes termination."); } } @@ -906,22 +801,25 @@ namespace DXCoils { Real64 CurveInput; // index used for testing PLF curve output // find number of each type of DX coil and calculate the total number - NumDoe2DXCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:SingleSpeed"); - NumDXHeatingCoils = inputProcessor->getNumObjectsFound(state, "Coil:Heating:DX:SingleSpeed"); - NumDXMulSpeedCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:TwoSpeed"); - NumDXMulModeCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:TwoStageWithHumidityControlMode"); - NumDXHeatPumpWaterHeaterPumpedCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilDX_HeatPumpWaterHeaterPumped)); - NumDXHeatPumpWaterHeaterWrappedCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilDX_HeatPumpWaterHeaterWrapped)); - NumDXMulSpeedCoolCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:MultiSpeed"); - NumDXMulSpeedHeatCoils = inputProcessor->getNumObjectsFound(state, "Coil:Heating:DX:MultiSpeed"); - NumVRFCoolingCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_Cooling)); - NumVRFHeatingCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_Heating)); - NumVRFCoolingFluidTCtrlCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_FluidTCtrl_Cooling)); - NumVRFHeatingFluidTCtrlCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_FluidTCtrl_Heating)); - - NumDXCoils = NumDoe2DXCoils + NumDXHeatingCoils + NumDXMulSpeedCoils + NumDXMulModeCoils + NumDXHeatPumpWaterHeaterPumpedCoils + - NumDXHeatPumpWaterHeaterWrappedCoils + NumDXMulSpeedCoolCoils + NumDXMulSpeedHeatCoils + NumVRFCoolingCoils + - NumVRFHeatingCoils + NumVRFCoolingFluidTCtrlCoils + NumVRFHeatingFluidTCtrlCoils; + state.dataDXCoils->NumDoe2DXCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:SingleSpeed"); + state.dataDXCoils->NumDXHeatingCoils = inputProcessor->getNumObjectsFound(state, "Coil:Heating:DX:SingleSpeed"); + state.dataDXCoils->NumDXMulSpeedCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:TwoSpeed"); + state.dataDXCoils->NumDXMulModeCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:TwoStageWithHumidityControlMode"); + state.dataDXCoils->NumDXHeatPumpWaterHeaterPumpedCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilDX_HeatPumpWaterHeaterPumped)); + state.dataDXCoils->NumDXHeatPumpWaterHeaterWrappedCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilDX_HeatPumpWaterHeaterWrapped)); + state.dataDXCoils->NumDXMulSpeedCoolCoils = inputProcessor->getNumObjectsFound(state, "Coil:Cooling:DX:MultiSpeed"); + state.dataDXCoils->NumDXMulSpeedHeatCoils = inputProcessor->getNumObjectsFound(state, "Coil:Heating:DX:MultiSpeed"); + state.dataDXCoils->NumVRFCoolingCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_Cooling)); + state.dataDXCoils->NumVRFHeatingCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_Heating)); + state.dataDXCoils->NumVRFCoolingFluidTCtrlCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_FluidTCtrl_Cooling)); + state.dataDXCoils->NumVRFHeatingFluidTCtrlCoils = inputProcessor->getNumObjectsFound(state, cAllCoilTypes(CoilVRF_FluidTCtrl_Heating)); + + state.dataDXCoils->NumDXCoils = + state.dataDXCoils->NumDoe2DXCoils + state.dataDXCoils->NumDXHeatingCoils + state.dataDXCoils->NumDXMulSpeedCoils + + state.dataDXCoils->NumDXMulModeCoils + state.dataDXCoils->NumDXHeatPumpWaterHeaterPumpedCoils + + state.dataDXCoils->NumDXHeatPumpWaterHeaterWrappedCoils + state.dataDXCoils->NumDXMulSpeedCoolCoils + + state.dataDXCoils->NumDXMulSpeedHeatCoils + state.dataDXCoils->NumVRFCoolingCoils + state.dataDXCoils->NumVRFHeatingCoils + + state.dataDXCoils->NumVRFCoolingFluidTCtrlCoils + state.dataDXCoils->NumVRFHeatingFluidTCtrlCoils; // Determine max number of alpha and numeric arguments for all objects being read, in order to allocate local arrays inputProcessor->getObjectDefMaxArgs(state, "Coil:Cooling:DX:SingleSpeed", TotalArgs, NumAlphas, NumNumbers); @@ -981,38 +879,38 @@ namespace DXCoils { // allocate the data structure // Derived types - DXCoil.allocate(NumDXCoils); - DXCoilNumericFields.allocate(NumDXCoils); - HeatReclaimDXCoil.allocate(NumDXCoils); - CheckEquipName.dimension(NumDXCoils, true); + state.dataDXCoils->DXCoil.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilNumericFields.allocate(state.dataDXCoils->NumDXCoils); + HeatReclaimDXCoil.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->CheckEquipName.dimension(state.dataDXCoils->NumDXCoils, true); // Module level variable arrays - DXCoilOutletTemp.allocate(NumDXCoils); - DXCoilOutletHumRat.allocate(NumDXCoils); - DXCoilPartLoadRatio.allocate(NumDXCoils); - DXCoilFanOpMode.allocate(NumDXCoils); - DXCoilFullLoadOutAirTemp.allocate(NumDXCoils); - DXCoilFullLoadOutAirHumRat.allocate(NumDXCoils); - DXCoilTotalCooling.allocate(NumDXCoils); - DXCoilTotalHeating.allocate(NumDXCoils); - DXCoilCoolInletAirWBTemp.allocate(NumDXCoils); - DXCoilHeatInletAirDBTemp.allocate(NumDXCoils); - DXCoilHeatInletAirWBTemp.allocate(NumDXCoils); + state.dataDXCoils->DXCoilOutletTemp.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilOutletHumRat.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilPartLoadRatio.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilFanOpMode.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilFullLoadOutAirTemp.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilFullLoadOutAirHumRat.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilTotalCooling.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilTotalHeating.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilCoolInletAirWBTemp.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilHeatInletAirDBTemp.allocate(state.dataDXCoils->NumDXCoils); + state.dataDXCoils->DXCoilHeatInletAirWBTemp.allocate(state.dataDXCoils->NumDXCoils); // initialize the module level arrays - DXCoilOutletTemp = 0.0; - DXCoilOutletHumRat = 0.0; - DXCoilPartLoadRatio = 0.0; - DXCoilFanOpMode = 0; - DXCoilFullLoadOutAirTemp = 0.0; - DXCoilFullLoadOutAirHumRat = 0.0; + state.dataDXCoils->DXCoilOutletTemp = 0.0; + state.dataDXCoils->DXCoilOutletHumRat = 0.0; + state.dataDXCoils->DXCoilPartLoadRatio = 0.0; + state.dataDXCoils->DXCoilFanOpMode = 0; + state.dataDXCoils->DXCoilFullLoadOutAirTemp = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat = 0.0; // initialize the coil counter DXCoilNum = 0; // Loop over the Doe2 DX Coils and get & load the data CurrentModuleObject = "Coil:Cooling:DX:SingleSpeed"; - for (DXCoilIndex = 1; DXCoilIndex <= NumDoe2DXCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDoe2DXCoils; ++DXCoilIndex) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -1029,75 +927,75 @@ namespace DXCoils { ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils - HeatReclaimDXCoil(DXCoilNum).Name = DXCoil(DXCoilNum).Name; + HeatReclaimDXCoil(DXCoilNum).Name = state.dataDXCoils->DXCoil(DXCoilNum).Name; HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingSingleSpeed; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingSingleSpeed; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); - DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); - DXCoil(DXCoilNum).RatedCOP(1) = Numbers(3); - if (DXCoil(DXCoilNum).RatedCOP(1) <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) = Numbers(3); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0, entered value=[{:.2T}].", cNumericFields(3), Numbers(3))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(4); - DXCoil(DXCoilNum).FanPowerPerEvapAirFlowRate(1) = Numbers(5); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(4); + state.dataDXCoils->DXCoil(DXCoilNum).FanPowerPerEvapAirFlowRate(1) = Numbers(5); - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(5)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFTemp(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(5)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(5) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(5) + "=\"" + Alphas(5) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - DXCoil(DXCoilNum).CCapFTemp(1), // Curve index + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(5)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), cAlphaFields(5), Alphas(5), RatedInletWetBulbTemp, @@ -1105,54 +1003,54 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) == 0) { if (lAlphaBlanks(6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(6) + "=\"" + Alphas(6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); } } - DXCoil(DXCoilNum).EIRFTemp(1) = GetCurveIndex(state, Alphas(7)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFTemp(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1) = GetCurveIndex(state, Alphas(7)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1) == 0) { if (lAlphaBlanks(7)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(7) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(7) + "=\"" + Alphas(7) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(7)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).EIRFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), cAlphaFields(7), Alphas(7), RatedInletWetBulbTemp, @@ -1160,48 +1058,48 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).EIRFFlow(1) = GetCurveIndex(state, Alphas(8)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1) = GetCurveIndex(state, Alphas(8)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1) == 0) { if (lAlphaBlanks(8)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(8) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(8) + "=\"" + Alphas(8) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(8)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).EIRFFlow(1), cAlphaFields(8), Alphas(8), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), cAlphaFields(8), Alphas(8), 1.0); } } - DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(9)); // convert curve name to number - if (DXCoil(DXCoilNum).PLFFPLR(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(9)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) == 0) { if (lAlphaBlanks(9)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(9) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(9) + "=\"" + Alphas(9) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).PLFFPLR(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(9)); // Field Name if (!ErrorsFound) { @@ -1210,7 +1108,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -1222,58 +1120,58 @@ namespace DXCoils { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(9) + "=\"" + Alphas(9) + "\" has out of range values."); ShowContinueError(state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(9) + " = " + Alphas(9) + " has out of range value."); ShowContinueError(state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); } } } // Set minimum OAT for compressor operation - DXCoil(DXCoilNum).MinOATCompressor = Numbers(6); + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = Numbers(6); if (NumNumbers < 6) - DXCoil(DXCoilNum).MinOATCompressor = minOATCompDXCooling; // input field is after min fields and won't default if field not included + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = minOATCompDXCooling; // input field is after min fields and won't default if field not included - DXCoil(DXCoilNum).Twet_Rated(1) = Numbers(7); - DXCoil(DXCoilNum).Gamma_Rated(1) = Numbers(8); - DXCoil(DXCoilNum).MaxONOFFCyclesperHour(1) = Numbers(9); - DXCoil(DXCoilNum).LatentCapacityTimeConstant(1) = Numbers(10); + state.dataDXCoils->DXCoil(DXCoilNum).Twet_Rated(1) = Numbers(7); + state.dataDXCoils->DXCoil(DXCoilNum).Gamma_Rated(1) = Numbers(8); + state.dataDXCoils->DXCoil(DXCoilNum).MaxONOFFCyclesperHour(1) = Numbers(9); + state.dataDXCoils->DXCoil(DXCoilNum).LatentCapacityTimeConstant(1) = Numbers(10); // Numbers (7) through (10) must all be greater than zero to use the latent capacity degradation model if ((Numbers(7) > 0.0 || Numbers(8) > 0.0 || Numbers(9) > 0.0 || Numbers(10) > 0.0) && (Numbers(7) <= 0.0 || Numbers(8) <= 0.0 || Numbers(9) <= 0.0 || Numbers(10) <= 0.0)) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\":"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError(state, "...At least one of the four input parameters for the latent capacity degradation model"); ShowContinueError(state, "...is set to zero. Therefore, the latent degradation model will not be used for this simulation."); } // outdoor condenser node if (lAlphaBlanks(10)) { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; } else { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(10), + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(10), ErrorsFound, CurrentModuleObject, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, NodeType_Air, NodeConnectionType_OutsideAirReference, 1, ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", may be invalid"); + if (!CheckOutAirNodeNumber(state, state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", may be invalid"); ShowContinueError(state, cAlphaFields(10) + "=\"" + Alphas(10) + "\", node does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ShowContinueError(state, @@ -1282,173 +1180,173 @@ namespace DXCoils { } if ((UtilityRoutines::SameString(Alphas(11), "AirCooled")) || lAlphaBlanks(11)) { - DXCoil(DXCoilNum).CondenserType(1) = AirCooled; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = AirCooled; } else if (UtilityRoutines::SameString(Alphas(11), "EvaporativelyCooled")) { - DXCoil(DXCoilNum).CondenserType(1) = EvapCooled; - DXCoil(DXCoilNum).ReportEvapCondVars = true; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = EvapCooled; + state.dataDXCoils->DXCoil(DXCoilNum).ReportEvapCondVars = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(11) + "=\"" + Alphas(11) + "\":"); ShowContinueError(state, "...must be AirCooled or EvaporativelyCooled."); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondEffect(1) = Numbers(11); - if (DXCoil(DXCoilNum).EvapCondEffect(1) < 0.0 || DXCoil(DXCoilNum).EvapCondEffect(1) > 1.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(1) = Numbers(11); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(1) < 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(1) > 1.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(11) + " cannot be < 0.0 or > 1.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(11))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondAirFlow(1) = Numbers(12); - if (DXCoil(DXCoilNum).EvapCondAirFlow(1) < 0.0 && DXCoil(DXCoilNum).EvapCondAirFlow(1) != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(1) = Numbers(12); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(1) < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(1) != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(12) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(12))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) = Numbers(13); - if (DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) < 0.0 && DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) = Numbers(13); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(13) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(13))); ErrorsFound = true; } // Set crankcase heater capacity - DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(14); - if (DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(14); + if (state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(14) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(14))); ErrorsFound = true; } // Set crankcase heater cutout temperature - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(15); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(15); - if (DXCoil(DXCoilNum).RatedCOP(1) > 0.0) { - DXCoil(DXCoilNum).RatedEIR(1) = 1.0 / DXCoil(DXCoilNum).RatedCOP(1); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) > 0.0) { + state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(1) = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1); } // Get Water System tank connections // A12, \field Name of Water Storage Tank for Supply - DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(12); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(12); if (lAlphaBlanks(12)) { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromMains; } else { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; - SetupTankDemandComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromTank; + SetupTankDemandComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).EvapWaterSupplyName, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName, ErrorsFound, - DXCoil(DXCoilNum).EvapWaterSupTankID, - DXCoil(DXCoilNum).EvapWaterTankDemandARRID); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID); } // A13; \field Name of Water Storage Tank for Condensate Collection - DXCoil(DXCoilNum).CondensateCollectName = Alphas(13); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName = Alphas(13); if (lAlphaBlanks(13)) { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::Discarded; } else { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::ToTank; + SetupTankSupplyComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).CondensateCollectName, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName, ErrorsFound, - DXCoil(DXCoilNum).CondensateTankID, - DXCoil(DXCoilNum).CondensateTankSupplyARRID); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID); } // Basin heater power as a function of temperature must be greater than or equal to 0 - DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(16); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(16); if (Numbers(16) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(16) + " must be >= 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(16))); ErrorsFound = true; } - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(17); - if (DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(17); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { if (NumNumbers < 17) { - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; } - if (DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", freeze possible"); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", freeze possible"); ShowContinueError(state, "..." + cNumericFields(17) + " is < 2 {C}. Freezing could occur."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(17))); } } if (!lAlphaBlanks(14)) { - DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(14)); - if (DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(14)); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(14) + "=\"" + Alphas(14) + "\"."); ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); } } if (!lAlphaBlanks(15) && NumAlphas > 14) { - DXCoil(DXCoilNum).SHRFTemp(1) = GetCurveIndex(state, Alphas(15)); // convert curve name to number - if (DXCoil(DXCoilNum).SHRFTemp(1) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1) = GetCurveIndex(state, Alphas(15)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(15) + "=\"" + Alphas(15) + "\"."); } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(15)); // Field Name } } if (!lAlphaBlanks(16) && NumAlphas > 15) { - DXCoil(DXCoilNum).SHRFFlow(1) = GetCurveIndex(state, Alphas(16)); // convert curve name to number - if (DXCoil(DXCoilNum).SHRFTemp(1) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(1) = GetCurveIndex(state, Alphas(16)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(16) + "=\"" + Alphas(16) + "\"."); } else { // Verify Curve Object, only legal type is Quadratic and Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(16)); // Field Name } } - if (DXCoil(DXCoilNum).SHRFTemp(1) > 0 && DXCoil(DXCoilNum).SHRFFlow(1) > 0) { - DXCoil(DXCoilNum).UserSHRCurveExists = true; + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1) > 0 && state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(1) > 0) { + state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists = true; } // get User Input flag for ASHRAE Standard 127 Standard Ratings Reporting if (lAlphaBlanks(17)) { - DXCoil(DXCoilNum).ASHRAE127StdRprt = false; + state.dataDXCoils->DXCoil(DXCoilNum).ASHRAE127StdRprt = false; } else { if (Alphas(17) == "YES" || Alphas(17) == "Yes") { - DXCoil(DXCoilNum).ASHRAE127StdRprt = true; + state.dataDXCoils->DXCoil(DXCoilNum).ASHRAE127StdRprt = true; } else { - DXCoil(DXCoilNum).ASHRAE127StdRprt = false; + state.dataDXCoils->DXCoil(DXCoilNum).ASHRAE127StdRprt = false; } } // A18; \field Zone Name for Condenser Placement if (!lAlphaBlanks(18) && NumAlphas > 17) { - DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(18), Zone); - if (DXCoil(DXCoilNum).SecZonePtr > 0) { - SetupZoneInternalGain(state, DXCoil(DXCoilNum).SecZonePtr, + state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(18), Zone); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr > 0) { + SetupZoneInternalGain(state, state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr, "Coil:Cooling:DX:SingleSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, IntGainTypeOf_SecCoolingDXCoilSingleSpeed, - &DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + &state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); + state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(18) + "=\"" + Alphas(18) + "\"."); } } @@ -1461,7 +1359,7 @@ namespace DXCoils { // Loop over the Multimode DX Coils and get & load the data CurrentModuleObject = "Coil:Cooling:DX:TwoStageWithHumidityControlMode"; - for (DXCoilIndex = 1; DXCoilIndex <= NumDXMulModeCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDXMulModeCoils; ++DXCoilIndex) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -1481,59 +1379,59 @@ namespace DXCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils - HeatReclaimDXCoil(DXCoilNum).Name = DXCoil(DXCoilNum).Name; + HeatReclaimDXCoil(DXCoilNum).Name = state.dataDXCoils->DXCoil(DXCoilNum).Name; HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingTwoStageWHumControl; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingTwoStageWHumControl; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); // Set crankcase heater capacity - DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(1); - if (DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(1); + if (state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0.0, entered value=[{:.2T}].", cNumericFields(1), Numbers(1))); ErrorsFound = true; } // Set crankcase heater cutout temperature - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(2); // Number of capacity stages - DXCoil(DXCoilNum).NumCapacityStages = Numbers(3); + state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages = Numbers(3); // Check if requested number of capacity stages exceeds limits - if ((DXCoil(DXCoilNum).NumCapacityStages > MaxCapacityStages) || (DXCoil(DXCoilNum).NumCapacityStages < 1)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); - ShowContinueError(state, format("...illegal {} = {}", cNumericFields(3), DXCoil(DXCoilNum).NumCapacityStages)); + if ((state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages > MaxCapacityStages) || (state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages < 1)) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); + ShowContinueError(state, format("...illegal {} = {}", cNumericFields(3), state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages)); ShowContinueError(state, format("...Valid range is 1 to {}", MaxCapacityStages)); ErrorsFound = true; } // Number of enhanced dehumidification modes - DXCoil(DXCoilNum).NumDehumidModes = Numbers(4); + state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes = Numbers(4); // Check if requested number of enhanced dehumidification modes exceeds limits - if ((DXCoil(DXCoilNum).NumDehumidModes > MaxDehumidModes) || (DXCoil(DXCoilNum).NumDehumidModes < 0)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); - ShowContinueError(state, format("...illegal {} = {}", cNumericFields(4), DXCoil(DXCoilNum).NumDehumidModes)); + if ((state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes > MaxDehumidModes) || (state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes < 0)) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); + ShowContinueError(state, format("...illegal {} = {}", cNumericFields(4), state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes)); ShowContinueError(state, format("...Valid range is 0 to {}", MaxDehumidModes)); ErrorsFound = true; } @@ -1541,15 +1439,15 @@ namespace DXCoils { // Set starting alpha index for coil performance inputs AlphaIndex = 5; // allocate performance modes for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(DXCoil(DXCoilNum).NumDehumidModes * 2 + - DXCoil(DXCoilNum).NumCapacityStages * 2); // not sure this math is correct, ask MW + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes * 2 + + state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages * 2); // not sure this math is correct, ask MW // Loop through capacity stages and dehumidification modes - for (DehumidModeNum = 0; DehumidModeNum <= DXCoil(DXCoilNum).NumDehumidModes; ++DehumidModeNum) { - for (CapacityStageNum = 1; CapacityStageNum <= DXCoil(DXCoilNum).NumCapacityStages; ++CapacityStageNum) { + for (DehumidModeNum = 0; DehumidModeNum <= state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes; ++DehumidModeNum) { + for (CapacityStageNum = 1; CapacityStageNum <= state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages; ++CapacityStageNum) { // Check if sufficient number of fields entered if ((AlphaIndex + 1) > NumAlphas) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not enough remaining fields for specified Number of Operating Modes."); ShowContinueError(state, "...Need additional Coil Performance Object Type and Coil Performance Object Name fields."); ErrorsFound = true; @@ -1557,16 +1455,16 @@ namespace DXCoils { PerfObjectType = Alphas(AlphaIndex); PerfObjectName = Alphas(AlphaIndex + 1); PerfModeNum = DehumidModeNum * 2 + CapacityStageNum; - DXCoil(DXCoilNum).CoilPerformanceType(PerfModeNum) = PerfObjectType; + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceType(PerfModeNum) = PerfObjectType; if (UtilityRoutines::SameString(PerfObjectType, "CoilPerformance:DX:Cooling")) { - DXCoil(DXCoilNum).CoilPerformanceType_Num(PerfModeNum) = CoilPerfDX_CoolBypassEmpirical; + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceType_Num(PerfModeNum) = CoilPerfDX_CoolBypassEmpirical; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFields(AlphaIndex) + "=\"" + PerfObjectType + "\"."); ShowContinueError(state, "Must be \"CoilPerformance:DX:Cooling\"."); ErrorsFound = true; } - DXCoil(DXCoilNum).CoilPerformanceName(PerfModeNum) = PerfObjectName; + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(PerfModeNum) = PerfObjectName; // Get for CoilPerformance object PerfObjectNum = inputProcessor->getObjectItemNum(state, PerfObjectType, PerfObjectName); if (PerfObjectNum > 0) { @@ -1585,21 +1483,21 @@ namespace DXCoils { cNumericFields2); // allocate performance mode numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode(PerfModeNum).FieldNames.allocate(NumNumbers2); // use MaxNumbers here?? - DXCoilNumericFields(DXCoilNum).PerfMode(PerfModeNum).FieldNames = cNumericFields2; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(PerfModeNum).FieldNames.allocate(NumNumbers2); // use MaxNumbers here?? + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(PerfModeNum).FieldNames = cNumericFields2; - DXCoil(DXCoilNum).RatedTotCap(PerfModeNum) = Numbers2(1); - DXCoil(DXCoilNum).RatedSHR(PerfModeNum) = Numbers2(2); - DXCoil(DXCoilNum).RatedCOP(PerfModeNum) = Numbers2(3); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(PerfModeNum) = Numbers2(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(PerfModeNum) = Numbers2(2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(PerfModeNum) = Numbers2(3); // Rated flow is immediately adjusted for bypass fraction if not autosized - DXCoil(DXCoilNum).BypassedFlowFrac(PerfModeNum) = Numbers2(5); - DXCoil(DXCoilNum).RatedAirVolFlowRate(PerfModeNum) = Numbers2(4); - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(PerfModeNum) != AutoSize) { - DXCoil(DXCoilNum).RatedAirVolFlowRate(PerfModeNum) *= (1.0 - DXCoil(DXCoilNum).BypassedFlowFrac(PerfModeNum)); + state.dataDXCoils->DXCoil(DXCoilNum).BypassedFlowFrac(PerfModeNum) = Numbers2(5); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(PerfModeNum) = Numbers2(4); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(PerfModeNum) != AutoSize) { + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(PerfModeNum) *= (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).BypassedFlowFrac(PerfModeNum)); } - DXCoil(DXCoilNum).CCapFTemp(PerfModeNum) = GetCurveIndex(state, Alphas2(2)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFTemp(PerfModeNum) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(PerfModeNum) = GetCurveIndex(state, Alphas2(2)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(PerfModeNum) == 0) { if (lAlphaBlanks2(2)) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "...required " + cAlphaFields2(2) + " is blank."); @@ -1610,17 +1508,17 @@ namespace DXCoils { ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFTemp(PerfModeNum), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(PerfModeNum), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields2(2)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(PerfModeNum), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(PerfModeNum), cAlphaFields2(2), Alphas2(2), RatedInletWetBulbTemp, @@ -1628,8 +1526,8 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).CCapFFlow(PerfModeNum) = GetCurveIndex(state, Alphas2(3)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFFlow(PerfModeNum) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(PerfModeNum) = GetCurveIndex(state, Alphas2(3)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(PerfModeNum) == 0) { if (lAlphaBlanks2(3)) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "...required " + cAlphaFields2(3) + " is blank."); @@ -1640,25 +1538,25 @@ namespace DXCoils { ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFFlow(PerfModeNum), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(PerfModeNum), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields2(3)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFFlow(PerfModeNum), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(PerfModeNum), cAlphaFields2(3), Alphas2(3), 1.0); } } - DXCoil(DXCoilNum).EIRFTemp(PerfModeNum) = GetCurveIndex(state, Alphas2(4)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFTemp(PerfModeNum) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(PerfModeNum) = GetCurveIndex(state, Alphas2(4)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(PerfModeNum) == 0) { if (lAlphaBlanks2(4)) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "...required " + cAlphaFields2(4) + " is blank."); @@ -1669,17 +1567,17 @@ namespace DXCoils { ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFTemp(PerfModeNum), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(PerfModeNum), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields2(4)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).EIRFTemp(PerfModeNum), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(PerfModeNum), cAlphaFields2(4), Alphas2(4), RatedInletWetBulbTemp, @@ -1687,8 +1585,8 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).EIRFFlow(PerfModeNum) = GetCurveIndex(state, Alphas2(5)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFFlow(PerfModeNum) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(PerfModeNum) = GetCurveIndex(state, Alphas2(5)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(PerfModeNum) == 0) { if (lAlphaBlanks2(5)) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "...required " + cAlphaFields2(5) + " is blank."); @@ -1699,25 +1597,25 @@ namespace DXCoils { ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFFlow(PerfModeNum), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(PerfModeNum), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields2(5)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).EIRFFlow(PerfModeNum), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(PerfModeNum), cAlphaFields2(5), Alphas2(5), 1.0); } } - DXCoil(DXCoilNum).PLFFPLR(PerfModeNum) = GetCurveIndex(state, Alphas2(6)); // convert curve name to number - if (DXCoil(DXCoilNum).PLFFPLR(PerfModeNum) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(PerfModeNum) = GetCurveIndex(state, Alphas2(6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(PerfModeNum) == 0) { if (lAlphaBlanks2(6)) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "...required " + cAlphaFields2(6) + " is blank."); @@ -1728,11 +1626,11 @@ namespace DXCoils { ErrorsFound = true; } else { // Verify Curve Object, only legal types are Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields2(6)); // Field Name if (!ErrorsFound) { @@ -1741,7 +1639,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -1759,7 +1657,7 @@ namespace DXCoils { state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { @@ -1769,15 +1667,15 @@ namespace DXCoils { state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), ErrorsFound, _, 1.0); } } } - DXCoil(DXCoilNum).Twet_Rated(PerfModeNum) = Numbers2(6); - DXCoil(DXCoilNum).Gamma_Rated(PerfModeNum) = Numbers2(7); - DXCoil(DXCoilNum).MaxONOFFCyclesperHour(PerfModeNum) = Numbers2(8); - DXCoil(DXCoilNum).LatentCapacityTimeConstant(PerfModeNum) = Numbers2(9); + state.dataDXCoils->DXCoil(DXCoilNum).Twet_Rated(PerfModeNum) = Numbers2(6); + state.dataDXCoils->DXCoil(DXCoilNum).Gamma_Rated(PerfModeNum) = Numbers2(7); + state.dataDXCoils->DXCoil(DXCoilNum).MaxONOFFCyclesperHour(PerfModeNum) = Numbers2(8); + state.dataDXCoils->DXCoil(DXCoilNum).LatentCapacityTimeConstant(PerfModeNum) = Numbers2(9); // Numbers2 (6) through (9) must all be greater than zero to use the latent capacity degradation model if ((Numbers2(6) > 0.0 || Numbers2(7) > 0.0 || Numbers2(8) > 0.0 || Numbers2(9) > 0.0) && (Numbers2(6) <= 0.0 || Numbers2(7) <= 0.0 || Numbers2(8) <= 0.0 || Numbers2(9) <= 0.0)) { @@ -1788,9 +1686,9 @@ namespace DXCoils { // outdoor condenser node if (lAlphaBlanks2(7)) { - DXCoil(DXCoilNum).CondenserInletNodeNum(PerfModeNum) = 0; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(PerfModeNum) = 0; } else { - DXCoil(DXCoilNum).CondenserInletNodeNum(PerfModeNum) = GetOnlySingleNode(state, Alphas2(7), + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(PerfModeNum) = GetOnlySingleNode(state, Alphas2(7), ErrorsFound, PerfObjectType, PerfObjectName, @@ -1798,7 +1696,7 @@ namespace DXCoils { NodeConnectionType_OutsideAirReference, 1, ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).CondenserInletNodeNum(PerfModeNum))) { + if (!CheckOutAirNodeNumber(state, state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(PerfModeNum))) { ShowWarningError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\":"); ShowContinueError(state, "may not be valid " + cAlphaFields2(7) + "=\"" + Alphas2(7) + "\"."); ShowContinueError(state, "node does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); @@ -1807,10 +1705,10 @@ namespace DXCoils { } } if ((UtilityRoutines::SameString(Alphas2(8), "AirCooled")) || lAlphaBlanks2(8)) { - DXCoil(DXCoilNum).CondenserType(PerfModeNum) = AirCooled; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(PerfModeNum) = AirCooled; } else if (UtilityRoutines::SameString(Alphas2(8), "EvaporativelyCooled")) { - DXCoil(DXCoilNum).CondenserType(PerfModeNum) = EvapCooled; - DXCoil(DXCoilNum).ReportEvapCondVars = true; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(PerfModeNum) = EvapCooled; + state.dataDXCoils->DXCoil(DXCoilNum).ReportEvapCondVars = true; } else { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields2(8) + "=\"" + Alphas2(8) + "\":"); @@ -1818,73 +1716,73 @@ namespace DXCoils { ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondEffect(PerfModeNum) = Numbers2(10); - if (DXCoil(DXCoilNum).EvapCondEffect(PerfModeNum) < 0.0 || DXCoil(DXCoilNum).EvapCondEffect(PerfModeNum) > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(PerfModeNum) = Numbers2(10); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(PerfModeNum) < 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(PerfModeNum) > 1.0) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "..." + cNumericFields2(10) + " cannot be < 0.0 or > 1.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers2(10))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) = Numbers2(11); - if (DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) < 0.0 && DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) != AutoSize) { + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) = Numbers2(11); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) != AutoSize) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "..." + cNumericFields2(11) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers2(11))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondPumpElecNomPower(PerfModeNum) = Numbers2(12); - if (DXCoil(DXCoilNum).EvapCondPumpElecNomPower(PerfModeNum) < 0.0 && - DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) != AutoSize) { + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(PerfModeNum) = Numbers2(12); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(PerfModeNum) < 0.0 && + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(PerfModeNum) != AutoSize) { ShowSevereError(state, RoutineName + PerfObjectType + "=\"" + PerfObjectName + "\", invalid"); ShowContinueError(state, "..." + cNumericFields2(12) + " cannot be less than zero."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers2(12))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedEIR(PerfModeNum) = 1.0 / DXCoil(DXCoilNum).RatedCOP(PerfModeNum); + state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(PerfModeNum) = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(PerfModeNum); // read in user specified SHR modifer curves if (!lAlphaBlanks2(9) && NumAlphas2 > 8) { - DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) = GetCurveIndex(state, Alphas2(9)); // convert curve name to number - if (DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) = GetCurveIndex(state, Alphas2(9)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields2(9) + "=\"" + Alphas2(9) + "\"."); } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFTemp(PerfModeNum), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(PerfModeNum), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields2(9)); // Field Name } } if (!lAlphaBlanks2(10) && NumAlphas2 > 9) { - DXCoil(DXCoilNum).SHRFFlow(PerfModeNum) = GetCurveIndex(state, Alphas2(10)); // convert curve name to number - if (DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(PerfModeNum) = GetCurveIndex(state, Alphas2(10)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields2(10) + "=\"" + Alphas2(10) + "\"."); } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFFlow(PerfModeNum), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(PerfModeNum), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields2(10)); // Field Name } } - if (DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) > 0 && DXCoil(DXCoilNum).SHRFFlow(PerfModeNum) > 0) { - DXCoil(DXCoilNum).UserSHRCurveExists = true; + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(PerfModeNum) > 0 && state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(PerfModeNum) > 0) { + state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists = true; } else { - DXCoil(DXCoilNum).UserSHRCurveExists = false; + state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists = false; } } else { // invalid performance object - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "... not found " + PerfObjectType + "=\"" + PerfObjectName + "\"."); ErrorsFound = true; } // end of valid performance object check @@ -1892,9 +1790,9 @@ namespace DXCoils { } // end of sufficient number of fields entered check } // End of multimode DX capacity stages loop // Warn if inputs entered for unused capacity stages - for (CapacityStageNum = (DXCoil(DXCoilNum).NumCapacityStages + 1); CapacityStageNum <= MaxCapacityStages; ++CapacityStageNum) { + for (CapacityStageNum = (state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages + 1); CapacityStageNum <= MaxCapacityStages; ++CapacityStageNum) { if ((AlphaIndex <= NumAlphas) && ((!Alphas(AlphaIndex).empty()) || (!Alphas(AlphaIndex + 1).empty()))) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\":"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError(state, format("...Capacity Stage {} not active. Therefore,{}", CapacityStageNum, cAlphaFields(AlphaIndex))); ShowContinueError(state, "... and " + cAlphaFields(AlphaIndex + 1) + " fields will be ignored."); } @@ -1911,63 +1809,63 @@ namespace DXCoils { // Get Water System tank connections // A13, \field Name of Water Storage Tank for Supply - DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(13); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(13); if (lAlphaBlanks(13)) { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromMains; } else { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; - SetupTankDemandComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromTank; + SetupTankDemandComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).EvapWaterSupplyName, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName, ErrorsFound, - DXCoil(DXCoilNum).EvapWaterSupTankID, - DXCoil(DXCoilNum).EvapWaterTankDemandARRID); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID); } // A14; \field Name of Water Storage Tank for Condensate Collection - DXCoil(DXCoilNum).CondensateCollectName = Alphas(14); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName = Alphas(14); if (lAlphaBlanks(14)) { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::Discarded; } else { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::ToTank; + SetupTankSupplyComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).CondensateCollectName, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName, ErrorsFound, - DXCoil(DXCoilNum).CondensateTankID, - DXCoil(DXCoilNum).CondensateTankSupplyARRID); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID); } // Set minimum OAT for compressor operation - DXCoil(DXCoilNum).MinOATCompressor = Numbers(5); + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = Numbers(5); if (NumNumbers < 5) - DXCoil(DXCoilNum).MinOATCompressor = minOATCompDXCooling; // input field is after min fields and won't default if field not included + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = minOATCompDXCooling; // input field is after min fields and won't default if field not included // Basin heater power as a function of temperature must be greater than or equal to 0 - DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(6); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(6); if (Numbers(6) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(6) + " must be >= 0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(6))); ErrorsFound = true; } - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(7); - if (DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(7); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { if (NumNumbers < 7) { - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; } - if (DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", freeze possible"); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", freeze possible"); ShowContinueError(state, "..." + cNumericFields(7) + " is < 2 {C}. Freezing could occur."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(7))); } } if (!lAlphaBlanks(15)) { - DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(15)); - if (DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(15)); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(15) + "=\"" + Alphas(15) + "\"."); ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); } @@ -1981,7 +1879,7 @@ namespace DXCoils { //************* Read Heat Pump (DX Heating Coil) Input ********** CurrentModuleObject = "Coil:Heating:DX:SingleSpeed"; - for (DXCoilIndex = 1; DXCoilIndex <= NumDXHeatingCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDXHeatingCoils; ++DXCoilIndex) { ++DXCoilNum; @@ -1999,66 +1897,66 @@ namespace DXCoils { cNumericFields); // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatingEmpirical; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatingEmpirical; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(5)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFTemp(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(5)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(5) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(5) + "=\"" + Alphas(5) + "\"."); } ErrorsFound = true; } else { // only legal types are Quadratic, BiQuadratic and Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(5)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).CCapFTemp(1)).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1)).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), cAlphaFields(5), Alphas(5), RatedOutdoorAirTempHeat); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), cAlphaFields(5), Alphas(5), RatedInletAirTempHeat, @@ -2067,62 +1965,62 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) == 0) { if (lAlphaBlanks(6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(6) + "=\"" + Alphas(6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); } } - DXCoil(DXCoilNum).EIRFTemp(1) = GetCurveIndex(state, Alphas(7)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFTemp(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1) = GetCurveIndex(state, Alphas(7)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1) == 0) { if (lAlphaBlanks(7)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(7) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(7) + "=\"" + Alphas(7) + "\"."); } ErrorsFound = true; } else { // only legal types are Quadratic, BiQuadratic and Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(7)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).EIRFTemp(1)).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1)).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).EIRFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), cAlphaFields(7), Alphas(7), RatedOutdoorAirTempHeat); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).EIRFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), cAlphaFields(7), Alphas(7), RatedInletAirTempHeat, @@ -2131,48 +2029,48 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).EIRFFlow(1) = GetCurveIndex(state, Alphas(8)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1) = GetCurveIndex(state, Alphas(8)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1) == 0) { if (lAlphaBlanks(8)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(8) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(8) + "=\"" + Alphas(8) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(8)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).EIRFFlow(1), cAlphaFields(8), Alphas(8), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), cAlphaFields(8), Alphas(8), 1.0); } } - DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(9)); // convert curve name to number - if (DXCoil(DXCoilNum).PLFFPLR(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(9)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) == 0) { if (lAlphaBlanks(9)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(9) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(9) + "=\"" + Alphas(9) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).PLFFPLR(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(9)); // Field Name if (!ErrorsFound) { @@ -2181,7 +2079,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -2193,51 +2091,51 @@ namespace DXCoils { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(9) + " = " + Alphas(9) + " has out of range value."); ShowContinueError(state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(9) + " = " + Alphas(9) + " has out of range value."); ShowContinueError(state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); } } } // Only required for reverse cycle heat pumps - DXCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, Alphas(10)); // convert curve name to number + state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, Alphas(10)); // convert curve name to number if (UtilityRoutines::SameString(Alphas(11), "ReverseCycle")) { - if (DXCoil(DXCoilNum).DefrostEIRFT == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT == 0) { if (lAlphaBlanks(10)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(10) + " is blank."); ShowContinueError(state, "...field is required because " + cAlphaFields(11) + " is \"ReverseCycle\"."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(10) + "=\"" + Alphas(10) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).DefrostEIRFT, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(10)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DefrostEIRFT, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT, cAlphaFields(10), Alphas(10), RatedInletAirTempHeat, @@ -2246,97 +2144,97 @@ namespace DXCoils { } } - if (UtilityRoutines::SameString(Alphas(11), "ReverseCycle")) DXCoil(DXCoilNum).DefrostStrategy = ReverseCycle; - if (UtilityRoutines::SameString(Alphas(11), "Resistive")) DXCoil(DXCoilNum).DefrostStrategy = Resistive; - if (DXCoil(DXCoilNum).DefrostStrategy == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + if (UtilityRoutines::SameString(Alphas(11), "ReverseCycle")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy = ReverseCycle; + if (UtilityRoutines::SameString(Alphas(11), "Resistive")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy = Resistive; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFields(11) + "=\"" + Alphas(11) + "\"."); ShowContinueError(state, "...valid values for this field are ReverseCycle or Resistive."); ErrorsFound = true; } - if (UtilityRoutines::SameString(Alphas(12), "Timed")) DXCoil(DXCoilNum).DefrostControl = Timed; - if (UtilityRoutines::SameString(Alphas(12), "OnDemand")) DXCoil(DXCoilNum).DefrostControl = OnDemand; - if (DXCoil(DXCoilNum).DefrostControl == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + if (UtilityRoutines::SameString(Alphas(12), "Timed")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl = Timed; + if (UtilityRoutines::SameString(Alphas(12), "OnDemand")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl = OnDemand; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFields(12) + "=\"" + Alphas(12) + "\"."); ShowContinueError(state, "...valid values for this field are Timed or OnDemand."); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedSHR(1) = 1.0; - DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); - DXCoil(DXCoilNum).RatedCOP(1) = Numbers(2); - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(3); - DXCoil(DXCoilNum).FanPowerPerEvapAirFlowRate(1) = Numbers(4); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = 1.0; + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(3); + state.dataDXCoils->DXCoil(DXCoilNum).FanPowerPerEvapAirFlowRate(1) = Numbers(4); // Set minimum OAT for heat pump compressor operation - DXCoil(DXCoilNum).MinOATCompressor = Numbers(5); + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = Numbers(5); - DXCoil(DXCoilNum).OATempCompressorOn = Numbers(6); + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOn = Numbers(6); if (lNumericBlanks(6) || lNumericBlanks(5)) { - DXCoil(DXCoilNum).OATempCompressorOnOffBlank = true; + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOnOffBlank = true; } else { - DXCoil(DXCoilNum).OATempCompressorOnOffBlank = false; + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOnOffBlank = false; } - if (DXCoil(DXCoilNum).OATempCompressorOn < DXCoil(DXCoilNum).MinOATCompressor) - DXCoil(DXCoilNum).OATempCompressorOn = DXCoil(DXCoilNum).MinOATCompressor; + if (state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOn < state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor) + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOn = state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor; // Set maximum outdoor temp for defrost to occur - DXCoil(DXCoilNum).MaxOATDefrost = Numbers(7); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATDefrost = Numbers(7); // Set crankcase heater capacity - DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(8); - if (DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(8); + if (state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(8) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(8))); ErrorsFound = true; } // Set crankcase heater cutout temperature - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(9); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(9); // Set defrost time period - DXCoil(DXCoilNum).DefrostTime = Numbers(10); - if (DXCoil(DXCoilNum).DefrostTime == 0.0 && DXCoil(DXCoilNum).DefrostControl == Timed) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", "); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime = Numbers(10); + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime == 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == Timed) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", "); ShowContinueError(state, "..." + cNumericFields(10) + " = 0.0 for defrost control = TIMED."); } // Set defrost capacity (for resistive defrost) - DXCoil(DXCoilNum).DefrostCapacity = Numbers(11); - if (DXCoil(DXCoilNum).DefrostCapacity == 0.0 && DXCoil(DXCoilNum).DefrostStrategy == Resistive) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", "); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity = Numbers(11); + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity == 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == Resistive) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", "); ShowContinueError(state, "..." + cNumericFields(11) + " = 0.0 for defrost strategy = RESISTIVE."); } // Set Region number for calculating HSPF - DXCoil(DXCoilNum).RegionNum = Numbers(12); + state.dataDXCoils->DXCoil(DXCoilNum).RegionNum = Numbers(12); if (lNumericBlanks(12)) { - DXCoil(DXCoilNum).RegionNum = 4; + state.dataDXCoils->DXCoil(DXCoilNum).RegionNum = 4; } - DXCoil(DXCoilNum).RatedEIR(1) = 1.0 / DXCoil(DXCoilNum).RatedCOP(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(1) = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1); // A13 is optional evaporator node name if (lAlphaBlanks(13)) { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; } else { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(13), + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(13), ErrorsFound, CurrentModuleObject, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, NodeType_Air, NodeConnectionType_OutsideAirReference, 1, ObjectIsNotParent); // warn if not an outdoor node, but allow - if (!CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", may be invalid"); + if (!CheckOutAirNodeNumber(state, state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", may be invalid"); ShowContinueError(state, cAlphaFields(13) + "=\"" + Alphas(13) + "\", node does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ShowContinueError(state, @@ -2346,50 +2244,50 @@ namespace DXCoils { // A14, \field Zone Name for Evaporator Placement if (!lAlphaBlanks(14) && NumAlphas > 13) { - DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(14), Zone); - if (DXCoil(DXCoilNum).SecZonePtr > 0) { - SetupZoneInternalGain(state, DXCoil(DXCoilNum).SecZonePtr, + state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(14), Zone); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr > 0) { + SetupZoneInternalGain(state, state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr, "Coil:Heating:DX:SingleSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, IntGainTypeOf_SecHeatingDXCoilSingleSpeed, - &DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate, + &state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate, nullptr, nullptr, - &DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + &state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate); + state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(14) + "=\"" + Alphas(14) + "\"."); } } - if (DXCoil(DXCoilNum).SecZonePtr > 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr > 0) { // N13, \field Secondary Coil Air Flow Rate if (!lNumericBlanks(13)) { - DXCoil(DXCoilNum).SecCoilAirFlow = Numbers(13); + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow = Numbers(13); } // N14, \field Secondary Coil Fan Flow Scaling Factor if (!lNumericBlanks(14)) { - DXCoil(DXCoilNum).SecCoilAirFlowScalingFactor = Numbers(14); + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlowScalingFactor = Numbers(14); } // N15, \field Nominal Sensible Heat Ratio of Secondary Coil if (!lNumericBlanks(15)) { - DXCoil(DXCoilNum).SecCoilRatedSHR = Numbers(15); + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilRatedSHR = Numbers(15); } else { - DXCoil(DXCoilNum).SecCoilRatedSHR = 1.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilRatedSHR = 1.0; } // A15, \field Sensible Heat Ratio Modifier Function of Temperature Curve Name if (!lAlphaBlanks(15)) { - DXCoil(DXCoilNum).SecCoilSHRFT = GetCurveIndex(state, Alphas(15)); - if (DXCoil(DXCoilNum).SecCoilSHRFT == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHRFT = GetCurveIndex(state, Alphas(15)); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHRFT == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(15) + "=\"" + Alphas(15) + "\"."); } } // A16; \field Sensible Heat Ratio Function of Flow Fraction Curve Name if (!lAlphaBlanks(16)) { - DXCoil(DXCoilNum).SecCoilSHRFF = GetCurveIndex(state, Alphas(16)); - if (DXCoil(DXCoilNum).SecCoilSHRFF == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHRFF = GetCurveIndex(state, Alphas(16)); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHRFF == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(16) + "=\"" + Alphas(16) + "\"."); } } @@ -2402,7 +2300,7 @@ namespace DXCoils { } CurrentModuleObject = "Coil:Cooling:DX:TwoSpeed"; - for (DXCoilIndex = 1; DXCoilIndex <= NumDXMulSpeedCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDXMulSpeedCoils; ++DXCoilIndex) { ++DXCoilNum; @@ -2420,73 +2318,73 @@ namespace DXCoils { cNumericFields); // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils - HeatReclaimDXCoil(DXCoilNum).Name = DXCoil(DXCoilNum).Name; + HeatReclaimDXCoil(DXCoilNum).Name = state.dataDXCoils->DXCoil(DXCoilNum).Name; HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingTwoSpeed; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingTwoSpeed; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); - DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); - DXCoil(DXCoilNum).RatedCOP(1) = Numbers(3); - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(4); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) = Numbers(3); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(4); if (!lNumericBlanks(5)) { - DXCoil(DXCoilNum).InternalStaticPressureDrop = Numbers(5); - DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject = true; + state.dataDXCoils->DXCoil(DXCoilNum).InternalStaticPressureDrop = Numbers(5); + state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject = true; } else { - DXCoil(DXCoilNum).InternalStaticPressureDrop = -999.0; - DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject = false; + state.dataDXCoils->DXCoil(DXCoilNum).InternalStaticPressureDrop = -999.0; + state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject = false; } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(5)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFTemp(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(5)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(5) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(5) + "=\"" + Alphas(5) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(5)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), cAlphaFields(5), Alphas(5), RatedInletWetBulbTemp, @@ -2494,54 +2392,54 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) == 0) { if (lAlphaBlanks(6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(6) + "=\"" + Alphas(6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); } } - DXCoil(DXCoilNum).EIRFTemp(1) = GetCurveIndex(state, Alphas(7)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFTemp(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1) = GetCurveIndex(state, Alphas(7)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1) == 0) { if (lAlphaBlanks(7)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(7) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(7) + "=\"" + Alphas(7) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(7)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).EIRFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), cAlphaFields(7), Alphas(7), RatedInletWetBulbTemp, @@ -2549,48 +2447,48 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).EIRFFlow(1) = GetCurveIndex(state, Alphas(8)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1) = GetCurveIndex(state, Alphas(8)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1) == 0) { if (lAlphaBlanks(8)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(8) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(8) + "=\"" + Alphas(8) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(8)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).EIRFFlow(1), cAlphaFields(8), Alphas(8), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), cAlphaFields(8), Alphas(8), 1.0); } } - DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(9)); // convert curve name to number - if (DXCoil(DXCoilNum).PLFFPLR(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(9)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) == 0) { if (lAlphaBlanks(9)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(9) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(9) + "=\"" + Alphas(9) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).PLFFPLR(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(9)); // Field Name if (!ErrorsFound) { @@ -2599,7 +2497,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -2611,60 +2509,60 @@ namespace DXCoils { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(9) + " = " + Alphas(9) + " has out of range value."); ShowContinueError(state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(9) + " = " + Alphas(9) + " has out of range value."); ShowContinueError(state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); } } } - DXCoil(DXCoilNum).RatedEIR(1) = 1.0 / DXCoil(DXCoilNum).RatedCOP(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(1) = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1); - DXCoil(DXCoilNum).RatedTotCap2 = Numbers(6); - DXCoil(DXCoilNum).RatedSHR2 = Numbers(7); - DXCoil(DXCoilNum).RatedCOP2 = Numbers(8); - DXCoil(DXCoilNum).RatedAirVolFlowRate2 = Numbers(9); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 = Numbers(6); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR2 = Numbers(7); + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP2 = Numbers(8); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2 = Numbers(9); if (lNumericBlanks(10)) { - DXCoil(DXCoilNum).MinOATCompressor = -25.0; + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = -25.0; } else { - DXCoil(DXCoilNum).MinOATCompressor = Numbers(10); + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = Numbers(10); } - DXCoil(DXCoilNum).CCapFTemp2 = GetCurveIndex(state, Alphas(10)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFTemp2 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2 = GetCurveIndex(state, Alphas(10)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2 == 0) { if (lAlphaBlanks(10)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(10) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(10) + "=\"" + Alphas(10) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFTemp2, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2, // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(10)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp2, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2, cAlphaFields(10), Alphas(10), RatedInletWetBulbTemp, @@ -2672,29 +2570,29 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).EIRFTemp2 = GetCurveIndex(state, Alphas(11)); // convert curve name to number - if (DXCoil(DXCoilNum).EIRFTemp2 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp2 = GetCurveIndex(state, Alphas(11)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp2 == 0) { if (lAlphaBlanks(11)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(11) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(11) + "=\"" + Alphas(11) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).EIRFTemp2, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp2, // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(11)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).EIRFTemp2, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp2, cAlphaFields(11), Alphas(11), RatedInletWetBulbTemp, @@ -2704,18 +2602,18 @@ namespace DXCoils { // outdoor condenser node if (lAlphaBlanks(12)) { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; } else { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(12), + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(12), ErrorsFound, CurrentModuleObject, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, NodeType_Air, NodeConnectionType_OutsideAirReference, 1, ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", may be invalid"); + if (!CheckOutAirNodeNumber(state, state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", may be invalid"); ShowContinueError(state, cAlphaFields(12) + "=\"" + Alphas(12) + "\", node does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ShowContinueError(state, @@ -2724,209 +2622,209 @@ namespace DXCoils { } if ((UtilityRoutines::SameString(Alphas(13), "AirCooled")) || lAlphaBlanks(13)) { - DXCoil(DXCoilNum).CondenserType(1) = AirCooled; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = AirCooled; } else if (UtilityRoutines::SameString(Alphas(13), "EvaporativelyCooled")) { - DXCoil(DXCoilNum).CondenserType(1) = EvapCooled; - DXCoil(DXCoilNum).ReportEvapCondVars = true; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = EvapCooled; + state.dataDXCoils->DXCoil(DXCoilNum).ReportEvapCondVars = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(13) + "=\"" + Alphas(13) + "\":"); ShowContinueError(state, "...must be AirCooled or EvaporativelyCooled."); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondEffect(1) = Numbers(11); - if (DXCoil(DXCoilNum).EvapCondEffect(1) < 0.0 || DXCoil(DXCoilNum).EvapCondEffect(1) > 1.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(1) = Numbers(11); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(1) < 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(1) > 1.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(11) + " cannot be < 0.0 or > 1.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(11))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondAirFlow(1) = Numbers(12); - if (DXCoil(DXCoilNum).EvapCondAirFlow(1) < 0.0 && DXCoil(DXCoilNum).EvapCondAirFlow(1) != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(1) = Numbers(12); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(1) < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(1) != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(12) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(12))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) = Numbers(13); - if (DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) < 0.0 && DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) = Numbers(13); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(1) != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(13) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(13))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondEffect2 = Numbers(14); - if (DXCoil(DXCoilNum).EvapCondEffect2 < 0.0 || DXCoil(DXCoilNum).EvapCondEffect2 > 1.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect2 = Numbers(14); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect2 < 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect2 > 1.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(14) + " cannot be cannot be < 0.0 or > 1.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(14))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondAirFlow2 = Numbers(15); - if (DXCoil(DXCoilNum).EvapCondAirFlow2 < 0.0 && DXCoil(DXCoilNum).EvapCondAirFlow2 != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2 = Numbers(15); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2 < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2 != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(15) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(15))); ErrorsFound = true; } - DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 = Numbers(16); - if (DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 < 0.0 && DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 = Numbers(16); + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(16) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(16))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedEIR2 = 1.0 / DXCoil(DXCoilNum).RatedCOP2; + state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR2 = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP2; // Get Water System tank connections // A14, \field Name of Water Storage Tank for Supply - DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(14); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(14); if (lAlphaBlanks(14)) { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromMains; } else { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; - SetupTankDemandComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromTank; + SetupTankDemandComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).EvapWaterSupplyName, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName, ErrorsFound, - DXCoil(DXCoilNum).EvapWaterSupTankID, - DXCoil(DXCoilNum).EvapWaterTankDemandARRID); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID); } // A15; \field Name of Water Storage Tank for Condensate Collection - DXCoil(DXCoilNum).CondensateCollectName = Alphas(15); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName = Alphas(15); if (lAlphaBlanks(15)) { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::Discarded; } else { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::ToTank; + SetupTankSupplyComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).CondensateCollectName, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName, ErrorsFound, - DXCoil(DXCoilNum).CondensateTankID, - DXCoil(DXCoilNum).CondensateTankSupplyARRID); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID); } // Basin heater power as a function of temperature must be greater than or equal to 0 - DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(17); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(17); if (Numbers(17) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(17) + " must be >= 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(17))); ErrorsFound = true; } - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(18); - if (DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(18); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { if (NumNumbers < 18) { - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; } - if (DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", freeze possible"); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", freeze possible"); ShowContinueError(state, "..." + cNumericFields(18) + " is < 2 {C}. Freezing could occur."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(18))); } } if (!lAlphaBlanks(16)) { - DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(16)); - if (DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(16)); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(16) + "=\"" + Alphas(16) + "\"."); ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); } } if (!lAlphaBlanks(17) && NumAlphas > 16) { - DXCoil(DXCoilNum).SHRFTemp(1) = GetCurveIndex(state, Alphas(17)); // convert curve name to number + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1) = GetCurveIndex(state, Alphas(17)); // convert curve name to number // DXCoil(DXCoilNum)%SHRFTemp2 = DXCoil(DXCoilNum)%SHRFTemp(1) - if (DXCoil(DXCoilNum).SHRFTemp(1) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(17) + "=\"" + Alphas(17) + "\"."); } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(17)); // Field Name } } if (!lAlphaBlanks(18) && NumAlphas > 17) { - DXCoil(DXCoilNum).SHRFFlow(1) = GetCurveIndex(state, Alphas(18)); // convert curve name to number + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(1) = GetCurveIndex(state, Alphas(18)); // convert curve name to number // DXCoil(DXCoilNum)%SHRFFlow2 = DXCoil(DXCoilNum)%SHRFFlow(1) - if (DXCoil(DXCoilNum).SHRFFlow(1) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(1) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(18) + "=\"" + Alphas(18) + "\"."); } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(18)); // Field Name } } if (!lAlphaBlanks(19) && NumAlphas > 18) { - DXCoil(DXCoilNum).SHRFTemp2 = GetCurveIndex(state, Alphas(19)); // convert curve name to number - if (DXCoil(DXCoilNum).SHRFTemp2 == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp2 = GetCurveIndex(state, Alphas(19)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp2 == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(19) + "=\"" + Alphas(19) + "\"."); } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFTemp2, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp2, // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(19)); // Field Name } } if (!lAlphaBlanks(20) && NumAlphas > 19) { - DXCoil(DXCoilNum).SHRFFlow2 = GetCurveIndex(state, Alphas(20)); // convert curve name to number - if (DXCoil(DXCoilNum).SHRFTemp2 == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow2 = GetCurveIndex(state, Alphas(20)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp2 == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(20) + "=\"" + Alphas(20) + "\"."); } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).SHRFFlow2, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow2, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(20)); // Field Name } } - if (DXCoil(DXCoilNum).SHRFTemp(1) > 0 && DXCoil(DXCoilNum).SHRFFlow(1) > 0 && DXCoil(DXCoilNum).SHRFTemp2 > 0 && - DXCoil(DXCoilNum).SHRFFlow2 > 0) { - DXCoil(DXCoilNum).UserSHRCurveExists = true; + if (state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(1) > 0 && state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(1) > 0 && state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp2 > 0 && + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow2 > 0) { + state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists = true; } else { - DXCoil(DXCoilNum).UserSHRCurveExists = false; + state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists = false; } // A21; \field Zone Name for Condenser Placement if (!lAlphaBlanks(21) && NumAlphas > 20) { - DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(21), Zone); - if (DXCoil(DXCoilNum).SecZonePtr > 0) { - SetupZoneInternalGain(state, DXCoil(DXCoilNum).SecZonePtr, + state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(21), Zone); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr > 0) { + SetupZoneInternalGain(state, state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr, "Coil:Cooling:DX:TwoSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, IntGainTypeOf_SecCoolingDXCoilTwoSpeed, - &DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + &state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); + state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(21) + "=\"" + Alphas(21) + "\"."); } } @@ -2938,7 +2836,7 @@ namespace DXCoils { // Loop over the Pumped DX Water Heater Coils and get & load the data CurrentModuleObject = cAllCoilTypes(CoilDX_HeatPumpWaterHeaterPumped); - for (DXHPWaterHeaterCoilNum = 1; DXHPWaterHeaterCoilNum <= NumDXHeatPumpWaterHeaterPumpedCoils; ++DXHPWaterHeaterCoilNum) { + for (DXHPWaterHeaterCoilNum = 1; DXHPWaterHeaterCoilNum <= state.dataDXCoils->NumDXHeatPumpWaterHeaterPumpedCoils; ++DXHPWaterHeaterCoilNum) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -2956,98 +2854,98 @@ namespace DXCoils { ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatPumpWaterHeaterPumped; - DXCoil(DXCoilNum).SchedPtr = 0; // heat pump water heater DX coil has no schedule + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatPumpWaterHeaterPumped; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = 0; // heat pump water heater DX coil has no schedule // Store the HPWH DX coil heating capacity in RatedTotCap2. After backing off pump and fan heat, // move to RatedTotCap() for use by DX coil - DXCoil(DXCoilNum).RatedTotCap2 = Numbers(1); - if (DXCoil(DXCoilNum).RatedTotCap2 <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 = Numbers(1); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0, entered value=[{:.2T}].", cNumericFields(1), Numbers(1))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedCOP(1) = Numbers(2); - if (DXCoil(DXCoilNum).RatedCOP(1) <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) = Numbers(2); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0, entered value=[{:.2T}].", cNumericFields(2), Numbers(2))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedSHR(1) = Numbers(3); - if (DXCoil(DXCoilNum).RatedSHR(1) <= 0.0 || DXCoil(DXCoilNum).RatedSHR(1) > 1.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = Numbers(3); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) <= 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) > 1.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0 and <= 1. entered value=[{:.3T}].", cNumericFields(3), Numbers(3))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedInletDBTemp = Numbers(4); - if (DXCoil(DXCoilNum).RatedInletDBTemp <= 5.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp = Numbers(4); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp <= 5.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 5 {{C}}. entered value=[{:.1T}].", cNumericFields(4), Numbers(4))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedInletWBTemp = Numbers(5); - if (DXCoil(DXCoilNum).RatedInletWBTemp <= 5.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp = Numbers(5); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp <= 5.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 5 {{C}}. entered value=[{:.1T}].", cNumericFields(5), Numbers(5))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedInletWaterTemp = Numbers(6); - if (DXCoil(DXCoilNum).RatedInletWaterTemp <= 25.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWaterTemp = Numbers(6); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWaterTemp <= 25.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 25 {{C}}. entered value=[{:.1T}].", cNumericFields(6), Numbers(6))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(7); - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(1) != DataGlobalConstants::AutoCalculate) { - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(1) <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(7); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) != DataGlobalConstants::AutoCalculate) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0. entered value=[{:.3T}].", cNumericFields(7), Numbers(7))); ErrorsFound = true; } } - DXCoil(DXCoilNum).RatedHPWHCondWaterFlow = Numbers(8); + state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow = Numbers(8); // move to init - if (DXCoil(DXCoilNum).RatedHPWHCondWaterFlow != DataGlobalConstants::AutoCalculate) { - if (DXCoil(DXCoilNum).RatedHPWHCondWaterFlow <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow != DataGlobalConstants::AutoCalculate) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0 entered value=[{:.3T}].", cNumericFields(8), Numbers(8))); ErrorsFound = true; } // check the range of flow rate to be >= 1 gpm/ton and <= 5 gpm/ton - if (DXCoil(DXCoilNum).RatedHPWHCondWaterFlow / DXCoil(DXCoilNum).RatedTotCap2 < 1.79405e-8 || - DXCoil(DXCoilNum).RatedHPWHCondWaterFlow / DXCoil(DXCoilNum).RatedTotCap2 > 8.97024e-8) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", outside range"); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 < 1.79405e-8 || + state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 > 8.97024e-8) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", outside range"); ShowContinueError(state, "..." + cNumericFields(8) + " per watt of " + cNumericFields(1) + " is outside the recommended range of >= 1.79405E-8 m3/s/W (0.083 gpm/MBH) and <= 8.97024E-8 m3/s/W (0.417 gpm/MBH)."); ShowContinueError(state, format("...Entered Flow rate per watt = [{:.10T}].", - (DXCoil(DXCoilNum).RatedHPWHCondWaterFlow / DXCoil(DXCoilNum).RatedTotCap2))); + (state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2))); } } if (UtilityRoutines::SameString(Alphas(2), "Yes") || UtilityRoutines::SameString(Alphas(2), "No")) { // initialized to TRUE on allocate - if (UtilityRoutines::SameString(Alphas(2), "No")) DXCoil(DXCoilNum).FanPowerIncludedInCOP = false; + if (UtilityRoutines::SameString(Alphas(2), "No")) state.dataDXCoils->DXCoil(DXCoilNum).FanPowerIncludedInCOP = false; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(2) + ". Entered choice = " + Alphas(2)); ShowContinueError(state, "Valid choices are Yes or No."); ErrorsFound = true; @@ -3055,9 +2953,9 @@ namespace DXCoils { if (UtilityRoutines::SameString(Alphas(3), "Yes") || UtilityRoutines::SameString(Alphas(3), "No")) { // initialized to FALSE on allocate - if (UtilityRoutines::SameString(Alphas(3), "Yes")) DXCoil(DXCoilNum).CondPumpPowerInCOP = true; + if (UtilityRoutines::SameString(Alphas(3), "Yes")) state.dataDXCoils->DXCoil(DXCoilNum).CondPumpPowerInCOP = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(3) + ". Entered choice = " + Alphas(3)); ShowContinueError(state, "Valid choices are Yes or No."); ErrorsFound = true; @@ -3065,111 +2963,111 @@ namespace DXCoils { if (UtilityRoutines::SameString(Alphas(4), "Yes") || UtilityRoutines::SameString(Alphas(4), "No")) { // initialized to FALSE on allocate - if (UtilityRoutines::SameString(Alphas(4), "Yes")) DXCoil(DXCoilNum).CondPumpHeatInCapacity = true; + if (UtilityRoutines::SameString(Alphas(4), "Yes")) state.dataDXCoils->DXCoil(DXCoilNum).CondPumpHeatInCapacity = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(4) + ". Entered choice = " + Alphas(4)); ShowContinueError(state, "Valid choices are Yes or No."); ErrorsFound = true; } - DXCoil(DXCoilNum).HPWHCondPumpElecNomPower = Numbers(9); - if (DXCoil(DXCoilNum).HPWHCondPumpElecNomPower < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HPWHCondPumpElecNomPower = Numbers(9); + if (state.dataDXCoils->DXCoil(DXCoilNum).HPWHCondPumpElecNomPower < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0.0 entered value=[{:.3T}].", cNumericFields(9), Numbers(9))); ErrorsFound = true; } - DXCoil(DXCoilNum).HPWHCondPumpFracToWater = Numbers(10); - if (DXCoil(DXCoilNum).HPWHCondPumpFracToWater <= 0.0 || DXCoil(DXCoilNum).HPWHCondPumpFracToWater > 1.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HPWHCondPumpFracToWater = Numbers(10); + if (state.dataDXCoils->DXCoil(DXCoilNum).HPWHCondPumpFracToWater <= 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).HPWHCondPumpFracToWater > 1.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0 and <= 1. entered value=[{:.3T}].", cNumericFields(10), Numbers(10))); ErrorsFound = true; } // Air nodes - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(5), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(6), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(5), Alphas(6), "Air Nodes"); // Check if the air inlet node is OA node, to justify whether the coil is placed in zone or not - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).AirInNode); + state.dataDXCoils->DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, state.dataDXCoils->DXCoil(DXCoilNum).AirInNode); // Water nodes - DXCoil(DXCoilNum).WaterInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).WaterInNode = GetOnlySingleNode(state, Alphas(7), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent); - DXCoil(DXCoilNum).WaterOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).WaterOutNode = GetOnlySingleNode(state, Alphas(8), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Water, NodeConnectionType_Outlet, 2, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(7), Alphas(8), "Water Nodes"); - DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(11); - if (DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(11); + if (state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0.0 entered value=[{:.1T}].", cNumericFields(11), Numbers(11))); ErrorsFound = true; } - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(12); - if (DXCoil(DXCoilNum).MaxOATCrankcaseHeater < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(12); + if (state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0 {{C}}. entered value=[{:.1T}].", cNumericFields(12), Numbers(12))); ErrorsFound = true; } if (UtilityRoutines::SameString(Alphas(9), "DryBulbTemperature")) { - DXCoil(DXCoilNum).InletAirTemperatureType = DryBulbIndicator; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemperatureType = DryBulbIndicator; } else if (UtilityRoutines::SameString(Alphas(9), "WetBulbTemperature")) { - DXCoil(DXCoilNum).InletAirTemperatureType = WetBulbIndicator; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemperatureType = WetBulbIndicator; } else { // wrong temperature type selection - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(9) + " must be DryBulbTemperature or WetBulbTemperature."); ShowContinueError(state, "...entered value=\"" + Alphas(9) + "\"."); ErrorsFound = true; } // set rated inlet air temperature for curve object verification - if (DXCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { - InletAirTemp = DXCoil(DXCoilNum).RatedInletWBTemp; + if (state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { + InletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp; } else { - InletAirTemp = DXCoil(DXCoilNum).RatedInletDBTemp; + InletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp; } // set rated water temperature for curve object verification - InletWaterTemp = DXCoil(DXCoilNum).RatedInletWaterTemp; + InletWaterTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWaterTemp; if (!lAlphaBlanks(10)) { - DXCoil(DXCoilNum).HCapFTemp = GetCurveIndex(state, Alphas(10)); - if (DXCoil(DXCoilNum).HCapFTemp == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp = GetCurveIndex(state, Alphas(10)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(10) + "=\"" + Alphas(10) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCapFTemp, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(10)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).HCapFTemp).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCapFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp, cAlphaFields(10), Alphas(10), InletAirTemp); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCapFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp, cAlphaFields(10), Alphas(10), InletAirTemp, @@ -3180,24 +3078,24 @@ namespace DXCoils { } if (!lAlphaBlanks(11)) { - DXCoil(DXCoilNum).HCapFAirFlow = GetCurveIndex(state, Alphas(11)); - if (DXCoil(DXCoilNum).HCapFAirFlow == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow = GetCurveIndex(state, Alphas(11)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(11) + "=\"" + Alphas(11) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCapFAirFlow, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(11)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCapFAirFlow, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow, cAlphaFields(11), Alphas(11), 1.0); @@ -3206,24 +3104,24 @@ namespace DXCoils { } if (!lAlphaBlanks(12)) { - DXCoil(DXCoilNum).HCapFWaterFlow = GetCurveIndex(state, Alphas(12)); - if (DXCoil(DXCoilNum).HCapFWaterFlow == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCapFWaterFlow = GetCurveIndex(state, Alphas(12)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCapFWaterFlow == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(12) + "=\"" + Alphas(12) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCapFWaterFlow, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCapFWaterFlow, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(12)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCapFWaterFlow, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCapFWaterFlow, cAlphaFields(12), Alphas(12), 1.0); @@ -3232,32 +3130,32 @@ namespace DXCoils { } if (!lAlphaBlanks(13)) { - DXCoil(DXCoilNum).HCOPFTemp = GetCurveIndex(state, Alphas(13)); - if (DXCoil(DXCoilNum).HCOPFTemp == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp = GetCurveIndex(state, Alphas(13)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(13) + "=\"" + Alphas(13) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCOPFTemp, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(13)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).HCOPFTemp).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCOPFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp, cAlphaFields(13), Alphas(13), InletAirTemp); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCOPFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp, cAlphaFields(13), Alphas(13), InletAirTemp, @@ -3268,24 +3166,24 @@ namespace DXCoils { } if (!lAlphaBlanks(14)) { - DXCoil(DXCoilNum).HCOPFAirFlow = GetCurveIndex(state, Alphas(14)); - if (DXCoil(DXCoilNum).HCOPFAirFlow == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow = GetCurveIndex(state, Alphas(14)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(14) + "=\"" + Alphas(14) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCOPFAirFlow, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(14)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCOPFAirFlow, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow, cAlphaFields(14), Alphas(14), 1.0); @@ -3294,24 +3192,24 @@ namespace DXCoils { } if (!lAlphaBlanks(15)) { - DXCoil(DXCoilNum).HCOPFWaterFlow = GetCurveIndex(state, Alphas(15)); - if (DXCoil(DXCoilNum).HCOPFWaterFlow == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFWaterFlow = GetCurveIndex(state, Alphas(15)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCOPFWaterFlow == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(15) + "=\"" + Alphas(15) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCOPFWaterFlow, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCOPFWaterFlow, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(15)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCOPFWaterFlow, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFWaterFlow, cAlphaFields(15), Alphas(15), 1.0); @@ -3320,18 +3218,18 @@ namespace DXCoils { } if (!lAlphaBlanks(16)) { - DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(16)); - if (DXCoil(DXCoilNum).PLFFPLR(1) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(16)); + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(16) + "=\"" + Alphas(16) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).PLFFPLR(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(16)); // Field Name if (!ErrorsFound) { @@ -3340,7 +3238,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -3352,31 +3250,31 @@ namespace DXCoils { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(16) + " = " + Alphas(16) + " has out of range value."); ShowContinueError( state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(16) + " = " + Alphas(16) + " has out of range value."); ShowContinueError( state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); } } } } // assume compressor resides at the inlet to the DX Coil - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = DXCoil(DXCoilNum).AirInNode; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = state.dataDXCoils->DXCoil(DXCoilNum).AirInNode; // set condenser type as HPWH - DXCoil(DXCoilNum).CondenserType(1) = WaterHeater; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = WaterHeater; } // end of the DX water heater coil loop @@ -3385,7 +3283,7 @@ namespace DXCoils { } // Loop over the Wrapped DX Water Heater Coils and get & load the data CurrentModuleObject = cAllCoilTypes(CoilDX_HeatPumpWaterHeaterWrapped); - for (DXHPWaterHeaterCoilNum = 1; DXHPWaterHeaterCoilNum <= NumDXHeatPumpWaterHeaterWrappedCoils; ++DXHPWaterHeaterCoilNum) { + for (DXHPWaterHeaterCoilNum = 1; DXHPWaterHeaterCoilNum <= state.dataDXCoils->NumDXHeatPumpWaterHeaterWrappedCoils; ++DXHPWaterHeaterCoilNum) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -3403,67 +3301,67 @@ namespace DXCoils { ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatPumpWaterHeaterWrapped; - DXCoil(DXCoilNum).SchedPtr = 0; // heat pump water heater DX coil has no schedule + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatPumpWaterHeaterWrapped; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = 0; // heat pump water heater DX coil has no schedule // Store the HPWH DX coil heating capacity in RatedTotCap2. After backing off pump and fan heat, // move to RatedTotCap() for use by DX coil - DXCoil(DXCoilNum).RatedTotCap2 = Numbers(1); - if (DXCoil(DXCoilNum).RatedTotCap2 <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 = Numbers(1); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0, entered value=[{:.2T}].", cNumericFields(1), Numbers(1))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedCOP(1) = Numbers(2); - if (DXCoil(DXCoilNum).RatedCOP(1) <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) = Numbers(2); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0, entered value=[{:.2T}].", cNumericFields(2), Numbers(2))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedSHR(1) = Numbers(3); - if (DXCoil(DXCoilNum).RatedSHR(1) <= 0.0 || DXCoil(DXCoilNum).RatedSHR(1) > 1.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = Numbers(3); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) <= 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) > 1.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0 and <= 1. entered value=[{:.3T}].", cNumericFields(3), Numbers(3))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedInletDBTemp = Numbers(4); - if (DXCoil(DXCoilNum).RatedInletDBTemp <= 5.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp = Numbers(4); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp <= 5.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 5 {{C}}. entered value=[{:.1T}].", cNumericFields(4), Numbers(4))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedInletWBTemp = Numbers(5); - if (DXCoil(DXCoilNum).RatedInletWBTemp <= 5.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp = Numbers(5); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp <= 5.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 5 {{C}}. entered value=[{:.1T}].", cNumericFields(5), Numbers(5))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedInletWaterTemp = Numbers(6); - if (DXCoil(DXCoilNum).RatedInletWaterTemp <= 25.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWaterTemp = Numbers(6); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWaterTemp <= 25.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 25 {{C}}. entered value=[{:.1T}].", cNumericFields(6), Numbers(6))); ErrorsFound = true; } - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(7); - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(1) != DataGlobalConstants::AutoCalculate) { - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(1) <= 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(7); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) != DataGlobalConstants::AutoCalculate) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) <= 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be > 0.0. entered value=[{:.3T}].", cNumericFields(7), Numbers(7))); ErrorsFound = true; } @@ -3471,32 +3369,32 @@ namespace DXCoils { if (UtilityRoutines::SameString(Alphas(2), "Yes") || UtilityRoutines::SameString(Alphas(2), "No")) { // initialized to TRUE on allocate - if (UtilityRoutines::SameString(Alphas(2), "No")) DXCoil(DXCoilNum).FanPowerIncludedInCOP = false; + if (UtilityRoutines::SameString(Alphas(2), "No")) state.dataDXCoils->DXCoil(DXCoilNum).FanPowerIncludedInCOP = false; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(2) + ". Entered choice = " + Alphas(2)); ShowContinueError(state, "Valid choices are Yes or No."); ErrorsFound = true; } // Air nodes - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); // Check if the air inlet node is OA node, to justify whether the coil is placed in zone or not - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).AirInNode); + state.dataDXCoils->DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, state.dataDXCoils->DXCoil(DXCoilNum).AirInNode); - std::string const DummyCondenserInletName("DUMMY CONDENSER INLET " + DXCoil(DXCoilNum).Name); - std::string const DummyCondenserOutletName("DUMMY CONDENSER OUTLET " + DXCoil(DXCoilNum).Name); - DXCoil(DXCoilNum).WaterInNode = GetOnlySingleNode(state, + std::string const DummyCondenserInletName("DUMMY CONDENSER INLET " + state.dataDXCoils->DXCoil(DXCoilNum).Name); + std::string const DummyCondenserOutletName("DUMMY CONDENSER OUTLET " + state.dataDXCoils->DXCoil(DXCoilNum).Name); + state.dataDXCoils->DXCoil(DXCoilNum).WaterInNode = GetOnlySingleNode(state, DummyCondenserInletName, ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent); - DXCoil(DXCoilNum).WaterOutNode = GetOnlySingleNode(state, DummyCondenserOutletName, + state.dataDXCoils->DXCoil(DXCoilNum).WaterOutNode = GetOnlySingleNode(state, DummyCondenserOutletName, ErrorsFound, CurrentModuleObject, Alphas(1), @@ -3507,68 +3405,68 @@ namespace DXCoils { TestCompSet(state, CurrentModuleObject, Alphas(1), DummyCondenserInletName, DummyCondenserOutletName, "Water Nodes"); - DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(8); - if (DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(8); + if (state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0.0 entered value=[{:.1T}].", cNumericFields(8), Numbers(8))); ErrorsFound = true; } - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(9); - if (DXCoil(DXCoilNum).MaxOATCrankcaseHeater < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(9); + if (state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0 {{C}}. entered value=[{:.1T}].", cNumericFields(9), Numbers(9))); ErrorsFound = true; } if (UtilityRoutines::SameString(Alphas(5), "DryBulbTemperature")) { - DXCoil(DXCoilNum).InletAirTemperatureType = DryBulbIndicator; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemperatureType = DryBulbIndicator; } else if (UtilityRoutines::SameString(Alphas(5), "WetBulbTemperature")) { - DXCoil(DXCoilNum).InletAirTemperatureType = WetBulbIndicator; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemperatureType = WetBulbIndicator; } else { // wrong temperature type selection - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(5) + " must be DryBulbTemperature or WetBulbTemperature."); ShowContinueError(state, "...entered value=\"" + Alphas(5) + "\"."); ErrorsFound = true; } // set rated inlet air temperature for curve object verification - if (DXCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { - InletAirTemp = DXCoil(DXCoilNum).RatedInletWBTemp; + if (state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { + InletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp; } else { - InletAirTemp = DXCoil(DXCoilNum).RatedInletDBTemp; + InletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp; } // set rated water temperature for curve object verification - InletWaterTemp = DXCoil(DXCoilNum).RatedInletWaterTemp; + InletWaterTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWaterTemp; if (!lAlphaBlanks(6)) { - DXCoil(DXCoilNum).HCapFTemp = GetCurveIndex(state, Alphas(6)); - if (DXCoil(DXCoilNum).HCapFTemp == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp = GetCurveIndex(state, Alphas(6)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(6) + "=\"" + Alphas(6) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCapFTemp, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(6)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).HCapFTemp).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCapFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp, cAlphaFields(6), Alphas(6), InletAirTemp); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCapFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCapFTemp, cAlphaFields(6), Alphas(6), InletAirTemp, @@ -3579,24 +3477,24 @@ namespace DXCoils { } if (!lAlphaBlanks(7)) { - DXCoil(DXCoilNum).HCapFAirFlow = GetCurveIndex(state, Alphas(7)); - if (DXCoil(DXCoilNum).HCapFAirFlow == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow = GetCurveIndex(state, Alphas(7)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(7) + "=\"" + Alphas(7) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCapFAirFlow, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(7)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCapFAirFlow, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCapFAirFlow, cAlphaFields(7), Alphas(7), 1.0); @@ -3605,32 +3503,32 @@ namespace DXCoils { } if (!lAlphaBlanks(8)) { - DXCoil(DXCoilNum).HCOPFTemp = GetCurveIndex(state, Alphas(8)); - if (DXCoil(DXCoilNum).HCOPFTemp == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp = GetCurveIndex(state, Alphas(8)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(8) + "=\"" + Alphas(8) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCOPFTemp, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(8)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).HCOPFTemp).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCOPFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp, cAlphaFields(8), Alphas(8), InletAirTemp); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCOPFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFTemp, cAlphaFields(8), Alphas(8), InletAirTemp, @@ -3641,24 +3539,24 @@ namespace DXCoils { } if (!lAlphaBlanks(9)) { - DXCoil(DXCoilNum).HCOPFAirFlow = GetCurveIndex(state, Alphas(9)); - if (DXCoil(DXCoilNum).HCOPFAirFlow == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow = GetCurveIndex(state, Alphas(9)); + if (state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(9) + "=\"" + Alphas(9) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).HCOPFAirFlow, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow, // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(9)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HCOPFAirFlow, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HCOPFAirFlow, cAlphaFields(9), Alphas(9), 1.0); @@ -3667,18 +3565,18 @@ namespace DXCoils { } if (!lAlphaBlanks(10)) { - DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(10)); - if (DXCoil(DXCoilNum).PLFFPLR(1) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) = GetCurveIndex(state, Alphas(10)); + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(10) + "=\"" + Alphas(10) + "\"."); ErrorsFound = true; } else { // Verify Curve Object, only legal types are Cubic or Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).PLFFPLR(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(10)); // Field Name if (!ErrorsFound) { @@ -3687,7 +3585,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -3699,31 +3597,31 @@ namespace DXCoils { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(10) + " = " + Alphas(10) + " has out of range value."); ShowContinueError( state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(10) + " = " + Alphas(10) + " has out of range value."); ShowContinueError( state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, _, 1.0); } } } } // assume compressor resides at the inlet to the DX Coil - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = DXCoil(DXCoilNum).AirInNode; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = state.dataDXCoils->DXCoil(DXCoilNum).AirInNode; // set condenser type as HPWH - DXCoil(DXCoilNum).CondenserType(1) = WaterHeater; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = WaterHeater; } // end of the DX water heater wrapped coil loop @@ -3733,7 +3631,7 @@ namespace DXCoils { // DX Multispeed cooling coil CurrentModuleObject = "Coil:Cooling:DX:MultiSpeed"; - for (DXCoilIndex = 1; DXCoilIndex <= NumDXMulSpeedCoolCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDXMulSpeedCoolCoils; ++DXCoilIndex) { ++DXCoilNum; @@ -3751,52 +3649,52 @@ namespace DXCoils { cNumericFields); // allocate single performance mode for numeric field strings used for sizing routine (all fields are in this object) - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils - HeatReclaimDXCoil(DXCoilNum).Name = DXCoil(DXCoilNum).Name; + HeatReclaimDXCoil(DXCoilNum).Name = state.dataDXCoils->DXCoil(DXCoilNum).Name; HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedCooling; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedCooling; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); // outdoor condenser node if (lAlphaBlanks(5)) { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = 0; } else { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(5), + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = GetOnlySingleNode(state, Alphas(5), ErrorsFound, CurrentModuleObject, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, NodeType_Air, NodeConnectionType_OutsideAirReference, 1, ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", may be invalid"); + if (!CheckOutAirNodeNumber(state, state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1))) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", may be invalid"); ShowContinueError(state, cAlphaFields(5) + "=\"" + Alphas(5) + "\", node does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ShowContinueError(state, @@ -3805,12 +3703,12 @@ namespace DXCoils { } if ((UtilityRoutines::SameString(Alphas(6), "AirCooled")) || lAlphaBlanks(6)) { - DXCoil(DXCoilNum).CondenserType(1) = AirCooled; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = AirCooled; } else if (UtilityRoutines::SameString(Alphas(6), "EvaporativelyCooled")) { - DXCoil(DXCoilNum).CondenserType(1) = EvapCooled; - DXCoil(DXCoilNum).ReportEvapCondVars = true; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) = EvapCooled; + state.dataDXCoils->DXCoil(DXCoilNum).ReportEvapCondVars = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(6) + "=\"" + Alphas(6) + "\":"); ShowContinueError(state, "...must be AirCooled or EvaporativelyCooled."); ErrorsFound = true; @@ -3818,94 +3716,94 @@ namespace DXCoils { // Get Water System tank connections // A8, \field Name of Water Storage Tank for Supply - DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(7); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName = Alphas(7); if (lAlphaBlanks(7)) { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromMains; } else { - DXCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; - SetupTankDemandComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode = iWaterSupply::FromTank; + SetupTankDemandComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).EvapWaterSupplyName, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyName, ErrorsFound, - DXCoil(DXCoilNum).EvapWaterSupTankID, - DXCoil(DXCoilNum).EvapWaterTankDemandARRID); + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID, + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID); } // A9; \field Name of Water Storage Tank for Condensate Collection - DXCoil(DXCoilNum).CondensateCollectName = Alphas(8); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName = Alphas(8); if (lAlphaBlanks(8)) { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::Discarded; } else { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::ToTank; + SetupTankSupplyComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).CondensateCollectName, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName, ErrorsFound, - DXCoil(DXCoilNum).CondensateTankID, - DXCoil(DXCoilNum).CondensateTankSupplyARRID); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID); } // Set minimum OAT for compressor operation - DXCoil(DXCoilNum).MinOATCompressor = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = Numbers(1); // Set crankcase heater capacity - DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(2); - if (DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(2); + if (state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cNumericFields(2) + " cannot be < 0.0."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(2))); ErrorsFound = true; } // Set crankcase heater cutout temperature - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(3); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(3); if (UtilityRoutines::SameString(Alphas(9), "Yes")) { - DXCoil(DXCoilNum).PLRImpact = true; + state.dataDXCoils->DXCoil(DXCoilNum).PLRImpact = true; } else if (UtilityRoutines::SameString(Alphas(9), "No")) { - DXCoil(DXCoilNum).PLRImpact = false; + state.dataDXCoils->DXCoil(DXCoilNum).PLRImpact = false; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(9) + ". Entered choice = " + Alphas(9)); ShowContinueError(state, "The allowed choices are Yes or No."); ErrorsFound = true; } if (UtilityRoutines::SameString(Alphas(10), "Yes")) { - DXCoil(DXCoilNum).LatentImpact = true; + state.dataDXCoils->DXCoil(DXCoilNum).LatentImpact = true; } else if (UtilityRoutines::SameString(Alphas(10), "No")) { - DXCoil(DXCoilNum).LatentImpact = false; + state.dataDXCoils->DXCoil(DXCoilNum).LatentImpact = false; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(10) + ". Entered choice = " + Alphas(10)); ShowContinueError(state, "The allowed choices are Yes or No."); ErrorsFound = true; } // Basin heater power as a function of temperature must be greater than or equal to 0 - DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(4); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff = Numbers(4); if (Numbers(4) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 0.0, entered value=[{:.3T}].", cNumericFields(4), Numbers(4))); ErrorsFound = true; } - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(5); - if (DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = Numbers(5); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { if (NumNumbers < 5) { - DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp = 2.0; } - if (DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", freeze possible"); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", freeze possible"); ShowContinueError(state, "..." + cNumericFields(5) + " is less than 2 {C}. Freezing could occur."); ShowContinueError(state, format("...entered value=[{:.2T}].", Numbers(5))); } } if (!lAlphaBlanks(11)) { - DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(11)); - if (DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(11)); + if (state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(11) + "=\"" + Alphas(11) + "\"."); ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); } @@ -3913,9 +3811,9 @@ namespace DXCoils { // A12; \field Fuel type, Validate fuel type input bool FuelTypeError(false); - UtilityRoutines::ValidateFuelTypeWithAssignResourceTypeNum(Alphas(12), DXCoil(DXCoilNum).FuelType, DXCoil(DXCoilNum).FuelTypeNum, FuelTypeError); + UtilityRoutines::ValidateFuelTypeWithAssignResourceTypeNum(Alphas(12), state.dataDXCoils->DXCoil(DXCoilNum).FuelType, state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum, FuelTypeError); if (FuelTypeError) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(12) + ". Entered choice = " + Alphas(12)); ShowContinueError(state, "Valid choices are Electricity, NaturalGas, PropaneGas, Diesel, Gasoline, FuelOilNo1, FuelOilNo2, OtherFuel1 or OtherFuel2"); @@ -3923,69 +3821,69 @@ namespace DXCoils { FuelTypeError = false; } - DXCoil(DXCoilNum).NumOfSpeeds = Numbers(6); // Number of speeds - if (DXCoil(DXCoilNum).NumOfSpeeds < 2) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds = Numbers(6); // Number of speeds + if (state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds < 2) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 2. entered number is {:.0T}", cNumericFields(6), Numbers(6))); ErrorsFound = true; } // Allocate arrays based on the number of speeds - DXCoil(DXCoilNum).MSErrIndex.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSErrIndex = 0; - DXCoil(DXCoilNum).MSRatedTotCap.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedTotCapDes.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedSHR.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedCOP.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedAirMassFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSCCapFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSCCapFFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEIRFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEIRFFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSWasteHeat.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEvapCondEffect.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEvapCondAirFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedCBF.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSWasteHeatFrac.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSPLFFPLR.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSTwet_Rated.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSGamma_Rated.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSLatentCapacityTimeConstant.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - - for (I = 1; I <= DXCoil(DXCoilNum).NumOfSpeeds; ++I) { - DXCoil(DXCoilNum).MSRatedTotCap(I) = Numbers(7 + (I - 1) * 13); - DXCoil(DXCoilNum).MSRatedSHR(I) = Numbers(8 + (I - 1) * 13); - DXCoil(DXCoilNum).MSRatedCOP(I) = Numbers(9 + (I - 1) * 13); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = Numbers(10 + (I - 1) * 13); - DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate(I) = Numbers(11 + (I - 1) * 13); - - DXCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, Alphas(13 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex = 0; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCapDes.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondEffect.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSTwet_Rated.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSGamma_Rated.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSLatentCapacityTimeConstant.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + + for (I = 1; I <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(I) = Numbers(7 + (I - 1) * 13); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(I) = Numbers(8 + (I - 1) * 13); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(I) = Numbers(9 + (I - 1) * 13); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = Numbers(10 + (I - 1) * 13); + state.dataDXCoils->DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate(I) = Numbers(11 + (I - 1) * 13); + + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, Alphas(13 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(13 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(13 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(13 + (I - 1) * 6) + "=\"" + Alphas(13 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(13 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSCCapFTemp(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I), cAlphaFields(13 + (I - 1) * 6), Alphas(13 + (I - 1) * 6), RatedInletWetBulbTemp, @@ -3993,58 +3891,58 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).MSCCapFFlow(I) = GetCurveIndex(state, Alphas(14 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSCCapFFlow(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I) = GetCurveIndex(state, Alphas(14 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I) == 0) { if (lAlphaBlanks(14 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(14 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(14 + (I - 1) * 6) + "=\"" + Alphas(14 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSCCapFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(14 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSCCapFFlow(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I), cAlphaFields(14 + (I - 1) * 6), Alphas(14 + (I - 1) * 6), 1.0); } } - DXCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, Alphas(15 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, Alphas(15 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(15 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(15 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(15 + (I - 1) * 6) + "=\"" + Alphas(15 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(15 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSEIRFTemp(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I), cAlphaFields(15 + (I - 1) * 6), Alphas(15 + (I - 1) * 6), RatedInletWetBulbTemp, @@ -4052,52 +3950,52 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).MSEIRFFlow(I) = GetCurveIndex(state, Alphas(16 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSEIRFFlow(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I) = GetCurveIndex(state, Alphas(16 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I) == 0) { if (lAlphaBlanks(16 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(16 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(16 + (I - 1) * 6) + "=\"" + Alphas(16 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSEIRFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(16 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSEIRFFlow(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I), cAlphaFields(16 + (I - 1) * 6), Alphas(16 + (I - 1) * 6), 1.0); } } - DXCoil(DXCoilNum).MSPLFFPLR(I) = GetCurveIndex(state, Alphas(17 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSPLFFPLR(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I) = GetCurveIndex(state, Alphas(17 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I) == 0) { if (lAlphaBlanks(17 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(17 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(17 + (I - 1) * 6) + "=\"" + Alphas(16 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSPLFFPLR(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(17 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { @@ -4106,7 +4004,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).MSPLFFPLR(I), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -4118,83 +4016,83 @@ namespace DXCoils { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields2(17 + (I - 1) * 6) + " = " + Alphas2(17 + (I - 1) * 6) + " has out of range value."); ShowContinueError( state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(PerfModeNum), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields2(17 + (I - 1) * 6) + " = " + Alphas2(17 + (I - 1) * 6) + " has out of range value."); ShowContinueError( state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).MSPLFFPLR(I), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I), ErrorsFound, _, 1.0); } } } // read data for latent degradation - DXCoil(DXCoilNum).MSTwet_Rated(I) = Numbers(12 + (I - 1) * 13); - if (DXCoil(DXCoilNum).MSTwet_Rated(I) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSTwet_Rated(I) = Numbers(12 + (I - 1) * 13); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSTwet_Rated(I) < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} cannot be < 0.0, entered value=[{:.4T}].", cNumericFields(12 + (I - 1) * 13), - DXCoil(DXCoilNum).MSTwet_Rated(I))); + state.dataDXCoils->DXCoil(DXCoilNum).MSTwet_Rated(I))); ErrorsFound = true; } - DXCoil(DXCoilNum).MSGamma_Rated(I) = Numbers(13 + (I - 1) * 13); - if (DXCoil(DXCoilNum).MSGamma_Rated(I) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSGamma_Rated(I) = Numbers(13 + (I - 1) * 13); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSGamma_Rated(I) < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} cannot be < 0.0, entered value=[{:.4T}].", cNumericFields(13 + (I - 1) * 13), - DXCoil(DXCoilNum).MSGamma_Rated(I))); + state.dataDXCoils->DXCoil(DXCoilNum).MSGamma_Rated(I))); ErrorsFound = true; } - DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour(I) = Numbers(14 + (I - 1) * 13); - if (DXCoil(DXCoilNum).Gamma_Rated(I) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour(I) = Numbers(14 + (I - 1) * 13); + if (state.dataDXCoils->DXCoil(DXCoilNum).Gamma_Rated(I) < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} cannot be < 0.0, entered value=[{:.2T}].", cNumericFields(14 + (I - 1) * 13), - DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour(I))); + state.dataDXCoils->DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour(I))); ErrorsFound = true; } - DXCoil(DXCoilNum).MSLatentCapacityTimeConstant(I) = Numbers(15 + (I - 1) * 13); - if (DXCoil(DXCoilNum).Gamma_Rated(I) < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSLatentCapacityTimeConstant(I) = Numbers(15 + (I - 1) * 13); + if (state.dataDXCoils->DXCoil(DXCoilNum).Gamma_Rated(I) < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} cannot be < 0.0, entered value=[{:.2T}].", cNumericFields(15 + (I - 1) * 13), - DXCoil(DXCoilNum).MSLatentCapacityTimeConstant(I))); + state.dataDXCoils->DXCoil(DXCoilNum).MSLatentCapacityTimeConstant(I))); ErrorsFound = true; } - DXCoil(DXCoilNum).MSWasteHeatFrac(I) = Numbers(16 + (I - 1) * 13); + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(I) = Numbers(16 + (I - 1) * 13); // Read waste heat modifier curve name - DXCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, Alphas(18 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - if (DXCoil(DXCoilNum).MSWasteHeat(I) > 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, Alphas(18 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I) > 0) { // Verify Curve Object, only legal types are BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSWasteHeat(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(18 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).MSWasteHeat(I), RatedOutdoorAirTemp, RatedInletAirTemp); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I), RatedOutdoorAirTemp, RatedInletAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError(state, cAlphaFields(18 + (I - 1) * 6) + " = " + Alphas(18 + (I - 1) * 6)); ShowContinueError(state, "..." + cAlphaFields(18 + (I - 1) * 6) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); @@ -4204,9 +4102,9 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).MSEvapCondEffect(I) = Numbers(17 + (I - 1) * 13); - if (DXCoil(DXCoilNum).MSEvapCondEffect(I) < 0.0 || DXCoil(DXCoilNum).MSEvapCondEffect(I) > 1.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondEffect(I) = Numbers(17 + (I - 1) * 13); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondEffect(I) < 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondEffect(I) > 1.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} cannot be < 0.0 or > 1.0, entered value=[{:.3T}].", cNumericFields(17 + (I - 1) * 13), @@ -4214,18 +4112,18 @@ namespace DXCoils { ErrorsFound = true; } - DXCoil(DXCoilNum).MSEvapCondAirFlow(I) = Numbers(18 + (I - 1) * 13); - if (DXCoil(DXCoilNum).MSEvapCondAirFlow(I) < 0.0 && DXCoil(DXCoilNum).MSEvapCondAirFlow(I) != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(I) = Numbers(18 + (I - 1) * 13); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(I) < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(I) != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError( state, format("...{} cannot be < 0.0, entered value=[{:.3T}].", cNumericFields(18 + (I - 1) * 13), Numbers(18 + (I - 1) * 13))); ErrorsFound = true; } - DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(I) = Numbers(19 + (I - 1) * 13); - if (DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(I) < 0.0 && DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(I) != AutoSize) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(I) = Numbers(19 + (I - 1) * 13); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(I) < 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(I) != AutoSize) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError( state, format("...{} cannot be < 0.0, entered value=[{:.3T}].", cNumericFields(19 + (I - 1) * 13), Numbers(19 + (I - 1) * 13))); @@ -4234,16 +4132,16 @@ namespace DXCoils { } // A37; \field Zone Name for Condenser Placement if (!lAlphaBlanks(37) && NumAlphas > 36) { - DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(37), Zone); - if (DXCoil(DXCoilNum).SecZonePtr > 0) { - SetupZoneInternalGain(state, DXCoil(DXCoilNum).SecZonePtr, + state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(37), Zone); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr > 0) { + SetupZoneInternalGain(state, state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr, "Coil:Cooling:DX:MultiSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, IntGainTypeOf_SecCoolingDXCoilMultiSpeed, - &DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + &state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); + state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(37) + "=\"" + Alphas(37) + "\"."); } } @@ -4255,7 +4153,7 @@ namespace DXCoils { // DX multispeed heating coil CurrentModuleObject = "Coil:Heating:DX:MultiSpeed"; - for (DXCoilIndex = 1; DXCoilIndex <= NumDXMulSpeedHeatCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumDXMulSpeedHeatCoils; ++DXCoilIndex) { ++DXCoilNum; @@ -4274,80 +4172,80 @@ namespace DXCoils { // *** will have to circle back to this one to fix since the multispeed coil has all fields in this coil object *** // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils - HeatReclaimDXCoil(DXCoilNum).Name = DXCoil(DXCoilNum).Name; + HeatReclaimDXCoil(DXCoilNum).Name = state.dataDXCoils->DXCoil(DXCoilNum).Name; HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedHeating; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedHeating; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); // Set minimum OAT for heat pump compressor operation - DXCoil(DXCoilNum).MinOATCompressor = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = Numbers(1); // set Minimum Outdoor Dry-Bulb Temperature for Compressor Operation - DXCoil(DXCoilNum).OATempCompressorOn = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOn = Numbers(2); // Set crankcase heater capacity - DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(3); - if (DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity = Numbers(3); + if (state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} cannot be < 0.0, entered value=[{:.2T}].", cNumericFields(3), Numbers(3))); ErrorsFound = true; } // Set crankcase heater cutout temperature - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(4); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = Numbers(4); // Only required for reverse cycle heat pumps - DXCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, Alphas(5)); // convert curve name to number + state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, Alphas(5)); // convert curve name to number if (UtilityRoutines::SameString(Alphas(6), "ReverseCycle")) { - if (DXCoil(DXCoilNum).DefrostEIRFT == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(5) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(5) + "=\"" + Alphas(5) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).DefrostEIRFT, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(5)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DefrostEIRFT, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT, cAlphaFields(5), Alphas(5), RatedInletWetBulbTempHeat, @@ -4356,47 +4254,47 @@ namespace DXCoils { } } - if (UtilityRoutines::SameString(Alphas(6), "ReverseCycle")) DXCoil(DXCoilNum).DefrostStrategy = ReverseCycle; - if (UtilityRoutines::SameString(Alphas(6), "Resistive")) DXCoil(DXCoilNum).DefrostStrategy = Resistive; - if (DXCoil(DXCoilNum).DefrostStrategy == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + if (UtilityRoutines::SameString(Alphas(6), "ReverseCycle")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy = ReverseCycle; + if (UtilityRoutines::SameString(Alphas(6), "Resistive")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy = Resistive; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFields(6) + "=\"" + Alphas(6) + "\"."); ShowContinueError(state, "...valid values for this field are ReverseCycle or Resistive."); ErrorsFound = true; } - if (UtilityRoutines::SameString(Alphas(7), "Timed")) DXCoil(DXCoilNum).DefrostControl = Timed; - if (UtilityRoutines::SameString(Alphas(7), "OnDemand")) DXCoil(DXCoilNum).DefrostControl = OnDemand; - if (DXCoil(DXCoilNum).DefrostControl == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + if (UtilityRoutines::SameString(Alphas(7), "Timed")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl = Timed; + if (UtilityRoutines::SameString(Alphas(7), "OnDemand")) state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl = OnDemand; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFields(7) + "=\"" + Alphas(7) + "\"."); ShowContinueError(state, "...valid values for this field are Timed or OnDemand."); ErrorsFound = true; } // Set maximum outdoor temp for defrost to occur - DXCoil(DXCoilNum).MaxOATDefrost = Numbers(5); + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATDefrost = Numbers(5); // Set defrost time period - DXCoil(DXCoilNum).DefrostTime = Numbers(6); - if (DXCoil(DXCoilNum).DefrostTime == 0.0 && DXCoil(DXCoilNum).DefrostControl == Timed) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", "); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime = Numbers(6); + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime == 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == Timed) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", "); ShowContinueError(state, "..." + cNumericFields(5) + " = 0.0 for defrost control = TIMED."); } // Set defrost capacity (for resistive defrost) - DXCoil(DXCoilNum).DefrostCapacity = Numbers(7); - if (DXCoil(DXCoilNum).DefrostCapacity == 0.0 && DXCoil(DXCoilNum).DefrostStrategy == OnDemand) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", "); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity = Numbers(7); + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity == 0.0 && state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == OnDemand) { + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", "); ShowContinueError(state, "..." + cNumericFields(7) + " = 0.0 for defrost strategy = RESISTIVE."); } if (UtilityRoutines::SameString(Alphas(8), "Yes")) { - DXCoil(DXCoilNum).PLRImpact = true; + state.dataDXCoils->DXCoil(DXCoilNum).PLRImpact = true; } else if (UtilityRoutines::SameString(Alphas(8), "No")) { - DXCoil(DXCoilNum).PLRImpact = false; + state.dataDXCoils->DXCoil(DXCoilNum).PLRImpact = false; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(8) + ". Entered choice = " + Alphas(8)); ShowContinueError(state, "The allowed choices are Yes or No."); ErrorsFound = true; @@ -4404,9 +4302,9 @@ namespace DXCoils { // A9; \field Fuel type, Validate fuel type input bool FuelTypeError(false); - UtilityRoutines::ValidateFuelTypeWithAssignResourceTypeNum(Alphas(9), DXCoil(DXCoilNum).FuelType, DXCoil(DXCoilNum).FuelTypeNum, FuelTypeError); + UtilityRoutines::ValidateFuelTypeWithAssignResourceTypeNum(Alphas(9), state.dataDXCoils->DXCoil(DXCoilNum).FuelType, state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum, FuelTypeError); if (FuelTypeError) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, ",,,invalid choice for " + cAlphaFields(9) + ". Entered choice = " + Alphas(9)); ShowContinueError(state, "Valid choices are Electricity, NaturalGas, PropaneGas, Diesel, Gasoline, FuelOilNo1, FuelOilNo2, OtherFuel1 or OtherFuel2"); @@ -4414,72 +4312,72 @@ namespace DXCoils { FuelTypeError = false; } - DXCoil(DXCoilNum).RegionNum = Numbers(8); // Region Number for HSPF Calc - DXCoil(DXCoilNum).NumOfSpeeds = Numbers(9); // Number of speeds - if (DXCoil(DXCoilNum).NumOfSpeeds < 2) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).RegionNum = Numbers(8); // Region Number for HSPF Calc + state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds = Numbers(9); // Number of speeds + if (state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds < 2) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, format("...{} must be >= 2. entered number is {:.0T}", cNumericFields(9), Numbers(9))); ErrorsFound = true; } // Allocate arrays based on the number of speeds - DXCoil(DXCoilNum).MSErrIndex.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSErrIndex = 0; - DXCoil(DXCoilNum).MSRatedTotCap.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedCOP.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedAirMassFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSCCapFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSCCapFFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEIRFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEIRFFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSWasteHeat.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSPLFFPLR.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedCBF.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSWasteHeatFrac.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilSHRFT.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilSHRFF.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilAirFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilAirFlowScalingFactor.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilRatedSHR.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - - DXCoil(DXCoilNum).RatedSHR(1) = 1.0; - - for (I = 1; I <= DXCoil(DXCoilNum).NumOfSpeeds; ++I) { - - DXCoil(DXCoilNum).MSRatedTotCap(I) = Numbers(10 + (I - 1) * 5); - DXCoil(DXCoilNum).MSRatedCOP(I) = Numbers(11 + (I - 1) * 5); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = Numbers(12 + (I - 1) * 5); - DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate(I) = Numbers(13 + (I - 1) * 5); - DXCoil(DXCoilNum).MSWasteHeatFrac(I) = Numbers(14 + (I - 1) * 5); - - DXCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, Alphas(10 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSCCapFTemp(I) == 0) { - ShowSevereError(state, CurrentModuleObject + ", \"" + DXCoil(DXCoilNum).Name + "\" " + cAlphaFields(10 + (I - 1) * 6) + + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex = 0; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlowScalingFactor.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR.allocate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = 1.0; + + for (I = 1; I <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++I) { + + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(I) = Numbers(10 + (I - 1) * 5); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(I) = Numbers(11 + (I - 1) * 5); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = Numbers(12 + (I - 1) * 5); + state.dataDXCoils->DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate(I) = Numbers(13 + (I - 1) * 5); + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(I) = Numbers(14 + (I - 1) * 5); + + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, Alphas(10 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + ShowSevereError(state, CurrentModuleObject + ", \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" " + cAlphaFields(10 + (I - 1) * 6) + " not found:" + Alphas(10 + (I - 1) * 6)); ErrorsFound = true; } else { // only legal types are Quadratic, BiQuadratic and Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I), // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(10 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSCCapFTemp(I)).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I)).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSCCapFTemp(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I), cAlphaFields(10 + (I - 1) * 6), Alphas(10 + (I - 1) * 6), RatedOutdoorAirTempHeat); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSCCapFTemp(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(I), cAlphaFields(10 + (I - 1) * 6), Alphas(10 + (I - 1) * 6), RatedInletAirTempHeat, @@ -4488,66 +4386,66 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).MSCCapFFlow(I) = GetCurveIndex(state, Alphas(11 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSCCapFFlow(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I) = GetCurveIndex(state, Alphas(11 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I) == 0) { if (lAlphaBlanks(11 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(11 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(11 + (I - 1) * 6) + "=\"" + Alphas(11 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSCCapFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(11 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSCCapFFlow(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(I), cAlphaFields(11 + (I - 1) * 6), Alphas(11 + (I - 1) * 6), 1.0); } } - DXCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, Alphas(12 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, Alphas(12 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(12 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(12 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(12 + (I - 1) * 6) + "=\"" + Alphas(15 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // only legal types are Quadratic, BiQuadratic and Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I), // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(12 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSEIRFTemp(I)).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I)).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSEIRFTemp(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I), cAlphaFields(12 + (I - 1) * 6), Alphas(12 + (I - 1) * 6), RatedOutdoorAirTempHeat); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSEIRFTemp(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(I), cAlphaFields(12 + (I - 1) * 6), Alphas(12 + (I - 1) * 6), RatedInletAirTempHeat, @@ -4556,52 +4454,52 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).MSEIRFFlow(I) = GetCurveIndex(state, Alphas(13 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSEIRFFlow(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I) = GetCurveIndex(state, Alphas(13 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I) == 0) { if (lAlphaBlanks(13 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(13 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(13 + (I - 1) * 6) + "=\"" + Alphas(13 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSEIRFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(13 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSEIRFFlow(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(I), cAlphaFields(13 + (I - 1) * 6), Alphas(13 + (I - 1) * 6), 1.0); } } - DXCoil(DXCoilNum).MSPLFFPLR(I) = GetCurveIndex(state, Alphas(14 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).MSPLFFPLR(I) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I) = GetCurveIndex(state, Alphas(14 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I) == 0) { if (lAlphaBlanks(14 + (I - 1) * 6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(14 + (I - 1) * 6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(14 + (I - 1) * 6) + "=\"" + Alphas(14 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSPLFFPLR(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(14 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { @@ -4610,7 +4508,7 @@ namespace DXCoils { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, DXCoil(DXCoilNum).MSPLFFPLR(I), CurveInput); + CurveVal = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I), CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -4622,42 +4520,42 @@ namespace DXCoils { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(14 + (I - 1) * 6) + " = " + Alphas(14 + (I - 1) * 6) + " has out of range value."); ShowContinueError( state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).MSPLFFPLR(I), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I), ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(14 + (I - 1) * 6) + " = " + Alphas(14 + (I - 1) * 6) + " has out of range value."); ShowContinueError( state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, DXCoil(DXCoilNum).MSPLFFPLR(I), ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(I), ErrorsFound, _, 1.0); } } } // Read waste heat modifier curve name - DXCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, Alphas(15 + (I - 1) * 6)); // convert curve name to number - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - if (DXCoil(DXCoilNum).MSWasteHeat(I) > 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, Alphas(15 + (I - 1) * 6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I) > 0) { // Verify Curve Object, only legal types are BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).MSWasteHeat(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(15 + (I - 1) * 6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MSWasteHeat(I), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(I), cAlphaFields(15 + (I - 1) * 6), Alphas(15 + (I - 1) * 6), RatedOutdoorAirTempHeat, @@ -4668,40 +4566,40 @@ namespace DXCoils { } // A34; \field Zone Name for Condenser Placement if (!lAlphaBlanks(34) && NumAlphas > 33) { - DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(34), Zone); - if (DXCoil(DXCoilNum).SecZonePtr > 0) { - SetupZoneInternalGain(state, DXCoil(DXCoilNum).SecZonePtr, + state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr = UtilityRoutines::FindItemInList(Alphas(34), Zone); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr > 0) { + SetupZoneInternalGain(state, state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr, "Coil:Heating:DX:MultiSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, IntGainTypeOf_SecHeatingDXCoilMultiSpeed, - &DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate, + &state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate, nullptr, nullptr, - &DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + &state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate); + state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(34) + "=\"" + Alphas(34) + "\"."); } } - if (DXCoil(DXCoilNum).SecZonePtr > 0) { - for (I = 1; I <= DXCoil(DXCoilNum).NumOfSpeeds; ++I) { - DXCoil(DXCoilNum).MSSecCoilAirFlow(I) = Numbers(30 + (I - 1) * 3); - DXCoil(DXCoilNum).MSSecCoilAirFlowScalingFactor(I) = Numbers(31 + (I - 1) * 3); - DXCoil(DXCoilNum).MSSecCoilRatedSHR(I) = Numbers(32 + (I - 1) * 3); + if (state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr > 0) { + for (I = 1; I <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(I) = Numbers(30 + (I - 1) * 3); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlowScalingFactor(I) = Numbers(31 + (I - 1) * 3); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR(I) = Numbers(32 + (I - 1) * 3); // Read SHR modifier curve function of temperature if (!lAlphaBlanks(35 + (I - 1) * 2)) { - DXCoil(DXCoilNum).MSSecCoilSHRFT(I) = GetCurveIndex(state, Alphas(35 + (I - 1) * 2)); // convert curve name to number - if (DXCoil(DXCoilNum).MSSecCoilSHRFT(I) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(I) = GetCurveIndex(state, Alphas(35 + (I - 1) * 2)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(I) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(35 + (I - 1) * 2) + "=\"" + Alphas(35 + (I - 1) * 2) + "\"."); } } // Read SHR modifier curve function of flow fraction if (!lAlphaBlanks(36 + (I - 1) * 2)) { - DXCoil(DXCoilNum).MSSecCoilSHRFF(I) = GetCurveIndex(state, Alphas(36 + (I - 1) * 2)); // convert curve name to number - if (DXCoil(DXCoilNum).MSSecCoilSHRFF(I) == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF(I) = GetCurveIndex(state, Alphas(36 + (I - 1) * 2)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF(I) == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(36 + (I - 1) * 2) + "=\"" + Alphas(36 + (I - 1) * 2) + "\"."); } } @@ -4711,7 +4609,7 @@ namespace DXCoils { // Loop over the VRF Cooling Coils and get & load the data CurrentModuleObject = cAllCoilTypes(CoilVRF_Cooling); - for (DXCoilIndex = 1; DXCoilIndex <= NumVRFCoolingCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFCoolingCoils; ++DXCoilIndex) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -4729,52 +4627,52 @@ namespace DXCoils { ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_Cooling; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_Cooling; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); - DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(3); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(3); - DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(3)); + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) = GetCurveIndex(state, Alphas(3)); // Verify Curve Object, only legal type is Linear, Quadratic, Cubic, or BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(3)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).CCapFTemp(1)).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1)).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), cAlphaFields(3), Alphas(3), RatedInletWetBulbTemp); } else { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), cAlphaFields(3), Alphas(3), RatedInletWetBulbTemp, @@ -4782,50 +4680,50 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(4)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(4)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) == 0) { if (lAlphaBlanks(4)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(4) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(4) + "=\"" + Alphas(4) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Linear, Quadratic or Cubic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(4)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(4), Alphas(4), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(4), Alphas(4), 1.0); } } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(5), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(6), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(5), Alphas(6), "Air Nodes"); - DXCoil(DXCoilNum).CondensateCollectName = Alphas(7); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName = Alphas(7); if (lAlphaBlanks(7)) { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::Discarded; } else { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::ToTank; + SetupTankSupplyComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).CondensateCollectName, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName, ErrorsFound, - DXCoil(DXCoilNum).CondensateTankID, - DXCoil(DXCoilNum).CondensateTankSupplyARRID); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID); } } @@ -4835,7 +4733,7 @@ namespace DXCoils { // Loop over the VRF Heating Coils and get & load the data CurrentModuleObject = cAllCoilTypes(CoilVRF_Heating); - for (DXCoilIndex = 1; DXCoilIndex <= NumVRFHeatingCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFHeatingCoils; ++DXCoilIndex) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -4853,61 +4751,61 @@ namespace DXCoils { ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_Heating; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_Heating; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = Numbers(2); - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - DXCoil(DXCoilNum).CCapFTemp = GetCurveIndex(state, Alphas(5)); - if (DXCoil(DXCoilNum).CCapFTemp(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp = GetCurveIndex(state, Alphas(5)); + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(5) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(5) + "=\"" + Alphas(5) + "\"."); } ErrorsFound = true; } else { - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFTemp(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(5)); // Field Name if (!ErrorsFound) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).CCapFTemp(1)).NumDims == 1) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1)).NumDims == 1) { checkCurveIsNormalizedToOne(state, RoutineName + CurrentModuleObject, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), cAlphaFields(5), Alphas(5), RatedInletAirTempHeat); @@ -4918,28 +4816,28 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number - if (DXCoil(DXCoilNum).CCapFFlow(1) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) = GetCurveIndex(state, Alphas(6)); // convert curve name to number + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) == 0) { if (lAlphaBlanks(6)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(6) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(6) + "=\"" + Alphas(6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, DXCoil(DXCoilNum).CCapFFlow(1), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - DXCoil(DXCoilNum).Name, // Object Name + state.dataDXCoils->DXCoil(DXCoilNum).Name, // Object Name cAlphaFields(6)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, - RoutineName + CurrentModuleObject, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); + RoutineName + CurrentModuleObject, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), cAlphaFields(6), Alphas(6), 1.0); } } } @@ -4950,7 +4848,7 @@ namespace DXCoils { // Loop over the VRF Cooling Coils for VRF FluidTCtrl Model_zrp 2015 CurrentModuleObject = cAllCoilTypes(CoilVRF_FluidTCtrl_Cooling); - for (DXCoilIndex = 1; DXCoilIndex <= NumVRFCoolingFluidTCtrlCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFCoolingFluidTCtrlCoils; ++DXCoilIndex) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -4968,37 +4866,37 @@ namespace DXCoils { ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_FluidTCtrl_Cooling; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_FluidTCtrl_Cooling; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); - DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); - DXCoil(DXCoilNum).SH = Numbers(3); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).SH = Numbers(3); // @@ DXCoil( DXCoilNum ).RateBFVRFIUEvap = 0.0592; there will be a new field for this, which will be handled in a separate issue to // update VRF-HP idd. It is not hanlded here to avoide tranistion issues for VRF-HP. @@ -5006,22 +4904,22 @@ namespace DXCoils { // Verify curve name and type if (indexSHCurve == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(5) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(5) + "=\"" + Alphas(5) + "\"."); } ErrorsFound = true; } else { { if (state.dataCurveManager->PerfCurve(indexSHCurve).ObjectType == "Curve:Quadratic") { - DXCoil(DXCoilNum).C1Te = state.dataCurveManager->PerfCurve(indexSHCurve).Coeff1; - DXCoil(DXCoilNum).C2Te = state.dataCurveManager->PerfCurve(indexSHCurve).Coeff2; - DXCoil(DXCoilNum).C3Te = state.dataCurveManager->PerfCurve(indexSHCurve).Coeff3; + state.dataDXCoils->DXCoil(DXCoilNum).C1Te = state.dataCurveManager->PerfCurve(indexSHCurve).Coeff1; + state.dataDXCoils->DXCoil(DXCoilNum).C2Te = state.dataCurveManager->PerfCurve(indexSHCurve).Coeff2; + state.dataDXCoils->DXCoil(DXCoilNum).C3Te = state.dataCurveManager->PerfCurve(indexSHCurve).Coeff3; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFields(5) + " type for this object = " + state.dataCurveManager->PerfCurve(indexSHCurve).ObjectType); ShowContinueError(state, "... Curve type must be Quadratic."); @@ -5030,17 +4928,17 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).CondensateCollectName = Alphas(6); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName = Alphas(6); if (lAlphaBlanks(6)) { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::Discarded; } else { - DXCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode = iCondensate::ToTank; + SetupTankSupplyComponent(state, state.dataDXCoils->DXCoil(DXCoilNum).Name, CurrentModuleObject, - DXCoil(DXCoilNum).CondensateCollectName, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectName, ErrorsFound, - DXCoil(DXCoilNum).CondensateTankID, - DXCoil(DXCoilNum).CondensateTankSupplyARRID); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID, + state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID); } } @@ -5050,7 +4948,7 @@ namespace DXCoils { // Loop over the VRF Heating Coils for VRF FluidTCtrl Model_zrp 2015 CurrentModuleObject = cAllCoilTypes(CoilVRF_FluidTCtrl_Heating); - for (DXCoilIndex = 1; DXCoilIndex <= NumVRFHeatingFluidTCtrlCoils; ++DXCoilIndex) { + for (DXCoilIndex = 1; DXCoilIndex <= state.dataDXCoils->NumVRFHeatingFluidTCtrlCoils; ++DXCoilIndex) { inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -5068,58 +4966,58 @@ namespace DXCoils { ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); + state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); - DXCoil(DXCoilNum).Name = Alphas(1); - DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; - DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_FluidTCtrl_Heating; - DXCoil(DXCoilNum).Schedule = Alphas(2); + state.dataDXCoils->DXCoil(DXCoilNum).Name = Alphas(1); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType = CurrentModuleObject; + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilVRF_FluidTCtrl_Heating; + state.dataDXCoils->DXCoil(DXCoilNum).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (DXCoil(DXCoilNum).SchedPtr == 0) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer + if (state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr == 0) { + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFields(2) + "=\"" + Alphas(2) + "\"."); ErrorsFound = true; } } - DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirInNode = GetOnlySingleNode(state, Alphas(3), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, + state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode = GetOnlySingleNode(state, Alphas(4), ErrorsFound, CurrentModuleObject, Alphas(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); - DXCoil(DXCoilNum).SC = Numbers(2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = Numbers(1); + state.dataDXCoils->DXCoil(DXCoilNum).SC = Numbers(2); //@@ DXCoil( DXCoilNum ).RateBFVRFIUCond = 0.136; int indexSCCurve = GetCurveIndex(state, Alphas(5)); // convert curve name to index number // Verify curve name and type if (indexSCCurve == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFields(5) + " is blank."); } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFields(5) + "=\"" + Alphas(5) + "\"."); } ErrorsFound = true; } else { { if (state.dataCurveManager->PerfCurve(indexSCCurve).ObjectType == "Curve:Quadratic") { - DXCoil(DXCoilNum).C1Tc = state.dataCurveManager->PerfCurve(indexSCCurve).Coeff1; - DXCoil(DXCoilNum).C2Tc = state.dataCurveManager->PerfCurve(indexSCCurve).Coeff2; - DXCoil(DXCoilNum).C3Tc = state.dataCurveManager->PerfCurve(indexSCCurve).Coeff3; + state.dataDXCoils->DXCoil(DXCoilNum).C1Tc = state.dataCurveManager->PerfCurve(indexSCCurve).Coeff1; + state.dataDXCoils->DXCoil(DXCoilNum).C2Tc = state.dataCurveManager->PerfCurve(indexSCCurve).Coeff2; + state.dataDXCoils->DXCoil(DXCoilNum).C3Tc = state.dataCurveManager->PerfCurve(indexSCCurve).Coeff3; } else { - ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + DXCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFields(5) + " type for this object = " + state.dataCurveManager->PerfCurve(indexSCCurve).ObjectType); ShowContinueError(state, "... Curve type must be Quadratic."); @@ -5133,9 +5031,9 @@ namespace DXCoils { ShowFatalError(state, RoutineName + "Errors found in getting " + CurrentModuleObject + " input. Preceding condition(s) causes termination."); } - for (DXCoilNum = 1; DXCoilNum <= NumDXCoils; ++DXCoilNum) { + for (DXCoilNum = 1; DXCoilNum <= state.dataDXCoils->NumDXCoils; ++DXCoilNum) { - DXCoilData &Coil = DXCoil(DXCoilNum); + DXCoilData &Coil = state.dataDXCoils->DXCoil(DXCoilNum); if (Coil.DXCoilType_Num == CoilDX_CoolingSingleSpeed || Coil.DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { // Setup Report Variables for Cooling Equipment @@ -5185,7 +5083,7 @@ namespace DXCoils { } // do we report these even if no storage tank? - if (Coil.CondensateCollectMode == CondensateToTank) { + if (Coil.CondensateCollectMode == iCondensate::ToTank) { SetupOutputVariable(state, "Cooling Coil Condensate Volume Flow Rate", OutputProcessor::Unit::m3_s, Coil.CondensateVdot, "System", "Average", Coil.Name); SetupOutputVariable(state, "Cooling Coil Condensate Volume", @@ -5861,7 +5759,7 @@ namespace DXCoils { "Cooling Coil Latent Cooling Energy", OutputProcessor::Unit::J, Coil.LatCoolingEnergy, "System", "Sum", Coil.Name); SetupOutputVariable(state, "Cooling Coil Runtime Fraction", OutputProcessor::Unit::None, Coil.CoolingCoilRuntimeFraction, "System", "Average", Coil.Name); - if (Coil.CondensateCollectMode == CondensateToTank) { + if (Coil.CondensateCollectMode == iCondensate::ToTank) { SetupOutputVariable(state, "Cooling Coil Condensate Volume Flow Rate", OutputProcessor::Unit::m3_s, Coil.CondensateVdot, "System", "Average", Coil.Name); SetupOutputVariable(state, "Cooling Coil Condensate Volume", @@ -5932,7 +5830,7 @@ namespace DXCoils { SetupOutputVariable(state, "Cooling Coil VRF Super Heating Degrees", OutputProcessor::Unit::C, Coil.ActualSH, "System", "Average", Coil.Name); - if (Coil.CondensateCollectMode == CondensateToTank) { + if (Coil.CondensateCollectMode == iCondensate::ToTank) { SetupOutputVariable(state, "Cooling Coil Condensate Volume Flow Rate", OutputProcessor::Unit::m3_s, Coil.CondensateVdot, "System", "Average", Coil.Name); SetupOutputVariable(state, "Cooling Coil Condensate Volume", @@ -5977,27 +5875,27 @@ namespace DXCoils { if (state.dataGlobal->AnyEnergyManagementSystemInModel) { // setup EMS sizing actuators for single speed DX - for (DXCoilNum = 1; DXCoilNum <= NumDoe2DXCoils; ++DXCoilNum) { + for (DXCoilNum = 1; DXCoilNum <= state.dataDXCoils->NumDoe2DXCoils; ++DXCoilNum) { SetupEMSActuator(state, "Coil:Cooling:DX:SingleSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, "Autosized Rated Air Flow Rate", "[m3/s]", - DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(1), - DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(1)); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(1)); SetupEMSActuator(state, "Coil:Cooling:DX:SingleSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, "Autosized Rated Sensible Heat Ratio", "[W/W]", - DXCoil(DXCoilNum).RatedSHREMSOverrideOn(1), - DXCoil(DXCoilNum).RatedSHREMSOverrideValue(1)); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHREMSOverrideOn(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHREMSOverrideValue(1)); SetupEMSActuator(state, "Coil:Cooling:DX:SingleSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, "Autosized Rated Total Cooling Capacity", "[W]", - DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(1), - DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(1)); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(1)); } } Alphas.deallocate(); @@ -6057,31 +5955,31 @@ namespace DXCoils { int AirInletNode; // Air inlet node number int SpeedNum; // Speed number for multispeed coils - if (MyOneTimeFlag) { + if (state.dataDXCoils->MyOneTimeFlag) { // initialize the environment and sizing flags - MyEnvrnFlag.allocate(NumDXCoils); - MySizeFlag.allocate(NumDXCoils); + MyEnvrnFlag.allocate(state.dataDXCoils->NumDXCoils); + MySizeFlag.allocate(state.dataDXCoils->NumDXCoils); MyEnvrnFlag = true; MySizeFlag = true; - MyOneTimeFlag = false; + state.dataDXCoils->MyOneTimeFlag = false; } // if "ISHundredPercentDOASDXCoil" =.TRUE., then set coil as 100% DOAS dx coil - if (DXCoil(DXCoilNum).ISHundredPercentDOASDXCoil) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ISHundredPercentDOASDXCoil) { DXCT = 2; } else { DXCT = 1; } - if ((DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) && + if ((state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) && MyEnvrnFlag(DXCoilNum)) { SizeDXCoil(state, DXCoilNum); - RatedVolFlowPerRatedTotCap = DXCoil(DXCoilNum).RatedAirVolFlowRate(1) / DXCoil(DXCoilNum).RatedTotCap2; + RatedVolFlowPerRatedTotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2; if (((MinRatedVolFlowPerRatedTotCap(DXCT) - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - MaxHeatVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) { - ShowWarningError(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowWarningError(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Rated air volume flow rate per watt of rated total water heating capacity is out of range"); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6091,12 +5989,12 @@ namespace DXCoils { MaxHeatVolFlowPerRatedTotCap(DXCT))); } HPInletAirHumRat = - PsyWFnTdbTwbPb(state, DXCoil(DXCoilNum).RatedInletDBTemp, DXCoil(DXCoilNum).RatedInletWBTemp, DataEnvironment::StdPressureSeaLevel, RoutineName); - HPWHInletDBTemp = DXCoil(DXCoilNum).RatedInletDBTemp; - HPWHInletWBTemp = DXCoil(DXCoilNum).RatedInletWBTemp; - DXCoil(DXCoilNum).RatedAirMassFlowRate(1) = - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, DXCoil(DXCoilNum).RatedInletDBTemp, HPInletAirHumRat, RoutineName); + PsyWFnTdbTwbPb(state, state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp, state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp, DataEnvironment::StdPressureSeaLevel, RoutineName); + HPWHInletDBTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp; + HPWHInletWBTemp = state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWBTemp; + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1) = + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp, HPInletAirHumRat, RoutineName); // get rated coil bypass factor excluding fan heat // call CalcHPWHDXCoil to determine DXCoil%RatedTotCap(1) for rated CBF calculation below @@ -6106,25 +6004,25 @@ namespace DXCoils { MySizeFlag(DXCoilNum) = false; } - DXCoil(DXCoilNum).RatedCBF(1) = CalcCBF(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).RatedInletDBTemp, + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(1) = CalcCBF(state, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletDBTemp, HPInletAirHumRat, - DXCoil(DXCoilNum).RatedTotCap(1), - DXCoil(DXCoilNum).RatedAirVolFlowRate(1), - DXCoil(DXCoilNum).RatedSHR(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1), true); MyEnvrnFlag(DXCoilNum) = false; } - if ((DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) && + if ((state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) && MyEnvrnFlag(DXCoilNum)) { - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - if (DXCoil(DXCoilNum).MSHPHeatRecActive) { - for (SpeedNum = 1; SpeedNum <= DXCoil(DXCoilNum).NumOfSpeeds; ++SpeedNum) { - if (DXCoil(DXCoilNum).MSWasteHeat(SpeedNum) == 0) { - ShowWarningError(state, "GetDXCoils:" + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive) { + for (SpeedNum = 1; SpeedNum <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++SpeedNum) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNum) == 0) { + ShowWarningError(state, "GetDXCoils:" + state.dataDXCoils->DXCoil(DXCoilNum).Name + ". The value of Waste Heat Function of Temperature Curve is assumed to be 1. Simulation continues. "); break; } @@ -6135,53 +6033,53 @@ namespace DXCoils { } // Find the companion upstream coil (DX cooling coil) that is used with DX heating coils (HP AC units only) - if (DXCoil(DXCoilNum).FindCompanionUpStreamCoil) { - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { - DXCoil(DXCoilNum).CompanionUpstreamDXCoil = GetHPCoolingCoilIndex(state, DXCoil(DXCoilNum).DXCoilType, DXCoil(DXCoilNum).Name, DXCoilNum); - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil > 0) { - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).ReportCoolingCoilCrankcasePower = false; - DXCoil(DXCoilNum).FindCompanionUpStreamCoil = false; + if (state.dataDXCoils->DXCoil(DXCoilNum).FindCompanionUpStreamCoil) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { + state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil = GetHPCoolingCoilIndex(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, state.dataDXCoils->DXCoil(DXCoilNum).Name, DXCoilNum); + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil > 0) { + state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).ReportCoolingCoilCrankcasePower = false; + state.dataDXCoils->DXCoil(DXCoilNum).FindCompanionUpStreamCoil = false; // Copy condenser node number from DX cooling coil when used with a companion DX heating coil for (Mode = 1; Mode <= MaxModes; ++Mode) { - DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) = DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CondenserInletNodeNum(Mode); + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) = state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CondenserInletNodeNum(Mode); } } } else { - DXCoil(DXCoilNum).FindCompanionUpStreamCoil = false; + state.dataDXCoils->DXCoil(DXCoilNum).FindCompanionUpStreamCoil = false; } } // IF(DXCoil(DXCoilNum)%FindCompanionUpStreamCoil)THEN // CR7308 - Wait for zone and air loop equipment to be simulated, then print out report variables - if (CrankcaseHeaterReportVarFlag) { + if (state.dataDXCoils->CrankcaseHeaterReportVarFlag) { if (state.dataAirLoop->AirLoopInputsFilled) { // Set report variables for DX cooling coils that will have a crankcase heater (all DX coils not used in a HP AC unit) - for (DXCoilNumTemp = 1; DXCoilNumTemp <= NumDXCoils; ++DXCoilNumTemp) { - if ((DXCoil(DXCoilNumTemp).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) || - (DXCoil(DXCoilNumTemp).DXCoilType_Num == CoilDX_CoolingSingleSpeed) || - (DXCoil(DXCoilNumTemp).DXCoilType_Num == CoilDX_MultiSpeedCooling)) { - if (DXCoil(DXCoilNumTemp).ReportCoolingCoilCrankcasePower) { + for (DXCoilNumTemp = 1; DXCoilNumTemp <= state.dataDXCoils->NumDXCoils; ++DXCoilNumTemp) { + if ((state.dataDXCoils->DXCoil(DXCoilNumTemp).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) || + (state.dataDXCoils->DXCoil(DXCoilNumTemp).DXCoilType_Num == CoilDX_CoolingSingleSpeed) || + (state.dataDXCoils->DXCoil(DXCoilNumTemp).DXCoilType_Num == CoilDX_MultiSpeedCooling)) { + if (state.dataDXCoils->DXCoil(DXCoilNumTemp).ReportCoolingCoilCrankcasePower) { SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Rate", OutputProcessor::Unit::W, - DXCoil(DXCoilNumTemp).CrankcaseHeaterPower, + state.dataDXCoils->DXCoil(DXCoilNumTemp).CrankcaseHeaterPower, "System", "Average", - DXCoil(DXCoilNumTemp).Name); + state.dataDXCoils->DXCoil(DXCoilNumTemp).Name); SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Energy", OutputProcessor::Unit::J, - DXCoil(DXCoilNumTemp).CrankcaseHeaterConsumption, + state.dataDXCoils->DXCoil(DXCoilNumTemp).CrankcaseHeaterConsumption, "System", "Sum", - DXCoil(DXCoilNumTemp).Name, + state.dataDXCoils->DXCoil(DXCoilNumTemp).Name, _, "Electricity", "COOLING", _, "System"); - DXCoil(DXCoilNumTemp).ReportCoolingCoilCrankcasePower = false; + state.dataDXCoils->DXCoil(DXCoilNumTemp).ReportCoolingCoilCrankcasePower = false; } } } - CrankcaseHeaterReportVarFlag = false; + state.dataDXCoils->CrankcaseHeaterReportVarFlag = false; } //(AirLoopInputsFilled)THEN } //(CrankcaseHeaterReportVarFlag)THEN @@ -6190,17 +6088,17 @@ namespace DXCoils { SizeDXCoil(state, DXCoilNum); MySizeFlag(DXCoilNum) = false; - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || - DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling || DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { Mode = 1; // Check for zero capacity or zero max flow rate - if (DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { - ShowSevereError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + " has zero rated total capacity"); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { + ShowSevereError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + " has zero rated total capacity"); ErrorsFound = true; } - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) <= 0.0) { - ShowSevereError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + " has zero rated air flow rate"); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) <= 0.0) { + ShowSevereError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + " has zero rated air flow rate"); ErrorsFound = true; } if (ErrorsFound) { @@ -6208,12 +6106,12 @@ namespace DXCoils { } // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - if (DXCoil(DXCoilNum).DXCoilType_Num != + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Cooling) { // the VolFlowPerRatedTotCap check is not applicable for VRF-FluidTCtrl coil - RatedVolFlowPerRatedTotCap = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) / DXCoil(DXCoilNum).RatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); if (((MinRatedVolFlowPerRatedTotCap(DXCT) - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) { - ShowWarningError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowWarningError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Rated air volume flow rate per watt of rated total cooling capacity is out of range."); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6224,29 +6122,29 @@ namespace DXCoils { } } - DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) * + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get high speed rated coil bypass factor - DXCoil(DXCoilNum).RatedCBF(Mode) = CalcCBF(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode) = CalcCBF(state, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, RatedInletAirTemp, RatedInletAirHumRat, - DXCoil(DXCoilNum).RatedTotCap(Mode), - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode), - DXCoil(DXCoilNum).RatedSHR(Mode)); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode)); // call coil model with everthing set at rating point - DXCoil(DXCoilNum).InletAirMassFlowRate = DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); - DXCoil(DXCoilNum).InletAirMassFlowRateMax = DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); - DXCoil(DXCoilNum).InletAirTemp = RatedInletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp = RatedInletAirTemp; Real64 tempInletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedInletAirTemp, RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel, RoutineName); // DXCoil( DXCoilNum ).InletAirHumRat = RatedInletAirHumRat; // this seems inconsistent with dry bulb and wetbulb, filed NREL issue // #5934 Real64 tempInletAirWetBulb = Psychrometrics::PsyTwbFnTdbWPb( RatedInletAirTemp, RatedInletAirHumRat, // DataEnvironment::StdPressureSeaLevel ); - DXCoil(DXCoilNum).InletAirHumRat = tempInletAirHumRat; - DXCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, tempInletAirHumRat); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat = tempInletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, tempInletAirHumRat); // store environment data fill back in after rating point calc is over Real64 holdOutDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; @@ -6259,43 +6157,43 @@ namespace DXCoils { state.dataEnvrn->OutBaroPress = DataEnvironment::StdPressureSeaLevel; // assume rating is for sea level. state.dataEnvrn->OutHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedOutdoorAirTemp, ratedOutdoorAirWetBulb, DataEnvironment::StdPressureSeaLevel, RoutineName); - if (DXCoil(DXCoilNum).CondenserInletNodeNum(1) > 0) { // set condenser inlet node values - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = RatedOutdoorAirTemp; - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat = state.dataEnvrn->OutHumRat; - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).OutAirWetBulb = ratedOutdoorAirWetBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) > 0) { // set condenser inlet node values + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = RatedOutdoorAirTemp; + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat = state.dataEnvrn->OutHumRat; + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).OutAirWetBulb = ratedOutdoorAirWetBulb; } // calculate coil model at rating point - if (DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) { CalcDoe2DXCoil(state, DXCoilNum, 1.0, false, 1.0, 1.0, _, 1.0); - } else if (DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed) { CalcMultiSpeedDXCoil(state, DXCoilNum, 1.0, 1.0); - } else if (DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilVRF_Cooling) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilVRF_Cooling) { CalcVRFCoolingCoil(state, DXCoilNum, 1, false, 1.0, 1.0, 1.0, _, _, _); - } else if (DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilVRF_FluidTCtrl_Cooling) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == DataHVACGlobals::CoilVRF_FluidTCtrl_Cooling) { CalcVRFCoolingCoil_FluidTCtrl(state, DXCoilNum, 1, false, 1.0, 1.0, 1.0, _, _); } // coil outlets Real64 RatedOutletWetBulb(0.0); RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - DXCoil(DXCoilNum).OutletAirTemp, DXCoil(DXCoilNum).OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); coilSelectionReportObj->setRatedCoilConditions(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).TotalCoolingEnergyRate, // this is the report variable - DXCoil(DXCoilNum).SensCoolingEnergyRate, // this is the report variable - DXCoil(DXCoilNum).InletAirMassFlowRate, - DXCoil(DXCoilNum).InletAirTemp, - DXCoil(DXCoilNum).InletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate, // this is the report variable + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, // this is the report variable + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat, RatedInletWetBulbTemp, - DXCoil(DXCoilNum).OutletAirTemp, - DXCoil(DXCoilNum).OutletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat, RatedOutletWetBulb, RatedOutdoorAirTemp, ratedOutdoorAirWetBulb, - DXCoil(DXCoilNum).RatedCBF(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode), -999.0); // coil effectiveness not define for DX // now replace the outdoor air conditions set above for one time rating point calc @@ -6305,31 +6203,31 @@ namespace DXCoils { state.dataEnvrn->OutBaroPress = holdOutBaroPress; } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { - for (DehumidModeNum = 0; DehumidModeNum <= DXCoil(DXCoilNum).NumDehumidModes; ++DehumidModeNum) { - for (CapacityStageNum = 1; CapacityStageNum <= DXCoil(DXCoilNum).NumCapacityStages; ++CapacityStageNum) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { + for (DehumidModeNum = 0; DehumidModeNum <= state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes; ++DehumidModeNum) { + for (CapacityStageNum = 1; CapacityStageNum <= state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages; ++CapacityStageNum) { Mode = DehumidModeNum * 2 + CapacityStageNum; // Check for zero capacity or zero max flow rate - if (DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { - ShowSevereError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { + ShowSevereError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + " has zero rated total capacity"); - ShowContinueError(state, "for CoilPerformance:DX:Cooling mode: " + DXCoil(DXCoilNum).CoilPerformanceName(Mode)); + ShowContinueError(state, "for CoilPerformance:DX:Cooling mode: " + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode)); ErrorsFound = true; } - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) <= 0.0) { - ShowSevereError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) <= 0.0) { + ShowSevereError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + " has zero rated air flow rate"); - ShowContinueError(state, "for CoilPerformance:DX:Cooling mode: " + DXCoil(DXCoilNum).CoilPerformanceName(Mode)); + ShowContinueError(state, "for CoilPerformance:DX:Cooling mode: " + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode)); ErrorsFound = true; } if (ErrorsFound) { ShowFatalError(state, "Preceding condition causes termination."); } // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) / DXCoil(DXCoilNum).RatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); if (((MinRatedVolFlowPerRatedTotCap(DXCT) - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) { - ShowWarningError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowWarningError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Rated air volume flow rate per watt of rated total cooling capacity is out of range."); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6337,34 +6235,34 @@ namespace DXCoils { MinRatedVolFlowPerRatedTotCap(DXCT), RatedVolFlowPerRatedTotCap, MaxRatedVolFlowPerRatedTotCap(DXCT))); - ShowContinueError(state, "for CoilPerformance:DX:Cooling mode: " + DXCoil(DXCoilNum).CoilPerformanceName(Mode)); + ShowContinueError(state, "for CoilPerformance:DX:Cooling mode: " + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode)); } - DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) = - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) * + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) = + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get rated coil bypass factor - DXCoil(DXCoilNum).RatedCBF(Mode) = CalcCBF(state, - DXCoil(DXCoilNum).CoilPerformanceType(Mode), - DXCoil(DXCoilNum).CoilPerformanceName(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode) = CalcCBF(state, + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceType(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode), RatedInletAirTemp, RatedInletAirHumRat, - DXCoil(DXCoilNum).RatedTotCap(Mode), - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode), - DXCoil(DXCoilNum).RatedSHR(Mode)); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode)); } // End capacity stages loop } // End dehumidification modes loop } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || - DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { Mode = 1; - if (DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { - ShowSevereError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + " has zero rated total capacity"); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { + ShowSevereError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + " has zero rated total capacity"); ErrorsFound = true; } - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) <= 0.0) { - ShowSevereError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + " has zero rated air flow rate"); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) <= 0.0) { + ShowSevereError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + " has zero rated air flow rate"); ErrorsFound = true; } if (ErrorsFound) { @@ -6372,17 +6270,17 @@ namespace DXCoils { } RatedHeatPumpIndoorAirTemp = 21.11; // 21.11C or 70F RatedHeatPumpIndoorHumRat = 0.00881; // Humidity ratio corresponding to 70F dry bulb/60F wet bulb - DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) = - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) * + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) = + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - if (DXCoil(DXCoilNum).DXCoilType_Num != + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { // the VolFlowPerRatedTotCap check is not applicable for VRF-FluidTCtrl coil - RatedVolFlowPerRatedTotCap = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) / DXCoil(DXCoilNum).RatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); if (((MinRatedVolFlowPerRatedTotCap(DXCT) - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) { - ShowWarningError(state, "Sizing: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + + ShowWarningError(state, "Sizing: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + ": Rated air volume flow rate per watt of rated total heating capacity is out of range."); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6394,14 +6292,14 @@ namespace DXCoils { } // call coil model with everthing set at rating point - DXCoil(DXCoilNum).InletAirMassFlowRate = DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); - DXCoil(DXCoilNum).InletAirMassFlowRateMax = DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); - DXCoil(DXCoilNum).InletAirTemp = RatedInletAirTempHeat; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp = RatedInletAirTempHeat; Real64 tempInletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedInletAirTempHeat, RatedInletWetBulbTempHeat, DataEnvironment::StdPressureSeaLevel, RoutineName); - DXCoil(DXCoilNum).InletAirHumRat = tempInletAirHumRat; - DXCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTempHeat, tempInletAirHumRat); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat = tempInletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTempHeat, tempInletAirHumRat); // store environment data fill back in after rating point calc is over Real64 holdOutDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; @@ -6417,40 +6315,40 @@ namespace DXCoils { state.dataEnvrn->OutHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedOutdoorAirTempHeat, ratedOutdoorAirWetBulb, DataEnvironment::StdPressureSeaLevel, RoutineName); - if (DXCoil(DXCoilNum).CondenserInletNodeNum(1) > 0) { // set condenser inlet node values - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = RatedOutdoorAirTempHeat; - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat = state.dataEnvrn->OutHumRat; - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).OutAirWetBulb = ratedOutdoorAirWetBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) > 0) { // set condenser inlet node values + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = RatedOutdoorAirTempHeat; + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat = state.dataEnvrn->OutHumRat; + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).OutAirWetBulb = ratedOutdoorAirWetBulb; } // calculate coil model at rating point - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { CalcDXHeatingCoil(state, DXCoilNum, 1.0, 1.0, 1.0); - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating) { CalcDXHeatingCoil(state, DXCoilNum, 1.0, 1.0, _, _); - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { CalcVRFHeatingCoil_FluidTCtrl(state, 1.0, DXCoilNum, 1.0, 1.0, _, _); } // coil outlets Real64 RatedOutletWetBulb(0.0); RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - DXCoil(DXCoilNum).OutletAirTemp, DXCoil(DXCoilNum).OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp, state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); coilSelectionReportObj->setRatedCoilConditions(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).TotalHeatingEnergyRate, // this is the report variable - DXCoil(DXCoilNum).TotalHeatingEnergyRate, // this is the report variable - DXCoil(DXCoilNum).InletAirMassFlowRate, - DXCoil(DXCoilNum).InletAirTemp, - DXCoil(DXCoilNum).InletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate, // this is the report variable + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate, // this is the report variable + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat, RatedInletWetBulbTempHeat, - DXCoil(DXCoilNum).OutletAirTemp, - DXCoil(DXCoilNum).OutletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat, RatedOutletWetBulb, RatedOutdoorAirTempHeat, ratedOutdoorAirWetBulb, - DXCoil(DXCoilNum).RatedCBF(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode), -999.0); // coil effectiveness not define for DX // now replace the outdoor air conditions set above for one time rating point calc @@ -6460,12 +6358,12 @@ namespace DXCoils { state.dataEnvrn->OutBaroPress = holdOutBaroPress; } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = DXCoil(DXCoilNum).RatedAirVolFlowRate2 / DXCoil(DXCoilNum).RatedTotCap2; + RatedVolFlowPerRatedTotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2 / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2; if (((MinRatedVolFlowPerRatedTotCap(DXCT) - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) { - ShowWarningError(state, "Coil:Cooling:DX:TwoSpeed \"" + DXCoil(DXCoilNum).Name + + ShowWarningError(state, "Coil:Cooling:DX:TwoSpeed \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": At low speed rated air volume flow rate per watt of rated total cooling capacity is out of range."); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6475,41 +6373,41 @@ namespace DXCoils { MaxRatedVolFlowPerRatedTotCap(DXCT))); } - DXCoil(DXCoilNum).RatedAirMassFlowRate2 = - DXCoil(DXCoilNum).RatedAirVolFlowRate2 * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate2 = + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2 * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get low speed rated coil bypass factor - DXCoil(DXCoilNum).RatedCBF2 = CalcCBF(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF2 = CalcCBF(state, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, RatedInletAirTemp, RatedInletAirHumRat, - DXCoil(DXCoilNum).RatedTotCap2, - DXCoil(DXCoilNum).RatedAirVolFlowRate2, - DXCoil(DXCoilNum).RatedSHR2); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR2); // call for standard ratings for two-speeed DX coil - if (DXCoil(DXCoilNum).CondenserType(1) == AirCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) == AirCooled) { CalcTwoSpeedDXCoilStandardRating(state, DXCoilNum); } } // Multispeed Cooling - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { // Check for zero capacity or zero max flow rate - if (DXCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) { ShowSevereError(state, format("Sizing: {} {} has zero rated total capacity at speed {}", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode)); ErrorsFound = true; } - if (DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) <= 0.0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) <= 0.0) { ShowSevereError(state, format("Sizing: {} {} has zero rated air flow rate at speed {}", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode)); ErrorsFound = true; } @@ -6517,15 +6415,15 @@ namespace DXCoils { ShowFatalError(state, "Preceding condition causes termination."); } // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / DXCoil(DXCoilNum).MSRatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode); if (((MinRatedVolFlowPerRatedTotCap(DXCT) - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) { ShowWarningError( state, format( "Sizing: {} \"{}\": Rated air volume flow rate per watt of rated total cooling capacity is out of range at speed {}", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode)); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6534,38 +6432,38 @@ namespace DXCoils { RatedVolFlowPerRatedTotCap, MaxRatedVolFlowPerRatedTotCap(DXCT))); } - DXCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); // get high speed rated coil bypass factor - DXCoil(DXCoilNum).MSRatedCBF(Mode) = CalcCBF(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF(Mode) = CalcCBF(state, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, RatedInletAirTemp, RatedInletAirHumRat, - DXCoil(DXCoilNum).MSRatedTotCap(Mode), - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), - DXCoil(DXCoilNum).MSRatedSHR(Mode)); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode)); } } // Multispeed Heating - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { RatedHeatPumpIndoorAirTemp = 21.11; // 21.11C or 70F RatedHeatPumpIndoorHumRat = 0.00881; // Humidity ratio corresponding to 70F dry bulb/60F wet bulb - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { - DXCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / DXCoil(DXCoilNum).MSRatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode); if (((MinRatedVolFlowPerRatedTotCap(DXCT) - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest) || ((RatedVolFlowPerRatedTotCap - MaxRatedVolFlowPerRatedTotCap(DXCT)) > SmallDifferenceTest)) { ShowWarningError(state, format("Coil:Heating:DX:MultiSpeed {}: Rated air volume flow rate per watt of rated total heating capacity " "is out of range at speed {}", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode)); ShowContinueError(state, format("Min Rated Vol Flow Per Watt=[{:.3T}], Rated Vol Flow Per Watt=[{:.3T}], Max Rated Vol Flow Per " @@ -6578,70 +6476,70 @@ namespace DXCoils { } // store fan info for coil - if (DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { - if (DXCoil(DXCoilNum).SupplyFanIndex > -1) { + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex > -1) { coilSelectionReportObj->setCoilSupplyFanInfo(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).SupplyFanName, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, DataAirSystems::objectVectorOOFanSystemModel, - DXCoil(DXCoilNum).SupplyFanIndex); + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } } else { - if (DXCoil(DXCoilNum).SupplyFanIndex > 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex > 0) { coilSelectionReportObj->setCoilSupplyFanInfo(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).SupplyFanName, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, DataAirSystems::structArrayLegacyFanModels, - DXCoil(DXCoilNum).SupplyFanIndex); + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } } } - AirInletNode = DXCoil(DXCoilNum).AirInNode; + AirInletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirInNode; // Each iteration, load the coil data structure with the inlet conditions - DXCoil(DXCoilNum).InletAirMassFlowRate = Node(AirInletNode).MassFlowRate; - DXCoil(DXCoilNum).InletAirMassFlowRateMax = max(Node(AirInletNode).MassFlowRateMax, Node(AirInletNode).MassFlowRate); - DXCoil(DXCoilNum).InletAirTemp = Node(AirInletNode).Temp; - DXCoil(DXCoilNum).InletAirHumRat = Node(AirInletNode).HumRat; - DXCoil(DXCoilNum).InletAirEnthalpy = Node(AirInletNode).Enthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate = Node(AirInletNode).MassFlowRate; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax = max(Node(AirInletNode).MassFlowRateMax, Node(AirInletNode).MassFlowRate); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp = Node(AirInletNode).Temp; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat = Node(AirInletNode).HumRat; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy = Node(AirInletNode).Enthalpy; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // DXCoil(DXCoilNum)%InletAirPressure = Node(AirInletNode)%Press - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - DXCoil(DXCoilNum).EvapInletWetBulb = - PsyTwbFnTdbWPb(state, ZT(DXCoil(DXCoilNum).SecZonePtr), ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr), state.dataEnvrn->OutBaroPress, RoutineName); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb = + PsyTwbFnTdbWPb(state, ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr), ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr), state.dataEnvrn->OutBaroPress, RoutineName); } } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { - DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; - DXCoil(DXCoilNum).ElecWaterHeatingPower = 0.0; + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecWaterHeatingPower = 0.0; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // DXCoil(DXCoilNum)%InletAirPressure = StdBaroPress // HPWH's that use an inlet air temperature schedule also need to have a valid barometric pressure // The DX Coil used in HPWH's does not know if it is using a scheduled inlet temperature so check the node pressure - if (DXCoil(DXCoilNum).CondenserInletNodeNum(1) > 0) { - if (Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press == 0.0) { - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press = state.dataEnvrn->StdBaroPress; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) > 0) { + if (Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press == 0.0) { + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press = state.dataEnvrn->StdBaroPress; } } } - DXCoil(DXCoilNum).BasinHeaterPower = 0.0; - - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - DXCoil(DXCoilNum).CompressorPartLoadRatio = 0.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower = 0.0; + + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + state.dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; } } @@ -6809,18 +6707,18 @@ namespace DXCoils { // NOTE: we are sizing COIL:DX:HeatingEmpirical on the COOLING load. Thus the cooling and // and heating capacities of a DX heat pump system will be identical. In real life the AHRI // heating and cooling capacities are close but not identical. - for (DehumidModeNum = 0; DehumidModeNum <= DXCoil(DXCoilNum).NumDehumidModes; ++DehumidModeNum) { - for (CapacityStageNum = 1; CapacityStageNum <= DXCoil(DXCoilNum).NumCapacityStages; ++CapacityStageNum) { + for (DehumidModeNum = 0; DehumidModeNum <= state.dataDXCoils->DXCoil(DXCoilNum).NumDehumidModes; ++DehumidModeNum) { + for (CapacityStageNum = 1; CapacityStageNum <= state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages; ++CapacityStageNum) { Mode = DehumidModeNum * 2 + CapacityStageNum; - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { - if (DXCoil(DXCoilNum).RatedAirVolFlowRate(1) == DataGlobalConstants::AutoCalculate) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) == DataGlobalConstants::AutoCalculate) { // report autocalculated sizing PrintFlag = true; - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // DXCoil( DXCoilNum ).RatedAirVolFlowRate( 1 ) = DXCoil( DXCoilNum ).RatedTotCap2 * 0.00005035 - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap2; + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2; DataFractionUsedForSizing = 0.00005035; TempSize = AutoSize; AutoCalculateSizer sizerHPRatedAirVolFlow; @@ -6828,17 +6726,17 @@ namespace DXCoils { if (state.dataGlobal->isEpJSON) stringOverride = "rated_evaporator_air_flow_rate [m3/s]"; sizerHPRatedAirVolFlow.overrideSizingString(stringOverride); sizerHPRatedAirVolFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = sizerHPRatedAirVolFlow.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) = sizerHPRatedAirVolFlow.size(state, TempSize, ErrorsFound); PrintFlag = false; } - if (DXCoil(DXCoilNum).RatedHPWHCondWaterFlow == DataGlobalConstants::AutoCalculate) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow == DataGlobalConstants::AutoCalculate) { // report autocalculated sizing PrintFlag = true; - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // DXCoil( DXCoilNum ).RatedAirVolFlowRate( 1 ) = DXCoil( DXCoilNum ).RatedTotCap2 * 0.00000004487 - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap2; + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2; DataFractionUsedForSizing = 0.00000004487; TempSize = AutoSize; AutoCalculateSizer sizerHPWHCondWaterFlow; @@ -6846,74 +6744,74 @@ namespace DXCoils { if (state.dataGlobal->isEpJSON) stringOverride = "rated_condenser_water_flow_rate [m3/s]"; sizerHPWHCondWaterFlow.overrideSizingString(stringOverride); sizerHPWHCondWaterFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedHPWHCondWaterFlow = sizerHPWHCondWaterFlow.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedHPWHCondWaterFlow = sizerHPWHCondWaterFlow.size(state, TempSize, ErrorsFound); PrintFlag = false; } } else { PrintFlag = true; FieldNum = 0; - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { - CompName = DXCoil(DXCoilNum).Name + ":" + DXCoil(DXCoilNum).CoilPerformanceName(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name + ":" + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode); FieldNum = 4; - DataBypassFrac = DXCoil(DXCoilNum).BypassedFlowFrac(Mode); - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { - CompName = DXCoil(DXCoilNum).Name; + DataBypassFrac = state.dataDXCoils->DXCoil(DXCoilNum).BypassedFlowFrac(Mode); + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 3; // doesn't look like this is needed for air flow sizing, only for heating capacity sizing DataCoolCoilCap = DXCoolCap; // pass global variable used only for heat pumps (i.e., DX cooling and heating coils) - if ((DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) && - (DXCoil(DXCoilNum).CondenserType(1) == AirCooled)) { // seconday DX coil in secondary zone is specified + if ((state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) && + (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) == AirCooled)) { // seconday DX coil in secondary zone is specified SizeSecDXCoil = true; } - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating) { - CompName = DXCoil(DXCoilNum).Name; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 2; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling) { - CompName = DXCoil(DXCoilNum).Name; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 3; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { - CompName = DXCoil(DXCoilNum).Name; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { - CompName = DXCoil(DXCoilNum).Name; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(DXCoil(DXCoilNum).NumOfSpeeds); - CompName = DXCoil(DXCoilNum).Name; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; PrintFlag = false; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(DXCoil(DXCoilNum).NumOfSpeeds); - CompName = DXCoil(DXCoilNum).Name; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; PrintFlag = false; } else { - CompName = DXCoil(DXCoilNum).Name; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 4; } - TempSize = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); if (FieldNum > 0) { - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [m3/s]"; } else { SizingString = "Rated Air Flow Rate [m3/s]"; } - CompType = DXCoil(DXCoilNum).DXCoilType; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; DataIsDXCoil = true; - DataEMSOverrideON = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating || - DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating || DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { bool errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } else { bool errorsFound = false; CoolingAirFlowSizer sizingCoolingAirFlow; sizingCoolingAirFlow.overrideSizingString(SizingString); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode) = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } DataIsDXCoil = false; DataEMSOverrideON = false; @@ -6921,7 +6819,7 @@ namespace DXCoils { DataBypassFrac = 0.0; } - DataFlowUsedForSizing = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); + DataFlowUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); // get autosized air flow for capacity calc's if capacity is not autosized // *** RAR this if block is a last minute addition to correct capacity reporting when not autosized and a sizing run is done. Test // suite was not run with this code included. *** The question here is if the autosized air flow rate or the user specified air flow @@ -6958,37 +6856,37 @@ namespace DXCoils { // DataBypassFrac = 0.0; // } PrintFlag = true; - DataTotCapCurveIndex = DXCoil(DXCoilNum).CCapFTemp(Mode); - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { + DataTotCapCurveIndex = state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { SizingMethod = CoolingCapacitySizing; - CompName = DXCoil(DXCoilNum).Name + ":" + DXCoil(DXCoilNum).CoilPerformanceName(Mode); + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name + ":" + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode); FieldNum = 1; - TempSize = DXCoil(DXCoilNum).RatedTotCap(Mode); - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || - DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { SizingMethod = HeatingCapacitySizing; - CompName = DXCoil(DXCoilNum).Name; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 1; - TempSize = DXCoil(DXCoilNum).RatedTotCap(Mode); - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; DataCoolCoilCap = DXCoolCap; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { SizingMethod = CoolingCapacitySizing; - CompName = DXCoil(DXCoilNum).Name; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 1; - TempSize = DXCoil(DXCoilNum).RatedTotCap(Mode); - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; PrintFlag = false; - Node(DXCoil(DXCoilNum).WaterInNode).Temp = - DXCoil(DXCoilNum).RatedInletWaterTemp; // set the rated water inlet node for HPWHs for use in CalcHPWHDXCoil - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { + Node(state.dataDXCoils->DXCoil(DXCoilNum).WaterInNode).Temp = + state.dataDXCoils->DXCoil(DXCoilNum).RatedInletWaterTemp; // set the rated water inlet node for HPWHs for use in CalcHPWHDXCoil + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { SizingMethod = CoolingCapacitySizing; - CompName = DXCoil(DXCoilNum).Name; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 1; - TempSize = DXCoil(DXCoilNum).RatedTotCap(Mode); - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; if (CurZoneEqNum > 0) { CoilInTemp = ZoneSizingRunDone ? FinalZoneSizing(CurZoneEqNum).DesCoolCoilInTemp : 26; } else { @@ -6999,44 +6897,44 @@ namespace DXCoils { } } CalcVRFCoilCapModFac(state, 0, _, CompName, CoilInTemp, _, _, _, DataTotCapCurveValue); - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { SizingMethod = CoolingCapacitySizing; - CompName = DXCoil(DXCoilNum).Name; - FieldNum = 7 + (DXCoil(DXCoilNum).NumOfSpeeds - 1) * 13; - DataTotCapCurveIndex = DXCoil(DXCoilNum).MSCCapFTemp(DXCoil(DXCoilNum).NumOfSpeeds); - TempSize = DXCoil(DXCoilNum).MSRatedTotCap(DXCoil(DXCoilNum).NumOfSpeeds); + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + FieldNum = 7 + (state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1) * 13; + DataTotCapCurveIndex = state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); PrintFlag = false; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; - } else if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { SizingMethod = HeatingCapacitySizing; - CompName = DXCoil(DXCoilNum).Name; - FieldNum = 10 + (DXCoil(DXCoilNum).NumOfSpeeds - 1) * 5; - DataTotCapCurveIndex = DXCoil(DXCoilNum).MSCCapFTemp(DXCoil(DXCoilNum).NumOfSpeeds); - TempSize = DXCoil(DXCoilNum).MSRatedTotCap(DXCoil(DXCoilNum).NumOfSpeeds); + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + FieldNum = 10 + (state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1) * 5; + DataTotCapCurveIndex = state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); PrintFlag = false; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; } else { SizingMethod = CoolingCapacitySizing; - CompName = DXCoil(DXCoilNum).Name; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 1; - TempSize = DXCoil(DXCoilNum).RatedTotCap(Mode); - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; } - CompType = DXCoil(DXCoilNum).DXCoilType; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; DataIsDXCoil = true; - DataEMSOverrideON = DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || - DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Heating || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Heating) { HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedTotCap(Mode) = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); } else { CoolingCapacitySizer sizerCoolingCapacity; sizerCoolingCapacity.overrideSizingString(SizingString); sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedTotCap(Mode) = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); } DataIsDXCoil = false; DataFlowUsedForSizing = 0.0; @@ -7049,32 +6947,32 @@ namespace DXCoils { DataTotCapCurveValue = 0.0; // Cooling coil capacity - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl || DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling || - DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { - DXCoolCap = DXCoil(DXCoilNum).RatedTotCap(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { + DXCoolCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); } // Sizing DX cooling coil SHR - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl || DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling || - DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_Cooling || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilVRF_FluidTCtrl_Cooling) { - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { - CompName = DXCoil(DXCoilNum).Name + ":" + DXCoil(DXCoilNum).CoilPerformanceName(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name + ":" + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode); } else { - CompName = DXCoil(DXCoilNum).Name; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; } - CompType = DXCoil(DXCoilNum).DXCoilType; - TempSize = DXCoil(DXCoilNum).RatedSHR(Mode); + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode); DataDXSpeedNum = Mode; - DataFlowUsedForSizing = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); - DataCapacityUsedForSizing = DXCoil(DXCoilNum).RatedTotCap(Mode); - DataEMSOverrideON = DXCoil(DXCoilNum).RatedSHREMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedSHREMSOverrideValue(Mode); + DataFlowUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); + DataCapacityUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedSHREMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedSHREMSOverrideValue(Mode); bool ErrorsFound = false; sizerCoolingSHR.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedSHR(Mode) = sizerCoolingSHR.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode) = sizerCoolingSHR.size(state, TempSize, ErrorsFound); DataDXSpeedNum = 0; DataFlowUsedForSizing = 0.0; DataCapacityUsedForSizing = 0.0; @@ -7084,18 +6982,18 @@ namespace DXCoils { } // End of Rated SHR // Sizing evaporator condenser air flow - if (DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && DXCoil(DXCoilNum).EvapCondAirFlow(Mode) != 0.0 && - (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl)) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode) != 0.0 && + (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl)) { AutoCalculateSizer sizerEvapCondAirFlow; std::string stringOverride = "Evaporative Condenser Air Flow Rate [m3/s]"; if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_air_flow_rate [m3/s]"; - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { - CompName = DXCoil(DXCoilNum).Name + ":" + DXCoil(DXCoilNum).CoilPerformanceName(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name + ":" + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode); } else { - CompName = DXCoil(DXCoilNum).Name; - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { stringOverride = "High Speed Evaporative Condenser Air Flow Rate [m3/s]"; if (state.dataGlobal->isEpJSON) stringOverride = "high_speed_evaporative_condenser_air_flow_rate [m3/s]"; } else { @@ -7103,42 +7001,42 @@ namespace DXCoils { if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_air_flow_rate [m3/s]"; } } - CompType = DXCoil(DXCoilNum).DXCoilType; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton) - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap(Mode); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); DataFractionUsedForSizing = 0.000114; - TempSize = DXCoil(DXCoilNum).EvapCondAirFlow(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode); sizerEvapCondAirFlow.overrideSizingString(stringOverride); sizerEvapCondAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).EvapCondAirFlow(Mode) = sizerEvapCondAirFlow.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode) = sizerEvapCondAirFlow.size(state, TempSize, ErrorsFound); } if (SizeSecDXCoil) { // autosize secondary coil air flow rate for AirCooled condenser type IsAutoSize = false; - if (DXCoil(DXCoilNum).SecCoilAirFlow == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow == AutoSize) { IsAutoSize = true; } // Auto size Primary Coil Air Flow * Secondary Coil Scaling Factor - SecCoilAirFlowDes = DXCoil(DXCoilNum).RatedAirVolFlowRate(1) * DXCoil(DXCoilNum).SecCoilAirFlowScalingFactor; + SecCoilAirFlowDes = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1) * state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlowScalingFactor; if (IsAutoSize) { - DXCoil(DXCoilNum).SecCoilAirFlow = SecCoilAirFlowDes; - BaseSizer::reportSizerOutput(state, DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow = SecCoilAirFlowDes; + BaseSizer::reportSizerOutput(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, "Design Size Secondary Coil Air Flow Rate [m3/s]", SecCoilAirFlowDes); } else { - if (DXCoil(DXCoilNum).SecCoilAirFlow > 0.0 && SecCoilAirFlowDes > 0.0 && !HardSizeNoDesRun) { - SecCoilAirFlowUser = DXCoil(DXCoilNum).SecCoilAirFlow; - BaseSizer::reportSizerOutput(state, DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + if (state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow > 0.0 && SecCoilAirFlowDes > 0.0 && !HardSizeNoDesRun) { + SecCoilAirFlowUser = state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow; + BaseSizer::reportSizerOutput(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, "Design Size Secondary Coil Air Flow Rate [m3/s]", SecCoilAirFlowDes, "User-Specified Secondary Coil Air Flow Rate [m3/s]", SecCoilAirFlowUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(SecCoilAirFlowDes - SecCoilAirFlowUser) / SecCoilAirFlowUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + DXCoil(DXCoilNum).DXCoilType + ' ' + - DXCoil(DXCoilNum).Name); + ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + + state.dataDXCoils->DXCoil(DXCoilNum).Name); ShowContinueError(state, format("User-Specified Secondary Coil Air Flow Rate of {:.5R} [m3/s]", SecCoilAirFlowUser)); ShowContinueError( @@ -7153,38 +7051,38 @@ namespace DXCoils { // Sizing evaporative condenser air flow 2 PrintFlag = true; - if (DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && DXCoil(DXCoilNum).EvapCondAirFlow2 != 0.0 && - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { - CompName = DXCoil(DXCoilNum).Name; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2 != 0.0 && + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 15; // Low Speed Evaporative Condenser Air Flow Rate - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [m3/s]"; SizingMethod = AutoCalculateSizing; - CompType = DXCoil(DXCoilNum).DXCoilType; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size low speed condenser air flow to 1/3 Total Capacity * 0.000114 m3/s/w (850 cfm/ton) - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap(Mode); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); DataFractionUsedForSizing = 0.000114 * 0.3333; - TempSize = DXCoil(DXCoilNum).EvapCondAirFlow2; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2; AutoCalculateSizer sizerEvapCondAirFlow2; std::string stringOverride = "Low Speed Evaporative Condenser Air Flow Rate [m3/s]"; if (state.dataGlobal->isEpJSON) stringOverride = "low_speed_evaporative_condenser_air_flow_rate [m3/s]"; sizerEvapCondAirFlow2.overrideSizingString(stringOverride); sizerEvapCondAirFlow2.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).EvapCondAirFlow2 = sizerEvapCondAirFlow2.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2 = sizerEvapCondAirFlow2.size(state, TempSize, ErrorsFound); } // Sizing evaporative condenser pump electric nominal power - if (DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) != 0.0 && - (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl)) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) != 0.0 && + (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl)) { AutoCalculateSizer sizerEvapCondPumpPower; std::string stringOverride = "Evaporative Condenser Pump Rated Power Consumption [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_pump_rated_power_consumption [W]"; - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { - CompName = DXCoil(DXCoilNum).Name + ":" + DXCoil(DXCoilNum).CoilPerformanceName(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name + ":" + state.dataDXCoils->DXCoil(DXCoilNum).CoilPerformanceName(Mode); } else { - CompName = DXCoil(DXCoilNum).Name; - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { stringOverride = "High Speed Evaporative Condenser Pump Rated Power Consumption [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "high_speed_evaporative_condenser_pump_rated_power_consumption [W]"; } else { @@ -7193,144 +7091,144 @@ namespace DXCoils { } } SizingMethod = AutoCalculateSizing; - CompType = DXCoil(DXCoilNum).DXCoilType; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size high speed evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap(Mode); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); DataFractionUsedForSizing = 0.004266; - TempSize = DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode); sizerEvapCondPumpPower.overrideSizingString(stringOverride); sizerEvapCondPumpPower.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) = sizerEvapCondPumpPower.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) = sizerEvapCondPumpPower.size(state, TempSize, ErrorsFound); } // Sizing low speed evaporative condenser pump electric nominal power - if (DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 != 0.0 && - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) == EvapCooled && state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 != 0.0 && + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size low speed evap condenser pump power to 1/3 Total Capacity * 0.004266 w/w (15 w/ton) - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap(Mode); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); DataFractionUsedForSizing = 0.004266 * 0.3333; - TempSize = DXCoil(DXCoilNum).EvapCondPumpElecNomPower2; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2; AutoCalculateSizer sizerEvapCondPumpPower2; std::string stringOverride = "Low Speed Evaporative Condenser Pump Rated Power Consumption [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "low_speed_evaporative_condenser_pump_rated_power_consumption [W]"; sizerEvapCondPumpPower2.overrideSizingString(stringOverride); sizerEvapCondPumpPower2.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 = sizerEvapCondPumpPower2.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 = sizerEvapCondPumpPower2.size(state, TempSize, ErrorsFound); } // // Sizing rated low speed air flow rate - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size low speed air flow rate to 1/3 high speed air flow rate - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode); DataFractionUsedForSizing = 0.3333; - TempSize = DXCoil(DXCoilNum).RatedAirVolFlowRate2; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2; AutoCalculateSizer sizerLowSpdAirFlow; std::string stringOverride = "Low Speed Rated Air Flow Rate [m3/s]"; if (state.dataGlobal->isEpJSON) stringOverride = "low_speed_rated_air_flow_rate [m3/s]"; sizerLowSpdAirFlow.overrideSizingString(stringOverride); sizerLowSpdAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedAirVolFlowRate2 = sizerLowSpdAirFlow.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2 = sizerLowSpdAirFlow.size(state, TempSize, ErrorsFound); } // // Sizing rated low speed total cooling capacity - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size low speed capacity to 1/3 high speed capacity - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap(Mode); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); DataFractionUsedForSizing = 0.3333; - TempSize = DXCoil(DXCoilNum).RatedTotCap2; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2; AutoCalculateSizer sizerLowSpdCap; std::string stringOverride = "Low Speed Gross Rated Total Cooling Capacity [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "low_speed_gross_rated_total_cooling_capacity [W]"; sizerLowSpdCap.overrideSizingString(stringOverride); sizerLowSpdCap.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedTotCap2 = sizerLowSpdCap.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 = sizerLowSpdCap.size(state, TempSize, ErrorsFound); } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { - if (DXCoil(DXCoilNum).EvapCondAirFlow2 > DXCoil(DXCoilNum).EvapCondAirFlow(Mode)) { - ShowSevereError(state, "SizeDXCoil: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2 > state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode)) { + ShowSevereError(state, "SizeDXCoil: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + ", Evaporative Condenser low speed air flow must be less than or equal to high speed air flow."); ShowContinueError( - state, format("Instead, {:.2R} > {:.2R}", DXCoil(DXCoilNum).EvapCondAirFlow2, DXCoil(DXCoilNum).EvapCondAirFlow(Mode))); + state, format("Instead, {:.2R} > {:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2, state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode))); ShowFatalError(state, "Preceding conditions cause termination."); } - if (DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 > DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode)) { - ShowSevereError(state, "SizeDXCoil: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 > state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode)) { + ShowSevereError(state, "SizeDXCoil: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + ", Evaporative Condenser low speed pump power must be less than or equal to high speed pump power."); ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", - DXCoil(DXCoilNum).EvapCondPumpElecNomPower2, - DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode))); + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2, + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode))); ShowFatalError(state, "Preceding conditions cause termination."); } - if (DXCoil(DXCoilNum).RatedTotCap2 > DXCoil(DXCoilNum).RatedTotCap(Mode)) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 > state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode)) { ShowSevereError(state, - "SizeDXCoil: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + + "SizeDXCoil: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + ", Rated Total Cooling Capacity, Low Speed must be less than or equal to Rated Total Cooling Capacity, High Speed."); ShowContinueError(state, - format("Instead, {:.2R} > {:.2R}", DXCoil(DXCoilNum).RatedTotCap2, DXCoil(DXCoilNum).RatedTotCap(Mode))); + format("Instead, {:.2R} > {:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode))); ShowFatalError(state, "Preceding conditions cause termination."); } - if (DXCoil(DXCoilNum).RatedAirVolFlowRate2 > DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode)) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2 > state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode)) { ShowFatalError(state, - "SizeDXCoil: " + DXCoil(DXCoilNum).DXCoilType + ' ' + DXCoil(DXCoilNum).Name + + "SizeDXCoil: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + state.dataDXCoils->DXCoil(DXCoilNum).Name + ", Rated Air Volume Flow Rate, low speed must be less than or equal to Rated Air Volume Flow Rate, high speed."); ShowContinueError( state, - format("Instead, {:.2R} > {:.2R}", DXCoil(DXCoilNum).RatedAirVolFlowRate2, DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode))); + format("Instead, {:.2R} > {:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate2, state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(Mode))); ShowFatalError(state, "Preceding conditions cause termination."); } } // // Sizing rated low speed SHR2 - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { - CompName = DXCoil(DXCoilNum).Name; + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; FieldNum = 7; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum); SizingMethod = AutoCalculateSizing; - CompType = DXCoil(DXCoilNum).DXCoilType; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size low speed SHR to be the same as high speed SHR - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedSHR(Mode); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode); DataFractionUsedForSizing = 1.0; DataDXSpeedNum = 2; // refers to low speed in sizer bool ErrorsFound = false; - TempSize = DXCoil(DXCoilNum).RatedSHR2; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR2; sizerCoolingSHR.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).RatedSHR2 = sizerCoolingSHR.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR2 = sizerCoolingSHR.size(state, TempSize, ErrorsFound); DataConstantUsedForSizing = 0.0; DataFractionUsedForSizing = 0.0; DataDXSpeedNum = 0; } // // Sizing resistive defrost heater capacity - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating && - DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_MultiSpeedHeating) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating && + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_MultiSpeedHeating) { // IF (DXCoil(DXCoilNum)%DXCoilType_Num == CoilDX_MultiSpeedHeating .OR. & // DXCoil(DXCoilNum)%DXCoilType_Num == Coil_HeatingAirToAirVariableSpeed) THEN - if (DXCoil(DXCoilNum).DefrostStrategy == Resistive) { - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == Resistive) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Auto size low speed capacity to 1/3 high speed capacity DataConstantUsedForSizing = DXCoolCap; DataFractionUsedForSizing = 1.0; - TempSize = DXCoil(DXCoilNum).DefrostCapacity; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity; AutoCalculateSizer sizerResDefCap; std::string stringOverride = "Resistive Defrost Heater Capacity [W]"; if (state.dataGlobal->isEpJSON) stringOverride = "resistive_defrost_heater_capacity [W]"; sizerResDefCap.overrideSizingString(stringOverride); sizerResDefCap.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).DefrostCapacity = sizerResDefCap.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity = sizerResDefCap.size(state, TempSize, ErrorsFound); } else { - DXCoil(DXCoilNum).DefrostCapacity = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity = 0.0; } } @@ -7338,30 +7236,30 @@ namespace DXCoils { } // End dehumidification modes loop // Autosizing for multispeed cooling coil - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling) { // flow rate auto size - for (Mode = DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + for (Mode = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { // Sizing multispeed air volume flow rate IsAutoSize = false; - if (DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) == AutoSize) { IsAutoSize = true; } DataSizing::DataIsDXCoil = true; - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; - if (Mode == DXCoil(DXCoilNum).NumOfSpeeds) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; + if (Mode == state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) { FieldNum = 10 + (Mode - 1) * 13; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; - TempSize = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); - DataEMSOverrideON = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); bool errorsFound = false; CoolingAirFlowSizer sizingCoolingAirFlow; sizingCoolingAirFlow.overrideSizingString(SizingString); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); TempSize = sizingCoolingAirFlow.size(state, TempSize, errorsFound); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = TempSize; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = TempSize; DataEMSOverrideON = false; DataEMSOverride = 0.0; if (!IsAutoSize && !HardSizeNoDesRun) { @@ -7376,22 +7274,22 @@ namespace DXCoils { } } else { FieldNum = 10 + (Mode - 1) * 13; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; if (IsAutoSize || !HardSizeNoDesRun) { SizingMethod = AutoCalculateSizing; // Auto size low speed flow to fraction of the highest speed flow - DataConstantUsedForSizing = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(DXCoil(DXCoilNum).NumOfSpeeds); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); if (!IsAutoSize && !HardSizeNoDesRun) DataConstantUsedForSizing = MSRatedAirVolFlowRateDes; - DataFractionUsedForSizing = (float)Mode / DXCoil(DXCoilNum).NumOfSpeeds; + DataFractionUsedForSizing = (float)Mode / state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; } - TempSize = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); - DataEMSOverrideON = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); bool errorsFound = false; CoolingAirFlowSizer sizingCoolingAirFlow; sizingCoolingAirFlow.overrideSizingString(SizingString); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, bPRINT, RoutineName); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } DataEMSOverride = 0.0; DataEMSOverrideON = false; @@ -7402,42 +7300,42 @@ namespace DXCoils { } // Ensure flow rate at lower speed must be lower or equal to the flow rate at higher speed. Otherwise, a severe error is isssued. - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) > DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1)) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) > state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1)) { ShowWarningError( state, format("SizeDXCoil: {} {}, Speed {} Rated Air Flow Rate must be less than or equal to Speed {} Rated Air Flow Rate.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode, Mode + 1)); ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1))); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } // Sizing multispeed rated total cooling capacity - for (Mode = DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + for (Mode = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { IsAutoSize = false; - if (DXCoil(DXCoilNum).MSRatedTotCap(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) == AutoSize) { IsAutoSize = true; } - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; DataSizing::DataIsDXCoil = true; - DataSizing::DataTotCapCurveIndex = DXCoil(DXCoilNum).MSCCapFTemp(Mode); - if (Mode == DXCoil(DXCoilNum).NumOfSpeeds) { + DataSizing::DataTotCapCurveIndex = state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(Mode); + if (Mode == state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) { PrintFlag = true; - DataSizing::DataFlowUsedForSizing = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); + DataSizing::DataFlowUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); SizingMethod = CoolingCapacitySizing; FieldNum = 7 + (Mode - 1) * 13; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; - DataEMSOverrideON = DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); - MSRatedTotCapDesAtMaxSpeed = DXCoil(DXCoilNum).MSRatedTotCap(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); + MSRatedTotCapDesAtMaxSpeed = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode); if (!HardSizeNoDesRun) { PrintFlag = false; TempSize = DataSizing::AutoSize; @@ -7450,43 +7348,43 @@ namespace DXCoils { DataConstantUsedForSizing = TempSize; DataFractionUsedForSizing = 1.0; MSRatedTotCapDesAtMaxSpeed = TempSize; - DXCoil(DXCoilNum).MSRatedTotCapDes(Mode) = TempSize; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCapDes(Mode) = TempSize; PrintFlag = true; } - TempSize = DXCoil(DXCoilNum).MSRatedTotCap(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode); CoolingCapacitySizer sizerCoolingCapacity2; sizerCoolingCapacity2.overrideSizingString(SizingString); sizerCoolingCapacity2.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); TempSize = sizerCoolingCapacity2.size(state, TempSize, ErrorsFound); - DXCoil(DXCoilNum).MSRatedTotCap(Mode) = TempSize; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) = TempSize; if (IsAutoSize) { MSRatedTotCapDesAtMaxSpeed = TempSize; - DXCoil(DXCoilNum).MSRatedTotCapDes(Mode) = TempSize; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCapDes(Mode) = TempSize; } } else { // cooling capacity at lower speeds PrintFlag = true; SizingMethod = CoolingCapacitySizing; FieldNum = 7 + (Mode - 1) * 13; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; if (IsAutoSize || !HardSizeNoDesRun) { SizingMethod = AutoCalculateSizing; // auto size low speed capacity to fraction of the highest speed capacity if (!HardSizeNoDesRun) { DataConstantUsedForSizing = MSRatedTotCapDesAtMaxSpeed; } else { - DataConstantUsedForSizing = DXCoil(DXCoilNum).MSRatedTotCap(DXCoil(DXCoilNum).NumOfSpeeds); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); } - DataFractionUsedForSizing = (float)Mode / DXCoil(DXCoilNum).NumOfSpeeds; - DXCoil(DXCoilNum).MSRatedTotCapDes(Mode) = DataConstantUsedForSizing * DataFractionUsedForSizing; + DataFractionUsedForSizing = (float)Mode / state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCapDes(Mode) = DataConstantUsedForSizing * DataFractionUsedForSizing; } - TempSize = DXCoil(DXCoilNum).MSRatedTotCap(Mode); - DataEMSOverrideON = DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); CoolingCapacitySizer sizerCoolingCapacity; sizerCoolingCapacity.overrideSizingString(SizingString); sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).MSRatedTotCap(Mode) = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); } DataEMSOverride = 0.0; DataEMSOverrideON = false; @@ -7498,53 +7396,53 @@ namespace DXCoils { } // Ensure capacity at lower speed must be lower or equal to the capacity at higher speed. - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (DXCoil(DXCoilNum).MSRatedTotCap(Mode) > DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1)) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) > state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Total Cooling Capacity must be less than or equal to Speed {} Rated " "Total Cooling Capacity.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode, Mode + 1)); ShowContinueError( - state, format("Instead, {:.2R} > {:.2R}", DXCoil(DXCoilNum).MSRatedTotCap(Mode), DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1))); + state, format("Instead, {:.2R} > {:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode), state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } // Rated SHR - for (Mode = DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + for (Mode = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { IsAutoSize = false; - if (DXCoil(DXCoilNum).MSRatedSHR(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode) == AutoSize) { IsAutoSize = true; } - if (Mode == DXCoil(DXCoilNum).NumOfSpeeds) { - CompType = DXCoil(DXCoilNum).DXCoilType; - CompName = DXCoil(DXCoilNum).Name; - TempSize = DXCoil(DXCoilNum).MSRatedSHR(Mode); + if (Mode == state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) { + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode); DataFlowUsedForSizing = MSRatedAirVolFlowRateDes; DataCapacityUsedForSizing = MSRatedTotCapDesAtMaxSpeed; - DataEMSOverrideON = DXCoil(DXCoilNum).RatedSHREMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedSHREMSOverrideValue(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedSHREMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedSHREMSOverrideValue(Mode); bool ErrorsFound = false; DataDXSpeedNum = Mode; sizerCoolingSHR.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).MSRatedSHR(Mode) = sizerCoolingSHR.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode) = sizerCoolingSHR.size(state, TempSize, ErrorsFound); // added for rated sensible cooling capacity estimate for html reporting, issue #7381 - DXCoil(DXCoilNum).RatedSHR(1) = DXCoil(DXCoilNum).MSRatedSHR(Mode); + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1) = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode); // design SHR value at the maxiumum speed calculated above was supposed to be used for all speeds // Now user specified SHR value is used when the SHR field is not autosized and design day run is // set to yes unless the code below is commented out - MSRatedSHRDes = DXCoil(DXCoilNum).MSRatedSHR(Mode); + MSRatedSHRDes = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode); } else { - TempSize = DXCoil(DXCoilNum).MSRatedSHR(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode); bool ErrorsFound = false; DataDXSpeedNum = Mode; DataFractionUsedForSizing = MSRatedSHRDes; DataConstantUsedForSizing = 1.0; sizerCoolingSHR.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - DXCoil(DXCoilNum).MSRatedSHR(Mode) = sizerCoolingSHR.size(state, TempSize, ErrorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode) = sizerCoolingSHR.size(state, TempSize, ErrorsFound); } } DataFlowUsedForSizing = 0.0; @@ -7556,39 +7454,39 @@ namespace DXCoils { DataConstantUsedForSizing = 0.0; // Rated Evapovative condenser airflow rates - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { IsAutoSize = false; - if (DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) == AutoSize) { IsAutoSize = true; } if (IsAutoSize || !HardSizeNoDesRun) { // Auto size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton) - MSEvapCondAirFlowDes = ((float)Mode / DXCoil(DXCoilNum).NumOfSpeeds) * MSRatedTotCapDesAtMaxSpeed * 0.000114; + MSEvapCondAirFlowDes = ((float)Mode / state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) * MSRatedTotCapDesAtMaxSpeed * 0.000114; } else { // this is done to duplicate any existing calc method - MSEvapCondAirFlowDes = DXCoil(DXCoilNum).MSRatedTotCap(Mode) * 0.000114; + MSEvapCondAirFlowDes = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) * 0.000114; } if (IsAutoSize) { - DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) = MSEvapCondAirFlowDes; + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) = MSEvapCondAirFlowDes; BaseSizer::reportSizerOutput(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, format("Design Size Speed {} Evaporative Condenser Air Flow Rate [m3/s]", Mode), MSEvapCondAirFlowDes); } else { - if (DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) > 0.0 && MSEvapCondAirFlowDes > 0.0 && !HardSizeNoDesRun) { - MSEvapCondAirFlowUser = DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) > 0.0 && MSEvapCondAirFlowDes > 0.0 && !HardSizeNoDesRun) { + MSEvapCondAirFlowUser = state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode); BaseSizer::reportSizerOutput(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, format("Design Size Speed {} Evaporative Condenser Air Flow Rate [m3/s]", Mode), MSEvapCondAirFlowDes, format("User-Specified Speed {} Evaporative Condenser Air Flow Rate [m3/s]", Mode), MSEvapCondAirFlowUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(MSEvapCondAirFlowDes - MSEvapCondAirFlowUser) / MSEvapCondAirFlowUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + DXCoil(DXCoilNum).DXCoilType + ' ' + - DXCoil(DXCoilNum).Name); + ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + + state.dataDXCoils->DXCoil(DXCoilNum).Name); ShowContinueError( state, format("User-Specified Evaporative Condenser Air Flow Rate of {:.5R} [m3/s]", MSEvapCondAirFlowUser)); ShowContinueError( @@ -7603,50 +7501,50 @@ namespace DXCoils { } // Ensure evaporative condenser airflow rate at lower speed must be lower or equal to one at higher speed. - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) > DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode + 1)) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode) > state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Evaporative Condenser Air Flow Rate must be less than or equal to Speed {} " "Evaporative Condenser Air Flow Rate.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode, Mode + 1)); ShowContinueError( state, - format("Instead, {:.2R} > {:.2R}", DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode), DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode + 1))); + format("Instead, {:.2R} > {:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode), state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } // Sizing multispeed rated evapovative condenser pump power - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { IsAutoSize = false; - if (DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) == AutoSize) { IsAutoSize = true; } if (IsAutoSize || !HardSizeNoDesRun) { // Auto size low speed evap condenser pump power to 1/3 Total Capacity * 0.004266 w/w (15 w/ton) - MSEvapCondPumpElecNomPowerDes = ((float)Mode / DXCoil(DXCoilNum).NumOfSpeeds) * MSRatedTotCapDesAtMaxSpeed * 0.004266; + MSEvapCondPumpElecNomPowerDes = ((float)Mode / state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) * MSRatedTotCapDesAtMaxSpeed * 0.004266; } else { // this is done to duplicate any existing calc method - MSEvapCondPumpElecNomPowerDes = DXCoil(DXCoilNum).MSRatedTotCap(Mode) * 0.004266; + MSEvapCondPumpElecNomPowerDes = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) * 0.004266; } // Design Size data is always available if (IsAutoSize) { - DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) = MSEvapCondPumpElecNomPowerDes; + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) = MSEvapCondPumpElecNomPowerDes; BaseSizer::reportSizerOutput(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, format("Design Size Speed {} Rated Evaporative Condenser Pump Power Consumption [W]", Mode), MSEvapCondPumpElecNomPowerDes); } else { - if (DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) > 0.0 && MSEvapCondPumpElecNomPowerDes > 0.0 && !HardSizeNoDesRun) { - MSEvapCondPumpElecNomPowerUser = DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) > 0.0 && MSEvapCondPumpElecNomPowerDes > 0.0 && !HardSizeNoDesRun) { + MSEvapCondPumpElecNomPowerUser = state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode); BaseSizer::reportSizerOutput(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, format("Design Size Speed {} Rated Evaporative Condenser Pump Power Consumption [W]", Mode), MSEvapCondPumpElecNomPowerDes, format("User-Specified Speed {} Rated Evaporative Condenser Pump Power Consumption [W]", Mode), @@ -7654,8 +7552,8 @@ namespace DXCoils { if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(MSEvapCondPumpElecNomPowerDes - MSEvapCondPumpElecNomPowerUser) / MSEvapCondPumpElecNomPowerUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + DXCoil(DXCoilNum).DXCoilType + ' ' + - DXCoil(DXCoilNum).Name); + ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + + state.dataDXCoils->DXCoil(DXCoilNum).Name); ShowContinueError(state, format("User-Specified Evaporative Condenser Pump Rated Power Consumption of {:.2R} [W]", MSEvapCondPumpElecNomPowerUser)); @@ -7671,48 +7569,48 @@ namespace DXCoils { } // Ensure evaporative condesner pump power at lower speed must be lower or equal to one at higher speed. - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) > DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode + 1)) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode) > state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Evaporative Condenser Pump Power Consumption must be less than or " "equal to Speed {} Rated Evaporative Condenser Pump Power Consumption.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode, Mode + 1)); ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", - DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode), - DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode + 1))); + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } } // Autosizing for multispeed heating coil - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { // flow rate auto size - for (Mode = DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + for (Mode = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { IsAutoSize = false; - if (DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) == AutoSize) { IsAutoSize = true; } DataSizing::DataIsDXCoil = true; - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; // Sizing rated air flow rate - if (Mode == DXCoil(DXCoilNum).NumOfSpeeds) { + if (Mode == state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) { FieldNum = 12 + (Mode - 1) * 5; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; - TempSize = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); - DataEMSOverrideON = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideON(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRateEMSOverrideValue(Mode); bool errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, bPRINT, RoutineName); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = sizingHeatingAirFlow.size(state, TempSize, errorsFound); if (!IsAutoSize && !HardSizeNoDesRun) { TempSize = AutoSize; bPRINT = false; @@ -7726,21 +7624,21 @@ namespace DXCoils { } } else { FieldNum = 12 + (Mode - 1) * 5; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; if (IsAutoSize || !HardSizeNoDesRun) { SizingMethod = AutoCalculateSizing; // Auto size low speed flow to fraction of the highest speed capacity - DataConstantUsedForSizing = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(DXCoil(DXCoilNum).NumOfSpeeds); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); if (!IsAutoSize && !HardSizeNoDesRun) DataConstantUsedForSizing = MSRatedAirVolFlowRateDes; - DataFractionUsedForSizing = (float)Mode / DXCoil(DXCoilNum).NumOfSpeeds; + DataFractionUsedForSizing = (float)Mode / state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; } - TempSize = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); bool errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, bPRINT, RoutineName); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } DataEMSOverride = 0.0; DataEMSOverrideON = false; @@ -7751,52 +7649,52 @@ namespace DXCoils { } // Ensure flow rate at lower speed must be lower or equal to the flow rate at higher speed. Otherwise, a severe error is isssued. - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) > DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1)) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) > state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1)) { ShowWarningError( state, format("SizeDXCoil: {} {}, Speed {} Rated Air Flow Rate must be less than or equal to Speed {} Rated Air Flow Rate.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode, Mode + 1)); ShowContinueError(state, format("Instead, {:.2R} > {:.2R}", - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1))); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } // Rated Secondary Coil Airflow Rates for AirCooled condenser type - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - for (Mode = DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + for (Mode = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { IsAutoSize = false; - if (DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode) == AutoSize) { IsAutoSize = true; } // Auto size Primary Coil air flow * Secondary Coil Scaling Factor - SecCoilAirFlowDes = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * DXCoil(DXCoilNum).MSSecCoilAirFlowScalingFactor(Mode); + SecCoilAirFlowDes = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlowScalingFactor(Mode); if (IsAutoSize) { - DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode) = SecCoilAirFlowDes; + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode) = SecCoilAirFlowDes; BaseSizer::reportSizerOutput(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, format("Design Size Speed {} Secondary Coil Air Flow Rate [m3/s]", Mode), SecCoilAirFlowDes); } else { - if (DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode) > 0.0 && SecCoilAirFlowDes > 0.0 && !HardSizeNoDesRun) { - SecCoilAirFlowUser = DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode) > 0.0 && SecCoilAirFlowDes > 0.0 && !HardSizeNoDesRun) { + SecCoilAirFlowUser = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(Mode); BaseSizer::reportSizerOutput(state, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, format("Design Size Speed {} Secondary Coil Air Flow Rate [m3/s]", Mode), SecCoilAirFlowDes, format("User-Specified Speed {} Secondary Coil Air Flow Rate [m3/s]", Mode), SecCoilAirFlowUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(SecCoilAirFlowDes - SecCoilAirFlowUser) / SecCoilAirFlowUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + DXCoil(DXCoilNum).DXCoilType + ' ' + - DXCoil(DXCoilNum).Name); + ShowMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + + state.dataDXCoils->DXCoil(DXCoilNum).Name); ShowContinueError(state, format("User-Specified Secondary Coil Air Flow Rate of {:.5R} [m3/s]", SecCoilAirFlowUser)); ShowContinueError( @@ -7811,34 +7709,34 @@ namespace DXCoils { } // Sizing rated total heating capacity - for (Mode = DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + for (Mode = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { IsAutoSize = false; - if (DXCoil(DXCoilNum).MSRatedTotCap(Mode) == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) == AutoSize) { IsAutoSize = true; } DataSizing::DataIsDXCoil = true; - CompName = DXCoil(DXCoilNum).Name; - CompType = DXCoil(DXCoilNum).DXCoilType; - if (Mode == DXCoil(DXCoilNum).NumOfSpeeds) { + CompName = state.dataDXCoils->DXCoil(DXCoilNum).Name; + CompType = state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType; + if (Mode == state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) { SizingMethod = HeatingCapacitySizing; - DataSizing::DataFlowUsedForSizing = DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); + DataSizing::DataFlowUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode); FieldNum = 10 + (Mode - 1) * 5; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; - DataTotCapCurveIndex = DXCoil(DXCoilNum).MSCCapFTemp(Mode); + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; + DataTotCapCurveIndex = state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(Mode); if (IsAutoSize || !HardSizeNoDesRun) { // Heating capacity is assumed to be equal to the cooling capacity PrintFlag = false; SizingMethod = AutoCalculateSizing; DataFractionUsedForSizing = 1.0; - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil > 0) { - NumOfSpeedCompanion = DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).NumOfSpeeds; - DataConstantUsedForSizing = DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).MSRatedTotCapDes(NumOfSpeedCompanion); + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil > 0) { + NumOfSpeedCompanion = state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).NumOfSpeeds; + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).MSRatedTotCapDes(NumOfSpeedCompanion); } else { - DataConstantUsedForSizing = DXCoil(DXCoilNum).RatedTotCap(1); // sized above + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1); // sized above } TempSize = DataSizing::AutoSize; - DataEMSOverrideON = DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); @@ -7848,14 +7746,14 @@ namespace DXCoils { DataFractionUsedForSizing = 1.0; } PrintFlag = true; - TempSize = DXCoil(DXCoilNum).MSRatedTotCap(Mode); - DataEMSOverrideON = DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); TempSize = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); - DXCoil(DXCoilNum).MSRatedTotCap(Mode) = TempSize; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) = TempSize; if (IsAutoSize) { MSRatedTotCapDesAtMaxSpeed = TempSize; } @@ -7863,25 +7761,25 @@ namespace DXCoils { PrintFlag = true; SizingMethod = HeatingCapacitySizing; FieldNum = 10 + (Mode - 1) * 5; - SizingString = DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; + SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; if (IsAutoSize || !HardSizeNoDesRun) { SizingMethod = AutoCalculateSizing; // auto size low speed capacity to fraction of the highest speed capacity if (!HardSizeNoDesRun) { DataConstantUsedForSizing = MSRatedTotCapDesAtMaxSpeed; } else { - DataConstantUsedForSizing = DXCoil(DXCoilNum).MSRatedTotCap(DXCoil(DXCoilNum).NumOfSpeeds); + DataConstantUsedForSizing = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); } - DataFractionUsedForSizing = (float)Mode / DXCoil(DXCoilNum).NumOfSpeeds; + DataFractionUsedForSizing = (float)Mode / state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; } - TempSize = DXCoil(DXCoilNum).MSRatedTotCap(Mode); - DataEMSOverrideON = DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); - DataEMSOverride = DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); + TempSize = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode); + DataEMSOverrideON = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideOn(Mode); + DataEMSOverride = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCapEMSOverrideValue(Mode); HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); TempSize = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); - DXCoil(DXCoilNum).MSRatedTotCap(Mode) = TempSize; + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) = TempSize; } PrintFlag = false; DataEMSOverrideON = false; @@ -7894,17 +7792,17 @@ namespace DXCoils { DataSizing::DataFractionUsedForSizing = 0.0; } // Ensure capacity at lower speed must be lower or equal to the capacity at higher speed. - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (DXCoil(DXCoilNum).MSRatedTotCap(Mode) > DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1)) { + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) > state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1)) { ShowWarningError(state, format("SizeDXCoil: {} {}, Speed {} Rated Total Heating Capacity must be less than or equal to Speed {} Rated " "Total Heating Capacity.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, Mode, Mode + 1)); ShowContinueError( - state, format("Instead, {:.2R} > {:.2R}", DXCoil(DXCoilNum).MSRatedTotCap(Mode), DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1))); + state, format("Instead, {:.2R} > {:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode), state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode + 1))); ShowFatalError(state, "Preceding conditions cause termination."); } } @@ -7912,31 +7810,31 @@ namespace DXCoils { // Resistive Defrost Heater Capacity = capacity at the first stage // Sizing defrost heater capacity IsAutoSize = false; - if (DXCoil(DXCoilNum).DefrostCapacity == AutoSize) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity == AutoSize) { IsAutoSize = true; } - if (DXCoil(DXCoilNum).DefrostStrategy == Resistive) { - DefrostCapacityDes = DXCoil(DXCoilNum).MSRatedTotCap(1); + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == Resistive) { + DefrostCapacityDes = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(1); } else { DefrostCapacityDes = 0.0; } if (IsAutoSize) { - DXCoil(DXCoilNum).DefrostCapacity = DefrostCapacityDes; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity = DefrostCapacityDes; BaseSizer::reportSizerOutput(state, - DXCoil(DXCoilNum).DXCoilType, DXCoil(DXCoilNum).Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes); + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, state.dataDXCoils->DXCoil(DXCoilNum).Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes); } else { - if (DXCoil(DXCoilNum).DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0 && !HardSizeNoDesRun) { - DefrostCapacityUser = DXCoil(DXCoilNum).DefrostCapacity; - BaseSizer::reportSizerOutput(state, DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0 && !HardSizeNoDesRun) { + DefrostCapacityUser = state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity; + BaseSizer::reportSizerOutput(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes, "User-Specified Resistive Defrost Heater Capacity", DefrostCapacityUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(DefrostCapacityDes - DefrostCapacityUser) / DefrostCapacityUser) > AutoVsHardSizingThreshold) { - ShowWarningMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + DXCoil(DXCoilNum).DXCoilType + ' ' + - DXCoil(DXCoilNum).Name); + ShowWarningMessage(state, "SizeDxCoil: Potential issue with equipment sizing for " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + ' ' + + state.dataDXCoils->DXCoil(DXCoilNum).Name); ShowContinueError(state, format("User-Specified Resistive Defrost Heater Capacity of {:.2R}[W]", DefrostCapacityUser)); ShowContinueError(state, format("differs from Design Size Resistive Defrost Heater Capacity of {:.2R}[W]", DefrostCapacityDes)); @@ -7949,89 +7847,89 @@ namespace DXCoils { } // Call routine that computes AHRI certified rating for single-speed DX Coils - if ((DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed && DXCoil(DXCoilNum).CondenserType(1) == AirCooled) || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { + if ((state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed && state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(1) == AirCooled) || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatingEmpirical) { CalcDXCoilStandardRating(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).DXCoilType_Num, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num, 1, - DXCoil(DXCoilNum).RatedTotCap(1), - DXCoil(DXCoilNum).RatedCOP(1), - DXCoil(DXCoilNum).CCapFFlow(1), - DXCoil(DXCoilNum).CCapFTemp(1), - DXCoil(DXCoilNum).EIRFFlow(1), - DXCoil(DXCoilNum).EIRFTemp(1), - DXCoil(DXCoilNum).PLFFPLR(1), - DXCoil(DXCoilNum).RatedAirVolFlowRate(1), - DXCoil(DXCoilNum).FanPowerPerEvapAirFlowRate(1), - DXCoil(DXCoilNum).RegionNum, - DXCoil(DXCoilNum).MinOATCompressor, - DXCoil(DXCoilNum).OATempCompressorOn, - DXCoil(DXCoilNum).OATempCompressorOnOffBlank, - DXCoil(DXCoilNum).DefrostControl, - DXCoil(DXCoilNum).ASHRAE127StdRprt); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1), + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), + state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1), + state.dataDXCoils->DXCoil(DXCoilNum).FanPowerPerEvapAirFlowRate(1), + state.dataDXCoils->DXCoil(DXCoilNum).RegionNum, + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor, + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOn, + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOnOffBlank, + state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl, + state.dataDXCoils->DXCoil(DXCoilNum).ASHRAE127StdRprt); } // Call routine that computes AHRI certified rating for multi-speed DX cooling Coils - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedCooling || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_MultiSpeedHeating) { CalcDXCoilStandardRating(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).DXCoilType_Num, - DXCoil(DXCoilNum).NumOfSpeeds, - DXCoil(DXCoilNum).MSRatedTotCap, - DXCoil(DXCoilNum).MSRatedCOP, - DXCoil(DXCoilNum).MSCCapFFlow, - DXCoil(DXCoilNum).MSCCapFTemp, - DXCoil(DXCoilNum).MSEIRFFlow, - DXCoil(DXCoilNum).MSEIRFTemp, - DXCoil(DXCoilNum).MSPLFFPLR, - DXCoil(DXCoilNum).MSRatedAirVolFlowRate, - DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate, - DXCoil(DXCoilNum).RegionNum, - DXCoil(DXCoilNum).MinOATCompressor, - DXCoil(DXCoilNum).OATempCompressorOn, - DXCoil(DXCoilNum).OATempCompressorOnOffBlank, - DXCoil(DXCoilNum).DefrostControl, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num, + state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds, + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap, + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP, + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow, + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow, + state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp, + state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR, + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate, + state.dataDXCoils->DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate, + state.dataDXCoils->DXCoil(DXCoilNum).RegionNum, + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor, + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOn, + state.dataDXCoils->DXCoil(DXCoilNum).OATempCompressorOnOffBlank, + state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl, ObjexxFCL::Optional_bool_const()); } // create predefined report entries - equipName = DXCoil(DXCoilNum).Name; + equipName = state.dataDXCoils->DXCoil(DXCoilNum).Name; // put tables for cooling and heating separate { - auto const SELECT_CASE_var(DXCoil(DXCoilNum).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num); if ((SELECT_CASE_var == CoilDX_CoolingSingleSpeed) || (SELECT_CASE_var == CoilDX_CoolingTwoSpeed) || (SELECT_CASE_var == CoilDX_CoolingTwoStageWHumControl) || (SELECT_CASE_var == CoilDX_MultiSpeedCooling)) { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilType, equipName, DXCoil(DXCoilNum).DXCoilType); - if (DXCoil(DXCoilNum).NumOfSpeeds == 0) { - if (DXCoil(DXCoilNum).NumCapacityStages == 1) { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, equipName, DXCoil(DXCoilNum).RatedTotCap(1)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSensCap, equipName, DXCoil(DXCoilNum).RatedTotCap(1) * DXCoil(DXCoilNum).RatedSHR(1)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilType, equipName, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType); + if (state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages == 1) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSensCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1)); PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilLatCap, equipName, - DXCoil(DXCoilNum).RatedTotCap(1) - DXCoil(DXCoilNum).RatedTotCap(1) * DXCoil(DXCoilNum).RatedSHR(1)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, equipName, DXCoil(DXCoilNum).RatedSHR(1)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, equipName, DXCoil(DXCoilNum).RatedCOP(1)); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) - state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1)); } else { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, equipName, DXCoil(DXCoilNum).RatedTotCap(2)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSensCap, equipName, DXCoil(DXCoilNum).RatedTotCap(2) * DXCoil(DXCoilNum).RatedSHR(2)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(2)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSensCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(2) * state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(2)); PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilLatCap, equipName, - DXCoil(DXCoilNum).RatedTotCap(2) - DXCoil(DXCoilNum).RatedTotCap(2) * DXCoil(DXCoilNum).RatedSHR(2)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, equipName, DXCoil(DXCoilNum).RatedSHR(2)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, equipName, DXCoil(DXCoilNum).RatedCOP(2)); + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(2) - state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(2) * state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(2)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(2)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(2)); } } else { - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, equipName, DXCoil(DXCoilNum).MSRatedTotCap(Mode)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSensCap, equipName, DXCoil(DXCoilNum).MSRatedTotCap(Mode) * DXCoil(DXCoilNum).MSRatedSHR(Mode)); + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSensCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode)); PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilLatCap, equipName, - DXCoil(DXCoilNum).MSRatedTotCap(Mode) - - DXCoil(DXCoilNum).MSRatedTotCap(Mode) * DXCoil(DXCoilNum).MSRatedSHR(Mode)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, equipName, DXCoil(DXCoilNum).MSRatedSHR(Mode)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, equipName, DXCoil(DXCoilNum).MSRatedCOP(Mode)); + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) - + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, equipName, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(Mode)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, equipName, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(Mode)); } } addFootNoteSubTable(state, @@ -8040,19 +7938,19 @@ namespace DXCoils { } else if ((SELECT_CASE_var == CoilDX_HeatingEmpirical) || (SELECT_CASE_var == CoilDX_MultiSpeedHeating) || (SELECT_CASE_var == CoilDX_HeatPumpWaterHeaterPumped) || (SELECT_CASE_var == CoilDX_HeatPumpWaterHeaterWrapped)) { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilType, equipName, DXCoil(DXCoilNum).DXCoilType); - if (DXCoil(DXCoilNum).NumOfSpeeds == 0) { - if (DXCoil(DXCoilNum).NumCapacityStages == 1) { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, equipName, DXCoil(DXCoilNum).RatedTotCap(1)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, equipName, DXCoil(DXCoilNum).RatedCOP(1)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilType, equipName, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType); + if (state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages == 1) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1)); } else { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, equipName, DXCoil(DXCoilNum).RatedTotCap(2)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, equipName, DXCoil(DXCoilNum).RatedCOP(2)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(2)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, equipName, state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(2)); } } else { - for (Mode = 1; Mode <= DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, equipName, DXCoil(DXCoilNum).MSRatedTotCap(Mode)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, equipName, DXCoil(DXCoilNum).MSRatedCOP(Mode)); + for (Mode = 1; Mode <= state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, equipName, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(Mode)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, equipName, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(Mode)); } } addFootNoteSubTable(state, @@ -8124,7 +8022,7 @@ namespace DXCoils { Real64 HPRTF; // Heat pump run time fraction // References to Coil and Node struct - DXCoilData &Coil = DXCoil(DXCoilNum); + DXCoilData &Coil = state.dataDXCoils->DXCoil(DXCoilNum); NodeData &AirInletNode = Node(Coil.AirInNode); NodeData &WaterInletNode = Node(Coil.WaterInNode); NodeData &WaterOutletNode = Node(Coil.WaterOutNode); @@ -8411,9 +8309,9 @@ namespace DXCoils { // send heating capacity and COP to water heater module for standards rating calculation // total heating capacity including condenser pump - HPWHHeatingCapacity = TotalTankHeatingCapacity; + state.dataDXCoils->HPWHHeatingCapacity = TotalTankHeatingCapacity; // total heating COP including compressor, fan, and condenser pump - HPWHHeatingCOP = TankHeatingCOP; + state.dataDXCoils->HPWHHeatingCOP = TankHeatingCOP; // send DX coil total cooling capacity to HPWH for reporting DXCoilTotalCapacity = EvapCoolingCapacity; @@ -8590,21 +8488,21 @@ namespace DXCoils { Tolerance = 0.01; CondInletTemp = 0.0; CondInletHumRat = 0.0; - BypassFlowFraction = DXCoil(DXCoilNum).BypassedFlowFrac(Mode); - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate * (1.0 - BypassFlowFraction); - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + BypassFlowFraction = state.dataDXCoils->DXCoil(DXCoilNum).BypassedFlowFrac(Mode); + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate * (1.0 - BypassFlowFraction); + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // InletAirPressure = DXCoil(DXCoilNum)%InletAirPressure HeatReclaimDXCoil(DXCoilNum).AvailCapacity = 0.0; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; - DXCoil(DXCoilNum).PartLoadRatio = 0.0; - DXCoil(DXCoilNum).BasinHeaterPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower = 0.0; - if (DXCoil(DXCoilNum).CondenserType(Mode) != WaterHeater) { - if (DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) != WaterHeater) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -8612,10 +8510,10 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorDryBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; - OutdoorHumRat = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; + OutdoorDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; + OutdoorHumRat = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; // this should use Node%WetBulbTemp or a PSYC function, not OAWB - OutdoorWetBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).OutAirWetBulb; + OutdoorWetBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).OutAirWetBulb; } } else { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -8623,15 +8521,15 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } } else { - if (DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) OutdoorPressure = state.dataEnvrn->OutBaroPress; // node not connected } else { @@ -8639,33 +8537,33 @@ namespace DXCoils { } } - if (DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp CompAmbTemp = OutdoorDryBulb; - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - CondInletTemp = ZT(DXCoil(DXCoilNum).SecZonePtr); + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + CondInletTemp = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); CompAmbTemp = CondInletTemp; // assumes compressor is in same location as secondary coil OutdoorDryBulb = CondInletTemp; - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } - } else if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat); - CondAirMassFlow = RhoAir * DXCoil(DXCoilNum).EvapCondAirFlow(Mode); + CondAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode); // (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - DXCoil(DXCoilNum).EvapCondEffect(Mode)); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(Mode)); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure); CompAmbTemp = OutdoorDryBulb; - } else if (DXCoil(DXCoilNum).CondenserType(Mode) == WaterHeater) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == WaterHeater) { CompAmbTemp = HPWHCrankcaseDBTemp; // Temperature at HP water heater compressor CondInletTemp = HPWHCrankcaseDBTemp; // Temperature at HP water heater compressor } // Initialize crankcase heater, operates below OAT defined in input deck for HP DX cooling coil // If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput) - if (CompAmbTemp < DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = DXCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (CompAmbTemp < state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } @@ -8677,28 +8575,28 @@ namespace DXCoils { // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. - if (DXCoil(DXCoilNum).PrintLowAmbMessage) { // .AND. & - if (CurrentEndTime > DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= DXCoil(DXCoilNum).TimeStepSysLast) { - if (DXCoil(DXCoilNum).LowAmbErrIndex == 0) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).LowAmbBuffer1); - ShowContinueError(state, DXCoil(DXCoilNum).LowAmbBuffer2); + if (state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage) { // .AND. & + if (CurrentEndTime > state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast) { + if (state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex == 0) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer1); + ShowContinueError(state, state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer2); ShowContinueError(state, "... Operation at low ambient temperatures may require special performance curves."); } - if (DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { - ShowRecurringWarningErrorAtEnd(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { + ShowRecurringWarningErrorAtEnd(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Low condenser dry-bulb temperature error continues...", - DXCoil(DXCoilNum).LowAmbErrIndex, - DXCoil(DXCoilNum).LowTempLast, - DXCoil(DXCoilNum).LowTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex, + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast, _, "[C]", "[C]"); } else { - ShowRecurringWarningErrorAtEnd(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + ShowRecurringWarningErrorAtEnd(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Low condenser wet-bulb temperature error continues...", - DXCoil(DXCoilNum).LowAmbErrIndex, - DXCoil(DXCoilNum).LowTempLast, - DXCoil(DXCoilNum).LowTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex, + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast, _, "[C]", "[C]"); @@ -8706,43 +8604,43 @@ namespace DXCoils { } } - if (DXCoil(DXCoilNum).PrintLowOutTempMessage) { - if (CurrentEndTime > DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= DXCoil(DXCoilNum).TimeStepSysLast) { - if (DXCoil(DXCoilNum).LowOutletTempIndex == 0) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).LowOutTempBuffer1); - ShowContinueError(state, DXCoil(DXCoilNum).LowOutTempBuffer2); + if (state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage) { + if (CurrentEndTime > state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast) { + if (state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex == 0) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer1); + ShowContinueError(state, state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer2); ShowContinueError(state, "... Possible reasons for low outlet air dry-bulb temperatures are: This DX coil"); ShowContinueError(state, format(" 1) may have a low inlet air dry-bulb temperature. Inlet air temperature = {:.3T} C.", - DXCoil(DXCoilNum).FullLoadInletAirTempLast)); + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadInletAirTempLast)); ShowContinueError(state, " 2) may have a low air flow rate per watt of cooling capacity. Check inputs."); ShowContinueError(state, " 3) is used as part of a HX assisted cooling coil which uses a high sensible effectiveness. Check inputs."); } - ShowRecurringWarningErrorAtEnd(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + ShowRecurringWarningErrorAtEnd(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " "Outlet air temperature statistics follow:", - DXCoil(DXCoilNum).LowOutletTempIndex, - DXCoil(DXCoilNum).FullLoadOutAirTempLast, - DXCoil(DXCoilNum).FullLoadOutAirTempLast); + state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex, + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast); } } // save last system time step and last end time of current time step (used to determine if warning is valid) - DXCoil(DXCoilNum).TimeStepSysLast = TimeStepSys; - DXCoil(DXCoilNum).CurrentEndTimeLast = CurrentEndTime; - DXCoil(DXCoilNum).PrintLowAmbMessage = false; - DXCoil(DXCoilNum).PrintLowOutTempMessage = false; + state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast = TimeStepSys; + state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast = CurrentEndTime; + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage = false; + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage = false; if ((AirMassFlow > 0.0) && - (GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0 || DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) && - (PartLoadRatio > 0.0) && (CompOp == On) && CompAmbTemp > DXCoil(DXCoilNum).MinOATCompressor) { // criteria for coil operation + (GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0 || state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) && + (PartLoadRatio > 0.0) && (CompOp == On) && CompAmbTemp > state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor) { // criteria for coil operation if (FanOpMode == CycFanCycCoil) { AirMassFlow /= (PartLoadRatio / DXcoolToHeatPLRRatio); - } else if (FanOpMode == ContFanCycCoil && DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_CoolingTwoSpeed) { + } else if (FanOpMode == ContFanCycCoil && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_CoolingTwoSpeed) { AirMassFlow *= AirFlowRatio; } else { - AirMassFlow = DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); } // Check for valid air volume flow per rated total cooling capacity (200 - 500 cfm/ton) @@ -8755,26 +8653,26 @@ namespace DXCoils { // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // InletAirWetBulbC = PsyTwbFnTdbWPb(InletAirDryBulbTemp,InletAirHumRat,InletAirPressure) // AirVolumeFlowRate = AirMassFlow/ PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - if (DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { - ShowFatalError(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { + ShowFatalError(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Rated total cooling capacity is zero or less."); } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).RatedTotCap2; + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2; } else { - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).RatedTotCap(Mode); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); } - if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag && DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_HeatPumpWaterHeaterPumped && - DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_HeatPumpWaterHeaterWrapped && + if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_HeatPumpWaterHeaterPumped && + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_HeatPumpWaterHeaterWrapped && ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxCoolVolFlowPerRatedTotCap(DXCT)))) { - if (DXCoil(DXCoilNum).ErrIndex1 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1 == 0) { ShowWarningMessage( state, format("{}{}=\"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at {:.3R} m3/s/W.", RoutineName, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -8785,22 +8683,22 @@ namespace DXCoils { ShowContinueError(state, "or variable air volume [VAV] system using incorrect coil type."); } ShowRecurringWarningErrorAtEnd(state, - RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", - DXCoil(DXCoilNum).ErrIndex1, + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); - } else if (!state.dataGlobal->WarmupFlag && DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped && - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped && + } else if (!state.dataGlobal->WarmupFlag && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped && + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped && ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxHeatVolFlowPerRatedTotCap(DXCT)))) { - if (DXCoil(DXCoilNum).ErrIndex1 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1 == 0) { ShowWarningMessage( state, format("{}{}=\"{}\" - Air volume flow rate per watt of rated total water heating capacity is out of range at {:.2R} m3/s/W.", RoutineName, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -8811,18 +8709,18 @@ namespace DXCoils { "higher or lower than the DX coil rated supply air flow rate."); } ShowRecurringWarningErrorAtEnd(state, - RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Air volume flow rate per watt of rated total water heating capacity is out of range error continues...", - DXCoil(DXCoilNum).ErrIndex1, + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); } // Adjust coil bypass factor for actual air flow rate. Use relation CBF = exp(-NTU) where // NTU = A0/(m*cp). Relationship models the cooling coil as a heat exchanger with Cmin/Cmax = 0. - RatedCBF = DXCoil(DXCoilNum).RatedCBF(Mode); + RatedCBF = state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode); if (RatedCBF > 0.0) { - A0 = -std::log(RatedCBF) * DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + A0 = -std::log(RatedCBF) * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); } else { A0 = 0.0; } @@ -8834,31 +8732,31 @@ namespace DXCoils { } // check boundary for low ambient temperature and post warnings to individual DX coil buffers to print at end of time step - if (DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { if (OutdoorDryBulb < 0.0 && !state.dataGlobal->WarmupFlag) { // Same threshold as for air-cooled electric chiller - DXCoil(DXCoilNum).PrintLowAmbMessage = true; - DXCoil(DXCoilNum).LowTempLast = OutdoorDryBulb; - if (DXCoil(DXCoilNum).LowAmbErrIndex == 0) { - DXCoil(DXCoilNum).LowAmbBuffer1 = + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage = true; + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast = OutdoorDryBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer1 = format("{} \"{}\" - Air-cooled condenser inlet dry-bulb temperature below 0 C. Outdoor dry-bulb temperature = {:.2R}", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, OutdoorDryBulb); - DXCoil(DXCoilNum).LowAmbBuffer2 = + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer2 = " ... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + CreateSysTimeIntervalString(state); } } - } else if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { if (OutdoorWetBulb < 10.0 && !state.dataGlobal->WarmupFlag) { // Same threshold as for evap-cooled electric chiller - DXCoil(DXCoilNum).PrintLowAmbMessage = true; - DXCoil(DXCoilNum).LowTempLast = OutdoorWetBulb; - if (DXCoil(DXCoilNum).LowAmbErrIndex == 0) { - DXCoil(DXCoilNum).LowAmbBuffer1 = + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage = true; + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast = OutdoorWetBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer1 = format("{} \"{}\" - Evap-cooled condenser inlet wet-bulb temperature below 10 C. Outdoor wet-bulb temperature = {:.2R}", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, OutdoorWetBulb); - DXCoil(DXCoilNum).LowAmbBuffer2 = + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer2 = " ... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + CreateSysTimeIntervalString(state); } } @@ -8867,28 +8765,28 @@ namespace DXCoils { // Get total capacity modifying factor (function of temperature) for off-rated conditions // InletAirHumRat may be modified in this ADP/BF loop, use temporary varible for calculations InletAirHumRatTemp = InletAirHumRat; - AirMassFlowRatio = AirMassFlow / DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + AirMassFlowRatio = AirMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); while (true) { - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { // Coil:DX:HeatPumpWaterHeater does not have total cooling capacity as a function of temp or flow curve TotCapTempModFac = 1.0; TotCapFlowModFac = 1.0; } else { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).CCapFTemp(Mode)).NumDims == 2) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirWetBulbC, CondInletTemp); + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode)).NumDims == 2) { + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirWetBulbC, CondInletTemp); } else { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), CondInletTemp); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), CondInletTemp); } // Warn user if curve output goes negative if (TotCapTempModFac < 0.0) { - if (DXCoil(DXCoilNum).CCapFTempErrorIndex == 0) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + "\":"); + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTempErrorIndex == 0) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError(state, format(" Total Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCapTempModFac)); - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).CCapFTemp(Mode)).NumDims == 2) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode)).NumDims == 2) { ShowContinueError(state, format(" Negative value occurs using a condenser inlet air temperature of {:.1T} and an inlet air " "wet-bulb temperature of {:.1T}.", @@ -8904,20 +8802,20 @@ namespace DXCoils { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - RoutineName + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", - DXCoil(DXCoilNum).CCapFTempErrorIndex, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTempErrorIndex, TotCapTempModFac, TotCapTempModFac); TotCapTempModFac = 0.0; } // Get total capacity modifying factor (function of mass flow) for off-rated conditions - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(Mode), AirMassFlowRatio); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(Mode), AirMassFlowRatio); // Warn user if curve output goes negative if (TotCapFlowModFac < 0.0) { - if (DXCoil(DXCoilNum).CCapFFlowErrorIndex == 0) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + "\":"); + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlowErrorIndex == 0) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of flow fraction) output is negative ({:.3T}).", @@ -8929,24 +8827,24 @@ namespace DXCoils { } } ShowRecurringWarningErrorAtEnd(state, - RoutineName + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Total Cooling Capacity Modifier curve (function of flow fraction) output is negative warning continues...", - DXCoil(DXCoilNum).CCapFFlowErrorIndex, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlowErrorIndex, TotCapFlowModFac, TotCapFlowModFac); TotCapFlowModFac = 0.0; } } - TotCap = DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac; + TotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac; // if user specified SHR modifier curves are available calculate the SHR as follows: - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { SHR = CalcSHRUserDefinedCurves(state, InletAirDryBulbTemp, InletAirWetBulbC, AirMassFlowRatio, - DXCoil(DXCoilNum).SHRFTemp(Mode), - DXCoil(DXCoilNum).SHRFFlow(Mode), - DXCoil(DXCoilNum).RatedSHR(Mode)); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode)); hDelta = TotCap / AirMassFlow; break; } else { @@ -8983,89 +8881,89 @@ namespace DXCoils { } } // end of DO iteration loop - if (DXCoil(DXCoilNum).PLFFPLR(Mode) > 0) { - PLF = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(Mode), PartLoadRatio); // Calculate part-load factor + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode) > 0) { + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode), PartLoadRatio); // Calculate part-load factor } else { PLF = 1.0; } if (PLF < 0.7) { - if (DXCoil(DXCoilNum).ErrIndex2 == 0) { - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + "\", PLF curve value"); + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex2 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", PLF curve value"); ShowContinueError(state, format("The PLF curve value = {:.3T} for part-load ratio = {:.3T}", PLF, PartLoadRatio)); ShowContinueErrorTimeStamp(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); - ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + DXCoil(DXCoilNum).DXCoilType + "]."); + ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "]."); } else { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + "\", PLF curve value"); + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", PLF curve value"); ShowContinueError(state, format("The PLF curve value = {:.3T} for part-load ratio = {:.3T}", PLF, PartLoadRatio)); ShowContinueErrorTimeStamp(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); - ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + DXCoil(DXCoilNum).DXCoilType + "]."); + ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "]."); } } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", " + DXCoil(DXCoilNum).DXCoilType + + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " PLF curve < 0.7 warning continues...", - DXCoil(DXCoilNum).ErrIndex2, + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex2, PLF, PLF); } else { - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", " + DXCoil(DXCoilNum).DXCoilType + + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " PLF curve < 0.7 warning continues...", - DXCoil(DXCoilNum).ErrIndex2, + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex2, PLF, PLF); } PLF = 0.7; } - DXCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = PartLoadRatio / PLF; - if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0 && std::abs(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction - 1.0) > 0.001) { - if (DXCoil(DXCoilNum).ErrIndex3 == 0) { - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + "\", runtime fraction"); + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = PartLoadRatio / PLF; + if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0 && std::abs(state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction - 1.0) > 0.001) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex3 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", runtime fraction"); ShowWarningMessage(state, - format("The runtime fraction exceeded 1.0. [{:.4R}].", DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); + format("The runtime fraction exceeded 1.0. [{:.4R}].", state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction reset to 1 and the simulation will continue."); - ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + DXCoil(DXCoilNum).DXCoilType + "]."); + ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "]."); ShowContinueErrorTimeStamp(state, ""); } else { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + "\", runtime fraction"); + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\", runtime fraction"); ShowWarningMessage(state, - format("The runtime fraction exceeded 1.0. [{:.4R}].", DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); + format("The runtime fraction exceeded 1.0. [{:.4R}].", state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction reset to 1 and the simulation will continue."); - ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + DXCoil(DXCoilNum).DXCoilType + "]."); + ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [" + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "]."); ShowContinueErrorTimeStamp(state, ""); } } - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", " + DXCoil(DXCoilNum).DXCoilType + + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex3, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex3, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } else { - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", " + DXCoil(DXCoilNum).DXCoilType + + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex3, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex3, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 - } else if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // If cycling fan, send coil part-load fraction to on/off fan via HVACDataGlobals if (FanOpMode == CycFanCycCoil) OnOffFanPartLoadFraction = PLF; // Calculate full load output conditions - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { FullLoadOutAirEnth = InletAirEnthalpy - hDelta; if (SHR < 1.0) { hTinwout = InletAirEnthalpy - (1.0 - SHR) * hDelta; @@ -9099,21 +8997,21 @@ namespace DXCoils { } // Store actual outlet conditions when DX coil is ON for use in heat recovery module - DXCoilFullLoadOutAirTemp(DXCoilNum) = FullLoadOutAirTemp; - DXCoilFullLoadOutAirHumRat(DXCoilNum) = FullLoadOutAirHumRat; + state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum) = FullLoadOutAirTemp; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum) = FullLoadOutAirHumRat; // Add warning message for cold cooling coil (FullLoadOutAirTemp < 2 C) if (FullLoadOutAirTemp < 2.0 && !FirstHVACIteration && !state.dataGlobal->WarmupFlag) { - DXCoil(DXCoilNum).PrintLowOutTempMessage = true; - DXCoil(DXCoilNum).FullLoadOutAirTempLast = FullLoadOutAirTemp; - if (DXCoil(DXCoilNum).LowOutletTempIndex == 0) { - DXCoil(DXCoilNum).FullLoadInletAirTempLast = InletAirDryBulbTemp; - DXCoil(DXCoilNum).LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage = true; + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast = FullLoadOutAirTemp; + if (state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadInletAirTempLast = InletAirDryBulbTemp; + state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " "possibility of coil frost/freeze. Outlet temperature = {:.2R} C.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, FullLoadOutAirTemp); - DXCoil(DXCoilNum).LowOutTempBuffer2 = + state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer2 = " ...Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + CreateSysTimeIntervalString(state); } } @@ -9121,20 +9019,20 @@ namespace DXCoils { // If constant fan with cycling compressor, call function to determine "effective SHR" // which includes the part-load degradation on latent capacity if (FanOpMode == ContFanCycCoil) { - QLatRated = DXCoil(DXCoilNum).RatedTotCap(Mode) * (1.0 - DXCoil(DXCoilNum).RatedSHR(Mode)); + QLatRated = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode)); QLatActual = TotCap * (1.0 - SHR); SHRUnadjusted = SHR; - SHR = CalcEffectiveSHR( - DXCoilNum, SHR, DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, QLatRated, QLatActual, InletAirDryBulbTemp, InletAirWetBulbC, Mode); + SHR = CalcEffectiveSHR(state, + DXCoilNum, SHR, state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, QLatRated, QLatActual, InletAirDryBulbTemp, InletAirWetBulbC, Mode); // For multimode coil, if stage-2 operation (modes 2 or 4), adjust Stage1&2 SHR to account for // Stage 1 operating at full load, so there is no degradation for that portion // Use the stage 1 bypass fraction to allocate if (Mode == 2 || Mode == 4) { - SHR = SHRUnadjusted * (1.0 - DXCoil(DXCoilNum).BypassedFlowFrac(Mode - 1)) + SHR * DXCoil(DXCoilNum).BypassedFlowFrac(Mode - 1); + SHR = SHRUnadjusted * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).BypassedFlowFrac(Mode - 1)) + SHR * state.dataDXCoils->DXCoil(DXCoilNum).BypassedFlowFrac(Mode - 1); } // Calculate full load output conditions - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { FullLoadOutAirEnth = InletAirEnthalpy - hDelta; if (SHR < 1.0) { hTinwout = InletAirEnthalpy - (1.0 - SHR) * hDelta; @@ -9162,17 +9060,18 @@ namespace DXCoils { // longer than the cooling coil. DXcoolToHeatPLRRatio = Cooling coil PLR / Heating coil PLR. } else if (FanOpMode == CycFanCycCoil) { if (DXcoolToHeatPLRRatio < 1.0) { - QLatRated = DXCoil(DXCoilNum).RatedTotCap(Mode) * (1.0 - DXCoil(DXCoilNum).RatedSHR(Mode)); + QLatRated = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode)); QLatActual = TotCap * (1.0 - SHR); HeatRTF = PartLoadRatio / DXcoolToHeatPLRRatio; - if (DXCoil(DXCoilNum).HeatingCoilPLFCurvePTR > 0) { - HeatingCoilPLF = CurveValue(state, DXCoil(DXCoilNum).HeatingCoilPLFCurvePTR, HeatRTF); + if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilPLFCurvePTR > 0) { + HeatingCoilPLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilPLFCurvePTR, HeatRTF); if (HeatingCoilPLF > 0) HeatRTF /= HeatingCoilPLF; } SHRUnadjusted = SHR; - SHR = CalcEffectiveSHR(DXCoilNum, + SHR = CalcEffectiveSHR(state, + DXCoilNum, SHR, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, QLatRated, QLatActual, InletAirDryBulbTemp, @@ -9180,7 +9079,7 @@ namespace DXCoils { Mode, HeatRTF); // Calculate full load output conditions - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { FullLoadOutAirEnth = InletAirEnthalpy - hDelta; if (SHR < 1.0) { hTinwout = InletAirEnthalpy - (1.0 - SHR) * hDelta; @@ -9250,22 +9149,22 @@ namespace DXCoils { } // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || - DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterPumped || + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_HeatPumpWaterHeaterWrapped) { // Coil:DX:HeatPumpWaterHeater does not have EIR temp or flow curves EIRTempModFac = 1.0; EIRFlowModFac = 1.0; } else { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirWetBulbC, CondInletTemp); + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirWetBulbC, CondInletTemp); // Warn user if curve output goes negative if (EIRTempModFac < 0.0) { - if (DXCoil(DXCoilNum).EIRFTempErrorIndex == 0) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + "\":"); + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFTempErrorIndex == 0) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError( state, format(" Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).", EIRTempModFac)); - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).EIRFTemp(Mode)).NumDims == 2) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode)).NumDims == 2) { ShowContinueError(state, format(" Negative value occurs using a condenser inlet air temperature of {:.1T} and an inlet air " "wet-bulb temperature of {:.1T}.", @@ -9281,20 +9180,20 @@ namespace DXCoils { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...", - DXCoil(DXCoilNum).EIRFTempErrorIndex, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTempErrorIndex, EIRTempModFac, EIRTempModFac); EIRTempModFac = 0.0; } - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); // Warn user if curve output goes negative if (EIRFlowModFac < 0.0) { - if (DXCoil(DXCoilNum).EIRFFlowErrorIndex == 0) { - ShowWarningMessage(state, RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + "\":"); + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlowErrorIndex == 0) { + ShowWarningMessage(state, RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError( state, format(" Energy Input Ratio Modifier curve (function of flow fraction) output is negative ({:.3T}).", EIRFlowModFac)); @@ -9305,142 +9204,142 @@ namespace DXCoils { } } ShowRecurringWarningErrorAtEnd(state, - RoutineName + DXCoil(DXCoilNum).DXCoilType + "=\"" + DXCoil(DXCoilNum).Name + + RoutineName + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + "=\"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Energy Input Ratio Modifier curve (function of flow fraction) output is negative warning continues...", - DXCoil(DXCoilNum).EIRFFlowErrorIndex, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlowErrorIndex, EIRFlowModFac, EIRFlowModFac); EIRFlowModFac = 0.0; } } - EIR = DXCoil(DXCoilNum).RatedEIR(Mode) * EIRFlowModFac * EIRTempModFac; + EIR = state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(Mode) * EIRFlowModFac * EIRTempModFac; // For multimode coil, if stage-2 operation (Modes 2 or 4), return "full load" power adjusted for PLF if (Mode == 1 || Mode == 3) { - DXCoil(DXCoilNum).ElecCoolingPower = TotCap * EIR * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = TotCap * EIR * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; } else { - DXCoil(DXCoilNum).ElecCoolingPower = TotCap * EIR * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction / PartLoadRatio; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = TotCap * EIR * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction / PartLoadRatio; } // Reset AirMassFlow to inlet node air mass flow for final total, sensible and latent calculations // since AirMassFlow might have been modified above (in this subroutine): // IF (FanOpMode .EQ. CycFanCycCoil) AirMassFlow = AirMassFlow / PartLoadRatio // For multimode coil, this should be full flow including bypassed fraction - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; CalcComponentSensibleLatentOutput(AirMassFlow, InletAirDryBulbTemp, InletAirHumRat, OutletAirTemp, OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); // Set DataHeatGlobal heat reclaim variable for use by heat reclaim coil (part load ratio is accounted for) // Calculation for heat reclaim needs to be corrected to use compressor power (not including condenser fan power) - HeatReclaimDXCoil(DXCoilNum).AvailCapacity = DXCoil(DXCoilNum).TotalCoolingEnergyRate + DXCoil(DXCoilNum).ElecCoolingPower; + HeatReclaimDXCoil(DXCoilNum).AvailCapacity = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; // Calculate crankcase heater power using the runtime fraction for this DX cooling coil only if there is no companion DX coil. // Else use the largest runtime fraction of this DX cooling coil and the companion DX heating coil. - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - max(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - max(state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction)); } - if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { //****************** // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** RhoWater = RhoH2O(OutdoorDryBulb); - DXCoil(DXCoilNum).EvapWaterConsumpRate = - (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; - DXCoil(DXCoilNum).EvapCondPumpElecPower = - DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = + (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; // Calculate basin heater power - CalcBasinHeaterPower(state, DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed) { - DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + CalcBasinHeaterPower(state, state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingSingleSpeed) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } } - DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; - DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; // Reset globals when DX coil is OFF for use in heat recovery module - DXCoilFullLoadOutAirTemp(DXCoilNum) = 0.0; - DXCoilFullLoadOutAirHumRat(DXCoilNum) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum) = 0.0; // Calculate crankcase heater power using the runtime fraction for this DX cooling coil (here DXCoolingCoilRTF=0) if // there is no companion DX coil, or the runtime fraction of the companion DX heating coil (here DXHeatingCoilRTF>=0). - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction); } // Calculate basin heater power - if (DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { - if (any_eq(DXCoil(DXCoilNum).CondenserType, EvapCooled)) { - CalcBasinHeaterPower(state, DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { + if (any_eq(state.dataDXCoils->DXCoil(DXCoilNum).CondenserType, EvapCooled)) { + CalcBasinHeaterPower(state, state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); } } else { - if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { - CalcBasinHeaterPower(state, DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + CalcBasinHeaterPower(state, state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); } } } // end of on/off if - else // set water system demand request (if needed) - if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = - DXCoil(DXCoilNum).EvapWaterConsumpRate; + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode == iWaterSupply::FromTank) { + state.dataWaterData->WaterStorage(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate; } - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoilPartLoadRatio(DXCoilNum) = DXCoil(DXCoilNum).PartLoadRatio; - DXCoilFanOpMode(DXCoilNum) = FanOpMode; - DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio; + state.dataDXCoils->DXCoilFanOpMode(DXCoilNum) = FanOpMode; + state.dataDXCoils->DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; // set outlet node conditions - int airOutletNode = DXCoil(DXCoilNum).AirOutNode; - Node(airOutletNode).Temp = DXCoil(DXCoilNum).OutletAirTemp; - Node(airOutletNode).HumRat = DXCoil(DXCoilNum).OutletAirHumRat; + int airOutletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode; + Node(airOutletNode).Temp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + Node(airOutletNode).HumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; // calc secondary coil if specified - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { CalcSecondaryDXCoils(state, DXCoilNum); } } @@ -9586,25 +9485,25 @@ namespace DXCoils { Tolerance = 0.01; CondInletTemp = 0.0; CondInletHumRat = 0.0; - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // InletAirPressure = DXCoil(DXCoilNum)%InletAirPressure HeatReclaimDXCoil(DXCoilNum).AvailCapacity = 0.0; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; - DXCoil(DXCoilNum).PartLoadRatio = 0.0; - DXCoil(DXCoilNum).BasinHeaterPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower = 0.0; - if (DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { - OutdoorDryBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; - if (DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { + OutdoorDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { OutdoorHumRat = state.dataEnvrn->OutHumRat; OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -9612,9 +9511,9 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorHumRat = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; + OutdoorHumRat = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; // this should use Node%WetBulbTemp or a PSYC function, not OAWB - OutdoorWetBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).OutAirWetBulb; + OutdoorWetBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).OutAirWetBulb; } } } else { @@ -9624,16 +9523,16 @@ namespace DXCoils { OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } - if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat); - CondAirMassFlow = RhoAir * DXCoil(DXCoilNum).EvapCondAirFlow(Mode); + CondAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode); // (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - DXCoil(DXCoilNum).EvapCondEffect(Mode)); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(Mode)); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure); CompAmbTemp = OutdoorDryBulb; } else { // for air or water-cooled, inlet temp is stored in OutdoorDryBulb temp CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp or water inlet temp - if (DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { CompAmbTemp = state.dataEnvrn->OutDryBulbTemp; // for crankcase heater use actual outdoor temp for water-cooled } else { CompAmbTemp = OutdoorDryBulb; @@ -9642,8 +9541,8 @@ namespace DXCoils { // Initialize crankcase heater, operates below OAT defined in input deck for HP DX cooling coil // If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput) - if (CompAmbTemp < DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = DXCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (CompAmbTemp < state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } @@ -9655,77 +9554,77 @@ namespace DXCoils { // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. - if (DXCoil(DXCoilNum).PrintLowAmbMessage) { // .AND. & - if (CurrentEndTime > DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= DXCoil(DXCoilNum).TimeStepSysLast) { - if (DXCoil(DXCoilNum).LowAmbErrIndex == 0) { - ShowWarningMessage(state, DXCoil(DXCoilNum).LowAmbBuffer1); - ShowContinueError(state, DXCoil(DXCoilNum).LowAmbBuffer2); + if (state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage) { // .AND. & + if (CurrentEndTime > state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast) { + if (state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex == 0) { + ShowWarningMessage(state, state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer1); + ShowContinueError(state, state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer2); ShowContinueError(state, "... Operation at low inlet temperatures may require special performance curves."); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Low condenser inlet temperature error continues...", - DXCoil(DXCoilNum).LowAmbErrIndex, - DXCoil(DXCoilNum).LowTempLast, - DXCoil(DXCoilNum).LowTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex, + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast, _, "[C]", "[C]"); } } - if (DXCoil(DXCoilNum).PrintHighAmbMessage) { // .AND. & - if (CurrentEndTime > DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= DXCoil(DXCoilNum).TimeStepSysLast) { - if (DXCoil(DXCoilNum).HighAmbErrIndex == 0) { - ShowWarningMessage(state, DXCoil(DXCoilNum).HighAmbBuffer1); - ShowContinueError(state, DXCoil(DXCoilNum).HighAmbBuffer2); + if (state.dataDXCoils->DXCoil(DXCoilNum).PrintHighAmbMessage) { // .AND. & + if (CurrentEndTime > state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast) { + if (state.dataDXCoils->DXCoil(DXCoilNum).HighAmbErrIndex == 0) { + ShowWarningMessage(state, state.dataDXCoils->DXCoil(DXCoilNum).HighAmbBuffer1); + ShowContinueError(state, state.dataDXCoils->DXCoil(DXCoilNum).HighAmbBuffer2); ShowContinueError(state, "... Operation at high inlet temperatures may require special performance curves."); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - High condenser inlet temperature error continues...", - DXCoil(DXCoilNum).HighAmbErrIndex, - DXCoil(DXCoilNum).HighTempLast, - DXCoil(DXCoilNum).HighTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).HighAmbErrIndex, + state.dataDXCoils->DXCoil(DXCoilNum).HighTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).HighTempLast, _, "[C]", "[C]"); } } - if (DXCoil(DXCoilNum).PrintLowOutTempMessage) { - if (CurrentEndTime > DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= DXCoil(DXCoilNum).TimeStepSysLast) { - if (DXCoil(DXCoilNum).LowOutletTempIndex == 0) { - ShowWarningMessage(state, DXCoil(DXCoilNum).LowOutTempBuffer1); - ShowContinueError(state, DXCoil(DXCoilNum).LowOutTempBuffer2); + if (state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage) { + if (CurrentEndTime > state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast) { + if (state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex == 0) { + ShowWarningMessage(state, state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer1); + ShowContinueError(state, state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer2); ShowContinueError(state, "... Possible reasons for low outlet air dry-bulb temperatures are: This DX coil"); ShowContinueError(state, format(" 1) may have a low inlet air dry-bulb temperature. Inlet air temperature = {:.3T} C.", - DXCoil(DXCoilNum).FullLoadInletAirTempLast)); + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadInletAirTempLast)); ShowContinueError(state, " 2) may have a low air flow rate per watt of cooling capacity. Check inputs."); ShowContinueError(state, " 3) is used as part of a HX assisted cooling coil which uses a high sensible effectiveness. Check inputs."); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " "Outlet air temperature statistics follow:", - DXCoil(DXCoilNum).LowOutletTempIndex, - DXCoil(DXCoilNum).FullLoadOutAirTempLast, - DXCoil(DXCoilNum).FullLoadOutAirTempLast); + state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex, + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast); } } // save last system time step and last end time of current time step (used to determine if warning is valid) - DXCoil(DXCoilNum).TimeStepSysLast = TimeStepSys; - DXCoil(DXCoilNum).CurrentEndTimeLast = CurrentEndTime; - DXCoil(DXCoilNum).PrintLowAmbMessage = false; - DXCoil(DXCoilNum).PrintLowOutTempMessage = false; + state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast = TimeStepSys; + state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast = CurrentEndTime; + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage = false; + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage = false; - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && + if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && (CompOp == On)) { // for cycling fan, reset mass flow to full on rate if (FanOpMode == CycFanCycCoil) { AirMassFlow /= PartLoadRatio; } else if (FanOpMode == ContFanCycCoil) { AirMassFlow *= AirFlowRatio; } else { - AirMassFlow = DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); } // Check for valid air volume flow per rated total cooling capacity (200 - 500 cfm/ton) @@ -9735,20 +9634,20 @@ namespace DXCoils { InletAirWetBulbC = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); AirVolumeFlowRate = AirMassFlow / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat); - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).RatedTotCap(Mode); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); - if (DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { - ShowFatalError(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + "\" - Rated total cooling capacity is zero or less."); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { + ShowFatalError(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Rated total cooling capacity is zero or less."); } if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag && ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxCoolVolFlowPerRatedTotCap(DXCT)))) { - if (DXCoil(DXCoilNum).ErrIndex1 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1 == 0) { ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at {:.3R} m3/s/W.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -9760,7 +9659,7 @@ namespace DXCoils { ShowContinueError(state, "...Volume Flow Rate per Rated Total Capacity = Volume Flow Rate / Rated Total Capacity"); ShowContinueError(state, "...Volume Flow Rate = Air Mass Flow Rate / Air Density"); ShowContinueError(state, "...Data used for calculations:"); - ShowContinueError(state, format("...Rated Total Capacity = {:.2R} W.", DXCoil(DXCoilNum).RatedTotCap(Mode))); + ShowContinueError(state, format("...Rated Total Capacity = {:.2R} W.", state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode))); ShowContinueError(state, "...Volume Flow Rate = Air Mass Flow Rate / Air Density"); ShowContinueError(state, format("...Volume Flow Rate = {:.8R} m3/s.", AirVolumeFlowRate)); ShowContinueError(state, format("...Air Mass Flow Rate = {:.8R} kg/s.", AirMassFlow)); @@ -9773,18 +9672,18 @@ namespace DXCoils { ShowContinueError(state, format("...Inlet Air Humidity Ratio = {:.8R} kgWater/kgDryAir.", InletAirHumRat)); } ShowRecurringWarningErrorAtEnd(state, - DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Air volume flow rate per watt of rated total cooling capacity is out of range error continues...", - DXCoil(DXCoilNum).ErrIndex1, + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); } // Adjust coil bypass factor for actual air flow rate. Use relation CBF = exp(-NTU) where // NTU = A0/(m*cp). Relationship models the cooling coil as a heat exchanger with Cmin/Cmax = 0. - RatedCBF = DXCoil(DXCoilNum).RatedCBF(Mode); + RatedCBF = state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode); if (RatedCBF > 0.0) { - A0 = -std::log(RatedCBF) * DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + A0 = -std::log(RatedCBF) * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); } else { A0 = 0.0; } @@ -9796,33 +9695,33 @@ namespace DXCoils { } // check boundary for low ambient temperature and post warnings to individual DX coil buffers to print at end of time step - if (OutdoorDryBulb < DXCoil(DXCoilNum).MinOATCompressor && !state.dataGlobal->WarmupFlag) { - DXCoil(DXCoilNum).PrintLowAmbMessage = true; - DXCoil(DXCoilNum).LowTempLast = OutdoorDryBulb; - if (DXCoil(DXCoilNum).LowAmbErrIndex == 0) { - DXCoil(DXCoilNum).LowAmbBuffer1 = + if (OutdoorDryBulb < state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor && !state.dataGlobal->WarmupFlag) { + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage = true; + state.dataDXCoils->DXCoil(DXCoilNum).LowTempLast = OutdoorDryBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).LowAmbErrIndex == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer1 = format("{} \"{}\" - Condenser inlet temperature below {:.2R} C. Condenser inlet temperature = {:.2R}", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MinOATCompressor, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor, OutdoorDryBulb); - DXCoil(DXCoilNum).LowAmbBuffer2 = + state.dataDXCoils->DXCoil(DXCoilNum).LowAmbBuffer2 = " ... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + CreateSysTimeIntervalString(state); } } // check boundary for high ambient temperature and post warnings to individual DX coil buffers to print at end of time step - if (OutdoorDryBulb > DXCoil(DXCoilNum).MaxOATCompressor && !state.dataGlobal->WarmupFlag) { - DXCoil(DXCoilNum).PrintHighAmbMessage = true; - DXCoil(DXCoilNum).HighTempLast = OutdoorDryBulb; - if (DXCoil(DXCoilNum).HighAmbErrIndex == 0) { - DXCoil(DXCoilNum).HighAmbBuffer1 = + if (OutdoorDryBulb > state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCompressor && !state.dataGlobal->WarmupFlag) { + state.dataDXCoils->DXCoil(DXCoilNum).PrintHighAmbMessage = true; + state.dataDXCoils->DXCoil(DXCoilNum).HighTempLast = OutdoorDryBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).HighAmbErrIndex == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).HighAmbBuffer1 = format("{} \"{}\" - Condenser inlet temperature above {:.2R} C. Condenser temperature = {:.2R}", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).MaxOATCompressor, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCompressor, OutdoorDryBulb); - DXCoil(DXCoilNum).HighAmbBuffer2 = + state.dataDXCoils->DXCoil(DXCoilNum).HighAmbBuffer2 = " ... Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + CreateSysTimeIntervalString(state); } } @@ -9833,12 +9732,12 @@ namespace DXCoils { // No need to differentiate between curve types, single-independent curve will just use first variable // (as long as the first independent variable is the same for both curve types) Label50:; - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirWetBulbC, CondInletTemp); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirWetBulbC, CondInletTemp); // Warn user if curve output goes negative if (TotCapTempModFac < 0.0) { - if (DXCoil(DXCoilNum).CCapFTempErrorIndex == 0) { - ShowWarningMessage(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + "\":"); + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFTempErrorIndex == 0) { + ShowWarningMessage(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCapTempModFac)); @@ -9854,22 +9753,22 @@ namespace DXCoils { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Total Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", - DXCoil(DXCoilNum).CCapFTempErrorIndex, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTempErrorIndex, TotCapTempModFac, TotCapTempModFac); TotCapTempModFac = 0.0; } // Get total capacity modifying factor (function of mass flow) for off-rated conditions - AirMassFlowRatio = AirMassFlow / DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(Mode), AirMassFlowRatio); + AirMassFlowRatio = AirMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(Mode), AirMassFlowRatio); // Warn user if curve output goes negative if (TotCapFlowModFac < 0.0) { - if (DXCoil(DXCoilNum).CCapFFlowErrorIndex == 0) { - ShowWarningMessage(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + "\":"); + if (state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlowErrorIndex == 0) { + ShowWarningMessage(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\":"); ShowContinueError( state, format(" Total Cooling Capacity Modifier curve (function of flow fraction) output is negative ({:.3T}).", TotCapFlowModFac)); @@ -9880,18 +9779,18 @@ namespace DXCoils { } } ShowRecurringWarningErrorAtEnd(state, - DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": Total Cooling Capacity Modifier curve (function of flow fraction) output is negative warning continues...", - DXCoil(DXCoilNum).CCapFFlowErrorIndex, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlowErrorIndex, TotCapFlowModFac, TotCapFlowModFac); TotCapFlowModFac = 0.0; } if (present(MaxCoolCap)) { - TotCap = min(MaxCoolCap, DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac); + TotCap = min(MaxCoolCap, state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac); } else { - TotCap = DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac; + TotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac; } TotCap *= PartLoadRatio; @@ -9926,46 +9825,46 @@ namespace DXCoils { if (std::abs(werror) > Tolerance) goto Label50; // Recalculate with modified inlet conditions } - if (DXCoil(DXCoilNum).PLFFPLR(Mode) > 0 && CompCycRatio < 1.0) { - PLF = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(Mode), CompCycRatio); // Calculate part-load factor + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode) > 0 && CompCycRatio < 1.0) { + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode), CompCycRatio); // Calculate part-load factor } else { PLF = 1.0; } if (PLF < 0.7) { - if (DXCoil(DXCoilNum).ErrIndex2 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex2 == 0) { ShowWarningMessage(state, format("The PLF curve value for the DX cooling coil {} ={:.3R} for part-load ratio ={:.3R}", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF, PartLoadRatio)); ShowContinueErrorTimeStamp(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Cooling:DX:SingleSpeed]."); } ShowRecurringWarningErrorAtEnd(state, - DXCoil(DXCoilNum).Name + ", DX cooling coil PLF curve < 0.7 warning continues...", DXCoil(DXCoilNum).ErrIndex2, PLF, PLF); + state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX cooling coil PLF curve < 0.7 warning continues...", state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex2, PLF, PLF); PLF = 0.7; } - DXCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CompCycRatio / PLF; - if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0 && std::abs(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction - 1.0) > 0.001) { - if (DXCoil(DXCoilNum).ErrIndex3 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CompCycRatio / PLF; + if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0 && std::abs(state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction - 1.0) > 0.001) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex3 == 0) { ShowWarningMessage(state, format("The runtime fraction for DX cooling coil {} exceeded 1.0. [{:.4R}].", - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction reset to 1 and the simulation will continue."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Cooling:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", DX cooling coil runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex3, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 - } else if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX cooling coil runtime fraction > 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex3, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // If cycling fan, send coil part-load fraction to on/off fan via HVACDataGlobals @@ -9993,21 +9892,21 @@ namespace DXCoils { } // Store actual outlet conditions when DX coil is ON for use in heat recovery module - DXCoilFullLoadOutAirTemp(DXCoilNum) = FullLoadOutAirTemp; - DXCoilFullLoadOutAirHumRat(DXCoilNum) = FullLoadOutAirHumRat; + state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum) = FullLoadOutAirTemp; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum) = FullLoadOutAirHumRat; // Add warning message for cold cooling coil (FullLoadOutAirTemp < 2 C) if (FullLoadOutAirTemp < 2.0 && !FirstHVACIteration && !state.dataGlobal->WarmupFlag) { - DXCoil(DXCoilNum).PrintLowOutTempMessage = true; - DXCoil(DXCoilNum).FullLoadOutAirTempLast = FullLoadOutAirTemp; - if (DXCoil(DXCoilNum).LowOutletTempIndex == 0) { - DXCoil(DXCoilNum).FullLoadInletAirTempLast = InletAirDryBulbTemp; - DXCoil(DXCoilNum).LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage = true; + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast = FullLoadOutAirTemp; + if (state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadInletAirTempLast = InletAirDryBulbTemp; + state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " "possibility of coil frost/freeze. Outlet temperature = {:.2R} C.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, FullLoadOutAirTemp); - DXCoil(DXCoilNum).LowOutTempBuffer2 = + state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer2 = " ...Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + CreateSysTimeIntervalString(state); } } @@ -10015,11 +9914,11 @@ namespace DXCoils { // If constant fan with cycling compressor, call function to determine "effective SHR" // which includes the part-load degradation on latent capacity if (FanOpMode == ContFanCycCoil && CompCycRatio < 1.0) { - QLatRated = DXCoil(DXCoilNum).RatedTotCap(Mode) * (1.0 - DXCoil(DXCoilNum).RatedSHR(Mode)); // always the same number + QLatRated = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode)); // always the same number QLatActual = TotCap * (1.0 - SHR); SHRUnadjusted = SHR; - SHR = CalcEffectiveSHR( - DXCoilNum, SHR, DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, QLatRated, QLatActual, InletAirDryBulbTemp, InletAirWetBulbC, Mode); + SHR = CalcEffectiveSHR(state, + DXCoilNum, SHR, state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, QLatRated, QLatActual, InletAirDryBulbTemp, InletAirWetBulbC, Mode); // Calculate full load output conditions // if ( SHR > 1.0 || Counter > 0 ) SHR = 1.0; @@ -10064,7 +9963,7 @@ namespace DXCoils { // since AirMassFlow might have been modified above (in this subroutine): // IF (FanOpMode .EQ. CycFanCycCoil) AirMassFlow = AirMassFlow / PartLoadRatio // For multimode coil, this should be full flow including bypassed fraction - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; // Coil total/sensible/latent cooling rates CalcComponentSensibleLatentOutput(AirMassFlow, @@ -10072,52 +9971,52 @@ namespace DXCoils { InletAirHumRat, OutletAirTemp, OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); - DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; - DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; // Reset globals when DX coil is OFF for use in heat recovery module - DXCoilFullLoadOutAirTemp(DXCoilNum) = 0.0; - DXCoilFullLoadOutAirHumRat(DXCoilNum) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum) = 0.0; } // end of on/off if - else // set water system demand request (if needed) - if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = - DXCoil(DXCoilNum).EvapWaterConsumpRate; + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode == iWaterSupply::FromTank) { + state.dataWaterData->WaterStorage(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate; } - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoilPartLoadRatio(DXCoilNum) = DXCoil(DXCoilNum).PartLoadRatio; - DXCoilFanOpMode(DXCoilNum) = FanOpMode; - DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; - DXCoilTotalCooling(DXCoilNum) = DXCoil(DXCoilNum).TotalCoolingEnergyRate; - DXCoilCoolInletAirWBTemp(DXCoilNum) = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio; + state.dataDXCoils->DXCoilFanOpMode(DXCoilNum) = FanOpMode; + state.dataDXCoils->DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; + state.dataDXCoils->DXCoilTotalCooling(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate; + state.dataDXCoils->DXCoilCoolInletAirWBTemp(DXCoilNum) = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); // set outlet node conditions - int airOutletNode = DXCoil(DXCoilNum).AirOutNode; - Node(airOutletNode).Temp = DXCoil(DXCoilNum).OutletAirTemp; - Node(airOutletNode).HumRat = DXCoil(DXCoilNum).OutletAirHumRat; + int airOutletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode; + Node(airOutletNode).Temp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + Node(airOutletNode).HumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; } void CalcDXHeatingCoil(EnergyPlusData &state, @@ -10228,16 +10127,16 @@ namespace DXCoils { } // Get condenser outdoor node info from DX Heating Coil - if (DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { - OutdoorDryBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { + OutdoorDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp; CompAmbTemp = OutdoorDryBulb; - if (DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { OutdoorHumRat = state.dataEnvrn->OutHumRat; OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; CompAmbTemp = state.dataEnvrn->OutDryBulbTemp; } else { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press; + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -10245,22 +10144,22 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorHumRat = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat; + OutdoorHumRat = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat; // this should use Node%WetBulbTemp or a PSYC function, not OAWB - OutdoorWetBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).OutAirWetBulb; + OutdoorWetBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).OutAirWetBulb; } - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; } } - } else if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; } else { @@ -10271,25 +10170,25 @@ namespace DXCoils { CompAmbTemp = OutdoorDryBulb; } - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // InletAirPressure = DXCoil(DXCoilNum)%InletAirPressure // InletAirWetBulbC = PsyTwbFnTdbWPb(InletAirDryBulbTemp,InletAirHumRat,InletAirPressure) InletAirWetBulbC = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); PLRHeating = 0.0; - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 0.0; // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (CompAmbTemp < DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = DXCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (CompAmbTemp < state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && - OutdoorDryBulb > DXCoil(DXCoilNum).MinOATCompressor) { + if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && + OutdoorDryBulb > state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor) { // for cycling fan, reset mass flow to full on rate if (FanOpMode == CycFanCycCoil) AirMassFlow /= PartLoadRatio; if (FanOpMode == ContFanCycCoil) AirMassFlow *= AirFlowRatio; @@ -10297,15 +10196,15 @@ namespace DXCoils { AirVolumeFlowRate = AirMassFlow / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // AirVolumeFlowRate = AirMassFlow/PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).RatedTotCap(Mode); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); if ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxHeatVolFlowPerRatedTotCap(DXCT))) { - if (DXCoil(DXCoilNum).ErrIndex1 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1 == 0) { ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range at {:.3R} m3/s/W.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, VolFlowperRatedTotCap)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -10316,9 +10215,9 @@ namespace DXCoils { ShowContinueError(state, "inconsistent supply air fan operation modes in coil and unitary system objects."); } ShowRecurringWarningErrorAtEnd(state, - DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues...", - DXCoil(DXCoilNum).ErrIndex1, + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); } @@ -10327,31 +10226,31 @@ namespace DXCoils { // Model was extended to accept bi-quadratic curves. This allows sensitivity of the heating capacity // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quaratic curve if sufficient manufacturer data is available. - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).CCapFTemp(Mode)).NumDims == 2) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode)).NumDims == 2) { { - auto const SELECT_CASE_var(DXCoil(DXCoilNum).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(DXCoilNum).HeatingPerformanceOATType); if (SELECT_CASE_var == DryBulbIndicator) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp, OutdoorDryBulb); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp, OutdoorDryBulb); } else if (SELECT_CASE_var == WetBulbIndicator) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp, OutdoorWetBulb); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp, OutdoorWetBulb); } else { TotCapTempModFac = 1.0; } } } else { { - auto const SELECT_CASE_var(DXCoil(DXCoilNum).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(DXCoilNum).HeatingPerformanceOATType); if (SELECT_CASE_var == DryBulbIndicator) { - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), OutdoorDryBulb); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), OutdoorDryBulb); } else { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp); } } else if (SELECT_CASE_var == WetBulbIndicator) { - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), OutdoorWetBulb); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), OutdoorWetBulb); } else { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), InletAirDryBulbTemp); } } else { TotCapTempModFac = 1.0; @@ -10360,27 +10259,27 @@ namespace DXCoils { } if (TotCapTempModFac < 0.0) { - if (DXCoil(DXCoilNum).CAPFTErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CAPFTErrIndex == 0) { ShowWarningMessage( - state, format("The TotCapTempModFac curve value for DX heating coil {} ={:.2R}", DXCoil(DXCoilNum).Name, TotCapTempModFac)); + state, format("The TotCapTempModFac curve value for DX heating coil {} ={:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).Name, TotCapTempModFac)); ShowContinueError(state, "TotCapTempModFac curve value must be > 0. TotCapTempModFac curve value has been reset to 0.0 and " "simulation is continuing."); - ShowContinueError(state, "Check the IO reference manual for TotCapTempModFac curve guidance [ " + DXCoil(DXCoilNum).DXCoilType + " ]."); + ShowContinueError(state, "Check the IO reference manual for TotCapTempModFac curve guidance [ " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " ]."); ShowContinueErrorTimeStamp(state, ""); } ShowRecurringWarningErrorAtEnd(state, "DX heating coil TotCapTempModFac curve value < 0 warning continues... ", - DXCoil(DXCoilNum).CAPFTErrIndex, + state.dataDXCoils->DXCoil(DXCoilNum).CAPFTErrIndex, TotCapTempModFac, TotCapTempModFac); TotCapTempModFac = 0.0; } // Get total capacity modifying factor (function of mass flow) for off-rated conditions - AirMassFlowRatio = AirMassFlow / DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(Mode), AirMassFlowRatio); + AirMassFlowRatio = AirMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(Mode), AirMassFlowRatio); // Calculate total heating capacity for off-rated conditions - TotCap = DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac; + TotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) * TotCapFlowModFac * TotCapTempModFac; // Calculating adjustment factors for defrost // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E @@ -10394,10 +10293,10 @@ namespace DXCoils { InputPowerMultiplier = 1.0; // Check outdoor temperature to determine of defrost is active - if (OutdoorDryBulb <= DXCoil(DXCoilNum).MaxOATDefrost && DXCoil(DXCoilNum).CondenserType(Mode) != WaterCooled) { + if (OutdoorDryBulb <= state.dataDXCoils->DXCoil(DXCoilNum).MaxOATDefrost && state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) != WaterCooled) { // Calculate defrost adjustment factors depending on defrost control type - if (DXCoil(DXCoilNum).DefrostControl == Timed) { - FractionalDefrostTime = DXCoil(DXCoilNum).DefrostTime; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == Timed) { + FractionalDefrostTime = state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime; if (FractionalDefrostTime > 0.0) { HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw; InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw; @@ -10410,17 +10309,17 @@ namespace DXCoils { if (FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle) { LoadDueToDefrost = - (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (DXCoil(DXCoilNum).RatedTotCap(Mode) / 1.01667); - DefrostEIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); - DXCoil(DXCoilNum).DefrostPower = - DefrostEIRTempModFac * (DXCoil(DXCoilNum).RatedTotCap(Mode) / 1.01667) * FractionalDefrostTime; + (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) / 1.01667); + DefrostEIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = + DefrostEIRTempModFac * (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) / 1.01667) * FractionalDefrostTime; } else { // Defrost strategy is resistive - DXCoil(DXCoilNum).DefrostPower = DXCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; } } else { // Defrost is not active because (FractionalDefrostTime .EQ. 0.0) - DXCoil(DXCoilNum).DefrostPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = 0.0; } } @@ -10464,145 +10363,145 @@ namespace DXCoils { // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quaratic curve if sufficient manufacturer data is available. - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).EIRFTemp(Mode)).NumDims == 1) { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp(Mode), OutdoorDryBulb); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode)).NumDims == 1) { + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode), OutdoorDryBulb); } else { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirDryBulbTemp, OutdoorDryBulb); + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirDryBulbTemp, OutdoorDryBulb); } - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); } else { EIRTempModFac = 1.0; EIRFlowModFac = 1.0; } if (EIRTempModFac < 0.0) { - if (DXCoil(DXCoilNum).EIRFTErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).EIRFTErrIndex == 0) { ShowWarningMessage(state, - format("The EIRTempModFac curve value for DX heating coil {} ={:.2R}", DXCoil(DXCoilNum).Name, EIRTempModFac)); + format("The EIRTempModFac curve value for DX heating coil {} ={:.2R}", state.dataDXCoils->DXCoil(DXCoilNum).Name, EIRTempModFac)); ShowContinueError(state, "EIRTempModFac curve value must be > 0. EIRTempModFac curve value has been reset to 0.0 and simulation is continuing."); - ShowContinueError(state, "Check the IO reference manual for EIRTempModFac curve guidance [ " + DXCoil(DXCoilNum).DXCoilType + " ]."); + ShowContinueError(state, "Check the IO reference manual for EIRTempModFac curve guidance [ " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " ]."); ShowContinueErrorTimeStamp(state, ""); } ShowRecurringWarningErrorAtEnd(state, "DX heating coil EIRTempModFac curve value < 0.0 warning continues... ", - DXCoil(DXCoilNum).EIRFTErrIndex, + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTErrIndex, EIRTempModFac, EIRTempModFac); EIRTempModFac = 0.0; } - EIR = DXCoil(DXCoilNum).RatedEIR(Mode) * EIRTempModFac * EIRFlowModFac; + EIR = state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(Mode) * EIRTempModFac * EIRFlowModFac; // Calculate modified PartLoadRatio due to defrost (reverse-cycle defrost only) if (TotCapAdj > 0.0) { PLRHeating = min(1.0, (PartLoadRatio + (LoadDueToDefrost * PartLoadRatio) / TotCapAdj)); } else { PLRHeating = 0.0; } - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating) { - PLF = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(Mode), PLRHeating); // Calculate part-load factor + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating) { + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode), PLRHeating); // Calculate part-load factor } else { PLF = 1.0; } if (PLF < 0.7) { - if (DXCoil(DXCoilNum).PLRErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex == 0) { ShowWarningMessage(state, format("The PLF curve value for DX heating coil {} ={:.2R} for part-load ratio ={:.2R}", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF, PLRHeating)); ShowContinueError(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); + ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); PLF = 0.7; } - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); - if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { - if (DXCoil(DXCoilNum).ErrIndex4 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); + if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4 == 0) { ShowWarningMessage(state, format("The runtime fraction for DX heating coil {} exceeded 1.0. [{:.4R}].", - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction is set to 1.0 and the simulation continues..."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex4, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 - } else if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // if cycling fan, send coil part-load fraction to on/off fan via HVACDataGlobals if (FanOpMode == CycFanCycCoil) OnOffFanPartLoadFraction = PLF; - DXCoil(DXCoilNum).ElecHeatingPower = TotCap * EIR * DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * InputPowerMultiplier; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = TotCap * EIR * state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * InputPowerMultiplier; // Calculate crankcase heater power using the runtime fraction for this DX heating coil only if there is no companion DX coil. // Else use the largest runtime fraction of this DX heating coil and the companion DX cooling coil. - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - max(DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - max(state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction)); } - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - DXCoil(DXCoilNum).TotalHeatingEnergyRate = AirMassFlow * (OutletAirEnthalpy - InletAirEnthalpy); + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = AirMassFlow * (OutletAirEnthalpy - InletAirEnthalpy); // Adjust defrost power to correct for DOE-2 bug where defrost power is constant regardless of compressor runtime fraction // Defrosts happen based on compressor run time (frost buildup on outdoor coil), not total elapsed time. - DXCoil(DXCoilNum).DefrostPower *= DXCoil(DXCoilNum).HeatingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower *= state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction; - DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; - DXCoil(DXCoilNum).CompressorPartLoadRatio = PartLoadRatio; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio = PartLoadRatio; } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; - DXCoil(DXCoilNum).ElecHeatingPower = 0.0; - DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; - DXCoil(DXCoilNum).DefrostPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = 0.0; // Calculate crankcase heater power using the runtime fraction for this DX heating coil (here DXHeatingCoilRTF=0) if // there is no companion DX coil, or the runtime fraction of the companion DX cooling coil (here DXCoolingCoilRTF>=0). - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction); } - DXCoil(DXCoilNum).CompressorPartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio = 0.0; } // end of on/off if - else - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoilFanOpMode(DXCoilNum) = FanOpMode; - DXCoilPartLoadRatio(DXCoilNum) = PLRHeating; - DXCoilTotalHeating(DXCoilNum) = DXCoil(DXCoilNum).TotalHeatingEnergyRate; - DXCoilHeatInletAirDBTemp(DXCoilNum) = InletAirDryBulbTemp; - DXCoilHeatInletAirWBTemp(DXCoilNum) = InletAirWetBulbC; + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoilFanOpMode(DXCoilNum) = FanOpMode; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = PLRHeating; + state.dataDXCoils->DXCoilTotalHeating(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate; + state.dataDXCoils->DXCoilHeatInletAirDBTemp(DXCoilNum) = InletAirDryBulbTemp; + state.dataDXCoils->DXCoilHeatInletAirWBTemp(DXCoilNum) = InletAirWetBulbC; // set outlet node conditions - int airOutletNode = DXCoil(DXCoilNum).AirOutNode; - Node(airOutletNode).Temp = DXCoil(DXCoilNum).OutletAirTemp; - Node(airOutletNode).HumRat = DXCoil(DXCoilNum).OutletAirHumRat; + int airOutletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode; + Node(airOutletNode).Temp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + Node(airOutletNode).HumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; // calc secondary coil if specified - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { CalcSecondaryDXCoils(state, DXCoilNum); } } @@ -10710,8 +10609,8 @@ namespace DXCoils { LocalForceOn = false; } - if (DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -10719,22 +10618,22 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorDryBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; - OutdoorHumRat = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; + OutdoorDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; + OutdoorHumRat = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; OutdoorWetBulb = PsyTwbFnTdbWPb(state, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure); } CompAmbTemp = OutdoorDryBulb; - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; } - } else if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; } else { @@ -10745,60 +10644,60 @@ namespace DXCoils { CompAmbTemp = OutdoorDryBulb; } - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - AirMassFlowRatio = DXCoil(DXCoilNum).InletAirMassFlowRateMax / DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + AirMassFlowRatio = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; AirMassFlowRatio2 = 1.0; // DXCoil(DXCoilNum)%RatedAirMassFlowRate2 / DXCoil(DXCoilNum)%RatedAirMassFlowRate(Mode) // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // InletAirPressure = DXCoil(DXCoilNum)%InletAirPressure // InletAirWetBulbC = PsyTwbFnTdbWPb(InletAirDryBulbTemp,InletAirHumRat,InletAirPressure) InletAirWetBulbC = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); - if (DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == AirCooled) { CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp - } else if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { // Outdoor wet-bulb temp from DataEnvironment + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - DXCoil(DXCoilNum).EvapCondEffect(Mode)); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(Mode)); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure); } - if ((AirMassFlow > 0.0 && CompAmbTemp >= DXCoil(DXCoilNum).MinOATCompressor) && - ((GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0) || (LocalForceOn)) && (SpeedRatio > 0.0 || CycRatio > 0.0)) { + if ((AirMassFlow > 0.0 && CompAmbTemp >= state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor) && + ((GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0) || (LocalForceOn)) && (SpeedRatio > 0.0 || CycRatio > 0.0)) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat); if (SpeedRatio > 0.0) { // Adjust high speed coil bypass factor for actual maximum air flow rate. - RatedCBFHS = DXCoil(DXCoilNum).RatedCBF(Mode); - CBFHS = AdjustCBF(RatedCBFHS, DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode), DXCoil(DXCoilNum).InletAirMassFlowRateMax); + RatedCBFHS = state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode); + CBFHS = AdjustCBF(RatedCBFHS, state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode), state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax); // get high speed total capacity and SHR at current conditions CalcTotCapSHR(state, InletAirDryBulbTemp, InletAirHumRat, InletAirEnthalpy, InletAirWetBulbC, AirMassFlowRatio, - DXCoil(DXCoilNum).InletAirMassFlowRateMax, - DXCoil(DXCoilNum).RatedTotCap(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax, + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode), CBFHS, - DXCoil(DXCoilNum).CCapFTemp(Mode), - DXCoil(DXCoilNum).CCapFFlow(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(Mode), TotCapHS, SHRHS, CondInletTemp, OutdoorPressure, - DXCoil(DXCoilNum).capModFacTotal); + state.dataDXCoils->DXCoil(DXCoilNum).capModFacTotal); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // CondInletTemp, Node(DXCoil(DXCoilNum)%AirInNode)%Press) // get the high speed SHR from user specified SHR modifier curves - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { SHRHS = CalcSHRUserDefinedCurves(state, InletAirDryBulbTemp, InletAirWetBulbC, AirMassFlowRatio, - DXCoil(DXCoilNum).SHRFTemp(Mode), - DXCoil(DXCoilNum).SHRFFlow(Mode), - DXCoil(DXCoilNum).RatedSHR(Mode)); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(Mode)); } // get low speed total capacity and SHR at current conditions CalcTotCapSHR(state, InletAirDryBulbTemp, @@ -10806,37 +10705,37 @@ namespace DXCoils { InletAirEnthalpy, InletAirWetBulbC, 1.0, - DXCoil(DXCoilNum).RatedAirMassFlowRate2, - DXCoil(DXCoilNum).RatedTotCap2, - DXCoil(DXCoilNum).RatedCBF2, - DXCoil(DXCoilNum).CCapFTemp2, - DXCoil(DXCoilNum).CCapFFlow(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF2, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(Mode), TotCapLS, SHRLS, CondInletTemp, OutdoorPressure, - DXCoil(DXCoilNum).capModFacTotal); + state.dataDXCoils->DXCoil(DXCoilNum).capModFacTotal); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // Node(DXCoil(DXCoilNum)%AirInNode)%Press) // get the low speed SHR from user specified SHR modifier curves - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { SHRLS = CalcSHRUserDefinedCurves(state, InletAirDryBulbTemp, InletAirWetBulbC, AirMassFlowRatio2, - DXCoil(DXCoilNum).SHRFTemp2, - DXCoil(DXCoilNum).SHRFFlow2, - DXCoil(DXCoilNum).RatedSHR2); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp2, + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR2); } // get high speed EIR at current conditions - EIRTempModFacHS = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirWetBulbC, CondInletTemp); - EIRFlowModFacHS = CurveValue(state, DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); - EIRHS = DXCoil(DXCoilNum).RatedEIR(Mode) * EIRFlowModFacHS * EIRTempModFacHS; + EIRTempModFacHS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirWetBulbC, CondInletTemp); + EIRFlowModFacHS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); + EIRHS = state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(Mode) * EIRFlowModFacHS * EIRTempModFacHS; // get low speed EIR at current conditions // EIRTempModFacLS = CurveValue(state, DXCoil(DXCoilNum)%EIRFTemp(Mode),InletAirWetBulbC,CondInletTemp) // CR7307 changed EIRTempModFacLS calculation to that shown below. - EIRTempModFacLS = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp2, InletAirWetBulbC, CondInletTemp); - EIRLS = DXCoil(DXCoilNum).RatedEIR2 * EIRTempModFacLS; + EIRTempModFacLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp2, InletAirWetBulbC, CondInletTemp); + EIRLS = state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR2 * EIRTempModFacLS; // get current total capacity, SHR, EIR if (SpeedRatio >= 1.0) { @@ -10844,22 +10743,22 @@ namespace DXCoils { SHR = SHRHS; EIR = EIRHS; CBFNom = CBFHS; - AirMassFlowNom = DXCoil(DXCoilNum).InletAirMassFlowRateMax; - CondAirMassFlow = RhoAir * DXCoil(DXCoilNum).EvapCondAirFlow(Mode); - EvapCondPumpElecPower = DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode); + AirMassFlowNom = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax; + CondAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode); + EvapCondPumpElecPower = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode); } else { TotCap = SpeedRatio * TotCapHS + (1.0 - SpeedRatio) * TotCapLS; EIR = SpeedRatio * EIRHS + (1.0 - SpeedRatio) * EIRLS; - CBFNom = SpeedRatio * CBFHS + (1.0 - SpeedRatio) * DXCoil(DXCoilNum).RatedCBF2; + CBFNom = SpeedRatio * CBFHS + (1.0 - SpeedRatio) * state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF2; AirMassFlowNom = - SpeedRatio * DXCoil(DXCoilNum).InletAirMassFlowRateMax + (1.0 - SpeedRatio) * DXCoil(DXCoilNum).RatedAirMassFlowRate2; + SpeedRatio * state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax + (1.0 - SpeedRatio) * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate2; CondAirMassFlow = - RhoAir * (SpeedRatio * DXCoil(DXCoilNum).EvapCondAirFlow(Mode) + (1.0 - SpeedRatio) * DXCoil(DXCoilNum).EvapCondAirFlow2); - EvapCondPumpElecPower = SpeedRatio * DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) + - (1.0 - SpeedRatio) * DXCoil(DXCoilNum).EvapCondPumpElecNomPower2; + RhoAir * (SpeedRatio * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode) + (1.0 - SpeedRatio) * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2); + EvapCondPumpElecPower = SpeedRatio * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower(Mode) + + (1.0 - SpeedRatio) * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2; } hDelta = TotCap / AirMassFlow; - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { if (SpeedRatio >= 1.0) { SHR = SHRHS; } else { @@ -10919,24 +10818,24 @@ namespace DXCoils { InletAirHumRat, OutletAirDryBulbTemp, OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); - DXCoil(DXCoilNum).ElecCoolingPower = TotCap * EIR; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = TotCap * EIR; // Calculation for heat reclaim needs to be corrected to use compressor power (not including condenser fan power) - HeatReclaimDXCoil(DXCoilNum).AvailCapacity = DXCoil(DXCoilNum).TotalCoolingEnergyRate + DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).PartLoadRatio = 1.0; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; + HeatReclaimDXCoil(DXCoilNum).AvailCapacity = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = 1.0; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; } else if (CycRatio > 0.0) { - if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { // Outdoor wet-bulb temp from DataEnvironment + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - DXCoil(DXCoilNum).EvapCondEffect2); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect2); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure); } @@ -10948,30 +10847,30 @@ namespace DXCoils { InletAirEnthalpy, InletAirWetBulbC, 1.0, - DXCoil(DXCoilNum).RatedAirMassFlowRate2, - DXCoil(DXCoilNum).RatedTotCap2, - DXCoil(DXCoilNum).RatedCBF2, - DXCoil(DXCoilNum).CCapFTemp2, - DXCoil(DXCoilNum).CCapFFlow(Mode), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF2, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2, + state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(Mode), TotCapLS, SHRLS, CondInletTemp, OutdoorPressure, - DXCoil(DXCoilNum).capModFacTotal); + state.dataDXCoils->DXCoil(DXCoilNum).capModFacTotal); // get the low speed SHR from user specified SHR modifier curves - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { SHRLS = CalcSHRUserDefinedCurves(state, InletAirDryBulbTemp, InletAirWetBulbC, 1.0, - DXCoil(DXCoilNum).SHRFTemp2, - DXCoil(DXCoilNum).SHRFFlow2, - DXCoil(DXCoilNum).RatedSHR2); + state.dataDXCoils->DXCoil(DXCoilNum).SHRFTemp2, + state.dataDXCoils->DXCoil(DXCoilNum).SHRFFlow2, + state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR2); } // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // Node(DXCoil(DXCoilNum)%AirInNode)%Press) hDelta = TotCapLS / AirMassFlow; - if (DXCoil(DXCoilNum).UserSHRCurveExists) { + if (state.dataDXCoils->DXCoil(DXCoilNum).UserSHRCurveExists) { SHR = SHRLS; LSOutletAirEnthalpy = InletAirEnthalpy - hDelta; if (SHR < 1.0) { @@ -10993,7 +10892,7 @@ namespace DXCoils { } else { // Adjust CBF for off-nominal flow - CBF = AdjustCBF(DXCoil(DXCoilNum).RatedCBF2, DXCoil(DXCoilNum).RatedAirMassFlowRate2, AirMassFlow); + CBF = AdjustCBF(state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF2, state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate2, AirMassFlow); // Calculate new apparatus dew point conditions hADP = InletAirEnthalpy - hDelta / (1.0 - CBF); tADP = PsyTsatFnHPb(state, hADP, OutdoorPressure, RoutineNameNewDewPointConditions); @@ -11026,21 +10925,21 @@ namespace DXCoils { // get low speed EIR at current conditions // EIRTempModFacLS = CurveValue(state, DXCoil(DXCoilNum)%EIRFTemp(Mode),InletAirWetBulbC,CondInletTemp) // CR7307 changed EIRTempModFacLS calculation to that shown below. - EIRTempModFacLS = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp2, InletAirWetBulbC, CondInletTemp); - EIRLS = DXCoil(DXCoilNum).RatedEIR2 * EIRTempModFacLS; + EIRTempModFacLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp2, InletAirWetBulbC, CondInletTemp); + EIRLS = state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR2 * EIRTempModFacLS; // get the part load factor that will account for cycling losses - PLF = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(Mode), CycRatio); + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode), CycRatio); if (PLF < 0.7) { PLF = 0.7; } // calculate the run time fraction - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CycRatio / PLF; - DXCoil(DXCoilNum).PartLoadRatio = CycRatio; - if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CycRatio / PLF; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = CycRatio; + if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // get the eletrical power consumption - DXCoil(DXCoilNum).ElecCoolingPower = TotCapLS * EIRLS * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = TotCapLS * EIRLS * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; // Coil total/sensible/latent cooling rates and electrical power CalcComponentSensibleLatentOutput(AirMassFlow, @@ -11048,75 +10947,75 @@ namespace DXCoils { InletAirHumRat, OutletAirDryBulbTemp, OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); - HeatReclaimDXCoil(DXCoilNum).AvailCapacity = DXCoil(DXCoilNum).TotalCoolingEnergyRate + DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; - CondAirMassFlow = RhoAir * DXCoil(DXCoilNum).EvapCondAirFlow2 * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; - EvapCondPumpElecPower = DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; - } - - if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); + HeatReclaimDXCoil(DXCoilNum).AvailCapacity = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; + CondAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow2 * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + EvapCondPumpElecPower = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecNomPower2 * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + } + + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { //****************** // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** RhoWater = RhoH2O(OutdoorDryBulb); - DXCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater; - DXCoil(DXCoilNum).EvapCondPumpElecPower = EvapCondPumpElecPower; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = EvapCondPumpElecPower; // set water system demand request (if needed) - if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode == iWaterSupply::FromTank) { - state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = - DXCoil(DXCoilNum).EvapWaterConsumpRate; + state.dataWaterData->WaterStorage(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate; } // Calculate basin heater power - CalcBasinHeaterPower(state, DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); - DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + CalcBasinHeaterPower(state, state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; - DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; // Calculate basin heater power - if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { - CalcBasinHeaterPower(state, DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + CalcBasinHeaterPower(state, state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); } } - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; // Save condenser inlet temp in the data structure + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; // Save condenser inlet temp in the data structure // set outlet node conditions - int airOutletNode = DXCoil(DXCoilNum).AirOutNode; - Node(airOutletNode).Temp = DXCoil(DXCoilNum).OutletAirTemp; - Node(airOutletNode).HumRat = DXCoil(DXCoilNum).OutletAirHumRat; + int airOutletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode; + Node(airOutletNode).Temp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + Node(airOutletNode).HumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; // calc secondary coil if specified - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { CalcSecondaryDXCoils(state, DXCoilNum); } } @@ -11149,19 +11048,19 @@ namespace DXCoils { // 1-2=normal mode: 1=stage 1 only, 2=stage 1&2 // 3-4=enhanced dehumidification mode: 3=stage 1 only, 4=stage 1&2 - if (DXCoil(DXCoilNum).NumCapacityStages == 1) { - DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + if (state.dataDXCoils->DXCoil(DXCoilNum).NumCapacityStages == 1) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } else { PerfMode = DehumidMode * 2 + 1; - if (DXCoil(DXCoilNum).CondenserType(PerfMode) == EvapCooled) { - DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); - } else if (DXCoil(DXCoilNum).CondenserType(PerfMode + 1) == EvapCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(PerfMode) == EvapCooled) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(PerfMode + 1) == EvapCooled) { CalcBasinHeaterPower(state, - DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); - DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - DXCoil(DXCoilNum).CoolingCoilStg2RuntimeFrac); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilStg2RuntimeFrac); } } } @@ -11540,7 +11439,8 @@ namespace DXCoils { return SHR; } - Real64 CalcEffectiveSHR(int const DXCoilNum, // Index number for cooling coil + Real64 CalcEffectiveSHR(EnergyPlusData &state, + int const DXCoilNum, // Index number for cooling coil Real64 const SHRss, // Steady-state sensible heat ratio Real64 const RTF, // Compressor run-time fraction Real64 const QLatRated, // Rated latent capacity @@ -11602,16 +11502,16 @@ namespace DXCoils { Real64 Ton_heating; Real64 Toff_heating; - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_MultiSpeedCooling) { - Twet_Rated = DXCoil(DXCoilNum).Twet_Rated(Mode); - Gamma_Rated = DXCoil(DXCoilNum).Gamma_Rated(Mode); - Nmax = DXCoil(DXCoilNum).MaxONOFFCyclesperHour(Mode); - Tcl = DXCoil(DXCoilNum).LatentCapacityTimeConstant(Mode); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilDX_MultiSpeedCooling) { + Twet_Rated = state.dataDXCoils->DXCoil(DXCoilNum).Twet_Rated(Mode); + Gamma_Rated = state.dataDXCoils->DXCoil(DXCoilNum).Gamma_Rated(Mode); + Nmax = state.dataDXCoils->DXCoil(DXCoilNum).MaxONOFFCyclesperHour(Mode); + Tcl = state.dataDXCoils->DXCoil(DXCoilNum).LatentCapacityTimeConstant(Mode); } else { - Twet_Rated = DXCoil(DXCoilNum).MSTwet_Rated(Mode); - Gamma_Rated = DXCoil(DXCoilNum).MSGamma_Rated(Mode); - Nmax = DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour(Mode); - Tcl = DXCoil(DXCoilNum).MSLatentCapacityTimeConstant(Mode); + Twet_Rated = state.dataDXCoils->DXCoil(DXCoilNum).MSTwet_Rated(Mode); + Gamma_Rated = state.dataDXCoils->DXCoil(DXCoilNum).MSGamma_Rated(Mode); + Nmax = state.dataDXCoils->DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour(Mode); + Tcl = state.dataDXCoils->DXCoil(DXCoilNum).MSLatentCapacityTimeConstant(Mode); } // No moisture evaporation (latent degradation) occurs for runtime fraction of 1.0 @@ -11939,8 +11839,8 @@ namespace DXCoils { Real64 AirVolumeFlowRate; // Air volume flow rate across the heating coil Real64 VolFlowperRatedTotCap; // Air volume flow rate divided by rated total heating capacity - if (DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode) != 0) { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode)).Press; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode) != 0) { + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -11948,20 +11848,20 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorDryBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode)).Temp; - OutdoorHumRat = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode)).HumRat; + OutdoorDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode)).Temp; + OutdoorHumRat = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(DXMode)).HumRat; OutdoorWetBulb = PsyTwbFnTdbWPb(state, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, RoutineName); } - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } - } else if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); - OutdoorWetBulb = DXCoil(DXCoilNum).EvapInletWetBulb; + } else if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorWetBulb = state.dataDXCoils->DXCoil(DXCoilNum).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } else { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -11973,9 +11873,9 @@ namespace DXCoils { if (SpeedNum > 1) { SpeedNumLS = SpeedNum - 1; SpeedNumHS = SpeedNum; - if (SpeedNum > DXCoil(DXCoilNum).NumOfSpeeds) { - SpeedNumLS = DXCoil(DXCoilNum).NumOfSpeeds - 1; - SpeedNumHS = DXCoil(DXCoilNum).NumOfSpeeds; + if (SpeedNum > state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) { + SpeedNumLS = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; + SpeedNumHS = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; } } else { SpeedNumLS = 1; @@ -11983,11 +11883,11 @@ namespace DXCoils { } MSHPWasteHeat = 0.0; - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - AirMassFlowRatioLS = MSHPMassFlowRateLow / DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumLS); - AirMassFlowRatioHS = MSHPMassFlowRateHigh / DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumHS); + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + AirMassFlowRatioLS = MSHPMassFlowRateLow / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumLS); + AirMassFlowRatioHS = MSHPMassFlowRateHigh / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumHS); if ((AirMassFlow > 0.0) && (CycRatio > 0.0) && (MSHPMassFlowRateHigh == 0.0)) { - ShowSevereError(state, "CalcMultiSpeedDXCoilCooling: " + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowSevereError(state, "CalcMultiSpeedDXCoilCooling: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + " Developer error - inconsistent airflow rates."); if (MSHPMassFlowRateLow == 0.0 && SpeedNum > 1) { ShowContinueError(state, "When AirMassFlow > 0.0 and CycRatio > 0.0 and SpeedNum > 1, then MSHPMassFlowRateLow and MSHPMassFlowRateHigh " @@ -12010,7 +11910,7 @@ namespace DXCoils { ShowFatalError(state, "Preceding condition(s) causes termination."); } } else if (CycRatio > 1.0 || SpeedRatio > 1.0) { - ShowSevereError(state, "CalcMultiSpeedDXCoilCooling: " + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowSevereError(state, "CalcMultiSpeedDXCoilCooling: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + " Developer error - inconsistent speed ratios."); ShowContinueError(state, "CycRatio and SpeedRatio must be between 0.0 and 1.0"); ShowContinueErrorTimeStamp(state, ""); @@ -12018,31 +11918,31 @@ namespace DXCoils { ShowFatalError(state, "Preceding condition(s) causes termination."); } - DXCoil(DXCoilNum).PartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = 0.0; HeatReclaimDXCoil(DXCoilNum).AvailCapacity = 0.0; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // InletAirPressure = DXCoil(DXCoilNum)%InletAirPressure // InletAirWetBulbC = PsyTwbFnTdbWPb(InletAirDryBulbTemp,InletAirHumRat,InletAirPressure) InletAirWetBulbC = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure, RoutineName); - if (DXCoil(DXCoilNum).CondenserType(DXMode) == AirCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(DXMode) == AirCooled) { CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp - } else if (DXCoil(DXCoilNum).CondenserType(DXMode) == EvapCooled) { + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(DXMode) == EvapCooled) { // Outdoor wet-bulb temp from DataEnvironment + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - DXCoil(DXCoilNum).MSEvapCondEffect(SpeedNumHS)); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondEffect(SpeedNumHS)); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure, RoutineName); } - if (OutdoorDryBulb < DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = DXCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (OutdoorDryBulb < state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } - if ((AirMassFlow > 0.0 && CondInletTemp >= DXCoil(DXCoilNum).MinOATCompressor) && - (GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0) && ((SpeedRatio > 0.0 && SingleMode == 0) || CycRatio > 0.0) && + if ((AirMassFlow > 0.0 && CondInletTemp >= state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor) && + (GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0) && ((SpeedRatio > 0.0 && SingleMode == 0) || CycRatio > 0.0) && (CompOp == On)) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat, RoutineName); @@ -12052,14 +11952,14 @@ namespace DXCoils { AirVolumeFlowRate = MSHPMassFlowRateLow / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat, RoutineName); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // AirVolumeFlowRate = AirMassFlow/PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS); if ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxCoolVolFlowPerRatedTotCap(DXCT))) { - if (DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS) == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS) == 0) { ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at speed {}.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumLS)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -12072,10 +11972,10 @@ namespace DXCoils { } ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range " "at speed {} error continues...", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumLS), - DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS), + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS), VolFlowperRatedTotCap, VolFlowperRatedTotCap); } @@ -12084,14 +11984,14 @@ namespace DXCoils { AirVolumeFlowRate = MSHPMassFlowRateHigh / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat, RoutineName); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // AirVolumeFlowRate = AirMassFlow/PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS); if ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxCoolVolFlowPerRatedTotCap(DXCT))) { - if (DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS) == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS) == 0) { ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at speed {}.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumHS)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -12104,19 +12004,19 @@ namespace DXCoils { } ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range " "at speed {} error continues...", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumHS), - DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS), + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS), VolFlowperRatedTotCap, VolFlowperRatedTotCap); } // Adjust high speed coil bypass factor for actual maximum air flow rate. - RatedCBFHS = DXCoil(DXCoilNum).MSRatedCBF(SpeedNumHS); - CBFHS = AdjustCBF(RatedCBFHS, DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumHS), MSHPMassFlowRateHigh); - RatedCBFLS = DXCoil(DXCoilNum).MSRatedCBF(SpeedNumLS); - CBFLS = AdjustCBF(RatedCBFLS, DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumLS), MSHPMassFlowRateLow); + RatedCBFHS = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF(SpeedNumHS); + CBFHS = AdjustCBF(RatedCBFHS, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumHS), MSHPMassFlowRateHigh); + RatedCBFLS = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF(SpeedNumLS); + CBFLS = AdjustCBF(RatedCBFLS, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumLS), MSHPMassFlowRateLow); // get low speed total capacity and SHR at current conditions CalcTotCapSHR(state, InletAirDryBulbTemp, InletAirHumRat, @@ -12124,15 +12024,15 @@ namespace DXCoils { InletAirWetBulbC, AirMassFlowRatioLS, MSHPMassFlowRateLow, - DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS), + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS), CBFLS, - DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS), - DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumLS), + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS), + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumLS), TotCapLS, SHRLS, CondInletTemp, OutdoorPressure, - DXCoil(DXCoilNum).capModFacTotal); + state.dataDXCoils->DXCoil(DXCoilNum).capModFacTotal); // get low speed outlet conditions hDelta = TotCapLS / MSHPMassFlowRateLow; // Calculate new apparatus dew point conditions @@ -12168,15 +12068,15 @@ namespace DXCoils { InletAirWetBulbC, AirMassFlowRatioHS, MSHPMassFlowRateHigh, - DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS), + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS), CBFHS, - DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS), - DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumHS), + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS), + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumHS), TotCapHS, SHRHS, CondInletTemp, OutdoorPressure, - DXCoil(DXCoilNum).capModFacTotal); + state.dataDXCoils->DXCoil(DXCoilNum).capModFacTotal); hDelta = TotCapHS / MSHPMassFlowRateHigh; // Calculate new apparatus dew point conditions hADP = InletAirEnthalpy - hDelta / (1.0 - CBFHS); @@ -12193,16 +12093,16 @@ namespace DXCoils { } // cr8918 SHRHS = MIN((hTinwADP-hADP)/(InletAirEnthalpy-hADP),1.0d0) // get the part load factor that will account for cycling losses - PLF = CurveValue(state, DXCoil(DXCoilNum).MSPLFFPLR(SpeedNumHS), SpeedRatio); + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(SpeedNumHS), SpeedRatio); if (PLF < 0.7) { PLF = 0.7; } // calculate the run time fraction - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = SpeedRatio / PLF; - DXCoil(DXCoilNum).PartLoadRatio = SpeedRatio; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = SpeedRatio / PLF; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = SpeedRatio; - if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // get high speed outlet conditions @@ -12218,13 +12118,14 @@ namespace DXCoils { // If constant fan with cycling compressor, call function to determine "effective SHR" // which includes the part-load degradation on latent capacity - if (DXCoil(DXCoilNum).LatentImpact && FanOpMode == ContFanCycCoil && SpeedRatio > 0.0) { - QLatRated = DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) * (1.0 - DXCoil(DXCoilNum).MSRatedSHR(SpeedNumHS)); + if (state.dataDXCoils->DXCoil(DXCoilNum).LatentImpact && FanOpMode == ContFanCycCoil && SpeedRatio > 0.0) { + QLatRated = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(SpeedNumHS)); QLatActual = TotCapHS * (1.0 - SHRHS); SHRUnadjusted = SHRHS; - SHR = CalcEffectiveSHR(DXCoilNum, + SHR = CalcEffectiveSHR(state, + DXCoilNum, SHRHS, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, QLatRated, QLatActual, InletAirDryBulbTemp, @@ -12242,27 +12143,27 @@ namespace DXCoils { } // get high speed EIR at current conditions - EIRTempModFacHS = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS), InletAirWetBulbC, CondInletTemp); - EIRFlowModFacHS = CurveValue(state, DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumHS), AirMassFlowRatioHS); - EIRHS = 1.0 / DXCoil(DXCoilNum).MSRatedCOP(SpeedNumHS) * EIRFlowModFacHS * EIRTempModFacHS; + EIRTempModFacHS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS), InletAirWetBulbC, CondInletTemp); + EIRFlowModFacHS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumHS), AirMassFlowRatioHS); + EIRHS = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(SpeedNumHS) * EIRFlowModFacHS * EIRTempModFacHS; // get low speed EIR at current conditions - EIRTempModFacLS = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS), InletAirWetBulbC, CondInletTemp); - EIRFlowModFacLS = CurveValue(state, DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumLS), AirMassFlowRatioLS); - EIRLS = 1.0 / DXCoil(DXCoilNum).MSRatedCOP(SpeedNumLS) * EIRTempModFacLS * EIRFlowModFacLS; + EIRTempModFacLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS), InletAirWetBulbC, CondInletTemp); + EIRFlowModFacLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumLS), AirMassFlowRatioLS); + EIRLS = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(SpeedNumLS) * EIRTempModFacLS * EIRFlowModFacLS; // get current total capacity, SHR, EIR if (SpeedRatio >= 1.0) { SHR = SHRHS; EIR = EIRHS; - CondAirMassFlow = RhoAir * DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNumHS); - EvapCondPumpElecPower = DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNumHS); + CondAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNumHS); + EvapCondPumpElecPower = state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNumHS); } else { EIR = SpeedRatio * EIRHS + (1.0 - SpeedRatio) * EIRLS; SHR = SpeedRatio * SHRHS + (1.0 - SpeedRatio) * SHRLS; - CondAirMassFlow = RhoAir * (SpeedRatio * DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNumHS) + - (1.0 - SpeedRatio) * DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNumLS)); - EvapCondPumpElecPower = SpeedRatio * DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNumHS) + - (1.0 - SpeedRatio) * DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNumLS); + CondAirMassFlow = RhoAir * (SpeedRatio * state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNumHS) + + (1.0 - SpeedRatio) * state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNumLS)); + EvapCondPumpElecPower = SpeedRatio * state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNumHS) + + (1.0 - SpeedRatio) * state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNumLS); } // Outlet calculation @@ -12288,11 +12189,11 @@ namespace DXCoils { SensibleOutputHS, LatentOutputHS, TotalOutputHS); - DXCoil(DXCoilNum).TotalCoolingEnergyRate = TotalOutputHS * SpeedRatio + TotalOutputLS * (1.0 - SpeedRatio); - DXCoil(DXCoilNum).SensCoolingEnergyRate = SensibleOutputHS * SpeedRatio + SensibleOutputLS * (1.0 - SpeedRatio); - DXCoil(DXCoilNum).LatCoolingEnergyRate = LatentOutputHS * SpeedRatio + LatentOutputLS * (1.0 - SpeedRatio); + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = TotalOutputHS * SpeedRatio + TotalOutputLS * (1.0 - SpeedRatio); + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate = SensibleOutputHS * SpeedRatio + SensibleOutputLS * (1.0 - SpeedRatio); + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate = LatentOutputHS * SpeedRatio + LatentOutputLS * (1.0 - SpeedRatio); // Average outlet enthalpy - OutletAirEnthalpy = InletAirEnthalpy - DXCoil(DXCoilNum).TotalCoolingEnergyRate / DXCoil(DXCoilNum).InletAirMassFlowRate; + OutletAirEnthalpy = InletAirEnthalpy - state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate / state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; if (FanOpMode == CycFanCycCoil) OnOffFanPartLoadFraction = 1.0; // Update outlet conditions @@ -12309,7 +12210,7 @@ namespace DXCoils { Real64 MinAirHumRat(0.0); // set to zero because MinAirHumRat is unused argument Hfg = PsyHfgAirFnWTdb(MinAirHumRat, HSOutletAirDryBulbTemp * SpeedRatio + (1.0 - SpeedRatio) * LSOutletAirDryBulbTemp); // Average outlet HR - OutletAirHumRat = InletAirHumRat - DXCoil(DXCoilNum).LatCoolingEnergyRate / Hfg / DXCoil(DXCoilNum).InletAirMassFlowRate; + OutletAirHumRat = InletAirHumRat - state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate / Hfg / state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; } else { OutletAirHumRat = (HSOutletAirHumRat * SpeedRatio) + (LSOutletAirHumRat * (1.0 - SpeedRatio)); } @@ -12322,9 +12223,9 @@ namespace DXCoils { InletAirHumRat, OutletAirDryBulbTemp, OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); } } @@ -12332,48 +12233,48 @@ namespace DXCoils { HSElecCoolingPower = TotCapHS * EIRHS; // Power calculation - if (!DXCoil(DXCoilNum).PLRImpact) { - DXCoil(DXCoilNum).ElecCoolingPower = SpeedRatio * HSElecCoolingPower + (1.0 - SpeedRatio) * LSElecCoolingPower; + if (!state.dataDXCoils->DXCoil(DXCoilNum).PLRImpact) { + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = SpeedRatio * HSElecCoolingPower + (1.0 - SpeedRatio) * LSElecCoolingPower; } else { - DXCoil(DXCoilNum).ElecCoolingPower = DXCoil(DXCoilNum).CoolingCoilRuntimeFraction * HSElecCoolingPower + - (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction) * LSElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction * HSElecCoolingPower + + (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction) * LSElecCoolingPower; } // Calculation for heat reclaim needs to be corrected to use compressor power (not including condenser fan power) - HeatReclaimDXCoil(DXCoilNum).AvailCapacity = DXCoil(DXCoilNum).TotalCoolingEnergyRate + DXCoil(DXCoilNum).ElecCoolingPower; + HeatReclaimDXCoil(DXCoilNum).AvailCapacity = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; // Waste heat calculation // TODO: waste heat not considered even if defined in Cooling:DX:MultiSpeed, N16, \field Speed 1 Rated Waste Heat Fraction of // Power Input - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - if (DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS) == 0) { - WasteHeatLS = DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS) == 0) { + WasteHeatLS = state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); } else { - WasteHeatLS = CurveValue(state, DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS), OutdoorDryBulb, InletAirDryBulbTemp) * - DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); + WasteHeatLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS), OutdoorDryBulb, InletAirDryBulbTemp) * + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); } - if (DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS) == 0) { - WasteHeatHS = DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS) == 0) { + WasteHeatHS = state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); } else { - WasteHeatHS = CurveValue(state, DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS), OutdoorDryBulb, InletAirDryBulbTemp) * - DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); + WasteHeatHS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS), OutdoorDryBulb, InletAirDryBulbTemp) * + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); } - DXCoil(DXCoilNum).MSFuelWasteHeat = - (SpeedRatio * WasteHeatHS + (1.0 - SpeedRatio) * WasteHeatLS) * DXCoil(DXCoilNum).ElecCoolingPower; - if (DXCoil(DXCoilNum).MSHPHeatRecActive) { - MSHPWasteHeat = DXCoil(DXCoilNum).MSFuelWasteHeat; + state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat = + (SpeedRatio * WasteHeatHS + (1.0 - SpeedRatio) * WasteHeatLS) * state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive) { + MSHPWasteHeat = state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat; } } // Energy use for other fuel types - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - DXCoil(DXCoilNum).FuelUsed = DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; } - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; - DXCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; } else if (CycRatio > 0.0) { @@ -12384,14 +12285,14 @@ namespace DXCoils { AirVolumeFlowRate = MSHPMassFlowRateHigh / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat, RoutineName); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // AirVolumeFlowRate = AirMassFlow/PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum); if ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxCoolVolFlowPerRatedTotCap(DXCT))) { - if (DXCoil(DXCoilNum).MSErrIndex(SpeedNum) == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNum) == 0) { ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range at speed {}.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNum)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -12404,22 +12305,22 @@ namespace DXCoils { } ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total cooling capacity is out of range " "at speed {} error continues...", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumHS), - DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS), + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS), VolFlowperRatedTotCap, VolFlowperRatedTotCap); } - if (DXCoil(DXCoilNum).CondenserType(SpeedNum) == EvapCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(SpeedNum) == EvapCooled) { // Outdoor wet-bulb temp from DataEnvironment + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - DXCoil(DXCoilNum).MSEvapCondEffect(SpeedNum)); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondEffect(SpeedNum)); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure, RoutineName); } - RatedCBFLS = DXCoil(DXCoilNum).MSRatedCBF(SpeedNum); - CBFLS = AdjustCBF(RatedCBFLS, DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNum), MSHPMassFlowRateHigh); + RatedCBFLS = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF(SpeedNum); + CBFLS = AdjustCBF(RatedCBFLS, state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNum), MSHPMassFlowRateHigh); // Adjust low speed coil bypass factor for actual flow rate. // CBF = AdjustCBF(DXCoil(DXCoilNum)%RatedCBF2,DXCoil(DXCoilNum)%RatedAirMassFlowRate2,AirMassFlow) @@ -12430,20 +12331,20 @@ namespace DXCoils { InletAirWetBulbC, AirMassFlowRatioLS, MSHPMassFlowRateHigh, - DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum), + state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum), CBFLS, - DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum), - DXCoil(DXCoilNum).MSCCapFFlow(SpeedNum), + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum), + state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(SpeedNum), TotCapLS, SHRLS, CondInletTemp, OutdoorPressure, - DXCoil(DXCoilNum).capModFacTotal); + state.dataDXCoils->DXCoil(DXCoilNum).capModFacTotal); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // Node(DXCoil(DXCoilNum)%AirInNode)%Press) hDelta = TotCapLS / AirMassFlow; // Adjust CBF for off-nominal flow - CBF = AdjustCBF(DXCoil(DXCoilNum).MSRatedCBF(SpeedNum), DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNum), AirMassFlow); + CBF = AdjustCBF(state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF(SpeedNum), state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNum), AirMassFlow); // Calculate new apparatus dew point conditions hADP = InletAirEnthalpy - hDelta / (1.0 - CBF); tADP = PsyTsatFnHPb(state, hADP, OutdoorPressure, RoutineName); @@ -12460,16 +12361,16 @@ namespace DXCoils { // cr8918 SHR = MIN((hTinwADP-hADP)/(InletAirEnthalpy-hADP),1.0d0) // get the part load factor that will account for cycling losses - PLF = CurveValue(state, DXCoil(DXCoilNum).MSPLFFPLR(SpeedNum), CycRatio); + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(SpeedNum), CycRatio); if (FanOpMode == CycFanCycCoil && CycRatio == 1.0 && PLF != 1.0) { - if (DXCoil(DXCoilNum).PLFErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFErrIndex == 0) { ShowWarningMessage( - state, format("The PLF curve value for DX cooling coil {} ={:.2R} for part-load ratio = 1", DXCoil(DXCoilNum).Name, PLF)); + state, format("The PLF curve value for DX cooling coil {} ={:.2R} for part-load ratio = 1", state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF)); ShowContinueError(state, "PLF curve value must be = 1.0 and has been reset to 1.0. Simulation is continuing."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + "\": DX cooling coil PLF curve value <> 1.0 warning continues...", - DXCoil(DXCoilNum).PLFErrIndex, + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": DX cooling coil PLF curve value <> 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).PLFErrIndex, PLF, PLF); PLF = 1.0; @@ -12479,11 +12380,11 @@ namespace DXCoils { PLF = 0.7; } // calculate the run time fraction - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CycRatio / PLF; - DXCoil(DXCoilNum).PartLoadRatio = CycRatio; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CycRatio / PLF; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = CycRatio; - if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // get low speed outlet conditions @@ -12500,12 +12401,13 @@ namespace DXCoils { // If constant fan with cycling compressor, call function to determine "effective SHR" // which includes the part-load degradation on latent capacity if (FanOpMode == ContFanCycCoil) { - QLatRated = DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum) * (1.0 - DXCoil(DXCoilNum).MSRatedSHR(SpeedNum)); + QLatRated = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR(SpeedNum)); QLatActual = TotCapLS * (1.0 - SHR); SHRUnadjusted = SHR; - SHR = CalcEffectiveSHR(DXCoilNum, + SHR = CalcEffectiveSHR(state, + DXCoilNum, SHR, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, QLatRated, QLatActual, InletAirDryBulbTemp, @@ -12528,12 +12430,12 @@ namespace DXCoils { OutletAirHumRat = LSOutletAirHumRat; OutletAirDryBulbTemp = LSOutletAirDryBulbTemp; // get low speed EIR at current conditions - EIRTempModFacLS = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(SpeedNum), InletAirWetBulbC, CondInletTemp); - EIRFlowModFacLS = CurveValue(state, DXCoil(DXCoilNum).MSEIRFFlow(SpeedNum), AirMassFlowRatioLS); - EIRLS = 1.0 / DXCoil(DXCoilNum).MSRatedCOP(SpeedNum) * EIRTempModFacLS * EIRFlowModFacLS; + EIRTempModFacLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNum), InletAirWetBulbC, CondInletTemp); + EIRFlowModFacLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(SpeedNum), AirMassFlowRatioLS); + EIRLS = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(SpeedNum) * EIRTempModFacLS * EIRFlowModFacLS; // get the eletrical power consumption - DXCoil(DXCoilNum).ElecCoolingPower = TotCapLS * EIRLS * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = TotCapLS * EIRLS * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; // calculate cooling output power // AirMassFlow = DXCoil(DXCoilNum)%InletAirMassFlowRate CalcComponentSensibleLatentOutput(AirMassFlow, @@ -12541,133 +12443,133 @@ namespace DXCoils { InletAirHumRat, LSOutletAirDryBulbTemp, LSOutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); - DXCoil(DXCoilNum).TotalCoolingEnergyRate = DXCoil(DXCoilNum).TotalCoolingEnergyRate * CycRatio; - DXCoil(DXCoilNum).SensCoolingEnergyRate = DXCoil(DXCoilNum).SensCoolingEnergyRate * CycRatio; - DXCoil(DXCoilNum).LatCoolingEnergyRate = DXCoil(DXCoilNum).LatCoolingEnergyRate * CycRatio; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate * CycRatio; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate * CycRatio; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate = state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate * CycRatio; if (FanOpMode == ContFanCycCoil) { - OutletAirEnthalpy = InletAirEnthalpy - DXCoil(DXCoilNum).TotalCoolingEnergyRate / DXCoil(DXCoilNum).InletAirMassFlowRate; + OutletAirEnthalpy = InletAirEnthalpy - state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate / state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; Real64 MinAirHumRat(0.0); // set to zero because MinAirHumRat is unused argument Hfg = PsyHfgAirFnWTdb(MinAirHumRat, OutletAirDryBulbTemp * CycRatio + (1.0 - CycRatio) * InletAirDryBulbTemp); - OutletAirHumRat = InletAirHumRat - DXCoil(DXCoilNum).LatCoolingEnergyRate / Hfg / DXCoil(DXCoilNum).InletAirMassFlowRate; + OutletAirHumRat = InletAirHumRat - state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate / Hfg / state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; OutletAirDryBulbTemp = PsyTdbFnHW(OutletAirEnthalpy, OutletAirHumRat); if (OutletAirDryBulbTemp < OutletAirDryBulbTempSat) { // Limit to saturated conditions at OutletAirEnthalpy OutletAirDryBulbTemp = OutletAirDryBulbTempSat; OutletAirHumRat = PsyWFnTdbH(state, OutletAirDryBulbTemp, OutletAirEnthalpy, RoutineName); - CalcComponentSensibleLatentOutput(DXCoil(DXCoilNum).InletAirMassFlowRate, + CalcComponentSensibleLatentOutput(state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate, InletAirDryBulbTemp, InletAirHumRat, OutletAirDryBulbTemp, OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); } } // Calculation for heat reclaim needs to be corrected to use compressor power (not including condenser fan power) - HeatReclaimDXCoil(DXCoilNum).AvailCapacity = DXCoil(DXCoilNum).TotalCoolingEnergyRate + DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; - CondAirMassFlow = RhoAir * DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNum) * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; - EvapCondPumpElecPower = DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNum) * DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + HeatReclaimDXCoil(DXCoilNum).AvailCapacity = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirDryBulbTemp; + CondAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow(SpeedNum) * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; + EvapCondPumpElecPower = state.dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower(SpeedNum) * state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction; // Waste heat - if (DXCoil(DXCoilNum).MSHPHeatRecActive) { - if (DXCoil(DXCoilNum).MSWasteHeat(SpeedNum) == 0) { - DXCoil(DXCoilNum).MSFuelWasteHeat = DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * DXCoil(DXCoilNum).ElecCoolingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNum) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat = state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; } else { - DXCoil(DXCoilNum).MSFuelWasteHeat = CurveValue(state, DXCoil(DXCoilNum).MSWasteHeat(SpeedNum), OutdoorDryBulb, InletAirDryBulbTemp) * - DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNum), OutdoorDryBulb, InletAirDryBulbTemp) * + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; } - if (DXCoil(DXCoilNum).MSHPHeatRecActive) { - MSHPWasteHeat = DXCoil(DXCoilNum).MSFuelWasteHeat; + if (state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive) { + MSHPWasteHeat = state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat; } } // Energy use for other fuel types - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - DXCoil(DXCoilNum).FuelUsed = DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; } - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - max(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - max(state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction)); } } - if (DXCoil(DXCoilNum).CondenserType(DXMode) == EvapCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(DXMode) == EvapCooled) { //****************** // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** RhoWater = RhoH2O(OutdoorDryBulb); - DXCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater; - DXCoil(DXCoilNum).EvapCondPumpElecPower = EvapCondPumpElecPower; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = EvapCondPumpElecPower; // set water system demand request (if needed) - if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = - DXCoil(DXCoilNum).EvapWaterConsumpRate; + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode == iWaterSupply::FromTank) { + state.dataWaterData->WaterStorage(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate; } // Calculate basin heater power - CalcBasinHeaterPower(state, DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); - DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + CalcBasinHeaterPower(state, state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower *= (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); } } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; - - DXCoil(DXCoilNum).FuelUsed = 0.0; - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; - DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; - - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + + state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; + + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).HeatingCoilRuntimeFraction); } // Calculate basin heater power - if (DXCoil(DXCoilNum).CondenserType(DXMode) == EvapCooled) { - CalcBasinHeaterPower(state, DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - DXCoil(DXCoilNum).BasinHeaterSchedulePtr, - DXCoil(DXCoilNum).BasinHeaterSetPointTemp, - DXCoil(DXCoilNum).BasinHeaterPower); + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(DXMode) == EvapCooled) { + CalcBasinHeaterPower(state, state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower); } } - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoilPartLoadRatio(DXCoilNum) = DXCoil(DXCoilNum).PartLoadRatio; - DXCoilFanOpMode(DXCoilNum) = FanOpMode; - DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; // Save condenser inlet temp in the data structure + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio; + state.dataDXCoils->DXCoilFanOpMode(DXCoilNum) = FanOpMode; + state.dataDXCoils->DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; // Save condenser inlet temp in the data structure // set outlet node conditions - int airOutletNode = DXCoil(DXCoilNum).AirOutNode; - Node(airOutletNode).Temp = DXCoil(DXCoilNum).OutletAirTemp; - Node(airOutletNode).HumRat = DXCoil(DXCoilNum).OutletAirHumRat; + int airOutletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode; + Node(airOutletNode).Temp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + Node(airOutletNode).HumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; // calc secondary coil if specified - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { CalcSecondaryDXCoils(state, DXCoilNum); } } @@ -12778,20 +12680,20 @@ namespace DXCoils { if (SpeedNum > 1) { SpeedNumLS = SpeedNum - 1; SpeedNumHS = SpeedNum; - if (SpeedNum > DXCoil(DXCoilNum).NumOfSpeeds) { - SpeedNumLS = DXCoil(DXCoilNum).NumOfSpeeds - 1; - SpeedNumHS = DXCoil(DXCoilNum).NumOfSpeeds; + if (SpeedNum > state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds) { + SpeedNumLS = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds - 1; + SpeedNumHS = state.dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds; } } else { SpeedNumLS = 1; SpeedNumHS = 1; } - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - AirMassFlowRatioLS = MSHPMassFlowRateLow / DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumLS); - AirMassFlowRatioHS = MSHPMassFlowRateHigh / DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumHS); + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + AirMassFlowRatioLS = MSHPMassFlowRateLow / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumLS); + AirMassFlowRatioHS = MSHPMassFlowRateHigh / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedNumHS); if ((AirMassFlow > 0.0) && (CycRatio > 0.0) && (MSHPMassFlowRateHigh == 0.0)) { - ShowSevereError(state, "CalcMultiSpeedDXCoilHeating: " + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowSevereError(state, "CalcMultiSpeedDXCoilHeating: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + " Developer error - inconsistent airflow rates."); if (MSHPMassFlowRateLow == 0.0 && SpeedNum > 1) { ShowContinueError(state, "When AirMassFlow > 0.0 and CycRatio > 0.0 and SpeedNum > 1, then MSHPMassFlowRateLow and MSHPMassFlowRateHigh " @@ -12814,7 +12716,7 @@ namespace DXCoils { ShowFatalError(state, "Preceding condition(s) causes termination."); } } else if (CycRatio > 1.0 || SpeedRatio > 1.0) { - ShowSevereError(state, "CalcMultiSpeedDXCoilHeating: " + DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowSevereError(state, "CalcMultiSpeedDXCoilHeating: " + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + " Developer error - inconsistent speed ratios."); ShowContinueError(state, "CycRatio and SpeedRatio must be between 0.0 and 1.0"); ShowContinueErrorTimeStamp(state, ""); @@ -12823,29 +12725,29 @@ namespace DXCoils { } AirFlowRatio = 1.0; - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) MSHPWasteHeat = 0.0; + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) MSHPWasteHeat = 0.0; // Get condenser outdoor node info from DX Heating Coil - if (DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; OutdoorHumRat = state.dataEnvrn->OutHumRat; OutdoorPressure = state.dataEnvrn->OutBaroPress; } else { - OutdoorDryBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp; - OutdoorHumRat = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat; + OutdoorDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp; + OutdoorHumRat = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).HumRat; } - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); // OutdoorWetBulb = DXCoil( DXCoilNum ).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } - } else if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { - OutdoorDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - OutdoorHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); + } else if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + OutdoorDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + OutdoorHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); // OutdoorWetBulb = DXCoil( DXCoilNum ).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } else { @@ -12854,26 +12756,26 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; } - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // InletAirPressure = DXCoil(DXCoilNum)%InletAirPressure // InletAirWetBulbC = PsyTwbFnTdbWPb(InletAirDryBulbTemp,InletAirHumRat,InletAirPressure) InletAirWetBulbC = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure, RoutineName); PLRHeating = 0.0; - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 0.0; // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (OutdoorDryBulb < DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = DXCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (OutdoorDryBulb < state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } - DXCoil(DXCoilNum).PartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = 0.0; HeatReclaimDXCoil(DXCoilNum).AvailCapacity = 0.0; - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0) && - ((CycRatio > 0.0) || (SpeedRatio > 0.0 && SingleMode == 0)) && OutdoorDryBulb > DXCoil(DXCoilNum).MinOATCompressor) { + if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0) && + ((CycRatio > 0.0) || (SpeedRatio > 0.0 && SingleMode == 0)) && OutdoorDryBulb > state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor) { if (SpeedNum > 1 && SingleMode == 0) { @@ -12881,14 +12783,14 @@ namespace DXCoils { AirVolumeFlowRate = MSHPMassFlowRateLow / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat, RoutineName); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // AirVolumeFlowRate = AirMassFlow/PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS); if ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxHeatVolFlowPerRatedTotCap(DXCT))) { - if (DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS) == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS) == 0) { ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range at speed {}.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumLS)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -12901,10 +12803,10 @@ namespace DXCoils { } ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range " "at speed {} error continues...", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumLS), - DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS), + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumLS), VolFlowperRatedTotCap, VolFlowperRatedTotCap); } @@ -12913,14 +12815,14 @@ namespace DXCoils { AirVolumeFlowRate = MSHPMassFlowRateHigh / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat, RoutineName); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // AirVolumeFlowRate = AirMassFlow/PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS); if ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxHeatVolFlowPerRatedTotCap(DXCT))) { - if (DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS) == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS) == 0) { ShowWarningMessage( state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range at speed {}.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumHS)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -12933,10 +12835,10 @@ namespace DXCoils { } ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Air volume flow rate per watt of rated total heating capacity is out of range " "at speed {} error continues...", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, SpeedNumHS), - DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS), + state.dataDXCoils->DXCoil(DXCoilNum).MSErrIndex(SpeedNumHS), VolFlowperRatedTotCap, VolFlowperRatedTotCap); } @@ -12946,45 +12848,45 @@ namespace DXCoils { // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quaratic curve if sufficient manufacturer data is available. // Low speed - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS)).NumDims == 1) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS), OutdoorDryBulb); + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS)).NumDims == 1) { + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS), OutdoorDryBulb); } else { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS), InletAirDryBulbTemp, OutdoorDryBulb); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumLS), InletAirDryBulbTemp, OutdoorDryBulb); } // Get total capacity modifying factor (function of mass flow) for off-rated conditions - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumLS), AirMassFlowRatioLS); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumLS), AirMassFlowRatioLS); // Calculate total heating capacity for off-rated conditions - TotCapLS = DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS) * TotCapFlowModFac * TotCapTempModFac; + TotCapLS = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS) * TotCapFlowModFac * TotCapTempModFac; // High speed - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS)).NumDims == 1) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS), OutdoorDryBulb); + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS)).NumDims == 1) { + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS), OutdoorDryBulb); } else { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS), InletAirDryBulbTemp, OutdoorDryBulb); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNumHS), InletAirDryBulbTemp, OutdoorDryBulb); } // Get total capacity modifying factor (function of mass flow) for off-rated conditions - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumHS), AirMassFlowRatioHS); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(SpeedNumHS), AirMassFlowRatioHS); // Calculate total heating capacity for off-rated conditions - TotCapHS = DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) * TotCapFlowModFac * TotCapTempModFac; + TotCapHS = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) * TotCapFlowModFac * TotCapTempModFac; // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quaratic curve if sufficient manufacturer data is available. // Low Speed - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS)).NumDims == 1) { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS), OutdoorDryBulb); + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS)).NumDims == 1) { + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS), OutdoorDryBulb); } else { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS), InletAirDryBulbTemp, OutdoorDryBulb); + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumLS), InletAirDryBulbTemp, OutdoorDryBulb); } - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumLS), AirMassFlowRatioLS); - EIRLS = 1.0 / DXCoil(DXCoilNum).MSRatedCOP(SpeedNumLS) * EIRTempModFac * EIRFlowModFac; + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumLS), AirMassFlowRatioLS); + EIRLS = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(SpeedNumLS) * EIRTempModFac * EIRFlowModFac; // High Speed - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS)).NumDims == 1) { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS), OutdoorDryBulb); + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS)).NumDims == 1) { + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS), OutdoorDryBulb); } else { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS), InletAirDryBulbTemp, OutdoorDryBulb); + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(SpeedNumHS), InletAirDryBulbTemp, OutdoorDryBulb); } - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumHS), AirMassFlowRatioHS); - EIRHS = 1.0 / DXCoil(DXCoilNum).MSRatedCOP(SpeedNumHS) * EIRTempModFac * EIRFlowModFac; + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(SpeedNumHS), AirMassFlowRatioHS); + EIRHS = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(SpeedNumHS) * EIRTempModFac * EIRFlowModFac; // Calculating adjustment factors for defrost // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E @@ -13001,10 +12903,10 @@ namespace DXCoils { DefrostPowerHS = 0.0; // Check outdoor temperature to determine of defrost is active - if (OutdoorDryBulb <= DXCoil(DXCoilNum).MaxOATDefrost) { + if (OutdoorDryBulb <= state.dataDXCoils->DXCoil(DXCoilNum).MaxOATDefrost) { // Calculate defrost adjustment factors depending on defrost control type - if (DXCoil(DXCoilNum).DefrostControl == Timed) { - FractionalDefrostTime = DXCoil(DXCoilNum).DefrostTime; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == Timed) { + FractionalDefrostTime = state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime; if (FractionalDefrostTime > 0.0) { HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw; InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw; @@ -13017,20 +12919,20 @@ namespace DXCoils { if (FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle && DXCoil(DXCoilNum).DefrostControl == OnDemand) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle && state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == OnDemand) { DefrostEIRTempModFac = - CurveValue(state, DXCoil(DXCoilNum).DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); + CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); LoadDueToDefrostLS = - (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS) / 1.01667); - DefrostPowerLS = DefrostEIRTempModFac * (DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS) / 1.01667) * FractionalDefrostTime; + (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS) / 1.01667); + DefrostPowerLS = DefrostEIRTempModFac * (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumLS) / 1.01667) * FractionalDefrostTime; LoadDueToDefrostHS = - (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) / 1.01667); - DefrostPowerHS = DefrostEIRTempModFac * (DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) / 1.01667) * FractionalDefrostTime; + (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) / 1.01667); + DefrostPowerHS = DefrostEIRTempModFac * (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNumHS) / 1.01667) * FractionalDefrostTime; } else { // Defrost strategy is resistive - DXCoil(DXCoilNum).DefrostPower = DXCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; } } else { // Defrost is not active because (OutDryBulbTemp .GT. DXCoil(DXCoilNum)%MaxOATDefrost) - DXCoil(DXCoilNum).DefrostPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = 0.0; } } @@ -13039,42 +12941,42 @@ namespace DXCoils { // Calculate modified PartLoadRatio due to defrost (reverse-cycle defrost only) PLRHeating = min(1.0, (SpeedRatio + LoadDueToDefrostHS / TotCapHSAdj)); - PLF = CurveValue(state, DXCoil(DXCoilNum).MSPLFFPLR(SpeedNumHS), PLRHeating); // Calculate part-load factor + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(SpeedNumHS), PLRHeating); // Calculate part-load factor if (PLF < 0.7) { - if (DXCoil(DXCoilNum).PLRErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex == 0) { ShowWarningMessage( state, format("The PLF curve value at high speed for DX multispeed heating coil {} ={:.2R} for part-load ratio ={:.2R}", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF, PLRHeating)); ShowContinueError(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:MultiSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); + ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); PLF = 0.7; } - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); - if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { - if (DXCoil(DXCoilNum).ErrIndex4 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); + if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4 == 0) { ShowWarningMessage(state, format("The runtime fraction at high speed for DX multispeed heating coil {} exceeded 1.0. [{:.4R}].", - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction is set to 1.0 and the simulation continues..."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex4, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 - } else if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // Get full load output and power @@ -13088,16 +12990,16 @@ namespace DXCoils { if (FanOpMode == CycFanCycCoil) OnOffFanPartLoadFraction = 1.0; // Power calculation - if (!DXCoil(DXCoilNum).PLRImpact) { - DXCoil(DXCoilNum).ElecHeatingPower = SpeedRatio * HSElecHeatingPower + (1.0 - SpeedRatio) * LSElecHeatingPower; + if (!state.dataDXCoils->DXCoil(DXCoilNum).PLRImpact) { + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = SpeedRatio * HSElecHeatingPower + (1.0 - SpeedRatio) * LSElecHeatingPower; } else { - DXCoil(DXCoilNum).ElecHeatingPower = DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * HSElecHeatingPower + - (1.0 - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction) * LSElecHeatingPower; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * HSElecHeatingPower + + (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction) * LSElecHeatingPower; } - DXCoil(DXCoilNum).TotalHeatingEnergyRate = MSHPMassFlowRateHigh * (HSFullLoadOutAirEnth - InletAirEnthalpy) * SpeedRatio + + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = MSHPMassFlowRateHigh * (HSFullLoadOutAirEnth - InletAirEnthalpy) * SpeedRatio + MSHPMassFlowRateLow * (LSFullLoadOutAirEnth - InletAirEnthalpy) * (1.0 - SpeedRatio); - OutletAirEnthalpy = InletAirEnthalpy + DXCoil(DXCoilNum).TotalHeatingEnergyRate / DXCoil(DXCoilNum).InletAirMassFlowRate; + OutletAirEnthalpy = InletAirEnthalpy + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate / state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; OutletAirTemp = PsyTdbFnHW(OutletAirEnthalpy, OutletAirHumRat); FullLoadOutAirRH = PsyRhFnTdbWPb(state, OutletAirTemp, OutletAirHumRat, OutdoorPressure, RoutineNameAverageLoad); if (FullLoadOutAirRH > 1.0) { // Limit to saturated conditions at FullLoadOutAirEnth @@ -13109,45 +13011,45 @@ namespace DXCoils { } // Waste heat calculation - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - if (DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS) == 0) { - WasteHeatLS = DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS) == 0) { + WasteHeatLS = state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); } else { - WasteHeatLS = CurveValue(state, DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS), OutdoorDryBulb, InletAirDryBulbTemp) * - DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); + WasteHeatLS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumLS), OutdoorDryBulb, InletAirDryBulbTemp) * + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumLS); } - if (DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS) == 0) { - WasteHeatHS = DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS) == 0) { + WasteHeatHS = state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); } else { - WasteHeatHS = CurveValue(state, DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS), OutdoorDryBulb, InletAirDryBulbTemp) * - DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); + WasteHeatHS = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNumHS), OutdoorDryBulb, InletAirDryBulbTemp) * + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNumHS); } - DXCoil(DXCoilNum).MSFuelWasteHeat = - (SpeedRatio * WasteHeatHS + (1.0 - SpeedRatio) * WasteHeatLS) * DXCoil(DXCoilNum).ElecCoolingPower; - if (DXCoil(DXCoilNum).MSHPHeatRecActive) { - MSHPWasteHeat = DXCoil(DXCoilNum).MSFuelWasteHeat; + state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat = + (SpeedRatio * WasteHeatHS + (1.0 - SpeedRatio) * WasteHeatLS) * state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive) { + MSHPWasteHeat = state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat; } } - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - DXCoil(DXCoilNum).FuelUsed = DXCoil(DXCoilNum).ElecHeatingPower; - DXCoil(DXCoilNum).ElecHeatingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed = state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = 0.0; } // Adjust defrost power to correct for DOE-2 bug where defrost power is constant regardless of compressor runtime fraction // Defrosts happen based on compressor run time (frost buildup on outdoor coil), not total elapsed time. - if (DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle) { - if (!DXCoil(DXCoilNum).PLRImpact) { - DXCoil(DXCoilNum).DefrostPower = DefrostPowerHS * SpeedRatio + DefrostPowerLS * (1.0 - SpeedRatio); + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle) { + if (!state.dataDXCoils->DXCoil(DXCoilNum).PLRImpact) { + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = DefrostPowerHS * SpeedRatio + DefrostPowerLS * (1.0 - SpeedRatio); } else { - DXCoil(DXCoilNum).DefrostPower = DefrostPowerHS * DXCoil(DXCoilNum).HeatingCoilRuntimeFraction + - DefrostPowerLS * (1.0 - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = DefrostPowerHS * state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction + + DefrostPowerLS * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); } } - DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; - DXCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; // Stage 1 } else if (CycRatio > 0.0 || (CycRatio > 0.0 && SingleMode == 1)) { @@ -13159,11 +13061,11 @@ namespace DXCoils { AirVolumeFlowRate = AirMassFlow / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat, RoutineName); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line // AirVolumeFlowRate = AirMassFlow/PsyRhoAirFnPbTdbW(InletAirPressure,InletAirDryBulbTemp, InletAirHumRat) - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum); if ((VolFlowperRatedTotCap < MinOperVolFlowPerRatedTotCap(DXCT)) || (VolFlowperRatedTotCap > MaxHeatVolFlowPerRatedTotCap(DXCT))) { - if (DXCoil(DXCoilNum).ErrIndex1 == 0) { - ShowWarningMessage(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1 == 0) { + ShowWarningMessage(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Air volume flow rate per watt of rated total heating capacity is out of range at speed 1."); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, @@ -13175,9 +13077,9 @@ namespace DXCoils { ShowContinueError(state, "inconsistent supply air fan operation modes in coil and unitary system objects."); } ShowRecurringWarningErrorAtEnd(state, - DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Air volume flow rate per watt of rated total heating capacity is out of range error continues at speed 1...", - DXCoil(DXCoilNum).ErrIndex1, + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex1, VolFlowperRatedTotCap, VolFlowperRatedTotCap); } @@ -13186,18 +13088,18 @@ namespace DXCoils { // Model was extended to accept bi-quadratic curves. This allows sensitivity of the heating capacity // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quaratic curve if sufficient manufacturer data is available. - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum)).NumDims == 1) { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum), OutdoorDryBulb); + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum)).NumDims == 1) { + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum), OutdoorDryBulb); } else { - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum), InletAirDryBulbTemp, OutdoorDryBulb); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(SpeedNum), InletAirDryBulbTemp, OutdoorDryBulb); } // Get total capacity modifying factor (function of mass flow) for off-rated conditions // AirMassFlowRatio = AirMassFlow/DXCoil(DXCoilNum)%MSRatedAirMassFlowRate(SpeedNumLS) // TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum)%MSCCapFFlow(SpeedNumLS),AirMassFlowRatio) - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).MSCCapFFlow(SpeedNum), AirMassFlowRatioLS); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow(SpeedNum), AirMassFlowRatioLS); // Calculate total heating capacity for off-rated conditions - TotCap = DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum) * TotCapFlowModFac * TotCapTempModFac; + TotCap = state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(SpeedNum) * TotCapFlowModFac * TotCapTempModFac; // Calculating adjustment factors for defrost // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E @@ -13211,10 +13113,10 @@ namespace DXCoils { InputPowerMultiplier = 1.0; // Check outdoor temperature to determine of defrost is active - if (OutdoorDryBulb <= DXCoil(DXCoilNum).MaxOATDefrost) { + if (OutdoorDryBulb <= state.dataDXCoils->DXCoil(DXCoilNum).MaxOATDefrost) { // Calculate defrost adjustment factors depending on defrost control type - if (DXCoil(DXCoilNum).DefrostControl == Timed) { - FractionalDefrostTime = DXCoil(DXCoilNum).DefrostTime; + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == Timed) { + FractionalDefrostTime = state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime; if (FractionalDefrostTime > 0.0) { HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw; InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw; @@ -13227,18 +13129,18 @@ namespace DXCoils { if (FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle && DXCoil(DXCoilNum).DefrostControl == OnDemand) { + if (state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy == ReverseCycle && state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl == OnDemand) { LoadDueToDefrost = - (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (DXCoil(DXCoilNum).MSRatedTotCap(1) / 1.01667); + (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(1) / 1.01667); DefrostEIRTempModFac = - CurveValue(state, DXCoil(DXCoilNum).DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); - DXCoil(DXCoilNum).DefrostPower = - DefrostEIRTempModFac * (DXCoil(DXCoilNum).MSRatedTotCap(1) / 1.01667) * FractionalDefrostTime; + CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = + DefrostEIRTempModFac * (state.dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(1) / 1.01667) * FractionalDefrostTime; } else { // Defrost strategy is resistive - DXCoil(DXCoilNum).DefrostPower = DXCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; } } else { // Defrost is not active because (OutDryBulbTemp .GT. DXCoil(DXCoilNum)%MaxOATDefrost) - DXCoil(DXCoilNum).DefrostPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = 0.0; } } @@ -13267,149 +13169,149 @@ namespace DXCoils { // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quadratic curve if sufficient manufacturer data is available. - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).MSEIRFTemp(1)).NumDims == 1) { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(1), OutdoorDryBulb); + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(1)).NumDims == 1) { + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(1), OutdoorDryBulb); } else { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFTemp(1), InletAirDryBulbTemp, OutdoorDryBulb); + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp(1), InletAirDryBulbTemp, OutdoorDryBulb); } - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).MSEIRFFlow(1), AirMassFlowRatioLS); - EIR = 1.0 / DXCoil(DXCoilNum).MSRatedCOP(1) * EIRTempModFac * EIRFlowModFac; + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow(1), AirMassFlowRatioLS); + EIR = 1.0 / state.dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(1) * EIRTempModFac * EIRFlowModFac; // Calculate modified PartLoadRatio due to defrost (reverse-cycle defrost only) PLRHeating = min(1.0, (CycRatio + LoadDueToDefrost / TotCapAdj)); - PLF = CurveValue(state, DXCoil(DXCoilNum).MSPLFFPLR(1), PLRHeating); // Calculate part-load factor + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR(1), PLRHeating); // Calculate part-load factor if (FanOpMode == CycFanCycCoil && CycRatio == 1.0 && PLF != 1.0) { - if (DXCoil(DXCoilNum).PLFErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFErrIndex == 0) { ShowWarningMessage( - state, format("The PLF curve value for DX heating coil {} ={:.2R} for part-load ratio = 1", DXCoil(DXCoilNum).Name, PLF)); + state, format("The PLF curve value for DX heating coil {} ={:.2R} for part-load ratio = 1", state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF)); ShowContinueError(state, "PLF curve value must be = 1.0 and has been reset to 1.0. Simulation is continuing."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + "\": DX heating coil PLF curve value <> 1.0 warning continues...", - DXCoil(DXCoilNum).PLFErrIndex, + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + "\": DX heating coil PLF curve value <> 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).PLFErrIndex, PLF, PLF); PLF = 1.0; } if (PLF < 0.7) { - if (DXCoil(DXCoilNum).PLRErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex == 0) { ShowWarningMessage(state, format("The PLF curve value for DX heating coil {} ={:.2R} for part-load ratio ={:.2R}", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF, PLRHeating)); ShowContinueError(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); + ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); PLF = 0.7; } - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); - if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { - if (DXCoil(DXCoilNum).ErrIndex4 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); + if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4 == 0) { ShowWarningMessage(state, format("The runtime fraction for DX heating coil {} exceeded 1.0. [{:.4R}].", - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction is set to 1.0 and the simulation continues..."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex4, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 - } else if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // if cycling fan, send coil part-load fraction to on/off fan via HVACDataGlobals if (FanOpMode == CycFanCycCoil) OnOffFanPartLoadFraction = PLF; - DXCoil(DXCoilNum).ElecHeatingPower = TotCap * EIR * DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * InputPowerMultiplier; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = TotCap * EIR * state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * InputPowerMultiplier; // Calculate crankcase heater power using the runtime fraction for this DX heating coil only if there is no companion DX coil. // Else use the largest runtime fraction of this DX heating coil and the companion DX cooling coil. - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - max(DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - max(state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction)); } - DXCoil(DXCoilNum).TotalHeatingEnergyRate = AirMassFlow * (FullLoadOutAirEnth - InletAirEnthalpy) * CycRatio; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = AirMassFlow * (FullLoadOutAirEnth - InletAirEnthalpy) * CycRatio; if (FanOpMode == ContFanCycCoil) { - OutletAirEnthalpy = InletAirEnthalpy + DXCoil(DXCoilNum).TotalHeatingEnergyRate / DXCoil(DXCoilNum).InletAirMassFlowRate; + OutletAirEnthalpy = InletAirEnthalpy + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate / state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; OutletAirTemp = PsyTdbFnHW(OutletAirEnthalpy, OutletAirHumRat); } - if (DXCoil(DXCoilNum).MSHPHeatRecActive || DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - if (DXCoil(DXCoilNum).MSWasteHeat(SpeedNum) == 0) { - DXCoil(DXCoilNum).MSFuelWasteHeat = DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * DXCoil(DXCoilNum).ElecHeatingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive || state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNum) == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat = state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower; } else { - DXCoil(DXCoilNum).MSFuelWasteHeat = CurveValue(state, DXCoil(DXCoilNum).MSWasteHeat(SpeedNum), OutdoorDryBulb, InletAirDryBulbTemp) * - DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * DXCoil(DXCoilNum).ElecHeatingPower; + state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat(SpeedNum), OutdoorDryBulb, InletAirDryBulbTemp) * + state.dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac(SpeedNum) * state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower; } - if (DXCoil(DXCoilNum).MSHPHeatRecActive) { - MSHPWasteHeat = DXCoil(DXCoilNum).MSFuelWasteHeat; + if (state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive) { + MSHPWasteHeat = state.dataDXCoils->DXCoil(DXCoilNum).MSFuelWasteHeat; } } - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - DXCoil(DXCoilNum).FuelUsed = DXCoil(DXCoilNum).ElecHeatingPower; - DXCoil(DXCoilNum).ElecHeatingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed = state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = 0.0; } // Adjust defrost power to correct for DOE-2 bug where defrost power is constant regardless of compressor runtime fraction // Defrosts happen based on compressor run time (frost buildup on outdoor coil), not total elapsed time. - DXCoil(DXCoilNum).DefrostPower *= DXCoil(DXCoilNum).HeatingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower *= state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction; - DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; } } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; - DXCoil(DXCoilNum).ElecHeatingPower = 0.0; - DXCoil(DXCoilNum).FuelUsed = 0.0; - DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; - DXCoil(DXCoilNum).DefrostPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = 0.0; // Calculate crankcase heater power using the runtime fraction for this DX heating coil (here DXHeatingCoilRTF=0) if // there is no companion DX coil, or the runtime fraction of the companion DX cooling coil (here DXCoolingCoilRTF>=0). - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction); } } // end of on/off if - else - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoil(DXCoilNum).PartLoadRatio = PLRHeating; - DXCoilFanOpMode(DXCoilNum) = FanOpMode; - DXCoilPartLoadRatio(DXCoilNum) = PLRHeating; - DXCoil(DXCoilNum).MSSpeedNumLS = SpeedNumLS; - DXCoil(DXCoilNum).MSSpeedNumHS = SpeedNumHS; - DXCoil(DXCoilNum).MSSpeedRatio = SpeedRatio; - DXCoil(DXCoilNum).MSCycRatio = CycRatio; + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = PLRHeating; + state.dataDXCoils->DXCoilFanOpMode(DXCoilNum) = FanOpMode; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = PLRHeating; + state.dataDXCoils->DXCoil(DXCoilNum).MSSpeedNumLS = SpeedNumLS; + state.dataDXCoils->DXCoil(DXCoilNum).MSSpeedNumHS = SpeedNumHS; + state.dataDXCoils->DXCoil(DXCoilNum).MSSpeedRatio = SpeedRatio; + state.dataDXCoils->DXCoil(DXCoilNum).MSCycRatio = CycRatio; // set outlet node conditions - int airOutletNode = DXCoil(DXCoilNum).AirOutNode; - Node(airOutletNode).Temp = DXCoil(DXCoilNum).OutletAirTemp; - Node(airOutletNode).HumRat = DXCoil(DXCoilNum).OutletAirHumRat; + int airOutletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode; + Node(airOutletNode).Temp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + Node(airOutletNode).HumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; // calc secondary coil if specified - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { CalcSecondaryDXCoils(state, DXCoilNum); } } @@ -13428,13 +13330,13 @@ namespace DXCoils { int AirOutletNode; // air outlet node number int AirInletNode; // air inlet node number - AirOutletNode = DXCoil(DXCoilNum).AirOutNode; - AirInletNode = DXCoil(DXCoilNum).AirInNode; + AirOutletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirOutNode; + AirInletNode = state.dataDXCoils->DXCoil(DXCoilNum).AirInNode; // changed outputs - Node(AirOutletNode).Enthalpy = DXCoil(DXCoilNum).OutletAirEnthalpy; - Node(AirOutletNode).Temp = DXCoil(DXCoilNum).OutletAirTemp; - Node(AirOutletNode).HumRat = DXCoil(DXCoilNum).OutletAirHumRat; - Node(AirOutletNode).MassFlowRate = DXCoil(DXCoilNum).InletAirMassFlowRate; + Node(AirOutletNode).Enthalpy = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy; + Node(AirOutletNode).Temp = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + Node(AirOutletNode).HumRat = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + Node(AirOutletNode).MassFlowRate = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; // pass through outputs Node(AirOutletNode).Quality = Node(AirInletNode).Quality; Node(AirOutletNode).Press = Node(AirInletNode).Press; @@ -13478,110 +13380,110 @@ namespace DXCoils { Real64 SpecHumIn; Real64 ReportingConstant; // Number of seconds per HVAC system time step, to convert from W (J/s) to J - if (DXCoil(DXCoilNum).reportCoilFinalSizes) { + if (state.dataDXCoils->DXCoil(DXCoilNum).reportCoilFinalSizes) { if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) { Real64 ratedSensCap(0.0); - ratedSensCap = DXCoil(DXCoilNum).RatedTotCap(1) * DXCoil(DXCoilNum).RatedSHR(1); + ratedSensCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * state.dataDXCoils->DXCoil(DXCoilNum).RatedSHR(1); coilSelectionReportObj->setCoilFinalSizes(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).RatedTotCap(1), + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1), ratedSensCap, - DXCoil(DXCoilNum).RatedAirVolFlowRate(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1), -999.0); - DXCoil(DXCoilNum).reportCoilFinalSizes = false; + state.dataDXCoils->DXCoil(DXCoilNum).reportCoilFinalSizes = false; } } ReportingConstant = TimeStepSys * DataGlobalConstants::SecInHour; { - auto const SELECT_CASE_var(DXCoil(DXCoilNum).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num); if ((SELECT_CASE_var == CoilDX_HeatingEmpirical) || (SELECT_CASE_var == CoilVRF_Heating) || (SELECT_CASE_var == CoilVRF_FluidTCtrl_Heating)) { - DXCoil(DXCoilNum).TotalHeatingEnergy = DXCoil(DXCoilNum).TotalHeatingEnergyRate * ReportingConstant; - DXCoil(DXCoilNum).ElecHeatingConsumption = DXCoil(DXCoilNum).ElecHeatingPower * ReportingConstant; - DXCoil(DXCoilNum).DefrostConsumption = DXCoil(DXCoilNum).DefrostPower * ReportingConstant; - DXCoil(DXCoilNum).CrankcaseHeaterConsumption = DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; - DXElecHeatingPower = DXCoil(DXCoilNum).ElecHeatingPower + DXCoil(DXCoilNum).CrankcaseHeaterPower; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingConsumption = state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostConsumption = state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + DXElecHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower; } else if (SELECT_CASE_var == CoilDX_MultiSpeedHeating) { - DXCoil(DXCoilNum).TotalHeatingEnergy = DXCoil(DXCoilNum).TotalHeatingEnergyRate * ReportingConstant; - if (DXCoil(DXCoilNum).FuelTypeNum == DataGlobalConstants::ResourceType::Electricity) { - DXCoil(DXCoilNum).ElecHeatingConsumption = DXCoil(DXCoilNum).ElecHeatingPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate * ReportingConstant; + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum == DataGlobalConstants::ResourceType::Electricity) { + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingConsumption = state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower * ReportingConstant; } else { - DXCoil(DXCoilNum).FuelConsumed = DXCoil(DXCoilNum).FuelUsed * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).FuelConsumed = state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed * ReportingConstant; } - DXCoil(DXCoilNum).DefrostConsumption = DXCoil(DXCoilNum).DefrostPower * ReportingConstant; - DXCoil(DXCoilNum).CrankcaseHeaterConsumption = DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; - DXElecHeatingPower = DXCoil(DXCoilNum).ElecHeatingPower + DXCoil(DXCoilNum).CrankcaseHeaterPower; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostConsumption = state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + DXElecHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower; } else if (SELECT_CASE_var == CoilDX_MultiSpeedCooling) { - DXCoil(DXCoilNum).TotalCoolingEnergy = DXCoil(DXCoilNum).TotalCoolingEnergyRate * ReportingConstant; - DXCoil(DXCoilNum).SensCoolingEnergy = DXCoil(DXCoilNum).SensCoolingEnergyRate * ReportingConstant; - DXCoil(DXCoilNum).LatCoolingEnergy = DXCoil(DXCoilNum).TotalCoolingEnergy - DXCoil(DXCoilNum).SensCoolingEnergy; - DXCoil(DXCoilNum).CrankcaseHeaterConsumption = DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; - DXElecCoolingPower = DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).EvapCondPumpElecConsumption = DXCoil(DXCoilNum).EvapCondPumpElecPower * ReportingConstant; - DXCoil(DXCoilNum).EvapWaterConsump = DXCoil(DXCoilNum).EvapWaterConsumpRate * ReportingConstant; - if (DXCoil(DXCoilNum).FuelTypeNum == DataGlobalConstants::ResourceType::Electricity) { - DXCoil(DXCoilNum).ElecCoolingConsumption = DXCoil(DXCoilNum).ElecCoolingPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergy - state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergy; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + DXElecCoolingPower = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecConsumption = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsump = state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate * ReportingConstant; + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum == DataGlobalConstants::ResourceType::Electricity) { + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingConsumption = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower * ReportingConstant; } else { - DXCoil(DXCoilNum).FuelConsumed = DXCoil(DXCoilNum).FuelUsed * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).FuelConsumed = state.dataDXCoils->DXCoil(DXCoilNum).FuelUsed * ReportingConstant; } - if (any_eq(DXCoil(DXCoilNum).CondenserType, EvapCooled)) { - DXCoil(DXCoilNum).BasinHeaterConsumption = DXCoil(DXCoilNum).BasinHeaterPower * ReportingConstant; + if (any_eq(state.dataDXCoils->DXCoil(DXCoilNum).CondenserType, EvapCooled)) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterConsumption = state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower * ReportingConstant; } } else if (SELECT_CASE_var == CoilDX_HeatPumpWaterHeaterPumped || SELECT_CASE_var == CoilDX_HeatPumpWaterHeaterWrapped) { // water heating energy for HP water heater DX Coil condenser - DXCoil(DXCoilNum).TotalHeatingEnergy = DXCoil(DXCoilNum).TotalHeatingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate * ReportingConstant; // water heating power for HP water heater - DXCoil(DXCoilNum).ElecWaterHeatingConsumption = DXCoil(DXCoilNum).ElecWaterHeatingPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).ElecWaterHeatingConsumption = state.dataDXCoils->DXCoil(DXCoilNum).ElecWaterHeatingPower * ReportingConstant; // other usual DX cooling coil outputs - DXCoil(DXCoilNum).TotalCoolingEnergy = DXCoil(DXCoilNum).TotalCoolingEnergyRate * ReportingConstant; - DXCoil(DXCoilNum).SensCoolingEnergy = DXCoil(DXCoilNum).SensCoolingEnergyRate * ReportingConstant; - DXCoil(DXCoilNum).LatCoolingEnergy = DXCoil(DXCoilNum).TotalCoolingEnergy - DXCoil(DXCoilNum).SensCoolingEnergy; - DXCoil(DXCoilNum).ElecCoolingConsumption = DXCoil(DXCoilNum).ElecCoolingPower * ReportingConstant; - DXCoil(DXCoilNum).CrankcaseHeaterConsumption = DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergy - state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergy; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingConsumption = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; // DXElecCoolingPower global is only used for air-to-air cooling and heating coils DXElecCoolingPower = 0.0; } else { - DXCoil(DXCoilNum).TotalCoolingEnergy = DXCoil(DXCoilNum).TotalCoolingEnergyRate * ReportingConstant; - DXCoil(DXCoilNum).SensCoolingEnergy = DXCoil(DXCoilNum).SensCoolingEnergyRate * ReportingConstant; - DXCoil(DXCoilNum).LatCoolingEnergy = DXCoil(DXCoilNum).TotalCoolingEnergy - DXCoil(DXCoilNum).SensCoolingEnergy; - DXCoil(DXCoilNum).ElecCoolingConsumption = DXCoil(DXCoilNum).ElecCoolingPower * ReportingConstant; - DXCoil(DXCoilNum).CrankcaseHeaterConsumption = DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; - DXElecCoolingPower = DXCoil(DXCoilNum).ElecCoolingPower; - DXCoil(DXCoilNum).EvapCondPumpElecConsumption = DXCoil(DXCoilNum).EvapCondPumpElecPower * ReportingConstant; - DXCoil(DXCoilNum).EvapWaterConsump = DXCoil(DXCoilNum).EvapWaterConsumpRate * ReportingConstant; - if (any_eq(DXCoil(DXCoilNum).CondenserType, EvapCooled)) { - DXCoil(DXCoilNum).BasinHeaterConsumption = DXCoil(DXCoilNum).BasinHeaterPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergy = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergy - state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergy; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingConsumption = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + DXElecCoolingPower = state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecConsumption = state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsump = state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate * ReportingConstant; + if (any_eq(state.dataDXCoils->DXCoil(DXCoilNum).CondenserType, EvapCooled)) { + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterConsumption = state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower * ReportingConstant; } } } - if (DXCoil(DXCoilNum).CondensateCollectMode == CondensateToTank) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondensateCollectMode == iCondensate::ToTank) { // calculate and report condensation rates (how much water extracted from the air stream) // water flow of water in m3/s for water system interactions // put here to catch all types of DX coils - Tavg = (DXCoil(DXCoilNum).InletAirTemp - DXCoil(DXCoilNum).OutletAirTemp) / 2.0; + Tavg = (state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp - state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp) / 2.0; RhoWater = RhoH2O(Tavg); // CR9155 Remove specific humidity calculations - SpecHumIn = DXCoil(DXCoilNum).InletAirHumRat; - SpecHumOut = DXCoil(DXCoilNum).OutletAirHumRat; + SpecHumIn = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + SpecHumOut = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; // mdot * del HumRat / rho water - DXCoil(DXCoilNum).CondensateVdot = max(0.0, (DXCoil(DXCoilNum).InletAirMassFlowRate * (SpecHumIn - SpecHumOut) / RhoWater)); - DXCoil(DXCoilNum).CondensateVol = DXCoil(DXCoilNum).CondensateVdot * ReportingConstant; + state.dataDXCoils->DXCoil(DXCoilNum).CondensateVdot = max(0.0, (state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate * (SpecHumIn - SpecHumOut) / RhoWater)); + state.dataDXCoils->DXCoil(DXCoilNum).CondensateVol = state.dataDXCoils->DXCoil(DXCoilNum).CondensateVdot * ReportingConstant; - state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).CondensateTankID).VdotAvailSupply(DXCoil(DXCoilNum).CondensateTankSupplyARRID) = - DXCoil(DXCoilNum).CondensateVdot; - state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).CondensateTankID).TwaterSupply(DXCoil(DXCoilNum).CondensateTankSupplyARRID) = - DXCoil(DXCoilNum).OutletAirTemp; + state.dataWaterData->WaterStorage(state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID).VdotAvailSupply(state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID) = + state.dataDXCoils->DXCoil(DXCoilNum).CondensateVdot; + state.dataWaterData->WaterStorage(state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankID).TwaterSupply(state.dataDXCoils->DXCoil(DXCoilNum).CondensateTankSupplyARRID) = + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; } - state.dataAirLoop->LoopDXCoilRTF = max(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); - if (DXCoil(DXCoilNum).AirLoopNum > 0) { - state.dataAirLoop->AirLoopAFNInfo(DXCoil(DXCoilNum).AirLoopNum).AFNLoopDXCoilRTF = - max(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + state.dataAirLoop->LoopDXCoilRTF = max(state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + if (state.dataDXCoils->DXCoil(DXCoilNum).AirLoopNum > 0) { + state.dataAirLoop->AirLoopAFNInfo(state.dataDXCoils->DXCoil(DXCoilNum).AirLoopNum).AFNLoopDXCoilRTF = + max(state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); } } @@ -13695,13 +13597,13 @@ namespace DXCoils { "{},{},{},{},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.4R},{:.4R},{:.4R},{:.4R},\n"}; // Get fan index and name if not already available - if (DXCoil(DXCoilNum).SupplyFanIndex == -1) + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex == -1) GetFanIndexForTwoSpeedCoil( - state, DXCoilNum, DXCoil(DXCoilNum).SupplyFanIndex, DXCoil(DXCoilNum).SupplyFanName, DXCoil(DXCoilNum).SupplyFan_TypeNum); - if (DXCoil(DXCoilNum).SupplyFanIndex == -1) { // didn't find VAV fan, do not rate this coil - DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject = false; + state, DXCoilNum, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFan_TypeNum); + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex == -1) { // didn't find VAV fan, do not rate this coil + state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject = false; ShowWarningError(state, "CalcTwoSpeedDXCoilStandardRating: Did not find an appropriate fan associated with DX coil named = \"" + - DXCoil(DXCoilNum).Name + "\". Standard Ratings will not be calculated."); + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\". Standard Ratings will not be calculated."); return; } @@ -13709,10 +13611,10 @@ namespace DXCoils { // Calculate the Indoor fan electric power consumption. The electric power consumption is estimated // using either user supplied or AHRI default value for fan power per air volume flow rate - if (DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatioRated); - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatioRated); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); for (Iter = 1; Iter <= 4; ++Iter) { // iterative solution in the event that net capacity is near a threshold for external static // Obtain external static pressure from Table 5 in ANSI/AHRI Std. 340/360-2007 if (NetCoolingCapRated <= 21000.0) { @@ -13734,57 +13636,57 @@ namespace DXCoils { } else if (147000.0 < NetCoolingCapRated) { ExternalStatic = 190.0; } - FanStaticPressureRise = ExternalStatic + DXCoil(DXCoilNum).InternalStaticPressureDrop; - if (DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { - FanInletNode = HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->inletNodeNum; - FanOutletNode = HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->outletNodeNum; + FanStaticPressureRise = ExternalStatic + state.dataDXCoils->DXCoil(DXCoilNum).InternalStaticPressureDrop; + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { + FanInletNode = HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->inletNodeNum; + FanOutletNode = HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->outletNodeNum; } else { - FanInletNode = Fans::GetFanInletNode(state, "FAN:VARIABLEVOLUME", DXCoil(DXCoilNum).SupplyFanName, ErrorsFound); - FanOutletNode = Fans::GetFanOutletNode(state, "FAN:VARIABLEVOLUME", DXCoil(DXCoilNum).SupplyFanName, ErrorsFound); + FanInletNode = Fans::GetFanInletNode(state, "FAN:VARIABLEVOLUME", state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, ErrorsFound); + FanOutletNode = Fans::GetFanOutletNode(state, "FAN:VARIABLEVOLUME", state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, ErrorsFound); } // set node state variables in preparation for fan model. - Node(FanInletNode).MassFlowRate = DXCoil(DXCoilNum).RatedAirMassFlowRate(1); - Node(FanOutletNode).MassFlowRate = DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + Node(FanInletNode).MassFlowRate = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + Node(FanOutletNode).MassFlowRate = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); Node(FanInletNode).Temp = CoolingCoilInletAirDryBulbTempRated; Node(FanInletNode).HumRat = PsyWFnTdbTwbPb(state, CoolingCoilInletAirDryBulbTempRated, CoolingCoilInletAirWetBulbTempRated, state.dataEnvrn->OutBaroPress, RoutineName); Node(FanInletNode).Enthalpy = PsyHFnTdbW(CoolingCoilInletAirDryBulbTempRated, Node(FanInletNode).HumRat); - if (DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { - HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->simulate(state, _, true, false, FanStaticPressureRise); - FanPowerCorrection = HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->fanPower(); + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { + HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->simulate(state, _, true, false, FanStaticPressureRise); + FanPowerCorrection = HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->fanPower(); } else { Fans::SimulateFanComponents( - state, DXCoil(DXCoilNum).SupplyFanName, true, DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); - FanPowerCorrection = Fans::GetFanPower(DXCoil(DXCoilNum).SupplyFanIndex); + state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, true, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); + FanPowerCorrection = Fans::GetFanPower(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } FanHeatCorrection = Node(FanOutletNode).Enthalpy - Node(FanInletNode).Enthalpy; - NetCoolingCapRated = DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; + NetCoolingCapRated = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; } } else { FanPowerPerEvapAirFlowRate = DefaultFanPowerPerEvapAirFlowRate; - FanPowerCorrection = DefaultFanPowerPerEvapAirFlowRate * DXCoil(DXCoilNum).RatedAirVolFlowRate(1); - FanHeatCorrection = DefaultFanPowerPerEvapAirFlowRate * DXCoil(DXCoilNum).RatedAirVolFlowRate(1); - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatioRated); - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); - NetCoolingCapRated = DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; + FanPowerCorrection = DefaultFanPowerPerEvapAirFlowRate * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1); + FanHeatCorrection = DefaultFanPowerPerEvapAirFlowRate * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirVolFlowRate(1); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatioRated); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); + NetCoolingCapRated = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; } - SupAirMdot_TestPoint(1) = DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + SupAirMdot_TestPoint(1) = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); // Calculate Energy Efficiency Ratio (EER) at (19.44C WB and 35.0C DB ), ANSI/AHRI Std. 340/360 - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFFlow(1), AirMassFlowRatioRated); - if (DXCoil(DXCoilNum).RatedCOP(1) > 0.0) { + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempRated); + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), AirMassFlowRatioRated); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) > 0.0) { // RatedCOP <= 0.0 is trapped in GetInput, but keep this as "safety" - EIR = EIRTempModFac * EIRFlowModFac / DXCoil(DXCoilNum).RatedCOP(1); + EIR = EIRTempModFac * EIRFlowModFac / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1); } else { EIR = 0.0; } - TotalElecPowerRated = EIR * (DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac) + FanPowerCorrection; + TotalElecPowerRated = EIR * (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac) + FanPowerCorrection; if (TotalElecPowerRated > 0.0) { EER = NetCoolingCapRated / TotalElecPowerRated; @@ -13798,28 +13700,28 @@ namespace DXCoils { // find coil leaving drybulb at point A, with full rated air flow rate. // init coil - DXCoil(DXCoilNum).InletAirMassFlowRate = DXCoil(DXCoilNum).RatedAirMassFlowRate(1); - DXCoil(DXCoilNum).InletAirMassFlowRateMax = DXCoil(DXCoilNum).RatedAirMassFlowRate(1); - DXCoil(DXCoilNum).InletAirTemp = 26.7; - DXCoil(DXCoilNum).InletAirHumRat = PsyWFnTdbTwbPb(state, 26.7, 19.4, state.dataEnvrn->OutBaroPress, RoutineName); - DXCoil(DXCoilNum).InletAirEnthalpy = PsyHFnTdbW(26.7, DXCoil(DXCoilNum).InletAirHumRat); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRateMax = state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp = 26.7; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat = PsyWFnTdbTwbPb(state, 26.7, 19.4, state.dataEnvrn->OutBaroPress, RoutineName); + state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy = PsyHFnTdbW(26.7, state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat); Real64 const heldOutDryBulb = state.dataEnvrn->OutDryBulbTemp; - if (DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = OutdoorUnitInletAirDryBulbTempRated; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = OutdoorUnitInletAirDryBulbTempRated; } else { state.dataEnvrn->OutDryBulbTemp = OutdoorUnitInletAirDryBulbTempRated; } SpeedRatio = 1.0; CycRatio = 1.0; CalcMultiSpeedDXCoil(state, DXCoilNum, SpeedRatio, CycRatio, true); - TempDryBulb_Leaving_Apoint = DXCoilOutletTemp(DXCoilNum); // store result + TempDryBulb_Leaving_Apoint = state.dataDXCoils->DXCoilOutletTemp(DXCoilNum); // store result // IEER - part load test points *************************************************** for (PartLoadTestPoint = 1; PartLoadTestPoint <= 3; ++PartLoadTestPoint) { // determine minimum unloading capacity fraction at point B conditions. - if (DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { - Node(DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint); + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) != 0) { + Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1)).Temp = OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint); } else { state.dataEnvrn->OutDryBulbTemp = OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint); } @@ -13832,12 +13734,12 @@ namespace DXCoils { Par(5) = CoolingCoilInletAirWetBulbTempRated; Par(6) = CoolingCoilInletAirDryBulbTempRated; Par(7) = NetCoolingCapRated; - if (DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { Par(8) = 0.0; Par(9) = double(FanInletNode); Par(10) = double(FanOutletNode); Par(11) = ExternalStatic; - Par(12) = double(DXCoil(DXCoilNum).SupplyFanIndex); + Par(12) = double(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } else { Par(8) = FanPowerPerEvapAirFlowRate; Par(9) = 0.0; @@ -13846,7 +13748,7 @@ namespace DXCoils { Par(12) = 0.0; } - LowerBoundMassFlowRate = 0.01 * DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + LowerBoundMassFlowRate = 0.01 * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); TempSolveRoot::SolveRoot(state, AccuracyTolerance, @@ -13855,7 +13757,7 @@ namespace DXCoils { PartLoadAirMassFlowRate, CalcTwoSpeedDXCoilIEERResidual, LowerBoundMassFlowRate, - DXCoil(DXCoilNum).RatedAirMassFlowRate(1), + state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1), Par); if (SolverFlag == -1) { @@ -13879,25 +13781,25 @@ namespace DXCoils { } else { // now we have the supply air flow rate SupAirMdot_TestPoint(1 + PartLoadTestPoint) = PartLoadAirMassFlowRate; - AirMassFlowRatio = PartLoadAirMassFlowRate / DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + AirMassFlowRatio = PartLoadAirMassFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); SupplyAirHumRat = PsyWFnTdbTwbPb(state, CoolingCoilInletAirDryBulbTempRated, CoolingCoilInletAirWetBulbTempRated, state.dataEnvrn->OutBaroPress, RoutineName); SupplyAirRho = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, CoolingCoilInletAirDryBulbTempRated, SupplyAirHumRat, RoutineName); SupplyAirVolFlowRate = PartLoadAirMassFlowRate / SupplyAirRho; - if (DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { - FanStaticPressureRise = DXCoil(DXCoilNum).InternalStaticPressureDrop + (ExternalStatic * pow_2(AirMassFlowRatio)); + if (state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { + FanStaticPressureRise = state.dataDXCoils->DXCoil(DXCoilNum).InternalStaticPressureDrop + (ExternalStatic * pow_2(AirMassFlowRatio)); Node(FanInletNode).MassFlowRate = PartLoadAirMassFlowRate; Node(FanInletNode).Temp = CoolingCoilInletAirDryBulbTempRated; Node(FanInletNode).HumRat = SupplyAirHumRat; Node(FanInletNode).Enthalpy = PsyHFnTdbW(CoolingCoilInletAirDryBulbTempRated, SupplyAirHumRat); - if (DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { - HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->simulate(state, _, true, false, FanStaticPressureRise); - FanPowerCorrection = HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->fanPower(); + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { + HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->simulate(state, _, true, false, FanStaticPressureRise); + FanPowerCorrection = HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->fanPower(); } else { Fans::SimulateFanComponents( - state, DXCoil(DXCoilNum).SupplyFanName, true, DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); - FanPowerCorrection = Fans::GetFanPower(DXCoil(DXCoilNum).SupplyFanIndex); + state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, true, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); + FanPowerCorrection = Fans::GetFanPower(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } FanHeatCorrection = Node(FanOutletNode).Enthalpy - Node(FanInletNode).Enthalpy; @@ -13907,35 +13809,35 @@ namespace DXCoils { FanHeatCorrection = FanPowerPerEvapAirFlowRate * PartLoadAirMassFlowRate; } - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatio); - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(1), + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatio); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint)); - HighSpeedTotCoolingCap = DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac; + HighSpeedTotCoolingCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac; HighSpeedNetCoolingCap = HighSpeedTotCoolingCap - FanHeatCorrection; EIRTempModFac = CurveValue(state, - DXCoil(DXCoilNum).EIRFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint)); - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFFlow(1), AirMassFlowRatio); - if (DXCoil(DXCoilNum).RatedCOP(1) > 0.0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1), CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint)); + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), AirMassFlowRatio); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1) > 0.0) { // RatedCOP <= 0.0 is trapped in GetInput, but keep this as "safety" - EIR_HighSpeed = EIRTempModFac * EIRFlowModFac / DXCoil(DXCoilNum).RatedCOP(1); + EIR_HighSpeed = EIRTempModFac * EIRFlowModFac / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP(1); } else { EIR = 0.0; } - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp2, AirMassFlowRatio); + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2, AirMassFlowRatio); TotCapTempModFac = CurveValue(state, - DXCoil(DXCoilNum).CCapFTemp2, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint)); - LowSpeedTotCoolingCap = DXCoil(DXCoilNum).RatedTotCap2 * TotCapTempModFac * TotCapFlowModFac; + state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint)); + LowSpeedTotCoolingCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 * TotCapTempModFac * TotCapFlowModFac; LowSpeedNetCoolingCap = LowSpeedTotCoolingCap - FanHeatCorrection; EIRTempModFac = CurveValue(state, - DXCoil(DXCoilNum).EIRFTemp2, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint)); - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFFlow(1), AirMassFlowRatio); - if (DXCoil(DXCoilNum).RatedCOP2 > 0.0) { + state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp2, CoolingCoilInletAirWetBulbTempRated, OutdoorUnitInletAirDryBulbTempPLTestPoint(PartLoadTestPoint)); + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1), AirMassFlowRatio); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP2 > 0.0) { // RatedCOP <= 0.0 is trapped in GetInput, but keep this as "safety" - EIR_LowSpeed = EIRTempModFac * EIRFlowModFac / DXCoil(DXCoilNum).RatedCOP2; + EIR_LowSpeed = EIRTempModFac * EIRFlowModFac / state.dataDXCoils->DXCoil(DXCoilNum).RatedCOP2; } else { EIR_LowSpeed = 0.0; } @@ -13954,7 +13856,7 @@ namespace DXCoils { } else { // minimum unloading limit exceeded without cycling, so cycle SpeedRatio = 0.0; CycRatio = TargetNetCapacity / LowSpeedNetCoolingCap; - PLF = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(1), CycRatio); + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1), CycRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -13974,9 +13876,9 @@ namespace DXCoils { IEER = (0.02 * EER_TestPoint_IP(1)) + (0.617 * EER_TestPoint_IP(2)) + (0.238 * EER_TestPoint_IP(3)) + (0.125 * EER_TestPoint_IP(4)); // begin output - if (CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite) { + if (state.dataDXCoils->CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite) { print(state.files.eio, Header); - CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite = false; + state.dataDXCoils->CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite = false; state.dataOutRptPredefined->pdstVAVDXCoolCoil = newPreDefSubTable(state, state.dataOutRptPredefined->pdrEquip, "VAV DX Cooling Standard Rating Details"); state.dataOutRptPredefined->pdchVAVDXCoolCoilType = newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "DX Cooling Coil Type"); state.dataOutRptPredefined->pdchVAVDXFanName = newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "Assocated Fan"); @@ -13997,14 +13899,14 @@ namespace DXCoils { // determine footnote content countStaticInputs = 0; - for (index = 1; index <= NumDXCoils; ++index) { + for (index = 1; index <= state.dataDXCoils->NumDXCoils; ++index) { - if (DXCoil(index).RateWithInternalStaticAndFanObject && DXCoil(index).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { + if (state.dataDXCoils->DXCoil(index).RateWithInternalStaticAndFanObject && state.dataDXCoils->DXCoil(index).DXCoilType_Num == CoilDX_CoolingTwoSpeed) { ++countStaticInputs; } } - if (countStaticInputs == NumDXMulSpeedCoils) { + if (countStaticInputs == state.dataDXCoils->NumDXMulSpeedCoils) { addFootNoteSubTable(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "Packaged VAV unit ratings per ANSI/AHRI Standard 340/360-2007 with Addenda 1 and 2"); } else if (countStaticInputs == 0) { addFootNoteSubTable(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, @@ -14018,8 +13920,8 @@ namespace DXCoils { } const auto &fan_type_name = [&]() -> std::pair { - if (DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { - return {"Fan:VariableVolume", DXCoil(DXCoilNum).SupplyFanName}; + if (state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { + return {"Fan:VariableVolume", state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName}; } else { return {"N/A", "N/A"}; } @@ -14028,7 +13930,7 @@ namespace DXCoils { print(state.files.eio, Format_891, "Coil:Cooling:DX:TwoSpeed", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, fan_type_name.first, fan_type_name.second, NetCoolingCapRated, @@ -14047,37 +13949,37 @@ namespace DXCoils { SupAirMdot_TestPoint(3), SupAirMdot_TestPoint(4)); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType, DXCoil(DXCoilNum).Name, "Coil:Cooling:DX:TwoSpeed"); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType, state.dataDXCoils->DXCoil(DXCoilNum).Name, "Coil:Cooling:DX:TwoSpeed"); // W to tons - PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI, DXCoil(DXCoilNum).Name, NetCoolingCapRated, 1); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI, state.dataDXCoils->DXCoil(DXCoilNum).Name, NetCoolingCapRated, 1); // These will convert with a factor of 1 which is ok - PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilCOP, DXCoil(DXCoilNum).Name, EER_TestPoint_SI(1), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilEERIP, DXCoil(DXCoilNum).Name, EER_TestPoint_IP(1), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP, DXCoil(DXCoilNum).Name, IEER, 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERUserIP, DXCoil(DXCoilNum).Name, "N/A"); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERStandardIP, DXCoil(DXCoilNum).Name, "N/A"); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilCOP, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_SI(1), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilEERIP, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_IP(1), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP, state.dataDXCoils->DXCoil(DXCoilNum).Name, IEER, 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERUserIP, state.dataDXCoils->DXCoil(DXCoilNum).Name, "N/A"); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERStandardIP, state.dataDXCoils->DXCoil(DXCoilNum).Name, "N/A"); addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil, "ANSI/AHRI ratings include supply fan"); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilType, DXCoil(DXCoilNum).Name, "Coil:Cooling:DX:TwoSpeed"); - if (DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXFanName, DXCoil(DXCoilNum).Name, DXCoil(DXCoilNum).SupplyFanName); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilType, state.dataDXCoils->DXCoil(DXCoilNum).Name, "Coil:Cooling:DX:TwoSpeed"); + if (state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXFanName, state.dataDXCoils->DXCoil(DXCoilNum).Name, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName); } else { - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXFanName, DXCoil(DXCoilNum).Name, "None"); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXFanName, state.dataDXCoils->DXCoil(DXCoilNum).Name, "None"); } - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilNetCapSI, DXCoil(DXCoilNum).Name, NetCoolingCapRated, 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP, DXCoil(DXCoilNum).Name, EER_TestPoint_SI(1), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilIEERIP, DXCoil(DXCoilNum).Name, IEER, 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEERIP, DXCoil(DXCoilNum).Name, EER_TestPoint_IP(1), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotA, DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(1), 4); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP_B, DXCoil(DXCoilNum).Name, EER_TestPoint_SI(2), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEER_B_IP, DXCoil(DXCoilNum).Name, EER_TestPoint_IP(2), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotB, DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(2), 4); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP_C, DXCoil(DXCoilNum).Name, EER_TestPoint_SI(3), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEER_C_IP, DXCoil(DXCoilNum).Name, EER_TestPoint_IP(3), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotC, DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(3), 4); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP_D, DXCoil(DXCoilNum).Name, EER_TestPoint_SI(4), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEER_D_IP, DXCoil(DXCoilNum).Name, EER_TestPoint_IP(4), 2); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotD, DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(4), 4); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilNetCapSI, state.dataDXCoils->DXCoil(DXCoilNum).Name, NetCoolingCapRated, 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_SI(1), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilIEERIP, state.dataDXCoils->DXCoil(DXCoilNum).Name, IEER, 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEERIP, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_IP(1), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotA, state.dataDXCoils->DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(1), 4); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP_B, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_SI(2), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEER_B_IP, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_IP(2), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotB, state.dataDXCoils->DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(2), 4); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP_C, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_SI(3), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEER_C_IP, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_IP(3), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotC, state.dataDXCoils->DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(3), 4); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP_D, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_SI(4), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilEER_D_IP, state.dataDXCoils->DXCoil(DXCoilNum).Name, EER_TestPoint_IP(4), 2); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilMdotD, state.dataDXCoils->DXCoil(DXCoilNum).Name, SupAirMdot_TestPoint(4), 4); state.dataEnvrn->OutDryBulbTemp = heldOutDryBulb; // reset the outdoor dry bulb when done with it } @@ -14121,7 +14023,7 @@ namespace DXCoils { if (state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).Branch(BranchNum).Comp(CompNum).CompType_Num == DXSystem) { if (UtilityRoutines::SameString(state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).Branch(BranchNum).Comp(CompNum).Name, - DXCoil(CoolingCoilIndex).CoilSystemName)) { + state.dataDXCoils->DXCoil(CoolingCoilIndex).CoilSystemName)) { FoundBranch = BranchNum; FoundAirSysNum = AirSysNum; break; @@ -14151,7 +14053,7 @@ namespace DXCoils { } else if (state.dataAirSystemsData->PrimaryAirSystems(FoundAirSysNum).Branch(FoundBranch).Comp(CompNum).CompType_Num == UnitarySystem) { // fan may not be specified in a unitary system object, keep looking // Unitary System will "set" the fan index to the DX coil if contained within the HVAC system - if (DXCoil(CoolingCoilIndex).SupplyFanIndex > -1) break; + if (state.dataDXCoils->DXCoil(CoolingCoilIndex).SupplyFanIndex > -1) break; } } } @@ -14231,8 +14133,8 @@ namespace DXCoils { FanExternalStaticFull = Par(11); FanIndex = int(Par(12)); - if (DXCoil(DXCoilNum).RatedAirMassFlowRate(1) > 0.0) { - AirMassFlowRatio = SupplyAirMassFlowRate / DXCoil(DXCoilNum).RatedAirMassFlowRate(1); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1) > 0.0) { + AirMassFlowRatio = SupplyAirMassFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(1); } else { AirMassFlowRatio = 0.0; } @@ -14241,19 +14143,19 @@ namespace DXCoils { SupplyAirVolFlowRate = SupplyAirMassFlowRate / SupplyAirRho; - if (DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { + if (state.dataDXCoils->DXCoil(DXCoilNum).RateWithInternalStaticAndFanObject) { // modify external static per AHRI 340/360, Table 6, note 1. - FanStaticPressureRise = DXCoil(DXCoilNum).InternalStaticPressureDrop + (FanExternalStaticFull * pow_2(AirMassFlowRatio)); + FanStaticPressureRise = state.dataDXCoils->DXCoil(DXCoilNum).InternalStaticPressureDrop + (FanExternalStaticFull * pow_2(AirMassFlowRatio)); Node(FanInletNodeNum).MassFlowRate = SupplyAirMassFlowRate; Node(FanOutletNodeNum).MassFlowRate = SupplyAirMassFlowRate; Node(FanInletNodeNum).Temp = IndoorUnitInletDryBulb; Node(FanInletNodeNum).HumRat = PsyWFnTdbTwbPb(state, IndoorUnitInletDryBulb, IndoorUnitInletWetBulb, state.dataEnvrn->OutBaroPress, RoutineName); Node(FanInletNodeNum).Enthalpy = PsyHFnTdbW(IndoorUnitInletDryBulb, Node(FanInletNodeNum).HumRat); - if (DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { - HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->simulate(state, _, true, false, FanStaticPressureRise); + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { + HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->simulate(state, _, true, false, FanStaticPressureRise); } else { Fans::SimulateFanComponents( - state, DXCoil(DXCoilNum).SupplyFanName, true, DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); + state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, true, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise); } FanHeatCorrection = Node(FanOutletNodeNum).Enthalpy - Node(FanInletNodeNum).Enthalpy; @@ -14263,13 +14165,13 @@ namespace DXCoils { FanHeatCorrection = FanPowerPerEvapAirFlowRate * SupplyAirVolFlowRate; } - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatio); - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp(1), IndoorUnitInletWetBulb, OutdoorUnitInletDryBulb); - HighSpeedNetCoolingCap = DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatio); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1), IndoorUnitInletWetBulb, OutdoorUnitInletDryBulb); + HighSpeedNetCoolingCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; - TotCapFlowModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatio); - TotCapTempModFac = CurveValue(state, DXCoil(DXCoilNum).CCapFTemp2, IndoorUnitInletWetBulb, OutdoorUnitInletDryBulb); - LowSpeedNetCoolingCap = DXCoil(DXCoilNum).RatedTotCap2 * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; + TotCapFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1), AirMassFlowRatio); + TotCapTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).CCapFTemp2, IndoorUnitInletWetBulb, OutdoorUnitInletDryBulb); + LowSpeedNetCoolingCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap2 * TotCapTempModFac * TotCapFlowModFac - FanHeatCorrection; if (LowSpeedNetCoolingCap <= TargetNetCapacity) { CycRatio = 1.0; @@ -14279,10 +14181,10 @@ namespace DXCoils { CycRatio = TargetNetCapacity / LowSpeedNetCoolingCap; } - DXCoil(DXCoilNum).InletAirMassFlowRate = SupplyAirMassFlowRate; + state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate = SupplyAirMassFlowRate; CalcMultiSpeedDXCoil(state, DXCoilNum, SpeedRatio, CycRatio, true); - OutletAirTemp = DXCoilOutletTemp(DXCoilNum); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(DXCoilNum); Residuum = TargetCoilLeavingDryBulb - OutletAirTemp; return Residuum; @@ -14306,12 +14208,12 @@ namespace DXCoils { // This subroutine sets an index for a given DX Coil -- issues error message if that // DX Coil is not a legal DX Coil. - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - DXCoilIndex = UtilityRoutines::FindItemInList(DXCoilName, DXCoil); + DXCoilIndex = UtilityRoutines::FindItemInList(DXCoilName, state.dataDXCoils->DXCoil); if (DXCoilIndex == 0) { if (present(SuppressWarning)) { // No warning printed if only searching for the existence of a DX Coil @@ -14338,9 +14240,9 @@ namespace DXCoils { // This subroutine gets a name for a given DX Coil -- issues error message if that // DX Coil is not a legal DX Coil. - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (DXCoilIndex == 0) { @@ -14358,7 +14260,7 @@ namespace DXCoils { } else { - return DXCoil(DXCoilIndex).Name; + return state.dataDXCoils->DXCoil(DXCoilIndex).Name; } } @@ -14385,32 +14287,32 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (UtilityRoutines::SameString(CoilType, "Coil:Heating:DX:SingleSpeed") || UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:SingleSpeed")) { - WhichCoil = UtilityRoutines::FindItem(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - CoilCapacity = DXCoil(WhichCoil).RatedTotCap(1); + CoilCapacity = state.dataDXCoils->DXCoil(WhichCoil).RatedTotCap(1); } } else if (UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:TwoStageWithHumidityControlMode")) { - WhichCoil = UtilityRoutines::FindItem(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - CoilCapacity = DXCoil(WhichCoil).RatedTotCap(DXCoil(WhichCoil).NumCapacityStages); + CoilCapacity = state.dataDXCoils->DXCoil(WhichCoil).RatedTotCap(state.dataDXCoils->DXCoil(WhichCoil).NumCapacityStages); } } else if (UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:TwoSpeed")) { - WhichCoil = UtilityRoutines::FindItem(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - CoilCapacity = DXCoil(WhichCoil).RatedTotCap(1); + CoilCapacity = state.dataDXCoils->DXCoil(WhichCoil).RatedTotCap(1); } } else if (UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:MultiSpeed") || UtilityRoutines::SameString(CoilType, "Coil:Heating:DX:MultiSpeed")) { - WhichCoil = UtilityRoutines::FindItem(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - CoilCapacity = DXCoil(WhichCoil).MSRatedTotCap(DXCoil(WhichCoil).NumOfSpeeds); + CoilCapacity = state.dataDXCoils->DXCoil(WhichCoil).MSRatedTotCap(state.dataDXCoils->DXCoil(WhichCoil).NumOfSpeeds); } } else { WhichCoil = 0; @@ -14446,9 +14348,9 @@ namespace DXCoils { Real64 CoilCapacity; // returned capacity of matched coil // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (CoilIndex == 0) { @@ -14459,18 +14361,18 @@ namespace DXCoils { return CoilCapacity; } - if (CoilType_Num != DXCoil(CoilIndex).DXCoilType_Num) { + if (CoilType_Num != state.dataDXCoils->DXCoil(CoilIndex).DXCoilType_Num) { ShowSevereError(state, "GetCoilCapacityByIndexType: Index passed does not match DX Coil type passed."); ShowContinueError(state, "... returning capacity as -1000."); ErrorsFound = true; CoilCapacity = -1000.0; } else { { - auto const SELECT_CASE_var(DXCoil(CoilIndex).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(CoilIndex).DXCoilType_Num); if ((SELECT_CASE_var == CoilDX_MultiSpeedCooling) || (SELECT_CASE_var == CoilDX_MultiSpeedHeating)) { - CoilCapacity = DXCoil(CoilIndex).MSRatedTotCap(DXCoil(CoilIndex).NumOfSpeeds); + CoilCapacity = state.dataDXCoils->DXCoil(CoilIndex).MSRatedTotCap(state.dataDXCoils->DXCoil(CoilIndex).NumOfSpeeds); } else { - CoilCapacity = DXCoil(CoilIndex).RatedTotCap(DXCoil(CoilIndex).NumCapacityStages); + CoilCapacity = state.dataDXCoils->DXCoil(CoilIndex).RatedTotCap(state.dataDXCoils->DXCoil(CoilIndex).NumCapacityStages); } } } @@ -14503,9 +14405,9 @@ namespace DXCoils { bool PrintMessage; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (present(PrintWarning)) { @@ -14514,9 +14416,9 @@ namespace DXCoils { PrintMessage = true; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - TypeNum = DXCoil(WhichCoil).DXCoilType_Num; + TypeNum = state.dataDXCoils->DXCoil(WhichCoil).DXCoilType_Num; } else { if (PrintMessage) { ShowSevereError(state, "GetCoilTypeNum: Could not find Coil, Type=\"" + CoilType + "\" Name=\"" + CoilName + "\""); @@ -14551,28 +14453,28 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:SingleSpeed") || UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:TwoSpeed")) { - WhichCoil = UtilityRoutines::FindItem(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - MinOAT = DXCoil(WhichCoil).MinOATCompressor; + MinOAT = state.dataDXCoils->DXCoil(WhichCoil).MinOATCompressor; } } else if (UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:MultiSpeed") || UtilityRoutines::SameString(CoilType, "Coil:Cooling:DX:TwoStageWithHumidityControlMode")) { - WhichCoil = UtilityRoutines::FindItem(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - MinOAT = DXCoil(WhichCoil).MinOATCompressor; + MinOAT = state.dataDXCoils->DXCoil(WhichCoil).MinOATCompressor; } } else if (UtilityRoutines::SameString(CoilType, "Coil:Heating:DX:SingleSpeed") || UtilityRoutines::SameString(CoilType, "Coil:Heating:DX:MultiSpeed")) { - WhichCoil = UtilityRoutines::FindItem(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItem(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - MinOAT = DXCoil(WhichCoil).MinOATCompressor; + MinOAT = state.dataDXCoils->DXCoil(WhichCoil).MinOATCompressor; } } else { WhichCoil = 0; @@ -14607,9 +14509,9 @@ namespace DXCoils { Real64 MinOAT; // returned min oa temperature of matched coil // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (CoilIndex == 0) { @@ -14621,7 +14523,7 @@ namespace DXCoils { } else { - MinOAT = DXCoil(CoilIndex).MinOATCompressor; + MinOAT = state.dataDXCoils->DXCoil(CoilIndex).MinOATCompressor; } return MinOAT; @@ -14649,14 +14551,14 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - NodeNumber = DXCoil(WhichCoil).AirInNode; + NodeNumber = state.dataDXCoils->DXCoil(WhichCoil).AirInNode; } else { ShowSevereError(state, "GetCoilInletNode: Could not find Coil, Type=\"" + CoilType + "\" Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -14675,13 +14577,13 @@ namespace DXCoils { int NodeNumber; // returned node number of matched coil // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (CoilIndex != 0) { - NodeNumber = DXCoil(CoilIndex).AirInNode; + NodeNumber = state.dataDXCoils->DXCoil(CoilIndex).AirInNode; } else { ShowSevereError(state, "GetCoilInletNode: Could not find Coil Type"); ErrorsFound = true; @@ -14714,14 +14616,14 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - NodeNumber = DXCoil(WhichCoil).AirOutNode; + NodeNumber = state.dataDXCoils->DXCoil(WhichCoil).AirOutNode; } else { ShowSevereError(state, "GetCoilOutletNode: Could not find Coil, Type=\"" + CoilType + "\" Name=\"" + CoilName + "\" when accessing coil outlet node number."); @@ -14741,13 +14643,13 @@ namespace DXCoils { int NodeNumber; // returned node number of matched coil // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (CoilIndex != 0) { - NodeNumber = DXCoil(CoilIndex).AirOutNode; + NodeNumber = state.dataDXCoils->DXCoil(CoilIndex).AirOutNode; } else { ShowSevereError(state, "GetCoilOutletNode: Could not find Coil Type"); ErrorsFound = true; @@ -14779,14 +14681,14 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - CondNode = DXCoil(WhichCoil).CondenserInletNodeNum(1); + CondNode = state.dataDXCoils->DXCoil(WhichCoil).CondenserInletNodeNum(1); } else { ShowSevereError(state, "GetCoilCondenserInletNode: Invalid DX Coil, Type= \"" + CoilType + "\" Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -14819,14 +14721,14 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - BypassFraction = DXCoil(WhichCoil).BypassedFlowFrac(1); + BypassFraction = state.dataDXCoils->DXCoil(WhichCoil).BypassedFlowFrac(1); } else { ShowSevereError(state, "GetDXCoilBypassedFlowFrac: Invalid DX Coil Type=\"" + CoilType + "\" Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -14880,14 +14782,14 @@ namespace DXCoils { if (!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).ParentCName, CompSetsParentName) || !UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:SingleSpeed")) continue; - DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, DXCoil); + DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, state.dataDXCoils->DXCoil); break; } for (WhichCompanionComp = 1; WhichCompanionComp <= state.dataBranchNodeConnections->NumCompSets; ++WhichCompanionComp) { if (!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).ParentCName, CompSetsParentName) || !UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:MultiSpeed")) continue; - DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, DXCoil); + DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, state.dataDXCoils->DXCoil); break; } // Search for Heat Exchanger Assisted DX cooling coils @@ -14902,7 +14804,7 @@ namespace DXCoils { if (!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).ParentCName, HXCompSetsParentName) || !UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:SingleSpeed")) continue; - DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, DXCoil); + DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, state.dataDXCoils->DXCoil); break; } break; @@ -14919,11 +14821,11 @@ namespace DXCoils { // Check and warn user is crankcase heater power or max OAT for crankcase heater differs in DX cooling and heating coils if (DXCoolingCoilIndex > 0) { - if (DXCoil(DXCoolingCoilIndex).CrankcaseHeaterCapacity != 0.0) { - if (DXCoil(DXCoolingCoilIndex).CrankcaseHeaterCapacity != DXCoil(HeatingCoilIndex).CrankcaseHeaterCapacity || - DXCoil(DXCoolingCoilIndex).MaxOATCrankcaseHeater != DXCoil(HeatingCoilIndex).MaxOATCrankcaseHeater) { + if (state.dataDXCoils->DXCoil(DXCoolingCoilIndex).CrankcaseHeaterCapacity != 0.0) { + if (state.dataDXCoils->DXCoil(DXCoolingCoilIndex).CrankcaseHeaterCapacity != state.dataDXCoils->DXCoil(HeatingCoilIndex).CrankcaseHeaterCapacity || + state.dataDXCoils->DXCoil(DXCoolingCoilIndex).MaxOATCrankcaseHeater != state.dataDXCoils->DXCoil(HeatingCoilIndex).MaxOATCrankcaseHeater) { ShowWarningError(state, "Crankcase heater capacity or max outdoor temp for crankcase heater operation specified in"); - ShowContinueError(state, "Coil:Cooling:DX:SingleSpeed = " + DXCoil(DXCoolingCoilIndex).Name); + ShowContinueError(state, "Coil:Cooling:DX:SingleSpeed = " + state.dataDXCoils->DXCoil(DXCoolingCoilIndex).Name); ShowContinueError(state, "is different than that specified in Coil:Heating:DX:SingleSpeed = " + HeatingCoilName + '.'); ShowContinueError(state, "Both of these DX coils are part of " + CompSetsParentType + " = " + CompSetsParentName + '.'); ShowContinueError(state, "The value specified in the DX heating coil will be used and the simulation continues..."); @@ -14956,14 +14858,14 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - NumberOfSpeeds = DXCoil(WhichCoil).NumOfSpeeds; + NumberOfSpeeds = state.dataDXCoils->DXCoil(WhichCoil).NumOfSpeeds; } else { ShowSevereError(state, "GetDXCoilNumberOfSpeeds: Invalid DX Coil Type=\"" + CoilType + "\" Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -14997,9 +14899,9 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (present(CoilIndex)) { @@ -15013,10 +14915,10 @@ namespace DXCoils { WhichCoil = CoilIndex; } } else { - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); } if (WhichCoil != 0) { - SchPtr = DXCoil(WhichCoil).SchedPtr; + SchPtr = state.dataDXCoils->DXCoil(WhichCoil).SchedPtr; } else { if (!present(CoilIndex)) { ShowSevereError(state, "GetDXCoilAvailSch: Could not find Coil, Type=\"" + CoilType + "\" Name=\"" + CoilName + @@ -15052,20 +14954,20 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { { - auto const SELECT_CASE_var(DXCoil(WhichCoil).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(WhichCoil).DXCoilType_Num); if ((SELECT_CASE_var == CoilDX_CoolingSingleSpeed) || (SELECT_CASE_var == CoilDX_CoolingTwoSpeed) || (SELECT_CASE_var == CoilDX_HeatingEmpirical) || (SELECT_CASE_var == CoilDX_CoolingTwoStageWHumControl)) { - AirFlow = DXCoil(WhichCoil).RatedAirVolFlowRate(1); + AirFlow = state.dataDXCoils->DXCoil(WhichCoil).RatedAirVolFlowRate(1); } else if ((SELECT_CASE_var == CoilDX_MultiSpeedCooling) || (SELECT_CASE_var == CoilDX_MultiSpeedHeating)) { - AirFlow = DXCoil(WhichCoil).MSRatedAirVolFlowRate(1); + AirFlow = state.dataDXCoils->DXCoil(WhichCoil).MSRatedAirVolFlowRate(1); } else { ShowSevereError(state, "GetDXCoilAirFlow: Could not find Coil, Type=\"" + CoilType + "\" Name=\"" + CoilName + "\" when accessing coil air flow rate."); @@ -15102,21 +15004,21 @@ namespace DXCoils { int CapFTCurveIndex; // returned coil CapFT curve index // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } if (CoilIndex != 0) { { - auto const SELECT_CASE_var(DXCoil(CoilIndex).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(CoilIndex).DXCoilType_Num); if ((SELECT_CASE_var == CoilDX_CoolingSingleSpeed) || (SELECT_CASE_var == CoilDX_CoolingTwoSpeed) || (SELECT_CASE_var == CoilDX_HeatingEmpirical) || (SELECT_CASE_var == CoilDX_CoolingTwoStageWHumControl)) { - CapFTCurveIndex = DXCoil(CoilIndex).CCapFTemp(1); + CapFTCurveIndex = state.dataDXCoils->DXCoil(CoilIndex).CCapFTemp(1); } else if ((SELECT_CASE_var == CoilDX_MultiSpeedCooling) || (SELECT_CASE_var == CoilDX_MultiSpeedHeating)) { - CapFTCurveIndex = DXCoil(CoilIndex).MSCCapFTemp(DXCoil(CoilIndex).NumOfSpeeds); + CapFTCurveIndex = state.dataDXCoils->DXCoil(CoilIndex).MSCCapFTemp(state.dataDXCoils->DXCoil(CoilIndex).NumOfSpeeds); } else if (SELECT_CASE_var == CoilVRF_Heating) { - CapFTCurveIndex = DXCoil(CoilIndex).CCapFTemp(1); + CapFTCurveIndex = state.dataDXCoils->DXCoil(CoilIndex).CCapFTemp(1); } else { // CALL ShowSevereError(state, 'GetDXCoilCapFTCurveIndex: Could not find Coil, Type="'// & // TRIM(cAllCoilTypes(DXCoil(CoilIndex)%DXCoilType_Num))//'" Name="'//TRIM(DXCoil(CoilIndex)%Name)// & @@ -15174,120 +15076,120 @@ namespace DXCoils { // Using/Aliasing // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - if (DXCoilNum <= 0 || DXCoilNum > NumDXCoils) { + if (DXCoilNum <= 0 || DXCoilNum > state.dataDXCoils->NumDXCoils) { ShowSevereError( state, - format("SetDXCoolingCoilData: called with DX Cooling Coil Number out of range={} should be >0 and <{}", DXCoilNum, NumDXCoils)); + format("SetDXCoolingCoilData: called with DX Cooling Coil Number out of range={} should be >0 and <{}", DXCoilNum, state.dataDXCoils->NumDXCoils)); ErrorsFound = true; return; } if (present(HeatingCoilPLFCurvePTR)) { - DXCoil(DXCoilNum).HeatingCoilPLFCurvePTR = HeatingCoilPLFCurvePTR; + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilPLFCurvePTR = HeatingCoilPLFCurvePTR; } if (present(CondenserType)) { - DXCoil(DXCoilNum).CondenserType = CondenserType; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserType = CondenserType; } if (present(CondenserInletNodeNum)) { - DXCoil(DXCoilNum).CondenserInletNodeNum(1) = CondenserInletNodeNum; + state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(1) = CondenserInletNodeNum; } if (present(MaxOATCrankcaseHeater)) { - DXCoil(DXCoilNum).MaxOATCrankcaseHeater = MaxOATCrankcaseHeater; + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater = MaxOATCrankcaseHeater; } if (present(MaxOATCooling)) { - DXCoil(DXCoilNum).MaxOATCompressor = MaxOATCooling; + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCompressor = MaxOATCooling; } if (present(MaxOATHeating)) { - DXCoil(DXCoilNum).MaxOATCompressor = MaxOATHeating; + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCompressor = MaxOATHeating; } if (present(MinOATCooling)) { - DXCoil(DXCoilNum).MinOATCompressor = MinOATCooling; + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = MinOATCooling; } if (present(MinOATHeating)) { - DXCoil(DXCoilNum).MinOATCompressor = MinOATHeating; + state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = MinOATHeating; } if (present(HeatingPerformanceOATType)) { - DXCoil(DXCoilNum).HeatingPerformanceOATType = HeatingPerformanceOATType; + state.dataDXCoils->DXCoil(DXCoilNum).HeatingPerformanceOATType = HeatingPerformanceOATType; } if (present(DefrostStrategy)) { - DXCoil(DXCoilNum).DefrostStrategy = DefrostStrategy; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostStrategy = DefrostStrategy; } if (present(DefrostControl)) { - DXCoil(DXCoilNum).DefrostControl = DefrostControl; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostControl = DefrostControl; } if (present(DefrostEIRPtr)) { - DXCoil(DXCoilNum).DefrostEIRFT = DefrostEIRPtr; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostEIRFT = DefrostEIRPtr; } if (present(DefrostFraction)) { - DXCoil(DXCoilNum).DefrostTime = DefrostFraction; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostTime = DefrostFraction; } if (present(DefrostCapacity)) { - DXCoil(DXCoilNum).DefrostCapacity = DefrostCapacity; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostCapacity = DefrostCapacity; } if (present(MaxOATDefrost)) { - DXCoil(DXCoilNum).MaxOATDefrost = MaxOATDefrost; + state.dataDXCoils->DXCoil(DXCoilNum).MaxOATDefrost = MaxOATDefrost; } if (present(CoolingCoilPresent)) { - DXCoil(DXCoilNum).CoolingCoilPresent = CoolingCoilPresent; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilPresent = CoolingCoilPresent; } if (present(HeatingCoilPresent)) { - DXCoil(DXCoilNum).HeatingCoilPresent = HeatingCoilPresent; + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilPresent = HeatingCoilPresent; } if (present(HeatSizeRatio)) { - DXCoil(DXCoilNum).HeatSizeRatio = HeatSizeRatio; + state.dataDXCoils->DXCoil(DXCoilNum).HeatSizeRatio = HeatSizeRatio; } if (present(TotCap)) { - DXCoil(DXCoilNum).RatedTotCap(1) = TotCap; + state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(1) = TotCap; } if (present(SupplyFanIndex)) { - DXCoil(DXCoilNum).SupplyFanIndex = SupplyFanIndex; + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex = SupplyFanIndex; } if (present(SupplyFanName)) { - DXCoil(DXCoilNum).SupplyFanName = SupplyFanName; + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName = SupplyFanName; } if (present(SupplyFan_TypeNum)) { - DXCoil(DXCoilNum).SupplyFan_TypeNum = SupplyFan_TypeNum; - if (DXCoil(DXCoilNum).SupplyFanIndex > -1) { + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFan_TypeNum = SupplyFan_TypeNum; + if (state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex > -1) { if (SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { coilSelectionReportObj->setCoilSupplyFanInfo(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - HVACFan::fanObjs[DXCoil(DXCoilNum).SupplyFanIndex]->name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + HVACFan::fanObjs[state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex]->name, DataAirSystems::objectVectorOOFanSystemModel, - DXCoil(DXCoilNum).SupplyFanIndex); + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } else { coilSelectionReportObj->setCoilSupplyFanInfo(state, - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).DXCoilType, - Fans::Fan(DXCoil(DXCoilNum).SupplyFanIndex).FanName, + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + Fans::Fan(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex).FanName, DataAirSystems::structArrayLegacyFanModels, - DXCoil(DXCoilNum).SupplyFanIndex); + state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex); } } } @@ -15314,14 +15216,14 @@ namespace DXCoils { int WhichCoil; // Obtains and Allocates DXCoils - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - DXCoil(WhichCoil).FindCompanionUpStreamCoil = false; + state.dataDXCoils->DXCoil(WhichCoil).FindCompanionUpStreamCoil = false; } else { ShowSevereError(state, "SetCoilSystemHeatingDXFlag: Could not find Coil, Type=\"" + CoilType + "\"Name=\"" + CoilName + "\""); } @@ -15342,14 +15244,14 @@ namespace DXCoils { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int WhichCoil; - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - DXCoil(WhichCoil).CoilSystemName = CoilSystemName; + state.dataDXCoils->DXCoil(WhichCoil).CoilSystemName = CoilSystemName; } else { ShowSevereError(state, "SetCoilSystemCoolingData: Could not find Coil \"Name=\"" + CoilName + "\""); } @@ -15434,14 +15336,14 @@ namespace DXCoils { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int WhichCoil; - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - DXCoil(WhichCoil).ISHundredPercentDOASDXCoil = true; + state.dataDXCoils->DXCoil(WhichCoil).ISHundredPercentDOASDXCoil = true; } else { // DXCoil(WhichCoil)%ISHundredPercentDOASDXCoil = .FALSE. //Autodesk:BoundsViolation DXCoil(0): DXCoil is not allocated with a 0 // element: Commented out @@ -15507,45 +15409,45 @@ namespace DXCoils { EvapAirMassFlow = 0.0; - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { // Select the correct unit type { - auto const SELECT_CASE_var(DXCoil(DXCoilNum).DXCoilType_Num); + auto const SELECT_CASE_var(state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num); if ((SELECT_CASE_var == CoilDX_CoolingSingleSpeed) || (SELECT_CASE_var == CoilDX_CoolingTwoSpeed) || (SELECT_CASE_var == CoilDX_MultiSpeedCooling)) { // total sensible heat gain of the secondary zone from the secondary coil (condenser) - if (DXCoil(DXCoilNum).ElecCoolingPower > 0.0) { - TotalHeatRejectionRate = DXCoil(DXCoilNum).TotalCoolingEnergyRate + DXCoil(DXCoilNum).ElecCoolingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower > 0.0) { + TotalHeatRejectionRate = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower; } else { TotalHeatRejectionRate = 0.0; return; } - DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = TotalHeatRejectionRate; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = TotalHeatRejectionRate; } else if (SELECT_CASE_var == CoilDX_HeatingEmpirical) { // evaporator coil in the secondary zone - if (DXCoil(DXCoilNum).ElecHeatingPower > 0.0) { - TotalHeatRemovalRate = max(0.0, DXCoil(DXCoilNum).TotalHeatingEnergyRate - DXCoil(DXCoilNum).ElecHeatingPower); + if (state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower > 0.0) { + TotalHeatRemovalRate = max(0.0, state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate - state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower); } else { TotalHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilSHR = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHR = 0.0; return; } - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = -TotalHeatRemovalRate; // +DXCoil( DXCoilNum ).DefrostPower; - EvapInletDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - EvapInletHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = -TotalHeatRemovalRate; // +DXCoil( DXCoilNum ).DefrostPower; + EvapInletDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + EvapInletHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, EvapInletDryBulb, EvapInletHumRat); - EvapAirMassFlow = RhoAir * DXCoil(DXCoilNum).SecCoilAirFlow; + EvapAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow; ; - PartLoadRatio = DXCoil(DXCoilNum).CompressorPartLoadRatio; - SecCoilRatedSHR = DXCoil(DXCoilNum).SecCoilRatedSHR; + PartLoadRatio = state.dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio; + SecCoilRatedSHR = state.dataDXCoils->DXCoil(DXCoilNum).SecCoilRatedSHR; if ((EvapAirMassFlow > SmallMassFlow) && (PartLoadRatio > 0.0) && - (EvapInletDryBulb > DXCoil(DXCoilNum).MinOATCompressor)) { // coil is running + (EvapInletDryBulb > state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor)) { // coil is running SecCoilFlowFraction = 1.0; // for single speed DX coil the secondary coil (condenser) flow fraction is 1.0 - CondInletDryBulb = Node(DXCoil(DXCoilNum).AirInNode).Temp; + CondInletDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).AirInNode).Temp; EvapInletWetBulb = PsyTwbFnTdbWPb(state, EvapInletDryBulb, EvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName); EvapInletEnthalpy = PsyHFnTdbW(EvapInletDryBulb, EvapInletHumRat); - SecCoilSHRFT = DXCoil(DXCoilNum).SecCoilSHRFT; - SecCoilSHRFF = DXCoil(DXCoilNum).SecCoilSHRFF; + SecCoilSHRFT = state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHRFT; + SecCoilSHRFF = state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHRFF; // determine the current SHR SHR = CalcSecondaryDXCoilsSHR(state, DXCoilNum, @@ -15576,43 +15478,43 @@ namespace DXCoils { SHR = min(SHR, 1.0); } // calculate the sensible and latent zone heat removal (extraction) rate by the secondary coil - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate * SHR; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate * SHR; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate - state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate; } else { // DX coil is off; - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; SHR = 0.0; // SHR is set to zero if the coil is off } - DXCoil(DXCoilNum).SecCoilSHR = SHR; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHR = SHR; } else if (SELECT_CASE_var == CoilDX_MultiSpeedHeating) { - EvapInletDryBulb = ZT(DXCoil(DXCoilNum).SecZonePtr); - EvapInletHumRat = ZoneAirHumRat(DXCoil(DXCoilNum).SecZonePtr); + EvapInletDryBulb = ZT(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); + EvapInletHumRat = ZoneAirHumRat(state.dataDXCoils->DXCoil(DXCoilNum).SecZonePtr); RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, EvapInletDryBulb, EvapInletHumRat); - MSSpeedRatio = DXCoil(DXCoilNum).MSSpeedRatio; - MSCycRatio = DXCoil(DXCoilNum).MSCycRatio; - MSSpeedNumHS = DXCoil(DXCoilNum).MSSpeedNumHS; - MSSpeedNumLS = DXCoil(DXCoilNum).MSSpeedNumLS; + MSSpeedRatio = state.dataDXCoils->DXCoil(DXCoilNum).MSSpeedRatio; + MSCycRatio = state.dataDXCoils->DXCoil(DXCoilNum).MSCycRatio; + MSSpeedNumHS = state.dataDXCoils->DXCoil(DXCoilNum).MSSpeedNumHS; + MSSpeedNumLS = state.dataDXCoils->DXCoil(DXCoilNum).MSSpeedNumLS; if (MSSpeedRatio > 0.0) { - EvapAirMassFlow = RhoAir * (DXCoil(DXCoilNum).MSSecCoilAirFlow(MSSpeedNumHS) * MSSpeedRatio + - DXCoil(DXCoilNum).MSSecCoilAirFlow(MSSpeedNumLS) * (1.0 - MSSpeedRatio)); + EvapAirMassFlow = RhoAir * (state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(MSSpeedNumHS) * MSSpeedRatio + + state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(MSSpeedNumLS) * (1.0 - MSSpeedRatio)); } else if (MSCycRatio > 0.0) { - EvapAirMassFlow = RhoAir * DXCoil(DXCoilNum).MSSecCoilAirFlow(MSSpeedNumLS); + EvapAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(MSSpeedNumLS); } - if (DXCoil(DXCoilNum).ElecHeatingPower > 0.0) { - TotalHeatRemovalRate = max(0.0, DXCoil(DXCoilNum).TotalHeatingEnergyRate - DXCoil(DXCoilNum).ElecHeatingPower); + if (state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower > 0.0) { + TotalHeatRemovalRate = max(0.0, state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate - state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower); } else { TotalHeatRemovalRate = 0.0; return; } - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = -TotalHeatRemovalRate; // +DXCoil( DXCoilNum ).DefrostPower; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = -TotalHeatRemovalRate; // +DXCoil( DXCoilNum ).DefrostPower; if ((EvapAirMassFlow > SmallMassFlow) && (MSSpeedRatio > 0.0 || MSCycRatio > 0.0) && - (EvapInletDryBulb > DXCoil(DXCoilNum).MinOATCompressor)) { // coil is running + (EvapInletDryBulb > state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor)) { // coil is running SecCoilFlowFraction = 1.0; // for single speed DX coil the secondary coil (condenser) flow fraction is 1.0 - CondInletDryBulb = Node(DXCoil(DXCoilNum).AirInNode).Temp; + CondInletDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).AirInNode).Temp; EvapInletWetBulb = PsyTwbFnTdbWPb(state, EvapInletDryBulb, EvapInletHumRat, state.dataEnvrn->OutBaroPress, RoutineName); EvapInletEnthalpy = PsyHFnTdbW(EvapInletDryBulb, EvapInletHumRat); // determine the current SHR @@ -15620,9 +15522,9 @@ namespace DXCoils { // calculate SHR for the higher speed PartLoadRatio = 1.0; SecCoilFlowFraction = 1.0; - SecCoilSHRFT = DXCoil(DXCoilNum).MSSecCoilSHRFT(MSSpeedNumHS); - SecCoilSHRFF = DXCoil(DXCoilNum).MSSecCoilSHRFF(MSSpeedNumHS); - SecCoilRatedSHR = DXCoil(DXCoilNum).MSSecCoilRatedSHR(MSSpeedNumHS); + SecCoilSHRFT = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(MSSpeedNumHS); + SecCoilSHRFF = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF(MSSpeedNumHS); + SecCoilRatedSHR = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR(MSSpeedNumHS); SHRHighSpeed = CalcSecondaryDXCoilsSHR(state, DXCoilNum, EvapAirMassFlow, @@ -15638,9 +15540,9 @@ namespace DXCoils { SecCoilSHRFT, SecCoilSHRFF); // calculate SHR for the lower speed - SecCoilSHRFT = DXCoil(DXCoilNum).MSSecCoilSHRFT(MSSpeedNumLS); - SecCoilSHRFF = DXCoil(DXCoilNum).MSSecCoilSHRFF(MSSpeedNumLS); - SecCoilRatedSHR = DXCoil(DXCoilNum).MSSecCoilRatedSHR(MSSpeedNumLS); + SecCoilSHRFT = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(MSSpeedNumLS); + SecCoilSHRFF = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF(MSSpeedNumLS); + SecCoilRatedSHR = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR(MSSpeedNumLS); SHRLowSpeed = CalcSecondaryDXCoilsSHR(state, DXCoilNum, EvapAirMassFlow, @@ -15660,9 +15562,9 @@ namespace DXCoils { } else if (MSCycRatio > 0.0) { // calculate SHR for the lower speed PartLoadRatio = MSCycRatio; - SecCoilSHRFT = DXCoil(DXCoilNum).MSSecCoilSHRFT(MSSpeedNumLS); - SecCoilSHRFF = DXCoil(DXCoilNum).MSSecCoilSHRFF(MSSpeedNumLS); - SecCoilRatedSHR = DXCoil(DXCoilNum).MSSecCoilRatedSHR(MSSpeedNumLS); + SecCoilSHRFT = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(MSSpeedNumLS); + SecCoilSHRFF = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF(MSSpeedNumLS); + SecCoilRatedSHR = state.dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR(MSSpeedNumLS); SecCoilFlowFraction = 1.0; SHRLowSpeed = CalcSecondaryDXCoilsSHR(state, DXCoilNum, @@ -15695,25 +15597,25 @@ namespace DXCoils { SHR = min(SHR, 1.0); } // calculate the sensible and latent zone heat removal (extraction) rate by the secondary coil - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate * SHR; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate * SHR; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate - state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate; } else { // DX coil is off; - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; SHR = 0.0; // SHR is set to rated value if the coil is off } - DXCoil(DXCoilNum).SecCoilSHR = SHR; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSHR = SHR; } } // end of { auto const SELECT_CASE_var( DXCoil( DXCoilNum ).DXCoilType_Num ); } else { - DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; } } @@ -15855,8 +15757,6 @@ namespace DXCoils { using DataHVACGlobals::TimeStepSys; using General::CreateSysTimeIntervalString; - using HVACVariableRefrigerantFlow::OACompOffMassFlow; - using HVACVariableRefrigerantFlow::OACompOnMassFlow; using namespace HVACVariableRefrigerantFlow; // SUBROUTINE PARAMETER DEFINITIONS: @@ -15925,24 +15825,24 @@ namespace DXCoils { // Initialize coil air side parameters CondInletTemp = 0.0; CondInletHumRat = 0.0; - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; HeatReclaimDXCoil(DXCoilNum).AvailCapacity = 0.0; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; - DXCoil(DXCoilNum).PartLoadRatio = 0.0; - DXCoil(DXCoilNum).BasinHeaterPower = 0.0; - DXCoil(DXCoilNum).EvaporatingTemp = VRF(DXCoil(DXCoilNum).VRFOUPtr).IUEvaporatingTemp; - - if (DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { - OutdoorDryBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; - if (DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).BasinHeaterPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvaporatingTemp = state.dataHVACVarRefFlow->VRF(state.dataDXCoils->DXCoil(DXCoilNum).VRFOUPtr).IUEvaporatingTemp; + + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode) != 0) { + OutdoorDryBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Temp; + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { OutdoorHumRat = state.dataEnvrn->OutHumRat; OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorPressure = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; + OutdoorPressure = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).Press; // If node is not connected to anything, pressure = default, use weather data if (OutdoorPressure == DefaultNodeValues.Press) { OutdoorDryBulb = state.dataEnvrn->OutDryBulbTemp; @@ -15950,8 +15850,8 @@ namespace DXCoils { OutdoorPressure = state.dataEnvrn->OutBaroPress; OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } else { - OutdoorHumRat = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; - OutdoorWetBulb = Node(DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).OutAirWetBulb; + OutdoorHumRat = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).HumRat; + OutdoorWetBulb = Node(state.dataDXCoils->DXCoil(DXCoilNum).CondenserInletNodeNum(Mode)).OutAirWetBulb; } } } else { @@ -15961,16 +15861,16 @@ namespace DXCoils { OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } - if (DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == EvapCooled) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat); - CondAirMassFlow = RhoAir * DXCoil(DXCoilNum).EvapCondAirFlow(Mode); + CondAirMassFlow = RhoAir * state.dataDXCoils->DXCoil(DXCoilNum).EvapCondAirFlow(Mode); // (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - DXCoil(DXCoilNum).EvapCondEffect(Mode)); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).EvapCondEffect(Mode)); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure); CompAmbTemp = OutdoorDryBulb; } else { // for air or water-cooled, inlet temp is stored in OutdoorDryBulb temp CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp or water inlet temp - if (DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { + if (state.dataDXCoils->DXCoil(DXCoilNum).CondenserType(Mode) == WaterCooled) { CompAmbTemp = state.dataEnvrn->OutDryBulbTemp; // for crankcase heater use actual outdoor temp for water-cooled } else { CompAmbTemp = OutdoorDryBulb; @@ -15979,8 +15879,8 @@ namespace DXCoils { // Initialize crankcase heater, operates below OAT defined in input deck for HP DX cooling coil // If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput) - if (CompAmbTemp < DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = DXCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (CompAmbTemp < state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } @@ -16023,55 +15923,55 @@ namespace DXCoils { // } // } - if (DXCoil(DXCoilNum).PrintLowOutTempMessage) { - if (CurrentEndTime > DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= DXCoil(DXCoilNum).TimeStepSysLast) { - if (DXCoil(DXCoilNum).LowOutletTempIndex == 0) { - ShowWarningMessage(state, DXCoil(DXCoilNum).LowOutTempBuffer1); - ShowContinueError(state, DXCoil(DXCoilNum).LowOutTempBuffer2); + if (state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage) { + if (CurrentEndTime > state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast && TimeStepSys >= state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast) { + if (state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex == 0) { + ShowWarningMessage(state, state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer1); + ShowContinueError(state, state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer2); ShowContinueError(state, "... Possible reasons for low outlet air dry-bulb temperatures are: This DX coil"); ShowContinueError(state, format(" 1) may have a low inlet air dry-bulb temperature. Inlet air temperature = {:.3T} C.", - DXCoil(DXCoilNum).FullLoadInletAirTempLast)); + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadInletAirTempLast)); ShowContinueError(state, " 2) may have a low air flow rate per watt of cooling capacity. Check inputs."); ShowContinueError(state, " 3) is used as part of a HX assisted cooling coil which uses a high sensible effectiveness. Check inputs."); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Full load outlet temperature indicates a possibility of frost/freeze error continues. " "Outlet air temperature statistics follow:", - DXCoil(DXCoilNum).LowOutletTempIndex, - DXCoil(DXCoilNum).FullLoadOutAirTempLast, - DXCoil(DXCoilNum).FullLoadOutAirTempLast); + state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex, + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast, + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast); } } // save last system time step and last end time of current time step (used to determine if warning is valid) - DXCoil(DXCoilNum).TimeStepSysLast = TimeStepSys; - DXCoil(DXCoilNum).CurrentEndTimeLast = CurrentEndTime; - DXCoil(DXCoilNum).PrintLowAmbMessage = false; - DXCoil(DXCoilNum).PrintLowOutTempMessage = false; + state.dataDXCoils->DXCoil(DXCoilNum).TimeStepSysLast = TimeStepSys; + state.dataDXCoils->DXCoil(DXCoilNum).CurrentEndTimeLast = CurrentEndTime; + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowAmbMessage = false; + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage = false; - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && + if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && (CompOp == On)) { // for cycling fan, reset mass flow to full on rate - if (DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { - ShowFatalError(state, DXCoil(DXCoilNum).DXCoilType + " \"" + DXCoil(DXCoilNum).Name + "\" - Rated total cooling capacity is zero or less."); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode) <= 0.0) { + ShowFatalError(state, state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + "\" - Rated total cooling capacity is zero or less."); } - TotCap = DXCoil(DXCoilNum).RatedTotCap(Mode); + TotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); QCoilReq = -PartLoadRatio * TotCap; if (PartLoadRatio == 0.0) { - AirMassFlowMin = OACompOffMassFlow; + AirMassFlowMin = state.dataHVACVarRefFlow->OACompOffMassFlow; } else { - AirMassFlowMin = OACompOnMassFlow; + AirMassFlowMin = state.dataHVACVarRefFlow->OACompOnMassFlow; } // Call ControlVRFIUCoil to calculate: (1) FanSpdRatio, (2) coil inlet/outlet conditions, and (3) SH/SC ControlVRFIUCoil(state, DXCoilNum, QCoilReq, - DXCoil(DXCoilNum).InletAirTemp, - DXCoil(DXCoilNum).InletAirHumRat, - DXCoil(DXCoilNum).EvaporatingTemp, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).EvaporatingTemp, AirMassFlowMin, FanSpdRatio, OutletAirHumRat, @@ -16079,17 +15979,17 @@ namespace DXCoils { OutletAirEnthalpy, ActualSH, ActualSC); - AirMassFlow = FanSpdRatio * DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + AirMassFlow = FanSpdRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); AirVolumeFlowRate = AirMassFlow / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat); - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).RatedTotCap(Mode); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); // VolFlowperRatedTotCap was checked at the initialization step // No need to check VolFlowperRatedTotCap at the simulation // New VRF_FluidTCtrl model implements VAV fan which can vary air flow rate during simulation - RatedCBF = DXCoil(DXCoilNum).RatedCBF(Mode); + RatedCBF = state.dataDXCoils->DXCoil(DXCoilNum).RatedCBF(Mode); if (RatedCBF > 0.0) { - A0 = -std::log(RatedCBF) * DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + A0 = -std::log(RatedCBF) * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); } else { A0 = 0.0; } @@ -16152,46 +16052,46 @@ namespace DXCoils { //} // commented, not used issue #6950 ends here - if (DXCoil(DXCoilNum).PLFFPLR(Mode) > 0 && CompCycRatio < 1.0) { - PLF = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(Mode), CompCycRatio); // Calculate part-load factor + if (state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode) > 0 && CompCycRatio < 1.0) { + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode), CompCycRatio); // Calculate part-load factor } else { PLF = 1.0; } if (PLF < 0.7) { - if (DXCoil(DXCoilNum).ErrIndex2 == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex2 == 0) { ShowWarningMessage(state, format("The PLF curve value for the DX cooling coil {} ={:.3R} for part-load ratio ={:.3R}", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF, PartLoadRatio)); ShowContinueErrorTimeStamp(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Cooling:DX:SingleSpeed]."); } ShowRecurringWarningErrorAtEnd(state, - DXCoil(DXCoilNum).Name + ", DX cooling coil PLF curve < 0.7 warning continues...", DXCoil(DXCoilNum).ErrIndex2, PLF, PLF); + state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX cooling coil PLF curve < 0.7 warning continues...", state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex2, PLF, PLF); PLF = 0.7; } - DXCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CompCycRatio / PLF; - if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0 && std::abs(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction - 1.0) > 0.001) { - if (DXCoil(DXCoilNum).ErrIndex3 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = CompCycRatio / PLF; + if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0 && std::abs(state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction - 1.0) > 0.001) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex3 == 0) { ShowWarningMessage(state, format("The runtime fraction for DX cooling coil {} exceeded 1.0. [{:.4R}].", - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction reset to 1 and the simulation will continue."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Cooling:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", DX cooling coil runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex3, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 - } else if (DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX cooling coil runtime fraction > 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex3, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // If cycling fan, send coil part-load fraction to on/off fan via HVACDataGlobals @@ -16207,82 +16107,82 @@ namespace DXCoils { } // Store actual outlet conditions when DX coil is ON for use in heat recovery module - DXCoilFullLoadOutAirTemp(DXCoilNum) = OutletAirTemp; - DXCoilFullLoadOutAirHumRat(DXCoilNum) = OutletAirHumRat; + state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum) = OutletAirTemp; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum) = OutletAirHumRat; // Add warning message for cold cooling coil (OutletAirTemp < 2 C) if (OutletAirTemp < 2.0 && !FirstHVACIteration && !state.dataGlobal->WarmupFlag) { - DXCoil(DXCoilNum).PrintLowOutTempMessage = true; - DXCoil(DXCoilNum).FullLoadOutAirTempLast = OutletAirTemp; - if (DXCoil(DXCoilNum).LowOutletTempIndex == 0) { - DXCoil(DXCoilNum).FullLoadInletAirTempLast = InletAirDryBulbTemp; - DXCoil(DXCoilNum).LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " + state.dataDXCoils->DXCoil(DXCoilNum).PrintLowOutTempMessage = true; + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadOutAirTempLast = OutletAirTemp; + if (state.dataDXCoils->DXCoil(DXCoilNum).LowOutletTempIndex == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).FullLoadInletAirTempLast = InletAirDryBulbTemp; + state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer1 = format("{} \"{}\" - Full load outlet air dry-bulb temperature < 2C. This indicates the " "possibility of coil frost/freeze. Outlet temperature = {:.2R} C.", - DXCoil(DXCoilNum).DXCoilType, - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType, + state.dataDXCoils->DXCoil(DXCoilNum).Name, OutletAirTemp); - DXCoil(DXCoilNum).LowOutTempBuffer2 = + state.dataDXCoils->DXCoil(DXCoilNum).LowOutTempBuffer2 = " ...Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + " " + CreateSysTimeIntervalString(state); } } // Coil total cooling - Real64 AirMassFlowRate = DXCoil(DXCoilNum).InletAirMassFlowRate; + Real64 AirMassFlowRate = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; // Coil total/sensible/latent cooling rates CalcComponentSensibleLatentOutput(AirMassFlowRate, InletAirDryBulbTemp, InletAirHumRat, OutletAirTemp, OutletAirHumRat, - DXCoil(DXCoilNum).SensCoolingEnergyRate, - DXCoil(DXCoilNum).LatCoolingEnergyRate, - DXCoil(DXCoilNum).TotalCoolingEnergyRate); + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate, + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate); // Coil outlet conditions - DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; // Coil SH/SC - DXCoil(DXCoilNum).ActualSH = ActualSH; - DXCoil(DXCoilNum).ActualSC = ActualSC; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSH = ActualSH; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSC = ActualSC; } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; - DXCoil(DXCoilNum).ElecCoolingPower = 0.0; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; - DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; - DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).SensCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).LatCoolingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapCondPumpElecPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate = 0.0; - DXCoil(DXCoilNum).ActualSH = 999.0; - DXCoil(DXCoilNum).ActualSC = 999.0; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSH = 999.0; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSC = 999.0; // Reset globals when DX coil is OFF for use in heat recovery module - DXCoilFullLoadOutAirTemp(DXCoilNum) = 0.0; - DXCoilFullLoadOutAirHumRat(DXCoilNum) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirTemp(DXCoilNum) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(DXCoilNum) = 0.0; } // end of on/off // set water system demand request (if needed) - if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = - DXCoil(DXCoilNum).EvapWaterConsumpRate; + if (state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupplyMode == iWaterSupply::FromTank) { + state.dataWaterData->WaterStorage(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataDXCoils->DXCoil(DXCoilNum).EvapWaterConsumpRate; } - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoilPartLoadRatio(DXCoilNum) = DXCoil(DXCoilNum).PartLoadRatio; - DXCoilFanOpMode(DXCoilNum) = FanOpMode; - DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; - DXCoilTotalCooling(DXCoilNum) = DXCoil(DXCoilNum).TotalCoolingEnergyRate; - DXCoilCoolInletAirWBTemp(DXCoilNum) = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).PartLoadRatio; + state.dataDXCoils->DXCoilFanOpMode(DXCoilNum) = FanOpMode; + state.dataDXCoils->DXCoil(DXCoilNum).CondInletTemp = CondInletTemp; + state.dataDXCoils->DXCoilTotalCooling(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate; + state.dataDXCoils->DXCoilCoolInletAirWBTemp(DXCoilNum) = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); } void CalcVRFHeatingCoil_FluidTCtrl(EnergyPlusData &state, @@ -16309,8 +16209,6 @@ namespace DXCoils { // Using/Aliasing using CurveManager::CurveValue; - using HVACVariableRefrigerantFlow::OACompOffMassFlow; - using HVACVariableRefrigerantFlow::OACompOnMassFlow; using namespace HVACVariableRefrigerantFlow; // INTERFACE BLOCK SPECIFICATIONS @@ -16376,40 +16274,40 @@ namespace DXCoils { OutdoorHumRat = state.dataEnvrn->OutHumRat; OutdoorPressure = state.dataEnvrn->OutBaroPress; - AirMassFlow = DXCoil(DXCoilNum).InletAirMassFlowRate; - InletAirDryBulbTemp = DXCoil(DXCoilNum).InletAirTemp; - InletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - InletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; + AirMassFlow = state.dataDXCoils->DXCoil(DXCoilNum).InletAirMassFlowRate; + InletAirDryBulbTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; + InletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + InletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; InletAirWetBulbC = PsyTwbFnTdbWPb(state, InletAirDryBulbTemp, InletAirHumRat, OutdoorPressure); PLRHeating = 0.0; - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 0.0; - DXCoil(DXCoilNum).CondensingTemp = VRF(DXCoil(DXCoilNum).VRFOUPtr).IUCondensingTemp; + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).CondensingTemp = state.dataHVACVarRefFlow->VRF(state.dataDXCoils->DXCoil(DXCoilNum).VRFOUPtr).IUCondensingTemp; // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (OutdoorDryBulb < DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = DXCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (OutdoorDryBulb < state.dataDXCoils->DXCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } - if ((AirMassFlow > 0.0) && (CompOp == On) && (GetCurrentScheduleValue(state, DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && - (OutdoorDryBulb > DXCoil(DXCoilNum).MinOATCompressor)) { + if ((AirMassFlow > 0.0) && (CompOp == On) && (GetCurrentScheduleValue(state, state.dataDXCoils->DXCoil(DXCoilNum).SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && + (OutdoorDryBulb > state.dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor)) { - TotCap = DXCoil(DXCoilNum).RatedTotCap(Mode); + TotCap = state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); QCoilReq = PartLoadRatio * TotCap; if (PartLoadRatio == 0.0) { - AirMassFlowMin = OACompOffMassFlow; + AirMassFlowMin = state.dataHVACVarRefFlow->OACompOffMassFlow; } else { - AirMassFlowMin = OACompOnMassFlow; + AirMassFlowMin = state.dataHVACVarRefFlow->OACompOnMassFlow; } // Call ControlVRFIUCoil to calculate: (1) FanSpdRatio, (2) coil inlet/outlet conditions, and (3) SH/SC ControlVRFIUCoil(state, DXCoilNum, QCoilReq, - DXCoil(DXCoilNum).InletAirTemp, - DXCoil(DXCoilNum).InletAirHumRat, - DXCoil(DXCoilNum).CondensingTemp, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp, + state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat, + state.dataDXCoils->DXCoil(DXCoilNum).CondensingTemp, AirMassFlowMin, FanSpdRatio, OutletAirHumRat, @@ -16417,16 +16315,16 @@ namespace DXCoils { OutletAirEnthalpy, ActualSH, ActualSC); - AirMassFlow = FanSpdRatio * DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + AirMassFlow = FanSpdRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); AirVolumeFlowRate = AirMassFlow / PsyRhoAirFnPbTdbW(state, OutdoorPressure, InletAirDryBulbTemp, InletAirHumRat); // Eventually inlet air conditions will be used in DX Coil, these lines are commented out and marked with this comment line - VolFlowperRatedTotCap = AirVolumeFlowRate / DXCoil(DXCoilNum).RatedTotCap(Mode); + VolFlowperRatedTotCap = AirVolumeFlowRate / state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); // VolFlowperRatedTotCap was checked at the initialization step // No need to check VolFlowperRatedTotCap at the simulation // New VRF_FluidTCtrl model implements VAV fan which can vary air flow rate during simulation - AirMassFlowRatio = AirMassFlow / DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + AirMassFlowRatio = AirMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); // Calculating adjustment factors for defrost // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E @@ -16466,18 +16364,18 @@ namespace DXCoils { // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is // advised to use the bi-quaratic curve if sufficient manufacturer data is available. - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { - if (state.dataCurveManager->PerfCurve(DXCoil(DXCoilNum).EIRFTemp(Mode)).NumDims == 1) { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp(Mode), OutdoorDryBulb); + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { + if (state.dataCurveManager->PerfCurve(state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode)).NumDims == 1) { + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode), OutdoorDryBulb); } else { - EIRTempModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirDryBulbTemp, OutdoorDryBulb); + EIRTempModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(Mode), InletAirDryBulbTemp, OutdoorDryBulb); } - EIRFlowModFac = CurveValue(state, DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); + EIRFlowModFac = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(Mode), AirMassFlowRatio); } else { EIRTempModFac = 1.0; EIRFlowModFac = 1.0; } - EIR = DXCoil(DXCoilNum).RatedEIR(Mode) * EIRTempModFac * EIRFlowModFac; + EIR = state.dataDXCoils->DXCoil(DXCoilNum).RatedEIR(Mode) * EIRTempModFac * EIRFlowModFac; // Calculate PLRHeating: modified PartLoadRatio due to defrost ( reverse-cycle defrost only ) if (TotCap > 0.0) { @@ -16486,105 +16384,105 @@ namespace DXCoils { PLRHeating = min(1.0, PartLoadRatio); } - if (DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { - PLF = CurveValue(state, DXCoil(DXCoilNum).PLFFPLR(Mode), PLRHeating); // Calculate part-load factor + if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_Heating && state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num != CoilVRF_FluidTCtrl_Heating) { + PLF = CurveValue(state, state.dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(Mode), PLRHeating); // Calculate part-load factor } else { PLF = 1.0; } if (PLF < 0.7) { - if (DXCoil(DXCoilNum).PLRErrIndex == 0) { + if (state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex == 0) { ShowWarningMessage(state, format("The PLF curve value for DX heating coil {} ={:.2R} for part-load ratio ={:.2R}", - DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).Name, PLF, PLRHeating)); ShowContinueError(state, "PLF curve values must be >= 0.7. PLF has been reset to 0.7 and simulation is continuing."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); + ShowRecurringWarningErrorAtEnd(state, "DX heating coil PLF curve < 0.7 warning continues... ", state.dataDXCoils->DXCoil(DXCoilNum).PLRErrIndex, PLF, PLF); PLF = 0.7; } - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); - if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { - if (DXCoil(DXCoilNum).ErrIndex4 == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = (PLRHeating / PLF); + if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0 && std::abs(state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction - 1.0) > 0.001) { + if (state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4 == 0) { ShowWarningMessage(state, format("The runtime fraction for DX heating coil {} exceeded 1.0. [{:.4R}].", - DXCoil(DXCoilNum).Name, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).Name, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction)); ShowContinueError(state, "Runtime fraction is set to 1.0 and the simulation continues..."); ShowContinueError(state, "Check the IO reference manual for PLF curve guidance [Coil:Heating:DX:SingleSpeed]."); ShowContinueErrorTimeStamp(state, ""); } - ShowRecurringWarningErrorAtEnd(state, DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", - DXCoil(DXCoilNum).ErrIndex4, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 - } else if (DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + ShowRecurringWarningErrorAtEnd(state, state.dataDXCoils->DXCoil(DXCoilNum).Name + ", DX heating coil runtime fraction > 1.0 warning continues...", + state.dataDXCoils->DXCoil(DXCoilNum).ErrIndex4, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction > 1.0) { + state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } // if cycling fan, send coil part-load fraction to on / off fan via HVACDataGlobals if (FanOpMode == CycFanCycCoil) OnOffFanPartLoadFraction = PLF; - DXCoil(DXCoilNum).ElecHeatingPower = TotCap * EIR * DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * InputPowerMultiplier; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = TotCap * EIR * state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction * InputPowerMultiplier; // Calculate crankcase heater power using the runtime fraction for this DX heating coil only if there is no companion DX coil. // Else use the largest runtime fraction of this DX heating coil and the companion DX cooling coil. - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction); } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - max(DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction)); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - max(state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction, + state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction)); } - DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; - DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; - DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; - DXCoil(DXCoilNum).CompressorPartLoadRatio = PartLoadRatio; - DXCoil(DXCoilNum).ActualSH = ActualSH; - DXCoil(DXCoilNum).ActualSC = ActualSC; - DXCoil(DXCoilNum).TotalHeatingEnergyRate = AirMassFlow * (OutletAirEnthalpy - InletAirEnthalpy); - DXCoil(DXCoilNum).DefrostPower = DXCoil(DXCoilNum).DefrostPower * DXCoil(DXCoilNum).HeatingCoilRuntimeFraction; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = OutletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = OutletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = OutletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio = PartLoadRatio; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSH = ActualSH; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSC = ActualSC; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = AirMassFlow * (OutletAirEnthalpy - InletAirEnthalpy); + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower * state.dataDXCoils->DXCoil(DXCoilNum).HeatingCoilRuntimeFraction; } else { // DX coil is off; just pass through conditions - DXCoil(DXCoilNum).OutletAirEnthalpy = DXCoil(DXCoilNum).InletAirEnthalpy; - DXCoil(DXCoilNum).OutletAirHumRat = DXCoil(DXCoilNum).InletAirHumRat; - DXCoil(DXCoilNum).OutletAirTemp = DXCoil(DXCoilNum).InletAirTemp; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirEnthalpy = state.dataDXCoils->DXCoil(DXCoilNum).InletAirEnthalpy; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat = state.dataDXCoils->DXCoil(DXCoilNum).InletAirHumRat; + state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp = state.dataDXCoils->DXCoil(DXCoilNum).InletAirTemp; - DXCoil(DXCoilNum).ElecHeatingPower = 0.0; - DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; - DXCoil(DXCoilNum).DefrostPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).DefrostPower = 0.0; // Calculate crankcase heater power using the runtime fraction for this DX heating coil (here DXHeatingCoilRTF=0) if // there is no companion DX coil, or the runtime fraction of the companion DX cooling coil (here DXCoolingCoilRTF>=0). - if (DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { - DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; + if (state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil == 0) { + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower; } else { - DXCoil(DXCoilNum).CrankcaseHeaterPower = - CrankcaseHeatingPower * (1.0 - DXCoil(DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction); + state.dataDXCoils->DXCoil(DXCoilNum).CrankcaseHeaterPower = + CrankcaseHeatingPower * (1.0 - state.dataDXCoils->DXCoil(state.dataDXCoils->DXCoil(DXCoilNum).CompanionUpstreamDXCoil).CoolingCoilRuntimeFraction); } - DXCoil(DXCoilNum).CompressorPartLoadRatio = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio = 0.0; - DXCoil(DXCoilNum).ActualSH = 999.0; - DXCoil(DXCoilNum).ActualSC = 999.0; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSH = 999.0; + state.dataDXCoils->DXCoil(DXCoilNum).ActualSC = 999.0; } // end of on/off if - else - DXCoilOutletTemp(DXCoilNum) = DXCoil(DXCoilNum).OutletAirTemp; - DXCoilOutletHumRat(DXCoilNum) = DXCoil(DXCoilNum).OutletAirHumRat; - DXCoilFanOpMode(DXCoilNum) = FanOpMode; - DXCoilPartLoadRatio(DXCoilNum) = PLRHeating; - DXCoilTotalHeating(DXCoilNum) = DXCoil(DXCoilNum).TotalHeatingEnergyRate; - DXCoilHeatInletAirDBTemp(DXCoilNum) = InletAirDryBulbTemp; - DXCoilHeatInletAirWBTemp(DXCoilNum) = InletAirWetBulbC; + state.dataDXCoils->DXCoilOutletTemp(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirTemp; + state.dataDXCoils->DXCoilOutletHumRat(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).OutletAirHumRat; + state.dataDXCoils->DXCoilFanOpMode(DXCoilNum) = FanOpMode; + state.dataDXCoils->DXCoilPartLoadRatio(DXCoilNum) = PLRHeating; + state.dataDXCoils->DXCoilTotalHeating(DXCoilNum) = state.dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate; + state.dataDXCoils->DXCoilHeatInletAirDBTemp(DXCoilNum) = InletAirDryBulbTemp; + state.dataDXCoils->DXCoilHeatInletAirWBTemp(DXCoilNum) = InletAirWetBulbC; // calc secondary coil if specified - if (DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { + if (state.dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone) { CalcSecondaryDXCoils(state, DXCoilNum); } } @@ -16659,7 +16557,7 @@ namespace DXCoils { RHsat = 0.98; // Saturated RH MaxSH = 15; MaxSC = 20; - Garate = DXCoil(CoilIndex).RatedAirMassFlowRate(1); + Garate = state.dataDXCoils->DXCoil(CoilIndex).RatedAirMassFlowRate(1); // why always limit the minimum fan speed ratio to 0.65? FanSpdRatioMin = min(max(OAMassFlow / Garate, 0.65), 1.0); // ensure that coil flow rate is higher than OA flow rate @@ -16681,18 +16579,18 @@ namespace DXCoils { QCoilSenCoolingLoad = -QCoil; // Coefficients describing coil performance - SH = DXCoil(CoilIndex).SH; - C1Tevap = DXCoil(CoilIndex).C1Te; - C2Tevap = DXCoil(CoilIndex).C2Te; - C3Tevap = DXCoil(CoilIndex).C3Te; - BF = DXCoil(CoilIndex).RateBFVRFIUEvap; + SH = state.dataDXCoils->DXCoil(CoilIndex).SH; + C1Tevap = state.dataDXCoils->DXCoil(CoilIndex).C1Te; + C2Tevap = state.dataDXCoils->DXCoil(CoilIndex).C2Te; + C3Tevap = state.dataDXCoils->DXCoil(CoilIndex).C3Te; + BF = state.dataDXCoils->DXCoil(CoilIndex).RateBFVRFIUEvap; // Coil sensible heat transfer_minimum value - CalcVRFCoilSenCap(FlagCoolMode, CoilIndex, Tin, TeTc, SH, BF, QinSenPerFlowRate, Ts_1); + CalcVRFCoilSenCap(state, FlagCoolMode, CoilIndex, Tin, TeTc, SH, BF, QinSenPerFlowRate, Ts_1); To_1 = Tin - QinSenPerFlowRate / 1005; QinSenMin1 = FanSpdRatioMin * Garate * QinSenPerFlowRate; // Corresponds real SH - CalcVRFCoilSenCap(FlagCoolMode, CoilIndex, Tin, TeTc, MaxSH, BF, QinSenPerFlowRate, Ts_2); + CalcVRFCoilSenCap(state, FlagCoolMode, CoilIndex, Tin, TeTc, MaxSH, BF, QinSenPerFlowRate, Ts_2); To_2 = Tin - QinSenPerFlowRate / 1005; QinSenMin2 = FanSpdRatioMin * Garate * QinSenPerFlowRate; // Corresponds maximum SH @@ -16782,18 +16680,18 @@ namespace DXCoils { QCoilSenHeatingLoad = QCoil; // Coefficients describing coil performance - SC = DXCoil(CoilIndex).SC; - C1Tcond = DXCoil(CoilIndex).C1Tc; - C2Tcond = DXCoil(CoilIndex).C2Tc; - C3Tcond = DXCoil(CoilIndex).C3Tc; - BF = DXCoil(CoilIndex).RateBFVRFIUCond; + SC = state.dataDXCoils->DXCoil(CoilIndex).SC; + C1Tcond = state.dataDXCoils->DXCoil(CoilIndex).C1Tc; + C2Tcond = state.dataDXCoils->DXCoil(CoilIndex).C2Tc; + C3Tcond = state.dataDXCoils->DXCoil(CoilIndex).C3Tc; + BF = state.dataDXCoils->DXCoil(CoilIndex).RateBFVRFIUCond; // Coil sensible heat transfer_minimum value - CalcVRFCoilSenCap(FlagHeatMode, CoilIndex, Tin, TeTc, SC, BF, QinSenPerFlowRate, Ts_1); + CalcVRFCoilSenCap(state, FlagHeatMode, CoilIndex, Tin, TeTc, SC, BF, QinSenPerFlowRate, Ts_1); To_1 = QinSenPerFlowRate / 1005 + Tin; QinSenMin1 = FanSpdRatioMin * Garate * QinSenPerFlowRate; // Corresponds real SH - CalcVRFCoilSenCap(FlagHeatMode, CoilIndex, Tin, TeTc, MaxSC, BF, QinSenPerFlowRate, Ts_2); + CalcVRFCoilSenCap(state, FlagHeatMode, CoilIndex, Tin, TeTc, MaxSC, BF, QinSenPerFlowRate, Ts_2); To_2 = QinSenPerFlowRate / 1005 + Tin; QinSenMin2 = FanSpdRatioMin * Garate * QinSenPerFlowRate; // Corresponds maximum SH @@ -16857,7 +16755,8 @@ namespace DXCoils { } } - void CalcVRFCoilSenCap(int const OperationMode, // mode 0 for cooling, 1 for heating + void CalcVRFCoilSenCap(EnergyPlusData &state, + int const OperationMode, // mode 0 for cooling, 1 for heating int const CoilNum, // index to VRFTU cooling or heating coil Real64 const Tinlet, // dry bulb temperature of air entering the coil Real64 const TeTc, // evaporating or condensing temperature @@ -16896,9 +16795,9 @@ namespace DXCoils { if (OperationMode == FlagCoolMode) { // Cooling: OperationMode 0 - C1Tevap = DXCoil(CoilNum).C1Te; - C2Tevap = DXCoil(CoilNum).C2Te; - C3Tevap = DXCoil(CoilNum).C3Te; + C1Tevap = state.dataDXCoils->DXCoil(CoilNum).C1Te; + C2Tevap = state.dataDXCoils->DXCoil(CoilNum).C2Te; + C3Tevap = state.dataDXCoils->DXCoil(CoilNum).C3Te; SH = SHSC; T_coil_in = Tinlet; @@ -16915,9 +16814,9 @@ namespace DXCoils { } else if (OperationMode == FlagHeatMode) { // Heating: OperationMode 1 - C1Tcond = DXCoil(CoilNum).C1Tc; - C2Tcond = DXCoil(CoilNum).C2Tc; - C3Tcond = DXCoil(CoilNum).C3Tc; + C1Tcond = state.dataDXCoils->DXCoil(CoilNum).C1Tc; + C2Tcond = state.dataDXCoils->DXCoil(CoilNum).C2Tc; + C3Tcond = state.dataDXCoils->DXCoil(CoilNum).C3Tc; SC = SHSC; T_coil_in = Tinlet; @@ -16980,8 +16879,8 @@ namespace DXCoils { GetDXCoilIndex(state, CoilName, CoilNum, ErrorsFound, ObjexxFCL::Optional_string_const(), ObjexxFCL::Optional_bool_const()); } - BFC_rate = DXCoil(CoilNum).RateBFVRFIUEvap; - BFH_rate = DXCoil(CoilNum).RateBFVRFIUCond; + BFC_rate = state.dataDXCoils->DXCoil(CoilNum).RateBFVRFIUEvap; + BFH_rate = state.dataDXCoils->DXCoil(CoilNum).RateBFVRFIUCond; if (OperationMode == FlagCoolMode) { // Cooling: OperationMode 0 @@ -17003,10 +16902,10 @@ namespace DXCoils { } // Coil capacity at rated conditions - CalcVRFCoilSenCap(FlagCoolMode, CoilNum, 26, Te_rate, SH_rate, BFC_rate, Q_rate, Ts); + CalcVRFCoilSenCap(state, FlagCoolMode, CoilNum, 26, Te_rate, SH_rate, BFC_rate, Q_rate, Ts); // Coil capacity at given conditions - CalcVRFCoilSenCap(FlagCoolMode, CoilNum, Tinlet, TeTc_real, SHSC_real, BF_real, Q_real, Ts); + CalcVRFCoilSenCap(state, FlagCoolMode, CoilNum, Tinlet, TeTc_real, SHSC_real, BF_real, Q_real, Ts); if (Q_rate > 0) { CapModFac = Q_real / Q_rate; @@ -17034,10 +16933,10 @@ namespace DXCoils { } // Coil capacity at rated conditions - CalcVRFCoilSenCap(FlagHeatMode, CoilNum, 20, Tc_rate, SC_rate, BFH_rate, Q_rate, Ts); + CalcVRFCoilSenCap(state, FlagHeatMode, CoilNum, 20, Tc_rate, SC_rate, BFH_rate, Q_rate, Ts); // Coil capacity at given conditions - CalcVRFCoilSenCap(FlagHeatMode, CoilNum, Tinlet, TeTc_real, SHSC_real, BF_real, Q_real, Ts); + CalcVRFCoilSenCap(state, FlagHeatMode, CoilNum, Tinlet, TeTc_real, SHSC_real, BF_real, Q_real, Ts); if (Q_rate > 0) { CapModFac = Q_real / Q_rate; @@ -17126,7 +17025,7 @@ namespace DXCoils { return FanSpdResidualHeat; } - void SetMSHPDXCoilHeatRecoveryFlag(int const DXCoilNum) + void SetMSHPDXCoilHeatRecoveryFlag(EnergyPlusData &state, int const DXCoilNum) { // SUBROUTINE INFORMATION: @@ -17136,8 +17035,8 @@ namespace DXCoils { // PURPOSE OF THIS SUBROUTINE: // Set the heat recovery flag true when the parent object requests heat recovery. - if (DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - DXCoil(DXCoilNum).MSHPHeatRecActive = true; + if (state.dataDXCoils->DXCoil(DXCoilNum).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + state.dataDXCoils->DXCoil(DXCoilNum).MSHPHeatRecActive = true; } } @@ -17153,20 +17052,20 @@ namespace DXCoils { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int WhichCoil; - if (GetCoilsInputFlag) { + if (state.dataDXCoils->GetCoilsInputFlag) { GetDXCoils(state); - GetCoilsInputFlag = false; + state.dataDXCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, DXCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataDXCoils->DXCoil); if (WhichCoil != 0) { - DXCoil(WhichCoil).AirLoopNum = AirLoopNum; + state.dataDXCoils->DXCoil(WhichCoil).AirLoopNum = AirLoopNum; } else { ShowSevereError(state, "SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"" + CoilName + "\""); } } // must match coil names for the coil type - void DisableLatentDegradation(int const DXCoilNum) + void DisableLatentDegradation(EnergyPlusData &state, int const DXCoilNum) { // SUBROUTINE INFORMATION: // AUTHOR L. Gu @@ -17175,50 +17074,7 @@ namespace DXCoils { // PURPOSE OF THIS SUBROUTINE: // Disable latent degradation when direct solution is used. - DXCoil(DXCoilNum).Twet_Rated(1) = 0.0; + state.dataDXCoils->DXCoil(DXCoilNum).Twet_Rated(1) = 0.0; } - // Clears the global data in DXCoils. - // Needed for unit tests, should not be normally called. - void clear_state() - { - - CurDXCoilNum = 0; - NumDXCoils = 0; - HPWHHeatingCapacity = 0.0; - HPWHHeatingCOP = 0.0; - NumVRFHeatingCoils = 0; - NumVRFCoolingCoils = 0; - NumDXHeatingCoils = 0; - NumDoe2DXCoils = 0; - NumDXHeatPumpWaterHeaterPumpedCoils = 0; - NumDXHeatPumpWaterHeaterWrappedCoils = 0; - NumDXMulSpeedCoils = 0; - NumDXMulModeCoils = 0; - NumDXMulSpeedCoolCoils = 0; - NumDXMulSpeedHeatCoils = 0; - - GetCoilsInputFlag = true; - MyOneTimeFlag = true; - CrankcaseHeaterReportVarFlag = true; - - DXCoil.deallocate(); - DXCoilNumericFields.deallocate(); - DXCoilOutletTemp.deallocate(); - DXCoilOutletHumRat.deallocate(); - DXCoilPartLoadRatio.deallocate(); - DXCoilFanOpMode.deallocate(); - DXCoilFullLoadOutAirTemp.deallocate(); - DXCoilFullLoadOutAirHumRat.deallocate(); - DXCoilTotalCooling.deallocate(); - DXCoilTotalHeating.deallocate(); - DXCoilCoolInletAirWBTemp.deallocate(); - DXCoilHeatInletAirDBTemp.deallocate(); - DXCoilHeatInletAirWBTemp.deallocate(); - CheckEquipName.deallocate(); - CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite = true; - } - -} // namespace DXCoils - } // namespace EnergyPlus diff --git a/src/EnergyPlus/DXCoils.hh b/src/EnergyPlus/DXCoils.hh index 5c0f55dff29..b2c1403388e 100644 --- a/src/EnergyPlus/DXCoils.hh +++ b/src/EnergyPlus/DXCoils.hh @@ -70,89 +70,43 @@ namespace DXCoils { using DataHVACGlobals::AirCooled; using DataHVACGlobals::DryBulbIndicator; - // Data - // MODULE PARAMETER DEFINITIONS // Defrost strategy (heat pump only) - extern int const ReverseCycle; // uses reverse cycle defrost strategy - extern int const Resistive; // uses electric resistance heater for defrost - // Defrost control (heat pump only) - extern int const Timed; // defrost cycle is timed - extern int const OnDemand; // defrost cycle occurs only when required - // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run + constexpr int ReverseCycle(1); // uses reverse cycle defrost strategy + constexpr int Resistive(2); // uses electric resistance heater for defrost - extern Real64 const RatedInletAirTemp; // 26.6667C or 80F - extern Real64 const RatedInletWetBulbTemp; // 19.44 or 67F - extern Real64 const RatedInletAirHumRat; // Humidity ratio corresponding to 80F dry bulb/67F wet bulb - extern Real64 const RatedOutdoorAirTemp; // 35 C or 95F - extern Real64 const RatedInletAirTempHeat; // 21.11C or 70F - extern Real64 const RatedOutdoorAirTempHeat; // 8.33 C or 47F - extern Real64 const RatedOutdoorWetBulbTempHeat; // 6.11 C or 43F - extern Real64 const RatedInletWetBulbTempHeat; // 15.55 or 60F + // Defrost control (heat pump only) + constexpr int Timed(1); // defrost cycle is timed + constexpr int OnDemand(2); // defrost cycle occurs only when required - extern Real64 const DryCoilOutletHumRatioMin; // dry coil outlet minimum hum ratio kgWater/kgDryAir + // Compressor operation + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run + + constexpr Real64 RatedInletAirTemp(26.6667); // 26.6667C or 80F + constexpr Real64 RatedInletWetBulbTemp(19.4444); // 19.44 or 67F + constexpr Real64 RatedInletAirHumRat(0.0111847); // Humidity ratio corresponding to 80F dry bulb/67F wet bulb + constexpr Real64 RatedOutdoorAirTemp(35.0); // 35 C or 95F + constexpr Real64 RatedInletAirTempHeat(21.1111); // 21.11C or 70F + constexpr Real64 RatedOutdoorAirTempHeat(8.3333); // 8.33 C or 47F + constexpr Real64 RatedOutdoorWetBulbTempHeat(6.1111); // 6.11 C or 43F + constexpr Real64 RatedInletWetBulbTempHeat(15.5556); // 15.55 or 60F + constexpr Real64 DryCoilOutletHumRatioMin(0.00001); // dry coil outlet minimum hum ratio kgWater/kgDryAir // Multimode DX Coil - extern int const MaxCapacityStages; // Maximum number of capacity stages supported - extern int const MaxDehumidModes; // Maximum number of enhanced dehumidification modes supported - extern int const MaxModes; // Maximum number of performance modes + constexpr int MaxCapacityStages(2); // Maximum number of capacity stages supported + constexpr int MaxDehumidModes(1); // Maximum number of enhanced dehumidification modes supported + constexpr int MaxModes(MaxCapacityStages *(MaxDehumidModes + 1)); // Maximum number of performance modes // Water Systems - extern int const CondensateDiscarded; // default mode where water is "lost" - extern int const CondensateToTank; // collect coil condensate from air and store in water storage tank - - extern int const WaterSupplyFromMains; - extern int const WaterSupplyFromTank; - - // DERIVED TYPE DEFINITIONS - - // MODULE VARIABLE DECLARATIONS: - extern Array1D DXCoilOutletTemp; // DX coil outlet dry bulb temperature [C] - extern Array1D DXCoilOutletHumRat; // DX coil outlet humidity ratio [kgWater/kgDryAir] - extern Array1D DXCoilPartLoadRatio; // DX coil part-load ratio - extern Array1D_int DXCoilFanOpMode; // supply air fan operating mode - extern Array1D DXCoilFullLoadOutAirTemp; // DX coil full load outlet dry bulb temperature [C] - extern Array1D DXCoilFullLoadOutAirHumRat; // DX coil full load outlet humidity ratio [kgWater/kgDryAir] - extern Array1D DXCoilTotalCooling; // DX cooling coil total cooling output [W] - extern Array1D DXCoilTotalHeating; // DX heating coil total heating output [W] - extern Array1D DXCoilCoolInletAirWBTemp; // DX cooling coil inlet air wet-bulb temp [C] - extern Array1D DXCoilHeatInletAirDBTemp; // DX heating coil inlet air dry-bulb temp [C] - extern Array1D DXCoilHeatInletAirWBTemp; // DX heating coil inlet air wet-bulb temp [C] - - extern int CurDXCoilNum; - - extern int NumDXCoils; // Total number of DX coils - extern Real64 HPWHHeatingCapacity; // Used by Heat Pump:Water Heater object as total water heating capacity [W] - extern Real64 HPWHHeatingCOP; // Used by Heat Pump:Water Heater object as water heating COP [W/W] - extern bool GetCoilsInputFlag; // First time, input is "gotten" - extern bool MyOneTimeFlag; // One time flag used to allocate MyEnvrnFlag and MySizeFlag - extern int NumVRFHeatingCoils; // number of VRF heat pump heating coils - extern int NumVRFCoolingCoils; // number of VRF heat pump cooling coils - extern int NumDXHeatingCoils; // number of DX heat pump heating coils - extern int NumDoe2DXCoils; // number of doe2 DX coils - extern int NumDXHeatPumpWaterHeaterPumpedCoils; // number of DX water heater coils, pumped - extern int NumDXHeatPumpWaterHeaterWrappedCoils; // number of wrapped tank HPWH coils - extern int NumDXMulSpeedCoils; // number of DX coils with multi-speed compressor - extern int NumDXMulModeCoils; // number of DX coils with multi-mode performance - - extern int NumDXMulSpeedCoolCoils; // number of multispeed DX cooling coils - extern int NumDXMulSpeedHeatCoils; // number of multispeed DX heating coils - extern Array1D_bool CheckEquipName; - - // SUBROUTINE SPECIFICATIONS FOR MODULE - - // Driver/Manager Routines - - // Get Input routines for module - - // Initialization routines for module - - // Update routines to check convergence and update nodes - - // Common routines + enum class iCondensate { + Discarded, // default mode where water is "lost" + ToTank, // collect coil condensate from air and store in water storage tank + }; - // External function calls + enum class iWaterSupply { + FromMains, + FromTank, + }; // Types @@ -380,11 +334,11 @@ namespace DXCoils { std::string HighAmbBuffer1; // holds warning message until next iteration (only prints 1 message/iteration) std::string HighAmbBuffer2; // holds warning message until next iteration (only prints 1 message/iteration) // begin variables for Water System interactions - int EvapWaterSupplyMode; // where does water come from + iWaterSupply EvapWaterSupplyMode; // where does water come from std::string EvapWaterSupplyName; // name of water source e.g. water storage tank int EvapWaterSupTankID; int EvapWaterTankDemandARRID; - int CondensateCollectMode; // where does water come from + iCondensate CondensateCollectMode; // where does water come from std::string CondensateCollectName; // name of water source e.g. water storage tank int CondensateTankID; int CondensateTankSupplyARRID; @@ -534,8 +488,8 @@ namespace DXCoils { RatedHPWHCondWaterFlow(0.0), ElecWaterHeatingPower(0.0), ElecWaterHeatingConsumption(0.0), FanPowerIncludedInCOP(true), CondPumpHeatInCapacity(false), CondPumpPowerInCOP(false), LowTempLast(0.0), HighTempLast(0.0), ErrIndex1(0), ErrIndex2(0), ErrIndex3(0), ErrIndex4(0), LowAmbErrIndex(0), HighAmbErrIndex(0), PLFErrIndex(0), PLRErrIndex(0), PrintLowAmbMessage(false), - PrintHighAmbMessage(false), EvapWaterSupplyMode(WaterSupplyFromMains), EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), - CondensateCollectMode(CondensateDiscarded), CondensateTankID(0), CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), + PrintHighAmbMessage(false), EvapWaterSupplyMode(iWaterSupply::FromMains), EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), + CondensateCollectMode(iCondensate::Discarded), CondensateTankID(0), CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), CurrentEndTimeLast(0.0), TimeStepSysLast(0.0), FuelTypeNum(DataGlobalConstants::ResourceType::None), NumOfSpeeds(0), PLRImpact(false), LatentImpact(false), MSFuelWasteHeat(0.0), MSHPHeatRecActive(false), MSHPDesignSpecIndex(0), CoolingCoilPresent(true), HeatingCoilPresent(true), ISHundredPercentDOASDXCoil(false), @@ -579,10 +533,6 @@ namespace DXCoils { } }; - // Object Data - extern Array1D DXCoil; - extern Array1D DXCoilNumericFields; - // Functions void SimDXCoil(EnergyPlusData &state, std::string const &CompName, // name of the fan coil unit @@ -696,7 +646,8 @@ namespace DXCoils { std::string const &CallingRoutine // function name calling this routine ); - Real64 CalcEffectiveSHR(int const DXCoilNum, // Index number for cooling coil + Real64 CalcEffectiveSHR(EnergyPlusData &state, + int const DXCoilNum, // Index number for cooling coil Real64 const SHRss, // Steady-state sensible heat ratio Real64 const RTF, // Compressor run-time fraction Real64 const QLatRated, // Rated latent capacity @@ -957,7 +908,8 @@ namespace DXCoils { Real64 &SCact // actual SC ); - void CalcVRFCoilSenCap(int const OperationMode, // mode 0 for cooling, 1 for heating + void CalcVRFCoilSenCap(EnergyPlusData &state, + int const OperationMode, // mode 0 for cooling, 1 for heating int const CoilNum, // index to VRFTU cooling or heating coil Real64 const Tinlet, // dry bulb temperature of air entering the coil Real64 const TeTc, // evaporating or condensing temperature @@ -988,23 +940,85 @@ namespace DXCoils { // End of Methods for New VRF Model: Fluid Temperature Control // ***************************************************************************** - void SetMSHPDXCoilHeatRecoveryFlag(int const DXCoilNum); // must match coil names for the coil type + void SetMSHPDXCoilHeatRecoveryFlag(EnergyPlusData &state, int const DXCoilNum); // must match coil names for the coil type void SetDXCoilAirLoopNumber(EnergyPlusData &state, std::string const &CoilName, int const AirLoopNum); // must match coil names for the coil type - void DisableLatentDegradation(int const DXCoilNum); - - // Clears the global data in DXCoils. - // Needed for unit tests, should not be normally called. - void clear_state(); + void DisableLatentDegradation(EnergyPlusData &state, int const DXCoilNum); } // namespace DXCoils struct DXCoilsData : BaseGlobalStruct { + bool GetCoilsInputFlag = true; // First time, input is "gotten" + bool MyOneTimeFlag = true; // One time flag used to allocate MyEnvrnFlag and MySizeFlag + bool CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite = true; + bool CrankcaseHeaterReportVarFlag = true; + int NumVRFHeatingCoils = 0; // number of VRF heat pump heating coils + int NumVRFCoolingCoils = 0; // number of VRF heat pump cooling coils + int NumDXCoils = 0; // Total number of DX coils + int NumVRFHeatingFluidTCtrlCoils = 0; // number of VRF heat pump heating coils for FluidTCtrl Model + int NumVRFCoolingFluidTCtrlCoils = 0; // number of VRF heat pump cooling coils for FluidTCtrl Model + int NumDXHeatingCoils = 0; // number of DX heat pump heating coils + int NumDoe2DXCoils = 0; // number of doe2 DX coils + int NumDXHeatPumpWaterHeaterPumpedCoils = 0; // number of DX water heater coils, pumped + int NumDXHeatPumpWaterHeaterWrappedCoils = 0; // number of DX water heater coils, pumped + int NumDXMulSpeedCoils = 0; // number of DX coils with multi-speed compressor + int NumDXMulModeCoils = 0; // number of DX coils with multi-mode performance + int NumDXMulSpeedCoolCoils = 0; // number of multispeed DX cooling coils + int NumDXMulSpeedHeatCoils = 0; // number of multispeed DX heating coils + Real64 HPWHHeatingCapacity = 0.0; // Used by Heat Pump:Water Heater object as total water heating capacity [W] + Real64 HPWHHeatingCOP = 0.0; // Used by Heat Pump:Water Heater object as water heating COP [W/W] + Array1D_bool CheckEquipName; + Array1D DXCoilOutletTemp; // DX coil outlet dry bulb temperature [C] + Array1D DXCoilOutletHumRat; // DX coil outlet humidity ratio [kgWater/kgDryAir] + Array1D DXCoilPartLoadRatio; // DX coil part-load ratio + Array1D_int DXCoilFanOpMode; // supply air fan operating mode + Array1D DXCoilFullLoadOutAirTemp; // DX coil full load outlet dry bulb temperature [C] + Array1D DXCoilFullLoadOutAirHumRat; // DX coil full load outlet humidity ratio [kgWater/kgDryAir] + Array1D DXCoilTotalCooling; // DX cooling coil total cooling output [W] + Array1D DXCoilTotalHeating; // DX heating coil total heating output [W] + Array1D DXCoilCoolInletAirWBTemp; // DX cooling coil inlet air wet-bulb temp [C] + Array1D DXCoilHeatInletAirDBTemp; // DX heating coil inlet air dry-bulb temp [C] + Array1D DXCoilHeatInletAirWBTemp; // DX heating coil inlet air wet-bulb temp [C] + Array1D DXCoil; + Array1D DXCoilNumericFields; + void clear_state() override { - + this->GetCoilsInputFlag = true; + this->MyOneTimeFlag = true; + this->CalcTwoSpeedDXCoilStandardRatingOneTimeEIOHeaderWrite = true; + this->CrankcaseHeaterReportVarFlag = true; + this->NumVRFHeatingCoils = 0; + this->NumVRFCoolingCoils = 0; + this->NumDXCoils = 0; + this->NumVRFHeatingFluidTCtrlCoils = 0; + this->NumVRFCoolingFluidTCtrlCoils = 0; + this->NumDXHeatingCoils = 0; + this->NumDoe2DXCoils = 0; + this->NumDXHeatPumpWaterHeaterPumpedCoils = 0; + this->NumDXHeatPumpWaterHeaterWrappedCoils = 0; + this->NumDXMulSpeedCoils = 0; + this->NumDXMulModeCoils = 0; + this->NumDXMulSpeedCoolCoils = 0; + this->NumDXMulSpeedHeatCoils = 0; + this->HPWHHeatingCapacity = 0.0; + this->HPWHHeatingCOP = 0.0; + this->CheckEquipName.deallocate(); + this->DXCoilOutletTemp.deallocate(); + this->DXCoilOutletHumRat.deallocate(); + this->DXCoilPartLoadRatio.deallocate(); + this->DXCoilFanOpMode.deallocate(); + this->DXCoilFullLoadOutAirTemp.deallocate(); + this->DXCoilFullLoadOutAirHumRat.deallocate(); + this->DXCoilTotalCooling.deallocate(); + this->DXCoilTotalHeating.deallocate(); + this->DXCoilCoolInletAirWBTemp.deallocate(); + this->DXCoilHeatInletAirDBTemp.deallocate(); + this->DXCoilHeatInletAirWBTemp.deallocate(); + this->DXCoil.deallocate(); + this->DXCoilNumericFields.deallocate(); } }; diff --git a/src/EnergyPlus/DataHVACGlobals.cc b/src/EnergyPlus/DataHVACGlobals.cc index 2ebd7570c2d..8b8431164c6 100644 --- a/src/EnergyPlus/DataHVACGlobals.cc +++ b/src/EnergyPlus/DataHVACGlobals.cc @@ -120,15 +120,15 @@ namespace DataHVACGlobals { int const Other(4); int const RAB(5); // parameters describing fan types - int const NumAllFanTypes(6); // cpw22Aug2010 (was 4) + int const NumAllFanTypes(6); // fan types int const FanType_SimpleConstVolume(1); int const FanType_SimpleVAV(2); int const FanType_SimpleOnOff(3); int const FanType_ZoneExhaust(4); - int const FanType_ComponentModel(5); // cpw22Aug2010 - int const FanType_SystemModelObject(6); // new for V8.7, simple versatile fan object + int const FanType_ComponentModel(5); + int const FanType_SystemModelObject(6); // Fan Minimum Flow Fraction Input Method int const MinFrac(1); diff --git a/src/EnergyPlus/DataHVACGlobals.hh b/src/EnergyPlus/DataHVACGlobals.hh index 94c1c2f190b..f91e70d2778 100644 --- a/src/EnergyPlus/DataHVACGlobals.hh +++ b/src/EnergyPlus/DataHVACGlobals.hh @@ -123,15 +123,15 @@ namespace DataHVACGlobals { extern int const Other; extern int const RAB; // parameters describing fan types - extern int const NumAllFanTypes; // cpw22Aug2010 (was 4) + extern int const NumAllFanTypes; // fan types extern int const FanType_SimpleConstVolume; extern int const FanType_SimpleVAV; extern int const FanType_SimpleOnOff; extern int const FanType_ZoneExhaust; - extern int const FanType_ComponentModel; // cpw22Aug2010 (new) - extern int const FanType_SystemModelObject; // + extern int const FanType_ComponentModel; + extern int const FanType_SystemModelObject; // Fan Minimum Flow Fraction Input Method extern int const MinFrac; @@ -146,7 +146,7 @@ namespace DataHVACGlobals { extern int const BypassWhenWithinEconomizerLimits; // heat recovery controlled by economizer limits extern int const BypassWhenOAFlowGreaterThanMinimum; // heat recovery ON at minimum OA in economizer mode - extern Array1D_string const cFanTypes; // cpw22Aug2010 | cpw22Aug2010 (new) + extern Array1D_string const cFanTypes; // parameters describing unitary systems extern int const NumUnitarySystemTypes; diff --git a/src/EnergyPlus/DesiccantDehumidifiers.cc b/src/EnergyPlus/DesiccantDehumidifiers.cc index a38bf9bebf9..7eae796dd10 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.cc +++ b/src/EnergyPlus/DesiccantDehumidifiers.cc @@ -2586,8 +2586,6 @@ namespace DesiccantDehumidifiers { // Using/Aliasing using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyRhoAirFnPbTdbW; - using DXCoils::DXCoilFanOpMode; - using DXCoils::DXCoilPartLoadRatio; using HeatRecovery::SimHeatRecovery; // Locals @@ -2657,7 +2655,7 @@ namespace DesiccantDehumidifiers { if (DesicDehum(DesicDehumNum).CoilUpstreamOfProcessSide == Yes) { if ((DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingSingleSpeed) || (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl)) { - if (DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex) == 0.0) { + if (state.dataDXCoils->DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex) == 0.0) { UnitOn = false; } } @@ -2703,7 +2701,7 @@ namespace DesiccantDehumidifiers { if (CompanionCoilIndexNum > 0) { if ((DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingSingleSpeed) || (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl)) { - DDPartLoadRatio = DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex); + DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex); } else if (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down } @@ -2713,7 +2711,7 @@ namespace DesiccantDehumidifiers { if (CompanionCoilIndexNum > 0) { if ((DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingSingleSpeed) || (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl)) { - if (DXCoilFanOpMode(DesicDehum(DesicDehumNum).DXCoilIndex) == ContFanCycCoil) { + if (state.dataDXCoils->DXCoilFanOpMode(DesicDehum(DesicDehumNum).DXCoilIndex) == ContFanCycCoil) { NewRegenInTemp = Node(DesicDehum(DesicDehumNum).CondenserInletNode).Temp + CondenserWasteHeat / (CpAir * (Node(DesicDehum(DesicDehumNum).RegenAirInNode).MassFlowRate) * DDPartLoadRatio); @@ -2898,7 +2896,7 @@ namespace DesiccantDehumidifiers { } else { if ((DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingSingleSpeed) || (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl)) { - DDPartLoadRatio = DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex); + DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex); } else if (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down } @@ -2980,7 +2978,7 @@ namespace DesiccantDehumidifiers { DesicDehum(DesicDehumNum).ExhaustFanPower += max(0.0, (DesicDehum(DesicDehumNum).ExhaustFanMaxPower * - (DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex) - DDPartLoadRatio))); + (state.dataDXCoils->DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex) - DDPartLoadRatio))); } else if (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { DesicDehum(DesicDehumNum).ExhaustFanPower += max(0.0, (DesicDehum(DesicDehumNum).ExhaustFanMaxPower * (1.0 - DDPartLoadRatio))); } @@ -3032,7 +3030,7 @@ namespace DesiccantDehumidifiers { if (DesicDehum(DesicDehumNum).DXCoilIndex > 0) { if ((DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingSingleSpeed) || (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl)) { - DDPartLoadRatio = DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex); + DDPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(DesicDehum(DesicDehumNum).DXCoilIndex); } else if (DesicDehum(DesicDehumNum).coolingCoil_TypeNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { DDPartLoadRatio = 1.0; // condenser waste heat already includes modulation down } diff --git a/src/EnergyPlus/EconomicLifeCycleCost.cc b/src/EnergyPlus/EconomicLifeCycleCost.cc index 88e855957ab..aeb97ae70b7 100644 --- a/src/EnergyPlus/EconomicLifeCycleCost.cc +++ b/src/EnergyPlus/EconomicLifeCycleCost.cc @@ -66,9 +66,7 @@ #include #include -namespace EnergyPlus { - -namespace EconomicLifeCycleCost { +namespace EnergyPlus::EconomicLifeCycleCost { // Module containing the routines dealing with the EconomicLifeCycleCost @@ -83,7 +81,7 @@ namespace EconomicLifeCycleCost { // on input provided by the user as well as calculated energy costs. // METHODOLOGY EMPLOYED: - // Uses NIST Handbook 135 "Life-Cycle Costing Manual for the Federaml + // Uses NIST Handbook 135 "Life-Cycle Costing Manual for the Federal // Energy Management Program" for most computations. // REFERENCES: @@ -104,151 +102,6 @@ namespace EconomicLifeCycleCost { using namespace DataGlobalConstants; using namespace DataIPShortCuts; - // Data - // MODULE PARAMETER DEFINITIONS: - int const disConvBeginOfYear(1); - int const disConvMidYear(2); - int const disConvEndOfYear(3); - - int const inflAppConstantDollar(1); - int const inflAppCurrentDollar(2); - - // ModifiedAcceleratedCostRecoverySystem or Straight Line - int const depMethMACRS3(1); - int const depMethMACRS5(2); - int const depMethMACRS7(3); - int const depMethMACRS10(4); - int const depMethMACRS15(5); - int const depMethMACRS20(6); - int const depMethStraight27(7); - int const depMethStraight31(8); - int const depMethStraight39(9); - int const depMethStraight40(10); - int const depMethNone(11); - - int const costCatMaintenance(1); - int const costCatRepair(2); - int const costCatOperation(3); - int const costCatReplacement(4); - int const costCatMinorOverhaul(5); - int const costCatMajorOverhaul(6); - int const costCatOtherOperational(7); - int const costCatConstruction(8); - int const costCatSalvage(9); - int const costCatOtherCapital(10); - int const costCatWater(11); - int const costCatEnergy(12); - int const costCatTotEnergy(13); - int const costCatTotOper(14); - int const costCatTotCaptl(15); - int const costCatTotGrand(16); - - int const countOfCostCat(16); // count of the number of cost categories - - // The NIST supplement includes UPV* factors for - // Electricity - // Natural gas - // Distillate oil - FuelOilNo1 - // Liquified petroleum gas - Propane - // Residual oil - FuelOilNo2 - // Coal - - int const startServicePeriod(1); - int const startBasePeriod(2); - - // DERIVED TYPE DEFINITIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - - // related to LifeCycleCost:Parameters - bool LCCparamPresent(false); // If a LifeCycleCost:Parameters object is present - std::string LCCname; // Name - int discountConvension(disConvEndOfYear); // Discounting Convention - int inflationApproach(inflAppConstantDollar); // Inflation Approach - Real64 realDiscountRate(0.0); // Real Discount Rate - Real64 nominalDiscountRate(0.0); // Nominal Discount Rate - Real64 inflation(0.0); // Inflation - int baseDateMonth(0); // Base Date Month (1=Jan, 12=Dec) - int baseDateYear(0); // Base Date Year 1900-2100 - int serviceDateMonth(0); // Service Date Month (1=Jan, 12=Dec) - int serviceDateYear(0); // Service Date Year 1900-2100 - int lengthStudyYears(0); // Length of Study Period in Years - int lengthStudyTotalMonths(0); // Length of Study expressed in months (years x 12) - Real64 taxRate(0.0); // Tax rate - int depreciationMethod(depMethNone); // Depreciation Method - // derived - int lastDateMonth(0); // Last Date Month (the month before the base date month) - int lastDateYear(0); // Last Date Year (base date year + length of study period in years) - - int numRecurringCosts(0); - - int numNonrecurringCost(0); - - int numUsePriceEscalation(0); - - int numUseAdjustment(0); - - int numCashFlow; - int const skRecurring(1); - int const skNonrecurring(2); - int const skResource(3); - int const skSum(4); - int const pvkEnergy(1); - int const pvkNonEnergy(2); - int const pvkNotComputed(3); - int numResourcesUsed; - - // present value factors - Array1D SPV; - std::map> energySPV; // yearly equivalent to FEMP UPV* values - - // arrays related to computing after tax cashflow and present value - Array1D DepreciatedCapital; - Array1D TaxableIncome; - Array1D Taxes; - Array1D AfterTaxCashFlow; - Array1D AfterTaxPresentValue; - - Array1D_string const - MonthNames(12, {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}); - - // arrays related to escalated energy costs - Array1D EscalatedTotEnergy; - std::map> EscalatedEnergy; - - // SUBROUTINE SPECIFICATIONS FOR MODULE : - - // Object Data - Array1D RecurringCosts; - Array1D NonrecurringCost; - Array1D UsePriceEscalation; - Array1D UseAdjustment; - Array1D CashFlow; - - namespace { - // These were static variables within different functions. They were pulled out into the namespace - // to facilitate easier unit testing of those functions. - // These are purposefully not in the header file as an extern variable. No one outside of this should - // use these. They are cleared by clear_state() for use by unit tests, but normal simulations should be unaffected. - // This is purposefully in an anonymous namespace so nothing outside this implementation file can use it. - bool GetInput_GetLifeCycleCostInput(true); - - // from former statics in GetInputLifeCycleCostUsePriceEscalation() - int UsePriceEscalation_escStartYear(0); - int UsePriceEscalation_escNumYears(0); - int UsePriceEscalation_escEndYear(0); - int UsePriceEscalation_earlierEndYear(0); - int UsePriceEscalation_laterStartYear(0); - int UsePriceEscalation_curEsc(0); - int UsePriceEscalation_curFld(0); - - // from former statics in ExpressAsCashFlows - int ExpressAsCashFlows_baseMonths1900(0); // number of months since 1900 for base period - int ExpressAsCashFlows_serviceMonths1900(0); // number of months since 1900 for service period - - } // namespace - // Functions void GetInputForLifeCycleCost(EnergyPlusData &state) @@ -262,36 +115,18 @@ namespace EconomicLifeCycleCost { // PURPOSE OF THIS SUBROUTINE: // Read the input file for "LifeCycleCost:Parameters" object. - // METHODOLOGY EMPLOYED: - - // REFERENCES: - // na - // Using/Aliasing using OutputReportTabular::AddTOCEntry; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + auto &elcc(state.dataEconLifeCycleCost); - if (GetInput_GetLifeCycleCostInput) { + if (elcc->GetInput_GetLifeCycleCostInput) { GetInputLifeCycleCostParameters(state); GetInputLifeCycleCostRecurringCosts(state); GetInputLifeCycleCostNonrecurringCost(state); GetInputLifeCycleCostUsePriceEscalation(state); GetInputLifeCycleCostUseAdjustment(state); - GetInput_GetLifeCycleCostInput = false; + elcc->GetInput_GetLifeCycleCostInput = false; } } @@ -306,34 +141,12 @@ namespace EconomicLifeCycleCost { // PURPOSE OF THIS SUBROUTINE: // Perform the life cycle cost computations and write report. - // METHODOLOGY EMPLOYED: - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - - if (LCCparamPresent) { + if (state.dataEconLifeCycleCost->LCCparamPresent) { DisplayString(state, "Computing Life Cycle Costs and Reporting"); ExpressAsCashFlows(state); - ComputePresentValue(); - ComputeEscalatedEnergyCosts(); - ComputeTaxAndDepreciation(); + ComputePresentValue(state); + ComputeEscalatedEnergyCosts(state); + ComputeTaxAndDepreciation(state); WriteTabularLifeCycleCostReport(state); } } @@ -373,10 +186,12 @@ namespace EconomicLifeCycleCost { AlphaArray.allocate(NumAlphas); NumObj = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + auto &elcc(state.dataEconLifeCycleCost); + if (NumObj == 0) { - LCCparamPresent = false; + elcc->LCCparamPresent = false; } else if (NumObj == 1) { - LCCparamPresent = true; + elcc->LCCparamPresent = true; inputProcessor->getObjectItem(state, CurrentModuleObject, 1, @@ -400,7 +215,7 @@ namespace EconomicLifeCycleCost { // A1, \field Name // \required-field // \type alpha - LCCname = AlphaArray(1); + elcc->LCCname = AlphaArray(1); // A2, \field Discounting Convention // \type choice // \key EndOfYear @@ -408,13 +223,13 @@ namespace EconomicLifeCycleCost { // \key BeginningOfYear // \default EndOfYear if (UtilityRoutines::SameString(AlphaArray(2), "EndOfYear")) { - discountConvension = disConvEndOfYear; + elcc->discountConvention = iDiscConv::EndOfYear; } else if (UtilityRoutines::SameString(AlphaArray(2), "MidYear")) { - discountConvension = disConvMidYear; + elcc->discountConvention = iDiscConv::MidYear; } else if (UtilityRoutines::SameString(AlphaArray(2), "BeginningOfYear")) { - discountConvension = disConvBeginOfYear; + elcc->discountConvention = iDiscConv::BeginOfYear; } else { - discountConvension = disConvEndOfYear; + elcc->discountConvention = iDiscConv::EndOfYear; ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(2) + "=\"" + AlphaArray(2) + "\". EndOfYear will be used."); } // A3, \field Inflation Approach @@ -423,44 +238,44 @@ namespace EconomicLifeCycleCost { // \key CurrentDollar // \default ConstantDollar if (UtilityRoutines::SameString(AlphaArray(3), "ConstantDollar")) { - inflationApproach = inflAppConstantDollar; + elcc->inflationApproach = iInflAppr::ConstantDollar; } else if (UtilityRoutines::SameString(AlphaArray(3), "CurrentDollar")) { - inflationApproach = inflAppCurrentDollar; + elcc->inflationApproach = iInflAppr::CurrentDollar; } else { - inflationApproach = inflAppConstantDollar; + elcc->inflationApproach = iInflAppr::ConstantDollar; ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(3) + "=\"" + AlphaArray(3) + "\". ConstantDollar will be used."); } // N1, \field Real Discount Rate // \type real - realDiscountRate = NumArray(1); - if ((inflationApproach == inflAppConstantDollar) && lNumericFieldBlanks(1)) { + elcc->realDiscountRate = NumArray(1); + if ((elcc->inflationApproach == iInflAppr::ConstantDollar) && lNumericFieldBlanks(1)) { ShowWarningError(state, CurrentModuleObject + ": Invalid for field " + cNumericFieldNames(1) + " to be blank when ConstantDollar analysis is be used."); } - if ((realDiscountRate > 0.30) || (realDiscountRate < -0.30)) { + if ((elcc->realDiscountRate > 0.30) || (elcc->realDiscountRate < -0.30)) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(1) + ". This value is the decimal value not a percentage so most values are between 0.02 and 0.15. "); } // N2, \field Nominal Discount Rate // \type real - nominalDiscountRate = NumArray(2); - if ((inflationApproach == inflAppCurrentDollar) && lNumericFieldBlanks(2)) { + elcc->nominalDiscountRate = NumArray(2); + if ((elcc->inflationApproach == iInflAppr::CurrentDollar) && lNumericFieldBlanks(2)) { ShowWarningError(state, CurrentModuleObject + ": Invalid for field " + cNumericFieldNames(2) + " to be blank when CurrentDollar analysis is be used."); } - if ((nominalDiscountRate > 0.30) || (nominalDiscountRate < -0.30)) { + if ((elcc->nominalDiscountRate > 0.30) || (elcc->nominalDiscountRate < -0.30)) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(2) + ". This value is the decimal value not a percentage so most values are between 0.02 and 0.15. "); } // N3, \field Inflation // \type real - inflation = NumArray(3); - if ((inflationApproach == inflAppConstantDollar) && (!lNumericFieldBlanks(3))) { + elcc->inflation = NumArray(3); + if ((elcc->inflationApproach == iInflAppr::ConstantDollar) && (!lNumericFieldBlanks(3))) { ShowWarningError(state, CurrentModuleObject + ": Invalid for field " + cNumericFieldNames(3) + " contain a value when ConstantDollar analysis is be used."); } - if ((inflation > 0.30) || (inflation < -0.30)) { + if ((elcc->inflation > 0.30) || (elcc->inflation < -0.30)) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(3) + ". This value is the decimal value not a percentage so most values are between 0.02 and 0.15. "); } @@ -479,17 +294,17 @@ namespace EconomicLifeCycleCost { // \key November // \key December // \default January - baseDateMonth = MonthToMonthNumber(AlphaArray(4), 1); + elcc->baseDateMonth = MonthToMonthNumber(AlphaArray(4), 1); // N4, \field Base Date Year // \type integer // \minimum 1900 // \maximum 2100 - baseDateYear = int(NumArray(4)); - if (baseDateYear > 2100) { + elcc->baseDateYear = int(NumArray(4)); + if (elcc->baseDateYear > 2100) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(4) + ". Value greater than 2100 yet it is representing a year. "); } - if (baseDateYear < 1900) { + if (elcc->baseDateYear < 1900) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(4) + ". Value less than 1900 yet it is representing a year. "); } @@ -508,17 +323,17 @@ namespace EconomicLifeCycleCost { // \key November // \key December // \default January - serviceDateMonth = MonthToMonthNumber(AlphaArray(5), 1); + elcc->serviceDateMonth = MonthToMonthNumber(AlphaArray(5), 1); // N5, \field Service Date Year // \type integer // \minimum 1900 // \maximum 2100 - serviceDateYear = int(NumArray(5)); - if (serviceDateYear > 2100) { + elcc->serviceDateYear = int(NumArray(5)); + if (elcc->serviceDateYear > 2100) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(5) + ". Value greater than 2100 yet it is representing a year. "); } - if (serviceDateYear < 1900) { + if (elcc->serviceDateYear < 1900) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(5) + ". Value less than 1900 yet it is representing a year. "); } @@ -526,21 +341,21 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 1 // \maximum 100 - lengthStudyYears = int(NumArray(6)); - if (lengthStudyYears > 100) { + elcc->lengthStudyYears = int(NumArray(6)); + if (elcc->lengthStudyYears > 100) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(6) + ". A value greater than 100 is not reasonable for an economic evaluation. "); } - if (lengthStudyYears < 1) { + if (elcc->lengthStudyYears < 1) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(6) + ". A value less than 1 is not reasonable for an economic evaluation. "); } - lengthStudyTotalMonths = lengthStudyYears * 12; + elcc->lengthStudyTotalMonths = elcc->lengthStudyYears * 12; // N7, \field Tax rate // \type real // \minimum 0.0 - taxRate = NumArray(7); - if (taxRate < 0.0 && (!lNumericFieldBlanks(7))) { + elcc->taxRate = NumArray(7); + if (elcc->taxRate < 0.0 && (!lNumericFieldBlanks(7))) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(10) + ". A value less than 0 is not reasonable for a tax rate. "); } @@ -559,41 +374,41 @@ namespace EconomicLifeCycleCost { // \key None // \default None if (UtilityRoutines::SameString(AlphaArray(6), "ModifiedAcceleratedCostRecoverySystem-3year")) { - depreciationMethod = depMethMACRS3; + elcc->depreciationMethod = iDeprMethod::MACRS3; } else if (UtilityRoutines::SameString(AlphaArray(6), "ModifiedAcceleratedCostRecoverySystem-5year")) { - depreciationMethod = depMethMACRS5; + elcc->depreciationMethod = iDeprMethod::MACRS5; } else if (UtilityRoutines::SameString(AlphaArray(6), "ModifiedAcceleratedCostRecoverySystem-7year")) { - depreciationMethod = depMethMACRS7; + elcc->depreciationMethod = iDeprMethod::MACRS7; } else if (UtilityRoutines::SameString(AlphaArray(6), "ModifiedAcceleratedCostRecoverySystem-10year")) { - depreciationMethod = depMethMACRS10; + elcc->depreciationMethod = iDeprMethod::MACRS10; } else if (UtilityRoutines::SameString(AlphaArray(6), "ModifiedAcceleratedCostRecoverySystem-15year")) { - depreciationMethod = depMethMACRS15; + elcc->depreciationMethod = iDeprMethod::MACRS15; } else if (UtilityRoutines::SameString(AlphaArray(6), "ModifiedAcceleratedCostRecoverySystem-20year")) { - depreciationMethod = depMethMACRS20; + elcc->depreciationMethod = iDeprMethod::MACRS20; } else if (UtilityRoutines::SameString(AlphaArray(6), "StraightLine-27year")) { - depreciationMethod = depMethStraight27; + elcc->depreciationMethod = iDeprMethod::Straight27; } else if (UtilityRoutines::SameString(AlphaArray(6), "StraightLine-31year")) { - depreciationMethod = depMethStraight31; + elcc->depreciationMethod = iDeprMethod::Straight31; } else if (UtilityRoutines::SameString(AlphaArray(6), "StraightLine-39year")) { - depreciationMethod = depMethStraight39; + elcc->depreciationMethod = iDeprMethod::Straight39; } else if (UtilityRoutines::SameString(AlphaArray(6), "StraightLine-40year")) { - depreciationMethod = depMethStraight40; + elcc->depreciationMethod = iDeprMethod::Straight40; } else if (UtilityRoutines::SameString(AlphaArray(6), "None")) { - depreciationMethod = depMethNone; + elcc->depreciationMethod = iDeprMethod::None; } else if (lAlphaFieldBlanks(6)) { - depreciationMethod = depMethNone; + elcc->depreciationMethod = iDeprMethod::None; ShowWarningError(state, CurrentModuleObject + ": The input field " + cAlphaFieldNames(6) + "is blank. \"None\" will be used."); } else { - depreciationMethod = depMethNone; - ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(6) + "=\"" + AlphaArray(6) + "\". \"None\" will be used."); + elcc->depreciationMethod = iDeprMethod::None; + ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(6) + "=\"" + AlphaArray(6) + R"(". "None" will be used.)"); } // compute derived variables - lastDateMonth = baseDateMonth - 1; // same month of the year for first and last month - if (lastDateMonth == 0) lastDateMonth = 12; - lastDateYear = baseDateYear + lengthStudyYears - 1; + elcc->lastDateMonth = elcc->baseDateMonth - 1; // same month of the year for first and last month + if (elcc->lastDateMonth == 0) elcc->lastDateMonth = 12; + elcc->lastDateYear = elcc->baseDateYear + elcc->lengthStudyYears - 1; } else { ShowWarningError(state, CurrentModuleObject + ": Only one instance of this object is allowed. No life-cycle cost reports will be generated."); - LCCparamPresent = false; + elcc->LCCparamPresent = false; } } @@ -618,14 +433,16 @@ namespace EconomicLifeCycleCost { int IOStat; // IO Status when calling get input subroutine std::string CurrentModuleObject; // for ease in renaming. - if (!LCCparamPresent) return; + auto &elcc(state.dataEconLifeCycleCost); + + if (!elcc->LCCparamPresent) return; CurrentModuleObject = "LifeCycleCost:RecurringCosts"; inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumFields, NumAlphas, NumNums); NumArray.allocate(NumNums); AlphaArray.allocate(NumAlphas); - numRecurringCosts = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - RecurringCosts.allocate(numRecurringCosts); - for (iInObj = 1; iInObj <= numRecurringCosts; ++iInObj) { + elcc->numRecurringCosts = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + elcc->RecurringCosts.allocate(elcc->numRecurringCosts); + for (iInObj = 1; iInObj <= elcc->numRecurringCosts; ++iInObj) { inputProcessor->getObjectItem(state, CurrentModuleObject, iInObj, @@ -649,7 +466,7 @@ namespace EconomicLifeCycleCost { // A1, \field Name // \required-field // \type alpha - RecurringCosts(iInObj).name = AlphaArray(1); + elcc->RecurringCosts(iInObj).name = AlphaArray(1); // A2, \field Category // \type choice // \key Maintenance @@ -661,38 +478,38 @@ namespace EconomicLifeCycleCost { // \key OtherOperational // \default Maintenance if (UtilityRoutines::SameString(AlphaArray(2), "Maintenance")) { - RecurringCosts(iInObj).category = costCatMaintenance; + elcc->RecurringCosts(iInObj).category = costCatMaintenance; } else if (UtilityRoutines::SameString(AlphaArray(2), "Repair")) { - RecurringCosts(iInObj).category = costCatRepair; + elcc->RecurringCosts(iInObj).category = costCatRepair; } else if (UtilityRoutines::SameString(AlphaArray(2), "Operation")) { - RecurringCosts(iInObj).category = costCatOperation; + elcc->RecurringCosts(iInObj).category = costCatOperation; } else if (UtilityRoutines::SameString(AlphaArray(2), "Replacement")) { - RecurringCosts(iInObj).category = costCatReplacement; + elcc->RecurringCosts(iInObj).category = costCatReplacement; } else if (UtilityRoutines::SameString(AlphaArray(2), "MinorOverhaul")) { - RecurringCosts(iInObj).category = costCatMinorOverhaul; + elcc->RecurringCosts(iInObj).category = costCatMinorOverhaul; } else if (UtilityRoutines::SameString(AlphaArray(2), "MajorOverhaul")) { - RecurringCosts(iInObj).category = costCatMajorOverhaul; + elcc->RecurringCosts(iInObj).category = costCatMajorOverhaul; } else if (UtilityRoutines::SameString(AlphaArray(2), "OtherOperational")) { - RecurringCosts(iInObj).category = costCatOtherOperational; + elcc->RecurringCosts(iInObj).category = costCatOtherOperational; } else { - RecurringCosts(iInObj).category = costCatMaintenance; + elcc->RecurringCosts(iInObj).category = costCatMaintenance; ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(2) + "=\"" + AlphaArray(2) + "\". The category of Maintenance will be used."); } // N1, \field Cost // \type real - RecurringCosts(iInObj).cost = NumArray(1); + elcc->RecurringCosts(iInObj).cost = NumArray(1); // A3, \field Start of Costs // \type choice // \key ServicePeriod // \key BasePeriod // \default ServicePeriod if (UtilityRoutines::SameString(AlphaArray(3), "ServicePeriod")) { - RecurringCosts(iInObj).startOfCosts = startServicePeriod; + elcc->RecurringCosts(iInObj).startOfCosts = iStartCosts::ServicePeriod; } else if (UtilityRoutines::SameString(AlphaArray(3), "BasePeriod")) { - RecurringCosts(iInObj).startOfCosts = startBasePeriod; + elcc->RecurringCosts(iInObj).startOfCosts = iStartCosts::BasePeriod; } else { - RecurringCosts(iInObj).startOfCosts = startServicePeriod; + elcc->RecurringCosts(iInObj).startOfCosts = iStartCosts::ServicePeriod; ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(3) + "=\"" + AlphaArray(3) + "\". The start of the service period will be used."); } @@ -700,13 +517,13 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 0 // \maximum 100 - RecurringCosts(iInObj).yearsFromStart = int(NumArray(2)); - if (RecurringCosts(iInObj).yearsFromStart > 100) { + elcc->RecurringCosts(iInObj).yearsFromStart = int(NumArray(2)); + if (elcc->RecurringCosts(iInObj).yearsFromStart > 100) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(2) + ". This value is the number of years from the start so a value greater than 100 is not reasonable for an economic evaluation. "); } - if (RecurringCosts(iInObj).yearsFromStart < 0) { + if (elcc->RecurringCosts(iInObj).yearsFromStart < 0) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(2) + ". This value is the number of years from the start so a value less than 0 is not reasonable for an economic evaluation. "); @@ -715,13 +532,13 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 0 // \maximum 1200 - RecurringCosts(iInObj).monthsFromStart = int(NumArray(3)); - if (RecurringCosts(iInObj).monthsFromStart > 1200) { + elcc->RecurringCosts(iInObj).monthsFromStart = int(NumArray(3)); + if (elcc->RecurringCosts(iInObj).monthsFromStart > 1200) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(3) + ". This value is the number of months from the start so a value greater than 1200 is not reasonable for an " "economic evaluation. "); } - if (RecurringCosts(iInObj).monthsFromStart < 0) { + if (elcc->RecurringCosts(iInObj).monthsFromStart < 0) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(3) + ". This value is the number of months from the start so a value less than 0 is not reasonable for an economic evaluation. "); @@ -730,13 +547,13 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 1 // \maximum 100 - RecurringCosts(iInObj).repeatPeriodYears = int(NumArray(4)); - if (RecurringCosts(iInObj).repeatPeriodYears > 100) { + elcc->RecurringCosts(iInObj).repeatPeriodYears = int(NumArray(4)); + if (elcc->RecurringCosts(iInObj).repeatPeriodYears > 100) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(4) + ". This value is the number of years between occurrences of the cost so a value greater than 100 is not reasonable " "for an economic evaluation. "); } - if (RecurringCosts(iInObj).repeatPeriodYears < 1) { + if (elcc->RecurringCosts(iInObj).repeatPeriodYears < 1) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(4) + ". This value is the number of years between occurrences of the cost so a value less than 1 is not reasonable for " "an economic evaluation. "); @@ -745,36 +562,36 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 0 // \maximum 1200 - RecurringCosts(iInObj).repeatPeriodMonths = int(NumArray(5)); - if (RecurringCosts(iInObj).repeatPeriodMonths > 1200) { + elcc->RecurringCosts(iInObj).repeatPeriodMonths = int(NumArray(5)); + if (elcc->RecurringCosts(iInObj).repeatPeriodMonths > 1200) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(5) + ". This value is the number of months between occurrences of the cost so a value greater than 1200 is not " "reasonable for an economic evaluation. "); } - if (RecurringCosts(iInObj).repeatPeriodMonths < 0) { + if (elcc->RecurringCosts(iInObj).repeatPeriodMonths < 0) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(5) + ". This value is the number of months between occurrences of the cost so a value less than 0 is not reasonable for " "an economic evaluation. "); } - if ((RecurringCosts(iInObj).repeatPeriodMonths == 0) && (RecurringCosts(iInObj).repeatPeriodYears == 0)) { + if ((elcc->RecurringCosts(iInObj).repeatPeriodMonths == 0) && (elcc->RecurringCosts(iInObj).repeatPeriodYears == 0)) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in fields " + cNumericFieldNames(5) + " and " + cNumericFieldNames(4) + ". The repeat period must not be zero months and zero years. "); } // N6; \field Annual escalation rate // \type real - RecurringCosts(iInObj).annualEscalationRate = int(NumArray(6)); - if (RecurringCosts(iInObj).annualEscalationRate > 0.30) { + elcc->RecurringCosts(iInObj).annualEscalationRate = int(NumArray(6)); + if (elcc->RecurringCosts(iInObj).annualEscalationRate > 0.30) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(6) + ". This value is the decimal value for the annual escalation so most values are between 0.02 and 0.15. "); } - if (RecurringCosts(iInObj).annualEscalationRate < -0.30) { + if (elcc->RecurringCosts(iInObj).annualEscalationRate < -0.30) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(6) + ". This value is the decimal value for the annual escalation so most values are between 0.02 and 0.15. "); } // express the years and months fields in total months - RecurringCosts(iInObj).totalMonthsFromStart = RecurringCosts(iInObj).yearsFromStart * 12 + RecurringCosts(iInObj).monthsFromStart; - RecurringCosts(iInObj).totalRepeatPeriodMonths = - RecurringCosts(iInObj).repeatPeriodYears * 12 + RecurringCosts(iInObj).repeatPeriodMonths; + elcc->RecurringCosts(iInObj).totalMonthsFromStart = elcc->RecurringCosts(iInObj).yearsFromStart * 12 + elcc->RecurringCosts(iInObj).monthsFromStart; + elcc->RecurringCosts(iInObj).totalRepeatPeriodMonths = + elcc->RecurringCosts(iInObj).repeatPeriodYears * 12 + elcc->RecurringCosts(iInObj).repeatPeriodMonths; } } @@ -800,19 +617,21 @@ namespace EconomicLifeCycleCost { std::string CurrentModuleObject; // for ease in renaming. int numComponentCostLineItems; // number of ComponentCost:LineItem objects - if (!LCCparamPresent) return; + auto &elcc(state.dataEconLifeCycleCost); + + if (!elcc->LCCparamPresent) return; CurrentModuleObject = "LifeCycleCost:NonrecurringCost"; inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumFields, NumAlphas, NumNums); NumArray.allocate(NumNums); AlphaArray.allocate(NumAlphas); - numNonrecurringCost = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + elcc->numNonrecurringCost = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); numComponentCostLineItems = inputProcessor->getNumObjectsFound(state, "ComponentCost:LineItem"); if (numComponentCostLineItems > 0) { // leave room for component cost total - NonrecurringCost.allocate(numNonrecurringCost + 1); // add a place for CostEstimate total + elcc->NonrecurringCost.allocate(elcc->numNonrecurringCost + 1); // add a place for CostEstimate total } else { - NonrecurringCost.allocate(numNonrecurringCost); + elcc->NonrecurringCost.allocate(elcc->numNonrecurringCost); } - for (iInObj = 1; iInObj <= numNonrecurringCost; ++iInObj) { + for (iInObj = 1; iInObj <= elcc->numNonrecurringCost; ++iInObj) { inputProcessor->getObjectItem(state, CurrentModuleObject, iInObj, @@ -836,7 +655,7 @@ namespace EconomicLifeCycleCost { // A1, \field Name // \required-field // \type alpha - NonrecurringCost(iInObj).name = AlphaArray(1); + elcc->NonrecurringCost(iInObj).name = AlphaArray(1); // A2, \field Category // \type choice // \key Construction @@ -844,30 +663,30 @@ namespace EconomicLifeCycleCost { // \key OtherCapital // \default Construction if (UtilityRoutines::SameString(AlphaArray(2), "Construction")) { - NonrecurringCost(iInObj).category = costCatConstruction; + elcc->NonrecurringCost(iInObj).category = costCatConstruction; } else if (UtilityRoutines::SameString(AlphaArray(2), "Salvage")) { - NonrecurringCost(iInObj).category = costCatSalvage; + elcc->NonrecurringCost(iInObj).category = costCatSalvage; } else if (UtilityRoutines::SameString(AlphaArray(2), "OtherCapital")) { - NonrecurringCost(iInObj).category = costCatOtherCapital; + elcc->NonrecurringCost(iInObj).category = costCatOtherCapital; } else { - NonrecurringCost(iInObj).category = costCatConstruction; + elcc->NonrecurringCost(iInObj).category = costCatConstruction; ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(2) + "=\"" + AlphaArray(2) + "\". The category of Construction will be used."); } // N1, \field Cost // \type real - NonrecurringCost(iInObj).cost = NumArray(1); + elcc->NonrecurringCost(iInObj).cost = NumArray(1); // A3, \field Start of Costs // \type choice // \key ServicePeriod // \key BasePeriod // \default ServicePeriod if (UtilityRoutines::SameString(AlphaArray(3), "ServicePeriod")) { - NonrecurringCost(iInObj).startOfCosts = startServicePeriod; + elcc->NonrecurringCost(iInObj).startOfCosts = iStartCosts::ServicePeriod; } else if (UtilityRoutines::SameString(AlphaArray(3), "BasePeriod")) { - NonrecurringCost(iInObj).startOfCosts = startBasePeriod; + elcc->NonrecurringCost(iInObj).startOfCosts = iStartCosts::BasePeriod; } else { - NonrecurringCost(iInObj).startOfCosts = startServicePeriod; + elcc->NonrecurringCost(iInObj).startOfCosts = iStartCosts::ServicePeriod; ShowWarningError(state, CurrentModuleObject + ": Invalid " + cAlphaFieldNames(3) + "=\"" + AlphaArray(3) + "\". The start of the service period will be used."); } @@ -875,13 +694,13 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 0 // \maximum 100 - NonrecurringCost(iInObj).yearsFromStart = int(NumArray(2)); - if (NonrecurringCost(iInObj).yearsFromStart > 100) { + elcc->NonrecurringCost(iInObj).yearsFromStart = int(NumArray(2)); + if (elcc->NonrecurringCost(iInObj).yearsFromStart > 100) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(2) + ". This value is the number of years from the start so a value greater than 100 is not reasonable for an economic evaluation. "); } - if (NonrecurringCost(iInObj).yearsFromStart < 0) { + if (elcc->NonrecurringCost(iInObj).yearsFromStart < 0) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(2) + ". This value is the number of years from the start so a value less than 0 is not reasonable for an economic evaluation. "); @@ -890,19 +709,19 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 0 // \maximum 11 - NonrecurringCost(iInObj).monthsFromStart = int(NumArray(3)); - if (NonrecurringCost(iInObj).monthsFromStart > 1200) { + elcc->NonrecurringCost(iInObj).monthsFromStart = int(NumArray(3)); + if (elcc->NonrecurringCost(iInObj).monthsFromStart > 1200) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(3) + ". This value is the number of months from the start so a value greater than 1200 is not reasonable for an " "economic evaluation. "); } - if (NonrecurringCost(iInObj).monthsFromStart < 0) { + if (elcc->NonrecurringCost(iInObj).monthsFromStart < 0) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(3) + ". This value is the number of months from the start so a value less than 0 is not reasonable for an economic evaluation. "); } // express the years and months fields in total months - NonrecurringCost(iInObj).totalMonthsFromStart = NonrecurringCost(iInObj).yearsFromStart * 12 + NonrecurringCost(iInObj).monthsFromStart; + elcc->NonrecurringCost(iInObj).totalMonthsFromStart = elcc->NonrecurringCost(iInObj).yearsFromStart * 12 + elcc->NonrecurringCost(iInObj).monthsFromStart; } } @@ -928,18 +747,20 @@ namespace EconomicLifeCycleCost { int IOStat; // IO Status when calling get input subroutine std::string CurrentModuleObject; // for ease in renaming. - if (!LCCparamPresent) return; + auto &elcc(state.dataEconLifeCycleCost); + + if (!elcc->LCCparamPresent) return; CurrentModuleObject = "LifeCycleCost:UsePriceEscalation"; inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumFields, NumAlphas, NumNums); NumArray.allocate(NumNums); AlphaArray.allocate(NumAlphas); - numUsePriceEscalation = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - UsePriceEscalation.allocate(numUsePriceEscalation); - for (iInObj = 1; iInObj <= numUsePriceEscalation; ++iInObj) { - UsePriceEscalation(iInObj).Escalation.allocate(lengthStudyYears); + elcc->numUsePriceEscalation = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + elcc->UsePriceEscalation.allocate(elcc->numUsePriceEscalation); + for (iInObj = 1; iInObj <= elcc->numUsePriceEscalation; ++iInObj) { + elcc->UsePriceEscalation(iInObj).Escalation.allocate(elcc->lengthStudyYears); } - if (numUsePriceEscalation > 0) { - for (iInObj = 1; iInObj <= numUsePriceEscalation; ++iInObj) { + if (elcc->numUsePriceEscalation > 0) { + for (iInObj = 1; iInObj <= elcc->numUsePriceEscalation; ++iInObj) { inputProcessor->getObjectItem(state, CurrentModuleObject, iInObj, @@ -963,7 +784,7 @@ namespace EconomicLifeCycleCost { // A1, \field Name // \required-field // \type alpha - UsePriceEscalation(iInObj).name = AlphaArray(1); + elcc->UsePriceEscalation(iInObj).name = AlphaArray(1); // A2, \field Resource // \required-field // \type choice @@ -979,7 +800,7 @@ namespace EconomicLifeCycleCost { // \key Water // \key OtherFuel1 // \key OtherFuel2 - UsePriceEscalation(iInObj).resource = AssignResourceTypeNum(AlphaArray(2)); // use function from DataGlobalConstants + elcc->UsePriceEscalation(iInObj).resource = AssignResourceTypeNum(AlphaArray(2)); // use function from DataGlobalConstants if (NumAlphas > 3) { ShowWarningError(state, "In " + CurrentModuleObject + " contains more alpha fields than expected."); } @@ -987,12 +808,12 @@ namespace EconomicLifeCycleCost { // \type integer // \minimum 1900 // \maximum 2100 - UsePriceEscalation(iInObj).escalationStartYear = int(NumArray(1)); - if (UsePriceEscalation(iInObj).escalationStartYear > 2100) { + elcc->UsePriceEscalation(iInObj).escalationStartYear = int(NumArray(1)); + if (elcc->UsePriceEscalation(iInObj).escalationStartYear > 2100) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(1) + ". Value greater than 2100 yet it is representing a year. "); } - if (UsePriceEscalation(iInObj).escalationStartYear < 1900) { + if (elcc->UsePriceEscalation(iInObj).escalationStartYear < 1900) { ShowWarningError(state, CurrentModuleObject + ": Invalid value in field " + cNumericFieldNames(1) + ". Value less than 1900 yet it is representing a year. "); } @@ -1011,29 +832,29 @@ namespace EconomicLifeCycleCost { // \key November // \key December // \default January - UsePriceEscalation(iInObj).escalationStartMonth = MonthToMonthNumber(AlphaArray(3), 1); + elcc->UsePriceEscalation(iInObj).escalationStartMonth = MonthToMonthNumber(AlphaArray(3), 1); // N2, \field Year 1 Escalation // \type real // \begin-extensible // The array is from the baseDateYear until baseDateYear + lengthStudyYears // Set the array to default to 1.0 - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { - UsePriceEscalation(iInObj).Escalation(jYear) = 1.0; + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->UsePriceEscalation(iInObj).Escalation(jYear) = 1.0; } // Since the years in the UsePriceEscalation may not match up with the baseDateYear and // the lenghtStudyYears, need to make adjustments when reading in the values to align // with the baseDateYear (the first item in all yearly arrays) - UsePriceEscalation_escStartYear = UsePriceEscalation(iInObj).escalationStartYear; - UsePriceEscalation_escNumYears = NumNums - 1; - UsePriceEscalation_escEndYear = UsePriceEscalation_escStartYear + UsePriceEscalation_escNumYears - 1; - UsePriceEscalation_earlierEndYear = min(UsePriceEscalation_escEndYear, lastDateYear); // pick the earlier ending date - UsePriceEscalation_laterStartYear = max(UsePriceEscalation_escStartYear, baseDateYear); // pick the later starting date - for (jYear = UsePriceEscalation_laterStartYear; jYear <= UsePriceEscalation_earlierEndYear; ++jYear) { - UsePriceEscalation_curFld = 2 + jYear - UsePriceEscalation_escStartYear; - UsePriceEscalation_curEsc = 1 + jYear - baseDateYear; - if ((UsePriceEscalation_curFld <= NumNums) && (UsePriceEscalation_curFld >= 1)) { - if ((UsePriceEscalation_curEsc <= lengthStudyYears) && (UsePriceEscalation_curEsc >= 1)) { - UsePriceEscalation(iInObj).Escalation(UsePriceEscalation_curEsc) = NumArray(UsePriceEscalation_curFld); + elcc->UsePriceEscalation_escStartYear = elcc->UsePriceEscalation(iInObj).escalationStartYear; + elcc->UsePriceEscalation_escNumYears = NumNums - 1; + elcc->UsePriceEscalation_escEndYear = elcc->UsePriceEscalation_escStartYear + elcc->UsePriceEscalation_escNumYears - 1; + elcc->UsePriceEscalation_earlierEndYear = min(elcc->UsePriceEscalation_escEndYear, elcc->lastDateYear); // pick the earlier ending date + elcc->UsePriceEscalation_laterStartYear = max(elcc->UsePriceEscalation_escStartYear, elcc->baseDateYear); // pick the later starting date + for (jYear = elcc->UsePriceEscalation_laterStartYear; jYear <= elcc->UsePriceEscalation_earlierEndYear; ++jYear) { + elcc->UsePriceEscalation_curFld = 2 + jYear - elcc->UsePriceEscalation_escStartYear; + elcc->UsePriceEscalation_curEsc = 1 + jYear - elcc->baseDateYear; + if ((elcc->UsePriceEscalation_curFld <= NumNums) && (elcc->UsePriceEscalation_curFld >= 1)) { + if ((elcc->UsePriceEscalation_curEsc <= elcc->lengthStudyYears) && (elcc->UsePriceEscalation_curEsc >= 1)) { + elcc->UsePriceEscalation(iInObj).Escalation(elcc->UsePriceEscalation_curEsc) = NumArray(elcc->UsePriceEscalation_curFld); } } } @@ -1064,18 +885,20 @@ namespace EconomicLifeCycleCost { std::string CurrentModuleObject; // for ease in renaming. int numFldsToUse; - if (!LCCparamPresent) return; + auto &elcc(state.dataEconLifeCycleCost); + + if (!elcc->LCCparamPresent) return; CurrentModuleObject = "LifeCycleCost:UseAdjustment"; inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumFields, NumAlphas, NumNums); NumArray.allocate(NumNums); AlphaArray.allocate(NumAlphas); - numUseAdjustment = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - UseAdjustment.allocate(numUseAdjustment); - for (iInObj = 1; iInObj <= numUseAdjustment; ++iInObj) { - UseAdjustment(iInObj).Adjustment.allocate(lengthStudyYears); + elcc->numUseAdjustment = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + elcc->UseAdjustment.allocate(elcc->numUseAdjustment); + for (iInObj = 1; iInObj <= elcc->numUseAdjustment; ++iInObj) { + elcc->UseAdjustment(iInObj).Adjustment.allocate(elcc->lengthStudyYears); } - if (numUseAdjustment > 0) { - for (iInObj = 1; iInObj <= numUseAdjustment; ++iInObj) { + if (elcc->numUseAdjustment > 0) { + for (iInObj = 1; iInObj <= elcc->numUseAdjustment; ++iInObj) { inputProcessor->getObjectItem(state, CurrentModuleObject, iInObj, @@ -1099,7 +922,7 @@ namespace EconomicLifeCycleCost { // A1, \field Name // \required-field // \type alpha - UseAdjustment(iInObj).name = AlphaArray(1); + elcc->UseAdjustment(iInObj).name = AlphaArray(1); // A2, \field Resource // \required-field // \type choice @@ -1115,7 +938,7 @@ namespace EconomicLifeCycleCost { // \key Water // \key OtherFuel1 // \key OtherFuel2 - UseAdjustment(iInObj).resource = AssignResourceTypeNum(AlphaArray(2)); // use function from DataGlobalConstants + elcc->UseAdjustment(iInObj).resource = AssignResourceTypeNum(AlphaArray(2)); // use function from DataGlobalConstants if (NumAlphas > 2) { ShowWarningError(state, "In " + CurrentModuleObject + " contains more alpha fields than expected."); } @@ -1123,18 +946,18 @@ namespace EconomicLifeCycleCost { // \type real // \begin-extensible // Set the array to default to 1.0 - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { - UseAdjustment(iInObj).Adjustment(jYear) = 1.0; + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->UseAdjustment(iInObj).Adjustment(jYear) = 1.0; } - numFldsToUse = min(NumNums, lengthStudyYears); + numFldsToUse = min(NumNums, elcc->lengthStudyYears); for (jYear = 1; jYear <= numFldsToUse; ++jYear) { - UseAdjustment(iInObj).Adjustment(jYear) = NumArray(jYear); + elcc->UseAdjustment(iInObj).Adjustment(jYear) = NumArray(jYear); } } } } - int MonthToMonthNumber(std::string const &inMonthString, int const inDefaultMonth) + int MonthToMonthNumber(std::string const &inMonthString, int const &inDefaultMonth) { // FUNCTION INFORMATION: @@ -1284,25 +1107,27 @@ namespace EconomicLifeCycleCost { Real64 inflationPerMonth; int iLoop; + auto &elcc(state.dataEconLifeCycleCost); + // compute months from 1900 for base and service period - ExpressAsCashFlows_baseMonths1900 = (baseDateYear - 1900) * 12 + baseDateMonth; - ExpressAsCashFlows_serviceMonths1900 = (serviceDateYear - 1900) * 12 + serviceDateMonth; - monthsBaseToService = ExpressAsCashFlows_serviceMonths1900 - ExpressAsCashFlows_baseMonths1900; + elcc->ExpressAsCashFlows_baseMonths1900 = (elcc->baseDateYear - 1900) * 12 + elcc->baseDateMonth; + elcc->ExpressAsCashFlows_serviceMonths1900 = (elcc->serviceDateYear - 1900) * 12 + elcc->serviceDateMonth; + monthsBaseToService = elcc->ExpressAsCashFlows_serviceMonths1900 - elcc->ExpressAsCashFlows_baseMonths1900; // if ComponentCost:LineItem exist, the grand total of all costs are another non-recurring cost if (state.dataCostEstimateManager->CurntBldg.GrandTotal > 0.0) { // from DataCostEstimate and computed in WriteCompCostTable within OutputReportTabular - ++numNonrecurringCost; - NonrecurringCost(numNonrecurringCost).name = "Total of ComponentCost:*"; - NonrecurringCost(numNonrecurringCost).lineItem = ""; - NonrecurringCost(numNonrecurringCost).category = costCatConstruction; - NonrecurringCost(numNonrecurringCost).cost = state.dataCostEstimateManager->CurntBldg.GrandTotal; - NonrecurringCost(numNonrecurringCost).startOfCosts = startBasePeriod; - NonrecurringCost(numNonrecurringCost).yearsFromStart = 0; - NonrecurringCost(numNonrecurringCost).monthsFromStart = 0; - NonrecurringCost(numNonrecurringCost).totalMonthsFromStart = 0; + ++elcc->numNonrecurringCost; + elcc->NonrecurringCost(elcc->numNonrecurringCost).name = "Total of ComponentCost:*"; + elcc->NonrecurringCost(elcc->numNonrecurringCost).lineItem = ""; + elcc->NonrecurringCost(elcc->numNonrecurringCost).category = costCatConstruction; + elcc->NonrecurringCost(elcc->numNonrecurringCost).cost = state.dataCostEstimateManager->CurntBldg.GrandTotal; + elcc->NonrecurringCost(elcc->numNonrecurringCost).startOfCosts = iStartCosts::BasePeriod; + elcc->NonrecurringCost(elcc->numNonrecurringCost).yearsFromStart = 0; + elcc->NonrecurringCost(elcc->numNonrecurringCost).monthsFromStart = 0; + elcc->NonrecurringCost(elcc->numNonrecurringCost).totalMonthsFromStart = 0; } // gather costs from EconomicTariff for each end use - numResourcesUsed = 0; + elcc->numResourcesUsed = 0; for (auto iResource : DataGlobalConstants::AllResourceTypes) { GetMonthlyCostForResource(state, iResource, curResourceCosts); annualCost = 0.0; @@ -1311,7 +1136,7 @@ namespace EconomicLifeCycleCost { annualCost += resourceCosts.at(jMonth).at(iResource); } if (annualCost != 0.0) { - ++numResourcesUsed; + ++elcc->numResourcesUsed; resourceCostNotZero.at(iResource) = true; } else { resourceCostNotZero.at(iResource) = false; @@ -1319,95 +1144,95 @@ namespace EconomicLifeCycleCost { resourceCostAnnual.at(iResource) = annualCost; } // allocate the escalated energy cost arrays - for (int year = 1; year <= lengthStudyYears; ++year) { + for (int year = 1; year <= elcc->lengthStudyYears; ++year) { std::map yearMap; for (auto iResource : DataGlobalConstants::AllResourceTypes) { yearMap.insert(std::pair (iResource, 0.0)); } - EscalatedEnergy.insert(std::pair>(year, yearMap)); + elcc->EscalatedEnergy.insert(std::pair>(year, yearMap)); } - EscalatedTotEnergy.allocate(lengthStudyYears); - EscalatedTotEnergy = 0.0; + elcc->EscalatedTotEnergy.allocate(elcc->lengthStudyYears); + elcc->EscalatedTotEnergy = 0.0; // pre-compute the inflation factors for each year - monthlyInflationFactor.allocate(lengthStudyTotalMonths); - if (inflationApproach == inflAppConstantDollar) { + monthlyInflationFactor.allocate(elcc->lengthStudyTotalMonths); + if (elcc->inflationApproach == iInflAppr::ConstantDollar) { monthlyInflationFactor = 1.0; // not really used but just in case - } else if (inflationApproach == inflAppCurrentDollar) { + } else if (elcc->inflationApproach == iInflAppr::CurrentDollar) { // to allocate an interest rate (in this case inflation) cannot just use 1/12 // for the monthly value since it will be slightly wrong. Instead use inverse of // formula from Newnan (4-32) which is r = m x (ia + 1)^(1/m) - 1) - inflationPerMonth = std::pow(inflation + 1.0, 1.0 / 12.0) - 1; - for (int jMonth = 1; jMonth <= lengthStudyTotalMonths; ++jMonth) { + inflationPerMonth = std::pow(elcc->inflation + 1.0, 1.0 / 12.0) - 1; + for (int jMonth = 1; jMonth <= elcc->lengthStudyTotalMonths; ++jMonth) { monthlyInflationFactor(jMonth) = std::pow(1.0 + inflationPerMonth, jMonth - 1); } } - numCashFlow = countOfCostCat + numRecurringCosts + numNonrecurringCost + numResourcesUsed; + elcc->numCashFlow = countOfCostCat + elcc->numRecurringCosts + elcc->numNonrecurringCost + elcc->numResourcesUsed; // Cashflow array order: // 1 cost categories // 2 recurring costs // 3 nonrecurring costs // 4 resource costs - CashFlow.allocate(numCashFlow); - for (iCashFlow = 1; iCashFlow <= numCashFlow; ++iCashFlow) { - CashFlow(iCashFlow).mnAmount.allocate(lengthStudyTotalMonths); - CashFlow(iCashFlow).yrAmount.allocate(lengthStudyYears); - CashFlow(iCashFlow).yrPresVal.allocate(lengthStudyYears); - CashFlow(iCashFlow).mnAmount = 0.0; // zero all cash flow values - CashFlow(iCashFlow).yrAmount = 0.0; // zero all cash flow values - CashFlow(iCashFlow).yrPresVal = 0.0; // zero all present values + elcc->CashFlow.allocate(elcc->numCashFlow); + for (iCashFlow = 1; iCashFlow <= elcc->numCashFlow; ++iCashFlow) { + elcc->CashFlow(iCashFlow).mnAmount.allocate(elcc->lengthStudyTotalMonths); + elcc->CashFlow(iCashFlow).yrAmount.allocate(elcc->lengthStudyYears); + elcc->CashFlow(iCashFlow).yrPresVal.allocate(elcc->lengthStudyYears); + elcc->CashFlow(iCashFlow).mnAmount = 0.0; // zero all cash flow values + elcc->CashFlow(iCashFlow).yrAmount = 0.0; // zero all cash flow values + elcc->CashFlow(iCashFlow).yrPresVal = 0.0; // zero all present values } // Put nonrecurring costs into cashflows - offset = countOfCostCat + numRecurringCosts; - for (jCost = 1; jCost <= numNonrecurringCost; ++jCost) { - CashFlow(offset + jCost).name = NonrecurringCost(jCost).name; - CashFlow(offset + jCost).SourceKind = skNonrecurring; - CashFlow(offset + jCost).Category = NonrecurringCost(jCost).category; - CashFlow(offset + jCost).orginalCost = NonrecurringCost(jCost).cost; - CashFlow(offset + jCost).mnAmount = 0.0; - if (NonrecurringCost(jCost).startOfCosts == startServicePeriod) { - month = NonrecurringCost(jCost).totalMonthsFromStart + monthsBaseToService + 1; - } else if (NonrecurringCost(jCost).startOfCosts == startBasePeriod) { - month = NonrecurringCost(jCost).totalMonthsFromStart + 1; - } - if ((month >= 1) && (month <= lengthStudyTotalMonths)) { - CashFlow(offset + jCost).mnAmount(month) = NonrecurringCost(jCost).cost * monthlyInflationFactor(month); + offset = countOfCostCat + elcc->numRecurringCosts; + for (jCost = 1; jCost <= elcc->numNonrecurringCost; ++jCost) { + elcc->CashFlow(offset + jCost).name = elcc->NonrecurringCost(jCost).name; + elcc->CashFlow(offset + jCost).SourceKind = iSourceKind::Nonrecurring; + elcc->CashFlow(offset + jCost).Category = elcc->NonrecurringCost(jCost).category; + elcc->CashFlow(offset + jCost).orginalCost = elcc->NonrecurringCost(jCost).cost; + elcc->CashFlow(offset + jCost).mnAmount = 0.0; + if (elcc->NonrecurringCost(jCost).startOfCosts == iStartCosts::ServicePeriod) { + month = elcc->NonrecurringCost(jCost).totalMonthsFromStart + monthsBaseToService + 1; + } else if (elcc->NonrecurringCost(jCost).startOfCosts == iStartCosts::BasePeriod) { + month = elcc->NonrecurringCost(jCost).totalMonthsFromStart + 1; + } + if ((month >= 1) && (month <= elcc->lengthStudyTotalMonths)) { + elcc->CashFlow(offset + jCost).mnAmount(month) = elcc->NonrecurringCost(jCost).cost * monthlyInflationFactor(month); } else { - ShowWarningError(state, "For life cycle costing a nonrecurring cost named " + NonrecurringCost(jCost).name + + ShowWarningError(state, "For life cycle costing a nonrecurring cost named " + elcc->NonrecurringCost(jCost).name + " contains a cost which is not within the study period."); } } // Put recurring costs into cashflows offset = countOfCostCat; - for (jCost = 1; jCost <= numRecurringCosts; ++jCost) { - CashFlow(offset + jCost).name = RecurringCosts(jCost).name; - CashFlow(offset + jCost).SourceKind = skRecurring; - CashFlow(offset + jCost).Category = RecurringCosts(jCost).category; - CashFlow(offset + jCost).orginalCost = RecurringCosts(jCost).cost; - if (RecurringCosts(jCost).startOfCosts == startServicePeriod) { - firstMonth = RecurringCosts(jCost).totalMonthsFromStart + monthsBaseToService + 1; - } else if (RecurringCosts(jCost).startOfCosts == startBasePeriod) { - firstMonth = RecurringCosts(jCost).totalMonthsFromStart + 1; - } - if ((firstMonth >= 1) && (firstMonth <= lengthStudyTotalMonths)) { + for (jCost = 1; jCost <= elcc->numRecurringCosts; ++jCost) { + elcc->CashFlow(offset + jCost).name = elcc->RecurringCosts(jCost).name; + elcc->CashFlow(offset + jCost).SourceKind = iSourceKind::Recurring; + elcc->CashFlow(offset + jCost).Category = elcc->RecurringCosts(jCost).category; + elcc->CashFlow(offset + jCost).orginalCost = elcc->RecurringCosts(jCost).cost; + if (elcc->RecurringCosts(jCost).startOfCosts == iStartCosts::ServicePeriod) { + firstMonth = elcc->RecurringCosts(jCost).totalMonthsFromStart + monthsBaseToService + 1; + } else if (elcc->RecurringCosts(jCost).startOfCosts == iStartCosts::BasePeriod) { + firstMonth = elcc->RecurringCosts(jCost).totalMonthsFromStart + 1; + } + if ((firstMonth >= 1) && (firstMonth <= elcc->lengthStudyTotalMonths)) { month = firstMonth; - if (RecurringCosts(jCost).totalRepeatPeriodMonths >= 1) { + if (elcc->RecurringCosts(jCost).totalRepeatPeriodMonths >= 1) { for (iLoop = 1; iLoop <= 10000; ++iLoop) { // add a limit to the loop to prevent runaway condition - CashFlow(offset + jCost).mnAmount(month) = RecurringCosts(jCost).cost * monthlyInflationFactor(month); - month += RecurringCosts(jCost).totalRepeatPeriodMonths; - if (month > lengthStudyTotalMonths) break; + elcc->CashFlow(offset + jCost).mnAmount(month) = elcc->RecurringCosts(jCost).cost * monthlyInflationFactor(month); + month += elcc->RecurringCosts(jCost).totalRepeatPeriodMonths; + if (month > elcc->lengthStudyTotalMonths) break; } } } else { - ShowWarningError(state, "For life cycle costing the recurring cost named " + RecurringCosts(jCost).name + + ShowWarningError(state, "For life cycle costing the recurring cost named " + elcc->RecurringCosts(jCost).name + " has the first year of the costs that is not within the study period."); } } // Put resource costs into cashflows // the first cash flow for resources should be after the categories, recurring and nonrecurring costs - cashFlowCounter = countOfCostCat + numRecurringCosts + numNonrecurringCost; + cashFlowCounter = countOfCostCat + elcc->numRecurringCosts + elcc->numNonrecurringCost; for (auto iResource : DataGlobalConstants::AllResourceTypes) { if (resourceCostNotZero.at(iResource)) { ++cashFlowCounter; @@ -1419,7 +1244,7 @@ namespace EconomicLifeCycleCost { case DataGlobalConstants::ResourceType::RainWater: case DataGlobalConstants::ResourceType::WellWater: case DataGlobalConstants::ResourceType::Condensate: - CashFlow(cashFlowCounter).Category = costCatWater; + elcc->CashFlow(cashFlowCounter).Category = costCatWater; break; case DataGlobalConstants::ResourceType::Electricity: case DataGlobalConstants::ResourceType::Natural_Gas: @@ -1438,47 +1263,47 @@ namespace EconomicLifeCycleCost { case DataGlobalConstants::ResourceType::ElectricityNet: case DataGlobalConstants::ResourceType::SolarWater: case DataGlobalConstants::ResourceType::SolarAir: - CashFlow(cashFlowCounter).Category = costCatEnergy; + elcc->CashFlow(cashFlowCounter).Category = costCatEnergy; break; default: - CashFlow(cashFlowCounter).Category = costCatOperation; + elcc->CashFlow(cashFlowCounter).Category = costCatOperation; } - CashFlow(cashFlowCounter).Resource = iResource; - CashFlow(cashFlowCounter).SourceKind = skResource; - CashFlow(cashFlowCounter).name = GetResourceTypeChar(iResource); - if (cashFlowCounter <= numCashFlow) { + elcc->CashFlow(cashFlowCounter).Resource = iResource; + elcc->CashFlow(cashFlowCounter).SourceKind = iSourceKind::Resource; + elcc->CashFlow(cashFlowCounter).name = GetResourceTypeChar(iResource); + if (cashFlowCounter <= elcc->numCashFlow) { // put the monthly energy costs into the cashflow prior to adjustments // energy costs (a.k.a. resource costs) start at the start of service and repeat // until the end of the study total for (int jMonth = 1; jMonth <= 12; ++jMonth) { - CashFlow(cashFlowCounter).mnAmount(monthsBaseToService + jMonth) = resourceCosts.at(jMonth).at(iResource); + elcc->CashFlow(cashFlowCounter).mnAmount(monthsBaseToService + jMonth) = resourceCosts.at(jMonth).at(iResource); } - CashFlow(cashFlowCounter).orginalCost = resourceCostAnnual.at(iResource); - for (int jMonth = monthsBaseToService + 13; jMonth <= lengthStudyTotalMonths; ++jMonth) { + elcc->CashFlow(cashFlowCounter).orginalCost = resourceCostAnnual.at(iResource); + for (int jMonth = monthsBaseToService + 13; jMonth <= elcc->lengthStudyTotalMonths; ++jMonth) { // use the cost from a year earlier - CashFlow(cashFlowCounter).mnAmount(jMonth) = CashFlow(cashFlowCounter).mnAmount(jMonth - 12); + elcc->CashFlow(cashFlowCounter).mnAmount(jMonth) = elcc->CashFlow(cashFlowCounter).mnAmount(jMonth - 12); } // add in the impact of inflation - for (int jMonth = 1; jMonth <= lengthStudyTotalMonths; ++jMonth) { - CashFlow(cashFlowCounter).mnAmount(jMonth) *= monthlyInflationFactor(jMonth); + for (int jMonth = 1; jMonth <= elcc->lengthStudyTotalMonths; ++jMonth) { + elcc->CashFlow(cashFlowCounter).mnAmount(jMonth) *= monthlyInflationFactor(jMonth); } // now factor in adjustments // need to find the correct adjustment to use for the current resource found = 0; - for (jAdj = 1; jAdj <= numUseAdjustment; ++jAdj) { - if (UseAdjustment(jAdj).resource == iResource) { + for (jAdj = 1; jAdj <= elcc->numUseAdjustment; ++jAdj) { + if (elcc->UseAdjustment(jAdj).resource == iResource) { found = jAdj; break; } } // if any adjustments were found for that resource apply the multiplier if (found != 0) { - for (kYear = 1; kYear <= lengthStudyYears; ++kYear) { // if service period is later than base period then this will go too far + for (kYear = 1; kYear <= elcc->lengthStudyYears; ++kYear) { // if service period is later than base period then this will go too far for (int jMonth = 1; jMonth <= 12; ++jMonth) { month = (kYear - 1) * 12 + jMonth; - if (month > lengthStudyTotalMonths) break; - CashFlow(cashFlowCounter).mnAmount(month) *= UseAdjustment(found).Adjustment(kYear); + if (month > elcc->lengthStudyTotalMonths) break; + elcc->CashFlow(cashFlowCounter).mnAmount(month) *= elcc->UseAdjustment(found).Adjustment(kYear); } } } @@ -1487,96 +1312,98 @@ namespace EconomicLifeCycleCost { } // put cashflows into categories for (jCost = 1; jCost <= countOfCostCat; ++jCost) { - CashFlow(jCost).Category = jCost; // make each category the type indicated - CashFlow(jCost).SourceKind = skSum; + elcc->CashFlow(jCost).Category = jCost; // make each category the type indicated + elcc->CashFlow(jCost).SourceKind = iSourceKind::Sum; } // add the cashflows by category - for (jCost = countOfCostCat + 1; jCost <= numCashFlow; ++jCost) { - curCategory = CashFlow(jCost).Category; + for (jCost = countOfCostCat + 1; jCost <= elcc->numCashFlow; ++jCost) { + curCategory = elcc->CashFlow(jCost).Category; if ((curCategory <= countOfCostCat) && (curCategory >= 1)) { - for (int jMonth = 1; jMonth <= lengthStudyTotalMonths; ++jMonth) { - CashFlow(curCategory).mnAmount(jMonth) += CashFlow(jCost).mnAmount(jMonth); + for (int jMonth = 1; jMonth <= elcc->lengthStudyTotalMonths; ++jMonth) { + elcc->CashFlow(curCategory).mnAmount(jMonth) += elcc->CashFlow(jCost).mnAmount(jMonth); } } } // create total categories - for (int jMonth = 1; jMonth <= lengthStudyTotalMonths; ++jMonth) { - CashFlow(costCatTotEnergy).mnAmount(jMonth) = CashFlow(costCatEnergy).mnAmount(jMonth); - CashFlow(costCatTotOper).mnAmount(jMonth) = CashFlow(costCatMaintenance).mnAmount(jMonth) + CashFlow(costCatRepair).mnAmount(jMonth) + - CashFlow(costCatOperation).mnAmount(jMonth) + CashFlow(costCatReplacement).mnAmount(jMonth) + - CashFlow(costCatMinorOverhaul).mnAmount(jMonth) + - CashFlow(costCatMajorOverhaul).mnAmount(jMonth) + - CashFlow(costCatOtherOperational).mnAmount(jMonth) + CashFlow(costCatWater).mnAmount(jMonth) + - CashFlow(costCatEnergy).mnAmount(jMonth); - CashFlow(costCatTotCaptl).mnAmount(jMonth) = CashFlow(costCatConstruction).mnAmount(jMonth) + CashFlow(costCatSalvage).mnAmount(jMonth) + - CashFlow(costCatOtherCapital).mnAmount(jMonth); - CashFlow(costCatTotGrand).mnAmount(jMonth) = CashFlow(costCatTotOper).mnAmount(jMonth) + CashFlow(costCatTotCaptl).mnAmount(jMonth); + for (int jMonth = 1; jMonth <= elcc->lengthStudyTotalMonths; ++jMonth) { + elcc->CashFlow(costCatTotEnergy).mnAmount(jMonth) = elcc->CashFlow(costCatEnergy).mnAmount(jMonth); + elcc->CashFlow(costCatTotOper).mnAmount(jMonth) = elcc->CashFlow(costCatMaintenance).mnAmount(jMonth) + elcc->CashFlow(costCatRepair).mnAmount(jMonth) + + elcc->CashFlow(costCatOperation).mnAmount(jMonth) + elcc->CashFlow(costCatReplacement).mnAmount(jMonth) + + elcc->CashFlow(costCatMinorOverhaul).mnAmount(jMonth) + + elcc->CashFlow(costCatMajorOverhaul).mnAmount(jMonth) + + elcc->CashFlow(costCatOtherOperational).mnAmount(jMonth) + elcc->CashFlow(costCatWater).mnAmount(jMonth) + + elcc->CashFlow(costCatEnergy).mnAmount(jMonth); + elcc->CashFlow(costCatTotCaptl).mnAmount(jMonth) = elcc->CashFlow(costCatConstruction).mnAmount(jMonth) + elcc->CashFlow(costCatSalvage).mnAmount(jMonth) + + elcc->CashFlow(costCatOtherCapital).mnAmount(jMonth); + elcc->CashFlow(costCatTotGrand).mnAmount(jMonth) = elcc->CashFlow(costCatTotOper).mnAmount(jMonth) + elcc->CashFlow(costCatTotCaptl).mnAmount(jMonth); } // convert all monthly cashflows into yearly cashflows - for (jCost = 1; jCost <= numCashFlow; ++jCost) { - for (kYear = 1; kYear <= lengthStudyYears; ++kYear) { + for (jCost = 1; jCost <= elcc->numCashFlow; ++jCost) { + for (kYear = 1; kYear <= elcc->lengthStudyYears; ++kYear) { annualCost = 0.0; for (int jMonth = 1; jMonth <= 12; ++jMonth) { month = (kYear - 1) * 12 + jMonth; - if (month <= lengthStudyTotalMonths) { - annualCost += CashFlow(jCost).mnAmount(month); + if (month <= elcc->lengthStudyTotalMonths) { + annualCost += elcc->CashFlow(jCost).mnAmount(month); } } - CashFlow(jCost).yrAmount(kYear) = annualCost; + elcc->CashFlow(jCost).yrAmount(kYear) = annualCost; } } // generate a warning if resource referenced was not used - for (int nUsePriceEsc = 1; nUsePriceEsc <= numUsePriceEscalation; ++nUsePriceEsc) { - auto curResource = UsePriceEscalation(nUsePriceEsc).resource; + for (int nUsePriceEsc = 1; nUsePriceEsc <= elcc->numUsePriceEscalation; ++nUsePriceEsc) { + auto curResource = elcc->UsePriceEscalation(nUsePriceEsc).resource; if (!resourceCostNotZero.at(curResource) && state.dataGlobal->DoWeathSim) { - ShowWarningError(state, "The resource referenced by LifeCycleCost:UsePriceEscalation= \"" + UsePriceEscalation(nUsePriceEsc).name + + ShowWarningError(state, "The resource referenced by LifeCycleCost:UsePriceEscalation= \"" + elcc->UsePriceEscalation(nUsePriceEsc).name + "\" has no energy cost. "); ShowContinueError(state, "... It is likely that the wrong resource is used. The resource should match the meter used in Utility:Tariff."); } } } - void ComputeEscalatedEnergyCosts() + void ComputeEscalatedEnergyCosts(EnergyPlusData &state) { // J. Glazer - August 2019 int nUsePriceEsc; - for (int iCashFlow = 1; iCashFlow <= numCashFlow; ++iCashFlow) { - if (CashFlow(iCashFlow).pvKind == pvkEnergy) { + auto &elcc(state.dataEconLifeCycleCost); + + for (int iCashFlow = 1; iCashFlow <= elcc->numCashFlow; ++iCashFlow) { + if (elcc->CashFlow(iCashFlow).pvKind == iPrValKind::Energy) { // make sure this is not water - auto curResource = CashFlow(iCashFlow).Resource; - if (CashFlow(iCashFlow).Resource == DataGlobalConstants::ResourceType::Water || - (CashFlow(iCashFlow).Resource >= DataGlobalConstants::ResourceType::OnSiteWater && CashFlow(iCashFlow).Resource <= DataGlobalConstants::ResourceType::Condensate)) { + auto curResource = elcc->CashFlow(iCashFlow).Resource; + if (elcc->CashFlow(iCashFlow).Resource == DataGlobalConstants::ResourceType::Water || + (elcc->CashFlow(iCashFlow).Resource >= DataGlobalConstants::ResourceType::OnSiteWater && elcc->CashFlow(iCashFlow).Resource <= DataGlobalConstants::ResourceType::Condensate)) { continue; } if ((curResource != DataGlobalConstants::ResourceType::None)) { int found = 0; - for (nUsePriceEsc = 1; nUsePriceEsc <= numUsePriceEscalation; ++nUsePriceEsc) { - if (UsePriceEscalation(nUsePriceEsc).resource == curResource) { + for (nUsePriceEsc = 1; nUsePriceEsc <= elcc->numUsePriceEscalation; ++nUsePriceEsc) { + if (elcc->UsePriceEscalation(nUsePriceEsc).resource == curResource) { found = nUsePriceEsc; break; } } if (found > 0) { - for (int jYear = 1; jYear <= lengthStudyYears; ++jYear) { - EscalatedEnergy.at(jYear).at(curResource) = CashFlow(iCashFlow).yrAmount(jYear) * UsePriceEscalation(found).Escalation(jYear); + for (int jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->EscalatedEnergy.at(jYear).at(curResource) = elcc->CashFlow(iCashFlow).yrAmount(jYear) * elcc->UsePriceEscalation(found).Escalation(jYear); } } else { // if no escalation than just store the original energy cost - for (int jYear = 1; jYear <= lengthStudyYears; ++jYear) { - EscalatedEnergy.at(jYear).at(curResource) = CashFlow(iCashFlow).yrAmount(jYear); + for (int jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->EscalatedEnergy.at(jYear).at(curResource) = elcc->CashFlow(iCashFlow).yrAmount(jYear); } } } } } for (auto kResource : DataGlobalConstants::AllResourceTypes) { - for (int jYear = 1; jYear <= lengthStudyYears; ++jYear) { - EscalatedTotEnergy(jYear) += EscalatedEnergy.at(jYear).at(kResource); + for (int jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->EscalatedTotEnergy(jYear) += elcc->EscalatedEnergy.at(jYear).at(kResource); } } } - void ComputePresentValue() + void ComputePresentValue(EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer of GARD Analytics, Inc. @@ -1616,153 +1443,155 @@ namespace EconomicLifeCycleCost { int nUsePriceEsc; Real64 effectiveYear; + auto &elcc(state.dataEconLifeCycleCost); + // identify how each cashflow should be treated - for (iCashFlow = 1; iCashFlow <= numCashFlow; ++iCashFlow) { + for (iCashFlow = 1; iCashFlow <= elcc->numCashFlow; ++iCashFlow) { { - auto const SELECT_CASE_var(CashFlow(iCashFlow).SourceKind); - if (SELECT_CASE_var == skResource) { + auto const SELECT_CASE_var(elcc->CashFlow(iCashFlow).SourceKind); + if (SELECT_CASE_var == iSourceKind::Resource) { // only for real fuels purchased such as electricity, natural gas, etc.. - if ((CashFlow(iCashFlow).Resource >= DataGlobalConstants::ResourceType::Electricity) && (CashFlow(iCashFlow).Resource <= DataGlobalConstants::ResourceType::ElectricitySurplusSold)) { - CashFlow(iCashFlow).pvKind = pvkEnergy; + if ((elcc->CashFlow(iCashFlow).Resource >= DataGlobalConstants::ResourceType::Electricity) && (elcc->CashFlow(iCashFlow).Resource <= DataGlobalConstants::ResourceType::ElectricitySurplusSold)) { + elcc->CashFlow(iCashFlow).pvKind = iPrValKind::Energy; } else { - CashFlow(iCashFlow).pvKind = pvkNonEnergy; + elcc->CashFlow(iCashFlow).pvKind = iPrValKind::NonEnergy; } - } else if ((SELECT_CASE_var == skRecurring) || (SELECT_CASE_var == skNonrecurring)) { - if (CashFlow(iCashFlow).Category == costCatEnergy) { - CashFlow(iCashFlow).pvKind = pvkEnergy; + } else if ((SELECT_CASE_var == iSourceKind::Recurring) || (SELECT_CASE_var == iSourceKind::Nonrecurring)) { + if (elcc->CashFlow(iCashFlow).Category == costCatEnergy) { + elcc->CashFlow(iCashFlow).pvKind = iPrValKind::Energy; } else { - CashFlow(iCashFlow).pvKind = pvkNonEnergy; + elcc->CashFlow(iCashFlow).pvKind = iPrValKind::NonEnergy; } - } else if (SELECT_CASE_var == skSum) { - CashFlow(iCashFlow).pvKind = pvkNotComputed; + } else if (SELECT_CASE_var == iSourceKind::Sum) { + elcc->CashFlow(iCashFlow).pvKind = iPrValKind::NotComputed; } else { - CashFlow(iCashFlow).pvKind = pvkNotComputed; + elcc->CashFlow(iCashFlow).pvKind = iPrValKind::NotComputed; } } } // compute the Single Present Value factors based on the discount rate - SPV.allocate(lengthStudyYears); - for (int year = 1; year <= lengthStudyYears; ++year) { + elcc->SPV.allocate(elcc->lengthStudyYears); + for (int year = 1; year <= elcc->lengthStudyYears; ++year) { std::map yearMap; for (auto iResource : DataGlobalConstants::AllResourceTypes) { yearMap.insert(std::pair (iResource, 0.0)); } - energySPV.insert(std::pair>(year, yearMap)); + elcc->energySPV.insert(std::pair>(year, yearMap)); } // Depending if using Constant or Current Dollar analysis // use the appropriate discount rate - if (inflationApproach == inflAppConstantDollar) { - curDiscountRate = realDiscountRate; - } else if (inflationApproach == inflAppCurrentDollar) { - curDiscountRate = nominalDiscountRate; + if (elcc->inflationApproach == iInflAppr::ConstantDollar) { + curDiscountRate = elcc->realDiscountRate; + } else if (elcc->inflationApproach == iInflAppr::CurrentDollar) { + curDiscountRate = elcc->nominalDiscountRate; } // compute single present values based on real discount rates - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { // NIST 155 D.2.1.1 - Single Present Value (SPV) formula { - auto const SELECT_CASE_var(discountConvension); - if (SELECT_CASE_var == disConvBeginOfYear) { + auto const SELECT_CASE_var(elcc->discountConvention); + if (SELECT_CASE_var == iDiscConv::BeginOfYear) { effectiveYear = double(jYear) - 1.0; - } else if (SELECT_CASE_var == disConvMidYear) { + } else if (SELECT_CASE_var == iDiscConv::MidYear) { effectiveYear = double(jYear) - 0.5; - } else if (SELECT_CASE_var == disConvEndOfYear) { + } else if (SELECT_CASE_var == iDiscConv::EndOfYear) { effectiveYear = double(jYear); } else { } } - SPV(jYear) = 1.0 / std::pow(1.0 + curDiscountRate, effectiveYear); + elcc->SPV(jYear) = 1.0 / std::pow(1.0 + curDiscountRate, effectiveYear); } // use SPV as default values for all energy types - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { for (auto kResource : DataGlobalConstants::AllResourceTypes) { - energySPV.at(jYear).at(kResource) = SPV(jYear); + elcc->energySPV.at(jYear).at(kResource) = elcc->SPV(jYear); } } // loop through the resources and if they match a UseEscalation use those values instead - for (nUsePriceEsc = 1; nUsePriceEsc <= numUsePriceEscalation; ++nUsePriceEsc) { - auto curResource = UsePriceEscalation(nUsePriceEsc).resource; + for (nUsePriceEsc = 1; nUsePriceEsc <= elcc->numUsePriceEscalation; ++nUsePriceEsc) { + auto curResource = elcc->UsePriceEscalation(nUsePriceEsc).resource; if (curResource != DataGlobalConstants::ResourceType::None) { - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { // the following is based on UPV* formula from NIST 135 supplement but is for a single year { - auto const SELECT_CASE_var(discountConvension); - if (SELECT_CASE_var == disConvBeginOfYear) { + auto const SELECT_CASE_var(elcc->discountConvention); + if (SELECT_CASE_var == iDiscConv::BeginOfYear) { effectiveYear = double(jYear) - 1.0; - } else if (SELECT_CASE_var == disConvMidYear) { + } else if (SELECT_CASE_var == iDiscConv::MidYear) { effectiveYear = double(jYear) - 0.5; - } else if (SELECT_CASE_var == disConvEndOfYear) { + } else if (SELECT_CASE_var == iDiscConv::EndOfYear) { effectiveYear = double(jYear); } else { } } - energySPV.at(jYear).at(curResource) = - UsePriceEscalation(nUsePriceEsc).Escalation(jYear) / std::pow(1.0 + curDiscountRate, effectiveYear); + elcc->energySPV.at(jYear).at(curResource) = + elcc->UsePriceEscalation(nUsePriceEsc).Escalation(jYear) / std::pow(1.0 + curDiscountRate, effectiveYear); } } } - for (iCashFlow = 1; iCashFlow <= numCashFlow; ++iCashFlow) { + for (iCashFlow = 1; iCashFlow <= elcc->numCashFlow; ++iCashFlow) { { - auto const SELECT_CASE_var(CashFlow(iCashFlow).pvKind); - if (SELECT_CASE_var == pvkNonEnergy) { + auto const SELECT_CASE_var(elcc->CashFlow(iCashFlow).pvKind); + if (SELECT_CASE_var == iPrValKind::NonEnergy) { totalPV = 0.0; - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { - CashFlow(iCashFlow).yrPresVal(jYear) = CashFlow(iCashFlow).yrAmount(jYear) * SPV(jYear); - totalPV += CashFlow(iCashFlow).yrPresVal(jYear); + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->CashFlow(iCashFlow).yrPresVal(jYear) = elcc->CashFlow(iCashFlow).yrAmount(jYear) * elcc->SPV(jYear); + totalPV += elcc->CashFlow(iCashFlow).yrPresVal(jYear); } - CashFlow(iCashFlow).presentValue = totalPV; - } else if (SELECT_CASE_var == pvkEnergy) { - auto curResource = CashFlow(iCashFlow).Resource; + elcc->CashFlow(iCashFlow).presentValue = totalPV; + } else if (SELECT_CASE_var == iPrValKind::Energy) { + auto curResource = elcc->CashFlow(iCashFlow).Resource; if (curResource != DataGlobalConstants::ResourceType::None) { totalPV = 0.0; - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { - CashFlow(iCashFlow).yrPresVal(jYear) = CashFlow(iCashFlow).yrAmount(jYear) * energySPV.at(jYear).at(curResource); - totalPV += CashFlow(iCashFlow).yrPresVal(jYear); + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->CashFlow(iCashFlow).yrPresVal(jYear) = elcc->CashFlow(iCashFlow).yrAmount(jYear) * elcc->energySPV.at(jYear).at(curResource); + totalPV += elcc->CashFlow(iCashFlow).yrPresVal(jYear); } - CashFlow(iCashFlow).presentValue = totalPV; + elcc->CashFlow(iCashFlow).presentValue = totalPV; } - } else if (SELECT_CASE_var == pvkNotComputed) { + } else if (SELECT_CASE_var == iPrValKind::NotComputed) { // do nothing } } } // sum by category for (int i = 1; i <= countOfCostCat; ++i) { - CashFlow(i).presentValue = 0; // initialize value to zero before summing in next for loop + elcc->CashFlow(i).presentValue = 0; // initialize value to zero before summing in next for loop } - for (iCashFlow = countOfCostCat + 1; iCashFlow <= numCashFlow; ++iCashFlow) { - curCategory = CashFlow(iCashFlow).Category; + for (iCashFlow = countOfCostCat + 1; iCashFlow <= elcc->numCashFlow; ++iCashFlow) { + curCategory = elcc->CashFlow(iCashFlow).Category; if ((curCategory <= countOfCostCat) && (curCategory >= 1)) { - CashFlow(curCategory).presentValue += CashFlow(iCashFlow).presentValue; - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { - CashFlow(curCategory).yrPresVal(jYear) += CashFlow(iCashFlow).yrPresVal(jYear); + elcc->CashFlow(curCategory).presentValue += elcc->CashFlow(iCashFlow).presentValue; + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->CashFlow(curCategory).yrPresVal(jYear) += elcc->CashFlow(iCashFlow).yrPresVal(jYear); } } } // create total categories - CashFlow(costCatTotEnergy).presentValue = CashFlow(costCatEnergy).presentValue; - CashFlow(costCatTotOper).presentValue = - CashFlow(costCatMaintenance).presentValue + CashFlow(costCatRepair).presentValue + CashFlow(costCatOperation).presentValue + - CashFlow(costCatReplacement).presentValue + CashFlow(costCatMinorOverhaul).presentValue + CashFlow(costCatMajorOverhaul).presentValue + - CashFlow(costCatOtherOperational).presentValue + CashFlow(costCatWater).presentValue + CashFlow(costCatEnergy).presentValue; - CashFlow(costCatTotCaptl).presentValue = - CashFlow(costCatConstruction).presentValue + CashFlow(costCatSalvage).presentValue + CashFlow(costCatOtherCapital).presentValue; - CashFlow(costCatTotGrand).presentValue = CashFlow(costCatTotOper).presentValue + CashFlow(costCatTotCaptl).presentValue; - for (jYear = 1; jYear <= lengthStudyYears; ++jYear) { - CashFlow(costCatTotEnergy).yrPresVal(jYear) = CashFlow(costCatEnergy).yrPresVal(jYear); - CashFlow(costCatTotOper).yrPresVal(jYear) = CashFlow(costCatMaintenance).yrPresVal(jYear) + CashFlow(costCatRepair).yrPresVal(jYear) + - CashFlow(costCatOperation).yrPresVal(jYear) + CashFlow(costCatReplacement).yrPresVal(jYear) + - CashFlow(costCatMinorOverhaul).yrPresVal(jYear) + - CashFlow(costCatMajorOverhaul).yrPresVal(jYear) + - CashFlow(costCatOtherOperational).yrPresVal(jYear) + CashFlow(costCatWater).yrPresVal(jYear) + - CashFlow(costCatEnergy).yrPresVal(jYear); - CashFlow(costCatTotCaptl).yrPresVal(jYear) = CashFlow(costCatConstruction).yrPresVal(jYear) + CashFlow(costCatSalvage).yrPresVal(jYear) + - CashFlow(costCatOtherCapital).yrPresVal(jYear); - CashFlow(costCatTotGrand).yrPresVal(jYear) = CashFlow(costCatTotOper).yrPresVal(jYear) + CashFlow(costCatTotCaptl).yrPresVal(jYear); + elcc->CashFlow(costCatTotEnergy).presentValue = elcc->CashFlow(costCatEnergy).presentValue; + elcc->CashFlow(costCatTotOper).presentValue = + elcc->CashFlow(costCatMaintenance).presentValue + elcc->CashFlow(costCatRepair).presentValue + elcc->CashFlow(costCatOperation).presentValue + + elcc->CashFlow(costCatReplacement).presentValue + elcc->CashFlow(costCatMinorOverhaul).presentValue + elcc->CashFlow(costCatMajorOverhaul).presentValue + + elcc->CashFlow(costCatOtherOperational).presentValue + elcc->CashFlow(costCatWater).presentValue + elcc->CashFlow(costCatEnergy).presentValue; + elcc->CashFlow(costCatTotCaptl).presentValue = + elcc->CashFlow(costCatConstruction).presentValue + elcc->CashFlow(costCatSalvage).presentValue + elcc->CashFlow(costCatOtherCapital).presentValue; + elcc->CashFlow(costCatTotGrand).presentValue = elcc->CashFlow(costCatTotOper).presentValue + elcc->CashFlow(costCatTotCaptl).presentValue; + for (jYear = 1; jYear <= elcc->lengthStudyYears; ++jYear) { + elcc->CashFlow(costCatTotEnergy).yrPresVal(jYear) = elcc->CashFlow(costCatEnergy).yrPresVal(jYear); + elcc->CashFlow(costCatTotOper).yrPresVal(jYear) = elcc->CashFlow(costCatMaintenance).yrPresVal(jYear) + elcc->CashFlow(costCatRepair).yrPresVal(jYear) + + elcc->CashFlow(costCatOperation).yrPresVal(jYear) + elcc->CashFlow(costCatReplacement).yrPresVal(jYear) + + elcc->CashFlow(costCatMinorOverhaul).yrPresVal(jYear) + + elcc->CashFlow(costCatMajorOverhaul).yrPresVal(jYear) + + elcc->CashFlow(costCatOtherOperational).yrPresVal(jYear) + elcc->CashFlow(costCatWater).yrPresVal(jYear) + + elcc->CashFlow(costCatEnergy).yrPresVal(jYear); + elcc->CashFlow(costCatTotCaptl).yrPresVal(jYear) = elcc->CashFlow(costCatConstruction).yrPresVal(jYear) + elcc->CashFlow(costCatSalvage).yrPresVal(jYear) + + elcc->CashFlow(costCatOtherCapital).yrPresVal(jYear); + elcc->CashFlow(costCatTotGrand).yrPresVal(jYear) = elcc->CashFlow(costCatTotOper).yrPresVal(jYear) + elcc->CashFlow(costCatTotCaptl).yrPresVal(jYear); } } - void ComputeTaxAndDepreciation() + void ComputeTaxAndDepreciation(EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer of GARD Analytics, Inc. @@ -1801,11 +1630,13 @@ namespace EconomicLifeCycleCost { int iYear; int jYear; - DepreciatedCapital.allocate(lengthStudyYears); - TaxableIncome.allocate(lengthStudyYears); - Taxes.allocate(lengthStudyYears); - AfterTaxCashFlow.allocate(lengthStudyYears); - AfterTaxPresentValue.allocate(lengthStudyYears); + auto &elcc(state.dataEconLifeCycleCost); + + elcc->DepreciatedCapital.allocate(elcc->lengthStudyYears); + elcc->TaxableIncome.allocate(elcc->lengthStudyYears); + elcc->Taxes.allocate(elcc->lengthStudyYears); + elcc->AfterTaxCashFlow.allocate(elcc->lengthStudyYears); + elcc->AfterTaxPresentValue.allocate(elcc->lengthStudyYears); // Depreciation factors are based on IRS Publication 946 for 2009 "How to Depreciate Property" // The MACRS valus are based on Modified Accelerated Cost Recovery System GDS for 3, 5, 7, 10 year @@ -1818,20 +1649,20 @@ namespace EconomicLifeCycleCost { // the June value was used. DepreciationPercent = 0.0; // default all values to zero { - auto const SELECT_CASE_var(depreciationMethod); - if (SELECT_CASE_var == depMethMACRS3) { // IRS Publication 946 for 2009 Table A-1 + auto const SELECT_CASE_var(elcc->depreciationMethod); + if (SELECT_CASE_var == iDeprMethod::MACRS3) { // IRS Publication 946 for 2009 Table A-1 DepreciationPercent(1) = 33.33; DepreciationPercent(2) = 44.45; DepreciationPercent(3) = 14.81; DepreciationPercent(4) = 7.41; - } else if (SELECT_CASE_var == depMethMACRS5) { // IRS Publication 946 for 2009 Table A-1 + } else if (SELECT_CASE_var == iDeprMethod::MACRS5) { // IRS Publication 946 for 2009 Table A-1 DepreciationPercent(1) = 20.0; DepreciationPercent(2) = 32.0; DepreciationPercent(3) = 19.2; DepreciationPercent(4) = 11.52; DepreciationPercent(5) = 11.52; DepreciationPercent(6) = 5.76; - } else if (SELECT_CASE_var == depMethMACRS7) { // IRS Publication 946 for 2009 Table A-1 + } else if (SELECT_CASE_var == iDeprMethod::MACRS7) { // IRS Publication 946 for 2009 Table A-1 DepreciationPercent(1) = 14.29; DepreciationPercent(2) = 24.49; DepreciationPercent(3) = 17.49; @@ -1840,7 +1671,7 @@ namespace EconomicLifeCycleCost { DepreciationPercent(6) = 8.92; DepreciationPercent(7) = 8.93; DepreciationPercent(8) = 4.46; - } else if (SELECT_CASE_var == depMethMACRS10) { // IRS Publication 946 for 2009 Table A-1 + } else if (SELECT_CASE_var == iDeprMethod::MACRS10) { // IRS Publication 946 for 2009 Table A-1 DepreciationPercent(1) = 10.0; DepreciationPercent(2) = 18.0; DepreciationPercent(3) = 14.4; @@ -1852,7 +1683,7 @@ namespace EconomicLifeCycleCost { DepreciationPercent(9) = 6.56; DepreciationPercent(10) = 6.55; DepreciationPercent(11) = 3.28; - } else if (SELECT_CASE_var == depMethMACRS15) { // IRS Publication 946 for 2009 Table A-1 + } else if (SELECT_CASE_var == iDeprMethod::MACRS15) { // IRS Publication 946 for 2009 Table A-1 DepreciationPercent(1) = 5.0; DepreciationPercent(2) = 9.5; DepreciationPercent(3) = 8.55; @@ -1869,7 +1700,7 @@ namespace EconomicLifeCycleCost { DepreciationPercent(14) = 5.9; DepreciationPercent(15) = 5.91; DepreciationPercent(16) = 2.95; - } else if (SELECT_CASE_var == depMethMACRS20) { // IRS Publication 946 for 2009 Table A-1 + } else if (SELECT_CASE_var == iDeprMethod::MACRS20) { // IRS Publication 946 for 2009 Table A-1 DepreciationPercent(1) = 3.75; DepreciationPercent(2) = 7.219; DepreciationPercent(3) = 6.677; @@ -1891,7 +1722,7 @@ namespace EconomicLifeCycleCost { DepreciationPercent(19) = 4.462; DepreciationPercent(20) = 4.461; DepreciationPercent(21) = 2.231; - } else if (SELECT_CASE_var == depMethStraight27) { // IRS Publication 946 for 2009 Table A-6 (June) + } else if (SELECT_CASE_var == iDeprMethod::Straight27) { // IRS Publication 946 for 2009 Table A-6 (June) DepreciationPercent(1) = 1.97; DepreciationPercent(2) = 3.636; DepreciationPercent(3) = 3.636; @@ -1920,7 +1751,7 @@ namespace EconomicLifeCycleCost { DepreciationPercent(26) = 3.637; DepreciationPercent(27) = 3.636; DepreciationPercent(28) = 3.485; - } else if (SELECT_CASE_var == depMethStraight31) { // IRS Publication 946 for 2009 Table A-7 (June) + } else if (SELECT_CASE_var == iDeprMethod::Straight31) { // IRS Publication 946 for 2009 Table A-7 (June) DepreciationPercent(1) = 1.72; DepreciationPercent(2) = 3.175; DepreciationPercent(3) = 3.175; @@ -1953,7 +1784,7 @@ namespace EconomicLifeCycleCost { DepreciationPercent(30) = 3.174; DepreciationPercent(31) = 3.175; DepreciationPercent(32) = 3.042; - } else if (SELECT_CASE_var == depMethStraight39) { // IRS Publication 946 for 2009 Table A-7a (June) + } else if (SELECT_CASE_var == iDeprMethod::Straight39) { // IRS Publication 946 for 2009 Table A-7a (June) DepreciationPercent(1) = 1.391; DepreciationPercent(2) = 2.564; DepreciationPercent(3) = 2.564; @@ -1994,7 +1825,7 @@ namespace EconomicLifeCycleCost { DepreciationPercent(38) = 2.564; DepreciationPercent(39) = 2.564; DepreciationPercent(40) = 1.177; - } else if (SELECT_CASE_var == depMethStraight40) { // IRS Publication 946 for 2009 Table A-13 (June) + } else if (SELECT_CASE_var == iDeprMethod::Straight40) { // IRS Publication 946 for 2009 Table A-13 (June) DepreciationPercent(1) = 1.354; DepreciationPercent(2) = 2.5; DepreciationPercent(3) = 2.5; @@ -2039,13 +1870,13 @@ namespace EconomicLifeCycleCost { } } // convert construction costs (not salvage) into depreciation - DepreciatedCapital = 0.0; // set all years to zero - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - curCapital = CashFlow(costCatConstruction).yrAmount(iYear) + CashFlow(costCatOtherCapital).yrAmount(iYear); + elcc->DepreciatedCapital = 0.0; // set all years to zero + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + curCapital = elcc->CashFlow(costCatConstruction).yrAmount(iYear) + elcc->CashFlow(costCatOtherCapital).yrAmount(iYear); for (jYear = 1; jYear <= SizeDepr; ++jYear) { curDepYear = iYear + jYear - 1; // start depreciating with the year that the capital was shown and go to years following - if (curDepYear <= lengthStudyYears) { - DepreciatedCapital(curDepYear) += curCapital * (DepreciationPercent(jYear) / 100); + if (curDepYear <= elcc->lengthStudyYears) { + elcc->DepreciatedCapital(curDepYear) += curCapital * (DepreciationPercent(jYear) / 100); } } } @@ -2055,12 +1886,12 @@ namespace EconomicLifeCycleCost { // taxable income (before-tax cash flow - depreciation) // income taxes (taxable income x incremental tax rate) // after-tax cash flow (before-tax cash flow - income taxes) - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - TaxableIncome(iYear) = CashFlow(costCatTotGrand).yrAmount(iYear) - DepreciatedCapital(iYear); - Taxes(iYear) = TaxableIncome(iYear) * taxRate; - AfterTaxCashFlow(iYear) = CashFlow(costCatTotGrand).yrAmount(iYear) - Taxes(iYear); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + elcc->TaxableIncome(iYear) = elcc->CashFlow(costCatTotGrand).yrAmount(iYear) - elcc->DepreciatedCapital(iYear); + elcc->Taxes(iYear) = elcc->TaxableIncome(iYear) * elcc->taxRate; + elcc->AfterTaxCashFlow(iYear) = elcc->CashFlow(costCatTotGrand).yrAmount(iYear) - elcc->Taxes(iYear); // the present value after taxes is pretax present value minus the present value of the taxes - AfterTaxPresentValue(iYear) = CashFlow(costCatTotGrand).yrPresVal(iYear) - Taxes(iYear) * SPV(iYear); + elcc->AfterTaxPresentValue(iYear) = elcc->CashFlow(costCatTotGrand).yrPresVal(iYear) - elcc->Taxes(iYear) * elcc->SPV(iYear); } } @@ -2125,7 +1956,9 @@ namespace EconomicLifeCycleCost { int numYears; Real64 totalPV; - if (LCCparamPresent && state.dataOutRptTab->displayLifeCycleCostReport) { + auto &elcc(state.dataEconLifeCycleCost); + + if (elcc->LCCparamPresent && state.dataOutRptTab->displayLifeCycleCostReport) { //--------------------------------- // Life-Cycle Cost Verification and Results Report //--------------------------------- @@ -2149,61 +1982,61 @@ namespace EconomicLifeCycleCost { rowHead(11) = "Depreciation Method"; columnHead(1) = "Value"; - tableBody(1, 1) = LCCname; - if (discountConvension == disConvEndOfYear) { + tableBody(1, 1) = elcc->LCCname; + if (elcc->discountConvention == iDiscConv::EndOfYear) { tableBody(1, 2) = "EndOfYear"; - } else if (discountConvension == disConvMidYear) { + } else if (elcc->discountConvention == iDiscConv::MidYear) { tableBody(1, 2) = "MidYear"; - } else if (discountConvension == disConvBeginOfYear) { + } else if (elcc->discountConvention == iDiscConv::BeginOfYear) { tableBody(1, 2) = "BeginningOfYear"; } - if (inflationApproach == inflAppConstantDollar) { + if (elcc->inflationApproach == iInflAppr::ConstantDollar) { tableBody(1, 3) = "ConstantDollar"; - } else if (inflationApproach == inflAppCurrentDollar) { + } else if (elcc->inflationApproach == iInflAppr::CurrentDollar) { tableBody(1, 3) = "CurrentDollar"; } - if (inflationApproach == inflAppConstantDollar) { - tableBody(1, 4) = RealToStr(realDiscountRate, 4); + if (elcc->inflationApproach == iInflAppr::ConstantDollar) { + tableBody(1, 4) = RealToStr(elcc->realDiscountRate, 4); } else { tableBody(1, 4) = "-- N/A --"; } - if (inflationApproach == inflAppCurrentDollar) { - tableBody(1, 5) = RealToStr(nominalDiscountRate, 4); + if (elcc->inflationApproach == iInflAppr::CurrentDollar) { + tableBody(1, 5) = RealToStr(elcc->nominalDiscountRate, 4); } else { tableBody(1, 5) = "-- N/A --"; } - if (inflationApproach == inflAppCurrentDollar) { - tableBody(1, 6) = RealToStr(inflation, 4); + if (elcc->inflationApproach == iInflAppr::CurrentDollar) { + tableBody(1, 6) = RealToStr(elcc->inflation, 4); } else { tableBody(1, 6) = "-- N/A --"; } - tableBody(1, 7) = format("{} {}", MonthNames(baseDateMonth), baseDateYear); - tableBody(1, 8) = format("{} {}", MonthNames(serviceDateMonth), serviceDateYear); - tableBody(1, 9) = fmt::to_string(lengthStudyYears); - tableBody(1, 10) = RealToStr(taxRate, 4); + tableBody(1, 7) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear); + tableBody(1, 8) = format("{} {}", MonthNames(elcc->serviceDateMonth), elcc->serviceDateYear); + tableBody(1, 9) = fmt::to_string(elcc->lengthStudyYears); + tableBody(1, 10) = RealToStr(elcc->taxRate, 4); { - auto const SELECT_CASE_var(depreciationMethod); - if (SELECT_CASE_var == depMethMACRS3) { + auto const SELECT_CASE_var(elcc->depreciationMethod); + if (SELECT_CASE_var == iDeprMethod::MACRS3) { tableBody(1, 11) = "ModifiedAcceleratedCostRecoverySystem-3year"; - } else if (SELECT_CASE_var == depMethMACRS5) { + } else if (SELECT_CASE_var == iDeprMethod::MACRS5) { tableBody(1, 11) = "ModifiedAcceleratedCostRecoverySystem-5year"; - } else if (SELECT_CASE_var == depMethMACRS7) { + } else if (SELECT_CASE_var == iDeprMethod::MACRS7) { tableBody(1, 11) = "ModifiedAcceleratedCostRecoverySystem-7year"; - } else if (SELECT_CASE_var == depMethMACRS10) { + } else if (SELECT_CASE_var == iDeprMethod::MACRS10) { tableBody(1, 11) = "ModifiedAcceleratedCostRecoverySystem-10year"; - } else if (SELECT_CASE_var == depMethMACRS15) { + } else if (SELECT_CASE_var == iDeprMethod::MACRS15) { tableBody(1, 11) = "ModifiedAcceleratedCostRecoverySystem-15year"; - } else if (SELECT_CASE_var == depMethMACRS20) { + } else if (SELECT_CASE_var == iDeprMethod::MACRS20) { tableBody(1, 11) = "ModifiedAcceleratedCostRecoverySystem-20year"; - } else if (SELECT_CASE_var == depMethStraight27) { + } else if (SELECT_CASE_var == iDeprMethod::Straight27) { tableBody(1, 11) = "StraightLine-27year"; - } else if (SELECT_CASE_var == depMethStraight31) { + } else if (SELECT_CASE_var == iDeprMethod::Straight31) { tableBody(1, 11) = "StraightLine-31year"; - } else if (SELECT_CASE_var == depMethStraight39) { + } else if (SELECT_CASE_var == iDeprMethod::Straight39) { tableBody(1, 11) = "StraightLine-39year"; - } else if (SELECT_CASE_var == depMethStraight40) { + } else if (SELECT_CASE_var == iDeprMethod::Straight40) { tableBody(1, 11) = "StraightLine-40year"; - } else if (SELECT_CASE_var == depMethNone) { + } else if (SELECT_CASE_var == iDeprMethod::None) { tableBody(1, 11) = "None"; } } @@ -2224,27 +2057,27 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Use Price Escalation - numColumns = max(1, numUsePriceEscalation); - rowHead.allocate(lengthStudyYears + 2); + numColumns = max(1, elcc->numUsePriceEscalation); + rowHead.allocate(elcc->lengthStudyYears + 2); columnHead.allocate(numColumns); columnWidth.dimension(numColumns, 14); // array assignment - same for all columns - tableBody.allocate(numColumns, lengthStudyYears + 2); + tableBody.allocate(numColumns, elcc->lengthStudyYears + 2); tableBody = ""; columnHead = "none"; rowHead(1) = "Resource"; rowHead(2) = "Start Date"; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { rowHead(iYear + 2) = fmt::to_string(iYear); } - for (jObj = 1; jObj <= numUsePriceEscalation; ++jObj) { // loop through objects not columns to add names - columnHead(jObj) = UsePriceEscalation(jObj).name; - tableBody(jObj, 1) = GetResourceTypeChar(UsePriceEscalation(jObj).resource); + for (jObj = 1; jObj <= elcc->numUsePriceEscalation; ++jObj) { // loop through objects not columns to add names + columnHead(jObj) = elcc->UsePriceEscalation(jObj).name; + tableBody(jObj, 1) = GetResourceTypeChar(elcc->UsePriceEscalation(jObj).resource); tableBody(jObj, 2) = - format("{} {}", MonthNames(UsePriceEscalation(jObj).escalationStartMonth), UsePriceEscalation(jObj).escalationStartYear); + format("{} {}", MonthNames(elcc->UsePriceEscalation(jObj).escalationStartMonth), elcc->UsePriceEscalation(jObj).escalationStartYear); } - for (jObj = 1; jObj <= numUsePriceEscalation; ++jObj) { - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - tableBody(jObj, iYear + 2) = RealToStr(UsePriceEscalation(jObj).Escalation(iYear), 6); + for (jObj = 1; jObj <= elcc->numUsePriceEscalation; ++jObj) { + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + tableBody(jObj, iYear + 2) = RealToStr(elcc->UsePriceEscalation(jObj).Escalation(iYear), 6); } } WriteSubtitle(state, "Use Price Escalation"); @@ -2262,9 +2095,9 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Use Adjustment - if (numUseAdjustment >= 1) { // only create table if objects used - numColumns = max(1, numUseAdjustment); - numYears = lengthStudyYears - (serviceDateYear - baseDateYear); + if (elcc->numUseAdjustment >= 1) { // only create table if objects used + numColumns = max(1, elcc->numUseAdjustment); + numYears = elcc->lengthStudyYears - (elcc->serviceDateYear - elcc->baseDateYear); rowHead.allocate(numYears + 1); columnHead.allocate(numColumns); columnWidth.dimension(numColumns, 14); // array assignment - same for all columns @@ -2273,15 +2106,15 @@ namespace EconomicLifeCycleCost { columnHead = "none"; rowHead(1) = ""; for (iYear = 1; iYear <= numYears; ++iYear) { - rowHead(iYear + 1) = format("{} {}", MonthNames(serviceDateMonth), serviceDateYear + iYear - 1); + rowHead(iYear + 1) = format("{} {}", MonthNames(elcc->serviceDateMonth), elcc->serviceDateYear + iYear - 1); } - for (jObj = 1; jObj <= numUseAdjustment; ++jObj) { // loop through objects not columns to add names - columnHead(jObj) = UseAdjustment(jObj).name; - tableBody(jObj, 1) = GetResourceTypeChar(UseAdjustment(jObj).resource); + for (jObj = 1; jObj <= elcc->numUseAdjustment; ++jObj) { // loop through objects not columns to add names + columnHead(jObj) = elcc->UseAdjustment(jObj).name; + tableBody(jObj, 1) = GetResourceTypeChar(elcc->UseAdjustment(jObj).resource); } - for (jObj = 1; jObj <= numUseAdjustment; ++jObj) { + for (jObj = 1; jObj <= elcc->numUseAdjustment; ++jObj) { for (iYear = 1; iYear <= numYears; ++iYear) { - tableBody(jObj, iYear + 1) = RealToStr(UseAdjustment(jObj).Adjustment(iYear), 6); + tableBody(jObj, iYear + 1) = RealToStr(elcc->UseAdjustment(jObj).Adjustment(iYear), 6); } } WriteSubtitle(state, "Use Adjustment"); @@ -2300,29 +2133,29 @@ namespace EconomicLifeCycleCost { tableBody.deallocate(); } //---- Cash Flow for Recurring and Nonrecurring Costs - numColumns = max(1, numRecurringCosts + numNonrecurringCost); - rowHead.allocate(lengthStudyYears + 1); + numColumns = max(1, elcc->numRecurringCosts + elcc->numNonrecurringCost); + rowHead.allocate(elcc->lengthStudyYears + 1); columnHead.allocate(numColumns); columnWidth.dimension(numColumns, 14); // array assignment - same for all columns - tableBody.allocate(numColumns, lengthStudyYears + 1); + tableBody.allocate(numColumns, elcc->lengthStudyYears + 1); tableBody = ""; rowHead(1) = ""; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear + 1) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear + 1) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); } - for (jObj = 1; jObj <= (numRecurringCosts + numNonrecurringCost); ++jObj) { + for (jObj = 1; jObj <= (elcc->numRecurringCosts + elcc->numNonrecurringCost); ++jObj) { curCashFlow = countOfCostCat + jObj; - columnHead(jObj) = CashFlow(curCashFlow).name; + columnHead(jObj) = elcc->CashFlow(curCashFlow).name; { - auto const SELECT_CASE_var(CashFlow(curCashFlow).SourceKind); - if (SELECT_CASE_var == skNonrecurring) { + auto const SELECT_CASE_var(elcc->CashFlow(curCashFlow).SourceKind); + if (SELECT_CASE_var == iSourceKind::Nonrecurring) { tableBody(jObj, 1) = "Nonrecurring"; - } else if (SELECT_CASE_var == skRecurring) { + } else if (SELECT_CASE_var == iSourceKind::Recurring) { tableBody(jObj, 1) = "Recurring"; } } - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - tableBody(jObj, iYear + 1) = RealToStr(CashFlow(curCashFlow).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + tableBody(jObj, iYear + 1) = RealToStr(elcc->CashFlow(curCashFlow).yrAmount(iYear), 2); } } WriteSubtitle(state, "Cash Flow for Recurring and Nonrecurring Costs (Without Escalation)"); @@ -2349,25 +2182,25 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Energy and Water Cost Cash Flows (Without Escalation) - numColumns = max(1, numResourcesUsed + 1); - rowHead.allocate(lengthStudyYears); + numColumns = max(1, elcc->numResourcesUsed + 1); + rowHead.allocate(elcc->lengthStudyYears); columnHead.allocate(numColumns); columnWidth.dimension(numColumns, 14); // array assignment - same for all columns - tableBody.allocate(numColumns, lengthStudyYears); + tableBody.allocate(numColumns, elcc->lengthStudyYears); tableBody = ""; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); - } - for (jObj = 1; jObj <= numResourcesUsed; ++jObj) { - curCashFlow = countOfCostCat + numRecurringCosts + numNonrecurringCost + jObj; - columnHead(jObj) = CashFlow(curCashFlow).name; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - tableBody(jObj, iYear) = RealToStr(CashFlow(curCashFlow).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); + } + for (jObj = 1; jObj <= elcc->numResourcesUsed; ++jObj) { + curCashFlow = countOfCostCat + elcc->numRecurringCosts + elcc->numNonrecurringCost + jObj; + columnHead(jObj) = elcc->CashFlow(curCashFlow).name; + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + tableBody(jObj, iYear) = RealToStr(elcc->CashFlow(curCashFlow).yrAmount(iYear), 2); } } columnHead(numColumns) = "Total"; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - tableBody(jObj, iYear) = RealToStr(CashFlow(costCatTotEnergy).yrAmount(iYear) + CashFlow(costCatWater).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + tableBody(jObj, iYear) = RealToStr(elcc->CashFlow(costCatTotEnergy).yrAmount(iYear) + elcc->CashFlow(costCatWater).yrAmount(iYear), 2); } WriteSubtitle(state, "Energy and Water Cost Cash Flows (Without Escalation)"); WriteTable(state, tableBody, rowHead, columnHead, columnWidth); @@ -2392,32 +2225,32 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Energy and Water Cost Cash Flows (With Escalation) - numColumns = max(1, numResourcesUsed + 1); - rowHead.allocate(lengthStudyYears); + numColumns = max(1, elcc->numResourcesUsed + 1); + rowHead.allocate(elcc->lengthStudyYears); columnHead.allocate(numColumns); columnWidth.dimension(numColumns, 14); // array assignment - same for all columns - tableBody.allocate(numColumns, lengthStudyYears); + tableBody.allocate(numColumns, elcc->lengthStudyYears); tableBody = ""; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); - } - for (int jObj = 1; jObj <= numResourcesUsed; ++jObj) { - curCashFlow = countOfCostCat + numRecurringCosts + numNonrecurringCost + jObj; - columnHead(jObj) = CashFlow(curCashFlow).name; - auto curResource = CashFlow(curCashFlow).Resource; - if (CashFlow(curCashFlow).Resource != DataGlobalConstants::ResourceType::Water) { - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - tableBody(jObj, iYear) = RealToStr(EscalatedEnergy.at(iYear).at(curResource), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); + } + for (jObj = 1; jObj <= elcc->numResourcesUsed; ++jObj) { + curCashFlow = countOfCostCat + elcc->numRecurringCosts + elcc->numNonrecurringCost + jObj; + columnHead(jObj) = elcc->CashFlow(curCashFlow).name; + auto curResource = elcc->CashFlow(curCashFlow).Resource; + if (elcc->CashFlow(curCashFlow).Resource != DataGlobalConstants::ResourceType::Water) { + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + tableBody(jObj, iYear) = RealToStr(elcc->EscalatedEnergy.at(iYear).at(curResource), 2); } } else { // for water just use the original cashflow since not involved in escalation - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - tableBody(jObj, iYear) = RealToStr(CashFlow(curCashFlow).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + tableBody(jObj, iYear) = RealToStr(elcc->CashFlow(curCashFlow).yrAmount(iYear), 2); } } } columnHead(numColumns) = "Total"; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - tableBody(jObj, iYear) = RealToStr(EscalatedTotEnergy(iYear) + CashFlow(costCatWater).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + tableBody(jObj, iYear) = RealToStr(elcc->EscalatedTotEnergy(iYear) + elcc->CashFlow(costCatWater).yrAmount(iYear), 2); } WriteSubtitle(state, "Energy and Water Cost Cash Flows (With Escalation)"); WriteTable(state, tableBody, rowHead, columnHead, columnWidth); @@ -2443,22 +2276,22 @@ namespace EconomicLifeCycleCost { tableBody.deallocate(); //---- Capital Cash Flow by Category - rowHead.allocate(lengthStudyYears); + rowHead.allocate(elcc->lengthStudyYears); columnHead.allocate(4); columnWidth.allocate(4); columnWidth = 14; // array assignment - same for all columns - tableBody.allocate(4, lengthStudyYears); + tableBody.allocate(4, elcc->lengthStudyYears); tableBody = ""; columnHead(1) = "Construction"; columnHead(2) = "Salvage"; columnHead(3) = "OtherCapital"; columnHead(4) = "Total"; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); - tableBody(1, iYear) = RealToStr(CashFlow(costCatConstruction).yrAmount(iYear), 2); - tableBody(2, iYear) = RealToStr(CashFlow(costCatSalvage).yrAmount(iYear), 2); - tableBody(3, iYear) = RealToStr(CashFlow(costCatOtherCapital).yrAmount(iYear), 2); - tableBody(4, iYear) = RealToStr(CashFlow(costCatTotCaptl).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); + tableBody(1, iYear) = RealToStr(elcc->CashFlow(costCatConstruction).yrAmount(iYear), 2); + tableBody(2, iYear) = RealToStr(elcc->CashFlow(costCatSalvage).yrAmount(iYear), 2); + tableBody(3, iYear) = RealToStr(elcc->CashFlow(costCatOtherCapital).yrAmount(iYear), 2); + tableBody(4, iYear) = RealToStr(elcc->CashFlow(costCatTotCaptl).yrAmount(iYear), 2); } WriteSubtitle(state, "Capital Cash Flow by Category (Without Escalation)"); WriteTable(state, tableBody, rowHead, columnHead, columnWidth); @@ -2483,11 +2316,11 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Operating Cash Flow by Category (Without Escalation) - rowHead.allocate(lengthStudyYears); + rowHead.allocate(elcc->lengthStudyYears); columnHead.allocate(10); columnWidth.allocate(10); columnWidth = 14; // array assignment - same for all columns - tableBody.allocate(10, lengthStudyYears); + tableBody.allocate(10, elcc->lengthStudyYears); tableBody = ""; columnHead(1) = "Energy"; columnHead(2) = "Water"; @@ -2500,18 +2333,18 @@ namespace EconomicLifeCycleCost { columnHead(9) = "OtherOperational"; columnHead(10) = "Total"; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); - tableBody(1, iYear) = RealToStr(CashFlow(costCatEnergy).yrAmount(iYear), 2); - tableBody(2, iYear) = RealToStr(CashFlow(costCatWater).yrAmount(iYear), 2); - tableBody(3, iYear) = RealToStr(CashFlow(costCatMaintenance).yrAmount(iYear), 2); - tableBody(4, iYear) = RealToStr(CashFlow(costCatRepair).yrAmount(iYear), 2); - tableBody(5, iYear) = RealToStr(CashFlow(costCatOperation).yrAmount(iYear), 2); - tableBody(6, iYear) = RealToStr(CashFlow(costCatReplacement).yrAmount(iYear), 2); - tableBody(7, iYear) = RealToStr(CashFlow(costCatMinorOverhaul).yrAmount(iYear), 2); - tableBody(8, iYear) = RealToStr(CashFlow(costCatMajorOverhaul).yrAmount(iYear), 2); - tableBody(9, iYear) = RealToStr(CashFlow(costCatOtherOperational).yrAmount(iYear), 2); - tableBody(10, iYear) = RealToStr(CashFlow(costCatTotOper).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); + tableBody(1, iYear) = RealToStr(elcc->CashFlow(costCatEnergy).yrAmount(iYear), 2); + tableBody(2, iYear) = RealToStr(elcc->CashFlow(costCatWater).yrAmount(iYear), 2); + tableBody(3, iYear) = RealToStr(elcc->CashFlow(costCatMaintenance).yrAmount(iYear), 2); + tableBody(4, iYear) = RealToStr(elcc->CashFlow(costCatRepair).yrAmount(iYear), 2); + tableBody(5, iYear) = RealToStr(elcc->CashFlow(costCatOperation).yrAmount(iYear), 2); + tableBody(6, iYear) = RealToStr(elcc->CashFlow(costCatReplacement).yrAmount(iYear), 2); + tableBody(7, iYear) = RealToStr(elcc->CashFlow(costCatMinorOverhaul).yrAmount(iYear), 2); + tableBody(8, iYear) = RealToStr(elcc->CashFlow(costCatMajorOverhaul).yrAmount(iYear), 2); + tableBody(9, iYear) = RealToStr(elcc->CashFlow(costCatOtherOperational).yrAmount(iYear), 2); + tableBody(10, iYear) = RealToStr(elcc->CashFlow(costCatTotOper).yrAmount(iYear), 2); } WriteSubtitle(state, "Operating Cash Flow by Category (Without Escalation)"); WriteTable(state, tableBody, rowHead, columnHead, columnWidth); @@ -2536,11 +2369,11 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Operating Cash Flow by Category (With Escalation) - rowHead.allocate(lengthStudyYears); + rowHead.allocate(elcc->lengthStudyYears); columnHead.allocate(10); columnWidth.allocate(10); columnWidth = 14; // array assignment - same for all columns - tableBody.allocate(10, lengthStudyYears); + tableBody.allocate(10, elcc->lengthStudyYears); tableBody = ""; columnHead(1) = "Energy"; columnHead(2) = "Water"; @@ -2553,19 +2386,19 @@ namespace EconomicLifeCycleCost { columnHead(9) = "OtherOperational"; columnHead(10) = "Total"; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); - tableBody(1, iYear) = RealToStr(EscalatedTotEnergy(iYear), 2); - tableBody(2, iYear) = RealToStr(CashFlow(costCatWater).yrAmount(iYear), 2); - tableBody(3, iYear) = RealToStr(CashFlow(costCatMaintenance).yrAmount(iYear), 2); - tableBody(4, iYear) = RealToStr(CashFlow(costCatRepair).yrAmount(iYear), 2); - tableBody(5, iYear) = RealToStr(CashFlow(costCatOperation).yrAmount(iYear), 2); - tableBody(6, iYear) = RealToStr(CashFlow(costCatReplacement).yrAmount(iYear), 2); - tableBody(7, iYear) = RealToStr(CashFlow(costCatMinorOverhaul).yrAmount(iYear), 2); - tableBody(8, iYear) = RealToStr(CashFlow(costCatMajorOverhaul).yrAmount(iYear), 2); - tableBody(9, iYear) = RealToStr(CashFlow(costCatOtherOperational).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); + tableBody(1, iYear) = RealToStr(elcc->EscalatedTotEnergy(iYear), 2); + tableBody(2, iYear) = RealToStr(elcc->CashFlow(costCatWater).yrAmount(iYear), 2); + tableBody(3, iYear) = RealToStr(elcc->CashFlow(costCatMaintenance).yrAmount(iYear), 2); + tableBody(4, iYear) = RealToStr(elcc->CashFlow(costCatRepair).yrAmount(iYear), 2); + tableBody(5, iYear) = RealToStr(elcc->CashFlow(costCatOperation).yrAmount(iYear), 2); + tableBody(6, iYear) = RealToStr(elcc->CashFlow(costCatReplacement).yrAmount(iYear), 2); + tableBody(7, iYear) = RealToStr(elcc->CashFlow(costCatMinorOverhaul).yrAmount(iYear), 2); + tableBody(8, iYear) = RealToStr(elcc->CashFlow(costCatMajorOverhaul).yrAmount(iYear), 2); + tableBody(9, iYear) = RealToStr(elcc->CashFlow(costCatOtherOperational).yrAmount(iYear), 2); Real64 yearly_total_cost = - CashFlow(costCatTotOper).yrAmount(iYear) + EscalatedTotEnergy(iYear) - CashFlow(costCatTotEnergy).yrAmount(iYear); + elcc->CashFlow(costCatTotOper).yrAmount(iYear) + elcc->EscalatedTotEnergy(iYear) - elcc->CashFlow(costCatTotEnergy).yrAmount(iYear); tableBody(10, iYear) = RealToStr(yearly_total_cost, 2); } WriteSubtitle(state, "Operating Cash Flow by Category (With Escalation)"); @@ -2593,10 +2426,10 @@ namespace EconomicLifeCycleCost { //---- DEBUG ONLY - Monthly Cash Flows bool showMonthlyCashFlows = false; if (showMonthlyCashFlows) { - rowHead.allocate(lengthStudyTotalMonths); - columnHead.allocate(numCashFlow); - columnWidth.allocate(numCashFlow); - tableBody.allocate(numCashFlow, lengthStudyTotalMonths); + rowHead.allocate(elcc->lengthStudyTotalMonths); + columnHead.allocate(elcc->numCashFlow); + columnWidth.allocate(elcc->numCashFlow); + tableBody.allocate(elcc->numCashFlow, elcc->lengthStudyTotalMonths); tableBody = ""; columnHead(1) = "mnt"; columnHead(2) = "rpr"; @@ -2614,15 +2447,15 @@ namespace EconomicLifeCycleCost { columnHead(14) = "tOpr"; columnHead(15) = "tCap"; columnHead(16) = "Totl"; - for (jObj = countOfCostCat + 1; jObj <= numCashFlow; ++jObj) { - columnHead(jObj) = CashFlow(jObj).name; + for (jObj = countOfCostCat + 1; jObj <= elcc->numCashFlow; ++jObj) { + columnHead(jObj) = elcc->CashFlow(jObj).name; } - for (kMonth = 1; kMonth <= lengthStudyTotalMonths; ++kMonth) { - rowHead(kMonth) = format("{} {}", MonthNames(1 + (kMonth + baseDateMonth - 2) % 12), baseDateYear + int((kMonth - 1) / 12)); + for (kMonth = 1; kMonth <= elcc->lengthStudyTotalMonths; ++kMonth) { + rowHead(kMonth) = format("{} {}", MonthNames(1 + (kMonth + elcc->baseDateMonth - 2) % 12), elcc->baseDateYear + int((kMonth - 1) / 12)); } - for (kMonth = 1; kMonth <= lengthStudyTotalMonths; ++kMonth) { - for (jObj = 1; jObj <= numCashFlow; ++jObj) { - tableBody(jObj, kMonth) = RealToStr(CashFlow(jObj).mnAmount(kMonth), 2); + for (kMonth = 1; kMonth <= elcc->lengthStudyTotalMonths; ++kMonth) { + for (jObj = 1; jObj <= elcc->numCashFlow; ++jObj) { + tableBody(jObj, kMonth) = RealToStr(elcc->CashFlow(jObj).mnAmount(kMonth), 2); } } WriteSubtitle(state, "DEBUG ONLY - Monthly Cash Flows"); @@ -2641,21 +2474,21 @@ namespace EconomicLifeCycleCost { tableBody.deallocate(); } //---- Monthly Total Cash Flow - rowHead.allocate(lengthStudyYears); + rowHead.allocate(elcc->lengthStudyYears); columnHead.allocate(12); columnWidth.allocate(12); columnWidth = 14; // array assignment - same for all columns - tableBody.allocate(12, lengthStudyYears); + tableBody.allocate(12, elcc->lengthStudyYears); tableBody = ""; for (kMonth = 1; kMonth <= 12; ++kMonth) { columnHead(kMonth) = MonthNames(kMonth); } - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = fmt::to_string(baseDateYear + iYear - 1); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = fmt::to_string(elcc->baseDateYear + iYear - 1); } - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { for (kMonth = 1; kMonth <= 12; ++kMonth) { - tableBody(kMonth, iYear) = RealToStr(CashFlow(costCatTotGrand).mnAmount((iYear - 1) * 12 + kMonth), 2); + tableBody(kMonth, iYear) = RealToStr(elcc->CashFlow(costCatTotGrand).mnAmount((iYear - 1) * 12 + kMonth), 2); } } WriteSubtitle(state, "Monthly Total Cash Flow (Without Escalation)"); @@ -2673,7 +2506,7 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Present Value for Recurring, Nonrecurring and Energy Costs - numRows = max(1, numRecurringCosts + numNonrecurringCost + numResourcesUsed); + numRows = max(1, elcc->numRecurringCosts + elcc->numNonrecurringCost + elcc->numResourcesUsed); rowHead.allocate(numRows + 1); columnHead.allocate(5); columnWidth.allocate(5); @@ -2687,11 +2520,11 @@ namespace EconomicLifeCycleCost { columnHead(5) = "Present Value Factor"; totalPV = 0.0; rowHead(numRows + 1) = "TOTAL"; - for (jObj = 1; jObj <= (numRecurringCosts + numNonrecurringCost + numResourcesUsed); ++jObj) { + for (jObj = 1; jObj <= (elcc->numRecurringCosts + elcc->numNonrecurringCost + elcc->numResourcesUsed); ++jObj) { offset = countOfCostCat; - rowHead(jObj) = CashFlow(offset + jObj).name; + rowHead(jObj) = elcc->CashFlow(offset + jObj).name; { - auto const SELECT_CASE_var(CashFlow(offset + jObj).Category); + auto const SELECT_CASE_var(elcc->CashFlow(offset + jObj).Category); if (SELECT_CASE_var == costCatMaintenance) { tableBody(1, jObj) = "Maintenance"; } else if (SELECT_CASE_var == costCatRepair) { @@ -2721,13 +2554,13 @@ namespace EconomicLifeCycleCost { } } { - auto const SELECT_CASE_var(CashFlow(offset + jObj).SourceKind); - if (SELECT_CASE_var == skNonrecurring) { + auto const SELECT_CASE_var(elcc->CashFlow(offset + jObj).SourceKind); + if (SELECT_CASE_var == iSourceKind::Nonrecurring) { tableBody(2, jObj) = "Nonrecurring"; - } else if (SELECT_CASE_var == skRecurring) { + } else if (SELECT_CASE_var == iSourceKind::Recurring) { tableBody(2, jObj) = "Recurring"; - } else if (SELECT_CASE_var == skResource) { - if (CashFlow(offset + jObj).Category == costCatWater) { + } else if (SELECT_CASE_var == iSourceKind::Resource) { + if (elcc->CashFlow(offset + jObj).Category == costCatWater) { tableBody(2, jObj) = "Water Cost"; } else { tableBody(2, jObj) = "Energy Cost"; @@ -2736,11 +2569,11 @@ namespace EconomicLifeCycleCost { tableBody(2, jObj) = "-"; } } - tableBody(3, jObj) = RealToStr(CashFlow(offset + jObj).orginalCost, 2); - tableBody(4, jObj) = RealToStr(CashFlow(offset + jObj).presentValue, 2); - totalPV += CashFlow(offset + jObj).presentValue; - if (CashFlow(offset + jObj).orginalCost != 0.0) { - tableBody(5, jObj) = RealToStr(CashFlow(offset + jObj).presentValue / CashFlow(offset + jObj).orginalCost, 4); + tableBody(3, jObj) = RealToStr(elcc->CashFlow(offset + jObj).orginalCost, 2); + tableBody(4, jObj) = RealToStr(elcc->CashFlow(offset + jObj).presentValue, 2); + totalPV += elcc->CashFlow(offset + jObj).presentValue; + if (elcc->CashFlow(offset + jObj).orginalCost != 0.0) { + tableBody(5, jObj) = RealToStr(elcc->CashFlow(offset + jObj).presentValue / elcc->CashFlow(offset + jObj).orginalCost, 4); } else { tableBody(5, jObj) = "-"; } @@ -2794,22 +2627,22 @@ namespace EconomicLifeCycleCost { rowHead(16) = "Grand Total"; columnHead(1) = "Present Value"; - tableBody(1, 1) = RealToStr(CashFlow(costCatConstruction).presentValue, 2); - tableBody(1, 2) = RealToStr(CashFlow(costCatSalvage).presentValue, 2); - tableBody(1, 3) = RealToStr(CashFlow(costCatOtherCapital).presentValue, 2); - tableBody(1, 4) = RealToStr(CashFlow(costCatEnergy).presentValue, 2); - tableBody(1, 5) = RealToStr(CashFlow(costCatWater).presentValue, 2); - tableBody(1, 6) = RealToStr(CashFlow(costCatMaintenance).presentValue, 2); - tableBody(1, 7) = RealToStr(CashFlow(costCatRepair).presentValue, 2); - tableBody(1, 8) = RealToStr(CashFlow(costCatOperation).presentValue, 2); - tableBody(1, 9) = RealToStr(CashFlow(costCatReplacement).presentValue, 2); - tableBody(1, 10) = RealToStr(CashFlow(costCatMinorOverhaul).presentValue, 2); - tableBody(1, 11) = RealToStr(CashFlow(costCatMajorOverhaul).presentValue, 2); - tableBody(1, 12) = RealToStr(CashFlow(costCatOtherOperational).presentValue, 2); - tableBody(1, 13) = RealToStr(CashFlow(costCatTotEnergy).presentValue, 2); - tableBody(1, 14) = RealToStr(CashFlow(costCatTotOper).presentValue, 2); - tableBody(1, 15) = RealToStr(CashFlow(costCatTotCaptl).presentValue, 2); - tableBody(1, 16) = RealToStr(CashFlow(costCatTotGrand).presentValue, 2); + tableBody(1, 1) = RealToStr(elcc->CashFlow(costCatConstruction).presentValue, 2); + tableBody(1, 2) = RealToStr(elcc->CashFlow(costCatSalvage).presentValue, 2); + tableBody(1, 3) = RealToStr(elcc->CashFlow(costCatOtherCapital).presentValue, 2); + tableBody(1, 4) = RealToStr(elcc->CashFlow(costCatEnergy).presentValue, 2); + tableBody(1, 5) = RealToStr(elcc->CashFlow(costCatWater).presentValue, 2); + tableBody(1, 6) = RealToStr(elcc->CashFlow(costCatMaintenance).presentValue, 2); + tableBody(1, 7) = RealToStr(elcc->CashFlow(costCatRepair).presentValue, 2); + tableBody(1, 8) = RealToStr(elcc->CashFlow(costCatOperation).presentValue, 2); + tableBody(1, 9) = RealToStr(elcc->CashFlow(costCatReplacement).presentValue, 2); + tableBody(1, 10) = RealToStr(elcc->CashFlow(costCatMinorOverhaul).presentValue, 2); + tableBody(1, 11) = RealToStr(elcc->CashFlow(costCatMajorOverhaul).presentValue, 2); + tableBody(1, 12) = RealToStr(elcc->CashFlow(costCatOtherOperational).presentValue, 2); + tableBody(1, 13) = RealToStr(elcc->CashFlow(costCatTotEnergy).presentValue, 2); + tableBody(1, 14) = RealToStr(elcc->CashFlow(costCatTotOper).presentValue, 2); + tableBody(1, 15) = RealToStr(elcc->CashFlow(costCatTotCaptl).presentValue, 2); + tableBody(1, 16) = RealToStr(elcc->CashFlow(costCatTotGrand).presentValue, 2); WriteSubtitle(state, "Present Value by Category"); WriteTable(state, tableBody, rowHead, columnHead, columnWidth); @@ -2826,30 +2659,30 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- Present Value by Year - rowHead.allocate(lengthStudyYears + 1); + rowHead.allocate(elcc->lengthStudyYears + 1); columnHead.allocate(3); columnWidth.allocate(3); columnWidth = 14; // array assignment - same for all columns - tableBody.allocate(3, lengthStudyYears + 1); + tableBody.allocate(3, elcc->lengthStudyYears + 1); tableBody = ""; columnHead(1) = "Total Cost (Without Escalation)"; columnHead(2) = "Total Cost (With Escalation)"; columnHead(3) = "Present Value of Costs"; totalPV = 0.0; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); - tableBody(1, iYear) = RealToStr(CashFlow(costCatTotGrand).yrAmount(iYear), 2); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); + tableBody(1, iYear) = RealToStr(elcc->CashFlow(costCatTotGrand).yrAmount(iYear), 2); // adjust for escalated energy costs Real64 yearly_total_cost = - CashFlow(costCatTotGrand).yrAmount(iYear) + EscalatedTotEnergy(iYear) - CashFlow(costCatTotEnergy).yrAmount(iYear); + elcc->CashFlow(costCatTotGrand).yrAmount(iYear) + elcc->EscalatedTotEnergy(iYear) - elcc->CashFlow(costCatTotEnergy).yrAmount(iYear); tableBody(2, iYear) = RealToStr(yearly_total_cost, 2); - tableBody(3, iYear) = RealToStr(CashFlow(costCatTotGrand).yrPresVal(iYear), 2); - totalPV += CashFlow(costCatTotGrand).yrPresVal(iYear); + tableBody(3, iYear) = RealToStr(elcc->CashFlow(costCatTotGrand).yrPresVal(iYear), 2); + totalPV += elcc->CashFlow(costCatTotGrand).yrPresVal(iYear); } - rowHead(lengthStudyYears + 1) = "TOTAL"; - tableBody(3, lengthStudyYears + 1) = RealToStr(totalPV, 2); + rowHead(elcc->lengthStudyYears + 1) = "TOTAL"; + tableBody(3, elcc->lengthStudyYears + 1) = RealToStr(totalPV, 2); WriteSubtitle(state, "Present Value by Year"); WriteTable(state, tableBody, rowHead, columnHead, columnWidth); @@ -2866,12 +2699,12 @@ namespace EconomicLifeCycleCost { columnWidth.deallocate(); tableBody.deallocate(); //---- After Tax Estimate - if (taxRate != 0.0) { - rowHead.allocate(lengthStudyYears + 1); + if (elcc->taxRate != 0.0) { + rowHead.allocate(elcc->lengthStudyYears + 1); columnHead.allocate(5); columnWidth.allocate(5); columnWidth = 14; // array assignment - same for all columns - tableBody.allocate(5, lengthStudyYears + 1); + tableBody.allocate(5, elcc->lengthStudyYears + 1); tableBody = ""; columnHead(1) = "Depreciated Capital"; columnHead(2) = "Taxable Income"; @@ -2880,18 +2713,18 @@ namespace EconomicLifeCycleCost { columnHead(5) = "After Tax Present Value"; totalPV = 0.0; - for (iYear = 1; iYear <= lengthStudyYears; ++iYear) { - rowHead(iYear) = format("{} {}", MonthNames(baseDateMonth), baseDateYear + iYear - 1); - tableBody(1, iYear) = RealToStr(DepreciatedCapital(iYear), 2); - tableBody(2, iYear) = RealToStr(TaxableIncome(iYear), 2); - tableBody(3, iYear) = RealToStr(Taxes(iYear), 2); - tableBody(4, iYear) = RealToStr(AfterTaxCashFlow(iYear), 2); - tableBody(5, iYear) = RealToStr(AfterTaxPresentValue(iYear), 2); - totalPV += AfterTaxPresentValue(iYear); + for (iYear = 1; iYear <= elcc->lengthStudyYears; ++iYear) { + rowHead(iYear) = format("{} {}", MonthNames(elcc->baseDateMonth), elcc->baseDateYear + iYear - 1); + tableBody(1, iYear) = RealToStr(elcc->DepreciatedCapital(iYear), 2); + tableBody(2, iYear) = RealToStr(elcc->TaxableIncome(iYear), 2); + tableBody(3, iYear) = RealToStr(elcc->Taxes(iYear), 2); + tableBody(4, iYear) = RealToStr(elcc->AfterTaxCashFlow(iYear), 2); + tableBody(5, iYear) = RealToStr(elcc->AfterTaxPresentValue(iYear), 2); + totalPV += elcc->AfterTaxPresentValue(iYear); } - rowHead(lengthStudyYears + 1) = "TOTAL"; - tableBody(5, lengthStudyYears + 1) = RealToStr(totalPV, 2); + rowHead(elcc->lengthStudyYears + 1) = "TOTAL"; + tableBody(5, elcc->lengthStudyYears + 1) = RealToStr(totalPV, 2); WriteSubtitle(state, "After Tax Estimate"); WriteTable(state, tableBody, rowHead, columnHead, columnWidth); @@ -2911,55 +2744,4 @@ namespace EconomicLifeCycleCost { } } - void clear_state() - { - LCCparamPresent = false; - LCCname = ""; - discountConvension = disConvEndOfYear; - inflationApproach = inflAppConstantDollar; - realDiscountRate = 0.0; - nominalDiscountRate = 0.0; - inflation = 0.0; - baseDateMonth = 0; - baseDateYear = 0; - serviceDateMonth = 0; - serviceDateYear = 0; - lengthStudyYears = 0; - lengthStudyTotalMonths = 0; - taxRate = 0.0; - depreciationMethod = depMethNone; - lastDateMonth = 0; - lastDateYear = 0; - numRecurringCosts = 0; - numNonrecurringCost = 0; - numUsePriceEscalation = 0; - numUseAdjustment = 0; - numCashFlow = 0; - numResourcesUsed = 0; - SPV.deallocate(); - DepreciatedCapital.deallocate(); - TaxableIncome.deallocate(); - Taxes.deallocate(); - AfterTaxCashFlow.deallocate(); - AfterTaxPresentValue.deallocate(); - RecurringCosts.deallocate(); - NonrecurringCost.deallocate(); - UsePriceEscalation.deallocate(); - UseAdjustment.deallocate(); - CashFlow.deallocate(); - - GetInput_GetLifeCycleCostInput = true; - UsePriceEscalation_escStartYear = 0; - UsePriceEscalation_escNumYears = 0; - UsePriceEscalation_escEndYear = 0; - UsePriceEscalation_earlierEndYear = 0; - UsePriceEscalation_laterStartYear = 0; - UsePriceEscalation_curEsc = 0; - UsePriceEscalation_curFld = 0; - ExpressAsCashFlows_baseMonths1900 = 0; - ExpressAsCashFlows_serviceMonths1900 = 0; - } - -} // namespace EconomicLifeCycleCost - } // namespace EnergyPlus diff --git a/src/EnergyPlus/EconomicLifeCycleCost.hh b/src/EnergyPlus/EconomicLifeCycleCost.hh index 18034058d3b..2f955c60bad 100644 --- a/src/EnergyPlus/EconomicLifeCycleCost.hh +++ b/src/EnergyPlus/EconomicLifeCycleCost.hh @@ -69,44 +69,49 @@ namespace EconomicLifeCycleCost { // Data // MODULE PARAMETER DEFINITIONS: - extern int const disConvBeginOfYear; - extern int const disConvMidYear; - extern int const disConvEndOfYear; - - extern int const inflAppConstantDollar; - extern int const inflAppCurrentDollar; - - // ModifiedAcceleratedCostRecoverySystem or Straight Line - extern int const depMethMACRS3; - extern int const depMethMACRS5; - extern int const depMethMACRS7; - extern int const depMethMACRS10; - extern int const depMethMACRS15; - extern int const depMethMACRS20; - extern int const depMethStraight27; - extern int const depMethStraight31; - extern int const depMethStraight39; - extern int const depMethStraight40; - extern int const depMethNone; - - extern int const costCatMaintenance; - extern int const costCatRepair; - extern int const costCatOperation; - extern int const costCatReplacement; - extern int const costCatMinorOverhaul; - extern int const costCatMajorOverhaul; - extern int const costCatOtherOperational; - extern int const costCatConstruction; - extern int const costCatSalvage; - extern int const costCatOtherCapital; - extern int const costCatWater; - extern int const costCatEnergy; - extern int const costCatTotEnergy; - extern int const costCatTotOper; - extern int const costCatTotCaptl; - extern int const costCatTotGrand; - - extern int const countOfCostCat; // count of the number of cost categories + enum class iDiscConv { + BeginOfYear, + MidYear, + EndOfYear, + }; + + enum class iInflAppr { + ConstantDollar, + CurrentDollar, + }; + + enum class iDeprMethod { + MACRS3, + MACRS5, + MACRS7, + MACRS10, + MACRS15, + MACRS20, + Straight27, + Straight31, + Straight39, + Straight40, + None, + }; + + constexpr int costCatMaintenance(1); + constexpr int costCatRepair(2); + constexpr int costCatOperation(3); + constexpr int costCatReplacement(4); + constexpr int costCatMinorOverhaul(5); + constexpr int costCatMajorOverhaul(6); + constexpr int costCatOtherOperational(7); + constexpr int costCatConstruction(8); + constexpr int costCatSalvage(9); + constexpr int costCatOtherCapital(10); + constexpr int costCatWater(11); + constexpr int costCatEnergy(12); + constexpr int costCatTotEnergy(13); + constexpr int costCatTotOper(14); + constexpr int costCatTotCaptl(15); + constexpr int costCatTotGrand(16); + + constexpr int countOfCostCat(16); // count of the number of cost categories // The NIST supplement includes UPV* factors for // Electricity @@ -116,69 +121,57 @@ namespace EconomicLifeCycleCost { // Residual oil - FuelOilNo2 // Coal - extern int const startServicePeriod; - extern int const startBasePeriod; - - // DERIVED TYPE DEFINITIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - - // related to LifeCycleCost:Parameters - extern bool LCCparamPresent; // If a LifeCycleCost:Parameters object is present - extern std::string LCCname; // Name - extern int discountConvension; // Discounting Convention - extern int inflationApproach; // Inflation Approach - extern Real64 realDiscountRate; // Real Discount Rate - extern Real64 nominalDiscountRate; // Nominal Discount Rate - extern Real64 inflation; // Inflation - extern int baseDateMonth; // Base Date Month (1=Jan, 12=Dec) - extern int baseDateYear; // Base Date Year 1900-2100 - extern int serviceDateMonth; // Service Date Month (1=Jan, 12=Dec) - extern int serviceDateYear; // Service Date Year 1900-2100 - extern int lengthStudyYears; // Length of Study Period in Years - extern int lengthStudyTotalMonths; // Length of Study expressed in months (years x 12) - extern Real64 taxRate; // Tax rate - extern int depreciationMethod; // Depreciation Method - // derived - extern int lastDateMonth; // Last Date Month (the month before the base date month) - extern int lastDateYear; // Last Date Year (base date year + length of study period in years) - - extern int numRecurringCosts; - - extern int numNonrecurringCost; - - extern int numUsePriceEscalation; - - extern int numUseAdjustment; - - extern int numCashFlow; - extern int const skRecurring; - extern int const skNonrecurring; - extern int const skResource; - extern int const skSum; - extern int const pvkEnergy; - extern int const pvkNonEnergy; - extern int const pvkNotComputed; - extern int numResourcesUsed; - - // present value factors - extern Array1D SPV; - - // arrays related to computing after tax cashflow and present value - extern Array1D DepreciatedCapital; - extern Array1D TaxableIncome; - extern Array1D Taxes; - extern Array1D AfterTaxCashFlow; - extern Array1D AfterTaxPresentValue; + enum class iStartCosts { + ServicePeriod, + BasePeriod, + }; - extern Array1D_string const MonthNames; + enum class iSourceKind { + Unassigned, + Recurring, + Nonrecurring, + Resource, + Sum, + }; - // arrays related to escalated energy costs - extern Array1D EscalatedTotEnergy; - extern std::map> EscalatedEnergy; + enum class iPrValKind { + Unassigned, + Energy, + NonEnergy, + NotComputed, + }; - // SUBROUTINE SPECIFICATIONS FOR MODULE : + constexpr const char * MonthNames(int const &i) { + switch (i) { + case 1: + return "January"; + case 2: + return "February"; + case 3: + return "March"; + case 4: + return "April"; + case 5: + return "May"; + case 6: + return "June"; + case 7: + return "July"; + case 8: + return "August"; + case 9: + return "September"; + case 10: + return "October"; + case 11: + return "November"; + case 12: + return "December"; + default: + assert(false); + return ""; + } + } // Types @@ -189,7 +182,7 @@ namespace EconomicLifeCycleCost { std::string lineItem; // Line Item int category; // Category Real64 cost; // Cost - int startOfCosts; // Start of Costs + iStartCosts startOfCosts; // Start of Costs int yearsFromStart; // Years from Start 0 - 100 int monthsFromStart; // Months from Start 0 - 11 int totalMonthsFromStart; // Total months (12 x years) + months @@ -200,8 +193,8 @@ namespace EconomicLifeCycleCost { // Default Constructor RecurringCostsType() - : category(costCatMaintenance), cost(0.0), startOfCosts(startServicePeriod), yearsFromStart(0), monthsFromStart(0), totalMonthsFromStart(0), - repeatPeriodYears(0), repeatPeriodMonths(0), totalRepeatPeriodMonths(0), annualEscalationRate(0.0) + : category(costCatMaintenance), cost(0.0), startOfCosts(iStartCosts::ServicePeriod), yearsFromStart(0), monthsFromStart(0), + totalMonthsFromStart(0), repeatPeriodYears(0), repeatPeriodMonths(0), totalRepeatPeriodMonths(0), annualEscalationRate(0.0) { } }; @@ -213,14 +206,15 @@ namespace EconomicLifeCycleCost { std::string lineItem; // Line Item int category; // Category Real64 cost; // Cost - int startOfCosts; // Start of Costs + iStartCosts startOfCosts; // Start of Costs int yearsFromStart; // Years from Start 0 - 100 int monthsFromStart; // Months from Start 0 - 11 int totalMonthsFromStart; // Total months (12 x years) + months // Default Constructor NonrecurringCostType() - : category(costCatConstruction), cost(0.0), startOfCosts(startServicePeriod), yearsFromStart(0), monthsFromStart(0), totalMonthsFromStart(0) + : category(costCatConstruction), cost(0.0), startOfCosts(iStartCosts::ServicePeriod), yearsFromStart(0), monthsFromStart(0), + totalMonthsFromStart(0) { } }; @@ -258,31 +252,26 @@ namespace EconomicLifeCycleCost { struct CashFlowType { // Members - std::string name; // Name - just for labeling output - use Category for aggregation - int SourceKind; // 1=recurring, 2=nonrecurring, 3=resource - DataGlobalConstants::ResourceType Resource; // resource like electricity or natural gas (uses definitions from DataGlobalConstants) - int Category; // uses "costCat" constants above - Array1D mnAmount; // cashflow dollar amount by month, first year is baseDateYear + std::string name; // Name - just for labeling output - use Category for aggregation + iSourceKind SourceKind; // 1=recurring, 2=nonrecurring, 3=resource + DataGlobalConstants::ResourceType Resource; // resource like electricity or natural gas (uses definitions from DataGlobalConstants) + int Category; // uses "costCat" constants above + Array1D mnAmount; // cashflow dollar amount by month, first year is baseDateYear // last year is baseDateYear + lengthStudyYears - 1 Array1D yrAmount; // cashflow dollar amount by year, first year is baseDateYear - int pvKind; // kind of present value 1=energy, 2=non-energy,3=not computed but summed + iPrValKind pvKind; // kind of present value 1=energy, 2=non-energy,3=not computed but summed Real64 presentValue; // total present value for cashflow Real64 orginalCost; // original cost from recurring, non-recurring or energy cost Array1D yrPresVal; // present value by year, first year is baseDateYear // Default Constructor - CashFlowType() : SourceKind(0), Resource(DataGlobalConstants::ResourceType::None), Category(0), pvKind(0), presentValue(0.), orginalCost(0.) + CashFlowType() + : SourceKind(iSourceKind::Unassigned), Resource(DataGlobalConstants::ResourceType::None), Category(0), pvKind(iPrValKind::Unassigned), + presentValue(0.), orginalCost(0.) { } }; - // Object Data - extern Array1D RecurringCosts; - extern Array1D NonrecurringCost; - extern Array1D UsePriceEscalation; - extern Array1D UseAdjustment; - extern Array1D CashFlow; - // Functions void GetInputForLifeCycleCost(EnergyPlusData &state); @@ -307,7 +296,7 @@ namespace EconomicLifeCycleCost { void GetInputLifeCycleCostUseAdjustment(EnergyPlusData &state); - int MonthToMonthNumber(std::string const &inMonthString, int const inDefaultMonth); + int MonthToMonthNumber(std::string const &inMonthString, int const &inDefaultMonth); //====================================================================================================================== //====================================================================================================================== @@ -319,11 +308,11 @@ namespace EconomicLifeCycleCost { void ExpressAsCashFlows(EnergyPlusData &state); - void ComputeEscalatedEnergyCosts(); + void ComputeEscalatedEnergyCosts(EnergyPlusData &state); - void ComputePresentValue(); + void ComputePresentValue(EnergyPlusData &state); - void ComputeTaxAndDepreciation(); + void ComputeTaxAndDepreciation(EnergyPlusData &state); //====================================================================================================================== //====================================================================================================================== @@ -335,15 +324,119 @@ namespace EconomicLifeCycleCost { void WriteTabularLifeCycleCostReport(EnergyPlusData &state); - void clear_state(); - } // namespace EconomicLifeCycleCost struct EconomicLifeCycleCostData : BaseGlobalStruct { + // related to LifeCycleCost:Parameters + bool LCCparamPresent = false; // If a LifeCycleCost:Parameters object is present + std::string LCCname; // Name + EconomicLifeCycleCost::iDiscConv discountConvention = EconomicLifeCycleCost::iDiscConv::EndOfYear; // Discounting Convention + EconomicLifeCycleCost::iInflAppr inflationApproach = EconomicLifeCycleCost::iInflAppr::ConstantDollar; // Inflation Approach + Real64 realDiscountRate = 0.0; // Real Discount Rate + Real64 nominalDiscountRate = 0.0; // Nominal Discount Rate + Real64 inflation = 0.0; // Inflation + int baseDateMonth = 0; // Base Date Month (1=Jan, 12=Dec) + int baseDateYear = 0; // Base Date Year 1900-2100 + int serviceDateMonth = 0; // Service Date Month (1=Jan, 12=Dec) + int serviceDateYear = 0; // Service Date Year 1900-2100 + int lengthStudyYears = 0; // Length of Study Period in Years + int lengthStudyTotalMonths = 0; // Length of Study expressed in months (years x 12) + Real64 taxRate = 0.0; // Tax rate + EconomicLifeCycleCost::iDeprMethod depreciationMethod = EconomicLifeCycleCost::iDeprMethod::None; // Depreciation Method + // derived + int lastDateMonth = 0; // Last Date Month (the month before the base date month) + int lastDateYear = 0; // Last Date Year (base date year + length of study period in years) + int numRecurringCosts = 0; + int numNonrecurringCost = 0; + int numUsePriceEscalation = 0; + int numUseAdjustment = 0; + int numCashFlow = 0; + int numResourcesUsed = 0; + bool GetInput_GetLifeCycleCostInput = true; + + // from former statics in GetInputLifeCycleCostUsePriceEscalation() + int UsePriceEscalation_escStartYear = 0; + int UsePriceEscalation_escNumYears = 0; + int UsePriceEscalation_escEndYear = 0; + int UsePriceEscalation_earlierEndYear = 0; + int UsePriceEscalation_laterStartYear = 0; + int UsePriceEscalation_curEsc = 0; + int UsePriceEscalation_curFld = 0; + + // from former statics in ExpressAsCashFlows + int ExpressAsCashFlows_baseMonths1900 = 0; // number of months since 1900 for base period + int ExpressAsCashFlows_serviceMonths1900 = 0; // number of months since 1900 for service period + + // present value factors + Array1D SPV; + std::map> energySPV; // yearly equivalent to FEMP UPV* values + + // arrays related to computing after tax cashflow and present value + Array1D DepreciatedCapital; + Array1D TaxableIncome; + Array1D Taxes; + Array1D AfterTaxCashFlow; + Array1D AfterTaxPresentValue; + + // arrays related to escalated energy costs + Array1D EscalatedTotEnergy; + std::map> EscalatedEnergy; + + Array1D RecurringCosts; + Array1D NonrecurringCost; + Array1D UsePriceEscalation; + Array1D UseAdjustment; + Array1D CashFlow; void clear_state() override { - + this->LCCparamPresent = false; + this->LCCname.clear(); + this->discountConvention = EconomicLifeCycleCost::iDiscConv::EndOfYear; + this->inflationApproach = EconomicLifeCycleCost::iInflAppr::ConstantDollar; + this->realDiscountRate = 0.0; + this->nominalDiscountRate = 0.0; + this->inflation = 0.0; + this->baseDateMonth = 0; + this->baseDateYear = 0; + this->serviceDateMonth = 0; + this->serviceDateYear = 0; + this->lengthStudyYears = 0; + this->lengthStudyTotalMonths = 0; + this->taxRate = 0.0; + this->depreciationMethod = EconomicLifeCycleCost::iDeprMethod::None; + this->lastDateMonth = 0; + this->lastDateYear = 0; + this->numRecurringCosts = 0; + this->numNonrecurringCost = 0; + this->numUsePriceEscalation = 0; + this->numUseAdjustment = 0; + this->numCashFlow = 0; + this->numResourcesUsed = 0; + this->GetInput_GetLifeCycleCostInput = true; + this->UsePriceEscalation_escStartYear = 0; + this->UsePriceEscalation_escNumYears = 0; + this->UsePriceEscalation_escEndYear = 0; + this->UsePriceEscalation_earlierEndYear = 0; + this->UsePriceEscalation_laterStartYear = 0; + this->UsePriceEscalation_curEsc = 0; + this->UsePriceEscalation_curFld = 0; + this->ExpressAsCashFlows_baseMonths1900 = 0; + this->ExpressAsCashFlows_serviceMonths1900 = 0; + this->SPV.deallocate(); + this->energySPV.clear(); + this->DepreciatedCapital.deallocate(); + this->TaxableIncome.deallocate(); + this->Taxes.deallocate(); + this->AfterTaxCashFlow.deallocate(); + this->AfterTaxPresentValue.deallocate(); + this->EscalatedTotEnergy.deallocate(); + this->EscalatedEnergy.clear(); + this->RecurringCosts.deallocate(); + this->NonrecurringCost.deallocate(); + this->UsePriceEscalation.deallocate(); + this->UseAdjustment.deallocate(); + this->CashFlow.deallocate(); } }; diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 3a4ce2bbcee..31132515a05 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -148,10 +148,6 @@ namespace FanCoilUnits { std::string const cMO_FanCoil("ZoneHVAC:FourPipeFanCoil"); - // coil operation - int const On(1); // normal coil operation - int const Off(0); // signal coil shouldn't run - // coil type units supported in this module int const FanCoilUnit_4Pipe(1); diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 1c6218093a1..e43d6f39671 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -77,8 +77,8 @@ namespace FanCoilUnits { extern std::string const cMO_FanCoil; // coil operation - extern int const On; // normal coil operation - extern int const Off; // signal coil shouldn't run + constexpr int On(1); // normal coil operation + constexpr int Off(0); // signal coil shouldn't run // coil type units supported in this module extern int const FanCoilUnit_4Pipe; diff --git a/src/EnergyPlus/Fans.cc b/src/EnergyPlus/Fans.cc index d85a7f55ecf..18c9498254d 100644 --- a/src/EnergyPlus/Fans.cc +++ b/src/EnergyPlus/Fans.cc @@ -118,7 +118,7 @@ namespace Fans { using DataHVACGlobals::Other; using DataHVACGlobals::SmallAirVolFlow; using DataHVACGlobals::TurnFansOff; - using DataHVACGlobals::TurnFansOn; // cpw22Aug2010 Added FanType_ComponentModel + using DataHVACGlobals::TurnFansOn; using DataHVACGlobals::UnbalExhMassFlow; using EMSManager::ManageEMS; using Psychrometrics::PsyCpAirFnW; @@ -254,7 +254,6 @@ namespace Fans { SimOnOffFan(state, FanNum, SpeedRatio); } else if (Fan(FanNum).FanType_Num == FanType_ZoneExhaust) { SimZoneExhaustFan(state, FanNum); - // cpw22Aug2010 Add call for Component Model fan } else if (Fan(FanNum).FanType_Num == FanType_ComponentModel) { SimComponentModelFan(state, FanNum); } @@ -301,8 +300,8 @@ namespace Fans { int ExhFanNum; int NVPerfNum; bool NVPerfFanFound; - int NumCompModelFan; // cpw22Aug2010 The number of Component Model Fans - int CompModelFanNum; // cpw22Aug2010 Component Model Fan index + int NumCompModelFan; + int CompModelFanNum; int NumAlphas; int NumNums; int checkNum; @@ -355,7 +354,6 @@ namespace Fans { MaxNumbers = max(MaxNumbers, NumNums); } - // cpw22Aug2010 Added get max alphas and numbers for ComponentModel fan NumCompModelFan = inputProcessor->getNumObjectsFound(state, "Fan:ComponentModel"); if (NumCompModelFan > 0) { inputProcessor->getObjectDefMaxArgs(state, "Fan:ComponentModel", NumParams, NumAlphas, NumNums); @@ -370,7 +368,7 @@ namespace Fans { lNumericFieldBlanks.dimension(MaxNumbers, false); rNumericArgs.dimension(MaxNumbers, 0.0); - state.dataFans->NumFans = NumSimpFan + NumVarVolFan + NumZoneExhFan + NumOnOff + NumCompModelFan; // cpw1Mar2010 Add NumCompModelFan + state.dataFans->NumFans = NumSimpFan + NumVarVolFan + NumZoneExhFan + NumOnOff + NumCompModelFan; if (state.dataFans->NumFans > 0) { Fan.allocate(state.dataFans->NumFans); FanNumericFields.allocate(state.dataFans->NumFans); @@ -789,7 +787,6 @@ namespace Fans { } } - // cpw22Aug2010 Added get input for Component Fan Model for (CompModelFanNum = 1; CompModelFanNum <= NumCompModelFan; ++CompModelFanNum) { FanNum = NumSimpFan + NumVarVolFan + NumZoneExhFan + NumOnOff + CompModelFanNum; @@ -856,7 +853,7 @@ namespace Fans { Fan(FanNum).MaxAirFlowRateIsAutosizable = true; Fan(FanNum).MinAirFlowRate = rNumericArgs(2); - Fan(FanNum).FanSizingFactor = rNumericArgs(3); // Fan max airflow sizing factor [-] cpw31Aug2010 + Fan(FanNum).FanSizingFactor = rNumericArgs(3); // Fan max airflow sizing factor [-] Fan(FanNum).FanWheelDia = rNumericArgs(4); // Fan wheel outer diameter [m] Fan(FanNum).FanOutletArea = rNumericArgs(5); // Fan outlet area [m2] Fan(FanNum).FanMaxEff = rNumericArgs(6); // Fan maximum static efficiency [-] @@ -872,7 +869,7 @@ namespace Fans { Fan(FanNum).MotInAirFrac = rNumericArgs(16); // Fraction of fan and motor losses to airstream [-] Fan(FanNum).VFDEffType = cAlphaArgs(5); // VFD efficiency type [Speed or Power] Fan(FanNum).VFDMaxOutPwr = rNumericArgs(17); // VFD maximum output power [W, autosizable] - Fan(FanNum).VFDSizingFactor = rNumericArgs(18); // VFD sizing factor [-] cpw31Aug2010 + Fan(FanNum).VFDSizingFactor = rNumericArgs(18); // VFD sizing factor [-] Fan(FanNum).PressRiseCurveIndex = GetCurveIndex(state, cAlphaArgs(6)); // Fan pressure rise curve Fan(FanNum).PressResetCurveIndex = GetCurveIndex(state, cAlphaArgs(7)); // Duct static pressure reset curve Fan(FanNum).PLFanEffNormCurveIndex = GetCurveIndex(state, cAlphaArgs(8)); // Fan part-load eff (normal) curve @@ -1258,7 +1255,6 @@ namespace Fans { DataEMSOverrideON = false; DataEMSOverride = 0.0; - // cpw31Aug2010 Add fan, belt, motor and VFD component autosizing and maximum efficiency calculations FanVolFlow = Fan(FanNum).MaxAirFlowRate; // Maximum volumetric airflow through fan [m3/s at standard conditions] if (Fan(FanNum).FanType_Num == FanType_ComponentModel) { // Get air density at standard conditions and get mass airflow through fan @@ -1319,7 +1315,7 @@ namespace Fans { // For direct-drive, should have PulleyDiaRatio = 1 MotorSpeed = Fan(FanNum).FanSpd / Fan(FanNum).PulleyDiaRatio; //[rpm] - // Check for inconsistent drive ratio and motor speed, and report design fan speed with warning cpw14Sep2010 + // Check for inconsistent drive ratio and motor speed, and report design fan speed with warning if (MotorSpeed > (Fan(FanNum).MotorMaxSpd + 1.e-5)) { ShowWarningError(state, "Drive ratio for " + Fan(FanNum).FanType + ": " + Fan(FanNum).FanName + " is too low at design conditions -- check motor speed and drive ratio inputs"); @@ -1335,7 +1331,7 @@ namespace Fans { // Adjust max belt torque using belt sizing factor Fan(FanNum).BeltMaxTorque *= Fan(FanNum).BeltSizingFactor; //[N-m] - // Check for undersized belt and report design size with warning cpw14Sep2010 + // Check for undersized belt and report design size with warning if (Fan(FanNum).FanTrq > (Fan(FanNum).BeltMaxTorque + 1.e-5)) { ShowWarningError(state, "Belt for " + Fan(FanNum).FanType + ": " + Fan(FanNum).FanName + " is undersized at design conditions -- check belt inputs"); @@ -1377,7 +1373,7 @@ namespace Fans { // Adjust max motor output power using motor sizing factor Fan(FanNum).MotorMaxOutPwr *= Fan(FanNum).MotorSizingFactor; //[W] - // Check for undersized motor and report design size with warning cpw14Sep2010 + // Check for undersized motor and report design size with warning if (Fan(FanNum).BeltInputPower > (Fan(FanNum).MotorMaxOutPwr + 1.e-5)) { ShowWarningError(state, "Motor for " + Fan(FanNum).FanType + ": " + Fan(FanNum).FanName + " is undersized at design conditions -- check motor inputs"); @@ -1418,7 +1414,7 @@ namespace Fans { // Adjust max VFD output power using VFD sizing factor Fan(FanNum).VFDMaxOutPwr *= Fan(FanNum).VFDSizingFactor; //[W] - // Check for undersized VFD and report design size with warning cpw14Sep2010 + // Check for undersized VFD and report design size with warning if (Fan(FanNum).MotorInputPower > (Fan(FanNum).VFDMaxOutPwr + 1.e-5)) { ShowWarningError(state, "VFD for " + Fan(FanNum).FanType + ": " + Fan(FanNum).FanName + " is undersized at design conditions -- check VFD inputs"); @@ -1442,7 +1438,7 @@ namespace Fans { // Equivalent to Fan(FanNum)%FanAirPower / Fan(FanNum)%FanPower Fan(FanNum).FanEff = Fan(FanNum).FanWheelEff * Fan(FanNum).BeltEff * Fan(FanNum).MotEff * Fan(FanNum).VFDEff; - // Report fan, belt, motor, and VFD characteristics at design condition to .eio file cpw14Sep2010 + // Report fan, belt, motor, and VFD characteristics at design condition to .eio file BaseSizer::reportSizerOutput(state, Fan(FanNum).FanType, Fan(FanNum).FanName, "Design Fan Airflow [m3/s]", FanVolFlow); BaseSizer::reportSizerOutput(state, Fan(FanNum).FanType, Fan(FanNum).FanName, "Design Fan Static Pressure Rise [Pa]", Fan(FanNum).DeltaPress); BaseSizer::reportSizerOutput(state, Fan(FanNum).FanType, Fan(FanNum).FanName, "Design Fan Shaft Power [W]", Fan(FanNum).FanShaftPower); @@ -1458,37 +1454,11 @@ namespace Fans { BaseSizer::reportSizerOutput(state, Fan(FanNum).FanType, Fan(FanNum).FanName, "Design Motor Efficiency []", Fan(FanNum).MotEff); BaseSizer::reportSizerOutput(state, Fan(FanNum).FanType, Fan(FanNum).FanName, "Design VFD Efficiency []", Fan(FanNum).VFDEff); BaseSizer::reportSizerOutput(state, Fan(FanNum).FanType, Fan(FanNum).FanName, "Design Combined Efficiency []", Fan(FanNum).FanEff); - - // cpw31Aug2010 Temporary code for debugging fan component model - // WRITE(300,*) TRIM(RoundSigDigits(RhoAir,4))//','//TRIM(RoundSigDigits(FanVolFlow,4)) & - // //','//TRIM(RoundSigDigits(FanOutletVelPress,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%DeltaPress,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%FanAirPower,4))//','//TRIM(RoundSigDigits(EulerNum,4)) & - // //','//TRIM(RoundSigDigits(NormalizedEulerNum,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%FanWheelEff,4)) - // WRITE(301,*) TRIM(RoundSigDigits(Fan(FanNum)%FanShaftPower,4))//','//TRIM(RoundSigDigits(FanDimFlow,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%FanTrq,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%FanSpd,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%FanShaftPwrMax,4))//','//TRIM(RoundSigDigits(XbeltMax,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%BeltMaxEff,4))//','//TRIM(RoundSigDigits(FanTrqRatio,4)) - // WRITE(302,*) TRIM(RoundSigDigits(BeltPLEff,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%BeltEff,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%BeltInputPower,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%MotorMaxOutPwr,4)) & - // //','//TRIM(RoundSigDigits(XmotorMax,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%MotorMaxEff,4)) & - // //','//TRIM(RoundSigDigits(MotorOutPwrRatio,4))//','//TRIM(RoundSigDigits(MotorPLEff,4)) - // WRITE(303,*) TRIM(RoundSigDigits(Fan(FanNum)%MotEff,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%MotorInputPower,4)) & - // //','//TRIM(RoundSigDigits(VFDOutPwrRatio,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%VFDEff,4)) & - // //','//TRIM(RoundSigDigits(RatedPower,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%FanEff,4)) & - // //','//TRIM(RoundSigDigits(0.0d0,4))//','//TRIM(RoundSigDigits(0.0d0,4)) - // WRITE(304,*) TRIM("Fan")//','//TRIM("Sizing") - - // cpw31Aug2010 Temporary code to write headers for component fan model debug files - // WRITE(300,*) 'Rho,VolFLOW,dPvOut,dP,AirPwr,Eu,NrmEu,FWEff' - // WRITE(301,*) 'ShftPwr,DimFlow,Trq,FSpd,BPwrOut,XBmax,BMaxEff,TrqRat' - // WRITE(302,*) 'BPLEff,BEff,BPwrIn,MPwrOut,XMmax,MMaxEff,MPwrRat,MPLEff' - // WRITE(303,*) 'MEff,MPwrIn,VPwrRat,VEff,FanPwr,FanEff,PwrLoss,dEnthalpy' - // WRITE(304,*) 'Date,Period' } // End fan component sizing equipName = Fan(FanNum).FanName; - // cpw31Aug2010 Rearrange order to match table and use FanVolFlow to calculate RatedPower + // Rearrange order to match table and use FanVolFlow to calculate RatedPower // ALSO generates values if Component Model fan, for which DeltaPress and FanEff vary with flow PreDefTableEntry(state, state.dataOutRptPredefined->pdchFanType, equipName, Fan(FanNum).FanType); PreDefTableEntry(state, state.dataOutRptPredefined->pdchFanTotEff, equipName, Fan(FanNum).FanEff); @@ -2195,8 +2165,6 @@ namespace Fans { } } - // cpw22Aug2010 Added Component Model fan algorithm - void SimComponentModelFan(EnergyPlusData &state, int const FanNum) { @@ -2431,26 +2399,6 @@ namespace Fans { Fan(FanNum).OutletAirHumRat = Fan(FanNum).InletAirHumRat; //[-] Fan(FanNum).OutletAirMassFlowRate = MassFlow; //[kg/s] Fan(FanNum).OutletAirTemp = PsyTdbFnHW(Fan(FanNum).OutletAirEnthalpy, Fan(FanNum).OutletAirHumRat); - - // cpw31Aug2010 Temporary code for debugging fan component model - // WRITE(300,*) TRIM(RoundSigDigits(Fan(FanNum)%RhoAirStdInit,4))//','//TRIM(RoundSigDigits(FanVolFlow,4)) & - // //','//TRIM(RoundSigDigits(FanOutletVelPress,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%DeltaPress,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%FanAirPower,4))//','//TRIM(RoundSigDigits(EulerNum,4)) & - // //','//TRIM(RoundSigDigits(NormalizedEulerNum,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%FanWheelEff,4)) - // WRITE(301,*) TRIM(RoundSigDigits(Fan(FanNum)%FanShaftPower,4))//','//TRIM(RoundSigDigits(FanDimFlow,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%FanTrq,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%FanSpd,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%FanShaftPwrMax,4))//','//TRIM(" ") & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%BeltMaxEff,4))//','//TRIM(RoundSigDigits(FanTrqRatio,4)) - // WRITE(302,*) TRIM(RoundSigDigits(BeltPLEff,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%BeltEff,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%BeltInputPower,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%MotorMaxOutPwr,4)) & - // //','//TRIM(" ")//','//TRIM(RoundSigDigits(Fan(FanNum)%MotorMaxEff,4)) & - // //','//TRIM(RoundSigDigits(MotorOutPwrRatio,4))//','//TRIM(RoundSigDigits(MotorPLEff,4)) - // WRITE(303,*) TRIM(RoundSigDigits(Fan(FanNum)%MotEff,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%MotorInputPower,4)) & - // //','//TRIM(RoundSigDigits(VFDOutPwrRatio,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%VFDEff,4)) & - // //','//TRIM(RoundSigDigits(Fan(FanNum)%FanPower,4))//','//TRIM(RoundSigDigits(Fan(FanNum)%FanEff,4)) & - // //','//TRIM(RoundSigDigits(PowerLossToAir,4))//','//TRIM(RoundSigDigits(FanEnthalpyChange,4)) - // WRITE(304,*) TRIM(CurMnDy)//','//TRIM(CreateSysTimeIntervalString()) - } else { // Fan is OFF and not operating -- no power consumed and zero mass flow rate Fan(FanNum).FanPower = 0.0; diff --git a/src/EnergyPlus/Fans.hh b/src/EnergyPlus/Fans.hh index a5863eff5fa..cd933b28d21 100644 --- a/src/EnergyPlus/Fans.hh +++ b/src/EnergyPlus/Fans.hh @@ -104,8 +104,6 @@ namespace Fans { Real64 PowerLossToAir; // Fan heat gain to air stream [W] bool EMSFanPressureOverrideOn; // if true, then EMS is calling to override Real64 EMSFanPressureValue; // EMS value for Delta Pressure Across the Fan [Pa] - // cpw22Aug2010 Clarify meaning of "fan efficiency" - // REAL(r64) :: FanEff =0.0d0 !Fan total efficiency; motor and mechanical Real64 FanEff; // Fan total system efficiency (fan*belt*motor*VFD) bool EMSFanEffOverrideOn; // if true, then EMS is calling to override Real64 EMSFanEffValue; // EMS value for total efficiency of the Fan, fraction on 0..1 @@ -126,14 +124,13 @@ namespace Fans { std::string EndUseSubcategoryName; bool OneTimePowerRatioCheck; // one time flag used for error message bool OneTimeEffRatioCheck; // one time flag used for error message - // cpw22Aug2010 Following added to support Fan Component Model input Real64 FanWheelDia; // Fan wheel outer diameter [m] Real64 FanOutletArea; // Fan outlet area [m2] Real64 FanMaxEff; // Fan maximum static efficiency [-] Real64 EuMaxEff; // Euler number at fan maximum static efficiency [-] Real64 FanMaxDimFlow; // Fan maximum dimensionless airflow [-] Real64 FanShaftPwrMax; // Fan shaft maximum input power [W] - Real64 FanSizingFactor; // Fan sizing factor [-] cpw31Aug2010 + Real64 FanSizingFactor; // Fan sizing factor [-] Real64 PulleyDiaRatio; // Motor/fan pulley diameter ratio [-] Real64 BeltMaxTorque; // Belt maximum torque [N-m] Real64 BeltSizingFactor; // Belt sizing factor [-] @@ -143,7 +140,7 @@ namespace Fans { Real64 MotorSizingFactor; // Motor sizing factor [-] std::string VFDEffType; // VFD efficiency type [Speed or Power] Real64 VFDMaxOutPwr; // VFD maximum output power [W] - Real64 VFDSizingFactor; // VFD sizing factor [-] cpw31Aug2010 + Real64 VFDSizingFactor; // VFD sizing factor [-] int PressRiseCurveIndex; // Fan pressure rise curve index int PressResetCurveIndex; // Duct static pressure reset curve index int PLFanEffNormCurveIndex; // Fan part-load efficiency (normal) curve index @@ -157,17 +154,16 @@ namespace Fans { int MotorMaxEffCurveIndex; // Motor maximum efficiency curve index int PLMotorEffCurveIndex; // Motor part-load efficiency curve index int VFDEffCurveIndex; // VFD efficiency curve index - // cpw22Aug2010 Following added to support Fan Component Model calculated values Real64 DeltaPressTot; // Total pressure rise across fan [N/m2] Real64 FanAirPower; // Air power for fan being Simulated [W] Real64 FanSpd; // Fan shaft rotational speed [rpm] Real64 FanTrq; // Fan shaft torque [N-m] Real64 FanWheelEff; // Fan efficiency (mechanical) Real64 FanShaftPower; // Shaft input power for fan being Simulated [W] - Real64 BeltMaxEff; // Belt maximum efficiency (mechanical) cpw31Aug2010 + Real64 BeltMaxEff; // Belt maximum efficiency (mechanical) Real64 BeltEff; // Belt efficiency (mechanical) Real64 BeltInputPower; // Belt input power for fan being Simulated [W] - Real64 MotorMaxEff; // Motor maximum efficiency (electrical) cpw31Aug2010 + Real64 MotorMaxEff; // Motor maximum efficiency (electrical) Real64 MotorInputPower; // Motor input power for fan being Simulated [W] Real64 VFDEff; // VFD efficiency (electrical) Real64 VFDInputPower; // VFD input power for fan being Simulated [W] @@ -282,8 +278,6 @@ namespace Fans { void SimZoneExhaustFan(EnergyPlusData &state, int const FanNum); - // cpw22Aug2010 Added Component Model fan algorithm - void SimComponentModelFan(EnergyPlusData &state, int const FanNum); // End Algorithm Section of the Module diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index 1a770e6389b..f651ac4b289 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -185,9 +185,6 @@ namespace Furnaces { // Airflow control for contant fan mode int const UseCompressorOnFlow(1); // set compressor OFF air flow rate equal to compressor ON air flow rate int const UseCompressorOffFlow(2); // set compressor OFF air flow rate equal to user defined value - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run // Dehumidification control modes (DehumidControlMode) int const DehumidControl_None(0); @@ -6768,8 +6765,6 @@ namespace Furnaces { using namespace ScheduleManager; using namespace DataZoneEnergyDemands; using DataHeatBalFanSys::ZT; - using DXCoils::DXCoil; - using DXCoils::DXCoilPartLoadRatio; using TempSolveRoot::SolveRoot; @@ -6839,10 +6834,10 @@ namespace Furnaces { PartLoadRatio = 0.0; if (Furnace(FurnaceNum).FurnaceType_Num == UnitarySys_HeatPump_AirToAir) { - if (DXCoil(Furnace(FurnaceNum).HeatingCoilIndex).IsSecondaryDXCoilInZone) { // assumes compressor is in same location as secondary coil - OutdoorDryBulbTemp = ZT(DXCoil(Furnace(FurnaceNum).HeatingCoilIndex).SecZonePtr); - } else if (DXCoil(Furnace(FurnaceNum).CoolingCoilIndex).IsSecondaryDXCoilInZone) { - OutdoorDryBulbTemp = ZT(DXCoil(Furnace(FurnaceNum).CoolingCoilIndex).SecZonePtr); + if (state.dataDXCoils->DXCoil(Furnace(FurnaceNum).HeatingCoilIndex).IsSecondaryDXCoilInZone) { // assumes compressor is in same location as secondary coil + OutdoorDryBulbTemp = ZT(state.dataDXCoils->DXCoil(Furnace(FurnaceNum).HeatingCoilIndex).SecZonePtr); + } else if (state.dataDXCoils->DXCoil(Furnace(FurnaceNum).CoolingCoilIndex).IsSecondaryDXCoilInZone) { + OutdoorDryBulbTemp = ZT(state.dataDXCoils->DXCoil(Furnace(FurnaceNum).CoolingCoilIndex).SecZonePtr); } else { if (Furnace(FurnaceNum).CondenserNodeNum > 0) { OutdoorDryBulbTemp = Node(Furnace(FurnaceNum).CondenserNodeNum).Temp; @@ -7959,7 +7954,7 @@ namespace Furnaces { if (Furnace(FurnaceNum).CoolingCoilType_Num == CoilDX_CoolingHXAssisted) { // VS coil issue here... - if (DXCoilPartLoadRatio(Furnace(FurnaceNum).ActualDXCoilIndexForHXAssisted) > 0.0) { + if (state.dataDXCoils->DXCoilPartLoadRatio(Furnace(FurnaceNum).ActualDXCoilIndexForHXAssisted) > 0.0) { Furnace(FurnaceNum).CoolPartLoadRatio = 1.0; Furnace(FurnaceNum).CompPartLoadRatio = 1.0; } else { @@ -7967,7 +7962,7 @@ namespace Furnaces { Furnace(FurnaceNum).CompPartLoadRatio = 0.0; } } else { - if (DXCoilPartLoadRatio(Furnace(FurnaceNum).CoolingCoilIndex) > 0.0) { + if (state.dataDXCoils->DXCoilPartLoadRatio(Furnace(FurnaceNum).CoolingCoilIndex) > 0.0) { Furnace(FurnaceNum).CoolPartLoadRatio = 1.0; Furnace(FurnaceNum).CompPartLoadRatio = 1.0; } else { diff --git a/src/EnergyPlus/Furnaces.hh b/src/EnergyPlus/Furnaces.hh index 3624c717f04..9c458a76d0d 100644 --- a/src/EnergyPlus/Furnaces.hh +++ b/src/EnergyPlus/Furnaces.hh @@ -77,8 +77,8 @@ namespace Furnaces { extern int const UseCompressorOnFlow; // set compressor OFF air flow rate equal to compressor ON air flow rate extern int const UseCompressorOffFlow; // set compressor OFF air flow rate equal to user defined value // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run // Dehumidification control modes (DehumidControlMode) extern int const DehumidControl_None; diff --git a/src/EnergyPlus/HVACDXHeatPumpSystem.cc b/src/EnergyPlus/HVACDXHeatPumpSystem.cc index 12c0d56c7f0..a4cde404cad 100644 --- a/src/EnergyPlus/HVACDXHeatPumpSystem.cc +++ b/src/EnergyPlus/HVACDXHeatPumpSystem.cc @@ -101,9 +101,6 @@ namespace HVACDXHeatPumpSystem { // Data // MODULE PARAMETER DEFINITIONS Real64 const MinAirMassFlow(0.001); - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run bool GetInputFlag(true); // Flag to get input only once @@ -591,7 +588,6 @@ namespace HVACDXHeatPumpSystem { // Using/Aliasing using namespace ScheduleManager; using DataHVACGlobals::TempControlTol; - using DXCoils::DXCoilOutletTemp; using DXCoils::SimDXCoil; using FaultsManager::FaultsCoilSATSensor; @@ -718,7 +714,7 @@ namespace HVACDXHeatPumpSystem { // OutletTempDXCoil is the full capacity outlet temperature at PartLoadFrac = 1 from the CALL above. If this // temp is greater than the desired outlet temp, then run the compressor at PartLoadFrac = 1, otherwise find the // operating PLR. - OutletTempDXCoil = DXCoilOutletTemp(DXHeatPumpSystem(DXSystemNum).HeatPumpCoilIndex); + OutletTempDXCoil = state.dataDXCoils->DXCoilOutletTemp(DXHeatPumpSystem(DXSystemNum).HeatPumpCoilIndex); if (OutletTempDXCoil < DesOutTemp) { PartLoadFrac = 1.0; } else { @@ -1097,7 +1093,6 @@ namespace HVACDXHeatPumpSystem { // Using/Aliasing using DXCoils::CalcDXHeatingCoil; - using DXCoils::DXCoilOutletTemp; // Return value Real64 Residuum; // Residual to be minimized to zero @@ -1127,7 +1122,7 @@ namespace HVACDXHeatPumpSystem { CalcDXHeatingCoil(state, CoilIndex, PartLoadFrac, ContFanCycCoil, OnOffAirFlowFrac); - OutletAirTemp = DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par(2) - OutletAirTemp; return Residuum; diff --git a/src/EnergyPlus/HVACDXHeatPumpSystem.hh b/src/EnergyPlus/HVACDXHeatPumpSystem.hh index 1e29789ab66..990ae0bbbc0 100644 --- a/src/EnergyPlus/HVACDXHeatPumpSystem.hh +++ b/src/EnergyPlus/HVACDXHeatPumpSystem.hh @@ -69,9 +69,10 @@ namespace HVACDXHeatPumpSystem { // Data // MODULE PARAMETER DEFINITIONS extern Real64 const MinAirMassFlow; + // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run // DERIVED TYPE DEFINITIONS diff --git a/src/EnergyPlus/HVACDXSystem.cc b/src/EnergyPlus/HVACDXSystem.cc index 8fee4ec30c0..bde6a766646 100644 --- a/src/EnergyPlus/HVACDXSystem.cc +++ b/src/EnergyPlus/HVACDXSystem.cc @@ -122,9 +122,7 @@ namespace HVACDXSystem { // Data // MODULE PARAMETER DEFINITIONS Real64 const MinAirMassFlow(0.001); - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run + // Dehumidification control modes (DehumidControlMode) int const DehumidControl_None(0); int const DehumidControl_Multimode(1); @@ -678,7 +676,7 @@ namespace HVACDXSystem { } if (state.dataGlobal->DoCoilDirectSolutions && DXCoolingSystem(DXCoolSysNum).CoolingCoilType_Num == CoilDX_CoolingSingleSpeed) { - DXCoils::DisableLatentDegradation(DXCoolingSystem(DXCoolSysNum).CoolingCoilIndex); + DXCoils::DisableLatentDegradation(state, DXCoolingSystem(DXCoolSysNum).CoolingCoilIndex); } } // End of the DX System Loop @@ -1017,8 +1015,6 @@ namespace HVACDXSystem { // Using/Aliasing using namespace ScheduleManager; using DataHVACGlobals::TempControlTol; - using DXCoils::DXCoilOutletHumRat; - using DXCoils::DXCoilOutletTemp; using DXCoils::SimDXCoil; using DXCoils::SimDXCoilMultiMode; using DXCoils::SimDXCoilMultiSpeed; @@ -1151,12 +1147,12 @@ namespace HVACDXSystem { SimDXCoil(state, CompName, On, FirstHVACIteration, DXCoolingSystem(DXSystemNum).CoolingCoilIndex, FanOpMode, PartLoadFrac); NoOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); - NoLoadHumRatOut = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + NoLoadHumRatOut = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); // Get full load result PartLoadFrac = 1.0; SimDXCoil(state, CompName, On, FirstHVACIteration, DXCoolingSystem(DXSystemNum).CoolingCoilIndex, FanOpMode, PartLoadFrac); - FullLoadHumRatOut = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + FullLoadHumRatOut = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); FullOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); @@ -1176,7 +1172,7 @@ namespace HVACDXSystem { // OutletTempDXCoil is the full capacity outlet temperature at PartLoadFrac = 1 from the CALL above. If this // temp is greater than the desired outlet temp, then run the compressor at PartLoadFrac = 1, otherwise find the // operating PLR. - OutletTempDXCoil = DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletTempDXCoil = state.dataDXCoils->DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); if (OutletTempDXCoil > DesOutTemp) { PartLoadFrac = 1.0; } else { @@ -1243,7 +1239,7 @@ namespace HVACDXSystem { if (PartLoadFrac == 0.0) { OutletHumRatDXCoil = NoLoadHumRatOut; } else { - OutletHumRatDXCoil = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); } // If humidity setpoint is not satisfied and humidity control type is CoolReheat, @@ -1352,7 +1348,7 @@ namespace HVACDXSystem { EconomizerFlag); NoOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); - NoLoadHumRatOut = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + NoLoadHumRatOut = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); // Get full load result PartLoadFrac = 1.0; @@ -1367,7 +1363,7 @@ namespace HVACDXSystem { EconomizerFlag); FullOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); - FullLoadHumRatOut = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + FullLoadHumRatOut = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); ReqOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(DesOutTemp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); @@ -1772,11 +1768,11 @@ namespace HVACDXSystem { // formerly (v3 and beyond)COIL:DX:MULTISPEED:COOLINGEMPIRICAL // SUBROUTINE SimDXCoilMultiSpeed(CompName,SpeedRatio,CycRatio,CompIndex,SpeedNum,FanMode,CompOp) SimDXCoilMultiSpeed(state, CompName, 0.0, 1.0, DXCoolingSystem(DXSystemNum).CoolingCoilIndex); - OutletTempLS = DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletTempLS = state.dataDXCoils->DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); if (OutletTempLS > DesOutTemp && SensibleLoad) { CycRatio = 1.0; SimDXCoilMultiSpeed(state, CompName, 1.0, 1.0, DXCoolingSystem(DXSystemNum).CoolingCoilIndex); - OutletTempHS = DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletTempHS = state.dataDXCoils->DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); if (OutletTempHS < DesOutTemp) { Par(1) = double(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); Par(2) = DesOutTemp; @@ -1851,7 +1847,7 @@ namespace HVACDXSystem { // Simulate MultiSpeed DX coil at sensible result SimDXCoilMultiSpeed(state, CompName, SpeedRatio, CycRatio, DXCoolingSystem(DXSystemNum).CoolingCoilIndex); - OutletHumRatDXCoil = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); // If humidity setpoint is not satisfied and humidity control type is CoolReheat, // then overcool to meet moisture load @@ -1862,11 +1858,11 @@ namespace HVACDXSystem { // SUBROUTINE SimDXCoilMultiSpeed(CompName,SpeedRatio,CycRatio,CompIndex,SpeedNum,FanMode,CompOp) SimDXCoilMultiSpeed(state, CompName, 0.0, 1.0, DXCoolingSystem(DXSystemNum).CoolingCoilIndex); - OutletHumRatLS = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletHumRatLS = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); if (OutletHumRatLS > DesOutHumRat) { CycRatio = 1.0; SimDXCoilMultiSpeed(state, CompName, 1.0, 1.0, DXCoolingSystem(DXSystemNum).CoolingCoilIndex); - OutletHumRatHS = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletHumRatHS = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); if (OutletHumRatHS < DesOutHumRat) { Par(1) = double(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); Par(2) = DesOutHumRat; @@ -1943,13 +1939,13 @@ namespace HVACDXSystem { CompName, On, FirstHVACIteration, PartLoadFrac, DehumidMode, DXCoolingSystem(DXSystemNum).CoolingCoilIndex, FanOpMode); NoOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); - NoLoadHumRatOut = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + NoLoadHumRatOut = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); // Get full load result PartLoadFrac = 1.0; SimDXCoilMultiMode(state, CompName, On, FirstHVACIteration, PartLoadFrac, DehumidMode, DXCoolingSystem(DXSystemNum).CoolingCoilIndex, FanOpMode); - FullLoadHumRatOut = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + FullLoadHumRatOut = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); FullOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); @@ -1966,7 +1962,7 @@ namespace HVACDXSystem { PartLoadFrac = 1.0; // Else find the PLR to meet the load } else { - OutletTempDXCoil = DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletTempDXCoil = state.dataDXCoils->DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); if (OutletTempDXCoil > DesOutTemp) { PartLoadFrac = 1.0; } else { @@ -2007,7 +2003,7 @@ namespace HVACDXSystem { } } - OutletHumRatDXCoil = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); // If humidity setpoint is not satisfied and humidity control type is Multimode, // then turn on enhanced dehumidification mode 1 @@ -2039,8 +2035,8 @@ namespace HVACDXSystem { if (FullOutput >= 0) { PartLoadFrac = 0.0; } else { - OutletTempDXCoil = DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); - OutletHumRatDXCoil = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletTempDXCoil = state.dataDXCoils->DXCoilOutletTemp(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); // if sensible load and setpoint cannot be met, set PLR = 1. If no sensible load and // latent load exists and setpoint cannot be met, set PLR = 1. if ((OutletTempDXCoil >= DesOutTemp && SensibleLoad && DXCoolingSystem(DXSystemNum).RunOnSensibleLoad) || @@ -2139,7 +2135,7 @@ namespace HVACDXSystem { if (PartLoadFrac == 0.0) { OutletHumRatDXCoil = NoLoadHumRatOut; } else { - OutletHumRatDXCoil = DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(DXCoolingSystem(DXSystemNum).CoolingCoilIndex); } if ((OutletHumRatDXCoil > DesOutHumRat) && (DXCoolingSystem(DXSystemNum).DehumidControlType == DehumidControl_CoolReheat)) { @@ -2694,7 +2690,6 @@ namespace HVACDXSystem { // Using/Aliasing using DXCoils::CalcMultiSpeedDXCoil; - using DXCoils::DXCoilOutletTemp; // Return value Real64 Residuum; // residual to be minimized to zero @@ -2720,7 +2715,7 @@ namespace HVACDXSystem { CoilIndex = int(Par(1)); CalcMultiSpeedDXCoil(state, CoilIndex, SpeedRatio, 1.0); - OutletAirTemp = DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -2749,7 +2744,6 @@ namespace HVACDXSystem { // Using/Aliasing using DXCoils::CalcMultiSpeedDXCoil; - using DXCoils::DXCoilOutletHumRat; // Return value Real64 Residuum; // residual to be minimized to zero @@ -2775,7 +2769,7 @@ namespace HVACDXSystem { CoilIndex = int(Par(1)); CalcMultiSpeedDXCoil(state, CoilIndex, SpeedRatio, 1.0); - OutletAirHumRat = DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); Residuum = Par(2) - OutletAirHumRat; return Residuum; @@ -2804,7 +2798,6 @@ namespace HVACDXSystem { // Using/Aliasing using DXCoils::CalcMultiSpeedDXCoil; - using DXCoils::DXCoilOutletTemp; // Return value Real64 Residuum; // residual to be minimized to zero @@ -2830,7 +2823,7 @@ namespace HVACDXSystem { CoilIndex = int(Par(1)); CalcMultiSpeedDXCoil(state, CoilIndex, 0.0, CycRatio); - OutletAirTemp = DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -2859,7 +2852,6 @@ namespace HVACDXSystem { // Using/Aliasing using DXCoils::CalcMultiSpeedDXCoil; - using DXCoils::DXCoilOutletHumRat; // Return value Real64 Residuum; // residual to be minimized to zero @@ -2885,7 +2877,7 @@ namespace HVACDXSystem { CoilIndex = int(Par(1)); CalcMultiSpeedDXCoil(state, CoilIndex, 0.0, CycRatio); - OutletAirHumRat = DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); Residuum = Par(2) - OutletAirHumRat; return Residuum; @@ -2914,7 +2906,6 @@ namespace HVACDXSystem { // Using/Aliasing using DXCoils::CalcDoe2DXCoil; - using DXCoils::DXCoilOutletTemp; // Return value Real64 Residuum; // residual to be minimized to zero @@ -2943,7 +2934,7 @@ namespace HVACDXSystem { CoilIndex = int(Par(1)); FanOpMode = int(Par(5)); CalcDoe2DXCoil(state, CoilIndex, On, true, PartLoadRatio, FanOpMode); - OutletAirTemp = DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -2972,7 +2963,6 @@ namespace HVACDXSystem { // Using/Aliasing using DXCoils::CalcDoe2DXCoil; - using DXCoils::DXCoilOutletHumRat; // Return value Real64 Residuum; // residual to be minimized to zero @@ -3001,7 +2991,7 @@ namespace HVACDXSystem { CoilIndex = int(Par(1)); FanOpMode = int(Par(5)); CalcDoe2DXCoil(state, CoilIndex, On, true, PartLoadRatio, FanOpMode); - OutletAirHumRat = DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); Residuum = Par(2) - OutletAirHumRat; return Residuum; @@ -3029,7 +3019,6 @@ namespace HVACDXSystem { // REFERENCES: // Using/Aliasing - using DXCoils::DXCoilOutletTemp; using DXCoils::SimDXCoilMultiMode; // Return value @@ -3062,7 +3051,7 @@ namespace HVACDXSystem { DehumidMode = int(Par(3)); FanOpMode = int(Par(4)); SimDXCoilMultiMode(state,"", On, false, PartLoadRatio, DehumidMode, CoilIndex, FanOpMode); - OutletAirTemp = DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -3089,7 +3078,6 @@ namespace HVACDXSystem { // REFERENCES: // Using/Aliasing - using DXCoils::DXCoilOutletHumRat; using DXCoils::SimDXCoilMultiMode; // Return value @@ -3122,7 +3110,7 @@ namespace HVACDXSystem { DehumidMode = int(Par(3)); FanOpMode = int(Par(4)); SimDXCoilMultiMode(state,"", On, false, PartLoadRatio, DehumidMode, CoilIndex, FanOpMode); - OutletAirHumRat = DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); Residuum = Par(2) - OutletAirHumRat; return Residuum; diff --git a/src/EnergyPlus/HVACDXSystem.hh b/src/EnergyPlus/HVACDXSystem.hh index 7db27041bc9..38347e36894 100644 --- a/src/EnergyPlus/HVACDXSystem.hh +++ b/src/EnergyPlus/HVACDXSystem.hh @@ -76,8 +76,8 @@ namespace HVACDXSystem { // MODULE PARAMETER DEFINITIONS extern Real64 const MinAirMassFlow; // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run // Dehumidification control modes (DehumidControlMode) extern int const DehumidControl_None; extern int const DehumidControl_Multimode; diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index ac6c2d3d043..83a4b40d128 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -105,9 +105,6 @@ namespace HVACHXAssistedCoolingCoil { // Data // MODULE PARAMETER DEFINITIONS - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run // MODULE VARIABLE DECLARATIONS: int TotalNumHXAssistedCoils(0); // The total number of HXAssistedCoolingCoil compound objects @@ -156,7 +153,8 @@ namespace HVACHXAssistedCoolingCoil { CheckEquipName.deallocate(); } - void SimHXAssistedCoolingCoil(EnergyPlusData &state, std::string const &HXAssistedCoilName, // Name of HXAssistedCoolingCoil + void SimHXAssistedCoolingCoil(EnergyPlusData &state, + std::string const &HXAssistedCoilName, // Name of HXAssistedCoolingCoil bool const FirstHVACIteration, // FirstHVACIteration flag int const CompOp, // compressor operation; 1=on, 0=off Real64 const PartLoadRatio, // Part load ratio of Coil:DX:CoolingBypassFactorEmpirical @@ -227,7 +225,7 @@ namespace HVACHXAssistedCoolingCoil { } // Initialize HXAssistedCoolingCoil Flows - InitHXAssistedCoolingCoil(HXAssistedCoilNum); + InitHXAssistedCoolingCoil(state, HXAssistedCoilNum); if (present(HXUnitEnable)) { HXUnitOn = HXUnitEnable; @@ -796,7 +794,7 @@ namespace HVACHXAssistedCoolingCoil { // Beginning Initialization Section of the Module //****************************************************************************** - void InitHXAssistedCoolingCoil(int const HXAssistedCoilNum) // index for HXAssistedCoolingCoil + void InitHXAssistedCoolingCoil(EnergyPlusData &state, int const HXAssistedCoilNum) // index for HXAssistedCoolingCoil { // SUBROUTINE INFORMATION: @@ -811,33 +809,12 @@ namespace HVACHXAssistedCoolingCoil { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - // REFERENCES: - - // Using/Aliasing - using DXCoils::DXCoilFullLoadOutAirHumRat; - using DXCoils::DXCoilFullLoadOutAirTemp; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - // Do these initializations every time HXAssistedCoil(HXAssistedCoilNum).MassFlowRate = Node(HXAssistedCoil(HXAssistedCoilNum).HXAssistedCoilInletNodeNum).MassFlowRate; if (HXAssistedCoil(HXAssistedCoilNum).CoolingCoilType_Num == CoilDX_CoolingSingleSpeed) { - DXCoilFullLoadOutAirTemp(HXAssistedCoil(HXAssistedCoilNum).CoolingCoilIndex) = 0.0; - DXCoilFullLoadOutAirHumRat(HXAssistedCoil(HXAssistedCoilNum).CoolingCoilIndex) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirTemp(HXAssistedCoil(HXAssistedCoilNum).CoolingCoilIndex) = 0.0; + state.dataDXCoils->DXCoilFullLoadOutAirHumRat(HXAssistedCoil(HXAssistedCoilNum).CoolingCoilIndex) = 0.0; } else if (HXAssistedCoil(HXAssistedCoilNum).CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { // } diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh index c0f8289dee7..87b7a32e71a 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh @@ -69,8 +69,8 @@ namespace HVACHXAssistedCoolingCoil { // Data // MODULE PARAMETER DEFINITIONS // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run // DERIVED TYPE DEFINITIONS @@ -169,12 +169,13 @@ namespace HVACHXAssistedCoolingCoil { // Beginning Initialization Section of the Module //****************************************************************************** - void InitHXAssistedCoolingCoil(int const HXAssistedCoilNum); // index for HXAssistedCoolingCoil + void InitHXAssistedCoolingCoil(EnergyPlusData &state, int const HXAssistedCoilNum); // index for HXAssistedCoolingCoil // End Initialization Section of the Module //****************************************************************************** - void CalcHXAssistedCoolingCoil(EnergyPlusData &state, int const HXAssistedCoilNum, // Index number for HXAssistedCoolingCoil + void CalcHXAssistedCoolingCoil(EnergyPlusData &state, + int const HXAssistedCoilNum, // Index number for HXAssistedCoolingCoil bool const FirstHVACIteration, // FirstHVACIteration flag int const CompOp, // compressor operation; 1=on, 0=off Real64 const PartLoadRatio, // Cooling coil part load ratio diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc index b808e871def..b24d1c51b9d 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc @@ -168,10 +168,6 @@ namespace HVACMultiSpeedHeatPump { Cubic, // Cubic curve type }; - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run - static std::string const fluidNameSteam("STEAM"); // DERIVED TYPE DEFINITIONS @@ -1369,9 +1365,9 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(16), Alphas(17), "MSHP Heat receovery Nodes"); - SetMSHPDXCoilHeatRecoveryFlag(MSHeatPump(MSHPNum).DXCoolCoilIndex); + SetMSHPDXCoilHeatRecoveryFlag(state, MSHeatPump(MSHPNum).DXCoolCoilIndex); if (MSHeatPump(MSHPNum).DXHeatCoilIndex > 0) { - SetMSHPDXCoilHeatRecoveryFlag(MSHeatPump(MSHPNum).DXHeatCoilIndex); + SetMSHPDXCoilHeatRecoveryFlag(state, MSHeatPump(MSHPNum).DXHeatCoilIndex); } } else { MSHeatPump(MSHPNum).HeatRecActive = false; @@ -1465,7 +1461,7 @@ namespace HVACMultiSpeedHeatPump { if (state.dataGlobal->DoCoilDirectSolutions) { int MaxNumber = std::max(MSHeatPump(MSHPNum).NumOfSpeedCooling, MSHeatPump(MSHPNum).NumOfSpeedHeating); MSHeatPump(MSHPNum).FullOutput.allocate(MaxNumber); - DXCoils::DisableLatentDegradation(MSHeatPump(MSHPNum).DXCoolCoilIndex); + DXCoils::DisableLatentDegradation(state, MSHeatPump(MSHPNum).DXCoolCoilIndex); } // Generate a dynamic array for cooling if (MSHeatPump(MSHPNum).NumOfSpeedCooling > 0) { @@ -3464,8 +3460,6 @@ namespace HVACMultiSpeedHeatPump { // Using/Aliasing using DataHeatBalFanSys::ZT; - using DXCoils::DXCoil; - using DXCoils::DXCoilPartLoadRatio; using DXCoils::SimDXCoilMultiSpeed; using Fans::SimulateFanComponents; using HeatingCoils::SimulateHeatingCoilComponents; @@ -3500,14 +3494,14 @@ namespace HVACMultiSpeedHeatPump { OutletNode = MSHeatPump(MSHeatPumpNum).AirOutletNodeNum; InletNode = MSHeatPump(MSHeatPumpNum).AirInletNodeNum; if (MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex > 0) { - if (DXCoil(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex).IsSecondaryDXCoilInZone) { - OutsideDryBulbTemp = ZT(DXCoil(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex).SecZonePtr); + if (state.dataDXCoils->DXCoil(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex).IsSecondaryDXCoilInZone) { + OutsideDryBulbTemp = ZT(state.dataDXCoils->DXCoil(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex).SecZonePtr); } else { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; } } else if (MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex > 0) { - if (DXCoil(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex).IsSecondaryDXCoilInZone) { - OutsideDryBulbTemp = ZT(DXCoil(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex).SecZonePtr); + if (state.dataDXCoils->DXCoil(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex).IsSecondaryDXCoilInZone) { + OutsideDryBulbTemp = ZT(state.dataDXCoils->DXCoil(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex).SecZonePtr); } else { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; } @@ -3550,7 +3544,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).OpMode, CompOp); } - SaveCompressorPLR = DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex); } else { SimDXCoilMultiSpeed(state, MSHeatPump(MSHeatPumpNum).DXCoolCoilName, @@ -3584,7 +3578,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).OpMode, CompOp); } - SaveCompressorPLR = DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); } else { SimDXCoilMultiSpeed(state, MSHeatPump(MSHeatPumpNum).DXHeatCoilName, @@ -3649,7 +3643,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).OpMode, CompOp); } - SaveCompressorPLR = DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex); } else { SimDXCoilMultiSpeed(state, MSHeatPump(MSHeatPumpNum).DXCoolCoilName, @@ -3683,7 +3677,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).OpMode, CompOp); } - SaveCompressorPLR = DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); } else { SimDXCoilMultiSpeed(state, MSHeatPump(MSHeatPumpNum).DXHeatCoilName, @@ -3751,7 +3745,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).OpMode, CompOp); } - SaveCompressorPLR = DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXCoolCoilIndex); } else { SimDXCoilMultiSpeed(state, MSHeatPump(MSHeatPumpNum).DXCoolCoilName, @@ -3785,7 +3779,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).OpMode, CompOp); } - SaveCompressorPLR = DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); } else { SimDXCoilMultiSpeed(state, MSHeatPump(MSHeatPumpNum).DXHeatCoilName, diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.hh b/src/EnergyPlus/HVACMultiSpeedHeatPump.hh index 9f32e216210..cba857ca9ed 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.hh +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.hh @@ -93,8 +93,8 @@ namespace HVACMultiSpeedHeatPump { }; // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run // Types diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 9df3a72a178..0e8ed11c28d 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -128,11 +128,6 @@ namespace HVACUnitaryBypassVAV { // "Ventilation for Changeover-Bypass VAV Systems," D. Stanke, ASHRAE Journal Vol. 46, No. 11, November 2004. // Lawrence Berkeley Laboratory. Nov. 1993. DOE-2 Supplement Version 2.1E, Winklemann et.al. - // MODULE PARAMETER DEFINITIONS - // Compressor operation - int const On(1); // Normal compressor operation - int const Off(0); // Signal DXCoil that compressor should not run - // Dehumidification control modes (DehumidControlMode) for Multimode units only int const DehumidControl_None(0); int const DehumidControl_Multimode(1); @@ -2441,7 +2436,7 @@ namespace HVACUnitaryBypassVAV { } } } - SaveCompressorPLR = DXCoils::DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); } else if (SELECT_CASE_var == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { Real64 QZnReq(0.0); // Zone load (W), input to variable-speed DX coil Real64 QLatReq(0.0); // Zone latent load, input to variable-speed DX coil @@ -2965,7 +2960,7 @@ namespace HVACUnitaryBypassVAV { } else if (PartLoadFrac < 0.0) { PartLoadFrac = 0.0; } - SaveCompressorPLR = DXCoils::DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); } else { ShowFatalError(state, "SimCBVAV System: Invalid DX Cooling Coil=" + CBVAV(CBVAVNum).DXCoolCoilType); @@ -2982,7 +2977,7 @@ namespace HVACUnitaryBypassVAV { CBVAV(CBVAVNum).CoolCoilCompIndex, DataHVACGlobals::ContFanCycCoil, HXUnitOn); - SaveCompressorPLR = DXCoils::DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); } else if (CBVAV(CBVAVNum).DXCoolCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) { DXCoils::SimDXCoil(state, CBVAV(CBVAVNum).DXCoolCoilName, @@ -2992,7 +2987,7 @@ namespace HVACUnitaryBypassVAV { DataHVACGlobals::ContFanCycCoil, 0.0, OnOffAirFlowRatio); - SaveCompressorPLR = DXCoils::DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); } else if (CBVAV(CBVAVNum).DXCoolCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) { DXCoils::SimDXCoilMultiMode(state, CBVAV(CBVAVNum).DXCoolCoilName, @@ -3002,7 +2997,7 @@ namespace HVACUnitaryBypassVAV { 0, CBVAV(CBVAVNum).CoolCoilCompIndex, DataHVACGlobals::ContFanCycCoil); - SaveCompressorPLR = DXCoils::DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXCoolCoilIndexNum); } else if (CBVAV(CBVAVNum).DXCoolCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { Real64 QZnReq(0.0); // Zone load (W), input to variable-speed DX coil Real64 QLatReq(0.0); // Zone latent load, input to variable-speed DX coil @@ -3146,7 +3141,7 @@ namespace HVACUnitaryBypassVAV { 0.0, OnOffAirFlowRatio); } - SaveCompressorPLR = DXCoils::DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXHeatCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(CBVAV(CBVAVNum).DXHeatCoilIndexNum); } else { // HeatCoolMode = CoolingMode // simulate DX heating coil with compressor off when cooling load is required DXCoils::SimDXCoil(state, @@ -3803,7 +3798,7 @@ namespace HVACUnitaryBypassVAV { DXCoils::CalcDoe2DXCoil(state, CoilIndex, On, false, PartLoadFrac, DataHVACGlobals::ContFanCycCoil, _, OnOffAirFlowFrac); - Real64 OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Real64 Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -3869,7 +3864,7 @@ namespace HVACUnitaryBypassVAV { DXCoils::CalcDXHeatingCoil(state, CoilIndex, PartLoadFrac, DataHVACGlobals::ContFanCycCoil, OnOffAirFlowFrac); - Real64 OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Real64 Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -3901,7 +3896,7 @@ namespace HVACUnitaryBypassVAV { int DehumidMode = int(Par(3)); int FanOpMode = 2; DXCoils::SimDXCoilMultiMode(state, "", On, false, PartLoadRatio, DehumidMode, CoilIndex, FanOpMode); - Real64 OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Real64 Residuum = Par(2) - OutletAirTemp; return Residuum; diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.hh b/src/EnergyPlus/HVACUnitaryBypassVAV.hh index 9084a63a957..0fa7a38061a 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.hh +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.hh @@ -68,8 +68,8 @@ namespace HVACUnitaryBypassVAV { // Data // MODULE PARAMETER DEFINITIONS // Compressor operation - extern int const On; // Normal compressor operation - extern int const Off; // Signal DXCoil that compressor should not run + constexpr int On(1); // Normal compressor operation + constexpr int Off(0); // Signal DXCoil that compressor should not run // Dehumidification control modes (DehumidControlMode) for Multimode units only extern int const DehumidControl_None; diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 4308aab3cff..d31b095afea 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -102,9 +102,7 @@ #include #include -namespace EnergyPlus { - -namespace HVACVariableRefrigerantFlow { +namespace EnergyPlus::HVACVariableRefrigerantFlow { // Module containing the Variable Refrigerant Flow (VRF or VRV) simulation routines // MODULE INFORMATION: @@ -122,109 +120,6 @@ namespace HVACVariableRefrigerantFlow { using namespace Psychrometrics; using namespace DataPlant; - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run - - // Heat Recovery System used - int const No(1); // Heat Pump mode only - int const Yes(2); // Heat Pump or Heat Recovery Mode (not available at this time) - - // Defrost strategy - int const ReverseCycle(1); // uses reverse cycle defrost strategy - int const Resistive(2); // uses electric resistance heater for defrost - - // Defrost control - int const Timed(1); // defrost cycle is timed - int const OnDemand(2); // defrost cycle occurs only when required - - // Thermostat Priority Control Type - int const LoadPriority(1); // total of zone loads dictate operation in cooling or heating - int const ZonePriority(2); // # of zones requiring cooling or heating dictate operation in cooling or heating - int const ThermostatOffsetPriority(3); // zone with largest deviation from setpoint dictates operation - int const ScheduledPriority(4); // cooling and heating modes are scheduled - int const MasterThermostatPriority(5); // Master zone thermostat dictates operation - int const FirstOnPriority(6); // first unit to respond dictates operation (not used at this time) - - // Water Systems - int const CondensateDiscarded(1001); // default mode where water is "lost" - int const CondensateToTank(1002); // collect coil condensate from air and store in water storage tank - - int const WaterSupplyFromMains(101); // mains water line used as water source - int const WaterSupplyFromTank(102); // storage tank used as water source - - Real64 const MaxCap(1.0e+20); // limit of zone terminal unit capacity - - // VRF System Types (strings used in integer conversions) - int const NumVRFSystemTypes(1); - int const VRF_HeatPump(1); - Array1D_string const cVRFTypes(NumVRFSystemTypes, std::string("AirConditioner:VariableRefrigerantFlow")); - - static std::string const fluidNameSteam("STEAM"); - - // VRF Algorithm Type - int const AlgorithmTypeSysCurve(1); // VRF model based on system curve - int const AlgorithmTypeFluidTCtrl(2); // VRF model based on physics, appreciable for Fluid Temperature Control - - // Flag for hex operation - int const FlagCondMode(0); // Flag for the hex running as condenser [-] - int const FlagEvapMode(1); // Flag for the hex running as evaporator [-] - - // Flag for VRF operational mode - int const ModeCoolingOnly(1); // Flag for Cooling Only Mode [-] - int const ModeHeatingOnly(2); // Flag for Heating Only Mode [-] - int const ModeCoolingAndHeating(3); // Flag for Simultaneous Cooling and Heating Only Mode [-] - - bool GetVRFInputFlag(true); // Flag set to make sure you get input once - bool MyOneTimeFlag(true); // One time flag used to allocate MyEnvrnFlag and MySizeFlag - bool MyOneTimeSizeFlag(true); // One time flag used to allocate MyEnvrnFlag and MySizeFlag - bool ZoneEquipmentListNotChecked(true); // False after the Zone Equipment List has been checked for items - int NumVRFCond(0); // total number of VRF condensers (All VRF Algorithm Types) - int NumVRFCond_SysCurve(0); // total number of VRF condensers with VRF Algorithm Type 1 - int NumVRFCond_FluidTCtrl_HP(0); // total number of VRF condensers with VRF Algorithm Type 2 (HP) - int NumVRFCond_FluidTCtrl_HR(0); // total number of VRF condensers with VRF Algorithm Type 2 (HR) - int NumVRFTU(0); // total number of VRF terminal units - int NumVRFTULists(0); // The number of VRF TU lists - Real64 CompOnMassFlow(0.0); // Supply air mass flow rate w/ compressor ON - Real64 OACompOnMassFlow(0.0); // OA mass flow rate w/ compressor ON - Real64 CompOffMassFlow(0.0); // Supply air mass flow rate w/ compressor OFF - Real64 OACompOffMassFlow(0.0); // OA mass flow rate w/ compressor OFF - Real64 CompOnFlowRatio(0.0); // fan flow ratio when coil on - Real64 CompOffFlowRatio(0.0); // fan flow ratio when coil off - Real64 FanSpeedRatio(0.0); // ratio of air flow ratio passed to fan object - Real64 LoopDXCoolCoilRTF(0.0); // holds value of DX cooling coil RTF - Real64 LoopDXHeatCoilRTF(0.0); // holds value of DX heating coil RTF - Real64 CondenserWaterMassFlowRate(0.0); // VRF water-cooled condenser mass flow rate (kg/s) - Real64 CurrentEndTimeLast; // end time of last time step - Array1D_bool HeatingLoad; // defines a heating load on VRFTerminalUnits - Array1D_bool CoolingLoad; // defines a cooling load on VRFTerminalUnits - Array1D_bool LastModeHeating; // defines last mode was heating mode - Array1D_bool LastModeCooling; // defines last mode was cooling mode - Array1D_bool CheckEquipName; // Flag set to check equipment connections once - Array1D_bool MyEnvrnFlag; // Flag for initializing at beginning of each new environment - Array1D_bool MySizeFlag; // False after TU has been sized - Array1D_bool MyBeginTimeStepFlag; // Flag to sense beginning of time step - Array1D_bool MyVRFFlag; // used for sizing VRF inputs one time - Array1D_bool MyVRFCondFlag; // used to reset timer counter - Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers - Array1D_int NumCoolingLoads; // number of TU's requesting cooling - Array1D_int NumHeatingLoads; // number of TU's requesting heating - Array1D MaxCoolingCapacity; // maximum capacity of any terminal unit - Array1D MaxHeatingCapacity; // maximum capacity of any terminal unit - Array1D CoolCombinationRatio; // ratio of terminal unit capacity to VRF condenser capacity - Array1D HeatCombinationRatio; // ratio of terminal unit capacity to VRF condenser capacity - Array1D MaxDeltaT; // maximum zone temperature difference from setpoint - Array1D MinDeltaT; // minimum zone temperature difference from setpoint - Array1D SumCoolingLoads; // sum of cooling loads - Array1D SumHeatingLoads; // sum of heating loads - - // Object Data - Array1D VRF; // AirConditioner:VariableRefrigerantFlow object - std::unordered_map VrfUniqueNames; - Array1D VRFTU; // ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object - Array1D TerminalUnitList; // zoneTerminalUnitList object - Array1D VRFTUNumericFields; // holds VRF TU numeric input fields character field name - void SimulateVRF(EnergyPlusData &state, std::string const &CompName, bool const FirstHVACIteration, @@ -252,9 +147,6 @@ namespace HVACVariableRefrigerantFlow { // Simulate all terminal units // Once all terminal units have been simulated, simulate VRF condenser - using DXCoils::DXCoilTotalCooling; - using DXCoils::DXCoilTotalHeating; - int VRFTUNum; // current VRF system terminal unit index int VRFCondenser; // index to VRF AC system object - AirConditioner:VariableRefrigerantFlow int TUListNum; // index to VRF AC system terminal unit list @@ -265,14 +157,14 @@ namespace HVACVariableRefrigerantFlow { Real64 QZnReq; // Obtains and Allocates VRF system related parameters from input file - if (GetVRFInputFlag) { // First time subroutine has been entered + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { // First time subroutine has been entered GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } // CompIndex accounting if (CompIndex == 0) { - VRFTUNum = UtilityRoutines::FindItemInList(CompName, VRFTU); + VRFTUNum = UtilityRoutines::FindItemInList(CompName, state.dataHVACVarRefFlow->VRFTU); if (VRFTUNum == 0) { ShowFatalError(state, "SimulateVRF: VRF Terminal Unit not found=" + CompName); } @@ -287,60 +179,60 @@ namespace HVACVariableRefrigerantFlow { } else { VRFTUNum = CompIndex; - if (VRFTUNum > NumVRFTU || VRFTUNum < 1) { + if (VRFTUNum > state.dataHVACVarRefFlow->NumVRFTU || VRFTUNum < 1) { ShowFatalError(state, format("SimulateVRF: Invalid CompIndex passed={}, Number of VRF Terminal Units = {}, VRF Terminal Unit name = {}", VRFTUNum, - NumVRFTU, + state.dataHVACVarRefFlow->NumVRFTU, CompName)); } - if (CheckEquipName(VRFTUNum)) { - if (!CompName.empty() && CompName != VRFTU(VRFTUNum).Name) { + if (state.dataHVACVarRefFlow->CheckEquipName(VRFTUNum)) { + if (!CompName.empty() && CompName != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name) { ShowFatalError(state, format("SimulateVRF: Invalid CompIndex passed={}, VRF Terminal Unit name={}, stored VRF TU Name for that index={}", VRFTUNum, CompName, - VRFTU(VRFTUNum).Name)); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name)); } - CheckEquipName(VRFTUNum) = false; + state.dataHVACVarRefFlow->CheckEquipName(VRFTUNum) = false; } } // the VRF condenser index - VRFCondenser = VRFTU(VRFTUNum).VRFSysNum; + VRFCondenser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; - if ((VRF(VRFCondenser).CondenserType == DataHVACGlobals::WaterCooled) && (VRF(VRFCondenser).checkPlantCondTypeOneTime)) { + if ((state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserType == DataHVACGlobals::WaterCooled) && (state.dataHVACVarRefFlow->VRF(VRFCondenser).checkPlantCondTypeOneTime)) { // scan for loop connection data bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - VRF(VRFCondenser).Name, - VRF(VRFCondenser).VRFPlantTypeOfNum, - VRF(VRFCondenser).SourceLoopNum, - VRF(VRFCondenser).SourceLoopSideNum, - VRF(VRFCondenser).SourceBranchNum, - VRF(VRFCondenser).SourceCompNum, + state.dataHVACVarRefFlow->VRF(VRFCondenser).Name, + state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFPlantTypeOfNum, + state.dataHVACVarRefFlow->VRF(VRFCondenser).SourceLoopNum, + state.dataHVACVarRefFlow->VRF(VRFCondenser).SourceLoopSideNum, + state.dataHVACVarRefFlow->VRF(VRFCondenser).SourceBranchNum, + state.dataHVACVarRefFlow->VRF(VRFCondenser).SourceCompNum, errFlag, _, _, _, - VRF(VRFCondenser).CondenserNodeNum, + state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserNodeNum, _); if (errFlag) { ShowSevereError(state, "GetVRFInput: Error scanning for plant loop data"); } - VRF(VRFCondenser).checkPlantCondTypeOneTime = false; + state.dataHVACVarRefFlow->VRF(VRFCondenser).checkPlantCondTypeOneTime = false; } // the terminal unit list object index - TUListNum = VRFTU(VRFTUNum).TUListIndex; + TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; // the entry number in the terminal unit list (which item in the terminal unit list, e.g. second in list) - IndexToTUInTUList = VRFTU(VRFTUNum).IndexToTUInTUList; + IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; // index to cooling coil (coil is optional but at least one must be present) - DXCoolingCoilIndex = VRFTU(VRFTUNum).CoolCoilIndex; + DXCoolingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex; // index to heating coil (coil is optional but at least one must be present) - DXHeatingCoilIndex = VRFTU(VRFTUNum).HeatCoilIndex; + DXHeatingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex; QZnReq = 0.0; // Initialize terminal unit @@ -350,54 +242,54 @@ namespace HVACVariableRefrigerantFlow { SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); // mark this terminal unit as simulated - TerminalUnitList(TUListNum).IsSimulated(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).IsSimulated(IndexToTUInTUList) = true; // keep track of individual coil loads if (DXCoolingCoilIndex > 0) { - TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) = DXCoilTotalCooling(DXCoolingCoilIndex); + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) = state.dataDXCoils->DXCoilTotalCooling(DXCoolingCoilIndex); } else { - TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) = 0.0; + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(IndexToTUInTUList) = 0.0; } if (DXHeatingCoilIndex > 0) { - TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) = DXCoilTotalHeating(DXHeatingCoilIndex); + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) = state.dataDXCoils->DXCoilTotalHeating(DXHeatingCoilIndex); } else { - TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) = 0.0; + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(IndexToTUInTUList) = 0.0; } // Report the current VRF terminal unit - ReportVRFTerminalUnit(VRFTUNum); + ReportVRFTerminalUnit(state, VRFTUNum); - if (VRFTU(VRFTUNum).TotalCoolingRate > 0.0) CoolingActive = true; - if (VRFTU(VRFTUNum).TotalHeatingRate > 0.0) HeatingActive = true; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate > 0.0) CoolingActive = true; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate > 0.0) HeatingActive = true; // make sure all TU in a list are able to get simulated, otherwise condenser is never simulated ** // either fatal on GetInput, or keep track of unused TU's and set their respective flag to TRUE ** // after all VRF terminal units have been simulated, call the VRF condenser model - if (all(TerminalUnitList(TUListNum).IsSimulated)) { + if (all(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).IsSimulated)) { - if (VRF(VRFCondenser).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state); + state.dataHVACVarRefFlow->VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state); } else { // Algorithm Type: VRF model based on system curve CalcVRFCondenser(state, VRFCondenser); } - ReportVRFCondenser(VRFCondenser); + ReportVRFCondenser(state, VRFCondenser); - if (VRF(VRFCondenser).CondenserType == DataHVACGlobals::WaterCooled) UpdateVRFCondenser(VRFCondenser); + if (state.dataHVACVarRefFlow->VRF(VRFCondenser).CondenserType == DataHVACGlobals::WaterCooled) UpdateVRFCondenser(state, VRFCondenser); } } PlantComponent *VRFCondenserEquipment::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data if it hasn't been done already - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } // Now look for this object in the list - for (auto &obj : VRF) { + for (auto &obj : state.dataHVACVarRefFlow->VRF) { if (obj.Name == objectName) { return &obj; } @@ -444,7 +336,7 @@ namespace HVACVariableRefrigerantFlow { this->WaterCondenserMassFlow, FirstHVACIteration); } else { - ShowFatalError(state, "SimVRFCondenserPlant:: Invalid loop connection " + cVRFTypes(VRF_HeatPump)); + ShowFatalError(state, "SimVRFCondenserPlant:: Invalid loop connection " + std::string(cVRFTypes(VRF_HeatPump))); } } @@ -461,9 +353,6 @@ namespace HVACVariableRefrigerantFlow { // If terminal units require more capacity than can be delivered by condenser, a limit is set. using CurveManager::CurveValue; - using DXCoils::DXCoilCoolInletAirWBTemp; - using DXCoils::DXCoilHeatInletAirDBTemp; - using DXCoils::DXCoilHeatInletAirWBTemp; using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::SetComponentFlowRate; @@ -526,8 +415,8 @@ namespace HVACVariableRefrigerantFlow { // FLOW // variable initializations - int TUListNum = VRF(VRFCond).ZoneTUListPtr; - int NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + int TUListNum = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; + int NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; int NumTUInCoolingMode = 0; // number of terminal units actually cooling int NumTUInHeatingMode = 0; // number of terminal units actually heating Real64 TUCoolingLoad = 0.0; // sum of TU's cooling coil load {W} @@ -545,26 +434,26 @@ namespace HVACVariableRefrigerantFlow { Real64 TotalTUCoolingCapacity = 0.0; // sum of TU's cooling capacity including piping losses (W) Real64 TotalTUHeatingCapacity = 0.0; // sum of TU's heating capacity including piping losses (W) - VRF(VRFCond).ElecCoolingPower = 0.0; - VRF(VRFCond).ElecHeatingPower = 0.0; - VRF(VRFCond).CrankCaseHeaterPower = 0.0; - VRF(VRFCond).EvapCondPumpElecPower = 0.0; - VRF(VRFCond).EvapWaterConsumpRate = 0.0; - VRF(VRFCond).DefrostPower = 0.0; - VRF(VRFCond).OperatingCoolingCOP = 0.0; - VRF(VRFCond).OperatingHeatingCOP = 0.0; - VRF(VRFCond).OperatingCOP = 0.0; - VRF(VRFCond).SCHE = 0.0; - VRF(VRFCond).BasinHeaterPower = 0.0; - VRF(VRFCond).VRFHeatRec = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).EvapWaterConsumpRate = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingCoolingCOP = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingHeatingCOP = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingCOP = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).SCHE = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPower = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatRec = 0.0; // set condenser entering air conditions - if (VRF(VRFCond).CondenserNodeNum != 0) { - OutdoorDryBulb = DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).Temp; - if (VRF(VRFCond).CondenserType != DataHVACGlobals::WaterCooled) { - OutdoorHumRat = DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).HumRat; - OutdoorPressure = DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).Press; - OutdoorWetBulb = DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).OutAirWetBulb; + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum != 0) { + OutdoorDryBulb = DataLoopNode::Node(state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp; + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType != DataHVACGlobals::WaterCooled) { + OutdoorHumRat = DataLoopNode::Node(state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).HumRat; + OutdoorPressure = DataLoopNode::Node(state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Press; + OutdoorWetBulb = DataLoopNode::Node(state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).OutAirWetBulb; } else { OutdoorHumRat = state.dataEnvrn->OutHumRat; OutdoorPressure = state.dataEnvrn->OutBaroPress; @@ -577,140 +466,140 @@ namespace HVACVariableRefrigerantFlow { OutdoorWetBulb = state.dataEnvrn->OutWetBulbTemp; } - if (VRF(VRFCond).CondenserType == DataHVACGlobals::AirCooled) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::AirCooled) { CondInletTemp = OutdoorDryBulb; // Outdoor dry-bulb temp - } else if (VRF(VRFCond).CondenserType == DataHVACGlobals::EvapCooled) { + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::EvapCooled) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat); - CondAirMassFlow = RhoAir * VRF(VRFCond).EvapCondAirVolFlowRate; + CondAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate; // (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) - CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - VRF(VRFCond).EvapCondEffectiveness); + CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondEffectiveness); CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure); - } else if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { CondInletTemp = OutdoorDryBulb; // node inlet temp from above OutdoorWetBulb = CondInletTemp; // for watercooled - CondWaterMassFlow = VRF(VRFCond).WaterCondenserDesignMassFlow; + CondWaterMassFlow = state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow; } else { assert(false); } - VRF(VRFCond).CondenserInletTemp = CondInletTemp; + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserInletTemp = CondInletTemp; // sum loads on TU coils for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUCoolingLoad += TerminalUnitList(TUListNum).TotalCoolLoad(NumTU); - TUHeatingLoad += TerminalUnitList(TUListNum).TotalHeatLoad(NumTU); + TUCoolingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU); + TUHeatingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU); } - VRF(VRFCond).TUCoolingLoad = TUCoolingLoad; - VRF(VRFCond).TUHeatingLoad = TUHeatingLoad; + state.dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad = TUCoolingLoad; + state.dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad = TUHeatingLoad; // no need to do anything else if the terminal units are off if (TUCoolingLoad == 0.0 && TUHeatingLoad == 0.0) { - VRF(VRFCond).SUMultiplier = 0.0; - VRF(VRFCond).VRFCondPLR = 0.0; - VRF(VRFCond).VRFCondRTF = 0.0; - VRF(VRFCond).VRFCondCyclingRatio = 0.0; - VRF(VRFCond).QCondenser = 0.0; - VRF(VRFCond).TotalCoolingCapacity = 0.0; - VRF(VRFCond).TotalHeatingCapacity = 0.0; - VRF(VRFCond).OperatingMode = 0.0; - VRF(VRFCond).HRHeatingActive = false; - VRF(VRFCond).HRCoolingActive = false; - CurrentEndTimeLast = double((state.dataGlobal->DayOfSim - 1) * 24) + state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone + DataHVACGlobals::SysTimeElapsed; - if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { - CondenserWaterMassFlowRate = 0.0; - SetComponentFlowRate(state, CondenserWaterMassFlowRate, - VRF(VRFCond).CondenserNodeNum, - VRF(VRFCond).CondenserOutletNodeNum, - VRF(VRFCond).SourceLoopNum, - VRF(VRFCond).SourceLoopSideNum, - VRF(VRFCond).SourceBranchNum, - VRF(VRFCond).SourceCompNum); - VRF(VRFCond).WaterCondenserMassFlow = CondenserWaterMassFlowRate; - VRF(VRFCond).CondenserSideOutletTemp = CondInletTemp; + state.dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondCyclingRatio = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingMode = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = false; + state.dataHVACVarRefFlow->CurrentEndTimeLast = double((state.dataGlobal->DayOfSim - 1) * 24) + state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone + DataHVACGlobals::SysTimeElapsed; + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + state.dataHVACVarRefFlow->CondenserWaterMassFlowRate = 0.0; + SetComponentFlowRate(state, state.dataHVACVarRefFlow->CondenserWaterMassFlowRate, + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum, + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopSideNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceBranchNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceCompNum); + state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserMassFlow = state.dataHVACVarRefFlow->CondenserWaterMassFlowRate; + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserSideOutletTemp = CondInletTemp; } return; } // switch modes if summed coil capacity shows opposite operating mode // if total TU heating exceeds total TU cooling * ( 1 + 1/COP) then system is in heating mode - if (CoolingLoad(VRFCond) && TUHeatingLoad > (TUCoolingLoad * (1.0 + 1.0 / VRF(VRFCond).CoolingCOP))) { - HeatingLoad(VRFCond) = true; - CoolingLoad(VRFCond) = false; - VRF(VRFCond).ModeChange = true; - if (!LastModeHeating(VRFCond)) { - LastModeHeating(VRFCond) = true; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && TUHeatingLoad > (TUCoolingLoad * (1.0 + 1.0 / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP))) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange = true; + if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { + state.dataHVACVarRefFlow->LastModeHeating(VRFCond) = true; // reset heat recovery startup timer - VRF(VRFCond).HRTimer = 0.0; - VRF(VRFCond).HRHeatingActive = false; - VRF(VRFCond).HRCoolingActive = false; - } - } else if (HeatingLoad(VRFCond) && (TUCoolingLoad * (1.0 + 1.0 / VRF(VRFCond).CoolingCOP)) > TUHeatingLoad) { - CoolingLoad(VRFCond) = true; - HeatingLoad(VRFCond) = false; - VRF(VRFCond).ModeChange = true; - if (!LastModeCooling(VRFCond)) { - LastModeCooling(VRFCond) = true; + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = false; + } + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && (TUCoolingLoad * (1.0 + 1.0 / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP)) > TUHeatingLoad) { + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange = true; + if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { + state.dataHVACVarRefFlow->LastModeCooling(VRFCond) = true; // reset heat recovery startup timer - VRF(VRFCond).HRTimer = 0.0; - VRF(VRFCond).HRHeatingActive = false; - VRF(VRFCond).HRCoolingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = false; } } else if (TUCoolingLoad > 0.0 && TUHeatingLoad > 0.0 && - ((CoolingLoad(VRFCond) && LastModeHeating(VRFCond)) || (HeatingLoad(VRFCond) && LastModeCooling(VRFCond)))) { - VRF(VRFCond).ModeChange = true; + ((state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) || (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && state.dataHVACVarRefFlow->LastModeCooling(VRFCond)))) { + state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange = true; // reset heat recovery startup timer - VRF(VRFCond).HRTimer = 0.0; - VRF(VRFCond).HRHeatingActive = false; - VRF(VRFCond).HRCoolingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = false; } // loop through TU's and calculate average inlet conditions for active coils for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = VRFTU(TUIndex).CoolCoilIndex; - HeatCoilIndex = VRFTU(TUIndex).HeatCoilIndex; - TUParasiticPower += VRFTU(TUIndex).ParasiticCoolElecPower + VRFTU(TUIndex).ParasiticHeatElecPower; - TUFanPower += VRFTU(TUIndex).FanPower; - - if (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) { - SumCoolInletWB += DXCoilCoolInletAirWBTemp(CoolCoilIndex) * TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TUCoolingLoad; + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; + TUParasiticPower += state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticCoolElecPower + state.dataHVACVarRefFlow->VRFTU(TUIndex).ParasiticHeatElecPower; + TUFanPower += state.dataHVACVarRefFlow->VRFTU(TUIndex).FanPower; + + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) { + SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(CoolCoilIndex) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TUCoolingLoad; ++NumTUInCoolingMode; } - if (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) { - SumHeatInletDB += DXCoilHeatInletAirDBTemp(HeatCoilIndex) * TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad; - SumHeatInletWB += DXCoilHeatInletAirWBTemp(HeatCoilIndex) * TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) { + SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(HeatCoilIndex) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad; + SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(HeatCoilIndex) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TUHeatingLoad; ++NumTUInHeatingMode; } } - bool CoolingCoilAvailableFlag = any(TerminalUnitList(TUListNum).CoolingCoilAvailable); - bool HeatingCoilAvailableFlag = any(TerminalUnitList(TUListNum).HeatingCoilAvailable); + bool CoolingCoilAvailableFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailable); + bool HeatingCoilAvailableFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailable); // calculate capacities and energy use - if (CoolingLoad(VRFCond) && CoolingCoilAvailableFlag) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingCoilAvailableFlag) { InletAirWetBulbC = SumCoolInletWB; - TotCoolCapTempModFac = CurveValue(state, VRF(VRFCond).CoolCapFT, InletAirWetBulbC, CondInletTemp); - TotCoolEIRTempModFac = CurveValue(state, VRF(VRFCond).CoolEIRFT, InletAirWetBulbC, CondInletTemp); + TotCoolCapTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolCapFT, InletAirWetBulbC, CondInletTemp); + TotCoolEIRTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFT, InletAirWetBulbC, CondInletTemp); // recalculate cooling Cap and EIR curve output if using boundary curve along with dual Cap and EIR curves. - if (VRF(VRFCond).CoolBoundaryCurvePtr > 0) { - CoolOABoundary = CurveValue(state, VRF(VRFCond).CoolBoundaryCurvePtr, InletAirWetBulbC); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolBoundaryCurvePtr > 0) { + CoolOABoundary = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolBoundaryCurvePtr, InletAirWetBulbC); if (OutdoorDryBulb > CoolOABoundary) { - if (VRF(VRFCond).CoolCapFTHi > 0) TotCoolCapTempModFac = CurveValue(state, VRF(VRFCond).CoolCapFTHi, InletAirWetBulbC, CondInletTemp); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolCapFTHi > 0) TotCoolCapTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolCapFTHi, InletAirWetBulbC, CondInletTemp); } } - if (VRF(VRFCond).EIRCoolBoundaryCurvePtr > 0) { - CoolOABoundary = CurveValue(state, VRF(VRFCond).EIRCoolBoundaryCurvePtr, InletAirWetBulbC); + if (state.dataHVACVarRefFlow->VRF(VRFCond).EIRCoolBoundaryCurvePtr > 0) { + CoolOABoundary = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).EIRCoolBoundaryCurvePtr, InletAirWetBulbC); if (OutdoorDryBulb > CoolOABoundary) { - if (VRF(VRFCond).CoolEIRFTHi > 0) TotCoolEIRTempModFac = CurveValue(state, VRF(VRFCond).CoolEIRFTHi, InletAirWetBulbC, CondInletTemp); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFTHi > 0) TotCoolEIRTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFTHi, InletAirWetBulbC, CondInletTemp); } } // Warn user if curve output goes negative if (TotCoolCapTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) { - if (VRF(VRFCond).CoolCapFTErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + VRF(VRFCond).Name + "\":"); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolCapFTErrorIndex == 0) { + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\":"); ShowContinueError( state, format(" Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCoolCapTempModFac)); @@ -722,9 +611,9 @@ namespace HVACVariableRefrigerantFlow { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + VRF(VRFCond).Name + + ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\": Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", - VRF(VRFCond).CoolCapFTErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).CoolCapFTErrorIndex, TotCoolCapTempModFac, TotCoolCapTempModFac); TotCoolCapTempModFac = 0.0; @@ -734,8 +623,8 @@ namespace HVACVariableRefrigerantFlow { // Warn user if curve output goes negative if (TotCoolEIRTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) { - if (VRF(VRFCond).EIRFTempCoolErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + VRF(VRFCond).Name + "\":"); + if (state.dataHVACVarRefFlow->VRF(VRFCond).EIRFTempCoolErrorIndex == 0) { + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\":"); ShowContinueError(state, format(" Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).", TotCoolEIRTempModFac)); @@ -747,20 +636,20 @@ namespace HVACVariableRefrigerantFlow { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + VRF(VRFCond).Name + + ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\": Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...", - VRF(VRFCond).EIRFTempCoolErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).EIRFTempCoolErrorIndex, TotCoolEIRTempModFac, TotCoolEIRTempModFac); TotCoolEIRTempModFac = 0.0; } } - TotalCondCoolingCapacity = VRF(VRFCond).CoolingCapacity * CoolCombinationRatio(VRFCond) * TotCoolCapTempModFac; - TotalTUCoolingCapacity = TotalCondCoolingCapacity * VRF(VRFCond).PipingCorrectionCooling; + TotalCondCoolingCapacity = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * state.dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) * TotCoolCapTempModFac; + TotalTUCoolingCapacity = TotalCondCoolingCapacity * state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling; if (TotalCondCoolingCapacity > 0.0) { - CoolingPLR = (TUCoolingLoad / VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacity; + CoolingPLR = (TUCoolingLoad / state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacity; } else { CoolingPLR = 0.0; } @@ -768,8 +657,8 @@ namespace HVACVariableRefrigerantFlow { // Warn user if curve output goes negative if (TotCoolCapTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) { - if (VRF(VRFCond).CoolCapFTErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + VRF(VRFCond).Name + "\":"); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolCapFTErrorIndex == 0) { + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\":"); ShowContinueError( state, format(" Cooling Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotCoolCapTempModFac)); @@ -781,9 +670,9 @@ namespace HVACVariableRefrigerantFlow { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + VRF(VRFCond).Name + + ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\": Cooling Capacity Modifier curve (function of temperature) output is negative warning continues...", - VRF(VRFCond).CoolCapFTErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).CoolCapFTErrorIndex, TotCoolCapTempModFac, TotCoolCapTempModFac); TotCoolCapTempModFac = 0.0; @@ -792,8 +681,8 @@ namespace HVACVariableRefrigerantFlow { // Warn user if curve output goes negative if (TotCoolEIRTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag && NumTUInCoolingMode > 0) { - if (VRF(VRFCond).EIRFTempCoolErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + VRF(VRFCond).Name + "\":"); + if (state.dataHVACVarRefFlow->VRF(VRFCond).EIRFTempCoolErrorIndex == 0) { + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\":"); ShowContinueError(state, format(" Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).", TotCoolEIRTempModFac)); @@ -805,64 +694,64 @@ namespace HVACVariableRefrigerantFlow { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + VRF(VRFCond).Name + + ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\": Cooling Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...", - VRF(VRFCond).EIRFTempCoolErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).EIRFTempCoolErrorIndex, TotCoolEIRTempModFac, TotCoolEIRTempModFac); TotCoolEIRTempModFac = 0.0; } } - } else if (HeatingLoad(VRFCond) && HeatingCoilAvailableFlag) { + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingCoilAvailableFlag) { InletAirDryBulbC = SumHeatInletDB; InletAirWetBulbC = SumHeatInletWB; { - auto const SELECT_CASE_var(VRF(VRFCond).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).HeatingPerformanceOATType); if (SELECT_CASE_var == DataHVACGlobals::DryBulbIndicator) { - TotHeatCapTempModFac = CurveValue(state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, CondInletTemp); - TotHeatEIRTempModFac = CurveValue(state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, CondInletTemp); + TotHeatCapTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFT, InletAirDryBulbC, CondInletTemp); + TotHeatEIRTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, CondInletTemp); } else if (SELECT_CASE_var == DataHVACGlobals::WetBulbIndicator) { - TotHeatCapTempModFac = CurveValue(state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, OutdoorWetBulb); - TotHeatEIRTempModFac = CurveValue(state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, OutdoorWetBulb); + TotHeatCapTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFT, InletAirDryBulbC, OutdoorWetBulb); + TotHeatEIRTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, OutdoorWetBulb); } else { TotHeatCapTempModFac = 1.0; TotHeatEIRTempModFac = 1.0; } } // recalculate heating Cap and EIR curve output if using boundary curve along with dual Cap and EIR curves. - if (VRF(VRFCond).HeatBoundaryCurvePtr > 0) { - HeatOABoundary = CurveValue(state, VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatBoundaryCurvePtr > 0) { + HeatOABoundary = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); { - auto const SELECT_CASE_var(VRF(VRFCond).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).HeatingPerformanceOATType); if (SELECT_CASE_var == DataHVACGlobals::DryBulbIndicator) { if (OutdoorDryBulb > HeatOABoundary) { - if (VRF(VRFCond).HeatCapFTHi > 0) - TotHeatCapTempModFac = CurveValue(state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, CondInletTemp); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTHi > 0) + TotHeatCapTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, CondInletTemp); } } else if (SELECT_CASE_var == DataHVACGlobals::WetBulbIndicator) { if (OutdoorWetBulb > HeatOABoundary) { - if (VRF(VRFCond).HeatCapFTHi > 0) - TotHeatCapTempModFac = CurveValue(state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, OutdoorWetBulb); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTHi > 0) + TotHeatCapTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, OutdoorWetBulb); } } else { TotHeatCapTempModFac = 1.0; } } } - if (VRF(VRFCond).EIRHeatBoundaryCurvePtr > 0) { - HeatOABoundary = CurveValue(state, VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); + if (state.dataHVACVarRefFlow->VRF(VRFCond).EIRHeatBoundaryCurvePtr > 0) { + HeatOABoundary = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); { - auto const SELECT_CASE_var(VRF(VRFCond).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).HeatingPerformanceOATType); if (SELECT_CASE_var == DataHVACGlobals::DryBulbIndicator) { if (OutdoorDryBulb > HeatOABoundary) { - if (VRF(VRFCond).HeatEIRFTHi > 0) - TotHeatEIRTempModFac = CurveValue(state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, CondInletTemp); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFTHi > 0) + TotHeatEIRTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, CondInletTemp); } } else if (SELECT_CASE_var == DataHVACGlobals::WetBulbIndicator) { if (OutdoorWetBulb > HeatOABoundary) { - if (VRF(VRFCond).HeatEIRFTHi > 0) - TotHeatEIRTempModFac = CurveValue(state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, OutdoorWetBulb); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFTHi > 0) + TotHeatEIRTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, OutdoorWetBulb); } } else { TotHeatEIRTempModFac = 1.0; @@ -873,13 +762,13 @@ namespace HVACVariableRefrigerantFlow { // Warn user if curve output goes negative if (TotHeatCapTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag && NumTUInHeatingMode > 0) { - if (VRF(VRFCond).HeatCapFTErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + VRF(VRFCond).Name + "\":"); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTErrorIndex == 0) { + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\":"); ShowContinueError( state, format(" Heating Capacity Modifier curve (function of temperature) output is negative ({:.3T}).", TotHeatCapTempModFac)); - auto const SELECT_CASE_var(VRF(VRFCond).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).HeatingPerformanceOATType); if (SELECT_CASE_var == DataHVACGlobals::DryBulbIndicator) { ShowContinueError(state, format(" Negative value occurs using an outdoor air temperature of {:.1T} C and an average indoor air " @@ -898,9 +787,9 @@ namespace HVACVariableRefrigerantFlow { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + VRF(VRFCond).Name + + ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\": Heating Capacity Ratio Modifier curve (function of temperature) output is negative warning continues...", - VRF(VRFCond).HeatCapFTErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTErrorIndex, TotHeatCapTempModFac, TotHeatCapTempModFac); TotHeatCapTempModFac = 0.0; @@ -909,13 +798,13 @@ namespace HVACVariableRefrigerantFlow { // Warn user if curve output goes negative if (TotHeatEIRTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag && NumTUInHeatingMode > 0) { - if (VRF(VRFCond).EIRFTempHeatErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + VRF(VRFCond).Name + "\":"); + if (state.dataHVACVarRefFlow->VRF(VRFCond).EIRFTempHeatErrorIndex == 0) { + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\":"); ShowContinueError(state, format(" Heating Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).", TotHeatEIRTempModFac)); { - auto const SELECT_CASE_var(VRF(VRFCond).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).HeatingPerformanceOATType); if (SELECT_CASE_var == DataHVACGlobals::DryBulbIndicator) { ShowContinueError(state, format(" Negative value occurs using an outdoor air dry-bulb temperature of {:.1T} C and an " @@ -935,9 +824,9 @@ namespace HVACVariableRefrigerantFlow { ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } ShowRecurringWarningErrorAtEnd(state, - ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + VRF(VRFCond).Name + + ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\": Heating Energy Input Ratio Modifier curve (function of temperature) output is negative warning continues...", - VRF(VRFCond).EIRFTempHeatErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).EIRFTempHeatErrorIndex, TotHeatEIRTempModFac, TotHeatEIRTempModFac); TotHeatEIRTempModFac = 0.0; @@ -951,7 +840,7 @@ namespace HVACVariableRefrigerantFlow { InputPowerMultiplier = 1.0; // Check outdoor temperature to determine of defrost is active - if (OutdoorDryBulb <= VRF(VRFCond).MaxOATDefrost && VRF(VRFCond).CondenserType != DataHVACGlobals::WaterCooled) { + if (OutdoorDryBulb <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATDefrost && state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType != DataHVACGlobals::WaterCooled) { // Calculating adjustment factors for defrost // Calculate delta w through outdoor coil by assuming a coil temp of 0.82*DBT-9.7(F) per DOE2.1E @@ -959,8 +848,8 @@ namespace HVACVariableRefrigerantFlow { OutdoorCoildw = max(1.0e-6, (OutdoorHumRat - PsyWFnTdpPb(state, OutdoorCoilT, OutdoorPressure))); // Calculate defrost adjustment factors depending on defrost control type - if (VRF(VRFCond).DefrostControl == Timed) { - FractionalDefrostTime = VRF(VRFCond).DefrostFraction; + if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostControl == Timed) { + FractionalDefrostTime = state.dataHVACVarRefFlow->VRF(VRFCond).DefrostFraction; if (FractionalDefrostTime > 0.0) { HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw; InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw; @@ -973,15 +862,15 @@ namespace HVACVariableRefrigerantFlow { if (FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (VRF(VRFCond).DefrostStrategy == ReverseCycle) { - LoadDueToDefrost = (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (VRF(VRFCond).HeatingCapacity / 1.01667); - DefrostEIRTempModFac = CurveValue(state, VRF(VRFCond).DefrostEIRPtr, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostStrategy == ReverseCycle) { + LoadDueToDefrost = (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / 1.01667); + DefrostEIRTempModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).DefrostEIRPtr, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); // Warn user if curve output goes negative if (DefrostEIRTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag) { - if (VRF(VRFCond).DefrostHeatErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + VRF(VRFCond).Name + "\":"); + if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostHeatErrorIndex == 0) { + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\":"); ShowContinueError( state, format(" Defrost Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).", @@ -993,135 +882,135 @@ namespace HVACVariableRefrigerantFlow { InletAirWetBulbC)); ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation."); } - ShowRecurringWarningErrorAtEnd(state, ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + VRF(VRFCond).Name + + ShowRecurringWarningErrorAtEnd(state, ccSimPlantEquipTypes(TypeOf_HeatPumpVRF) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\": Defrost Energy Input Ratio Modifier curve (function of temperature) output " "is negative warning continues...", - VRF(VRFCond).DefrostHeatErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostHeatErrorIndex, DefrostEIRTempModFac, DefrostEIRTempModFac); DefrostEIRTempModFac = 0.0; } } - VRF(VRFCond).DefrostPower = DefrostEIRTempModFac * (VRF(VRFCond).HeatingCapacity / 1.01667) * FractionalDefrostTime; + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower = DefrostEIRTempModFac * (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / 1.01667) * FractionalDefrostTime; } else { // Defrost strategy is resistive - VRF(VRFCond).DefrostPower = VRF(VRFCond).DefrostCapacity * FractionalDefrostTime; + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower = state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity * FractionalDefrostTime; } } } TotalCondHeatingCapacity = - VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFac * HeatingCapacityMultiplier; - TotalTUHeatingCapacity = TotalCondHeatingCapacity * VRF(VRFCond).PipingCorrectionHeating; + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity * state.dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) * TotHeatCapTempModFac * HeatingCapacityMultiplier; + TotalTUHeatingCapacity = TotalCondHeatingCapacity * state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating; if (TotalCondHeatingCapacity > 0.0) { - HeatingPLR = (TUHeatingLoad / VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacity; + HeatingPLR = (TUHeatingLoad / state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacity; HeatingPLR += (LoadDueToDefrost * HeatingPLR) / TotalCondHeatingCapacity; } else { HeatingPLR = 0.0; } } - VRF(VRFCond).VRFCondPLR = max(CoolingPLR, HeatingPLR); + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR = max(CoolingPLR, HeatingPLR); Real64 tmpVRFCondPLR = 0.0; - if (CoolingPLR > 0.0 || HeatingPLR > 0.0) tmpVRFCondPLR = max(VRF(VRFCond).MinPLR, VRF(VRFCond).VRFCondPLR); + if (CoolingPLR > 0.0 || HeatingPLR > 0.0) tmpVRFCondPLR = max(state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR, state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR); - HRHeatRequestFlag = any(TerminalUnitList(TUListNum).HRHeatRequest); - HRCoolRequestFlag = any(TerminalUnitList(TUListNum).HRCoolRequest); + HRHeatRequestFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HRHeatRequest); + HRCoolRequestFlag = any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HRCoolRequest); HREIRFTConst = 1.0; Real64 HREIRAdjustment = 1.0; if (!state.dataGlobal->DoingSizing && !state.dataGlobal->WarmupFlag) { if (HRHeatRequestFlag && HRCoolRequestFlag) { // determine operating mode change - if (!VRF(VRFCond).HRCoolingActive && !VRF(VRFCond).HRHeatingActive) { - VRF(VRFCond).ModeChange = true; - VRF(VRFCond).HRTimer = 0.0; + if (!state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive && !state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive) { + state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange = true; + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0; } - if (CoolingLoad(VRFCond)) { - if (VRF(VRFCond).HRHeatingActive && !VRF(VRFCond).HRCoolingActive) { - VRF(VRFCond).HRModeChange = true; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive && !state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive) { + state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange = true; } - VRF(VRFCond).HRCoolingActive = true; - VRF(VRFCond).HRHeatingActive = false; - HRCAPFT = VRF(VRFCond).HRCAPFTCool; // Index to cool capacity as a function of temperature\PLR curve for heat recovery + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = true; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = false; + HRCAPFT = state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTCool; // Index to cool capacity as a function of temperature\PLR curve for heat recovery if (HRCAPFT > 0) { // VRF(VRFCond)%HRCAPFTCoolConst = 0.9d0 ! initialized to 0.9 - if (state.dataCurveManager->PerfCurve(VRF(VRFCond).HRCAPFTCool).NumDims == 2) { // Curve type for HRCAPFTCool - VRF(VRFCond).HRCAPFTCoolConst = CurveValue(state, HRCAPFT, InletAirWetBulbC, CondInletTemp); + if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTCool).NumDims == 2) { // Curve type for HRCAPFTCool + state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTCoolConst = CurveValue(state, HRCAPFT, InletAirWetBulbC, CondInletTemp); } else { - VRF(VRFCond).HRCAPFTCoolConst = CurveValue(state, HRCAPFT, tmpVRFCondPLR); + state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTCoolConst = CurveValue(state, HRCAPFT, tmpVRFCondPLR); } } - HRCAPFTConst = VRF(VRFCond).HRCAPFTCoolConst; + HRCAPFTConst = state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTCoolConst; HRInitialCapFrac = - VRF(VRFCond).HRInitialCoolCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode - HRCapTC = VRF(VRFCond).HRCoolCapTC; // Time constant used to recover from initial degradation in cooling heat recovery + state.dataHVACVarRefFlow->VRF(VRFCond).HRInitialCoolCapFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode + HRCapTC = state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolCapTC; // Time constant used to recover from initial degradation in cooling heat recovery - HREIRFT = VRF(VRFCond).HREIRFTCool; // Index to cool EIR as a function of temperature curve for heat recovery + HREIRFT = state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTCool; // Index to cool EIR as a function of temperature curve for heat recovery if (HREIRFT > 0) { // VRF(VRFCond)%HREIRFTCoolConst = 1.1d0 ! initialized to 1.1 - if (state.dataCurveManager->PerfCurve(VRF(VRFCond).HREIRFTCool).NumDims == 2) { // Curve type for HREIRFTCool - VRF(VRFCond).HREIRFTCoolConst = CurveValue(state, HREIRFT, InletAirWetBulbC, CondInletTemp); + if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTCool).NumDims == 2) { // Curve type for HREIRFTCool + state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTCoolConst = CurveValue(state, HREIRFT, InletAirWetBulbC, CondInletTemp); } else { - VRF(VRFCond).HREIRFTCoolConst = CurveValue(state, HREIRFT, tmpVRFCondPLR); + state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTCoolConst = CurveValue(state, HREIRFT, tmpVRFCondPLR); } } - HREIRFTConst = VRF(VRFCond).HREIRFTCoolConst; + HREIRFTConst = state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTCoolConst; HRInitialEIRFrac = - VRF(VRFCond).HRInitialCoolEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode - HREIRTC = VRF(VRFCond).HRCoolEIRTC; // Time constant used to recover from initial degradation in cooling heat recovery - } else if (HeatingLoad(VRFCond)) { - if (!VRF(VRFCond).HRHeatingActive && VRF(VRFCond).HRCoolingActive) { - VRF(VRFCond).HRModeChange = true; - } - VRF(VRFCond).HRCoolingActive = false; - VRF(VRFCond).HRHeatingActive = true; - HRCAPFT = VRF(VRFCond).HRCAPFTHeat; // Index to heat capacity as a function of temperature\PLR curve for heat recovery + state.dataHVACVarRefFlow->VRF(VRFCond).HRInitialCoolEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode + HREIRTC = state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolEIRTC; // Time constant used to recover from initial degradation in cooling heat recovery + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { + if (!state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive && state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive) { + state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange = true; + } + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = true; + HRCAPFT = state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeat; // Index to heat capacity as a function of temperature\PLR curve for heat recovery if (HRCAPFT > 0) { // VRF(VRFCond)%HRCAPFTHeatConst = 1.1d0 ! initialized to 1.1 - if (state.dataCurveManager->PerfCurve(VRF(VRFCond).HRCAPFTHeat).NumDims == 2) { // Curve type for HRCAPFTCool + if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeat).NumDims == 2) { // Curve type for HRCAPFTCool { - auto const SELECT_CASE_var(VRF(VRFCond).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).HeatingPerformanceOATType); if (SELECT_CASE_var == DataHVACGlobals::DryBulbIndicator) { - VRF(VRFCond).HRCAPFTHeatConst = CurveValue(state, HRCAPFT, InletAirDryBulbC, CondInletTemp); + state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeatConst = CurveValue(state, HRCAPFT, InletAirDryBulbC, CondInletTemp); } else if (SELECT_CASE_var == DataHVACGlobals::WetBulbIndicator) { - VRF(VRFCond).HRCAPFTHeatConst = CurveValue(state, HRCAPFT, InletAirDryBulbC, OutdoorWetBulb); + state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeatConst = CurveValue(state, HRCAPFT, InletAirDryBulbC, OutdoorWetBulb); } else { - VRF(VRFCond).HRCAPFTHeatConst = 1.0; + state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeatConst = 1.0; } } } else { - VRF(VRFCond).HRCAPFTHeatConst = CurveValue(state, HRCAPFT, tmpVRFCondPLR); + state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeatConst = CurveValue(state, HRCAPFT, tmpVRFCondPLR); } } - HRCAPFTConst = VRF(VRFCond).HRCAPFTHeatConst; + HRCAPFTConst = state.dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeatConst; HRInitialCapFrac = - VRF(VRFCond).HRInitialHeatCapFrac; // Fractional heating degradation at the start of heat recovery from cooling mode - HRCapTC = VRF(VRFCond).HRHeatCapTC; // Time constant used to recover from initial degradation in heating heat recovery + state.dataHVACVarRefFlow->VRF(VRFCond).HRInitialHeatCapFrac; // Fractional heating degradation at the start of heat recovery from cooling mode + HRCapTC = state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatCapTC; // Time constant used to recover from initial degradation in heating heat recovery - HREIRFT = VRF(VRFCond).HREIRFTHeat; // Index to cool EIR as a function of temperature curve for heat recovery + HREIRFT = state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeat; // Index to cool EIR as a function of temperature curve for heat recovery if (HREIRFT > 0) { // VRF(VRFCond)%HREIRFTCoolConst = 1.1d0 ! initialized to 1.1 - if (state.dataCurveManager->PerfCurve(VRF(VRFCond).HREIRFTHeat).NumDims == 2) { // Curve type for HREIRFTHeat + if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeat).NumDims == 2) { // Curve type for HREIRFTHeat { - auto const SELECT_CASE_var(VRF(VRFCond).HeatingPerformanceOATType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).HeatingPerformanceOATType); if (SELECT_CASE_var == DataHVACGlobals::DryBulbIndicator) { - VRF(VRFCond).HREIRFTHeatConst = CurveValue(state, HREIRFT, InletAirDryBulbC, CondInletTemp); + state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst = CurveValue(state, HREIRFT, InletAirDryBulbC, CondInletTemp); } else if (SELECT_CASE_var == DataHVACGlobals::WetBulbIndicator) { - VRF(VRFCond).HREIRFTHeatConst = CurveValue(state, HREIRFT, InletAirDryBulbC, OutdoorWetBulb); + state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst = CurveValue(state, HREIRFT, InletAirDryBulbC, OutdoorWetBulb); } else { - VRF(VRFCond).HREIRFTHeatConst = 1.0; + state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst = 1.0; } } } else { - VRF(VRFCond).HREIRFTHeatConst = CurveValue(state, HREIRFT, tmpVRFCondPLR); + state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst = CurveValue(state, HREIRFT, tmpVRFCondPLR); } } - HREIRFTConst = VRF(VRFCond).HREIRFTHeatConst; + HREIRFTConst = state.dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst; HRInitialEIRFrac = - VRF(VRFCond).HRInitialHeatEIRFrac; // Fractional heating degradation at the start of heat recovery from heating mode - HREIRTC = VRF(VRFCond).HRHeatEIRTC; // Time constant used to recover from initial degradation in heating heat recovery + state.dataHVACVarRefFlow->VRF(VRFCond).HRInitialHeatEIRFrac; // Fractional heating degradation at the start of heat recovery from heating mode + HREIRTC = state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatEIRTC; // Time constant used to recover from initial degradation in heating heat recovery } else { // zone thermostats satisfied, condenser is off. Set values anyway HRCAPFTConst = 1.0; @@ -1130,11 +1019,11 @@ namespace HVACVariableRefrigerantFlow { HREIRFTConst = 1.0; HRInitialEIRFrac = 1.0; HREIRTC = 1.0; - if (VRF(VRFCond).HRHeatingActive || VRF(VRFCond).HRCoolingActive) { - VRF(VRFCond).HRModeChange = true; + if (state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive || state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive) { + state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange = true; } - VRF(VRFCond).HRCoolingActive = false; - VRF(VRFCond).HRHeatingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = false; } } else { // IF(HRHeatRequestFlag .AND. HRCoolRequestFlag)THEN -- Heat recovery turned off @@ -1144,259 +1033,261 @@ namespace HVACVariableRefrigerantFlow { HREIRFTConst = 1.0; HRInitialEIRFrac = 1.0; HREIRTC = 0.0; - VRF(VRFCond).HRModeChange = false; - VRF(VRFCond).HRCoolingActive = false; - VRF(VRFCond).HRHeatingActive = false; - VRF(VRFCond).HRTimer = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0; } // Calculate the capacity modification factor (SUMultiplier) for the HR mode transition period CurrentEndTime = double((state.dataGlobal->DayOfSim - 1) * 24) + state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone + DataHVACGlobals::SysTimeElapsed; - if (VRF(VRFCond).ModeChange || VRF(VRFCond).HRModeChange) { - if (VRF(VRFCond).HRCoolingActive && VRF(VRFCond).HRTimer == 0.0) { - VRF(VRFCond).HRTimer = CurrentEndTimeLast; - } else if (VRF(VRFCond).HRHeatingActive && VRF(VRFCond).HRTimer == 0.0) { - VRF(VRFCond).HRTimer = CurrentEndTimeLast; - } else if (!VRF(VRFCond).HRCoolingActive && !VRF(VRFCond).HRHeatingActive) { - VRF(VRFCond).HRTimer = 0.0; + if (state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange || state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive && state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer == 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast; + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive && state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer == 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast; + } else if (!state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive && !state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive) { + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0; } } - VRF(VRFCond).HRTime = max(0.0, CurrentEndTime - VRF(VRFCond).HRTimer); - if (VRF(VRFCond).HRTime < (HRCapTC * 5.0)) { + state.dataHVACVarRefFlow->VRF(VRFCond).HRTime = max(0.0, CurrentEndTime - state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HRTime < (HRCapTC * 5.0)) { if (HRCapTC > 0.0) { - SUMultiplier = min(1.0, 1.0 - std::exp(-VRF(VRFCond).HRTime / HRCapTC)); + SUMultiplier = min(1.0, 1.0 - std::exp(-state.dataHVACVarRefFlow->VRF(VRFCond).HRTime / HRCapTC)); } else { SUMultiplier = 1.0; } } else { SUMultiplier = 1.0; - VRF(VRFCond).ModeChange = false; - VRF(VRFCond).HRModeChange = false; + state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange = false; } - VRF(VRFCond).SUMultiplier = SUMultiplier; + state.dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier = SUMultiplier; - CurrentEndTimeLast = CurrentEndTime; + state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime; - if (VRF(VRFCond).HeatRecoveryUsed && VRF(VRFCond).HRCoolingActive) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive) { TotalCondCoolingCapacity *= HRCAPFTConst; TotalCondCoolingCapacity = HRInitialCapFrac * TotalCondCoolingCapacity + (1.0 - HRInitialCapFrac) * TotalCondCoolingCapacity * SUMultiplier; - TotalTUCoolingCapacity = TotalCondCoolingCapacity * VRF(VRFCond).PipingCorrectionCooling; + TotalTUCoolingCapacity = TotalCondCoolingCapacity * state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling; if (TotalCondCoolingCapacity > 0.0) { - CoolingPLR = min(1.0, (TUCoolingLoad / VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacity); + CoolingPLR = min(1.0, (TUCoolingLoad / state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacity); } else { CoolingPLR = 0.0; } HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * SUMultiplier; - VRF(VRFCond).VRFHeatRec = TUHeatingLoad; - } else if (VRF(VRFCond).HeatRecoveryUsed && VRF(VRFCond).HRHeatingActive) { + state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatRec = TUHeatingLoad; + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive) { TotalCondHeatingCapacity *= HRCAPFTConst; TotalCondHeatingCapacity = HRInitialCapFrac * TotalCondHeatingCapacity + (1.0 - HRInitialCapFrac) * TotalCondHeatingCapacity * SUMultiplier; - TotalTUHeatingCapacity = TotalCondHeatingCapacity * VRF(VRFCond).PipingCorrectionHeating; + TotalTUHeatingCapacity = TotalCondHeatingCapacity * state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating; if (TotalCondHeatingCapacity > 0.0) { - HeatingPLR = min(1.0, (TUHeatingLoad / VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacity); + HeatingPLR = min(1.0, (TUHeatingLoad / state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacity); } else { HeatingPLR = 0.0; } HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * SUMultiplier; - VRF(VRFCond).VRFHeatRec = TUCoolingLoad; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatRec = TUCoolingLoad; } - VRF(VRFCond).VRFCondPLR = max(CoolingPLR, HeatingPLR); + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR = max(CoolingPLR, HeatingPLR); } - if (VRF(VRFCond).MinPLR > 0.0) { - CyclingRatio = min(1.0, VRF(VRFCond).VRFCondPLR / VRF(VRFCond).MinPLR); - if (VRF(VRFCond).VRFCondPLR < VRF(VRFCond).MinPLR && VRF(VRFCond).VRFCondPLR > 0.0) { - VRF(VRFCond).VRFCondPLR = VRF(VRFCond).MinPLR; - if (CoolingPLR > 0.0) CoolingPLR = VRF(VRFCond).MinPLR; // also adjust local PLR variables - if (HeatingPLR > 0.0) HeatingPLR = VRF(VRFCond).MinPLR; // also adjust local PLR variables + if (state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR > 0.0) { + CyclingRatio = min(1.0, state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR / state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR); + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR < state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR && state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR = state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR; + if (CoolingPLR > 0.0) CoolingPLR = state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR; // also adjust local PLR variables + if (HeatingPLR > 0.0) HeatingPLR = state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR; // also adjust local PLR variables } } - VRF(VRFCond).VRFCondCyclingRatio = CyclingRatio; // report variable for cycling rate - VRF(VRFCond).TotalCoolingCapacity = TotalCondCoolingCapacity * CoolingPLR * CyclingRatio; - VRF(VRFCond).TotalHeatingCapacity = TotalCondHeatingCapacity * HeatingPLR * CyclingRatio; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondCyclingRatio = CyclingRatio; // report variable for cycling rate + state.dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity = TotalCondCoolingCapacity * CoolingPLR * CyclingRatio; + state.dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity = TotalCondHeatingCapacity * HeatingPLR * CyclingRatio; - VRF(VRFCond).OperatingMode = 0; // report variable for heating or cooling mode + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingMode = 0; // report variable for heating or cooling mode EIRFPLRModFac = 1.0; VRFRTF = 0.0; // cooling and heating is optional (only one may exist), if so then performance curve for missing coil are not required - if (CoolingLoad(VRFCond) && CoolingPLR > 0.0) { - VRF(VRFCond).OperatingMode = ModeCoolingOnly; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingMode = ModeCoolingOnly; if (CoolingPLR > 1.0) { - if (VRF(VRFCond).CoolEIRFPLR2 > 0) EIRFPLRModFac = CurveValue(state, VRF(VRFCond).CoolEIRFPLR2, max(VRF(VRFCond).MinPLR, CoolingPLR)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFPLR2 > 0) EIRFPLRModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFPLR2, max(state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR, CoolingPLR)); } else { - if (VRF(VRFCond).CoolEIRFPLR1 > 0) EIRFPLRModFac = CurveValue(state, VRF(VRFCond).CoolEIRFPLR1, max(VRF(VRFCond).MinPLR, CoolingPLR)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFPLR1 > 0) EIRFPLRModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFPLR1, max(state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR, CoolingPLR)); } // find part load fraction to calculate RTF - if (VRF(VRFCond).CoolPLFFPLR > 0) { - PartLoadFraction = max(0.7, CurveValue(state, VRF(VRFCond).CoolPLFFPLR, CyclingRatio)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolPLFFPLR > 0) { + PartLoadFraction = max(0.7, CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolPLFFPLR, CyclingRatio)); } else { PartLoadFraction = 1.0; } VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction)); - VRF(VRFCond).ElecCoolingPower = - (VRF(VRFCond).RatedCoolingPower * TotCoolCapTempModFac) * TotCoolEIRTempModFac * EIRFPLRModFac * HREIRAdjustment * VRFRTF; + state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower = + (state.dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower * TotCoolCapTempModFac) * TotCoolEIRTempModFac * EIRFPLRModFac * HREIRAdjustment * VRFRTF; } - if (HeatingLoad(VRFCond) && HeatingPLR > 0.0) { - VRF(VRFCond).OperatingMode = ModeHeatingOnly; + if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingPLR > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingMode = ModeHeatingOnly; if (HeatingPLR > 1.0) { - if (VRF(VRFCond).HeatEIRFPLR2 > 0) EIRFPLRModFac = CurveValue(state, VRF(VRFCond).HeatEIRFPLR2, max(VRF(VRFCond).MinPLR, HeatingPLR)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR2 > 0) EIRFPLRModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR2, max(state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR, HeatingPLR)); } else { - if (VRF(VRFCond).HeatEIRFPLR1 > 0) EIRFPLRModFac = CurveValue(state, VRF(VRFCond).HeatEIRFPLR1, max(VRF(VRFCond).MinPLR, HeatingPLR)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR1 > 0) EIRFPLRModFac = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR1, max(state.dataHVACVarRefFlow->VRF(VRFCond).MinPLR, HeatingPLR)); } // find part load fraction to calculate RTF - if (VRF(VRFCond).HeatPLFFPLR > 0) { - PartLoadFraction = max(0.7, CurveValue(state, VRF(VRFCond).HeatPLFFPLR, CyclingRatio)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatPLFFPLR > 0) { + PartLoadFraction = max(0.7, CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatPLFFPLR, CyclingRatio)); } else { PartLoadFraction = 1.0; } VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction)); - VRF(VRFCond).ElecHeatingPower = (VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFac) * TotHeatEIRTempModFac * EIRFPLRModFac * + state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower = (state.dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFac) * TotHeatEIRTempModFac * EIRFPLRModFac * HREIRAdjustment * VRFRTF * InputPowerMultiplier; // adjust defrost power based on heating RTF - VRF(VRFCond).DefrostPower *= VRFRTF; + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower *= VRFRTF; } - VRF(VRFCond).VRFCondRTF = VRFRTF; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF = VRFRTF; // calculate crankcase heater power - if (VRF(VRFCond).MaxOATCCHeater > OutdoorDryBulb) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCCHeater > OutdoorDryBulb) { // calculate crankcase heater power - VRF(VRFCond).CrankCaseHeaterPower = VRF(VRFCond).CCHeaterPower * (1.0 - VRFRTF); - if (VRF(VRFCond).NumCompressors > 1) { - UpperStageCompressorRatio = (1.0 - VRF(VRFCond).CompressorSizeRatio) / (VRF(VRFCond).NumCompressors - 1); - for (Stage = 1; Stage <= VRF(VRFCond).NumCompressors - 2; ++Stage) { - if (VRF(VRFCond).VRFCondPLR < (VRF(VRFCond).CompressorSizeRatio + Stage * UpperStageCompressorRatio)) { - VRF(VRFCond).CrankCaseHeaterPower += VRF(VRFCond).CCHeaterPower; + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower = state.dataHVACVarRefFlow->VRF(VRFCond).CCHeaterPower * (1.0 - VRFRTF); + if (state.dataHVACVarRefFlow->VRF(VRFCond).NumCompressors > 1) { + UpperStageCompressorRatio = (1.0 - state.dataHVACVarRefFlow->VRF(VRFCond).CompressorSizeRatio) / (state.dataHVACVarRefFlow->VRF(VRFCond).NumCompressors - 1); + for (Stage = 1; Stage <= state.dataHVACVarRefFlow->VRF(VRFCond).NumCompressors - 2; ++Stage) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR < (state.dataHVACVarRefFlow->VRF(VRFCond).CompressorSizeRatio + Stage * UpperStageCompressorRatio)) { + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower += state.dataHVACVarRefFlow->VRF(VRFCond).CCHeaterPower; } } } } else { - VRF(VRFCond).CrankCaseHeaterPower = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower = 0.0; } - CondCapacity = max(VRF(VRFCond).TotalCoolingCapacity, VRF(VRFCond).TotalHeatingCapacity); - CondPower = max(VRF(VRFCond).ElecCoolingPower, VRF(VRFCond).ElecHeatingPower); - if (VRF(VRFCond).ElecCoolingPower > 0.0) { - VRF(VRFCond).QCondenser = CondCapacity + CondPower - VRF(VRFCond).TUHeatingLoad / VRF(VRFCond).PipingCorrectionHeating; - } else if (VRF(VRFCond).ElecHeatingPower > 0.0) { - VRF(VRFCond).QCondenser = -CondCapacity + CondPower + VRF(VRFCond).TUCoolingLoad / VRF(VRFCond).PipingCorrectionCooling; + CondCapacity = max(state.dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, state.dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity); + CondPower = max(state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower); + if (state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser = CondCapacity + CondPower - state.dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad / state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating; + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser = -CondCapacity + CondPower + state.dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad / state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling; } else { - VRF(VRFCond).QCondenser = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser = 0.0; } - if (VRF(VRFCond).CondenserType == DataHVACGlobals::EvapCooled) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::EvapCooled) { // Calculate basin heater power - CalcBasinHeaterPower(state, VRF(VRFCond).BasinHeaterPowerFTempDiff, - VRF(VRFCond).BasinHeaterSchedulePtr, - VRF(VRFCond).BasinHeaterSetPointTemp, - VRF(VRFCond).BasinHeaterPower); - VRF(VRFCond).BasinHeaterPower *= (1.0 - VRFRTF); + CalcBasinHeaterPower(state, state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPowerFTempDiff, + state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterSchedulePtr, + state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterSetPointTemp, + state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPower); + state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPower *= (1.0 - VRFRTF); // calculate evaporative condenser pump power and water consumption - if (CoolingLoad(VRFCond) && CoolingPLR > 0.0) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) { //****************** // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** RhoWater = RhoH2O(OutdoorDryBulb); - VRF(VRFCond).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater * VRF(VRFCond).VRFCondPLR; - VRF(VRFCond).EvapCondPumpElecPower = VRF(VRFCond).EvapCondPumpPower * VRFRTF; + state.dataHVACVarRefFlow->VRF(VRFCond).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoWater * state.dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR; + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower = state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower * VRFRTF; } - } else if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { if (CondCapacity > 0.0) { - CondenserWaterMassFlowRate = CondWaterMassFlow; + state.dataHVACVarRefFlow->CondenserWaterMassFlowRate = CondWaterMassFlow; } else { - CondenserWaterMassFlowRate = 0.0; + state.dataHVACVarRefFlow->CondenserWaterMassFlowRate = 0.0; } - SetComponentFlowRate(state, CondenserWaterMassFlowRate, - VRF(VRFCond).CondenserNodeNum, - VRF(VRFCond).CondenserOutletNodeNum, - VRF(VRFCond).SourceLoopNum, - VRF(VRFCond).SourceLoopSideNum, - VRF(VRFCond).SourceBranchNum, - VRF(VRFCond).SourceCompNum); + SetComponentFlowRate(state, state.dataHVACVarRefFlow->CondenserWaterMassFlowRate, + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum, + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopSideNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceBranchNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceCompNum); // should be the same as above just entering this function // VRF( VRFCond ).CondenserInletTemp = DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).Temp; - VRF(VRFCond).WaterCondenserMassFlow = DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).MassFlowRate; + state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserMassFlow = DataLoopNode::Node(state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).MassFlowRate; CpCond = GetSpecificHeatGlycol(state, - PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, - VRF(VRFCond).CondenserInletTemp, - PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, + PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidName, + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserInletTemp, + PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); if (CondWaterMassFlow > 0.0) { - CondOutletTemp = VRF(VRFCond).QCondenser / (CondWaterMassFlow * CpCond) + CondInletTemp; + CondOutletTemp = state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser / (CondWaterMassFlow * CpCond) + CondInletTemp; } else { CondOutletTemp = CondInletTemp; } - VRF(VRFCond).CondenserSideOutletTemp = CondOutletTemp; + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserSideOutletTemp = CondOutletTemp; } // calculate operating COP - if (CoolingLoad(VRFCond) && CoolingPLR > 0.0) { - if (VRF(VRFCond).ElecCoolingPower != 0.0) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower != 0.0) { // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond)%TUCoolingLoad - VRF(VRFCond).OperatingCoolingCOP = - (VRF(VRFCond).TotalCoolingCapacity) / (VRF(VRFCond).ElecCoolingPower + VRF(VRFCond).CrankCaseHeaterPower + - VRF(VRFCond).EvapCondPumpElecPower + VRF(VRFCond).DefrostPower); + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingCoolingCOP = + (state.dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity) / (state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower + + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower); } else { - VRF(VRFCond).OperatingCoolingCOP = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingCoolingCOP = 0.0; } } - if (HeatingLoad(VRFCond) && HeatingPLR > 0.0) { - if (VRF(VRFCond).ElecHeatingPower != 0.0) { + if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingPLR > 0.0) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower != 0.0) { // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond)%TUHeatingLoad - VRF(VRFCond).OperatingHeatingCOP = - (VRF(VRFCond).TotalHeatingCapacity) / (VRF(VRFCond).ElecHeatingPower + VRF(VRFCond).CrankCaseHeaterPower + - VRF(VRFCond).EvapCondPumpElecPower + VRF(VRFCond).DefrostPower); + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingHeatingCOP = + (state.dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity) / (state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower + + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower); } else { - VRF(VRFCond).OperatingHeatingCOP = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingHeatingCOP = 0.0; } } - TotPower = TUParasiticPower + TUFanPower + VRF(VRFCond).ElecHeatingPower + VRF(VRFCond).ElecCoolingPower + VRF(VRFCond).CrankCaseHeaterPower + - VRF(VRFCond).EvapCondPumpElecPower + VRF(VRFCond).DefrostPower; + TotPower = TUParasiticPower + TUFanPower + state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower + state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower + + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower; if (TotPower > 0.0) { - VRF(VRFCond).OperatingCOP = (VRF(VRFCond).TUCoolingLoad + VRF(VRFCond).TUHeatingLoad) / TotPower; - VRF(VRFCond).SCHE = VRF(VRFCond).OperatingCOP * 3.412141633; // see StandardRatings::ConvFromSIToIP + state.dataHVACVarRefFlow->VRF(VRFCond).OperatingCOP = (state.dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad + state.dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad) / TotPower; + state.dataHVACVarRefFlow->VRF(VRFCond).SCHE = state.dataHVACVarRefFlow->VRF(VRFCond).OperatingCOP * 3.412141633; // see StandardRatings::ConvFromSIToIP } // limit the TU capacity when the condenser is maxed out on capacity // I think this next line will make the max cap report variable match the coil objects, will probably change the answer though // IF(CoolingLoad(VRFCond) .AND. NumTUInCoolingMode .GT. 0 .AND. MaxCoolingCapacity(VRFCond) == MaxCap)THEN - if (CoolingLoad(VRFCond) && NumTUInCoolingMode > 0) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && NumTUInCoolingMode > 0) { // IF TU capacity is greater than condenser capacity find maximum allowed TU capacity (i.e., conserve energy) if (TUCoolingLoad > TotalTUCoolingCapacity) { - LimitTUCapacity(VRFCond, + LimitTUCapacity(state, + VRFCond, NumTUInList, TotalTUCoolingCapacity, - TerminalUnitList(TUListNum).TotalCoolLoad, - MaxCoolingCapacity(VRFCond), + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad, + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond), TotalTUHeatingCapacity, - TerminalUnitList(TUListNum).TotalHeatLoad, - MaxHeatingCapacity(VRFCond)); + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad, + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond)); } - } else if (HeatingLoad(VRFCond) && NumTUInHeatingMode > 0) { + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && NumTUInHeatingMode > 0) { // IF TU capacity is greater than condenser capacity if (TUHeatingLoad > TotalTUHeatingCapacity) { - LimitTUCapacity(VRFCond, + LimitTUCapacity(state, + VRFCond, NumTUInList, TotalTUHeatingCapacity, - TerminalUnitList(TUListNum).TotalHeatLoad, - MaxHeatingCapacity(VRFCond), + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad, + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond), TotalTUCoolingCapacity, - TerminalUnitList(TUListNum).TotalCoolLoad, - MaxCoolingCapacity(VRFCond)); + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad, + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond)); } } else { } @@ -1550,31 +1441,31 @@ namespace HVACVariableRefrigerantFlow { MaxNumbers = max(MaxNumbers, NumNums); } - NumVRFCond_SysCurve = inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow"); - if (NumVRFCond_SysCurve > 0) { + state.dataHVACVarRefFlow->NumVRFCond_SysCurve = inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow"); + if (state.dataHVACVarRefFlow->NumVRFCond_SysCurve > 0) { inputProcessor->getObjectDefMaxArgs(state, "AirConditioner:VariableRefrigerantFlow", NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNumbers = max(MaxNumbers, NumNums); } - NumVRFCond_FluidTCtrl_HP = inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl"); - if (NumVRFCond_FluidTCtrl_HP > 0) { + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP = inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl"); + if (state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP > 0) { inputProcessor->getObjectDefMaxArgs(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl", NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNumbers = max(MaxNumbers, NumNums); } - NumVRFCond_FluidTCtrl_HR = inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR"); - if (NumVRFCond_FluidTCtrl_HR > 0) { + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR = inputProcessor->getNumObjectsFound(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR"); + if (state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR > 0) { inputProcessor->getObjectDefMaxArgs(state, "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR", NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNumbers = max(MaxNumbers, NumNums); } - NumVRFCond = NumVRFCond_SysCurve + NumVRFCond_FluidTCtrl_HP + NumVRFCond_FluidTCtrl_HR; + state.dataHVACVarRefFlow->NumVRFCond = state.dataHVACVarRefFlow->NumVRFCond_SysCurve + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR; - NumVRFTULists = inputProcessor->getNumObjectsFound(state, "ZoneTerminalUnitList"); - if (NumVRFTULists > 0) { + state.dataHVACVarRefFlow->NumVRFTULists = inputProcessor->getNumObjectsFound(state, "ZoneTerminalUnitList"); + if (state.dataHVACVarRefFlow->NumVRFTULists > 0) { inputProcessor->getObjectDefMaxArgs(state, "ZoneTerminalUnitList", NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNumbers = max(MaxNumbers, NumNums); @@ -1587,33 +1478,33 @@ namespace HVACVariableRefrigerantFlow { lNumericFieldBlanks.dimension(MaxNumbers, false); rNumericArgs.dimension(MaxNumbers, 0.0); - NumVRFTU = NumVRFCTU; - if (NumVRFTU > 0) { - VRFTU.allocate(NumVRFTU); - CheckEquipName.dimension(NumVRFTU, true); - VRFTUNumericFields.allocate(NumVRFTU); + state.dataHVACVarRefFlow->NumVRFTU = NumVRFCTU; + if (state.dataHVACVarRefFlow->NumVRFTU > 0) { + state.dataHVACVarRefFlow->VRFTU.allocate(state.dataHVACVarRefFlow->NumVRFTU); + state.dataHVACVarRefFlow->CheckEquipName.dimension(state.dataHVACVarRefFlow->NumVRFTU, true); + state.dataHVACVarRefFlow->VRFTUNumericFields.allocate(state.dataHVACVarRefFlow->NumVRFTU); } - if (NumVRFCond > 0) { - VRF.allocate(NumVRFCond); - VrfUniqueNames.reserve(static_cast(NumVRFCond)); - MaxCoolingCapacity.allocate(NumVRFCond); - MaxHeatingCapacity.allocate(NumVRFCond); - CoolCombinationRatio.allocate(NumVRFCond); - HeatCombinationRatio.allocate(NumVRFCond); - MaxCoolingCapacity = MaxCap; - MaxHeatingCapacity = MaxCap; - CoolCombinationRatio = 1.0; - HeatCombinationRatio = 1.0; + if (state.dataHVACVarRefFlow->NumVRFCond > 0) { + state.dataHVACVarRefFlow->VRF.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->VrfUniqueNames.reserve(static_cast(state.dataHVACVarRefFlow->NumVRFCond)); + state.dataHVACVarRefFlow->MaxCoolingCapacity.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->MaxHeatingCapacity.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->CoolCombinationRatio.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->HeatCombinationRatio.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->MaxCoolingCapacity = MaxCap; + state.dataHVACVarRefFlow->MaxHeatingCapacity = MaxCap; + state.dataHVACVarRefFlow->CoolCombinationRatio = 1.0; + state.dataHVACVarRefFlow->HeatCombinationRatio = 1.0; } - if (NumVRFTULists > 0) { - TerminalUnitList.allocate(NumVRFTULists); + if (state.dataHVACVarRefFlow->NumVRFTULists > 0) { + state.dataHVACVarRefFlow->TerminalUnitList.allocate(state.dataHVACVarRefFlow->NumVRFTULists); } // read all terminal unit list objects cCurrentModuleObject = "ZoneTerminalUnitList"; - for (VRFNum = 1; VRFNum <= NumVRFTULists; ++VRFNum) { + for (VRFNum = 1; VRFNum <= state.dataHVACVarRefFlow->NumVRFTULists; ++VRFNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, VRFNum, @@ -1628,44 +1519,44 @@ namespace HVACVariableRefrigerantFlow { cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - TerminalUnitList(VRFNum).Name = cAlphaArgs(1); - TerminalUnitList(VRFNum).NumTUInList = NumAlphas - 1; - TerminalUnitList(VRFNum).ZoneTUPtr.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).ZoneTUName.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).IsSimulated.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).TotalCoolLoad.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).TotalHeatLoad.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).CoolingCoilPresent.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).HeatingCoilPresent.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).TerminalUnitNotSizedYet.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).HRHeatRequest.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).HRCoolRequest.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).CoolingCoilAvailable.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).HeatingCoilAvailable.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).CoolingCoilAvailSchPtr.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).HeatingCoilAvailSchPtr.allocate(TerminalUnitList(VRFNum).NumTUInList); - TerminalUnitList(VRFNum).ZoneTUPtr = 0; - TerminalUnitList(VRFNum).IsSimulated = false; - TerminalUnitList(VRFNum).TotalCoolLoad = 0.0; - TerminalUnitList(VRFNum).TotalHeatLoad = 0.0; - TerminalUnitList(VRFNum).CoolingCoilPresent = true; - TerminalUnitList(VRFNum).HeatingCoilPresent = true; - TerminalUnitList(VRFNum).TerminalUnitNotSizedYet = true; - TerminalUnitList(VRFNum).HRHeatRequest = false; - TerminalUnitList(VRFNum).HRCoolRequest = false; - TerminalUnitList(VRFNum).CoolingCoilAvailable = false; - TerminalUnitList(VRFNum).HeatingCoilAvailable = false; - TerminalUnitList(VRFNum).CoolingCoilAvailSchPtr = -1; - TerminalUnitList(VRFNum).HeatingCoilAvailSchPtr = -1; - - for (TUListNum = 1; TUListNum <= TerminalUnitList(VRFNum).NumTUInList; ++TUListNum) { - TerminalUnitList(VRFNum).ZoneTUName(TUListNum) = cAlphaArgs(TUListNum + 1); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).Name = cAlphaArgs(1); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList = NumAlphas - 1; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).ZoneTUPtr.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).ZoneTUName.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).IsSimulated.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).TotalCoolLoad.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).TotalHeatLoad.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).CoolingCoilPresent.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HeatingCoilPresent.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).TerminalUnitNotSizedYet.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HRHeatRequest.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HRCoolRequest.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).CoolingCoilAvailable.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HeatingCoilAvailable.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).CoolingCoilAvailSchPtr.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HeatingCoilAvailSchPtr.allocate(state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList); + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).ZoneTUPtr = 0; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).IsSimulated = false; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).TotalCoolLoad = 0.0; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).TotalHeatLoad = 0.0; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).CoolingCoilPresent = true; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HeatingCoilPresent = true; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).TerminalUnitNotSizedYet = true; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HRHeatRequest = false; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HRCoolRequest = false; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).CoolingCoilAvailable = false; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HeatingCoilAvailable = false; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).CoolingCoilAvailSchPtr = -1; + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).HeatingCoilAvailSchPtr = -1; + + for (TUListNum = 1; TUListNum <= state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).NumTUInList; ++TUListNum) { + state.dataHVACVarRefFlow->TerminalUnitList(VRFNum).ZoneTUName(TUListNum) = cAlphaArgs(TUListNum + 1); } } // read all VRF condenser objects: Algorithm Type 1_system curve based model cCurrentModuleObject = "AirConditioner:VariableRefrigerantFlow"; - for (VRFNum = 1; VRFNum <= NumVRFCond_SysCurve; ++VRFNum) { + for (VRFNum = 1; VRFNum <= state.dataHVACVarRefFlow->NumVRFCond_SysCurve; ++VRFNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, VRFNum, @@ -1678,44 +1569,44 @@ namespace HVACVariableRefrigerantFlow { lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); - GlobalNames::VerifyUniqueInterObjectName(state, VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); + GlobalNames::VerifyUniqueInterObjectName(state, state.dataHVACVarRefFlow->VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); - VRF(VRFNum).Name = cAlphaArgs(1); - VRF(VRFNum).VRFSystemTypeNum = VRF_HeatPump; - VRF(VRFNum).VRFAlgorithmTypeNum = AlgorithmTypeSysCurve; + state.dataHVACVarRefFlow->VRF(VRFNum).Name = cAlphaArgs(1); + state.dataHVACVarRefFlow->VRF(VRFNum).VRFSystemTypeNum = VRF_HeatPump; + state.dataHVACVarRefFlow->VRF(VRFNum).VRFAlgorithmTypeNum = iAlgorithmType::SysCurve; if (lAlphaFieldBlanks(2)) { - VRF(VRFNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - VRF(VRFNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (VRF(VRFNum).SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\" invalid data"); + state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" invalid data"); ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } } // CALL TestCompSet(TRIM(cCurrentModuleObject),VRF(VRFTUNum)%Name,cAlphaArgs(3),cAlphaArgs(4),'Air Nodes') - VRF(VRFNum).CoolingCapacity = rNumericArgs(1); - VRF(VRFNum).CoolingCOP = rNumericArgs(2); - VRF(VRFNum).MinOATCooling = rNumericArgs(3); - VRF(VRFNum).MaxOATCooling = rNumericArgs(4); + state.dataHVACVarRefFlow->VRF(VRFNum).CoolingCapacity = rNumericArgs(1); + state.dataHVACVarRefFlow->VRF(VRFNum).CoolingCOP = rNumericArgs(2); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling = rNumericArgs(3); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling = rNumericArgs(4); - VRF(VRFNum).CoolCapFT = GetCurveIndex(state, cAlphaArgs(3)); - if (VRF(VRFNum).CoolCapFT > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolCapFT = GetCurveIndex(state, cAlphaArgs(3)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolCapFT > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolCapFT, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolCapFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(3)); // Field Name if (!ErrorsFound) { checkCurveIsNormalizedToOne(state, RoutineName + cCurrentModuleObject, - VRF(VRFNum).Name, - VRF(VRFNum).CoolCapFT, + state.dataHVACVarRefFlow->VRF(VRFNum).Name, + state.dataHVACVarRefFlow->VRF(VRFNum).CoolCapFT, cAlphaFieldNames(3), cAlphaArgs(3), RatedInletWetBulbTemp, @@ -1723,111 +1614,111 @@ namespace HVACVariableRefrigerantFlow { } } - VRF(VRFNum).CoolBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(4)); - if (VRF(VRFNum).CoolBoundaryCurvePtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(4)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolBoundaryCurvePtr > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolBoundaryCurvePtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolBoundaryCurvePtr, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(4)); // Field Name } - VRF(VRFNum).CoolCapFTHi = GetCurveIndex(state, cAlphaArgs(5)); - if (VRF(VRFNum).CoolCapFTHi > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolCapFTHi = GetCurveIndex(state, cAlphaArgs(5)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolCapFTHi > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolCapFTHi, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolCapFTHi, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(5)); // Field Name } - VRF(VRFNum).CoolEIRFT = GetCurveIndex(state, cAlphaArgs(6)); - if (VRF(VRFNum).CoolEIRFT > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFT = GetCurveIndex(state, cAlphaArgs(6)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFT > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolEIRFT, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(6)); // Field Name } - VRF(VRFNum).EIRCoolBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(7)); - if (VRF(VRFNum).EIRCoolBoundaryCurvePtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).EIRCoolBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(7)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).EIRCoolBoundaryCurvePtr > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).EIRCoolBoundaryCurvePtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).EIRCoolBoundaryCurvePtr, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(7)); // Field Name } - VRF(VRFNum).CoolEIRFTHi = GetCurveIndex(state, cAlphaArgs(8)); - if (VRF(VRFNum).CoolEIRFTHi > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFTHi = GetCurveIndex(state, cAlphaArgs(8)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFTHi > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolEIRFTHi, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFTHi, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(8)); // Field Name } - VRF(VRFNum).CoolEIRFPLR1 = GetCurveIndex(state, cAlphaArgs(9)); - if (VRF(VRFNum).CoolEIRFPLR1 > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR1 = GetCurveIndex(state, cAlphaArgs(9)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR1 > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolEIRFPLR1, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR1, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(9)); // Field Name } - VRF(VRFNum).CoolEIRFPLR2 = GetCurveIndex(state, cAlphaArgs(10)); - if (VRF(VRFNum).CoolEIRFPLR2 > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR2 = GetCurveIndex(state, cAlphaArgs(10)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR2 > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolEIRFPLR2, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR2, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(10)); // Field Name } - VRF(VRFNum).CoolCombRatioPTR = GetCurveIndex(state, cAlphaArgs(11)); - if (VRF(VRFNum).CoolCombRatioPTR > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolCombRatioPTR = GetCurveIndex(state, cAlphaArgs(11)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolCombRatioPTR > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolCombRatioPTR, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolCombRatioPTR, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(11)); // Field Name } - VRF(VRFNum).CoolPLFFPLR = GetCurveIndex(state, cAlphaArgs(12)); - if (VRF(VRFNum).CoolPLFFPLR > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).CoolPLFFPLR = GetCurveIndex(state, cAlphaArgs(12)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolPLFFPLR > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).CoolPLFFPLR, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).CoolPLFFPLR, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(12)); // Field Name if (!ErrorsFound) { // Test PLF curve minimum and maximum. Cap if less than 0.7 or greater than 1.0. @@ -1835,7 +1726,7 @@ namespace HVACVariableRefrigerantFlow { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, VRF(VRFNum).CoolPLFFPLR, CurveInput); + CurveVal = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFNum).CoolPLFFPLR, CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -1847,60 +1738,60 @@ namespace HVACVariableRefrigerantFlow { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFieldNames(12) + "=\"" + cAlphaArgs(12) + "\" has out of range values."); ShowContinueError(state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, VRF(VRFNum).CoolPLFFPLR, ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataHVACVarRefFlow->VRF(VRFNum).CoolPLFFPLR, ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFieldNames(12) + " = " + cAlphaArgs(12) + " has out of range value."); ShowContinueError(state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, VRF(VRFNum).CoolPLFFPLR, ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataHVACVarRefFlow->VRF(VRFNum).CoolPLFFPLR, ErrorsFound, _, 1.0); } } } - VRF(VRFNum).HeatingCapacity = rNumericArgs(5); - VRF(VRFNum).HeatingCapacitySizeRatio = rNumericArgs(6); - if (!lNumericFieldBlanks(6) && VRF(VRFNum).HeatingCapacity == AutoSize) { - VRF(VRFNum).LockHeatingCapacity = true; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCapacity = rNumericArgs(5); + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCapacitySizeRatio = rNumericArgs(6); + if (!lNumericFieldBlanks(6) && state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCapacity == AutoSize) { + state.dataHVACVarRefFlow->VRF(VRFNum).LockHeatingCapacity = true; } - VRF(VRFNum).HeatingCOP = rNumericArgs(7); - VRF(VRFNum).MinOATHeating = rNumericArgs(8); - VRF(VRFNum).MaxOATHeating = rNumericArgs(9); - if (VRF(VRFNum).MinOATHeating >= VRF(VRFNum).MaxOATHeating) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCOP = rNumericArgs(7); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating = rNumericArgs(8); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating = rNumericArgs(9); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating >= state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(8), - VRF(VRFNum).MinOATHeating, - VRF(VRFNum).MaxOATHeating)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating, + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating)); ErrorsFound = true; } - VRF(VRFNum).HeatCapFT = GetCurveIndex(state, cAlphaArgs(13)); - if (VRF(VRFNum).HeatCapFT > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFT = GetCurveIndex(state, cAlphaArgs(13)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFT > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatCapFT, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(13)); // Field Name if (!ErrorsFound) { if (UtilityRoutines::SameString(cAlphaArgs(19), "WETBULBTEMPERATURE")) { checkCurveIsNormalizedToOne(state, RoutineName + cCurrentModuleObject, - VRF(VRFNum).Name, - VRF(VRFNum).HeatCapFT, + state.dataHVACVarRefFlow->VRF(VRFNum).Name, + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFT, cAlphaFieldNames(13), cAlphaArgs(13), RatedInletAirTempHeat, @@ -1908,8 +1799,8 @@ namespace HVACVariableRefrigerantFlow { } else if (UtilityRoutines::SameString(cAlphaArgs(19), "DRYBULBTEMPERATURE")) { checkCurveIsNormalizedToOne(state, RoutineName + cCurrentModuleObject, - VRF(VRFNum).Name, - VRF(VRFNum).HeatCapFT, + state.dataHVACVarRefFlow->VRF(VRFNum).Name, + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFT, cAlphaFieldNames(13), cAlphaArgs(13), RatedInletAirTempHeat, @@ -1918,121 +1809,121 @@ namespace HVACVariableRefrigerantFlow { } } - VRF(VRFNum).HeatBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(14)); - if (VRF(VRFNum).HeatBoundaryCurvePtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(14)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatBoundaryCurvePtr > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatBoundaryCurvePtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatBoundaryCurvePtr, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(14)); // Field Name } - VRF(VRFNum).HeatCapFTHi = GetCurveIndex(state, cAlphaArgs(15)); - if (VRF(VRFNum).HeatCapFTHi > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFTHi = GetCurveIndex(state, cAlphaArgs(15)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFTHi > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatCapFTHi, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCapFTHi, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(15)); // Field Name } - VRF(VRFNum).HeatEIRFT = GetCurveIndex(state, cAlphaArgs(16)); - if (VRF(VRFNum).HeatEIRFT > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFT = GetCurveIndex(state, cAlphaArgs(16)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFT > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatEIRFT, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(16)); // Field Name } - VRF(VRFNum).EIRHeatBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(17)); - if (VRF(VRFNum).EIRHeatBoundaryCurvePtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).EIRHeatBoundaryCurvePtr = GetCurveIndex(state, cAlphaArgs(17)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).EIRHeatBoundaryCurvePtr > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).EIRHeatBoundaryCurvePtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).EIRHeatBoundaryCurvePtr, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(17)); // Field Name } - VRF(VRFNum).HeatEIRFTHi = GetCurveIndex(state, cAlphaArgs(18)); - if (VRF(VRFNum).HeatEIRFTHi > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFTHi = GetCurveIndex(state, cAlphaArgs(18)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFTHi > 0) { // Verify Curve Object, only legal type is biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatEIRFTHi, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFTHi, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(18)); // Field Name } if (UtilityRoutines::SameString(cAlphaArgs(19), "WETBULBTEMPERATURE")) { - VRF(VRFNum).HeatingPerformanceOATType = DataHVACGlobals::WetBulbIndicator; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingPerformanceOATType = DataHVACGlobals::WetBulbIndicator; } else if (UtilityRoutines::SameString(cAlphaArgs(19), "DRYBULBTEMPERATURE")) { - VRF(VRFNum).HeatingPerformanceOATType = DataHVACGlobals::DryBulbIndicator; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingPerformanceOATType = DataHVACGlobals::DryBulbIndicator; } else { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" illegal " + cAlphaFieldNames(19) + + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" illegal " + cAlphaFieldNames(19) + " input for this object = " + cAlphaArgs(19)); ShowContinueError(state, "... input must be WETBULBTEMPERATURE or DRYBULBTEMPERATURE."); ErrorsFound = true; } - VRF(VRFNum).HeatEIRFPLR1 = GetCurveIndex(state, cAlphaArgs(20)); - if (VRF(VRFNum).HeatEIRFPLR1 > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR1 = GetCurveIndex(state, cAlphaArgs(20)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR1 > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatEIRFPLR1, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR1, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(20)); // Field Name } - VRF(VRFNum).HeatEIRFPLR2 = GetCurveIndex(state, cAlphaArgs(21)); - if (VRF(VRFNum).HeatEIRFPLR2 > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR2 = GetCurveIndex(state, cAlphaArgs(21)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR2 > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatEIRFPLR2, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR2, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(21)); // Field Name } - VRF(VRFNum).HeatCombRatioPTR = GetCurveIndex(state, cAlphaArgs(22)); - if (VRF(VRFNum).HeatCombRatioPTR > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCombRatioPTR = GetCurveIndex(state, cAlphaArgs(22)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatCombRatioPTR > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatCombRatioPTR, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatCombRatioPTR, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(22)); // Field Name } - VRF(VRFNum).HeatPLFFPLR = GetCurveIndex(state, cAlphaArgs(23)); - if (VRF(VRFNum).HeatPLFFPLR > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HeatPLFFPLR = GetCurveIndex(state, cAlphaArgs(23)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatPLFFPLR > 0) { // Verify Curve Object, only legal type is linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HeatPLFFPLR, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HeatPLFFPLR, // Curve index {1}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(23)); // Field Name if (!ErrorsFound) { @@ -2040,7 +1931,7 @@ namespace HVACVariableRefrigerantFlow { MaxCurveVal = -999.0; CurveInput = 0.0; while (CurveInput <= 1.0) { - CurveVal = CurveValue(state, VRF(VRFNum).HeatPLFFPLR, CurveInput); + CurveVal = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFNum).HeatPLFFPLR, CurveInput); if (CurveVal < MinCurveVal) { MinCurveVal = CurveVal; MinCurvePLR = CurveInput; @@ -2052,42 +1943,42 @@ namespace HVACVariableRefrigerantFlow { CurveInput += 0.01; } if (MinCurveVal < 0.7) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFieldNames(23) + "=\"" + cAlphaArgs(23) + "\" has out of range values."); ShowContinueError(state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); - SetCurveOutputMinMaxValues(state, VRF(VRFNum).HeatPLFFPLR, ErrorsFound, 0.7, _); + SetCurveOutputMinMaxValues(state, state.dataHVACVarRefFlow->VRF(VRFNum).HeatPLFFPLR, ErrorsFound, 0.7, _); } if (MaxCurveVal > 1.0) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFieldNames(23) + " = " + cAlphaArgs(23) + " has out of range value."); ShowContinueError(state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); - SetCurveOutputMinMaxValues(state, VRF(VRFNum).HeatPLFFPLR, ErrorsFound, _, 1.0); + SetCurveOutputMinMaxValues(state, state.dataHVACVarRefFlow->VRF(VRFNum).HeatPLFFPLR, ErrorsFound, _, 1.0); } } } - VRF(VRFNum).MinPLR = rNumericArgs(10); + state.dataHVACVarRefFlow->VRF(VRFNum).MinPLR = rNumericArgs(10); Real64 minEIRfLowPLRXInput = 0.0; Real64 maxEIRfLowPLRXInput = 0.0; - if (VRF(VRFNum).CoolEIRFPLR1 > 0) { - CurveManager::GetCurveMinMaxValues(state, VRF(VRFNum).CoolEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); - if (minEIRfLowPLRXInput > VRF(VRFNum).MinPLR) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR1 > 0) { + CurveManager::GetCurveMinMaxValues(state, state.dataHVACVarRefFlow->VRF(VRFNum).CoolEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); + if (minEIRfLowPLRXInput > state.dataHVACVarRefFlow->VRF(VRFNum).MinPLR) { + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFieldNames(9) + " = " + cAlphaArgs(9) + " has out of range value."); ShowContinueError(state, format("...Curve minimum value of X = {:.3T} must be <= Minimum Heat Pump Part-Load Ratio = {:.3T}.", minEIRfLowPLRXInput, - VRF(VRFNum).MinPLR)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinPLR)); ErrorsFound = true; } if (maxEIRfLowPLRXInput < 1.0) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", suspicious"); + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", suspicious"); ShowContinueError(state, "..." + cAlphaFieldNames(9) + " = " + cAlphaArgs(9) + " has unexpected value."); ShowContinueError(state, format("...Curve maximum value of X = {:.3T} should be 1 and will result in lower energy use than expected.", @@ -2096,19 +1987,19 @@ namespace HVACVariableRefrigerantFlow { minEIRfLowPLRXInput = 0.0; maxEIRfLowPLRXInput = 0.0; } - if (VRF(VRFNum).HeatEIRFPLR1 > 0) { - CurveManager::GetCurveMinMaxValues(state, VRF(VRFNum).HeatEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); - if (minEIRfLowPLRXInput > VRF(VRFNum).MinPLR) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR1 > 0) { + CurveManager::GetCurveMinMaxValues(state, state.dataHVACVarRefFlow->VRF(VRFNum).HeatEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); + if (minEIRfLowPLRXInput > state.dataHVACVarRefFlow->VRF(VRFNum).MinPLR) { + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "..." + cAlphaFieldNames(20) + " = " + cAlphaArgs(20) + " has out of range value."); ShowContinueError(state, format("...Curve minimum value of X = {:.3T} must be <= Minimum Heat Pump Part-Load Ratio = {:.3T}.", minEIRfLowPLRXInput, - VRF(VRFNum).MinPLR)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinPLR)); ErrorsFound = true; } if (maxEIRfLowPLRXInput < 1.0) { - ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", suspicious"); + ShowWarningError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", suspicious"); ShowContinueError(state, "..." + cAlphaFieldNames(20) + " = " + cAlphaArgs(20) + " has unexpected value."); ShowContinueError(state, format("...Curve maximum value of X = {:.3T} should be 1 and will result in lower energy use than expected.", @@ -2116,205 +2007,205 @@ namespace HVACVariableRefrigerantFlow { } } - VRF(VRFNum).MasterZonePtr = UtilityRoutines::FindItemInList(cAlphaArgs(24), Zone); + state.dataHVACVarRefFlow->VRF(VRFNum).MasterZonePtr = UtilityRoutines::FindItemInList(cAlphaArgs(24), Zone); if (UtilityRoutines::SameString(cAlphaArgs(25), "LoadPriority")) { - VRF(VRFNum).ThermostatPriority = LoadPriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::LoadPriority; } else if (UtilityRoutines::SameString(cAlphaArgs(25), "ZonePriority")) { - VRF(VRFNum).ThermostatPriority = ZonePriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::ZonePriority; } else if (UtilityRoutines::SameString(cAlphaArgs(25), "ThermostatOffsetPriority")) { - VRF(VRFNum).ThermostatPriority = ThermostatOffsetPriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::ThermostatOffsetPriority; } else if (UtilityRoutines::SameString(cAlphaArgs(25), "Scheduled")) { - VRF(VRFNum).ThermostatPriority = ScheduledPriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::ScheduledPriority; } else if (UtilityRoutines::SameString(cAlphaArgs(25), "MasterThermostatPriority")) { - VRF(VRFNum).ThermostatPriority = MasterThermostatPriority; - if (VRF(VRFNum).MasterZonePtr == 0) { - ShowSevereError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::MasterThermostatPriority; + if (state.dataHVACVarRefFlow->VRF(VRFNum).MasterZonePtr == 0) { + ShowSevereError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, cAlphaFieldNames(24) + " must be entered when " + cAlphaFieldNames(25) + " = " + cAlphaArgs(25)); ErrorsFound = true; } // ELSE IF (UtilityRoutines::SameString(cAlphaArgs(25),'FirstOnPriority') )THEN ! strategy not used // VRF(VRFNum)%ThermostatPriority = FirstOnPriority } else { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); ShowContinueError(state, "Illegal " + cAlphaFieldNames(25) + " = " + cAlphaArgs(25)); ErrorsFound = true; } - if (VRF(VRFNum).ThermostatPriority == ScheduledPriority) { - VRF(VRFNum).SchedPriorityPtr = GetScheduleIndex(state, cAlphaArgs(26)); - if (VRF(VRFNum).SchedPriorityPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + if (state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority == iThermostatCtrlType::ScheduledPriority) { + state.dataHVACVarRefFlow->VRF(VRFNum).SchedPriorityPtr = GetScheduleIndex(state, cAlphaArgs(26)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).SchedPriorityPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); ShowContinueError(state, "..." + cAlphaFieldNames(26) + " = " + cAlphaArgs(26) + " not found."); ShowContinueError(state, "A schedule name is required when " + cAlphaFieldNames(25) + " = " + cAlphaArgs(25)); ErrorsFound = true; } } - VRF(VRFNum).ZoneTUListPtr = UtilityRoutines::FindItemInList(cAlphaArgs(27), TerminalUnitList); - if (VRF(VRFNum).ZoneTUListPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr = UtilityRoutines::FindItemInList(cAlphaArgs(27), state.dataHVACVarRefFlow->TerminalUnitList); + if (state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, cAlphaFieldNames(27) + " = " + cAlphaArgs(27) + " not found."); ErrorsFound = true; } - VRF(VRFNum).HeatRecoveryUsed = false; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed = false; if (!lAlphaFieldBlanks(28)) { if (UtilityRoutines::SameString(cAlphaArgs(28), "No")) { - VRF(VRFNum).HeatRecoveryUsed = false; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed = false; } else if (UtilityRoutines::SameString(cAlphaArgs(28), "Yes")) { - VRF(VRFNum).HeatRecoveryUsed = true; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed = true; } else { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); ShowContinueError(state, "Illegal " + cAlphaFieldNames(28) + " = " + cAlphaArgs(28)); ErrorsFound = true; } } - VRF(VRFNum).EquivPipeLngthCool = rNumericArgs(11); - VRF(VRFNum).VertPipeLngth = rNumericArgs(12); - VRF(VRFNum).PCFLengthCoolPtr = GetCurveIndex(state, cAlphaArgs(29)); - if (VRF(VRFNum).PCFLengthCoolPtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).EquivPipeLngthCool = rNumericArgs(11); + state.dataHVACVarRefFlow->VRF(VRFNum).VertPipeLngth = rNumericArgs(12); + state.dataHVACVarRefFlow->VRF(VRFNum).PCFLengthCoolPtr = GetCurveIndex(state, cAlphaArgs(29)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).PCFLengthCoolPtr > 0) { // Verify Curve Object, only legal type is linear, quadratic, cubic, or biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).PCFLengthCoolPtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).PCFLengthCoolPtr, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(29)); // Field Name } - VRF(VRFNum).PCFHeightCool = rNumericArgs(13); + state.dataHVACVarRefFlow->VRF(VRFNum).PCFHeightCool = rNumericArgs(13); - VRF(VRFNum).EquivPipeLngthHeat = rNumericArgs(14); - VRF(VRFNum).PCFLengthHeatPtr = GetCurveIndex(state, cAlphaArgs(30)); - if (VRF(VRFNum).PCFLengthHeatPtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).EquivPipeLngthHeat = rNumericArgs(14); + state.dataHVACVarRefFlow->VRF(VRFNum).PCFLengthHeatPtr = GetCurveIndex(state, cAlphaArgs(30)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).PCFLengthHeatPtr > 0) { // Verify Curve Object, only legal type is linear, quadratic, cubic, or biquadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).PCFLengthHeatPtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).PCFLengthHeatPtr, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(30)); // Field Name } - VRF(VRFNum).PCFHeightHeat = rNumericArgs(15); + state.dataHVACVarRefFlow->VRF(VRFNum).PCFHeightHeat = rNumericArgs(15); - VRF(VRFNum).CCHeaterPower = rNumericArgs(16); - VRF(VRFNum).NumCompressors = rNumericArgs(17); - VRF(VRFNum).CompressorSizeRatio = rNumericArgs(18); - VRF(VRFNum).MaxOATCCHeater = rNumericArgs(19); + state.dataHVACVarRefFlow->VRF(VRFNum).CCHeaterPower = rNumericArgs(16); + state.dataHVACVarRefFlow->VRF(VRFNum).NumCompressors = rNumericArgs(17); + state.dataHVACVarRefFlow->VRF(VRFNum).CompressorSizeRatio = rNumericArgs(18); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCCHeater = rNumericArgs(19); if (!lAlphaFieldBlanks(31)) { - if (UtilityRoutines::SameString(cAlphaArgs(31), "ReverseCycle")) VRF(VRFNum).DefrostStrategy = ReverseCycle; - if (UtilityRoutines::SameString(cAlphaArgs(31), "Resistive")) VRF(VRFNum).DefrostStrategy = Resistive; - if (VRF(VRFNum).DefrostStrategy == 0) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(31) + + if (UtilityRoutines::SameString(cAlphaArgs(31), "ReverseCycle")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = ReverseCycle; + if (UtilityRoutines::SameString(cAlphaArgs(31), "Resistive")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = Resistive; + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == 0) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(31) + " not found: " + cAlphaArgs(31)); ErrorsFound = true; } } else { - VRF(VRFNum).DefrostStrategy = ReverseCycle; + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = ReverseCycle; } if (!lAlphaFieldBlanks(32)) { - if (UtilityRoutines::SameString(cAlphaArgs(32), "Timed")) VRF(VRFNum).DefrostControl = Timed; - if (UtilityRoutines::SameString(cAlphaArgs(32), "OnDemand")) VRF(VRFNum).DefrostControl = OnDemand; - if (VRF(VRFNum).DefrostControl == 0) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(32) + + if (UtilityRoutines::SameString(cAlphaArgs(32), "Timed")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = Timed; + if (UtilityRoutines::SameString(cAlphaArgs(32), "OnDemand")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = OnDemand; + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl == 0) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(32) + " not found: " + cAlphaArgs(32)); ErrorsFound = true; } } else { - VRF(VRFNum).DefrostControl = Timed; + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = Timed; } if (!lAlphaFieldBlanks(33)) { - VRF(VRFNum).DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(33)); - if (VRF(VRFNum).DefrostEIRPtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(33)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr > 0) { // Verify Curve Object, expected type is BiQuadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).DefrostEIRPtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(33)); // Field Name } else { - if (VRF(VRFNum).DefrostStrategy == ReverseCycle) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(33) + + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == ReverseCycle) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(33) + " not found:" + cAlphaArgs(33)); ErrorsFound = true; } } } else { - if (VRF(VRFNum).DefrostStrategy == ReverseCycle) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(33) + " not found:" + cAlphaArgs(33)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == ReverseCycle) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(33) + " not found:" + cAlphaArgs(33)); ErrorsFound = true; } } - VRF(VRFNum).DefrostFraction = rNumericArgs(20); - VRF(VRFNum).DefrostCapacity = rNumericArgs(21); - if (VRF(VRFNum).DefrostCapacity == 0.0 && VRF(VRFNum).DefrostStrategy == Resistive) { - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cNumericFieldNames(21) + + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostFraction = rNumericArgs(20); + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostCapacity = rNumericArgs(21); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostCapacity == 0.0 && state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == Resistive) { + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cNumericFieldNames(21) + " = 0.0 for defrost strategy = RESISTIVE."); } - VRF(VRFNum).MaxOATDefrost = rNumericArgs(22); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATDefrost = rNumericArgs(22); if (!lAlphaFieldBlanks(35)) { - if (UtilityRoutines::SameString(cAlphaArgs(34), "AirCooled")) VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; - if (UtilityRoutines::SameString(cAlphaArgs(34), "EvaporativelyCooled")) VRF(VRFNum).CondenserType = DataHVACGlobals::EvapCooled; + if (UtilityRoutines::SameString(cAlphaArgs(34), "AirCooled")) state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; + if (UtilityRoutines::SameString(cAlphaArgs(34), "EvaporativelyCooled")) state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType = DataHVACGlobals::EvapCooled; if (UtilityRoutines::SameString(cAlphaArgs(34), "WaterCooled")) { - VRF(VRFNum).CondenserType = DataHVACGlobals::WaterCooled; - VRF(VRFNum).VRFPlantTypeOfNum = TypeOf_HeatPumpVRF; - if (VRF(VRFNum).HeatingPerformanceOATType == DataHVACGlobals::WetBulbIndicator) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType = DataHVACGlobals::WaterCooled; + state.dataHVACVarRefFlow->VRF(VRFNum).VRFPlantTypeOfNum = TypeOf_HeatPumpVRF; + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatingPerformanceOATType == DataHVACGlobals::WetBulbIndicator) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); ShowContinueError(state, cAlphaFieldNames(34) + " = " + cAlphaArgs(34)); ShowContinueError(state, "Illegal " + cAlphaFieldNames(19) + " input for this object = " + cAlphaArgs(19)); ShowContinueError(state, "... input must be DRYBULBTEMPERATURE when Condenser Type is WaterCooled."); ShowContinueError(state, "... " + cAlphaFieldNames(19) + " will be reset to DRYBULBTEMPERATURE and simulation continues."); } } - if (VRF(VRFNum).CondenserType == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType == 0) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); ShowContinueError(state, "Illegal " + cAlphaFieldNames(34) + " = " + cAlphaArgs(34)); ErrorsFound = true; } } else { - VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; } // outdoor condenser node if (lAlphaFieldBlanks(35)) { - VRF(VRFNum).CondenserNodeNum = 0; + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserNodeNum = 0; } else { { - auto const SELECT_CASE_var(VRF(VRFNum).CondenserType); + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType); if ((SELECT_CASE_var == DataHVACGlobals::AirCooled) || (SELECT_CASE_var == DataHVACGlobals::EvapCooled)) { - VRF(VRFNum).CondenserNodeNum = GetOnlySingleNode(state, + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserNodeNum = GetOnlySingleNode(state, cAlphaArgs(35), ErrorsFound, cCurrentModuleObject, - VRF(VRFNum).Name, + state.dataHVACVarRefFlow->VRF(VRFNum).Name, DataLoopNode::NodeType_Air, DataLoopNode::NodeConnectionType_OutsideAirReference, 1, ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, VRF(VRFNum).CondenserNodeNum)) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(35) + + if (!CheckOutAirNodeNumber(state, state.dataHVACVarRefFlow->VRF(VRFNum).CondenserNodeNum)) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(35) + " not a valid Outdoor Air Node = " + cAlphaArgs(35)); ShowContinueError(state, "...node name does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ErrorsFound = true; } } else if (SELECT_CASE_var == DataHVACGlobals::WaterCooled) { - VRF(VRFNum).CondenserNodeNum = GetOnlySingleNode(state, + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserNodeNum = GetOnlySingleNode(state, cAlphaArgs(35), ErrorsFound, cCurrentModuleObject, - VRF(VRFNum).Name, + state.dataHVACVarRefFlow->VRF(VRFNum).Name, DataLoopNode::NodeType_Water, DataLoopNode::NodeConnectionType_Inlet, 2, @@ -2324,87 +2215,87 @@ namespace HVACVariableRefrigerantFlow { } } - if (!lAlphaFieldBlanks(36) && VRF(VRFNum).CondenserType == DataHVACGlobals::WaterCooled) { - VRF(VRFNum).CondenserOutletNodeNum = GetOnlySingleNode(state, + if (!lAlphaFieldBlanks(36) && state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType == DataHVACGlobals::WaterCooled) { + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserOutletNodeNum = GetOnlySingleNode(state, cAlphaArgs(36), ErrorsFound, cCurrentModuleObject, - VRF(VRFNum).Name, + state.dataHVACVarRefFlow->VRF(VRFNum).Name, DataLoopNode::NodeType_Water, DataLoopNode::NodeConnectionType_Outlet, 2, ObjectIsNotParent); - TestCompSet(state, cCurrentModuleObject, VRF(VRFNum).Name, cAlphaArgs(35), cAlphaArgs(36), "Condenser Water Nodes"); - } else if (lAlphaFieldBlanks(36) && VRF(VRFNum).CondenserType == DataHVACGlobals::WaterCooled) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(36) + " is blank."); + TestCompSet(state, cCurrentModuleObject, state.dataHVACVarRefFlow->VRF(VRFNum).Name, cAlphaArgs(35), cAlphaArgs(36), "Condenser Water Nodes"); + } else if (lAlphaFieldBlanks(36) && state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType == DataHVACGlobals::WaterCooled) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(36) + " is blank."); ShowContinueError(state, "...node name must be entered when Condenser Type = WaterCooled."); ErrorsFound = true; } if (lNumericFieldBlanks(23)) { - if (VRF(VRFNum).CondenserType == DataHVACGlobals::WaterCooled) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cNumericFieldNames(23) + " is blank."); + if (state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType == DataHVACGlobals::WaterCooled) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cNumericFieldNames(23) + " is blank."); ShowContinueError(state, "...input is required when " + cAlphaFieldNames(34) + " = " + cAlphaArgs(34)); ErrorsFound = true; } } else { - VRF(VRFNum).WaterCondVolFlowRate = rNumericArgs(23); + state.dataHVACVarRefFlow->VRF(VRFNum).WaterCondVolFlowRate = rNumericArgs(23); } - VRF(VRFNum).EvapCondEffectiveness = rNumericArgs(24); - VRF(VRFNum).EvapCondAirVolFlowRate = rNumericArgs(25); - VRF(VRFNum).EvapCondPumpPower = rNumericArgs(26); + state.dataHVACVarRefFlow->VRF(VRFNum).EvapCondEffectiveness = rNumericArgs(24); + state.dataHVACVarRefFlow->VRF(VRFNum).EvapCondAirVolFlowRate = rNumericArgs(25); + state.dataHVACVarRefFlow->VRF(VRFNum).EvapCondPumpPower = rNumericArgs(26); // Get Water System tank connections // A37, \field Supply Water Storage Tank Name - VRF(VRFNum).EvapWaterSupplyName = cAlphaArgs(37); + state.dataHVACVarRefFlow->VRF(VRFNum).EvapWaterSupplyName = cAlphaArgs(37); if (lAlphaFieldBlanks(37)) { - VRF(VRFNum).EvapWaterSupplyMode = WaterSupplyFromMains; + state.dataHVACVarRefFlow->VRF(VRFNum).EvapWaterSupplyMode = iWaterSupply::FromMains; } else { - VRF(VRFNum).EvapWaterSupplyMode = WaterSupplyFromTank; + state.dataHVACVarRefFlow->VRF(VRFNum).EvapWaterSupplyMode = iWaterSupply::FromTank; SetupTankDemandComponent(state, - VRF(VRFNum).Name, + state.dataHVACVarRefFlow->VRF(VRFNum).Name, cCurrentModuleObject, - VRF(VRFNum).EvapWaterSupplyName, + state.dataHVACVarRefFlow->VRF(VRFNum).EvapWaterSupplyName, ErrorsFound, - VRF(VRFNum).EvapWaterSupTankID, - VRF(VRFNum).EvapWaterTankDemandARRID); + state.dataHVACVarRefFlow->VRF(VRFNum).EvapWaterSupTankID, + state.dataHVACVarRefFlow->VRF(VRFNum).EvapWaterTankDemandARRID); } // Basin heater power as a function of temperature must be greater than or equal to 0 - VRF(VRFNum).BasinHeaterPowerFTempDiff = rNumericArgs(27); + state.dataHVACVarRefFlow->VRF(VRFNum).BasinHeaterPowerFTempDiff = rNumericArgs(27); if (rNumericArgs(27) < 0.0) { - ShowSevereError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\", " + cNumericFieldNames(27) + " must be >= 0"); + ShowSevereError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cNumericFieldNames(27) + " must be >= 0"); ErrorsFound = true; } - VRF(VRFNum).BasinHeaterSetPointTemp = rNumericArgs(28); - if (VRF(VRFNum).BasinHeaterPowerFTempDiff > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFNum).BasinHeaterSetPointTemp = rNumericArgs(28); + if (state.dataHVACVarRefFlow->VRF(VRFNum).BasinHeaterPowerFTempDiff > 0.0) { if (NumNums < 27) { - VRF(VRFNum).BasinHeaterSetPointTemp = 2.0; + state.dataHVACVarRefFlow->VRF(VRFNum).BasinHeaterSetPointTemp = 2.0; } - if (VRF(VRFNum).BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\", " + cNumericFieldNames(28) + + if (state.dataHVACVarRefFlow->VRF(VRFNum).BasinHeaterSetPointTemp < 2.0) { + ShowWarningError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cNumericFieldNames(28) + " is less than 2 deg C. Freezing could occur."); } } if (!lAlphaFieldBlanks(38)) { - VRF(VRFNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, cAlphaArgs(38)); - if (VRF(VRFNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\", " + cAlphaFieldNames(38) + " = \"" + cAlphaArgs(38) + + state.dataHVACVarRefFlow->VRF(VRFNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, cAlphaArgs(38)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).BasinHeaterSchedulePtr == 0) { + ShowWarningError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cAlphaFieldNames(38) + " = \"" + cAlphaArgs(38) + "\" was not found."); ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); } } - VRF(VRFNum).FuelType = "Electricity"; + state.dataHVACVarRefFlow->VRF(VRFNum).FuelType = "Electricity"; if (!lAlphaFieldBlanks(39)) { // A39; \field Fuel type, Validate fuel type input bool FuelTypeError(false); UtilityRoutines::ValidateFuelTypeWithAssignResourceTypeNum( - cAlphaArgs(39), VRF(VRFNum).FuelType, VRF(VRFNum).FuelTypeNum, FuelTypeError); + cAlphaArgs(39), state.dataHVACVarRefFlow->VRF(VRFNum).FuelType, state.dataHVACVarRefFlow->VRF(VRFNum).FuelTypeNum, FuelTypeError); if (FuelTypeError) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\", " + cAlphaFieldNames(39) + + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cAlphaFieldNames(39) + " not found = " + cAlphaArgs(39)); ShowContinueError(state, "Valid choices are Electricity, NaturalGas, Propane, Diesel, Gasoline, FuelOilNo1, FuelOilNo2, OtherFuel1 or OtherFuel2"); @@ -2413,110 +2304,110 @@ namespace HVACVariableRefrigerantFlow { } } - if (VRF(VRFNum).HeatRecoveryUsed) { + if (state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed) { if (lNumericFieldBlanks(29)) { - VRF(VRFNum).MinOATHeatRecovery = max(VRF(VRFNum).MinOATCooling, VRF(VRFNum).MinOATHeating); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery = max(state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling, state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating); } else { - VRF(VRFNum).MinOATHeatRecovery = rNumericArgs(29); - if (VRF(VRFNum).MinOATHeatRecovery < VRF(VRFNum).MinOATCooling || VRF(VRFNum).MinOATHeatRecovery < VRF(VRFNum).MinOATHeating) { - ShowWarningError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\", " + cNumericFieldNames(29) + + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery = rNumericArgs(29); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery < state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling || state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery < state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating) { + ShowWarningError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cNumericFieldNames(29) + " is less than the minimum temperature in heat pump mode."); - ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(29), VRF(VRFNum).MinOATHeatRecovery)); - ShowContinueError(state, format("...Minimum Outdoor Temperature in Cooling Mode = {:.2T} C", VRF(VRFNum).MinOATCooling)); - ShowContinueError(state, format("...Minimum Outdoor Temperature in Heating Mode = {:.2T} C", VRF(VRFNum).MinOATHeating)); + ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(29), state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery)); + ShowContinueError(state, format("...Minimum Outdoor Temperature in Cooling Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling)); + ShowContinueError(state, format("...Minimum Outdoor Temperature in Heating Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating)); ShowContinueError(state, "...Minimum Outdoor Temperature in Heat Recovery Mode reset to greater of cooling or heating minimum " "temperature and simulation continues."); - VRF(VRFNum).MinOATHeatRecovery = max(VRF(VRFNum).MinOATCooling, VRF(VRFNum).MinOATHeating); - ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(29), VRF(VRFNum).MinOATHeatRecovery)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery = max(state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling, state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating); + ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(29), state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery)); } } if (lNumericFieldBlanks(30)) { - VRF(VRFNum).MaxOATHeatRecovery = min(VRF(VRFNum).MaxOATCooling, VRF(VRFNum).MaxOATHeating); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery = min(state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling, state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating); } else { - VRF(VRFNum).MaxOATHeatRecovery = rNumericArgs(30); - if (VRF(VRFNum).MaxOATHeatRecovery > VRF(VRFNum).MaxOATCooling || VRF(VRFNum).MaxOATHeatRecovery > VRF(VRFNum).MaxOATHeating) { - ShowWarningError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\", " + cNumericFieldNames(30) + + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery = rNumericArgs(30); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery > state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling || state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery > state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating) { + ShowWarningError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cNumericFieldNames(30) + " is greater than the maximum temperature in heat pump mode."); - ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(30), VRF(VRFNum).MaxOATHeatRecovery)); - ShowContinueError(state, format("...Maximum Outdoor Temperature in Cooling Mode = {:.2T} C", VRF(VRFNum).MaxOATCooling)); - ShowContinueError(state, format("...Maximum Outdoor Temperature in Heating Mode = {:.2T} C", VRF(VRFNum).MaxOATHeating)); + ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(30), state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery)); + ShowContinueError(state, format("...Maximum Outdoor Temperature in Cooling Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling)); + ShowContinueError(state, format("...Maximum Outdoor Temperature in Heating Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating)); ShowContinueError(state, "...Maximum Outdoor Temperature in Heat Recovery Mode reset to lesser of cooling or heating minimum " "temperature and simulation continues."); - VRF(VRFNum).MaxOATHeatRecovery = min(VRF(VRFNum).MaxOATCooling, VRF(VRFNum).MaxOATHeating); - ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(30), VRF(VRFNum).MaxOATHeatRecovery)); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery = min(state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling, state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating); + ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(30), state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery)); } } - VRF(VRFNum).HRCAPFTCool = GetCurveIndex(state, cAlphaArgs(40)); - if (VRF(VRFNum).HRCAPFTCool > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HRCAPFTCool = GetCurveIndex(state, cAlphaArgs(40)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HRCAPFTCool > 0) { // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HRCAPFTCool, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HRCAPFTCool, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(40)); // Field Name } if (!lNumericFieldBlanks(31)) { - VRF(VRFNum).HRInitialCoolCapFrac = rNumericArgs(31); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialCoolCapFrac = rNumericArgs(31); } - VRF(VRFNum).HRCoolCapTC = rNumericArgs(32); - VRF(VRFNum).HREIRFTCool = GetCurveIndex(state, cAlphaArgs(41)); - if (VRF(VRFNum).HREIRFTCool > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HRCoolCapTC = rNumericArgs(32); + state.dataHVACVarRefFlow->VRF(VRFNum).HREIRFTCool = GetCurveIndex(state, cAlphaArgs(41)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HREIRFTCool > 0) { // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HREIRFTCool, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HREIRFTCool, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(41)); // Field Name } - VRF(VRFNum).HRInitialCoolEIRFrac = rNumericArgs(33); - VRF(VRFNum).HRCoolEIRTC = rNumericArgs(34); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialCoolEIRFrac = rNumericArgs(33); + state.dataHVACVarRefFlow->VRF(VRFNum).HRCoolEIRTC = rNumericArgs(34); // INTEGER :: HRCAPFTHeat =0 ! Index to heat capacity as a function of temperature curve for heat recovery // REAL(r64) :: HRInitialHeatCapFrac =0.0d0 ! Fractional heating degradation at the start of heat recovery from heating mode // REAL(r64) :: HRHeatCapTC =0.0d0 ! Time constant used to recover from initial degradation in heating heat // recovery - VRF(VRFNum).HRCAPFTHeat = GetCurveIndex(state, cAlphaArgs(42)); - if (VRF(VRFNum).HRCAPFTHeat > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HRCAPFTHeat = GetCurveIndex(state, cAlphaArgs(42)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HRCAPFTHeat > 0) { // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HRCAPFTHeat, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HRCAPFTHeat, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(42)); // Field Name } - VRF(VRFNum).HRInitialHeatCapFrac = rNumericArgs(35); - VRF(VRFNum).HRHeatCapTC = rNumericArgs(36); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialHeatCapFrac = rNumericArgs(35); + state.dataHVACVarRefFlow->VRF(VRFNum).HRHeatCapTC = rNumericArgs(36); // INTEGER :: HREIRFTHeat =0 ! Index to heat EIR as a function of temperature curve for heat recovery // REAL(r64) :: HRInitialHeatEIRFrac =0.0d0 ! Fractional EIR degradation at the start of heat recovery from heating mode // REAL(r64) :: HRHeatEIRTC =0.0d0 ! Time constant used to recover from initial degradation in heating heat // recovery - VRF(VRFNum).HREIRFTHeat = GetCurveIndex(state, cAlphaArgs(43)); - if (VRF(VRFNum).HREIRFTHeat > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).HREIRFTHeat = GetCurveIndex(state, cAlphaArgs(43)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).HREIRFTHeat > 0) { // Verify Curve Object, only legal type is bi-quadratic or linear, quadratic, or cubic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).HREIRFTHeat, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).HREIRFTHeat, // Curve index {1, 2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(43)); // Field Name } - VRF(VRFNum).HRInitialHeatEIRFrac = rNumericArgs(37); - VRF(VRFNum).HRHeatEIRTC = rNumericArgs(38); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialHeatEIRFrac = rNumericArgs(37); + state.dataHVACVarRefFlow->VRF(VRFNum).HRHeatEIRTC = rNumericArgs(38); } } // Read all VRF condenser objects: Algorithm Type 2_physics based model (VRF-FluidTCtrl-HP) cCurrentModuleObject = "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl"; - for (VRFNum = NumVRFCond_SysCurve + 1; VRFNum <= NumVRFCond_SysCurve + NumVRFCond_FluidTCtrl_HP; ++VRFNum) { + for (VRFNum = state.dataHVACVarRefFlow->NumVRFCond_SysCurve + 1; VRFNum <= state.dataHVACVarRefFlow->NumVRFCond_SysCurve + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP; ++VRFNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, VRFNum, @@ -2529,147 +2420,147 @@ namespace HVACVariableRefrigerantFlow { lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); - GlobalNames::VerifyUniqueInterObjectName(state, VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); + GlobalNames::VerifyUniqueInterObjectName(state, state.dataHVACVarRefFlow->VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); - VRF(VRFNum).Name = cAlphaArgs(1); - VRF(VRFNum).VRFSystemTypeNum = VRF_HeatPump; - VRF(VRFNum).VRFAlgorithmTypeNum = AlgorithmTypeFluidTCtrl; - VRF(VRFNum).FuelType = "Electricity"; - VRF(VRFNum).FuelTypeNum = DataGlobalConstants::ResourceType::Electricity; + state.dataHVACVarRefFlow->VRF(VRFNum).Name = cAlphaArgs(1); + state.dataHVACVarRefFlow->VRF(VRFNum).VRFSystemTypeNum = VRF_HeatPump; + state.dataHVACVarRefFlow->VRF(VRFNum).VRFAlgorithmTypeNum = iAlgorithmType::FluidTCtrl; + state.dataHVACVarRefFlow->VRF(VRFNum).FuelType = "Electricity"; + state.dataHVACVarRefFlow->VRF(VRFNum).FuelTypeNum = DataGlobalConstants::ResourceType::Electricity; if (lAlphaFieldBlanks(2)) { - VRF(VRFNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - VRF(VRFNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (VRF(VRFNum).SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\" invalid data"); + state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" invalid data"); ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } } - VRF(VRFNum).ZoneTUListPtr = UtilityRoutines::FindItemInList(cAlphaArgs(3), TerminalUnitList, NumVRFTULists); - if (VRF(VRFNum).ZoneTUListPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr = UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataHVACVarRefFlow->TerminalUnitList, state.dataHVACVarRefFlow->NumVRFTULists); + if (state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, cAlphaFieldNames(3) + " = " + cAlphaArgs(3) + " not found."); ErrorsFound = true; } // Refrigerant type - VRF(VRFNum).RefrigerantName = cAlphaArgs(4); + state.dataHVACVarRefFlow->VRF(VRFNum).RefrigerantName = cAlphaArgs(4); if (EnergyPlus::FluidProperties::GetInput) { EnergyPlus::FluidProperties::GetFluidPropertiesData(state); EnergyPlus::FluidProperties::GetInput = false; } if (UtilityRoutines::FindItemInList( - VRF(VRFNum).RefrigerantName, EnergyPlus::FluidProperties::RefrigData, EnergyPlus::FluidProperties::NumOfRefrigerants) == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + state.dataHVACVarRefFlow->VRF(VRFNum).RefrigerantName, EnergyPlus::FluidProperties::RefrigData, EnergyPlus::FluidProperties::NumOfRefrigerants) == 0) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); ShowContinueError(state, "Illegal " + cAlphaFieldNames(4) + " = " + cAlphaArgs(4)); ErrorsFound = true; } - VRF(VRFNum).RatedEvapCapacity = rNumericArgs(1); - VRF(VRFNum).RatedCompPowerPerCapcity = rNumericArgs(2); - VRF(VRFNum).RatedCompPower = VRF(VRFNum).RatedCompPowerPerCapcity * VRF(VRFNum).RatedEvapCapacity; - VRF(VRFNum).CoolingCapacity = VRF(VRFNum).RatedEvapCapacity; - VRF(VRFNum).RatedHeatCapacity = VRF(VRFNum).RatedEvapCapacity * (1 + VRF(VRFNum).RatedCompPowerPerCapcity); - VRF(VRFNum).HeatingCapacity = VRF(VRFNum).RatedHeatCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity = rNumericArgs(1); + state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity = rNumericArgs(2); + state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPower = state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).CoolingCapacity = state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).RatedHeatCapacity = state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity * (1 + state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity); + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCapacity = state.dataHVACVarRefFlow->VRF(VRFNum).RatedHeatCapacity; // Reference system COP - VRF(VRFNum).CoolingCOP = 1 / VRF(VRFNum).RatedCompPowerPerCapcity; - VRF(VRFNum).HeatingCOP = 1 / VRF(VRFNum).RatedCompPowerPerCapcity + 1; + state.dataHVACVarRefFlow->VRF(VRFNum).CoolingCOP = 1 / state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCOP = 1 / state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity + 1; // OA temperature range for VRF-HP operations - VRF(VRFNum).MinOATCooling = rNumericArgs(3); - VRF(VRFNum).MaxOATCooling = rNumericArgs(4); - VRF(VRFNum).MinOATHeating = rNumericArgs(5); - VRF(VRFNum).MaxOATHeating = rNumericArgs(6); - if (VRF(VRFNum).MinOATCooling >= VRF(VRFNum).MaxOATCooling) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling = rNumericArgs(3); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling = rNumericArgs(4); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating = rNumericArgs(5); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating = rNumericArgs(6); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling >= state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(3), - VRF(VRFNum).MinOATCooling, - VRF(VRFNum).MaxOATCooling)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling, + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling)); ErrorsFound = true; } - if (VRF(VRFNum).MinOATHeating >= VRF(VRFNum).MaxOATHeating) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating >= state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(5), - VRF(VRFNum).MinOATHeating, - VRF(VRFNum).MaxOATHeating)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating, + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating)); ErrorsFound = true; } // Reference OU SH/SC - VRF(VRFNum).SH = rNumericArgs(7); - VRF(VRFNum).SC = rNumericArgs(8); + state.dataHVACVarRefFlow->VRF(VRFNum).SH = rNumericArgs(7); + state.dataHVACVarRefFlow->VRF(VRFNum).SC = rNumericArgs(8); if (UtilityRoutines::SameString(cAlphaArgs(5), "VariableTemp")) { - VRF(VRFNum).AlgorithmIUCtrl = 1; + state.dataHVACVarRefFlow->VRF(VRFNum).AlgorithmIUCtrl = 1; } else if (UtilityRoutines::SameString(cAlphaArgs(5), "ConstantTemp")) { - VRF(VRFNum).AlgorithmIUCtrl = 2; + state.dataHVACVarRefFlow->VRF(VRFNum).AlgorithmIUCtrl = 2; } else { - VRF(VRFNum).AlgorithmIUCtrl = 1; + state.dataHVACVarRefFlow->VRF(VRFNum).AlgorithmIUCtrl = 1; } // Reference IU Te/Tc for IU Control Algorithm: ConstantTemp - VRF(VRFNum).EvapTempFixed = rNumericArgs(9); - VRF(VRFNum).CondTempFixed = rNumericArgs(10); + state.dataHVACVarRefFlow->VRF(VRFNum).EvapTempFixed = rNumericArgs(9); + state.dataHVACVarRefFlow->VRF(VRFNum).CondTempFixed = rNumericArgs(10); // Bounds of Te/Tc for IU Control Algorithm: VariableTemp - VRF(VRFNum).IUEvapTempLow = rNumericArgs(11); - VRF(VRFNum).IUEvapTempHigh = rNumericArgs(12); - VRF(VRFNum).IUCondTempLow = rNumericArgs(13); - VRF(VRFNum).IUCondTempHigh = rNumericArgs(14); - if (VRF(VRFNum).IUEvapTempLow >= VRF(VRFNum).IUEvapTempHigh) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow = rNumericArgs(11); + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh = rNumericArgs(12); + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow = rNumericArgs(13); + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh = rNumericArgs(14); + if (state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow >= state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(11), - VRF(VRFNum).IUEvapTempLow, - VRF(VRFNum).IUEvapTempHigh)); + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow, + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh)); ErrorsFound = true; } - if (VRF(VRFNum).IUCondTempLow >= VRF(VRFNum).IUCondTempHigh) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow >= state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(13), - VRF(VRFNum).IUCondTempLow, - VRF(VRFNum).IUCondTempHigh)); + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow, + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh)); ErrorsFound = true; } // Get OU fan data - VRF(VRFNum).RatedOUFanPowerPerCapcity = rNumericArgs(15); - VRF(VRFNum).OUAirFlowRatePerCapcity = rNumericArgs(16); - VRF(VRFNum).RatedOUFanPower = VRF(VRFNum).RatedOUFanPowerPerCapcity * VRF(VRFNum).RatedEvapCapacity; - VRF(VRFNum).OUAirFlowRate = VRF(VRFNum).OUAirFlowRatePerCapcity * VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).RatedOUFanPowerPerCapcity = rNumericArgs(15); + state.dataHVACVarRefFlow->VRF(VRFNum).OUAirFlowRatePerCapcity = rNumericArgs(16); + state.dataHVACVarRefFlow->VRF(VRFNum).RatedOUFanPower = state.dataHVACVarRefFlow->VRF(VRFNum).RatedOUFanPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).OUAirFlowRate = state.dataHVACVarRefFlow->VRF(VRFNum).OUAirFlowRatePerCapcity * state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; // OUEvapTempCurve int indexOUEvapTempCurve = GetCurveIndex(state, cAlphaArgs(6)); // convert curve name to index number // Verify curve name and type if (indexOUEvapTempCurve == 0) { if (lAlphaFieldBlanks(6)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(6) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(6) + "=\"" + cAlphaArgs(6) + "\"."); } ErrorsFound = true; } else { { if (state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).ObjectType == "Curve:Quadratic") { - VRF(VRFNum).C1Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff1; - VRF(VRFNum).C2Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff2; - VRF(VRFNum).C3Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff3; + state.dataHVACVarRefFlow->VRF(VRFNum).C1Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff1; + state.dataHVACVarRefFlow->VRF(VRFNum).C2Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff2; + state.dataHVACVarRefFlow->VRF(VRFNum).C3Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff3; } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFieldNames(6) + " type for this object = " + state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).ObjectType); ShowContinueError(state, "... Curve type must be Quadratic."); @@ -2683,22 +2574,22 @@ namespace HVACVariableRefrigerantFlow { // Verify curve name and type if (indexOUCondTempCurve == 0) { if (lAlphaFieldBlanks(7)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(7) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(7) + "=\"" + cAlphaArgs(7) + "\"."); } ErrorsFound = true; } else { { if (state.dataCurveManager->PerfCurve(indexOUCondTempCurve).ObjectType == "Curve:Quadratic") { - VRF(VRFNum).C1Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff1; - VRF(VRFNum).C2Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff2; - VRF(VRFNum).C3Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff3; + state.dataHVACVarRefFlow->VRF(VRFNum).C1Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff1; + state.dataHVACVarRefFlow->VRF(VRFNum).C2Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff2; + state.dataHVACVarRefFlow->VRF(VRFNum).C3Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff3; } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFieldNames(7) + " type for this object = " + state.dataCurveManager->PerfCurve(indexOUCondTempCurve).ObjectType); ShowContinueError(state, "... Curve type must be Quadratic."); @@ -2708,137 +2599,137 @@ namespace HVACVariableRefrigerantFlow { } // Pipe parameters - VRF(VRFNum).RefPipDiaSuc = rNumericArgs(17); - VRF(VRFNum).RefPipDiaDis = rNumericArgs(17); - VRF(VRFNum).RefPipLen = rNumericArgs(18); - VRF(VRFNum).RefPipEquLen = rNumericArgs(19); - VRF(VRFNum).RefPipHei = rNumericArgs(20); - VRF(VRFNum).RefPipInsThi = rNumericArgs(21); - VRF(VRFNum).RefPipInsCon = rNumericArgs(22); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipDiaSuc = rNumericArgs(17); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipDiaDis = rNumericArgs(17); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen = rNumericArgs(18); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen = rNumericArgs(19); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipHei = rNumericArgs(20); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipInsThi = rNumericArgs(21); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipInsCon = rNumericArgs(22); // Check the RefPipEquLen if (lNumericFieldBlanks(19) && !lNumericFieldBlanks(18)) { - VRF(VRFNum).RefPipEquLen = 1.2 * VRF(VRFNum).RefPipLen; - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(19) + "\" is calculated based on"); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen = 1.2 * state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen; + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(19) + "\" is calculated based on"); ShowContinueError(state, "...the provided \"" + cNumericFieldNames(18) + "\" value."); } - if (VRF(VRFNum).RefPipEquLen < VRF(VRFNum).RefPipLen) { - VRF(VRFNum).RefPipEquLen = 1.2 * VRF(VRFNum).RefPipLen; - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\", invalid \" " + cNumericFieldNames(19) + "\" value."); + if (state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen < state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen) { + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen = 1.2 * state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen; + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid \" " + cNumericFieldNames(19) + "\" value."); ShowContinueError(state, "...Equivalent length of main pipe should be greater than or equal to the actual length."); ShowContinueError(state, "...The value is recalculated based on the provided \"" + cNumericFieldNames(18) + "\" value."); } // Crank case - VRF(VRFNum).CCHeaterPower = rNumericArgs(23); - VRF(VRFNum).NumCompressors = rNumericArgs(24); - VRF(VRFNum).CompressorSizeRatio = rNumericArgs(25); - VRF(VRFNum).MaxOATCCHeater = rNumericArgs(26); + state.dataHVACVarRefFlow->VRF(VRFNum).CCHeaterPower = rNumericArgs(23); + state.dataHVACVarRefFlow->VRF(VRFNum).NumCompressors = rNumericArgs(24); + state.dataHVACVarRefFlow->VRF(VRFNum).CompressorSizeRatio = rNumericArgs(25); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCCHeater = rNumericArgs(26); // Defrost if (!lAlphaFieldBlanks(8)) { - if (UtilityRoutines::SameString(cAlphaArgs(8), "ReverseCycle")) VRF(VRFNum).DefrostStrategy = ReverseCycle; - if (UtilityRoutines::SameString(cAlphaArgs(8), "Resistive")) VRF(VRFNum).DefrostStrategy = Resistive; - if (VRF(VRFNum).DefrostStrategy == 0) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(8) + " not found: " + cAlphaArgs(8)); + if (UtilityRoutines::SameString(cAlphaArgs(8), "ReverseCycle")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = ReverseCycle; + if (UtilityRoutines::SameString(cAlphaArgs(8), "Resistive")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = Resistive; + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == 0) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(8) + " not found: " + cAlphaArgs(8)); ErrorsFound = true; } } else { - VRF(VRFNum).DefrostStrategy = ReverseCycle; + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = ReverseCycle; } if (!lAlphaFieldBlanks(9)) { - if (UtilityRoutines::SameString(cAlphaArgs(9), "Timed")) VRF(VRFNum).DefrostControl = Timed; - if (UtilityRoutines::SameString(cAlphaArgs(9), "OnDemand")) VRF(VRFNum).DefrostControl = OnDemand; - if (VRF(VRFNum).DefrostControl == 0) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(9) + " not found: " + cAlphaArgs(9)); + if (UtilityRoutines::SameString(cAlphaArgs(9), "Timed")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = Timed; + if (UtilityRoutines::SameString(cAlphaArgs(9), "OnDemand")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = OnDemand; + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl == 0) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(9) + " not found: " + cAlphaArgs(9)); ErrorsFound = true; } } else { - VRF(VRFNum).DefrostControl = Timed; + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = Timed; } if (!lAlphaFieldBlanks(10)) { - VRF(VRFNum).DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(10)); - if (VRF(VRFNum).DefrostEIRPtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(10)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr > 0) { // Verify Curve Object, expected type is BiQuadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).DefrostEIRPtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(10)); // Field Name } else { - if (VRF(VRFNum).DefrostStrategy == ReverseCycle && VRF(VRFNum).DefrostControl == OnDemand) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == ReverseCycle && state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl == OnDemand) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10)); ErrorsFound = true; } } } else { - if (VRF(VRFNum).DefrostStrategy == ReverseCycle && VRF(VRFNum).DefrostControl == OnDemand) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == ReverseCycle && state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl == OnDemand) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10)); ErrorsFound = true; } } - VRF(VRFNum).DefrostFraction = rNumericArgs(27); - VRF(VRFNum).DefrostCapacity = rNumericArgs(28); - VRF(VRFNum).MaxOATDefrost = rNumericArgs(29); - if (VRF(VRFNum).DefrostCapacity == 0.0 && VRF(VRFNum).DefrostStrategy == Resistive) { - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cNumericFieldNames(28) + + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostFraction = rNumericArgs(27); + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostCapacity = rNumericArgs(28); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATDefrost = rNumericArgs(29); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostCapacity == 0.0 && state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == Resistive) { + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cNumericFieldNames(28) + " = 0.0 for defrost strategy = RESISTIVE."); } - VRF(VRFNum).CompMaxDeltaP = rNumericArgs(30); + state.dataHVACVarRefFlow->VRF(VRFNum).CompMaxDeltaP = rNumericArgs(30); //@@ The control type std::string ThermostatPriorityType = "LoadPriority"; // cAlphaArgs( 25 ) if (UtilityRoutines::SameString(ThermostatPriorityType, "LoadPriority")) { - VRF(VRFNum).ThermostatPriority = LoadPriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::LoadPriority; } else if (UtilityRoutines::SameString(ThermostatPriorityType, "ZonePriority")) { - VRF(VRFNum).ThermostatPriority = ZonePriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::ZonePriority; } else if (UtilityRoutines::SameString(ThermostatPriorityType, "ThermostatOffsetPriority")) { - VRF(VRFNum).ThermostatPriority = ThermostatOffsetPriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::ThermostatOffsetPriority; } else if (UtilityRoutines::SameString(ThermostatPriorityType, "Scheduled")) { - VRF(VRFNum).ThermostatPriority = ScheduledPriority; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::ScheduledPriority; } else if (UtilityRoutines::SameString(ThermostatPriorityType, "MasterThermostatPriority")) { - VRF(VRFNum).ThermostatPriority = MasterThermostatPriority; - if (VRF(VRFNum).MasterZonePtr == 0) { - ShowSevereError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::MasterThermostatPriority; + if (state.dataHVACVarRefFlow->VRF(VRFNum).MasterZonePtr == 0) { + ShowSevereError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); //** ShowContinueError(state, cAlphaFieldNames( 24 ) + " must be entered when " + cAlphaFieldNames( 25 ) + " = " + cAlphaArgs( 25 ) ); ErrorsFound = true; } } else { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); // ShowContinueError(state, "Illegal " + cAlphaFieldNames( 25 ) + " = " + cAlphaArgs( 25 ) ); ErrorsFound = true; } // The new VRF model is Air cooled - VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; - VRF(VRFNum).CondenserNodeNum = 0; + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserNodeNum = 0; // Evaporative Capacity & Compressor Power Curves corresponding to each Loading Index / compressor speed NumOfCompSpd = rNumericArgs(31); - VRF(VRFNum).CompressorSpeed.dimension(NumOfCompSpd); - VRF(VRFNum).OUCoolingCAPFT.dimension(NumOfCompSpd); - VRF(VRFNum).OUCoolingPWRFT.dimension(NumOfCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).CompressorSpeed.dimension(NumOfCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingCAPFT.dimension(NumOfCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingPWRFT.dimension(NumOfCompSpd); int Count1Index = 31; // the index of the last numeric field before compressor speed entries int Count2Index = 9; // the index of the last alpha field before capacity/power curves for (NumCompSpd = 1; NumCompSpd <= NumOfCompSpd; NumCompSpd++) { - VRF(VRFNum).CompressorSpeed(NumCompSpd) = rNumericArgs(Count1Index + NumCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).CompressorSpeed(NumCompSpd) = rNumericArgs(Count1Index + NumCompSpd); // Evaporating Capacity Curve if (!lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) { int indexOUEvapCapCurve = GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd)); // convert curve name to index number if (indexOUEvapCapCurve == 0) { // Verify curve name and type if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd) + "=\"" + cAlphaArgs(Count2Index + 2 * NumCompSpd) + "\"."); } @@ -2849,11 +2740,11 @@ namespace HVACVariableRefrigerantFlow { {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(Count2Index + 2 * NumCompSpd)); // Field Name if (!ErrorsFound) { - VRF(VRFNum).OUCoolingCAPFT(NumCompSpd) = indexOUEvapCapCurve; + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingCAPFT(NumCompSpd) = indexOUEvapCapCurve; } } } @@ -2864,10 +2755,10 @@ namespace HVACVariableRefrigerantFlow { GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd + 1)); // convert curve name to index number if (indexOUCompPwrCurve == 0) { // Verify curve name and type if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd + 1)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1) + "=\"" + cAlphaArgs(Count2Index + 2 * NumCompSpd + 1) + "\"."); } @@ -2878,11 +2769,11 @@ namespace HVACVariableRefrigerantFlow { {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1)); // Field Name if (!ErrorsFound) { - VRF(VRFNum).OUCoolingPWRFT(NumCompSpd) = indexOUCompPwrCurve; + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingPWRFT(NumCompSpd) = indexOUCompPwrCurve; } } } @@ -2891,8 +2782,8 @@ namespace HVACVariableRefrigerantFlow { // Read all VRF condenser objects: Algorithm Type 2_physics based model (VRF-FluidTCtrl-HR) cCurrentModuleObject = "AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl:HR"; - for (VRFNum = NumVRFCond_SysCurve + NumVRFCond_FluidTCtrl_HP + 1; - VRFNum <= NumVRFCond_SysCurve + NumVRFCond_FluidTCtrl_HP + NumVRFCond_FluidTCtrl_HR; + for (VRFNum = state.dataHVACVarRefFlow->NumVRFCond_SysCurve + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP + 1; + VRFNum <= state.dataHVACVarRefFlow->NumVRFCond_SysCurve + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HP + state.dataHVACVarRefFlow->NumVRFCond_FluidTCtrl_HR; ++VRFNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -2906,199 +2797,199 @@ namespace HVACVariableRefrigerantFlow { lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); - GlobalNames::VerifyUniqueInterObjectName(state, VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); + GlobalNames::VerifyUniqueInterObjectName(state, state.dataHVACVarRefFlow->VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); - VRF(VRFNum).Name = cAlphaArgs(1); + state.dataHVACVarRefFlow->VRF(VRFNum).Name = cAlphaArgs(1); - VRF(VRFNum).ThermostatPriority = LoadPriority; - VRF(VRFNum).HeatRecoveryUsed = true; - VRF(VRFNum).VRFSystemTypeNum = VRF_HeatPump; - VRF(VRFNum).VRFAlgorithmTypeNum = AlgorithmTypeFluidTCtrl; - VRF(VRFNum).FuelType = "Electricity"; - VRF(VRFNum).FuelTypeNum = DataGlobalConstants::ResourceType::Electricity; + state.dataHVACVarRefFlow->VRF(VRFNum).ThermostatPriority = iThermostatCtrlType::LoadPriority; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed = true; + state.dataHVACVarRefFlow->VRF(VRFNum).VRFSystemTypeNum = VRF_HeatPump; + state.dataHVACVarRefFlow->VRF(VRFNum).VRFAlgorithmTypeNum = iAlgorithmType::FluidTCtrl; + state.dataHVACVarRefFlow->VRF(VRFNum).FuelType = "Electricity"; + state.dataHVACVarRefFlow->VRF(VRFNum).FuelTypeNum = DataGlobalConstants::ResourceType::Electricity; if (lAlphaFieldBlanks(2)) { - VRF(VRFNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - VRF(VRFNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (VRF(VRFNum).SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\" invalid data"); + state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).SchedPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" invalid data"); ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } } - VRF(VRFNum).ZoneTUListPtr = UtilityRoutines::FindItemInList(cAlphaArgs(3), TerminalUnitList, NumVRFTULists); - if (VRF(VRFNum).ZoneTUListPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr = UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataHVACVarRefFlow->TerminalUnitList, state.dataHVACVarRefFlow->NumVRFTULists); + if (state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, cAlphaFieldNames(3) + " = " + cAlphaArgs(3) + " not found."); ErrorsFound = true; } // Refrigerant type - VRF(VRFNum).RefrigerantName = cAlphaArgs(4); + state.dataHVACVarRefFlow->VRF(VRFNum).RefrigerantName = cAlphaArgs(4); if (EnergyPlus::FluidProperties::GetInput) { EnergyPlus::FluidProperties::GetFluidPropertiesData(state); EnergyPlus::FluidProperties::GetInput = false; } if (UtilityRoutines::FindItemInList( - VRF(VRFNum).RefrigerantName, EnergyPlus::FluidProperties::RefrigData, EnergyPlus::FluidProperties::NumOfRefrigerants) == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRF(VRFNum).Name); + state.dataHVACVarRefFlow->VRF(VRFNum).RefrigerantName, EnergyPlus::FluidProperties::RefrigData, EnergyPlus::FluidProperties::NumOfRefrigerants) == 0) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRF(VRFNum).Name); ShowContinueError(state, "Illegal " + cAlphaFieldNames(4) + " = " + cAlphaArgs(4)); ErrorsFound = true; } - VRF(VRFNum).RatedEvapCapacity = rNumericArgs(1); - VRF(VRFNum).RatedCompPowerPerCapcity = rNumericArgs(2); - VRF(VRFNum).RatedCompPower = VRF(VRFNum).RatedCompPowerPerCapcity * VRF(VRFNum).RatedEvapCapacity; - VRF(VRFNum).CoolingCapacity = VRF(VRFNum).RatedEvapCapacity; - VRF(VRFNum).HeatingCapacity = VRF(VRFNum).RatedEvapCapacity * (1 + VRF(VRFNum).RatedCompPowerPerCapcity); + state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity = rNumericArgs(1); + state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity = rNumericArgs(2); + state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPower = state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).CoolingCapacity = state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCapacity = state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity * (1 + state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity); // Reference system COP - VRF(VRFNum).CoolingCOP = 1 / VRF(VRFNum).RatedCompPowerPerCapcity; - VRF(VRFNum).HeatingCOP = 1 / VRF(VRFNum).RatedCompPowerPerCapcity + 1; + state.dataHVACVarRefFlow->VRF(VRFNum).CoolingCOP = 1 / state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatingCOP = 1 / state.dataHVACVarRefFlow->VRF(VRFNum).RatedCompPowerPerCapcity + 1; // OA temperature range for VRF-HP operations - VRF(VRFNum).MinOATCooling = rNumericArgs(3); - VRF(VRFNum).MaxOATCooling = rNumericArgs(4); - VRF(VRFNum).MinOATHeating = rNumericArgs(5); - VRF(VRFNum).MaxOATHeating = rNumericArgs(6); - VRF(VRFNum).MinOATHeatRecovery = rNumericArgs(7); - VRF(VRFNum).MaxOATHeatRecovery = rNumericArgs(8); - if (VRF(VRFNum).MinOATCooling >= VRF(VRFNum).MaxOATCooling) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling = rNumericArgs(3); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling = rNumericArgs(4); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating = rNumericArgs(5); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating = rNumericArgs(6); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery = rNumericArgs(7); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery = rNumericArgs(8); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling >= state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(3), - VRF(VRFNum).MinOATCooling, - VRF(VRFNum).MaxOATCooling)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling, + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling)); ErrorsFound = true; } - if (VRF(VRFNum).MinOATHeating >= VRF(VRFNum).MaxOATHeating) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating >= state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(5), - VRF(VRFNum).MinOATHeating, - VRF(VRFNum).MaxOATHeating)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating, + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating)); ErrorsFound = true; } - if (VRF(VRFNum).MinOATHeatRecovery >= VRF(VRFNum).MaxOATHeatRecovery) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery >= state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(7), - VRF(VRFNum).MinOATHeating, - VRF(VRFNum).MaxOATHeating)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating, + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating)); ErrorsFound = true; } - if (VRF(VRFNum).MinOATHeatRecovery < VRF(VRFNum).MinOATCooling && VRF(VRFNum).MinOATHeatRecovery < VRF(VRFNum).MinOATHeating) { - ShowWarningError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\", " + cNumericFieldNames(7) + + if (state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery < state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling && state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery < state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating) { + ShowWarningError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cNumericFieldNames(7) + " is less than the minimum temperature in heat pump mode."); - ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(7), VRF(VRFNum).MinOATHeatRecovery)); - ShowContinueError(state, format("...Minimum Outdoor Temperature in Cooling Mode = {:.2T} C", VRF(VRFNum).MinOATCooling)); - ShowContinueError(state, format("...Minimum Outdoor Temperature in Heating Mode = {:.2T} C", VRF(VRFNum).MinOATHeating)); + ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(7), state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery)); + ShowContinueError(state, format("...Minimum Outdoor Temperature in Cooling Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling)); + ShowContinueError(state, format("...Minimum Outdoor Temperature in Heating Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating)); ShowContinueError(state, "...Minimum Outdoor Temperature in Heat Recovery Mode reset to lesser of cooling or heating minimum temperature " "and simulation continues."); - VRF(VRFNum).MinOATHeatRecovery = min(VRF(VRFNum).MinOATCooling, VRF(VRFNum).MinOATHeating); - ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(7), VRF(VRFNum).MinOATHeatRecovery)); + state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery = min(state.dataHVACVarRefFlow->VRF(VRFNum).MinOATCooling, state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeating); + ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(7), state.dataHVACVarRefFlow->VRF(VRFNum).MinOATHeatRecovery)); } - if (VRF(VRFNum).MaxOATHeatRecovery > VRF(VRFNum).MaxOATCooling && VRF(VRFNum).MaxOATHeatRecovery > VRF(VRFNum).MaxOATHeating) { - ShowWarningError(state, cCurrentModuleObject + " = \"" + VRF(VRFNum).Name + "\", " + cNumericFieldNames(8) + + if (state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery > state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling && state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery > state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating) { + ShowWarningError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", " + cNumericFieldNames(8) + " is greater than the maximum temperature in heat pump mode."); - ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(8), VRF(VRFNum).MaxOATHeatRecovery)); - ShowContinueError(state, format("...Maximum Outdoor Temperature in Cooling Mode = {:.2T} C", VRF(VRFNum).MaxOATCooling)); - ShowContinueError(state, format("...Maximum Outdoor Temperature in Heating Mode = {:.2T} C", VRF(VRFNum).MaxOATHeating)); + ShowContinueError(state, format("...{} = {:.2T} C", cNumericFieldNames(8), state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery)); + ShowContinueError(state, format("...Maximum Outdoor Temperature in Cooling Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling)); + ShowContinueError(state, format("...Maximum Outdoor Temperature in Heating Mode = {:.2T} C", state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating)); ShowContinueError(state, "...Maximum Outdoor Temperature in Heat Recovery Mode reset to greater of cooling or heating maximum temperature " "and simulation continues."); - VRF(VRFNum).MaxOATHeatRecovery = max(VRF(VRFNum).MaxOATCooling, VRF(VRFNum).MaxOATHeating); - ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(8), VRF(VRFNum).MaxOATHeatRecovery)); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery = max(state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCooling, state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeating); + ShowContinueError(state, format("... adjusted {} = {:.2T} C", cNumericFieldNames(8), state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATHeatRecovery)); } // IU Control Type if (UtilityRoutines::SameString(cAlphaArgs(5), "VariableTemp")) { - VRF(VRFNum).AlgorithmIUCtrl = 1; + state.dataHVACVarRefFlow->VRF(VRFNum).AlgorithmIUCtrl = 1; } else if (UtilityRoutines::SameString(cAlphaArgs(5), "ConstantTemp")) { - VRF(VRFNum).AlgorithmIUCtrl = 2; + state.dataHVACVarRefFlow->VRF(VRFNum).AlgorithmIUCtrl = 2; } else { - VRF(VRFNum).AlgorithmIUCtrl = 1; + state.dataHVACVarRefFlow->VRF(VRFNum).AlgorithmIUCtrl = 1; } // Reference IU Te/Tc for IU Control Algorithm: ConstantTemp - VRF(VRFNum).EvapTempFixed = rNumericArgs(9); - VRF(VRFNum).CondTempFixed = rNumericArgs(10); + state.dataHVACVarRefFlow->VRF(VRFNum).EvapTempFixed = rNumericArgs(9); + state.dataHVACVarRefFlow->VRF(VRFNum).CondTempFixed = rNumericArgs(10); // Bounds of Te/Tc for IU Control Algorithm: VariableTemp - VRF(VRFNum).IUEvapTempLow = rNumericArgs(11); - VRF(VRFNum).IUEvapTempHigh = rNumericArgs(12); - VRF(VRFNum).IUCondTempLow = rNumericArgs(13); - VRF(VRFNum).IUCondTempHigh = rNumericArgs(14); - if (VRF(VRFNum).IUEvapTempLow >= VRF(VRFNum).IUEvapTempHigh) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow = rNumericArgs(11); + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh = rNumericArgs(12); + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow = rNumericArgs(13); + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh = rNumericArgs(14); + if (state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow >= state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(11), - VRF(VRFNum).IUEvapTempLow, - VRF(VRFNum).IUEvapTempHigh)); + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow, + state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh)); ErrorsFound = true; } - if (VRF(VRFNum).IUCondTempLow >= VRF(VRFNum).IUCondTempHigh) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow >= state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\""); ShowContinueError(state, format("... {} ({:.3T}) must be less than maximum ({:.3T}).", cNumericFieldNames(13), - VRF(VRFNum).IUCondTempLow, - VRF(VRFNum).IUCondTempHigh)); + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow, + state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh)); ErrorsFound = true; } // Reference OU SH/SC - VRF(VRFNum).SH = rNumericArgs(15); - VRF(VRFNum).SC = rNumericArgs(16); - if (VRF(VRFNum).SH > 20) { - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(15)); + state.dataHVACVarRefFlow->VRF(VRFNum).SH = rNumericArgs(15); + state.dataHVACVarRefFlow->VRF(VRFNum).SC = rNumericArgs(16); + if (state.dataHVACVarRefFlow->VRF(VRFNum).SH > 20) { + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(15)); ShowContinueError(state, "...is higher than 20C, which is usually the maximum of normal range."); } - if (VRF(VRFNum).SC > 20) { - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(15)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).SC > 20) { + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(15)); ShowContinueError(state, "...is higher than 20C, which is usually the maximum of normal range."); } // OU Heat Exchanger Rated Bypass Factor - VRF(VRFNum).RateBFOUEvap = rNumericArgs(17); - VRF(VRFNum).RateBFOUCond = rNumericArgs(18); + state.dataHVACVarRefFlow->VRF(VRFNum).RateBFOUEvap = rNumericArgs(17); + state.dataHVACVarRefFlow->VRF(VRFNum).RateBFOUCond = rNumericArgs(18); // Difference between Outdoor Unit Te and OAT during Simultaneous Heating and Cooling operations - VRF(VRFNum).DiffOUTeTo = rNumericArgs(19); + state.dataHVACVarRefFlow->VRF(VRFNum).DiffOUTeTo = rNumericArgs(19); // HR OU Heat Exchanger Capacity Ratio - VRF(VRFNum).HROUHexRatio = rNumericArgs(20); + state.dataHVACVarRefFlow->VRF(VRFNum).HROUHexRatio = rNumericArgs(20); // Get OU fan data - VRF(VRFNum).RatedOUFanPowerPerCapcity = rNumericArgs(21); - VRF(VRFNum).OUAirFlowRatePerCapcity = rNumericArgs(22); - VRF(VRFNum).RatedOUFanPower = VRF(VRFNum).RatedOUFanPowerPerCapcity * VRF(VRFNum).RatedEvapCapacity; - VRF(VRFNum).OUAirFlowRate = VRF(VRFNum).OUAirFlowRatePerCapcity * VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).RatedOUFanPowerPerCapcity = rNumericArgs(21); + state.dataHVACVarRefFlow->VRF(VRFNum).OUAirFlowRatePerCapcity = rNumericArgs(22); + state.dataHVACVarRefFlow->VRF(VRFNum).RatedOUFanPower = state.dataHVACVarRefFlow->VRF(VRFNum).RatedOUFanPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFNum).OUAirFlowRate = state.dataHVACVarRefFlow->VRF(VRFNum).OUAirFlowRatePerCapcity * state.dataHVACVarRefFlow->VRF(VRFNum).RatedEvapCapacity; // OUEvapTempCurve int indexOUEvapTempCurve = GetCurveIndex(state, cAlphaArgs(6)); // convert curve name to index number // Verify curve name and type if (indexOUEvapTempCurve == 0) { if (lAlphaFieldBlanks(6)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(6) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(6) + "=\"" + cAlphaArgs(6) + "\"."); } ErrorsFound = true; } else { if (state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).ObjectType == "Curve:Quadratic") { - VRF(VRFNum).C1Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff1; - VRF(VRFNum).C2Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff2; - VRF(VRFNum).C3Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff3; + state.dataHVACVarRefFlow->VRF(VRFNum).C1Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff1; + state.dataHVACVarRefFlow->VRF(VRFNum).C2Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff2; + state.dataHVACVarRefFlow->VRF(VRFNum).C3Te = state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).Coeff3; } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFieldNames(6) + " type for this object = " + state.dataCurveManager->PerfCurve(indexOUEvapTempCurve).ObjectType); ShowContinueError(state, "... Curve type must be Quadratic."); @@ -3111,20 +3002,20 @@ namespace HVACVariableRefrigerantFlow { // Verify curve name and type if (indexOUCondTempCurve == 0) { if (lAlphaFieldBlanks(7)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(7) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(7) + "=\"" + cAlphaArgs(7) + "\"."); } ErrorsFound = true; } else { if (state.dataCurveManager->PerfCurve(indexOUCondTempCurve).ObjectType == "Curve:Quadratic") { - VRF(VRFNum).C1Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff1; - VRF(VRFNum).C2Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff2; - VRF(VRFNum).C3Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff3; + state.dataHVACVarRefFlow->VRF(VRFNum).C1Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff1; + state.dataHVACVarRefFlow->VRF(VRFNum).C2Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff2; + state.dataHVACVarRefFlow->VRF(VRFNum).C3Tc = state.dataCurveManager->PerfCurve(indexOUCondTempCurve).Coeff3; } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...illegal " + cAlphaFieldNames(7) + " type for this object = " + state.dataCurveManager->PerfCurve(indexOUCondTempCurve).ObjectType); ShowContinueError(state, "... Curve type must be Quadratic."); @@ -3133,127 +3024,127 @@ namespace HVACVariableRefrigerantFlow { } // Pipe parameters - VRF(VRFNum).RefPipDiaSuc = rNumericArgs(23); - VRF(VRFNum).RefPipDiaDis = rNumericArgs(24); - VRF(VRFNum).RefPipLen = rNumericArgs(25); - VRF(VRFNum).RefPipEquLen = rNumericArgs(26); - VRF(VRFNum).RefPipHei = rNumericArgs(27); - VRF(VRFNum).RefPipInsThi = rNumericArgs(28); - VRF(VRFNum).RefPipInsCon = rNumericArgs(29); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipDiaSuc = rNumericArgs(23); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipDiaDis = rNumericArgs(24); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen = rNumericArgs(25); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen = rNumericArgs(26); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipHei = rNumericArgs(27); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipInsThi = rNumericArgs(28); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipInsCon = rNumericArgs(29); // Check the RefPipEquLen if (lNumericFieldBlanks(26) && !lNumericFieldBlanks(25)) { - VRF(VRFNum).RefPipEquLen = 1.2 * VRF(VRFNum).RefPipLen; - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(26) + "\" is calculated based on"); + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen = 1.2 * state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen; + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", \" " + cNumericFieldNames(26) + "\" is calculated based on"); ShowContinueError(state, "...the provided \"" + cNumericFieldNames(25) + "\" value."); } - if (VRF(VRFNum).RefPipEquLen < VRF(VRFNum).RefPipLen) { - VRF(VRFNum).RefPipEquLen = 1.2 * VRF(VRFNum).RefPipLen; - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\", invalid \" " + cNumericFieldNames(26) + "\" value."); + if (state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen < state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen) { + state.dataHVACVarRefFlow->VRF(VRFNum).RefPipEquLen = 1.2 * state.dataHVACVarRefFlow->VRF(VRFNum).RefPipLen; + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid \" " + cNumericFieldNames(26) + "\" value."); ShowContinueError(state, "...Equivalent length of main pipe should be greater than or equal to the actual length."); ShowContinueError(state, "...The value is recalculated based on the provided \"" + cNumericFieldNames(25) + "\" value."); } // Crank case - VRF(VRFNum).CCHeaterPower = rNumericArgs(30); - VRF(VRFNum).NumCompressors = rNumericArgs(31); - VRF(VRFNum).CompressorSizeRatio = rNumericArgs(32); - VRF(VRFNum).MaxOATCCHeater = rNumericArgs(33); + state.dataHVACVarRefFlow->VRF(VRFNum).CCHeaterPower = rNumericArgs(30); + state.dataHVACVarRefFlow->VRF(VRFNum).NumCompressors = rNumericArgs(31); + state.dataHVACVarRefFlow->VRF(VRFNum).CompressorSizeRatio = rNumericArgs(32); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATCCHeater = rNumericArgs(33); // Defrost if (!lAlphaFieldBlanks(8)) { - if (UtilityRoutines::SameString(cAlphaArgs(8), "ReverseCycle")) VRF(VRFNum).DefrostStrategy = ReverseCycle; - if (UtilityRoutines::SameString(cAlphaArgs(8), "Resistive")) VRF(VRFNum).DefrostStrategy = Resistive; - if (VRF(VRFNum).DefrostStrategy == 0) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(8) + " not found: " + cAlphaArgs(8)); + if (UtilityRoutines::SameString(cAlphaArgs(8), "ReverseCycle")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = ReverseCycle; + if (UtilityRoutines::SameString(cAlphaArgs(8), "Resistive")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = Resistive; + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == 0) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(8) + " not found: " + cAlphaArgs(8)); ErrorsFound = true; } } else { - VRF(VRFNum).DefrostStrategy = ReverseCycle; + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy = ReverseCycle; } if (!lAlphaFieldBlanks(9)) { - if (UtilityRoutines::SameString(cAlphaArgs(9), "Timed")) VRF(VRFNum).DefrostControl = Timed; - if (UtilityRoutines::SameString(cAlphaArgs(9), "OnDemand")) VRF(VRFNum).DefrostControl = OnDemand; - if (VRF(VRFNum).DefrostControl == 0) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(9) + " not found: " + cAlphaArgs(9)); + if (UtilityRoutines::SameString(cAlphaArgs(9), "Timed")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = Timed; + if (UtilityRoutines::SameString(cAlphaArgs(9), "OnDemand")) state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = OnDemand; + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl == 0) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(9) + " not found: " + cAlphaArgs(9)); ErrorsFound = true; } } else { - VRF(VRFNum).DefrostControl = Timed; + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl = Timed; } if (!lAlphaFieldBlanks(10)) { - VRF(VRFNum).DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(10)); - if (VRF(VRFNum).DefrostEIRPtr > 0) { + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr = GetCurveIndex(state, cAlphaArgs(10)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr > 0) { // Verify Curve Object, expected type is BiQuadratic ErrorsFound |= CurveManager::CheckCurveDims(state, - VRF(VRFNum).DefrostEIRPtr, // Curve index + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostEIRPtr, // Curve index {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(10)); // Field Name } else { - if (VRF(VRFNum).DefrostStrategy == ReverseCycle && VRF(VRFNum).DefrostControl == OnDemand) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == ReverseCycle && state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl == OnDemand) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10)); ErrorsFound = true; } } } else { - if (VRF(VRFNum).DefrostStrategy == ReverseCycle && VRF(VRFNum).DefrostControl == OnDemand) { - ShowSevereError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10)); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == ReverseCycle && state.dataHVACVarRefFlow->VRF(VRFNum).DefrostControl == OnDemand) { + ShowSevereError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cAlphaFieldNames(10) + " not found:" + cAlphaArgs(10)); ErrorsFound = true; } } - VRF(VRFNum).DefrostFraction = rNumericArgs(34); - VRF(VRFNum).DefrostCapacity = rNumericArgs(35); - VRF(VRFNum).MaxOATDefrost = rNumericArgs(36); - if (VRF(VRFNum).DefrostCapacity == 0.0 && VRF(VRFNum).DefrostStrategy == Resistive) { - ShowWarningError(state, cCurrentModuleObject + ", \"" + VRF(VRFNum).Name + "\" " + cNumericFieldNames(35) + + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostFraction = rNumericArgs(34); + state.dataHVACVarRefFlow->VRF(VRFNum).DefrostCapacity = rNumericArgs(35); + state.dataHVACVarRefFlow->VRF(VRFNum).MaxOATDefrost = rNumericArgs(36); + if (state.dataHVACVarRefFlow->VRF(VRFNum).DefrostCapacity == 0.0 && state.dataHVACVarRefFlow->VRF(VRFNum).DefrostStrategy == Resistive) { + ShowWarningError(state, cCurrentModuleObject + ", \"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\" " + cNumericFieldNames(35) + " = 0.0 for defrost strategy = RESISTIVE."); } // HR mode transition - VRF(VRFNum).HRInitialCoolCapFrac = rNumericArgs(37); - VRF(VRFNum).HRCoolCapTC = rNumericArgs(38); - VRF(VRFNum).HRInitialCoolEIRFrac = rNumericArgs(39); - VRF(VRFNum).HRCoolEIRTC = rNumericArgs(40); - VRF(VRFNum).HRInitialHeatCapFrac = rNumericArgs(41); - VRF(VRFNum).HRHeatCapTC = rNumericArgs(42); - VRF(VRFNum).HRInitialHeatEIRFrac = rNumericArgs(43); - VRF(VRFNum).HRHeatEIRTC = rNumericArgs(44); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialCoolCapFrac = rNumericArgs(37); + state.dataHVACVarRefFlow->VRF(VRFNum).HRCoolCapTC = rNumericArgs(38); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialCoolEIRFrac = rNumericArgs(39); + state.dataHVACVarRefFlow->VRF(VRFNum).HRCoolEIRTC = rNumericArgs(40); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialHeatCapFrac = rNumericArgs(41); + state.dataHVACVarRefFlow->VRF(VRFNum).HRHeatCapTC = rNumericArgs(42); + state.dataHVACVarRefFlow->VRF(VRFNum).HRInitialHeatEIRFrac = rNumericArgs(43); + state.dataHVACVarRefFlow->VRF(VRFNum).HRHeatEIRTC = rNumericArgs(44); // Compressor configuration - VRF(VRFNum).CompMaxDeltaP = rNumericArgs(45); - VRF(VRFNum).EffCompInverter = rNumericArgs(46); - VRF(VRFNum).CoffEvapCap = rNumericArgs(47); + state.dataHVACVarRefFlow->VRF(VRFNum).CompMaxDeltaP = rNumericArgs(45); + state.dataHVACVarRefFlow->VRF(VRFNum).EffCompInverter = rNumericArgs(46); + state.dataHVACVarRefFlow->VRF(VRFNum).CoffEvapCap = rNumericArgs(47); // The new VRF model is Air cooled - VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; - VRF(VRFNum).CondenserNodeNum = 0; + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserType = DataHVACGlobals::AirCooled; + state.dataHVACVarRefFlow->VRF(VRFNum).CondenserNodeNum = 0; // Evaporative Capacity & Compressor Power Curves corresponding to each Loading Index / compressor speed NumOfCompSpd = rNumericArgs(48); - VRF(VRFNum).CompressorSpeed.dimension(NumOfCompSpd); - VRF(VRFNum).OUCoolingCAPFT.dimension(NumOfCompSpd); - VRF(VRFNum).OUCoolingPWRFT.dimension(NumOfCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).CompressorSpeed.dimension(NumOfCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingCAPFT.dimension(NumOfCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingPWRFT.dimension(NumOfCompSpd); int Count1Index = 48; // the index of the last numeric field before compressor speed entries int Count2Index = 9; // the index of the last alpha field before capacity/power curves for (NumCompSpd = 1; NumCompSpd <= NumOfCompSpd; NumCompSpd++) { - VRF(VRFNum).CompressorSpeed(NumCompSpd) = rNumericArgs(Count1Index + NumCompSpd); + state.dataHVACVarRefFlow->VRF(VRFNum).CompressorSpeed(NumCompSpd) = rNumericArgs(Count1Index + NumCompSpd); // Evaporating Capacity Curve if (!lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) { int indexOUEvapCapCurve = GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd)); // convert curve name to index number if (indexOUEvapCapCurve == 0) { // Verify curve name and type if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd) + "=\"" + cAlphaArgs(Count2Index + 2 * NumCompSpd) + "\"."); } @@ -3264,11 +3155,11 @@ namespace HVACVariableRefrigerantFlow { {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(Count2Index + 2 * NumCompSpd)); // Field Name if (!ErrorsFound) { - VRF(VRFNum).OUCoolingCAPFT(NumCompSpd) = indexOUEvapCapCurve; + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingCAPFT(NumCompSpd) = indexOUEvapCapCurve; } } } @@ -3279,10 +3170,10 @@ namespace HVACVariableRefrigerantFlow { GetCurveIndex(state, cAlphaArgs(Count2Index + 2 * NumCompSpd + 1)); // convert curve name to index number if (indexOUCompPwrCurve == 0) { // Verify curve name and type if (lAlphaFieldBlanks(Count2Index + 2 * NumCompSpd + 1)) { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", missing"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", missing"); ShowContinueError(state, "...required " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1) + " is blank."); } else { - ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + VRF(VRFNum).Name + "\", invalid"); + ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRF(VRFNum).Name + "\", invalid"); ShowContinueError(state, "...not found " + cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1) + "=\"" + cAlphaArgs(Count2Index + 2 * NumCompSpd + 1) + "\"."); } @@ -3293,11 +3184,11 @@ namespace HVACVariableRefrigerantFlow { {2}, // Valid dimensions RoutineName, // Routine name cCurrentModuleObject, // Object Type - VRF(VRFNum).Name, // Object Name + state.dataHVACVarRefFlow->VRF(VRFNum).Name, // Object Name cAlphaFieldNames(Count2Index + 2 * NumCompSpd + 1)); // Field Name if (!ErrorsFound) { - VRF(VRFNum).OUCoolingPWRFT(NumCompSpd) = indexOUCompPwrCurve; + state.dataHVACVarRefFlow->VRF(VRFNum).OUCoolingPWRFT(NumCompSpd) = indexOUCompPwrCurve; } } } @@ -3305,7 +3196,7 @@ namespace HVACVariableRefrigerantFlow { } cCurrentModuleObject = "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow"; - for (VRFNum = 1; VRFNum <= NumVRFTU; ++VRFNum) { + for (VRFNum = 1; VRFNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFNum) { VRFTUNum = VRFNum; // initialize local node number variables @@ -3330,86 +3221,86 @@ namespace HVACVariableRefrigerantFlow { cAlphaFieldNames, cNumericFieldNames); - VRFTUNumericFields(VRFTUNum).FieldNames.allocate(NumNums); - VRFTUNumericFields(VRFTUNum).FieldNames = cNumericFieldNames; + state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames.allocate(NumNums); + state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames = cNumericFieldNames; UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - VRFTU(VRFTUNum).Name = cAlphaArgs(1); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name = cAlphaArgs(1); ZoneTerminalUnitListNum = 0; - for (NumList = 1; NumList <= NumVRFTULists; ++NumList) { + for (NumList = 1; NumList <= state.dataHVACVarRefFlow->NumVRFTULists; ++NumList) { ZoneTerminalUnitListNum = UtilityRoutines::FindItemInList( - VRFTU(VRFTUNum).Name, TerminalUnitList(NumList).ZoneTUName, TerminalUnitList(NumList).NumTUInList); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUName, state.dataHVACVarRefFlow->TerminalUnitList(NumList).NumTUInList); if (ZoneTerminalUnitListNum > 0) { - VRFTU(VRFTUNum).IndexToTUInTUList = ZoneTerminalUnitListNum; - TerminalUnitList(NumList).ZoneTUPtr(ZoneTerminalUnitListNum) = VRFTUNum; - VRFTU(VRFTUNum).TUListIndex = NumList; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList = ZoneTerminalUnitListNum; + state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUPtr(ZoneTerminalUnitListNum) = VRFTUNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex = NumList; break; } } - if (VRFTU(VRFTUNum).TUListIndex == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex == 0) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, "Terminal unit not found on any ZoneTerminalUnitList."); ErrorsFound = true; } - for (NumCond = 1; NumCond <= NumVRFCond; ++NumCond) { - if (VRF(NumCond).ZoneTUListPtr != VRFTU(VRFTUNum).TUListIndex) continue; - VRFTU(VRFTUNum).VRFSysNum = NumCond; + for (NumCond = 1; NumCond <= state.dataHVACVarRefFlow->NumVRFCond; ++NumCond) { + if (state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex) continue; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum = NumCond; break; } - VRFTU(VRFTUNum).VRFTUType_Num = DataHVACGlobals::VRFTUType_ConstVolume; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num = DataHVACGlobals::VRFTUType_ConstVolume; if (lAlphaFieldBlanks(2)) { - VRFTU(VRFTUNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; } else { - VRFTU(VRFTUNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (VRFTU(VRFTUNum).SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + VRFTU(VRFTUNum).Name + "\" invalid data"); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr == 0) { + ShowSevereError(state, cCurrentModuleObject + "=\"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" invalid data"); ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } } - VRFTU(VRFTUNum).VRFTUInletNodeNum = GetOnlySingleNode(state, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum = GetOnlySingleNode(state, cAlphaArgs(3), ErrorsFound, cCurrentModuleObject, - VRFTU(VRFTUNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, DataLoopNode::NodeType_Air, DataLoopNode::NodeConnectionType_Inlet, 1, ObjectIsParent); - VRFTU(VRFTUNum).VRFTUOutletNodeNum = GetOnlySingleNode(state, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum = GetOnlySingleNode(state, cAlphaArgs(4), ErrorsFound, cCurrentModuleObject, - VRFTU(VRFTUNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, DataLoopNode::NodeType_Air, DataLoopNode::NodeConnectionType_Outlet, 1, ObjectIsParent); - VRFTU(VRFTUNum).MaxCoolAirVolFlow = rNumericArgs(1); - VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = rNumericArgs(2); - VRFTU(VRFTUNum).MaxHeatAirVolFlow = rNumericArgs(3); - VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = rNumericArgs(4); - VRFTU(VRFTUNum).CoolOutAirVolFlow = rNumericArgs(5); - VRFTU(VRFTUNum).HeatOutAirVolFlow = rNumericArgs(6); - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = rNumericArgs(7); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = rNumericArgs(1); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = rNumericArgs(2); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = rNumericArgs(3); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = rNumericArgs(4); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = rNumericArgs(5); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = rNumericArgs(6); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = rNumericArgs(7); - VRFTU(VRFTUNum).FanOpModeSchedPtr = GetScheduleIndex(state, cAlphaArgs(5)); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr = GetScheduleIndex(state, cAlphaArgs(5)); // default to constant fan operating mode - if (VRFTU(VRFTUNum).FanOpModeSchedPtr == 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr == 0) { if (!lAlphaFieldBlanks(5)) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, "..." + cAlphaFieldNames(5) + " = " + cAlphaArgs(5) + " not found."); ShowContinueError(state, "...Defaulting to constant fan operating mode and simulation continues."); } - VRFTU(VRFTUNum).OpMode = DataHVACGlobals::ContFanCycCoil; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode = DataHVACGlobals::ContFanCycCoil; } - if (UtilityRoutines::SameString(cAlphaArgs(6), "BlowThrough")) VRFTU(VRFTUNum).FanPlace = DataHVACGlobals::BlowThru; - if (UtilityRoutines::SameString(cAlphaArgs(6), "DrawThrough")) VRFTU(VRFTUNum).FanPlace = DataHVACGlobals::DrawThru; + if (UtilityRoutines::SameString(cAlphaArgs(6), "BlowThrough")) state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace = DataHVACGlobals::BlowThru; + if (UtilityRoutines::SameString(cAlphaArgs(6), "DrawThrough")) state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace = DataHVACGlobals::DrawThru; if (!lAlphaFieldBlanks(7) && !lAlphaFieldBlanks(8)) { // Get fan data @@ -3419,32 +3310,32 @@ namespace HVACVariableRefrigerantFlow { if (!HVACFan::checkIfFanNameIsAFanSystem(state, FanName)) { ErrorsFound = true; } else { - VRFTU(VRFTUNum).fanType_Num = DataHVACGlobals::FanType_SystemModelObject; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num = DataHVACGlobals::FanType_SystemModelObject; } } else { errFlag = false; - GetFanType(state, FanName, VRFTU(VRFTUNum).fanType_Num, errFlag, cCurrentModuleObject); + GetFanType(state, FanName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num, errFlag, cCurrentModuleObject); if (errFlag) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } } // Check the type of the fan is correct - if (!UtilityRoutines::SameString(DataHVACGlobals::cFanTypes(VRFTU(VRFTUNum).fanType_Num), FanType)) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (!UtilityRoutines::SameString(DataHVACGlobals::cFanTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num), FanType)) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7)); ShowContinueError(state, "Based on the fan name the type of fan actually used = " + - DataHVACGlobals::cFanTypes(VRFTU(VRFTUNum).fanType_Num)); + DataHVACGlobals::cFanTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num)); ErrorsFound = true; } - if (VRFTU(VRFTUNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0) { // VRFTU Supply Air Fan Object Type must be Fan:VariableVolume if VRF Algorithm Type is AlgorithmTypeFluidTCtrl - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl && - !(VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleVAV || - VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject)) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl && + !(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleVAV || + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject)) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7)); ShowContinueError(state, "Fan Object Type must be Fan:VariableVolume if VRF AirConditioner:VariableRefrigerantFlow:FluidTemperatureControl"); @@ -3452,11 +3343,11 @@ namespace HVACVariableRefrigerantFlow { ErrorsFound = true; } // VRFTU Supply Air Fan Object Type must be Fan:OnOff or Fan:ConstantVolume if VRF Algorithm Type is AlgorithmTypeSysCurve - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == AlgorithmTypeSysCurve && - !(VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleOnOff || - VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleConstVolume || - VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject)) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == iAlgorithmType::SysCurve && + !(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleOnOff || + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleConstVolume || + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject)) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, "Fan type specified = " + cAlphaArgs(7)); ShowContinueError(state, "Fan Object Type must be Fan:SystemModel, Fan:OnOff, or Fan:ConstantVolume if VRF " "AirConditioner:VariableRefrigerantFlow"); @@ -3465,35 +3356,35 @@ namespace HVACVariableRefrigerantFlow { } } - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleOnOff || - VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleConstVolume || - VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleVAV) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleOnOff || + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleConstVolume || + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleVAV) { - ValidateComponent(state, DataHVACGlobals::cFanTypes(VRFTU(VRFTUNum).fanType_Num), FanName, IsNotOK, cCurrentModuleObject); + ValidateComponent(state, DataHVACGlobals::cFanTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num), FanName, IsNotOK, cCurrentModuleObject); if (IsNotOK) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { // mine data from fan object // Get the fan index errFlag = false; - GetFanIndex(state, FanName, VRFTU(VRFTUNum).FanIndex, errFlag, ObjexxFCL::Optional_string_const()); + GetFanIndex(state, FanName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex, errFlag, ObjexxFCL::Optional_string_const()); if (errFlag) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { - VRFTU(VRFTUNum).fanInletNode = Fans::Fan(VRFTU(VRFTUNum).FanIndex).InletNodeNum; - VRFTU(VRFTUNum).fanOutletNode = Fans::Fan(VRFTU(VRFTUNum).FanIndex).OutletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanInletNode = Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).InletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode = Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).OutletNodeNum; } // Set the Design Fan Volume Flow Rate errFlag = false; FanVolFlowRate = GetFanDesignVolumeFlowRate(state, FanType, FanName, errFlag); - VRFTU(VRFTUNum).ActualFanVolFlowRate = FanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate = FanVolFlowRate; if (errFlag) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " =" + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " =" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } @@ -3501,7 +3392,7 @@ namespace HVACVariableRefrigerantFlow { errFlag = false; FanInletNodeNum = GetFanInletNode(state, FanType, FanName, errFlag); if (errFlag) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } @@ -3509,22 +3400,22 @@ namespace HVACVariableRefrigerantFlow { errFlag = false; FanOutletNodeNum = GetFanOutletNode(state, FanType, FanName, errFlag); if (errFlag) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the fan's availability schedule errFlag = false; - VRFTU(VRFTUNum).FanAvailSchedPtr = GetFanAvailSchPtr(state, FanType, FanName, errFlag); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr = GetFanAvailSchPtr(state, FanType, FanName, errFlag); if (errFlag) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Check fan's schedule for cycling fan operation if constant volume fan is used - if (VRFTU(VRFTUNum).FanOpModeSchedPtr > 0 && VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { - if (!CheckScheduleValueMinMax(state, VRFTU(VRFTUNum).FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { + if (!CheckScheduleValueMinMax(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, "For fan type = " + DataHVACGlobals::cFanTypes(DataHVACGlobals::FanType_SimpleConstVolume)); ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); ShowContinueError(state, "Error found in " + cAlphaFieldNames(5) + " = " + cAlphaArgs(5)); @@ -3534,51 +3425,51 @@ namespace HVACVariableRefrigerantFlow { } } // IF (IsNotOK) THEN - } else if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - ValidateComponent(state, DataHVACGlobals::cFanTypes(VRFTU(VRFTUNum).fanType_Num), FanName, IsNotOK, cCurrentModuleObject); + ValidateComponent(state, DataHVACGlobals::cFanTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num), FanName, IsNotOK, cCurrentModuleObject); if (IsNotOK) { - ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { // mine data from fan object HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, FanName)); // call constructor - VRFTU(VRFTUNum).FanIndex = HVACFan::getFanObjectVectorIndex(state, FanName); - VRFTU(VRFTUNum).ActualFanVolFlowRate = HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; - FanInletNodeNum = HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->inletNodeNum; - FanOutletNodeNum = HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->outletNodeNum; - VRFTU(VRFTUNum).FanAvailSchedPtr = HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->availSchedIndex; - VRFTU(VRFTUNum).fanInletNode = FanInletNodeNum; - VRFTU(VRFTUNum).fanOutletNode = FanOutletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex = HVACFan::getFanObjectVectorIndex(state, FanName); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate = HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; + FanInletNodeNum = HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->inletNodeNum; + FanOutletNodeNum = HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->outletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr = HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->availSchedIndex; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanInletNode = FanInletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode = FanOutletNodeNum; } } else { // IF (FanType_Num == DataHVACGlobals::FanType_SimpleOnOff .OR. FanType_Num == // DataHVACGlobals::FanType_SimpleConstVolume)THEN - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, "Illegal " + cAlphaFieldNames(7) + " = " + cAlphaArgs(7)); ErrorsFound = true; } // IF (FanType_Num == DataHVACGlobals::FanType_SimpleOnOff .OR. FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume)THEN // Add TU to component sets array SetUpCompSets(state, cCurrentModuleObject, - VRFTU(VRFTUNum).Name, - DataHVACGlobals::cFanTypes(VRFTU(VRFTUNum).fanType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + DataHVACGlobals::cFanTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num), FanName, DataLoopNode::NodeID(FanInletNodeNum), DataLoopNode::NodeID(FanOutletNodeNum)); } else if (lAlphaFieldBlanks(7) || lAlphaFieldBlanks(8)) { - VRFTU(VRFTUNum).FanPlace = 0; // reset fan placement when fan is not used so as not to call the fan + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace = 0; // reset fan placement when fan is not used so as not to call the fan } else { - VRFTU(VRFTUNum).FanPlace = 0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace = 0; } // Get OA mixer data OAMixerType = cAlphaArgs(9); if (!lAlphaFieldBlanks(10)) { - VRFTU(VRFTUNum).OAMixerName = cAlphaArgs(10); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName = cAlphaArgs(10); errFlag = false; - OANodeNums = GetOAMixerNodeNumbers(state, VRFTU(VRFTUNum).OAMixerName, errFlag); + OANodeNums = GetOAMixerNodeNumbers(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, errFlag); // OANodeNums(1) = OAMixer(OAMixerNum)%InletNode // OANodeNums(2) = OAMixer(OAMixerNum)%RelNode @@ -3586,41 +3477,41 @@ namespace HVACVariableRefrigerantFlow { // OANodeNums(4) = OAMixer(OAMixerNum)%MixNode if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { - VRFTU(VRFTUNum).OAMixerUsed = true; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed = true; } - VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum = OANodeNums(1); - VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum = OANodeNums(2); - VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum = OANodeNums(3); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum = OANodeNums(1); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum = OANodeNums(2); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum = OANodeNums(3); } // Get DX cooling coil data DXCoolingCoilType = cAlphaArgs(11); errFlag = false; - VRFTU(VRFTUNum).DXCoolCoilType_Num = GetCoilTypeNum(state, DXCoolingCoilType, cAlphaArgs(12), errFlag, false); - if (VRFTU(VRFTUNum).DXCoolCoilType_Num == 0) { - VRFTU(VRFTUNum).CoolingCoilPresent = false; - if (VRFTU(VRFTUNum).TUListIndex > 0 && VRFTU(VRFTUNum).IndexToTUInTUList > 0) { - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).CoolingCoilPresent(VRFTU(VRFTUNum).IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num = GetCoilTypeNum(state, DXCoolingCoilType, cAlphaArgs(12), errFlag, false); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num == 0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent = false; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).CoolingCoilPresent(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList) = false; } } else { - if (VRFTU(VRFTUNum).VRFSysNum > 0) { - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXCoolCoilType_Num), + if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num), DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Cooling))) { errFlag = false; - if (VRFTU(VRFTUNum).TUListIndex > 0 && VRFTU(VRFTUNum).IndexToTUInTUList > 0) { - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).CoolingCoilAvailSchPtr(VRFTU(VRFTUNum).IndexToTUInTUList) = + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).CoolingCoilAvailSchPtr(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList) = GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); } GetDXCoilIndex(state, cAlphaArgs(12), - VRFTU(VRFTUNum).CoolCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, errFlag, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Cooling), ObjexxFCL::Optional_bool_const()); @@ -3628,45 +3519,45 @@ namespace HVACVariableRefrigerantFlow { state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Cooling), cAlphaArgs(12), errFlag); CCoilOutletNodeNum = GetDXCoilOutletNode( state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Cooling), cAlphaArgs(12), errFlag); - VRFTU(VRFTUNum).coolCoilAirInNode = CCoilInletNodeNum; - VRFTU(VRFTUNum).coolCoilAirOutNode = CCoilOutletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolCoilAirInNode = CCoilInletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolCoilAirOutNode = CCoilOutletNodeNum; - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); - if (VRFTU(VRFTUNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0) { SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserType); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserType); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MinOATCooling); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MinOATCooling); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATCooling); - - DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).VRFIUPtr = VRFTUNum; - DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).VRFOUPtr = VRFTU(VRFTUNum).VRFSysNum; - DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).SupplyFanIndex = VRFTU(VRFTUNum).FanIndex; - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - if (VRFTU(VRFTUNum).FanIndex > -1) { - DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATCooling); + + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).VRFIUPtr = VRFTUNum; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).VRFOUPtr = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).SupplyFanIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > -1) { + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; } else { - DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = AutoSize; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = AutoSize; } } else { - if (VRFTU(VRFTUNum).FanIndex > 0) { - DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = - EnergyPlus::Fans::Fan(VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) { + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = + EnergyPlus::Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; } else { - DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = AutoSize; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).RatedAirVolFlowRate(1) = AutoSize; } } } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); - ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXCoolCoilType_Num) + " \"" + + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); + ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num) + " \"" + cAlphaArgs(12) + "\""); ShowContinueError(state, "... terminal unit not connected to condenser."); ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); @@ -3675,7 +3566,7 @@ namespace HVACVariableRefrigerantFlow { ErrorsFound = true; } } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "... illegal " + cAlphaFieldNames(12) + " = " + cAlphaArgs(12)); ErrorsFound = true; } @@ -3683,18 +3574,18 @@ namespace HVACVariableRefrigerantFlow { } else { // Algorithm Type: VRF model based on system curve - if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXCoolCoilType_Num), + if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num), DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Cooling))) { - if (VRFTU(VRFTUNum).TUListIndex > 0 && VRFTU(VRFTUNum).IndexToTUInTUList > 0) { - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).CoolingCoilAvailSchPtr(VRFTU(VRFTUNum).IndexToTUInTUList) = + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).CoolingCoilAvailSchPtr(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList) = GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); } else { - VRFTU(VRFTUNum).CoolingCoilPresent = false; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent = false; } errFlag = false; GetDXCoilIndex(state, cAlphaArgs(12), - VRFTU(VRFTUNum).CoolCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, errFlag, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Cooling), ObjexxFCL::Optional_bool_const()); @@ -3702,30 +3593,30 @@ namespace HVACVariableRefrigerantFlow { GetDXCoilInletNode(state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Cooling), cAlphaArgs(12), errFlag); CCoilOutletNodeNum = GetDXCoilOutletNode(state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Cooling), cAlphaArgs(12), errFlag); - VRFTU(VRFTUNum).coolCoilAirInNode = CCoilInletNodeNum; - VRFTU(VRFTUNum).coolCoilAirOutNode = CCoilOutletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolCoilAirInNode = CCoilInletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolCoilAirOutNode = CCoilOutletNodeNum; - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); - SetDXCoolingCoilData(state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserType); + SetDXCoolingCoilData(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserType); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MinOATCooling); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MinOATCooling); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATCooling); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATCooling); } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "... illegal " + cAlphaFieldNames(12) + " = " + cAlphaArgs(12)); ErrorsFound = true; } } } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); - ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXCoolCoilType_Num) + " \"" + + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); + ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num) + " \"" + cAlphaArgs(12) + "\""); ShowContinueError(state, "... terminal unit not connected to condenser."); ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); @@ -3740,31 +3631,31 @@ namespace HVACVariableRefrigerantFlow { // Get the heating to cooling sizing ratio input before writing to DX heating coil data if (!lNumericFieldBlanks(10)) { - VRFTU(VRFTUNum).HeatingCapacitySizeRatio = rNumericArgs(10); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCapacitySizeRatio = rNumericArgs(10); } errFlag = false; - VRFTU(VRFTUNum).DXHeatCoilType_Num = GetCoilTypeNum(state, DXHeatingCoilType, cAlphaArgs(14), errFlag, false); - if (VRFTU(VRFTUNum).DXHeatCoilType_Num == 0) { - VRFTU(VRFTUNum).HeatingCoilPresent = false; - if (VRFTU(VRFTUNum).TUListIndex > 0 && VRFTU(VRFTUNum).IndexToTUInTUList > 0) { - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).HeatingCoilPresent(VRFTU(VRFTUNum).IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num = GetCoilTypeNum(state, DXHeatingCoilType, cAlphaArgs(14), errFlag, false); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num == 0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent = false; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).HeatingCoilPresent(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList) = false; } } else { - if (VRFTU(VRFTUNum).VRFSysNum > 0) { - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num), + if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num), DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Heating))) { errFlag = false; - if (VRFTU(VRFTUNum).TUListIndex > 0 && VRFTU(VRFTUNum).IndexToTUInTUList > 0) { - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).HeatingCoilAvailSchPtr(VRFTU(VRFTUNum).IndexToTUInTUList) = + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).HeatingCoilAvailSchPtr(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList) = GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); } GetDXCoilIndex(state, cAlphaArgs(14), - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, errFlag, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Heating), ObjexxFCL::Optional_bool_const()); @@ -3772,20 +3663,20 @@ namespace HVACVariableRefrigerantFlow { state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Heating), cAlphaArgs(14), errFlag); HCoilOutletNodeNum = GetDXCoilOutletNode( state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_FluidTCtrl_Heating), cAlphaArgs(14), errFlag); - VRFTU(VRFTUNum).heatCoilAirInNode = HCoilInletNodeNum; - VRFTU(VRFTUNum).heatCoilAirOutNode = HCoilOutletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatCoilAirInNode = HCoilInletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatCoilAirOutNode = HCoilOutletNodeNum; - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); - if (VRFTU(VRFTUNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0) { SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserType); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserType); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3793,9 +3684,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).MinOATHeating); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MinOATHeating); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3804,9 +3695,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATHeating); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATHeating); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3816,10 +3707,10 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType); // Set defrost controls in child object to trip child object defrost calculations SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3830,9 +3721,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostStrategy); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostStrategy); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3844,9 +3735,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostControl); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostControl); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3859,9 +3750,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostEIRPtr); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostEIRPtr); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3875,9 +3766,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostFraction); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostFraction); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3893,13 +3784,13 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATDefrost); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATDefrost); // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing. // Defrost capacity is used for nothing more than setting defrost power/consumption report // variables which are not reported. The coil's defrost algorythm IS used to derate the coil SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3916,29 +3807,29 @@ namespace HVACVariableRefrigerantFlow { _, 1.0); // DefrostCapacity=1.0 - DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).VRFIUPtr = VRFTUNum; - DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).VRFOUPtr = VRFTU(VRFTUNum).VRFSysNum; - DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).SupplyFanIndex = VRFTU(VRFTUNum).FanIndex; - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - if (VRFTU(VRFTUNum).FanIndex > -1) { - DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).VRFIUPtr = VRFTUNum; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).VRFOUPtr = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).SupplyFanIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > -1) { + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; } else { - DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = AutoSize; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = AutoSize; } } else { - if (VRFTU(VRFTUNum).FanIndex > 0) { - DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = - EnergyPlus::Fans::Fan(VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) { + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = + EnergyPlus::Fans::Fan(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex).MaxAirFlowRate; } else { - DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = AutoSize; + state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).RatedAirVolFlowRate(1) = AutoSize; } } // Terminal unit heating to cooling sizing ratio has precedence over VRF system sizing ratio - if (VRFTU(VRFTUNum).HeatingCapacitySizeRatio > 1.0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCapacitySizeRatio > 1.0) { SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3957,10 +3848,10 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRFTU(VRFTUNum).HeatingCapacitySizeRatio); - } else if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio > 1.0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCapacitySizeRatio); + } else if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio > 1.0) { SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -3979,11 +3870,11 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio); } } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); - ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num) + " \"" + + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); + ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num) + " \"" + cAlphaArgs(14) + "\""); ShowContinueError(state, "... terminal unit not connected to condenser."); ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); @@ -3992,25 +3883,25 @@ namespace HVACVariableRefrigerantFlow { ErrorsFound = true; } } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "... illegal " + cAlphaFieldNames(14) + " = " + cAlphaArgs(14)); ErrorsFound = true; } } else { // Algorithm Type: VRF model based on system curve - if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num), + if (UtilityRoutines::SameString(DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num), DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Heating))) { - if (VRFTU(VRFTUNum).TUListIndex > 0 && VRFTU(VRFTUNum).IndexToTUInTUList > 0) { - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).HeatingCoilAvailSchPtr(VRFTU(VRFTUNum).IndexToTUInTUList) = + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList > 0) { + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).HeatingCoilAvailSchPtr(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList) = GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); } else { - VRFTU(VRFTUNum).HeatingCoilPresent = false; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent = false; } errFlag = false; GetDXCoilIndex(state, cAlphaArgs(14), - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, errFlag, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Heating), ObjexxFCL::Optional_bool_const()); @@ -4018,20 +3909,20 @@ namespace HVACVariableRefrigerantFlow { GetDXCoilInletNode(state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Heating), cAlphaArgs(14), errFlag); HCoilOutletNodeNum = GetDXCoilOutletNode(state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilVRF_Heating), cAlphaArgs(14), errFlag); - VRFTU(VRFTUNum).heatCoilAirInNode = HCoilInletNodeNum; - VRFTU(VRFTUNum).heatCoilAirOutNode = HCoilOutletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatCoilAirInNode = HCoilInletNodeNum; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatCoilAirOutNode = HCoilOutletNodeNum; - if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (errFlag) ShowContinueError(state, "...occurs in " + cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); - SetDXCoolingCoilData(state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserType); + SetDXCoolingCoilData(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserType); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CondenserNodeNum); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATCCHeater); SetDXCoolingCoilData( - state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, _, _, _, _, VRF(VRFTU(VRFTUNum).VRFSysNum).MinOATHeating); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, _, _, _, _, state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MinOATHeating); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4041,10 +3932,10 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType); // Set defrost controls in child object to trip child object defrost calculations SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4055,9 +3946,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostStrategy); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostStrategy); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4069,9 +3960,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostControl); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostControl); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4084,9 +3975,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostEIRPtr); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostEIRPtr); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4100,9 +3991,9 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).DefrostFraction); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).DefrostFraction); SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4118,13 +4009,13 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).MaxOATDefrost); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).MaxOATDefrost); // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing. // Defrost capacity is used for nothing more than setting defrost power/consumption report // variables which are not reported. The coil's defrost algorythm IS used to derate the coil SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4141,9 +4032,9 @@ namespace HVACVariableRefrigerantFlow { _, 1.0); // DefrostCapacity=1.0 // Terminal unit heating to cooling sizing ratio has precedence over VRF system sizing ratio - if (VRFTU(VRFTUNum).HeatingCapacitySizeRatio > 1.0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCapacitySizeRatio > 1.0) { SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4162,10 +4053,10 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRFTU(VRFTUNum).HeatingCapacitySizeRatio); - } else if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio > 1.0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCapacitySizeRatio); + } else if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio > 1.0) { SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4184,53 +4075,53 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio); + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingCapacitySizeRatio); } // Check VRF DX heating coil heating capacity as a fuction of temperature performance curve. Only report here for // biquadratic curve type. - if (VRFTU(VRFTUNum).VRFSysNum > 0 && VRFTU(VRFTUNum).HeatCoilIndex > 0 && - state.dataCurveManager->PerfCurve(GetDXCoilCapFTCurveIndex(state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound)) + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex > 0 && + state.dataCurveManager->PerfCurve(GetDXCoilCapFTCurveIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound)) .NumDims == 2) { - if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType == DataHVACGlobals::WetBulbIndicator) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType == DataHVACGlobals::WetBulbIndicator) { checkCurveIsNormalizedToOne( state, - "GetDXCoils: " + DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num), + "GetDXCoils: " + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num), DXCoils::GetDXCoilName(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, - DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num), + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num), ObjexxFCL::Optional_bool_const()), - GetDXCoilCapFTCurveIndex(state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound), + GetDXCoilCapFTCurveIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound), "Heating Capacity Ratio Modifier Function of Temperature Curve Name", CurveManager::GetCurveName(state, - GetDXCoilCapFTCurveIndex(state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound)), + GetDXCoilCapFTCurveIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound)), RatedInletAirTempHeat, RatedOutdoorWetBulbTempHeat); - } else if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType == DataHVACGlobals::DryBulbIndicator) { + } else if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingPerformanceOATType == DataHVACGlobals::DryBulbIndicator) { checkCurveIsNormalizedToOne(state, - "GetDXCoils: " + DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num), + "GetDXCoils: " + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num), DXCoils::GetDXCoilName(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, - DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num), + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num), ObjexxFCL::Optional_bool_const()), - GetDXCoilCapFTCurveIndex(state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound), + GetDXCoilCapFTCurveIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound), "Heating Capacity Ratio Modifier Function of Temperature Curve Name", - CurveManager::GetCurveName(state, GetDXCoilCapFTCurveIndex(state, VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound)), + CurveManager::GetCurveName(state, GetDXCoilCapFTCurveIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound)), RatedInletAirTempHeat, RatedOutdoorAirTempHeat); } } } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "... illegal " + cAlphaFieldNames(14) + " = " + cAlphaArgs(14)); ErrorsFound = true; } } } else { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); - ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num) + " \"" + + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); + ShowContinueError(state, "... when checking " + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num) + " \"" + cAlphaArgs(14) + "\""); ShowContinueError(state, "... terminal unit not connected to condenser."); ShowContinueError(state, "... check that terminal unit is specified in a terminal unit list object."); @@ -4240,25 +4131,25 @@ namespace HVACVariableRefrigerantFlow { } } - if (!VRFTU(VRFTUNum).CoolingCoilPresent && VRFTU(VRFTUNum).DXCoolCoilType_Num == 0 && !VRFTU(VRFTUNum).HeatingCoilPresent && - VRFTU(VRFTUNum).DXHeatCoilType_Num == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num == 0 && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent && + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "... no valid coils entered for this terminal unit. Simulation will not proceed."); ErrorsFound = true; } if (!lAlphaFieldBlanks(15)) { - VRFTU(VRFTUNum).AvailManagerListName = cAlphaArgs(15); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailManagerListName = cAlphaArgs(15); } - VRFTU(VRFTUNum).ParasiticElec = rNumericArgs(8); - VRFTU(VRFTUNum).ParasiticOffElec = rNumericArgs(9); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec = rNumericArgs(8); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec = rNumericArgs(9); - VRFTU(VRFTUNum).HVACSizingIndex = 0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex = 0; if (!lAlphaFieldBlanks(16)) { - VRFTU(VRFTUNum).HVACSizingIndex = UtilityRoutines::FindItemInList(cAlphaArgs(16), ZoneHVACSizing); - if (VRFTU(VRFTUNum).HVACSizingIndex == 0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex = UtilityRoutines::FindItemInList(cAlphaArgs(16), ZoneHVACSizing); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex == 0) { ShowSevereError(state, cAlphaFieldNames(16) + " = " + cAlphaArgs(16) + " not found."); - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } } @@ -4269,174 +4160,174 @@ namespace HVACVariableRefrigerantFlow { SuppHeatingCoilType = cAlphaArgs(17); SuppHeatingCoilName = cAlphaArgs(18); - VRFTU(VRFTUNum).SuppHeatCoilName = SuppHeatingCoilName; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName = SuppHeatingCoilName; errFlag = false; if (UtilityRoutines::SameString(SuppHeatingCoilType, "Coil:Heating:Water")) { - VRFTU(VRFTUNum).SuppHeatCoilType_Num = DataHVACGlobals::Coil_HeatingWater; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num = DataHVACGlobals::Coil_HeatingWater; } else if (UtilityRoutines::SameString(SuppHeatingCoilType, "Coil:Heating:Steam")) { - VRFTU(VRFTUNum).SuppHeatCoilType_Num = DataHVACGlobals::Coil_HeatingSteam; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num = DataHVACGlobals::Coil_HeatingSteam; } else if (UtilityRoutines::SameString(SuppHeatingCoilType, "Coil:Heating:Fuel") || UtilityRoutines::SameString(SuppHeatingCoilType, "Coil:Heating:Electric")) { - VRFTU(VRFTUNum).SuppHeatCoilType_Num = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num = HeatingCoils::GetHeatingCoilTypeNum(state, SuppHeatingCoilType, SuppHeatingCoilName, errFlag); } - VRFTU(VRFTUNum).SuppHeatCoilType = SuppHeatingCoilType; - VRFTU(VRFTUNum).SuppHeatingCoilPresent = true; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType = SuppHeatingCoilType; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent = true; - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel || - VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingElectric) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingGasOrOtherFuel || + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingElectric) { errFlag = false; - VRFTU(VRFTUNum).SuppHeatCoilType_Num = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num = HeatingCoils::GetHeatingCoilTypeNum(state, SuppHeatingCoilType, SuppHeatingCoilName, errFlag); if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { ValidateComponent(state, SuppHeatingCoilType, SuppHeatingCoilName, IsNotOK, cCurrentModuleObject); if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { // mine data from supplemental heating coil // Get the supplemental heating coil index - VRFTU(VRFTUNum).SuppHeatCoilIndex = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex = HeatingCoils::GetHeatingCoilIndex(state, SuppHeatingCoilType, SuppHeatingCoilName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the design supplemental heating capacity errFlag = false; - VRFTU(VRFTUNum).DesignSuppHeatingCapacity = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = HeatingCoils::GetCoilCapacity(state, SuppHeatingCoilType, SuppHeatingCoilName, errFlag); if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating Coil air inlet node errFlag = false; SuppHeatCoilAirInletNode = HeatingCoils::GetCoilInletNode(state, SuppHeatingCoilType, SuppHeatingCoilName, errFlag); if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating Coil air outlet node errFlag = false; SuppHeatCoilAirOutletNode = HeatingCoils::GetCoilOutletNode(state, SuppHeatingCoilType, SuppHeatingCoilName, errFlag); if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } } // IF (IsNotOK) THEN } - VRFTU(VRFTUNum).SuppHeatCoilAirInletNode = SuppHeatCoilAirInletNode; - VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode = SuppHeatCoilAirOutletNode; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirInletNode = SuppHeatCoilAirInletNode; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode = SuppHeatCoilAirOutletNode; - } else if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { ValidateComponent(state, SuppHeatingCoilType, SuppHeatingCoilName, IsNotOK, cCurrentModuleObject); if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { // mine data from heating coil object // Get the supplemental heating coil water Inlet or control node number errFlag = false; - VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", SuppHeatingCoilName, errFlag); if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating coil hot water max volume flow rate errFlag = false; - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", SuppHeatingCoilName, errFlag); if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating Coil air inlet node errFlag = false; SuppHeatCoilAirInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", SuppHeatingCoilName, errFlag); - VRFTU(VRFTUNum).SuppHeatCoilAirInletNode = SuppHeatCoilAirInletNode; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirInletNode = SuppHeatCoilAirInletNode; if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating coil air outlet node errFlag = false; SuppHeatCoilAirOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", SuppHeatingCoilName, errFlag); - VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode = SuppHeatCoilAirOutletNode; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode = SuppHeatCoilAirOutletNode; if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } } - } else if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { ValidateComponent(state, SuppHeatingCoilType, SuppHeatingCoilName, IsNotOK, cCurrentModuleObject); if (IsNotOK) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } else { // mine data from supplemental heating coil object errFlag = false; - VRFTU(VRFTUNum).SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", SuppHeatingCoilName, errFlag); - if (VRFTU(VRFTUNum).SuppHeatCoilIndex == 0) { - ShowSevereError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", SuppHeatingCoilName, errFlag); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex == 0) { + ShowSevereError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating Coil steam inlet node number errFlag = false; - VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", SuppHeatingCoilName, errFlag); if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating coil steam max volume flow rate - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, VRFTU(VRFTUNum).SuppHeatCoilIndex, errFlag); - if (VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = + SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, errFlag); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { int SteamIndex = 0; // fluid type index of 0 is passed if steam Real64 TempSteamIn = 100.0; Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = - SteamCoils::GetCoilMaxSteamFlowRate(state, VRFTU(VRFTUNum).SuppHeatCoilIndex, errFlag) * SteamDensity; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = + SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, errFlag) * SteamDensity; } // Get the supplemental heating coil air inlet node errFlag = false; SuppHeatCoilAirInletNode = - SteamCoils::GetCoilAirInletNode(state, VRFTU(VRFTUNum).SuppHeatCoilIndex, SuppHeatingCoilName, errFlag); - VRFTU(VRFTUNum).SuppHeatCoilAirInletNode = SuppHeatCoilAirInletNode; + SteamCoils::GetCoilAirInletNode(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, SuppHeatingCoilName, errFlag); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirInletNode = SuppHeatCoilAirInletNode; if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } // Get the supplemental heating coil air outlet node errFlag = false; SuppHeatCoilAirOutletNode = - SteamCoils::GetCoilAirOutletNode(state, VRFTU(VRFTUNum).SuppHeatCoilIndex, SuppHeatingCoilName, errFlag); - VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode = SuppHeatCoilAirOutletNode; + SteamCoils::GetCoilAirOutletNode(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, SuppHeatingCoilName, errFlag); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode = SuppHeatCoilAirOutletNode; if (errFlag) { - ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ErrorsFound = true; } } } } else { // if (!lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) { if (!lAlphaFieldBlanks(17) && lAlphaFieldBlanks(18)) { - ShowWarningError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name + "\""); + ShowWarningError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "...Supplemental heating coil type = " + cAlphaArgs(17)); ShowContinueError(state, "...But missing the associated supplemental heating coil name. "); ShowContinueError(state, "...The supplemental heating coil will not be simulated. "); } if (lAlphaFieldBlanks(17) && !lAlphaFieldBlanks(18)) { - ShowWarningError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name + "\""); + ShowWarningError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "...Supplemental heating coil name = " + cAlphaArgs(18)); ShowContinueError(state, "...But missing the associated supplemental heating coil type. "); ShowContinueError(state, "...The supplemental heating coil will not be simulated. "); @@ -4444,8 +4335,8 @@ namespace HVACVariableRefrigerantFlow { } if (!lAlphaFieldBlanks(19)) { - VRFTU(VRFTUNum).ZoneNum = UtilityRoutines::FindItemInList(cAlphaArgs(19), Zone); - if (VRFTU(VRFTUNum).ZoneNum == 0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum = UtilityRoutines::FindItemInList(cAlphaArgs(19), Zone); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum == 0) { ShowSevereError(state, cCurrentModuleObject + " = " + cAlphaArgs(1)); ShowContinueError(state, "Illegal " + cAlphaFieldNames(19) + " = " + cAlphaArgs(19)); ErrorsFound = true; @@ -4453,25 +4344,25 @@ namespace HVACVariableRefrigerantFlow { } // set supplemental heating coil operation temperature limits - if (VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { // Set maximum supply air temperature for supplemental heating coil - VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil = rNumericArgs(11); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil = rNumericArgs(11); // set maximum outdoor dry-bulb temperature for supplemental heating coil operation - VRFTU(VRFTUNum).MaxOATSuppHeatingCoil = rNumericArgs(12); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxOATSuppHeatingCoil = rNumericArgs(12); } // Add cooling coil to component sets array - if (VRFTU(VRFTUNum).CoolingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { SetUpCompSets(state, cCurrentModuleObject, - VRFTU(VRFTUNum).Name, - DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXCoolCoilType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXCoolCoilType_Num), cAlphaArgs(12), DataLoopNode::NodeID(CCoilInletNodeNum), DataLoopNode::NodeID(CCoilOutletNodeNum)); // set heating coil present flag SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).CoolCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, ErrorsFound, _, _, @@ -4489,22 +4380,22 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRFTU(VRFTUNum).HeatingCoilPresent); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent); // check that curve types are present in VRF Condenser if cooling coil is present in terminal unit (can be blank) // all curves are checked for correct type if a curve name is entered in the VRF condenser object. Check that the // curve is present if the corresponding coil is entered in the terminal unit. - if (VRFTU(VRFTUNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0) { - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum != AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum != iAlgorithmType::FluidTCtrl) { - if (VRF(VRFTU(VRFTUNum).VRFSysNum).CoolingCapacity <= 0 && VRF(VRFTU(VRFTUNum).VRFSysNum).CoolingCapacity != AutoSize) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CoolingCapacity <= 0 && state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).CoolingCapacity != AutoSize) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "...This terminal unit contains a cooling coil and rated cooling capacity is also required in the " "associated condenser object."); ShowContinueError(state, "...Rated Cooling Capacity must also be specified for condenser = " + - cVRFTypes(VRF(VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum) + " \"" + - VRF(VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum)) + " \"" + + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); ErrorsFound = true; } } @@ -4512,17 +4403,17 @@ namespace HVACVariableRefrigerantFlow { } // Add heating coil to component sets array - if (VRFTU(VRFTUNum).HeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { SetUpCompSets(state, cCurrentModuleObject, - VRFTU(VRFTUNum).Name, - DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).DXHeatCoilType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DXHeatCoilType_Num), cAlphaArgs(14), DataLoopNode::NodeID(HCoilInletNodeNum), DataLoopNode::NodeID(HCoilOutletNodeNum)); // set cooling coil present flag SetDXCoolingCoilData(state, - VRFTU(VRFTUNum).HeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, ErrorsFound, _, _, @@ -4539,113 +4430,113 @@ namespace HVACVariableRefrigerantFlow { _, _, _, - VRFTU(VRFTUNum).CoolingCoilPresent); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent); - if (VRFTU(VRFTUNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum > 0) { - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum != AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum != iAlgorithmType::FluidTCtrl) { - if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingCapacity <= 0 && VRF(VRFTU(VRFTUNum).VRFSysNum).HeatingCapacity != AutoSize) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingCapacity <= 0 && state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatingCapacity != AutoSize) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and rated heating capacity is also required in the " "associated condenser object."); ShowContinueError(state, "...Rated Heating Capacity must also be specified for condenser = " + - cVRFTypes(VRF(VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum) + " \"" + - VRF(VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum)) + " \"" + + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); ErrorsFound = true; } - if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatCapFT == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatCapFT == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and heating performance curves are also required in the " "associated condenser object."); ShowContinueError(state, "...Heating Capacity Ratio Modifier Function of Low Temperature Curve must also be specified for condenser = " + - cVRFTypes(VRF(VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum) + " \"" + VRF(VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); ErrorsFound = true; } - if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatEIRFT == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatEIRFT == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and heating performance curves are also required in the " "associated condenser object."); ShowContinueError(state, "...Heating Energy Input Ratio Modifier Function of Low Temperature Curve must also be specified for condenser = " + - cVRFTypes(VRF(VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum) + " \"" + VRF(VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); ErrorsFound = true; } - if (VRF(VRFTU(VRFTUNum).VRFSysNum).HeatEIRFPLR1 == 0) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\""); + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).HeatEIRFPLR1 == 0) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\""); ShowContinueError(state, "...This terminal unit contains a heating coil and heating performance curves are also required in the " "associated condenser object."); ShowContinueError(state, "...Heating Energy Input Ratio Modifier Function of Low Part-Load Ratio Curve must also be specified " "for condenser = " + - cVRFTypes(VRF(VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum) + " \"" + - VRF(VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFSystemTypeNum)) + " \"" + + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).Name + "\"."); } } } } // Add supplemental heating coil to component sets array - if (VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { SetUpCompSets(state, cCurrentModuleObject, - VRFTU(VRFTUNum).Name, - DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).SuppHeatCoilType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num), SuppHeatingCoilName, DataLoopNode::NodeID(SuppHeatCoilAirInletNode), DataLoopNode::NodeID(SuppHeatCoilAirOutletNode)); } // Set up component set for OA mixer - use OA node and Mixed air node - if (VRFTU(VRFTUNum).OAMixerUsed) + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) SetUpCompSets(state, cCurrentModuleObject, - VRFTU(VRFTUNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "UNDEFINED", - VRFTU(VRFTUNum).OAMixerName, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, DataLoopNode::NodeID(OANodeNums(1)), DataLoopNode::NodeID(OANodeNums(4))); // Get AirTerminal mixer data GetATMixer(state, - VRFTU(VRFTUNum).Name, - VRFTU(VRFTUNum).ATMixerName, - VRFTU(VRFTUNum).ATMixerIndex, - VRFTU(VRFTUNum).ATMixerType, - VRFTU(VRFTUNum).ATMixerPriNode, - VRFTU(VRFTUNum).ATMixerSecNode, - VRFTU(VRFTUNum).ATMixerOutNode, - VRFTU(VRFTUNum).VRFTUOutletNodeNum); - if (VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide || - VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { - VRFTU(VRFTUNum).ATMixerExists = true; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerName, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerSecNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerOutNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide || + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists = true; } // check that the VRF TU have local outside air and DOA - if (VRFTU(VRFTUNum).ATMixerExists && OANodeNums(4) > 0) { - ShowSevereError(state, cCurrentModuleObject + " = \"" + VRFTU(VRFTUNum).Name + + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && OANodeNums(4) > 0) { + ShowSevereError(state, cCurrentModuleObject + " = \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\". VRF terminal unit has local as well as central outdoor air specified"); ErrorsFound = true; } // for ZoneHVAC check that TU inlet node is a zone exhaust node otherwise ZoneAirNode and ZoneNum = 0 - if (!VRFTU(VRFTUNum).ATMixerExists || VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!ZoneEquipConfig(CtrlZone).IsControlled) continue; for (NodeNum = 1; NodeNum <= ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) { - if (VRFTU(VRFTUNum).VRFTUInletNodeNum == ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { - VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(CtrlZone).ZoneNode; - VRFTU(VRFTUNum).ZoneNum = CtrlZone; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum == ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(CtrlZone).ZoneNode; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum = CtrlZone; break; } } } - } else if (VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide) { for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!ZoneEquipConfig(CtrlZone).IsControlled) continue; for (NodeNum = 1; NodeNum <= ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) { - if (VRFTU(VRFTUNum).VRFTUOutletNodeNum == ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { - VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(CtrlZone).ZoneNode; - VRFTU(VRFTUNum).ZoneNum = CtrlZone; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum == ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(CtrlZone).ZoneNode; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum = CtrlZone; break; } } @@ -4654,24 +4545,24 @@ namespace HVACVariableRefrigerantFlow { } // end Number of VRF Terminal Unit Loop // perform additional error checking - for (NumList = 1; NumList <= NumVRFTULists; ++NumList) { - for (VRFNum = 1; VRFNum <= TerminalUnitList(NumList).NumTUInList; ++VRFNum) { - if (TerminalUnitList(NumList).ZoneTUPtr(VRFNum) == 0) { + for (NumList = 1; NumList <= state.dataHVACVarRefFlow->NumVRFTULists; ++NumList) { + for (VRFNum = 1; VRFNum <= state.dataHVACVarRefFlow->TerminalUnitList(NumList).NumTUInList; ++VRFNum) { + if (state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUPtr(VRFNum) == 0) { // TU name in zone terminal unit list not found - ShowSevereError(state, "ZoneTerminalUnitList \"" + TerminalUnitList(NumList).Name + "\""); - ShowContinueError(state, "...Zone Terminal Unit = " + TerminalUnitList(NumList).ZoneTUName(VRFNum) + " improperly connected to system."); + ShowSevereError(state, "ZoneTerminalUnitList \"" + state.dataHVACVarRefFlow->TerminalUnitList(NumList).Name + "\""); + ShowContinueError(state, "...Zone Terminal Unit = " + state.dataHVACVarRefFlow->TerminalUnitList(NumList).ZoneTUName(VRFNum) + " improperly connected to system."); ShowContinueError(state, "...either the ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object does not exist,"); ShowContinueError(state, "...the ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object name is misspelled,"); ShowContinueError(state, "...or the ZoneTerminalUnitList object is not named in an AirConditioner:VariableRefrigerantFlow object."); ErrorsFound = true; } - if (VRFTU(VRFNum).VRFSysNum > 0) { - if (TerminalUnitList(NumList).NumTUInList == 1 && VRF(VRFTU(VRFNum).VRFSysNum).VRFAlgorithmTypeNum == AlgorithmTypeSysCurve) { - if (VRF(VRFTU(VRFNum).VRFSysNum).HeatRecoveryUsed) { - ShowWarningError(state, "ZoneTerminalUnitList \"" + TerminalUnitList(NumList).Name + "\""); + if (state.dataHVACVarRefFlow->VRFTU(VRFNum).VRFSysNum > 0) { + if (state.dataHVACVarRefFlow->TerminalUnitList(NumList).NumTUInList == 1 && state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFNum).VRFSysNum).VRFAlgorithmTypeNum == iAlgorithmType::SysCurve) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFNum).VRFSysNum).HeatRecoveryUsed) { + ShowWarningError(state, "ZoneTerminalUnitList \"" + state.dataHVACVarRefFlow->TerminalUnitList(NumList).Name + "\""); ShowWarningError(state, "...Only 1 Terminal Unit connected to system and heat recovery is selected."); ShowContinueError(state, "...Heat recovery will be disabled."); - VRF(VRFNum).HeatRecoveryUsed = false; + state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed = false; } } } @@ -4679,45 +4570,45 @@ namespace HVACVariableRefrigerantFlow { } // warn when number of ZoneTerminalUnitList different from number of AirConditioner:VariableRefrigerantFlow - if (NumVRFTULists != NumVRFCond) { + if (state.dataHVACVarRefFlow->NumVRFTULists != state.dataHVACVarRefFlow->NumVRFCond) { ShowSevereError(state, format("The number of AirConditioner:VariableRefrigerantFlow objects ({}) does not match the number of " "ZoneTerminalUnitList objects ({}).", - NumVRFCond, - NumVRFTULists)); - for (NumCond = 1; NumCond <= NumVRFCond; ++NumCond) { - if (VRF(NumCond).ZoneTUListPtr > 0) { - ShowContinueError(state, "...AirConditioner:VariableRefrigerantFlow = " + VRF(NumCond).Name + - " specifies Zone Terminal Unit List Name = " + TerminalUnitList(VRF(NumCond).ZoneTUListPtr).Name); + state.dataHVACVarRefFlow->NumVRFCond, + state.dataHVACVarRefFlow->NumVRFTULists)); + for (NumCond = 1; NumCond <= state.dataHVACVarRefFlow->NumVRFCond; ++NumCond) { + if (state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr > 0) { + ShowContinueError(state, "...AirConditioner:VariableRefrigerantFlow = " + state.dataHVACVarRefFlow->VRF(NumCond).Name + + " specifies Zone Terminal Unit List Name = " + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRF(NumCond).ZoneTUListPtr).Name); } else { - ShowContinueError(state, "...AirConditioner:VariableRefrigerantFlow = " + VRF(NumCond).Name + + ShowContinueError(state, "...AirConditioner:VariableRefrigerantFlow = " + state.dataHVACVarRefFlow->VRF(NumCond).Name + " Zone Terminal Unit List Name not found."); } } ShowContinueError(state, "...listing ZoneTerminalUnitList objects."); - for (NumList = 1; NumList <= NumVRFTULists; ++NumList) { - ShowContinueError(state, "...ZoneTerminalUnitList = " + TerminalUnitList(NumList).Name); + for (NumList = 1; NumList <= state.dataHVACVarRefFlow->NumVRFTULists; ++NumList) { + ShowContinueError(state, "...ZoneTerminalUnitList = " + state.dataHVACVarRefFlow->TerminalUnitList(NumList).Name); } ErrorsFound = true; } // Set up output variables - for (VRFNum = 1; VRFNum <= NumVRFTU; ++VRFNum) { - if (VRFTU(VRFNum).CoolingCoilPresent) { + for (VRFNum = 1; VRFNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFNum) { + if (state.dataHVACVarRefFlow->VRFTU(VRFNum).CoolingCoilPresent) { SetupOutputVariable(state, "Zone VRF Air Terminal Cooling Electricity Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).ParasiticCoolElecPower, + state.dataHVACVarRefFlow->VRFTU(VRFNum).ParasiticCoolElecPower, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Cooling Electricity Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).ParasiticElecCoolConsumption, + state.dataHVACVarRefFlow->VRFTU(VRFNum).ParasiticElecCoolConsumption, "System", "Sum", - VRFTU(VRFNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name, _, "Electricity", "COOLING", @@ -4726,61 +4617,61 @@ namespace HVACVariableRefrigerantFlow { SetupOutputVariable(state, "Zone VRF Air Terminal Total Cooling Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).TotalCoolingRate, + state.dataHVACVarRefFlow->VRFTU(VRFNum).TotalCoolingRate, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Cooling Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).SensibleCoolingRate, + state.dataHVACVarRefFlow->VRFTU(VRFNum).SensibleCoolingRate, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Cooling Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).LatentCoolingRate, + state.dataHVACVarRefFlow->VRFTU(VRFNum).LatentCoolingRate, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Total Cooling Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).TotalCoolingEnergy, + state.dataHVACVarRefFlow->VRFTU(VRFNum).TotalCoolingEnergy, "System", "Sum", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Cooling Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).SensibleCoolingEnergy, + state.dataHVACVarRefFlow->VRFTU(VRFNum).SensibleCoolingEnergy, "System", "Sum", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Cooling Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).LatentCoolingEnergy, + state.dataHVACVarRefFlow->VRFTU(VRFNum).LatentCoolingEnergy, "System", "Sum", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); } - if (VRFTU(VRFNum).HeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFNum).HeatingCoilPresent) { SetupOutputVariable(state, "Zone VRF Air Terminal Heating Electricity Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).ParasiticHeatElecPower, + state.dataHVACVarRefFlow->VRFTU(VRFNum).ParasiticHeatElecPower, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Heating Electricity Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).ParasiticElecHeatConsumption, + state.dataHVACVarRefFlow->VRFTU(VRFNum).ParasiticElecHeatConsumption, "System", "Sum", - VRFTU(VRFNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name, _, "Electricity", "HEATING", @@ -4789,113 +4680,113 @@ namespace HVACVariableRefrigerantFlow { SetupOutputVariable(state, "Zone VRF Air Terminal Total Heating Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).TotalHeatingRate, + state.dataHVACVarRefFlow->VRFTU(VRFNum).TotalHeatingRate, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Heating Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).SensibleHeatingRate, + state.dataHVACVarRefFlow->VRFTU(VRFNum).SensibleHeatingRate, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Heating Rate", OutputProcessor::Unit::W, - VRFTU(VRFNum).LatentHeatingRate, + state.dataHVACVarRefFlow->VRFTU(VRFNum).LatentHeatingRate, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Total Heating Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).TotalHeatingEnergy, + state.dataHVACVarRefFlow->VRFTU(VRFNum).TotalHeatingEnergy, "System", "Sum", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Sensible Heating Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).SensibleHeatingEnergy, + state.dataHVACVarRefFlow->VRFTU(VRFNum).SensibleHeatingEnergy, "System", "Sum", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); SetupOutputVariable(state, "Zone VRF Air Terminal Latent Heating Energy", OutputProcessor::Unit::J, - VRFTU(VRFNum).LatentHeatingEnergy, + state.dataHVACVarRefFlow->VRFTU(VRFNum).LatentHeatingEnergy, "System", "Sum", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); } SetupOutputVariable(state, "Zone VRF Air Terminal Fan Availability Status", OutputProcessor::Unit::None, - VRFTU(VRFNum).AvailStatus, + state.dataHVACVarRefFlow->VRFTU(VRFNum).AvailStatus, "System", "Average", - VRFTU(VRFNum).Name); + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name); if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "Variable Refrigerant Flow Terminal Unit", - VRFTU(VRFNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFNum).Name, "Part Load Ratio", "[fraction]", - VRFTU(VRFNum).EMSOverridePartLoadFrac, - VRFTU(VRFNum).EMSValueForPartLoadFrac); + state.dataHVACVarRefFlow->VRFTU(VRFNum).EMSOverridePartLoadFrac, + state.dataHVACVarRefFlow->VRFTU(VRFNum).EMSValueForPartLoadFrac); } } - for (NumCond = 1; NumCond <= NumVRFCond; ++NumCond) { + for (NumCond = 1; NumCond <= state.dataHVACVarRefFlow->NumVRFCond; ++NumCond) { SetupOutputVariable(state, "VRF Heat Pump Total Cooling Rate", OutputProcessor::Unit::W, - VRF(NumCond).TotalCoolingCapacity, + state.dataHVACVarRefFlow->VRF(NumCond).TotalCoolingCapacity, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Total Heating Rate", OutputProcessor::Unit::W, - VRF(NumCond).TotalHeatingCapacity, + state.dataHVACVarRefFlow->VRF(NumCond).TotalHeatingCapacity, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, - "VRF Heat Pump Cooling " + VRF(NumCond).FuelType + " Rate", + "VRF Heat Pump Cooling " + state.dataHVACVarRefFlow->VRF(NumCond).FuelType + " Rate", OutputProcessor::Unit::W, - VRF(NumCond).ElecCoolingPower, + state.dataHVACVarRefFlow->VRF(NumCond).ElecCoolingPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, - "VRF Heat Pump Cooling " + VRF(NumCond).FuelType + " Energy", + "VRF Heat Pump Cooling " + state.dataHVACVarRefFlow->VRF(NumCond).FuelType + " Energy", OutputProcessor::Unit::J, - VRF(NumCond).CoolElecConsumption, + state.dataHVACVarRefFlow->VRF(NumCond).CoolElecConsumption, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, - VRF(NumCond).FuelType, + state.dataHVACVarRefFlow->VRF(NumCond).FuelType, "COOLING", _, "System"); SetupOutputVariable(state, - "VRF Heat Pump Heating " + VRF(NumCond).FuelType + " Rate", + "VRF Heat Pump Heating " + state.dataHVACVarRefFlow->VRF(NumCond).FuelType + " Rate", OutputProcessor::Unit::W, - VRF(NumCond).ElecHeatingPower, + state.dataHVACVarRefFlow->VRF(NumCond).ElecHeatingPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, - "VRF Heat Pump Heating " + VRF(NumCond).FuelType + " Energy", + "VRF Heat Pump Heating " + state.dataHVACVarRefFlow->VRF(NumCond).FuelType + " Energy", OutputProcessor::Unit::J, - VRF(NumCond).HeatElecConsumption, + state.dataHVACVarRefFlow->VRF(NumCond).HeatElecConsumption, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, - VRF(NumCond).FuelType, + state.dataHVACVarRefFlow->VRF(NumCond).FuelType, "HEATING", _, "System"); @@ -4903,148 +4794,148 @@ namespace HVACVariableRefrigerantFlow { SetupOutputVariable(state, "VRF Heat Pump Cooling COP", OutputProcessor::Unit::None, - VRF(NumCond).OperatingCoolingCOP, + state.dataHVACVarRefFlow->VRF(NumCond).OperatingCoolingCOP, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Heating COP", OutputProcessor::Unit::None, - VRF(NumCond).OperatingHeatingCOP, + state.dataHVACVarRefFlow->VRF(NumCond).OperatingHeatingCOP, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable( - state, "VRF Heat Pump COP", OutputProcessor::Unit::None, VRF(NumCond).OperatingCOP, "System", "Average", VRF(NumCond).Name); + state, "VRF Heat Pump COP", OutputProcessor::Unit::None, state.dataHVACVarRefFlow->VRF(NumCond).OperatingCOP, "System", "Average", state.dataHVACVarRefFlow->VRF(NumCond).Name); - if (VRF(NumCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(NumCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // For VRF_FluidTCtrl Model SetupOutputVariable(state, "VRF Heat Pump Compressor Electricity Rate", OutputProcessor::Unit::W, - VRF(NumCond).Ncomp, + state.dataHVACVarRefFlow->VRF(NumCond).Ncomp, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Outdoor Unit Fan Power", OutputProcessor::Unit::W, - VRF(NumCond).OUFanPower, + state.dataHVACVarRefFlow->VRF(NumCond).OUFanPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Compressor Rotating Speed", OutputProcessor::Unit::rev_min, - VRF(NumCond).CompActSpeed, + state.dataHVACVarRefFlow->VRF(NumCond).CompActSpeed, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Indoor Unit Evaporating Temperature", OutputProcessor::Unit::C, - VRF(NumCond).IUEvaporatingTemp, + state.dataHVACVarRefFlow->VRF(NumCond).IUEvaporatingTemp, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Outdoor Unit Condensing Temperature", OutputProcessor::Unit::C, - VRF(NumCond).CondensingTemp, + state.dataHVACVarRefFlow->VRF(NumCond).CondensingTemp, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Indoor Unit Condensing Temperature", OutputProcessor::Unit::C, - VRF(NumCond).IUCondensingTemp, + state.dataHVACVarRefFlow->VRF(NumCond).IUCondensingTemp, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Outdoor Unit Evaporating Temperature", OutputProcessor::Unit::C, - VRF(NumCond).EvaporatingTemp, + state.dataHVACVarRefFlow->VRF(NumCond).EvaporatingTemp, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Cooling Capacity at Max Compressor Speed", OutputProcessor::Unit::W, - VRF(NumCond).CoolingCapacity, + state.dataHVACVarRefFlow->VRF(NumCond).CoolingCapacity, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Heating Capacity at Max Compressor Speed", OutputProcessor::Unit::W, - VRF(NumCond).HeatingCapacity, + state.dataHVACVarRefFlow->VRF(NumCond).HeatingCapacity, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Indoor Unit Piping Correction for Cooling", OutputProcessor::Unit::None, - VRF(NumCond).PipingCorrectionCooling, + state.dataHVACVarRefFlow->VRF(NumCond).PipingCorrectionCooling, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Indoor Unit Piping Correction for Heating", OutputProcessor::Unit::None, - VRF(NumCond).PipingCorrectionHeating, + state.dataHVACVarRefFlow->VRF(NumCond).PipingCorrectionHeating, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Outdoor Unit Evaporator Heat Extract Rate", OutputProcessor::Unit::W, - VRF(NumCond).OUEvapHeatRate, + state.dataHVACVarRefFlow->VRF(NumCond).OUEvapHeatRate, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Outdoor Unit Condenser Heat Release Rate", OutputProcessor::Unit::W, - VRF(NumCond).OUCondHeatRate, + state.dataHVACVarRefFlow->VRF(NumCond).OUCondHeatRate, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); } else { // For VRF_SysCurve Model SetupOutputVariable(state, "VRF Heat Pump Maximum Capacity Cooling Rate", OutputProcessor::Unit::W, - MaxCoolingCapacity(NumCond), + state.dataHVACVarRefFlow->MaxCoolingCapacity(NumCond), "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Maximum Capacity Heating Rate", OutputProcessor::Unit::W, - MaxHeatingCapacity(NumCond), + state.dataHVACVarRefFlow->MaxHeatingCapacity(NumCond), "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); } - if (VRF(NumCond).DefrostStrategy == Resistive || - (VRF(NumCond).DefrostStrategy == ReverseCycle && VRF(NumCond).FuelTypeNum == DataGlobalConstants::ResourceType::Electricity)) { + if (state.dataHVACVarRefFlow->VRF(NumCond).DefrostStrategy == Resistive || + (state.dataHVACVarRefFlow->VRF(NumCond).DefrostStrategy == ReverseCycle && state.dataHVACVarRefFlow->VRF(NumCond).FuelTypeNum == DataGlobalConstants::ResourceType::Electricity)) { SetupOutputVariable(state, "VRF Heat Pump Defrost Electricity Rate", OutputProcessor::Unit::W, - VRF(NumCond).DefrostPower, + state.dataHVACVarRefFlow->VRF(NumCond).DefrostPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Defrost Electricity Energy", OutputProcessor::Unit::J, - VRF(NumCond).DefrostConsumption, + state.dataHVACVarRefFlow->VRF(NumCond).DefrostConsumption, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, "Electricity", "HEATING", @@ -5052,72 +4943,72 @@ namespace HVACVariableRefrigerantFlow { "System"); } else { // defrost energy applied to fuel type SetupOutputVariable(state, - "VRF Heat Pump Defrost " + VRF(NumCond).FuelType + " Rate", + "VRF Heat Pump Defrost " + state.dataHVACVarRefFlow->VRF(NumCond).FuelType + " Rate", OutputProcessor::Unit::W, - VRF(NumCond).DefrostPower, + state.dataHVACVarRefFlow->VRF(NumCond).DefrostPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, - "VRF Heat Pump Defrost " + VRF(NumCond).FuelType + " Energy", + "VRF Heat Pump Defrost " + state.dataHVACVarRefFlow->VRF(NumCond).FuelType + " Energy", OutputProcessor::Unit::J, - VRF(NumCond).DefrostConsumption, + state.dataHVACVarRefFlow->VRF(NumCond).DefrostConsumption, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, - VRF(NumCond).FuelType, + state.dataHVACVarRefFlow->VRF(NumCond).FuelType, "HEATING", _, "System"); } SetupOutputVariable( - state, "VRF Heat Pump Part Load Ratio", OutputProcessor::Unit::None, VRF(NumCond).VRFCondPLR, "System", "Average", VRF(NumCond).Name); + state, "VRF Heat Pump Part Load Ratio", OutputProcessor::Unit::None, state.dataHVACVarRefFlow->VRF(NumCond).VRFCondPLR, "System", "Average", state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Runtime Fraction", OutputProcessor::Unit::None, - VRF(NumCond).VRFCondRTF, + state.dataHVACVarRefFlow->VRF(NumCond).VRFCondRTF, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Cycling Ratio", OutputProcessor::Unit::None, - VRF(NumCond).VRFCondCyclingRatio, + state.dataHVACVarRefFlow->VRF(NumCond).VRFCondCyclingRatio, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Operating Mode", OutputProcessor::Unit::None, - VRF(NumCond).OperatingMode, + state.dataHVACVarRefFlow->VRF(NumCond).OperatingMode, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Condenser Inlet Temperature", OutputProcessor::Unit::C, - VRF(NumCond).CondenserInletTemp, + state.dataHVACVarRefFlow->VRF(NumCond).CondenserInletTemp, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Crankcase Heater Electricity Rate", OutputProcessor::Unit::W, - VRF(NumCond).CrankCaseHeaterPower, + state.dataHVACVarRefFlow->VRF(NumCond).CrankCaseHeaterPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Crankcase Heater Electricity Energy", OutputProcessor::Unit::J, - VRF(NumCond).CrankCaseHeaterElecConsumption, + state.dataHVACVarRefFlow->VRF(NumCond).CrankCaseHeaterElecConsumption, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, "Electricity", "COOLING", @@ -5126,46 +5017,46 @@ namespace HVACVariableRefrigerantFlow { SetupOutputVariable(state, "VRF Heat Pump Terminal Unit Cooling Load Rate", OutputProcessor::Unit::W, - VRF(NumCond).TUCoolingLoad, + state.dataHVACVarRefFlow->VRF(NumCond).TUCoolingLoad, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Terminal Unit Heating Load Rate", OutputProcessor::Unit::W, - VRF(NumCond).TUHeatingLoad, + state.dataHVACVarRefFlow->VRF(NumCond).TUHeatingLoad, "System", "Average", - VRF(NumCond).Name); - if (VRF(NumCond).HeatRecoveryUsed) { + state.dataHVACVarRefFlow->VRF(NumCond).Name); + if (state.dataHVACVarRefFlow->VRF(NumCond).HeatRecoveryUsed) { SetupOutputVariable(state, "VRF Heat Pump Heat Recovery Status Change Multiplier", OutputProcessor::Unit::None, - VRF(NumCond).SUMultiplier, + state.dataHVACVarRefFlow->VRF(NumCond).SUMultiplier, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Simultaneous Cooling and Heating Efficiency", OutputProcessor::Unit::Btu_h_W, - VRF(NumCond).SCHE, + state.dataHVACVarRefFlow->VRF(NumCond).SCHE, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Heat Recovery Rate", OutputProcessor::Unit::W, - VRF(NumCond).VRFHeatRec, + state.dataHVACVarRefFlow->VRF(NumCond).VRFHeatRec, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Heat Recovery Energy", OutputProcessor::Unit::J, - VRF(NumCond).VRFHeatEnergyRec, + state.dataHVACVarRefFlow->VRF(NumCond).VRFHeatEnergyRec, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, "ENERGYTRANSFER", "HEATRECOVERY", @@ -5173,14 +5064,14 @@ namespace HVACVariableRefrigerantFlow { "Plant"); } - if (VRF(NumCond).CondenserType == DataHVACGlobals::EvapCooled) { + if (state.dataHVACVarRefFlow->VRF(NumCond).CondenserType == DataHVACGlobals::EvapCooled) { SetupOutputVariable(state, "VRF Heat Pump Evaporative Condenser Water Use Volume", OutputProcessor::Unit::m3, - VRF(NumCond).EvapWaterConsumpRate, + state.dataHVACVarRefFlow->VRF(NumCond).EvapWaterConsumpRate, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, "Water", "Cooling", @@ -5189,38 +5080,38 @@ namespace HVACVariableRefrigerantFlow { SetupOutputVariable(state, "VRF Heat Pump Evaporative Condenser Pump Electricity Rate", OutputProcessor::Unit::W, - VRF(NumCond).EvapCondPumpElecPower, + state.dataHVACVarRefFlow->VRF(NumCond).EvapCondPumpElecPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Evaporative Condenser Pump Electricity Energy", OutputProcessor::Unit::J, - VRF(NumCond).EvapCondPumpElecConsumption, + state.dataHVACVarRefFlow->VRF(NumCond).EvapCondPumpElecConsumption, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, "Electricity", "COOLING", _, "System"); - if (VRF(NumCond).BasinHeaterPowerFTempDiff > 0.0) { + if (state.dataHVACVarRefFlow->VRF(NumCond).BasinHeaterPowerFTempDiff > 0.0) { SetupOutputVariable(state, "VRF Heat Pump Basin Heater Electricity Rate", OutputProcessor::Unit::W, - VRF(NumCond).BasinHeaterPower, + state.dataHVACVarRefFlow->VRF(NumCond).BasinHeaterPower, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Basin Heater Electricity Energy", OutputProcessor::Unit::J, - VRF(NumCond).BasinHeaterConsumption, + state.dataHVACVarRefFlow->VRF(NumCond).BasinHeaterConsumption, "System", "Sum", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, _, "Electricity", "COOLING", @@ -5228,44 +5119,44 @@ namespace HVACVariableRefrigerantFlow { "System"); } - } else if (VRF(NumCond).CondenserType == DataHVACGlobals::WaterCooled) { + } else if (state.dataHVACVarRefFlow->VRF(NumCond).CondenserType == DataHVACGlobals::WaterCooled) { SetupOutputVariable(state, "VRF Heat Pump Condenser Outlet Temperature", OutputProcessor::Unit::C, - VRF(NumCond).CondenserSideOutletTemp, + state.dataHVACVarRefFlow->VRF(NumCond).CondenserSideOutletTemp, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Condenser Mass Flow Rate", OutputProcessor::Unit::kg_s, - VRF(NumCond).WaterCondenserMassFlow, + state.dataHVACVarRefFlow->VRF(NumCond).WaterCondenserMassFlow, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Condenser Heat Transfer Rate", OutputProcessor::Unit::W, - VRF(NumCond).QCondenser, + state.dataHVACVarRefFlow->VRF(NumCond).QCondenser, "System", "Average", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); SetupOutputVariable(state, "VRF Heat Pump Condenser Heat Transfer Energy", OutputProcessor::Unit::J, - VRF(NumCond).QCondEnergy, + state.dataHVACVarRefFlow->VRF(NumCond).QCondEnergy, "System", "Sum", - VRF(NumCond).Name); + state.dataHVACVarRefFlow->VRF(NumCond).Name); } if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "Variable Refrigerant Flow Heat Pump", - VRF(NumCond).Name, + state.dataHVACVarRefFlow->VRF(NumCond).Name, "Operating Mode", "[integer]", - VRF(NumCond).EMSOverrideHPOperatingMode, - VRF(NumCond).EMSValueForHPOperatingMode); + state.dataHVACVarRefFlow->VRF(NumCond).EMSOverrideHPOperatingMode, + state.dataHVACVarRefFlow->VRF(NumCond).EMSValueForHPOperatingMode); } } } @@ -5329,50 +5220,50 @@ namespace HVACVariableRefrigerantFlow { Real64 SuppHeatCoilCapacity; // supplemental heating coil size (W) // ALLOCATE and Initialize subroutine variables - if (MyOneTimeFlag) { - - MyEnvrnFlag.allocate(NumVRFTU); - MySizeFlag.allocate(NumVRFTU); - MyVRFFlag.allocate(NumVRFTU); - MyZoneEqFlag.allocate(NumVRFTU); - MyBeginTimeStepFlag.allocate(NumVRFCond); - MaxDeltaT.allocate(NumVRFCond); - MinDeltaT.allocate(NumVRFCond); - LastModeCooling.allocate(NumVRFCond); - LastModeHeating.allocate(NumVRFCond); - HeatingLoad.allocate(NumVRFCond); - CoolingLoad.allocate(NumVRFCond); - NumCoolingLoads.allocate(NumVRFCond); - SumCoolingLoads.allocate(NumVRFCond); - NumHeatingLoads.allocate(NumVRFCond); - SumHeatingLoads.allocate(NumVRFCond); - MyVRFCondFlag.allocate(NumVRFCond); - MyEnvrnFlag = true; - MySizeFlag = true; - MyVRFFlag = true; - MyZoneEqFlag = true; - MyBeginTimeStepFlag = true; - MaxDeltaT = 0.0; - MinDeltaT = 0.0; - LastModeCooling = false; - LastModeHeating = true; - NumCoolingLoads = 0; - SumCoolingLoads = 0.0; - NumHeatingLoads = 0; - SumHeatingLoads = 0.0; - - MyOneTimeFlag = false; - MyVRFCondFlag = true; + if (state.dataHVACVarRefFlow->MyOneTimeFlag) { + + state.dataHVACVarRefFlow->MyEnvrnFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU); + state.dataHVACVarRefFlow->MySizeFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU); + state.dataHVACVarRefFlow->MyVRFFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU); + state.dataHVACVarRefFlow->MyZoneEqFlag.allocate(state.dataHVACVarRefFlow->NumVRFTU); + state.dataHVACVarRefFlow->MyBeginTimeStepFlag.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->MaxDeltaT.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->MinDeltaT.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->LastModeCooling.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->LastModeHeating.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->HeatingLoad.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->CoolingLoad.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->NumCoolingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->SumCoolingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->NumHeatingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->SumHeatingLoads.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->MyVRFCondFlag.allocate(state.dataHVACVarRefFlow->NumVRFCond); + state.dataHVACVarRefFlow->MyEnvrnFlag = true; + state.dataHVACVarRefFlow->MySizeFlag = true; + state.dataHVACVarRefFlow->MyVRFFlag = true; + state.dataHVACVarRefFlow->MyZoneEqFlag = true; + state.dataHVACVarRefFlow->MyBeginTimeStepFlag = true; + state.dataHVACVarRefFlow->MaxDeltaT = 0.0; + state.dataHVACVarRefFlow->MinDeltaT = 0.0; + state.dataHVACVarRefFlow->LastModeCooling = false; + state.dataHVACVarRefFlow->LastModeHeating = true; + state.dataHVACVarRefFlow->NumCoolingLoads = 0; + state.dataHVACVarRefFlow->SumCoolingLoads = 0.0; + state.dataHVACVarRefFlow->NumHeatingLoads = 0; + state.dataHVACVarRefFlow->SumHeatingLoads = 0.0; + + state.dataHVACVarRefFlow->MyOneTimeFlag = false; + state.dataHVACVarRefFlow->MyVRFCondFlag = true; } // IF (MyOneTimeFlag) THEN // identify VRF condenser connected to this TU - VRFCond = VRFTU(VRFTUNum).VRFSysNum; - TUListIndex = VRF(VRFCond).ZoneTUListPtr; - InNode = VRFTU(VRFTUNum).VRFTUInletNodeNum; - OutNode = VRFTU(VRFTUNum).VRFTUOutletNodeNum; - OutsideAirNode = VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; - IndexToTUInTUList = VRFTU(VRFTUNum).IndexToTUInTUList; + VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; + InNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum; + OutNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum; + OutsideAirNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; + IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; SuppHeatCoilCapacity = 0.0; SuppHeatCoilLoad = 0.0; @@ -5382,8 +5273,8 @@ namespace HVACVariableRefrigerantFlow { bool SetPointErrorFlag = false; // set condenser inlet temp, used as surrogate for OAT (used to check limits of operation) - if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { - OutsideDryBulbTemp = DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).Temp; + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + OutsideDryBulbTemp = DataLoopNode::Node(state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp; } else { if (OutsideAirNode == 0) { OutsideDryBulbTemp = state.dataEnvrn->OutDryBulbTemp; @@ -5393,26 +5284,26 @@ namespace HVACVariableRefrigerantFlow { } if (allocated(DataHVACGlobals::ZoneComp)) { - if (MyZoneEqFlag(VRFTUNum)) { // initialize the name of each availability manager list and zone number + if (state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum)) { // initialize the name of each availability manager list and zone number DataHVACGlobals::ZoneComp(VRFTerminalUnit_Num).ZoneCompAvailMgrs(VRFTUNum).AvailManagerListName = - VRFTU(VRFTUNum).AvailManagerListName; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailManagerListName; DataHVACGlobals::ZoneComp(VRFTerminalUnit_Num).ZoneCompAvailMgrs(VRFTUNum).ZoneNum = ZoneNum; - MyZoneEqFlag(VRFTUNum) = false; + state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum) = false; } - VRFTU(VRFTUNum).AvailStatus = DataHVACGlobals::ZoneComp(VRFTerminalUnit_Num).ZoneCompAvailMgrs(VRFTUNum).AvailStatus; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailStatus = DataHVACGlobals::ZoneComp(VRFTerminalUnit_Num).ZoneCompAvailMgrs(VRFTUNum).AvailStatus; } - if (VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && allocated(PlantLoop)) { - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && allocated(PlantLoop)) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { // hot water supplemental heating coil errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - VRFTU(VRFTUNum).SuppHeatCoilName, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, TypeOf_CoilWaterSimpleHeating, - VRFTU(VRFTUNum).SuppHeatCoilLoopNum, - VRFTU(VRFTUNum).SuppHeatCoilLoopSide, - VRFTU(VRFTUNum).SuppHeatCoilBranchNum, - VRFTU(VRFTUNum).SuppHeatCoilCompNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum, errFlag, _, _, @@ -5421,44 +5312,44 @@ namespace HVACVariableRefrigerantFlow { _); WaterCoils::SetCoilDesFlow(state, - DataHVACGlobals::cAllCoilTypes(VRFTU(VRFTUNum).SuppHeatCoilType_Num), - VRFTU(VRFTUNum).SuppHeatCoilName, - VRFTU(VRFTUNum).MaxHeatAirVolFlow, + DataHVACGlobals::cAllCoilTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow, errFlag); if (errFlag) { ShowFatalError(state, RoutineName + ": Program terminated for previous conditions."); } - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = + WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); - if (VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { rho = GetDensityGlycol(state, - PlantLoop(VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidName, + PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidName, DataGlobalConstants::HWInitConvTemp, - PlantLoop(VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidIndex, + PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidIndex, RoutineName); - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * rho; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * rho; } // fill fluid outlet node for hot water coil SuppHeatCoilFluidOutletNode - VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode = PlantLoop(VRFTU(VRFTUNum).SuppHeatCoilLoopNum) - .LoopSide(VRFTU(VRFTUNum).SuppHeatCoilLoopSide) - .Branch(VRFTU(VRFTUNum).SuppHeatCoilBranchNum) - .Comp(VRFTU(VRFTUNum).SuppHeatCoilCompNum) + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode = PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum) + .LoopSide(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide) + .Branch(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum) + .Comp(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum) .NodeNumOut; - VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; - } else if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { // steam supplemental heating coil errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, - VRFTU(VRFTUNum).SuppHeatCoilName, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, TypeOf_CoilSteamAirHeating, - VRFTU(VRFTUNum).SuppHeatCoilLoopNum, - VRFTU(VRFTUNum).SuppHeatCoilLoopSide, - VRFTU(VRFTUNum).SuppHeatCoilBranchNum, - VRFTU(VRFTUNum).SuppHeatCoilCompNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum, errFlag, _, _, @@ -5468,70 +5359,70 @@ namespace HVACVariableRefrigerantFlow { if (errFlag) { ShowFatalError(state, RoutineName + ": Program terminated for previous conditions."); } - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); - if (VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { int SteamIndex = 0; // fluid type index of 0 is passed if steam Real64 TempSteamIn = 100.0; Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * SteamDensity; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * SteamDensity; } // fill fluid outlet node for steam coil SuppHeatCoilFluidOutletNode - VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode = PlantLoop(VRFTU(VRFTUNum).SuppHeatCoilLoopNum) - .LoopSide(VRFTU(VRFTUNum).SuppHeatCoilLoopSide) - .Branch(VRFTU(VRFTUNum).SuppHeatCoilBranchNum) - .Comp(VRFTU(VRFTUNum).SuppHeatCoilCompNum) + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode = PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum) + .LoopSide(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide) + .Branch(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum) + .Comp(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum) .NodeNumOut; - VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; } else { // VRF terminal unit not connected to plant - VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; } - } else if (VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && !state.dataGlobal->AnyPlantInModel) { - VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && !state.dataGlobal->AnyPlantInModel) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag = false; } // one-time check to see if VRF TU's are on ZoneHVAC:EquipmentList or AirloopHVAC or issue warning - if (ZoneEquipmentListNotChecked) { - if (state.dataAirLoop->AirLoopInputsFilled) ZoneEquipmentListNotChecked = false; + if (state.dataHVACVarRefFlow->ZoneEquipmentListNotChecked) { + if (state.dataAirLoop->AirLoopInputsFilled) state.dataHVACVarRefFlow->ZoneEquipmentListNotChecked = false; bool AirLoopFound = false; bool errorsFound = false; bool AirNodeFound = false; int ctrlZoneNum = 0; std::string const cCurrentModuleObject = "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow"; - for (TUListNum = 1; TUListNum <= NumVRFTULists; ++TUListNum) { - for (NumTULoop = 1; NumTULoop <= TerminalUnitList(TUListNum).NumTUInList; ++NumTULoop) { + for (TUListNum = 1; TUListNum <= state.dataHVACVarRefFlow->NumVRFTULists; ++TUListNum) { + for (NumTULoop = 1; NumTULoop <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTULoop) { AirLoopFound = false; // reset for next TU ctrlZoneNum = 0; // reset for next TU - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTULoop); - std::string const thisObjectName = VRFTU(TUIndex).Name; - if (VRFTU(TUIndex).isInZone) goto EquipList_exit; // already found previously + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTULoop); + std::string const thisObjectName = state.dataHVACVarRefFlow->VRFTU(TUIndex).Name; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone) goto EquipList_exit; // already found previously for (ELLoop = 1; ELLoop <= state.dataGlobal->NumOfZones; ++ELLoop) { // NumOfZoneEquipLists if (ZoneEquipList(ELLoop).Name == "") continue; // dimensioned by NumOfZones. Only valid ones have names. for (ListLoop = 1; ListLoop <= ZoneEquipList(ELLoop).NumOfEquipTypes; ++ListLoop) { if (!UtilityRoutines::SameString(ZoneEquipList(ELLoop).EquipType(ListLoop), - DataHVACGlobals::cVRFTUTypes(VRFTU(TUIndex).VRFTUType_Num))) + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUType_Num))) continue; - if (!UtilityRoutines::SameString(ZoneEquipList(ELLoop).EquipName(ListLoop), VRFTU(TUIndex).Name)) continue; - VRFTU(TUIndex).ZoneNum = ELLoop; - VRFTU(TUIndex).isInZone = true; - if (VRF(VRFTU(TUIndex).VRFSysNum).MasterZonePtr == ELLoop) { - VRF(VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex; + if (!UtilityRoutines::SameString(ZoneEquipList(ELLoop).EquipName(ListLoop), state.dataHVACVarRefFlow->VRFTU(TUIndex).Name)) continue; + state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum = ELLoop; + state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone = true; + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZonePtr == ELLoop) { + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex; } - if (VRFTU(TUIndex).ZoneAirNode == 0) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode == 0) { bool ZoneNodeNotFound = true; for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!DataZoneEquipment::ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= DataZoneEquipment::ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) { - if (VRFTU(TUIndex).VRFTUInletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { - VRFTU(TUIndex).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { + state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } } for (int NodeNum = 1; NodeNum <= DataZoneEquipment::ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) { - if (VRFTU(TUIndex).VRFTUOutletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { - VRFTU(TUIndex).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { + state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } @@ -5540,20 +5431,20 @@ namespace HVACVariableRefrigerantFlow { } if (ZoneNodeNotFound) { ShowSevereError(state, - "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow \"" + VRFTU(TUIndex).Name + + "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow \"" + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name + "\" Zone terminal unit air inlet node name must be the same as a zone inlet or exhaust node name."); ShowContinueError(state, "... Zone inlet and exhaust node name is specified in ZoneHVAC:EquipmentConnections object."); ShowContinueError(state, "... Zone terminal unit inlet node name = " + - DataLoopNode::NodeID(VRFTU(TUIndex).VRFTUInletNodeNum)); + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum)); ShowContinueError(state, "... Zone terminal unit outlet node name = " + - DataLoopNode::NodeID(VRFTU(TUIndex).VRFTUOutletNodeNum)); + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum)); } } goto EquipList_exit; } } // check if the TU is connected to an air loop - if (!VRFTU(TUIndex).isInAirLoop) { + if (!state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop) { for (int AirLoopNum = 1; AirLoopNum <= DataHVACGlobals::NumPrimaryAirSys; ++AirLoopNum) { for (int BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) { for (int CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; @@ -5563,37 +5454,37 @@ namespace HVACVariableRefrigerantFlow { UtilityRoutines::SameString( state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf, cCurrentModuleObject)) { - VRFTU(TUIndex).airLoopNum = AirLoopNum; + state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum = AirLoopNum; AirLoopFound = true; - VRFTU(TUIndex).isInAirLoop = true; + state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop = true; BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, thisObjectName, - DataLoopNode::NodeID(VRFTU(TUIndex).VRFTUInletNodeNum), - DataLoopNode::NodeID(VRFTU(TUIndex).VRFTUOutletNodeNum), + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum), + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum), "Air Nodes"); - if (VRFTU(TUIndex).ZoneNum > 0) { - VRFTU(TUIndex).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(VRFTU(TUIndex).ZoneNum).ZoneNode; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum > 0) { + state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum).ZoneNode; for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) { - if (DataZoneEquipment::ZoneEquipConfig(ControlledZoneNum).ActualZoneNum != VRFTU(TUIndex).ZoneNum) + if (DataZoneEquipment::ZoneEquipConfig(ControlledZoneNum).ActualZoneNum != state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) continue; for (int TstatZoneNum = 1; TstatZoneNum <= DataZoneControls::NumTempControlledZones; ++TstatZoneNum) { - if (DataZoneControls::TempControlledZone(TstatZoneNum).ActualZoneNum != VRFTU(TUIndex).ZoneNum) + if (DataZoneControls::TempControlledZone(TstatZoneNum).ActualZoneNum != state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) continue; - VRF(VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex; + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex; AirNodeFound = true; ctrlZoneNum = ControlledZoneNum; goto EquipList_exit; } for (int TstatZoneNum = 1; TstatZoneNum <= DataZoneControls::NumComfortControlledZones; ++TstatZoneNum) { - if (DataZoneControls::ComfortControlledZone(TstatZoneNum).ActualZoneNum != VRFTU(TUIndex).ZoneNum) + if (DataZoneControls::ComfortControlledZone(TstatZoneNum).ActualZoneNum != state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) continue; - VRF(VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex; + state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFSysNum).MasterZoneTUIndex = TUIndex; AirNodeFound = true; ctrlZoneNum = ControlledZoneNum; goto EquipList_exit; } - if (!AirNodeFound && VRFTU(TUIndex).ZoneNum > 0) { + if (!AirNodeFound && state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum > 0) { ShowSevereError(state, "Input errors for " + cCurrentModuleObject + ":" + thisObjectName); ShowContinueError(state, "Did not find Air node (Zone with Thermostat or Thermal Comfort Thermostat)."); // ShowContinueError(state, "specified Controlling Zone or Thermostat Location name = " + @@ -5602,7 +5493,7 @@ namespace HVACVariableRefrigerantFlow { } } } else if (AirLoopFound) { // control zone name not entered in TU object input - VRFTU(TUIndex).isSetPointControlled = true; + state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; } } if (AirLoopFound) break; @@ -5614,25 +5505,25 @@ namespace HVACVariableRefrigerantFlow { } // check if the TU is connected to an outside air system - if (!AirLoopFound && !VRFTU(TUIndex).isInOASys) { + if (!AirLoopFound && !state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys) { for (int OASysNum = 1; OASysNum <= state.dataAirLoop->NumOASystems; ++OASysNum) { for (int OACompNum = 1; OACompNum <= state.dataAirLoop->OutsideAirSys(OASysNum).NumComponents; ++OACompNum) { if (!UtilityRoutines::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(OACompNum), - VRFTU(TUIndex).Name) || + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name) || !UtilityRoutines::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ComponentType(OACompNum), cCurrentModuleObject)) continue; - VRFTU(TUIndex).airLoopNum = 0; // need air loop number here? - VRFTU(TUIndex).isInOASys = true; + state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum = 0; // need air loop number here? + state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys = true; AirLoopFound = true; - VRFTU(TUIndex).isSetPointControlled = true; + state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; // user may have inadvertently entered a zone name in the OA system TU object - VRFTU(TUIndex).ZoneNum = 0; - VRFTU(TUIndex).ZoneAirNode = 0; + state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum = 0; + state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode = 0; BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, thisObjectName, - DataLoopNode::NodeID(VRFTU(TUIndex).VRFTUInletNodeNum), - DataLoopNode::NodeID(VRFTU(TUIndex).VRFTUOutletNodeNum), + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum), + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum), "Air Nodes"); goto EquipList_exit; } @@ -5644,7 +5535,7 @@ namespace HVACVariableRefrigerantFlow { int sysType_Num = 0; std::string sysName = ""; for (int inletNode = 1; inletNode <= DataZoneEquipment::ZoneEquipConfig(ctrlZoneNum).NumInletNodes; inletNode++) { - if (DataZoneEquipment::ZoneEquipConfig(ctrlZoneNum).InletNodeAirLoopNum(inletNode) != VRFTU(TUIndex).airLoopNum) continue; + if (DataZoneEquipment::ZoneEquipConfig(ctrlZoneNum).InletNodeAirLoopNum(inletNode) != state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum) continue; inletNodeADUNum = DataZoneEquipment::ZoneEquipConfig(ctrlZoneNum).InletNodeADUNum(inletNode); if (inletNodeADUNum > 0 && inletNodeADUNum <= state.dataDefineEquipment->NumAirDistUnits) { sysType_Num = DataZoneEquipment::AirDistUnit_Num; @@ -5663,10 +5554,10 @@ namespace HVACVariableRefrigerantFlow { DataZoneEquipment::ZoneEquipList(DataZoneEquipment::ZoneEquipConfig(ctrlZoneNum).EquipListIndex) .EquipName(EquipNum) != sysName) continue; - VRFTU(TUIndex).zoneSequenceCoolingNum = + state.dataHVACVarRefFlow->VRFTU(TUIndex).zoneSequenceCoolingNum = DataZoneEquipment::ZoneEquipList(DataZoneEquipment::ZoneEquipConfig(ctrlZoneNum).EquipListIndex) .CoolingPriority(EquipNum); - VRFTU(TUIndex).zoneSequenceHeatingNum = + state.dataHVACVarRefFlow->VRFTU(TUIndex).zoneSequenceHeatingNum = DataZoneEquipment::ZoneEquipList(DataZoneEquipment::ZoneEquipConfig(ctrlZoneNum).EquipListIndex) .HeatingPriority(EquipNum); break; @@ -5680,25 +5571,25 @@ namespace HVACVariableRefrigerantFlow { } // Find the number of zones (zone Inlet nodes) attached to an air loop from the air loop number - if (AirLoopFound || VRFTU(TUIndex).isInAirLoop) { + if (AirLoopFound || state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop) { int NumAirLoopZones = 0; bool initLoadBasedControlFlowFracFlagReady = false; Real64 initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax = 0.0; - if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && VRFTU(TUIndex).airLoopNum > 0) - NumAirLoopZones = state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).NumZonesCooled + - state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).NumZonesHeated; + if (allocated(state.dataAirLoop->AirToZoneNodeInfo) && state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum > 0) + NumAirLoopZones = state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesCooled + + state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesHeated; if (allocated(state.dataAirLoop->AirToZoneNodeInfo)) { initLoadBasedControlFlowFracFlagReady = true; for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) { // zone inlet nodes for cooling - if (state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).NumZonesCooled > 0) { - if (state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex) == + if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesCooled > 0) { + if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex) == -999) { // the data structure for the zones inlet nodes has not been filled initLoadBasedControlFlowFracFlagReady = false; } else { int ZoneInletNodeNum = - state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex); + state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex); if (DataLoopNode::Node(ZoneInletNodeNum).MassFlowRateMax == -999.0) { // the node mass flow rate has not been set initLoadBasedControlFlowFracFlagReady = false; @@ -5706,14 +5597,14 @@ namespace HVACVariableRefrigerantFlow { } } // zone inlet nodes for heating - if (state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).NumZonesHeated > 0) { - if (state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).TermUnitHeatInletNodes(ZoneInSysIndex) == + if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).NumZonesHeated > 0) { + if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).TermUnitHeatInletNodes(ZoneInSysIndex) == -999) { // the data structure for the zones inlet nodes has not been filled initLoadBasedControlFlowFracFlagReady = false; } else { int ZoneInletNodeNum = - state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).TermUnitHeatInletNodes(ZoneInSysIndex); + state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).TermUnitHeatInletNodes(ZoneInSysIndex); if (DataLoopNode::Node(ZoneInletNodeNum).MassFlowRateMax == -999.0) { // the node mass flow rate has not been set initLoadBasedControlFlowFracFlagReady = false; @@ -5726,88 +5617,88 @@ namespace HVACVariableRefrigerantFlow { Real64 SumOfMassFlowRateMax = 0.0; // initialize the sum of the maximum flows for (int ZoneInSysIndex = 1; ZoneInSysIndex <= NumAirLoopZones; ++ZoneInSysIndex) { int ZoneInletNodeNum = - state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex); + state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).TermUnitCoolInletNodes(ZoneInSysIndex); SumOfMassFlowRateMax += DataLoopNode::Node(ZoneInletNodeNum).MassFlowRateMax; - if (state.dataAirLoop->AirToZoneNodeInfo(VRFTU(TUIndex).airLoopNum).CoolCtrlZoneNums(ZoneInSysIndex) == - VRFTU(TUIndex).ZoneNum) { + if (state.dataAirLoop->AirToZoneNodeInfo(state.dataHVACVarRefFlow->VRFTU(TUIndex).airLoopNum).CoolCtrlZoneNums(ZoneInSysIndex) == + state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum) { initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax = DataLoopNode::Node(ZoneInletNodeNum).MassFlowRateMax; } } if (SumOfMassFlowRateMax != 0.0 && state.dataAirLoop->AirLoopInputsFilled) { if (initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax >= DataHVACGlobals::SmallAirVolFlow) { - VRFTU(TUIndex).controlZoneMassFlowFrac = + state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac = initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax / SumOfMassFlowRateMax; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(TUIndex).VRFTUType_Num), - VRFTU(TUIndex).Name, + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name, "Fraction of Supply Air Flow That Goes Through the Controlling Zone", - VRFTU(TUIndex).controlZoneMassFlowFrac); - VRFTU(TUIndex).isSetPointControlled = false; // redundant + state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac); + state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = false; // redundant } else { - if (VRFTU(TUIndex).isInAirLoop && VRFTU(TUIndex).ZoneNum == 0 && VRFTU(TUIndex).ZoneAirNode == 0) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop && state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum == 0 && state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode == 0) { // TU must be set point controlled and use constant fan mode (or coil out T won't change with PLR/air flow) - VRFTU(TUIndex).isSetPointControlled = true; - if (VRFTU(TUIndex).FanOpModeSchedPtr > 0) { - if (ScheduleManager::GetScheduleMinValue(state, VRFTU(TUIndex).FanOpModeSchedPtr) == 0.0) { - ShowSevereError(state, DataHVACGlobals::cVRFTUTypes(VRFTU(TUIndex).VRFTUType_Num) + " = " + - VRFTU(TUIndex).Name); + state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr > 0) { + if (ScheduleManager::GetScheduleMinValue(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr) == 0.0) { + ShowSevereError(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUType_Num) + " = " + + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name); ShowContinueError(state, "When using set point control, fan operating mode must be continuous (fan " "operating mode schedule values > 0)."); ShowContinueError(state, "Error found in Supply Air Fan Operating Mode Schedule Name = " + - ScheduleManager::Schedule(VRFTU(TUIndex).FanOpModeSchedPtr).Name); + ScheduleManager::Schedule(state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr).Name); ShowContinueError(state, "...schedule values must be (>0., <=1.)"); ErrorsFound = true; } } } else { - ShowSevereError(state, DataHVACGlobals::cVRFTUTypes(VRFTU(TUIndex).VRFTUType_Num) + " = " + VRFTU(TUIndex).Name); + ShowSevereError(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUType_Num) + " = " + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name); ShowContinueError(state, " The Fraction of Supply Air Flow That Goes Through the Controlling Zone is set to 1."); - VRFTU(TUIndex).controlZoneMassFlowFrac = 1.0; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(TUIndex).VRFTUType_Num), - VRFTU(TUIndex).Name, + state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac = 1.0; + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name, "Fraction of Supply Air Flow That Goes Through the Controlling Zone", - VRFTU(TUIndex).controlZoneMassFlowFrac); + state.dataHVACVarRefFlow->VRFTU(TUIndex).controlZoneMassFlowFrac); } } - } else if (VRFTU(TUIndex).ZoneNum == 0) { + } else if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum == 0) { // TU must be set point controlled and use constant fan mode (or coil outlet T won't change with PLR/air flow rate) // TU inlet air flow rate is also determined by OA system, not TU - VRFTU(TUIndex).isSetPointControlled = true; + state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; } } } - if (VRFTU(TUIndex).isInZone && state.dataAirLoop->AirLoopInputsFilled) { - if (VRFTU(TUIndex).FanPlace == 0) { - ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = " + VRFTU(TUIndex).Name); + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone && state.dataAirLoop->AirLoopInputsFilled) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanPlace == 0) { + ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = " + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name); ShowContinueError(state, "Illegal Supply Air Fan Placement."); ErrorsFound = true; } - if (VRFTU(TUIndex).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - if (VRFTU(TUIndex).FanIndex == -1) { - ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = " + VRFTU(TUIndex).Name); + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanIndex == -1) { + ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = " + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name); ShowContinueError(state, "VRF Terminal Unit fan is required when used as zone equipment."); ErrorsFound = true; } } else { - if (VRFTU(TUIndex).FanIndex == 0) { - ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = " + VRFTU(TUIndex).Name); + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanIndex == 0) { + ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow = " + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name); ShowContinueError(state, "VRF Terminal Unit fan is required when used as zone equipment."); ErrorsFound = true; } } } - if (VRFTU(TUIndex).isSetPointControlled && state.dataAirLoop->AirLoopInputsFilled) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled && state.dataAirLoop->AirLoopInputsFilled) { bool missingSetPoint = false; - Real64 TUOutNodeSP = DataLoopNode::Node(VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint; - Real64 coolCoilOutNodeSP = DataLoopNode::Node(VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint; - Real64 heatCoilOutNodeSP = DataLoopNode::Node(VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint; + Real64 TUOutNodeSP = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint; + Real64 coolCoilOutNodeSP = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint; + Real64 heatCoilOutNodeSP = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint; // SP can be at outlet of TU or at outlet of coils // if supp heat coil is present, a SP must be at the outlet of the TU - if (VRFTU(TUIndex).SuppHeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).SuppHeatingCoilPresent) { if (TUOutNodeSP == DataLoopNode::SensedNodeFlagValue) missingSetPoint = true; } else { - if (VRFTU(TUIndex).FanPlace == DataHVACGlobals::DrawThru) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanPlace == DataHVACGlobals::DrawThru) { // then SP must be at TU outlet if (TUOutNodeSP == DataLoopNode::SensedNodeFlagValue) missingSetPoint = true; // or at coil outlet nodes @@ -5824,32 +5715,32 @@ namespace HVACVariableRefrigerantFlow { if (missingSetPoint) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow: Missing temperature setpoint for " + - VRFTU(TUIndex).Name); + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name); ShowContinueError(state, "...use a Setpoint Manager to establish a setpoint at the TU or coil(s) outlet node."); ErrorsFound = true; } else if (state.dataGlobal->AnyEnergyManagementSystemInModel) { bool SPNotFound = false; EMSManager::CheckIfNodeSetPointManagedByEMS(state, - VRFTU(TUIndex).VRFTUOutletNodeNum, EMSManager::SPControlType::iTemperatureSetPoint, SetPointErrorFlag); + state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum, EMSManager::SPControlType::iTemperatureSetPoint, SetPointErrorFlag); SPNotFound = SPNotFound || SetPointErrorFlag; EMSManager::CheckIfNodeSetPointManagedByEMS(state, - VRFTU(TUIndex).coolCoilAirOutNode, EMSManager::SPControlType::iTemperatureSetPoint, SetPointErrorFlag); + state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode, EMSManager::SPControlType::iTemperatureSetPoint, SetPointErrorFlag); SPNotFound = SPNotFound || SetPointErrorFlag; EMSManager::CheckIfNodeSetPointManagedByEMS(state, - VRFTU(TUIndex).heatCoilAirOutNode, EMSManager::SPControlType::iTemperatureSetPoint, SetPointErrorFlag); + state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode, EMSManager::SPControlType::iTemperatureSetPoint, SetPointErrorFlag); SPNotFound = SPNotFound || SetPointErrorFlag; // We disable the check at end (if API), because one of the nodes is enough, so there's an almost certainty // that it will throw as you're unlikely going to actuate all three nodes // It's not ideal, but it's better to let slide a bad condition rather than throw false positives... - DataLoopNode::NodeSetpointCheck(VRFTU(TUIndex).VRFTUOutletNodeNum).needsSetpointChecking = false; - DataLoopNode::NodeSetpointCheck(VRFTU(TUIndex).coolCoilAirOutNode).needsSetpointChecking = false; - DataLoopNode::NodeSetpointCheck(VRFTU(TUIndex).heatCoilAirOutNode).needsSetpointChecking = false; + DataLoopNode::NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum).needsSetpointChecking = false; + DataLoopNode::NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).needsSetpointChecking = false; + DataLoopNode::NodeSetpointCheck(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).needsSetpointChecking = false; if (SPNotFound && state.dataAirLoop->AirLoopInputsFilled) { ShowSevereError(state, "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow: Missing temperature setpoint for unitary system = " + - VRFTU(TUIndex).Name); + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name); ShowContinueError(state, "...use a Setpoint Manager to establish a setpoint at the TU or coil(s) outlet node."); ShowContinueError(state, "...or use an EMS actuator to establish a temperature setpoint at the coil control node."); ErrorsFound = true; @@ -5858,10 +5749,10 @@ namespace HVACVariableRefrigerantFlow { } } - if (VRFTU(TUIndex).isInAirLoop || VRFTU(TUIndex).isInOASys || VRFTU(TUIndex).isInZone) continue; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isInAirLoop || state.dataHVACVarRefFlow->VRFTU(TUIndex).isInOASys || state.dataHVACVarRefFlow->VRFTU(TUIndex).isInZone) continue; if (!state.dataAirLoop->AirLoopInputsFilled) continue; - ShowSevereError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(TUIndex).VRFTUType_Num) + ',' + - VRFTU(TUIndex).Name + + ShowSevereError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUType_Num) + ',' + + state.dataHVACVarRefFlow->VRFTU(TUIndex).Name + "] is not on any ZoneHVAC:EquipmentList, AirloopHVAC or AirLoopHVAC:OutdoorAirSystem:EquipmentList. It will not " "be simulated."); ShowContinueError(state, "...The VRF AC System associated with this terminal unit may also not be simulated."); @@ -5870,46 +5761,46 @@ namespace HVACVariableRefrigerantFlow { // TU inlet node must be the same as a zone exhaust node and the OA Mixer return node // check that TU inlet node is a zone exhaust node. - if (VRFTU(VRFTUNum).isInZone && (!VRFTU(VRFTUNum).ATMixerExists || VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide)) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide)) { bool ZoneNodeNotFound = true; for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!DataZoneEquipment::ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= DataZoneEquipment::ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) { - if (VRFTU(VRFTUNum).VRFTUInletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { - VRFTU(VRFTUNum).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } } if (!ZoneNodeNotFound) break; } - if (ZoneNodeNotFound && !VRFTU(VRFTUNum).isInAirLoop) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + if (ZoneNodeNotFound && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Zone terminal unit air inlet node name must be the same as a zone exhaust node name."); ShowContinueError(state, "... Zone exhaust node name is specified in ZoneHVAC:EquipmentConnections object."); - ShowContinueError(state, "... Zone terminal unit inlet node name = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUInletNodeNum)); + ShowContinueError(state, "... Zone terminal unit inlet node name = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum)); ErrorsFound = true; } } // check OA Mixer return node - if (VRFTU(VRFTUNum).isInZone && !VRFTU(VRFTUNum).ATMixerExists && VRFTU(VRFTUNum).OAMixerUsed) { - Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, VRFTU(VRFTUNum).OAMixerName, errFlag); - if (VRFTU(VRFTUNum).VRFTUInletNodeNum != OANodeNums(3)) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, errFlag); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum != OANodeNums(3)) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Zone terminal unit air inlet node name must be the same as the OutdoorAir:Mixer return air node name."); - ShowContinueError(state, "... Zone terminal unit air inlet node name = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUInletNodeNum)); + ShowContinueError(state, "... Zone terminal unit air inlet node name = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum)); ShowContinueError(state, "... OutdoorAir:Mixer return air node name = " + DataLoopNode::NodeID(OANodeNums(3))); ErrorsFound = true; } } // check that TU outlet node is a zone inlet node. - if ((VRFTU(VRFTUNum).isInZone && (!VRFTU(VRFTUNum).ATMixerExists || VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide))) { + if ((state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide))) { bool ZoneNodeNotFound = true; for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!DataZoneEquipment::ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int NodeNum = 1; NodeNum <= DataZoneEquipment::ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) { - if (VRFTU(VRFTUNum).VRFTUOutletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { - VRFTU(VRFTUNum).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum == DataZoneEquipment::ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = DataZoneEquipment::ZoneEquipConfig(CtrlZone).ZoneNode; ZoneNodeNotFound = false; break; } @@ -5917,128 +5808,128 @@ namespace HVACVariableRefrigerantFlow { if (!ZoneNodeNotFound) break; } if (ZoneNodeNotFound) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Zone terminal unit air outlet node name must be the same as a zone inlet node name."); ShowContinueError(state, "... Zone inlet node name is specified in ZoneHVAC:EquipmentConnections object."); - ShowContinueError(state, "... Zone terminal unit outlet node name = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + ShowContinueError(state, "... Zone terminal unit outlet node name = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } } // check fan inlet and outlet nodes int FanInletNodeNum = 0; - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - if (VRFTU(VRFTUNum).FanIndex > -1) FanInletNodeNum = HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->inletNodeNum; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > -1) FanInletNodeNum = HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->inletNodeNum; } else { - if (VRFTU(VRFTUNum).FanIndex > 0) FanInletNodeNum = Fans::getFanInNodeIndex(state, VRFTU(VRFTUNum).FanIndex, errFlag); - } - int CCoilInletNodeNum = DXCoils::getCoilInNodeIndex(state, VRFTU(VRFTUNum).CoolCoilIndex, errFlag); - int CCoilOutletNodeNum = DXCoils::getCoilOutNodeIndex(state, VRFTU(VRFTUNum).CoolCoilIndex, errFlag); - int HCoilInletNodeNum = DXCoils::getCoilInNodeIndex(state, VRFTU(VRFTUNum).HeatCoilIndex, errFlag); - int HCoilOutletNodeNum = DXCoils::getCoilOutNodeIndex(state, VRFTU(VRFTUNum).HeatCoilIndex, errFlag); - if (VRFTU(VRFTUNum).isInZone && VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { - if (!VRFTU(VRFTUNum).ATMixerExists && VRFTU(VRFTUNum).OAMixerUsed) { - Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, VRFTU(VRFTUNum).OAMixerName, errFlag); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) FanInletNodeNum = Fans::getFanInNodeIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex, errFlag); + } + int CCoilInletNodeNum = DXCoils::getCoilInNodeIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, errFlag); + int CCoilOutletNodeNum = DXCoils::getCoilOutNodeIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex, errFlag); + int HCoilInletNodeNum = DXCoils::getCoilInNodeIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, errFlag); + int HCoilOutletNodeNum = DXCoils::getCoilOutNodeIndex(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex, errFlag); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + Array1D_int OANodeNums = MixedAir::GetOAMixerNodeNumbers(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, errFlag); if (FanInletNodeNum != OANodeNums(4)) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); ShowContinueError(state, "as the outside air mixers mixed air node name when blow through fan is specified and an outside air " "mixer is present."); ShowContinueError(state, "... Fan inlet node = " + DataLoopNode::NodeID(FanInletNodeNum)); ShowContinueError(state, "... OA mixers mixed air node = " + DataLoopNode::NodeID(OANodeNums(4))); ErrorsFound = true; } - } else if (!VRFTU(VRFTUNum).OAMixerUsed && - (VRFTU(VRFTUNum).ATMixerExists && VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide)) { - if (FanInletNodeNum != VRFTU(VRFTUNum).VRFTUInletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); + } else if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed && + (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide)) { + if (FanInletNodeNum != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); ShowContinueError(state, "as the terminal unit air inlet node name when blow through fan is specified and an outside air mixer " "is not present."); ShowContinueError(state, "... Fan inlet node = " + DataLoopNode::NodeID(FanInletNodeNum)); - ShowContinueError(state, "... Terminal unit air inlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUInletNodeNum)); + ShowContinueError(state, "... Terminal unit air inlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum)); ErrorsFound = true; } } - if (VRFTU(VRFTUNum).CoolingCoilPresent) { - if (VRFTU(VRFTUNum).fanOutletNode != CCoilInletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan outlet node name must be the same"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode != CCoilInletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan outlet node name must be the same"); ShowContinueError(state, "as the DX cooling coil air inlet node name when blow through fan is specified."); - ShowContinueError(state, "... Fan outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).fanOutletNode)); + ShowContinueError(state, "... Fan outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode)); ShowContinueError(state, "... DX cooling coil air inlet node = " + DataLoopNode::NodeID(CCoilInletNodeNum)); ErrorsFound = true; } - if (VRFTU(VRFTUNum).HeatingCoilPresent && !VRFTU(VRFTUNum).SuppHeatingCoilPresent) { - if (HCoilOutletNodeNum != VRFTU(VRFTUNum).VRFTUOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (HCoilOutletNodeNum != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Heating coil outlet node name must be the same"); ShowContinueError(state, "as the terminal unit air outlet node name when blow through fan is specified."); ShowContinueError(state, "... Heating coil outlet node = " + DataLoopNode::NodeID(HCoilOutletNodeNum)); - ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } - } else if (VRFTU(VRFTUNum).SuppHeatingCoilPresent) { - if (VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode != VRFTU(VRFTUNum).VRFTUOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Supplemental Heating coil outlet node name must be the same"); ShowContinueError(state, "as the terminal unit air outlet node name when blow through fan is specified."); ShowContinueError(state, "... Supplemental Heating coil outlet node = " + - DataLoopNode::NodeID(VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode)); - ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode)); + ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } } else { - if (CCoilOutletNodeNum != VRFTU(VRFTUNum).VRFTUOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + if (CCoilOutletNodeNum != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Cooling coil outlet node name must be the same"); ShowContinueError(state, "as the terminal unit air outlet node name when blow through fan is specified and no DX heating coil is present."); ShowContinueError(state, "... Cooling coil outlet node = " + DataLoopNode::NodeID(CCoilOutletNodeNum)); - ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } } - } else if (VRFTU(VRFTUNum).HeatingCoilPresent) { - if (VRFTU(VRFTUNum).fanOutletNode != HCoilInletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan outlet node name must be the same"); + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode != HCoilInletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan outlet node name must be the same"); ShowContinueError(state, "as the DX heating coil air inlet node name when blow through fan is specified and a DX cooling coil is not present."); - ShowContinueError(state, "... Fan outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).fanOutletNode)); + ShowContinueError(state, "... Fan outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode)); ShowContinueError(state, "... DX heating coil air inlet node = " + DataLoopNode::NodeID(HCoilInletNodeNum)); ErrorsFound = true; } - if (VRFTU(VRFTUNum).SuppHeatingCoilPresent) { - if (VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode != VRFTU(VRFTUNum).VRFTUOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Supplemental Heating coil outlet node name must be the same"); ShowContinueError(state, "as the terminal unit air outlet node name when blow through fan is specified."); ShowContinueError(state, "... Supplemental Heating coil outlet node = " + - DataLoopNode::NodeID(VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode)); - ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode)); + ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } } else { - if (HCoilOutletNodeNum != VRFTU(VRFTUNum).VRFTUOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + if (HCoilOutletNodeNum != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Heating coil outlet node name must be the same"); ShowContinueError(state, "as the terminal unit air outlet node name when blow through fan is specified."); ShowContinueError(state, "... Heating coil outlet node = " + DataLoopNode::NodeID(HCoilOutletNodeNum)); - ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + ShowContinueError(state, "... Terminal Unit air outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } } } - } else if (VRFTU(VRFTUNum).isInZone && VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { - if (VRFTU(VRFTUNum).CoolingCoilPresent) { - if (!VRFTU(VRFTUNum).OAMixerUsed) { - if (VRFTU(VRFTUNum).VRFTUInletNodeNum != CCoilInletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Cooling coil inlet node name must be the same"); + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum != CCoilInletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Cooling coil inlet node name must be the same"); ShowContinueError(state, "as the terminal unit air inlet node name when draw through fan is specified."); - ShowContinueError(state, "... Terminal unit air inlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUInletNodeNum)); + ShowContinueError(state, "... Terminal unit air inlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum)); ShowContinueError(state, "... DX cooling coil air inlet node = " + DataLoopNode::NodeID(CCoilInletNodeNum)); ErrorsFound = true; } } - if (VRFTU(VRFTUNum).HeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { if (FanInletNodeNum != HCoilOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); ShowContinueError(state, "as the DX heating coil air outlet node name when draw through fan is specified."); ShowContinueError(state, "... Fan inlet node = " + DataLoopNode::NodeID(FanInletNodeNum)); ShowContinueError(state, "... DX heating coil air outlet node = " + DataLoopNode::NodeID(HCoilOutletNodeNum)); @@ -6046,7 +5937,7 @@ namespace HVACVariableRefrigerantFlow { } } else { if (FanInletNodeNum != CCoilOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); ShowContinueError(state, "as the DX cooling coil air outlet node name when draw through fan is specified and a DX heating coil " "is not present."); ShowContinueError(state, "... Fan inlet node = " + DataLoopNode::NodeID(FanInletNodeNum)); @@ -6054,38 +5945,38 @@ namespace HVACVariableRefrigerantFlow { ErrorsFound = true; } } - } else if (VRFTU(VRFTUNum).HeatingCoilPresent) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { if (FanInletNodeNum != HCoilOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan inlet node name must be the same"); ShowContinueError(state, "as the DX heating coil air outlet node name when draw through fan is specified."); ShowContinueError(state, "... Fan inlet node = " + DataLoopNode::NodeID(FanInletNodeNum)); ShowContinueError(state, "... DX heating coil air outlet node = " + DataLoopNode::NodeID(HCoilOutletNodeNum)); ErrorsFound = true; } } - if (VRFTU(VRFTUNum).SuppHeatingCoilPresent) { - if (VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode != VRFTU(VRFTUNum).VRFTUOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Supplemental heating coil air outlet node name must be the same"); ShowContinueError(state, "as the terminal unit air outlet node name when draw through fan is specified."); ShowContinueError(state, "... Supplemental heating coil air outlet node = " + - DataLoopNode::NodeID(VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode)); - ShowContinueError(state, "... Terminal unit air outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilAirOutletNode)); + ShowContinueError(state, "... Terminal unit air outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } } else { - if (VRFTU(VRFTUNum).fanOutletNode != VRFTU(VRFTUNum).VRFTUOutletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" Fan outlet node name must be the same"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode != state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum) { + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" Fan outlet node name must be the same"); ShowContinueError(state, "as the terminal unit air outlet node name when draw through fan is specified."); - ShowContinueError(state, "... Fan outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).fanOutletNode)); - ShowContinueError(state, "... Terminal unit air outlet node = " + DataLoopNode::NodeID(VRFTU(VRFTUNum).VRFTUOutletNodeNum)); + ShowContinueError(state, "... Fan outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode)); + ShowContinueError(state, "... Terminal unit air outlet node = " + DataLoopNode::NodeID(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum)); ErrorsFound = true; } } } - if (VRFTU(VRFTUNum).CoolingCoilPresent && VRFTU(VRFTUNum).HeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { if (CCoilOutletNodeNum != HCoilInletNodeNum) { - ShowSevereError(state, cCurrentModuleObject + " \"" + VRFTU(VRFTUNum).Name + "\" DX cooling coil air outlet node name must be the same"); + ShowSevereError(state, cCurrentModuleObject + " \"" + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\" DX cooling coil air outlet node name must be the same"); ShowContinueError(state, " as the DX heating coil air inlet node name."); ShowContinueError(state, "... DX cooling coil air outlet node = " + DataLoopNode::NodeID(CCoilOutletNodeNum)); ShowContinueError(state, "... DX heating coil air inlet node = " + DataLoopNode::NodeID(HCoilInletNodeNum)); @@ -6093,155 +5984,155 @@ namespace HVACVariableRefrigerantFlow { } } - if (VRFTU(VRFTUNum).isInZone && VRFTU(VRFTUNum).ATMixerExists) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) { // check that OA flow in cooling must be set to zero when connected to DOAS - if (VRFTU(VRFTUNum).CoolOutAirVolFlow != 0) { - ShowWarningError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow != 0) { + ShowWarningError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, ".. Cooling Outdoor Air Flow Rate must be zero when " + cCurrentModuleObject); ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer"); ShowContinueError(state, ".. Cooling Outdoor Air Flow Rate is set to 0 and simulation continues."); - VRFTU(VRFTUNum).CoolOutAirVolFlow = 0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = 0; } // check that OA flow in heating must be set to zero when connected to DOAS - if (VRFTU(VRFTUNum).HeatOutAirVolFlow != 0) { - ShowWarningError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow != 0) { + ShowWarningError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, ".. Heating Outdoor Air Flow Rate must be zero when " + cCurrentModuleObject); ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer"); ShowContinueError(state, ".. Heating Outdoor Air Flow Rate is set to 0 and simulation continues."); - VRFTU(VRFTUNum).HeatOutAirVolFlow = 0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = 0; } // check that OA flow in no cooling and no heating must be set to zero when connected to DOAS - if (VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow != 0) { - ShowWarningError(state, cCurrentModuleObject + " = " + VRFTU(VRFTUNum).Name); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow != 0) { + ShowWarningError(state, cCurrentModuleObject + " = " + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, ".. No Load Outdoor Air Flow Rate must be zero when " + cCurrentModuleObject); ShowContinueError(state, "..object is connected to central dedicated outdoor air system via AirTerminal:SingleDuct:Mixer"); ShowContinueError(state, ".. No Load Outdoor Air Flow Rate is set to 0 and simulation continues."); - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0; } } } // IF(ZoneEquipmentListNotChecked)THEN // Size TU - if (MySizeFlag(VRFTUNum)) { + if (state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum)) { if (!state.dataGlobal->ZoneSizingCalc && !state.dataGlobal->SysSizingCalc) { SizeVRF(state, VRFTUNum); - TerminalUnitList(TUListIndex).TerminalUnitNotSizedYet(IndexToTUInTUList) = false; - MySizeFlag(VRFTUNum) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).TerminalUnitNotSizedYet(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum) = false; } // IF ( .NOT. state.dataGlobal->ZoneSizingCalc) THEN } // IF (MySizeFlag(VRFTUNum)) THEN // Do the Begin Environment initializations - if (state.dataGlobal->BeginEnvrnFlag && MyEnvrnFlag(VRFTUNum)) { + if (state.dataGlobal->BeginEnvrnFlag && state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum)) { // Change the Volume Flow Rates to Mass Flow Rates RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the input volume flow rates - VRFTU(VRFTUNum).MaxCoolAirMassFlow = RhoAir * VRFTU(VRFTUNum).MaxCoolAirVolFlow; - VRFTU(VRFTUNum).CoolOutAirMassFlow = RhoAir * VRFTU(VRFTUNum).CoolOutAirVolFlow; - VRFTU(VRFTUNum).MaxHeatAirMassFlow = RhoAir * VRFTU(VRFTUNum).MaxHeatAirVolFlow; - VRFTU(VRFTUNum).HeatOutAirMassFlow = RhoAir * VRFTU(VRFTUNum).HeatOutAirVolFlow; - VRFTU(VRFTUNum).MaxNoCoolAirMassFlow = RhoAir * VRFTU(VRFTUNum).MaxNoCoolAirVolFlow; - VRFTU(VRFTUNum).MaxNoHeatAirMassFlow = RhoAir * VRFTU(VRFTUNum).MaxNoHeatAirVolFlow; - VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow = RhoAir * VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow = RhoAir * state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; // set the node max and min mass flow rates // outside air mixer is optional, check that node num > 0 if (OutsideAirNode > 0) { - DataLoopNode::Node(OutsideAirNode).MassFlowRateMax = max(VRFTU(VRFTUNum).CoolOutAirMassFlow, VRFTU(VRFTUNum).HeatOutAirMassFlow); + DataLoopNode::Node(OutsideAirNode).MassFlowRateMax = max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow); DataLoopNode::Node(OutsideAirNode).MassFlowRateMin = 0.0; DataLoopNode::Node(OutsideAirNode).MassFlowRateMinAvail = 0.0; } - DataLoopNode::Node(OutNode).MassFlowRateMax = max(VRFTU(VRFTUNum).MaxCoolAirMassFlow, VRFTU(VRFTUNum).MaxHeatAirMassFlow); + DataLoopNode::Node(OutNode).MassFlowRateMax = max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow); DataLoopNode::Node(OutNode).MassFlowRateMin = 0.0; DataLoopNode::Node(OutNode).MassFlowRateMinAvail = 0.0; - DataLoopNode::Node(InNode).MassFlowRateMax = max(VRFTU(VRFTUNum).MaxCoolAirMassFlow, VRFTU(VRFTUNum).MaxHeatAirMassFlow); + DataLoopNode::Node(InNode).MassFlowRateMax = max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow); DataLoopNode::Node(InNode).MassFlowRateMin = 0.0; DataLoopNode::Node(InNode).MassFlowRateMinAvail = 0.0; - if (VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum > 0) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum).MassFlowRateMinAvail = 0.0; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum > 0) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum).MassFlowRateMinAvail = 0.0; } - MyEnvrnFlag(VRFTUNum) = false; + state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum) = false; - if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { rho = GetDensityGlycol(state, - PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, + PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidName, DataGlobalConstants::CWInitConvTemp, - PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, + PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); - VRF(VRFCond).WaterCondenserDesignMassFlow = VRF(VRFCond).WaterCondVolFlowRate * rho; + state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow = state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondVolFlowRate * rho; InitComponentNodes(0.0, - VRF(VRFCond).WaterCondenserDesignMassFlow, - VRF(VRFCond).CondenserNodeNum, - VRF(VRFCond).CondenserOutletNodeNum, - VRF(VRFCond).SourceLoopNum, - VRF(VRFCond).SourceLoopSideNum, - VRF(VRFCond).SourceBranchNum, - VRF(VRFCond).SourceCompNum); + state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow, + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum, + state.dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceLoopSideNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceBranchNum, + state.dataHVACVarRefFlow->VRF(VRFCond).SourceCompNum); } // IF(MyVRFCondFlag(VRFCond))THEN - VRF(VRFCond).HRTimer = 0.0; - VRF(VRFCond).ModeChange = false; - VRF(VRFCond).HRModeChange = false; - MyVRFCondFlag(VRFCond) = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRTimer = 0.0; + state.dataHVACVarRefFlow->VRF(VRFCond).ModeChange = false; + state.dataHVACVarRefFlow->VRF(VRFCond).HRModeChange = false; + state.dataHVACVarRefFlow->MyVRFCondFlag(VRFCond) = false; // END IF - if (VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { - if (VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { WaterCoils::SimulateWaterCoilComponents( - state, VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, VRFTU(VRFTUNum).SuppHeatCoilIndex); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex); // design hot water volume flow rate Real64 CoilMaxVolFlowRate = - WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); + WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { rho = GetDensityGlycol(state, - PlantLoop(VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidName, + PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidName, DataGlobalConstants::HWInitConvTemp, - PlantLoop(VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidIndex, + PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum).FluidIndex, RoutineName); - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * rho; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * rho; } } } - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { - if (VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow == DataSizing::AutoSize) { SteamCoils::SimulateSteamCoilComponents( - state, VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, VRFTU(VRFTUNum).SuppHeatCoilIndex, 1.0); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, 1.0); // design steam volume flow rate - Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); + Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { int SteamIndex = 0; // fluid type index of 0 is passed if steam Real64 TempSteamIn = 100.0; Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * SteamDensity; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * SteamDensity; } } } // init water/steam coils min and max flow rates InitComponentNodes(0.0, - VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow, - VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, - VRFTU(VRFTUNum).SuppHeatCoilLoopNum, - VRFTU(VRFTUNum).SuppHeatCoilLoopSide, - VRFTU(VRFTUNum).SuppHeatCoilBranchNum, - VRFTU(VRFTUNum).SuppHeatCoilCompNum); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum); } // the first time an air loop VRF TU is simulated set isSimulated = true so that the TU initialization // will occur with the first TU simulated this time step. Zone VRF TUs are called during sizing which, if air // loop TUs are included, alters when all TUs appear to have been simulated. Also, BeginEnvrnFlag is true multiple // times during the simulation, reset each time to avoid a different order during sizing and simulation - if (TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags) { + if (state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags) { // if no TUs are in the air loop or outdoor air system they will all be simulated during ManageZoneEquipment // and there is no need to adjust the order of simulation (i.e., when isSimulated are all true for a given system) - if (VRFTU(VRFTUNum).isInAirLoop || VRFTU(VRFTUNum).isInOASys) { - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).IsSimulated = true; - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = false; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) { + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).IsSimulated = true; + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = false; } } @@ -6249,208 +6140,208 @@ namespace HVACVariableRefrigerantFlow { // reset environment flag for next environment if (!state.dataGlobal->BeginEnvrnFlag) { - MyEnvrnFlag(VRFTUNum) = true; - MyVRFCondFlag(VRFCond) = true; - TerminalUnitList(VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = true; + state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum) = true; + state.dataHVACVarRefFlow->MyVRFCondFlag(VRFCond) = true; + state.dataHVACVarRefFlow->TerminalUnitList(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex).reset_isSimulatedFlags = true; } // If all VRF Terminal Units on this VRF AC System have been simulated, reset the IsSimulated flag // The condenser will be simulated after all terminal units have been simulated (see Sub SimulateVRF) - if (all(TerminalUnitList(TUListIndex).IsSimulated)) { + if (all(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).IsSimulated)) { // this should be the first time through on the next iteration. All TU's and condenser have been simulated. // reset simulation flag for each terminal unit - TerminalUnitList(TUListIndex).IsSimulated = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).IsSimulated = false; // after all TU's have been simulated, reset operating mode flag if necessary - if (LastModeHeating(VRFCond) && CoolingLoad(VRFCond)) { - LastModeCooling(VRFCond) = true; - LastModeHeating(VRFCond) = false; + if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond) && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) { + state.dataHVACVarRefFlow->LastModeCooling(VRFCond) = true; + state.dataHVACVarRefFlow->LastModeHeating(VRFCond) = false; // SwitchedMode(VRFCond) = .TRUE. } - if (LastModeCooling(VRFCond) && HeatingLoad(VRFCond)) { - LastModeHeating(VRFCond) = true; - LastModeCooling(VRFCond) = false; + if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond) && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { + state.dataHVACVarRefFlow->LastModeHeating(VRFCond) = true; + state.dataHVACVarRefFlow->LastModeCooling(VRFCond) = false; // SwitchedMode(VRFCond) = .TRUE. } } // IF(ALL(TerminalUnitList(VRFTU(VRFTUNum)%TUListIndex)%IsSimulated))THEN // get operating capacity of water and steam coil if (FirstHVACIteration) { - if (VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { // set hot water full flow rate for sizing - Real64 mdot = VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow; + Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, - VRFTU(VRFTUNum).SuppHeatCoilLoopNum, - VRFTU(VRFTUNum).SuppHeatCoilLoopSide, - VRFTU(VRFTUNum).SuppHeatCoilBranchNum, - VRFTU(VRFTUNum).SuppHeatCoilCompNum); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum); // simulate water coil to find operating capacity WaterCoils::SimulateWaterCoilComponents( - state, VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, VRFTU(VRFTUNum).SuppHeatCoilIndex, SuppHeatCoilCapacity); - VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity; + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, SuppHeatCoilCapacity); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity; } // from iF VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam) { // set hot water full flow rate for sizing - Real64 mdot = VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow; + Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow; PlantUtilities::SetComponentFlowRate(state, mdot, - VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, - VRFTU(VRFTUNum).SuppHeatCoilLoopNum, - VRFTU(VRFTUNum).SuppHeatCoilLoopSide, - VRFTU(VRFTUNum).SuppHeatCoilBranchNum, - VRFTU(VRFTUNum).SuppHeatCoilCompNum); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum); // simulate steam coil to find operating capacity SteamCoils::SimulateSteamCoilComponents(state, - VRFTU(VRFTUNum).SuppHeatCoilName, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, - VRFTU(VRFTUNum).SuppHeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, 1.0, ErrorsFound); // QCoilReq, simulate any load > 0 to get max capacity of steam coil - SuppHeatCoilCapacity = SteamCoils::GetCoilCapacity(state, "Coil:Heating:Steam", VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); + SuppHeatCoilCapacity = SteamCoils::GetCoilCapacity(state, "Coil:Heating:Steam", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); - VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = SuppHeatCoilCapacity; } // from if VRFTU( VRFTUNum ).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingSteam } } // initialize water/steam coil inlet flow rate to zero - if (VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode > 0) { Real64 mdot = 0.0; PlantUtilities::SetComponentFlowRate(state, mdot, - VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, - VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, - VRFTU(VRFTUNum).SuppHeatCoilLoopNum, - VRFTU(VRFTUNum).SuppHeatCoilLoopSide, - VRFTU(VRFTUNum).SuppHeatCoilBranchNum, - VRFTU(VRFTUNum).SuppHeatCoilCompNum); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilLoopSide, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilBranchNum, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilCompNum); } // one-time checks of flow rate vs fan flow rate - if (MyVRFFlag(VRFTUNum)) { + if (state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum)) { if (!state.dataGlobal->ZoneSizingCalc && !state.dataGlobal->SysSizingCalc) { - if (VRFTU(VRFTUNum).FanPlace > 0) { - if (VRFTU(VRFTUNum).ActualFanVolFlowRate != AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate != AutoSize) { - if (VRFTU(VRFTUNum).MaxCoolAirVolFlow > VRFTU(VRFTUNum).ActualFanVolFlowRate) { - ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + - VRFTU(VRFTUNum).Name + "\"]"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\"]"); ShowContinueError(state, "... has Supply Air Flow Rate During Cooling Operation > Max Fan Volume Flow Rate, should be <="); ShowContinueError( - state, format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s", VRFTU(VRFTUNum).MaxCoolAirVolFlow)); + state, format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow)); ShowContinueError( state, - format("... Max Fan Volume Flow Rate = {:.4R} m3/s", VRFTU(VRFTUNum).ActualFanVolFlowRate)); + format("... Max Fan Volume Flow Rate = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); ShowContinueError(state, "...the supply air flow rate during cooling operation will be reduced to match and the simulation continues."); - VRFTU(VRFTUNum).MaxCoolAirVolFlow = VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; } - if (VRFTU(VRFTUNum).MaxNoCoolAirVolFlow > VRFTU(VRFTUNum).ActualFanVolFlowRate) { - ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + - VRFTU(VRFTUNum).Name + "\"]"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\"]"); ShowContinueError(state, "... has Supply Air Flow Rate When No Cooling is Needed > Max Fan Volume Flow Rate, should be <="); ShowContinueError( state, - format("... Supply Air Flow Rate When No Cooling is Needed = {:.4R} m3/s", VRFTU(VRFTUNum).MaxNoCoolAirVolFlow)); + format("... Supply Air Flow Rate When No Cooling is Needed = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow)); ShowContinueError( state, - format("... Max Fan Volume Flow Rate = {:.4R} m3/s", VRFTU(VRFTUNum).ActualFanVolFlowRate)); + format("... Max Fan Volume Flow Rate = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); ShowContinueError(state, "...the supply air flow rate when no cooling is needed will be reduced to match and the simulation continues."); - VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; } - if (VRFTU(VRFTUNum).CoolOutAirVolFlow > VRFTU(VRFTUNum).MaxCoolAirVolFlow) { - ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + - VRFTU(VRFTUNum).Name + "\"]"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow) { + ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\"]"); ShowContinueError(state, "...The Outdoor Air Flow Rate During Cooling Operation exceeds the Supply Air Flow Rate During Cooling Operation."); ShowContinueError( - state, format("...Outdoor Air Flow Rate During Cooling Operation = {:.4R} m3/s", VRFTU(VRFTUNum).CoolOutAirVolFlow)); + state, format("...Outdoor Air Flow Rate During Cooling Operation = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow)); ShowContinueError( - state, format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s", VRFTU(VRFTUNum).MaxCoolAirVolFlow)); + state, format("... Supply Air Flow Rate During Cooling Operation = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow)); ShowContinueError(state, "...the outdoor air flow rate will be reduced to match and the simulation continues."); - VRFTU(VRFTUNum).CoolOutAirVolFlow = VRFTU(VRFTUNum).MaxCoolAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; } - if (VRFTU(VRFTUNum).MaxHeatAirVolFlow > VRFTU(VRFTUNum).ActualFanVolFlowRate) { - ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + - VRFTU(VRFTUNum).Name + "\"]"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\"]"); ShowContinueError(state, "... has Supply Air Flow Rate During Heating Operation > Max Fan Volume Flow Rate, should be <="); ShowContinueError( - state, format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s", VRFTU(VRFTUNum).MaxHeatAirVolFlow)); + state, format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow)); ShowContinueError( state, - format("... Max Fan Volume Flow Rate = {:.4R} m3/s", VRFTU(VRFTUNum).ActualFanVolFlowRate)); + format("... Max Fan Volume Flow Rate = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); ShowContinueError(state, "...the supply air flow rate during cooling operation will be reduced to match and the simulation continues."); - VRFTU(VRFTUNum).MaxHeatAirVolFlow = VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; } - if (VRFTU(VRFTUNum).MaxNoHeatAirVolFlow > VRFTU(VRFTUNum).ActualFanVolFlowRate) { - ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + - VRFTU(VRFTUNum).Name + "\"]"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\"]"); ShowContinueError(state, "... has Supply Air Flow Rate When No Heating is Needed > Max Fan Volume Flow Rate, should be <="); ShowContinueError( state, - format("... Supply Air Flow Rate When No Heating is Needed = {:.4R} m3/s", VRFTU(VRFTUNum).MaxNoHeatAirVolFlow)); + format("... Supply Air Flow Rate When No Heating is Needed = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow)); ShowContinueError( state, - format("... Max Fan Volume Flow Rate = {:.4R} m3/s", VRFTU(VRFTUNum).ActualFanVolFlowRate)); + format("... Max Fan Volume Flow Rate = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); ShowContinueError(state, "...the supply air flow rate when no cooling is needed will be reduced to match and the simulation continues."); - VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; } - if (VRFTU(VRFTUNum).HeatOutAirVolFlow > VRFTU(VRFTUNum).MaxHeatAirVolFlow) { - ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + - VRFTU(VRFTUNum).Name + "\"]"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow) { + ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\"]"); ShowContinueError(state, "...The Outdoor Air Flow Rate During Heating Operation exceeds the Supply Air Flow Rate During Heating Operation."); ShowContinueError( - state, format("...Outdoor Air Flow Rate During Heating Operation = {:.4R} m3/s", VRFTU(VRFTUNum).HeatOutAirVolFlow)); + state, format("...Outdoor Air Flow Rate During Heating Operation = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow)); ShowContinueError( - state, format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s", VRFTU(VRFTUNum).MaxHeatAirVolFlow)); + state, format("... Supply Air Flow Rate During Heating Operation = {:.4R} m3/s", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow)); ShowContinueError(state, "...the outdoor air flow rate will be reduced to match and the simulation continues."); - VRFTU(VRFTUNum).HeatOutAirVolFlow = VRFTU(VRFTUNum).MaxHeatAirVolFlow; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; } - if (VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > VRFTU(VRFTUNum).ActualFanVolFlowRate) { - ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + - VRFTU(VRFTUNum).Name + "\"]"); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate) { + ShowWarningError(state, "InitVRF: VRF Terminal Unit = [" + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ", \"" + + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name + "\"]"); ShowContinueError(state, "... has a Outdoor Air Flow Rate When No Cooling or Heating is Needed > Max Fan Volume Flow Rate, should be <="); ShowContinueError(state, format("... Outdoor Air Flow Rate When No Cooling or Heating is Needed = {:.4R} m3/s", - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow)); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow)); ShowContinueError(state, format("... Max Fan Volume Flow Rate = {:.4R} m3/s", - VRFTU(VRFTUNum).ActualFanVolFlowRate)); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate)); ShowContinueError(state, "...the outdoor air flow rate when no cooling or heating is needed will be reduced to match and the " "simulation continues."); - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; } - if (VRFTU(VRFTUNum).ActualFanVolFlowRate > 0.0) { - VRFTU(VRFTUNum).HeatingSpeedRatio = VRFTU(VRFTUNum).MaxHeatAirVolFlow / VRFTU(VRFTUNum).ActualFanVolFlowRate; - VRFTU(VRFTUNum).CoolingSpeedRatio = VRFTU(VRFTUNum).MaxCoolAirVolFlow / VRFTU(VRFTUNum).ActualFanVolFlowRate; - VRFTU(VRFTUNum).NoHeatingSpeedRatio = VRFTU(VRFTUNum).MaxNoHeatAirVolFlow / VRFTU(VRFTUNum).ActualFanVolFlowRate; - VRFTU(VRFTUNum).NoCoolingSpeedRatio = VRFTU(VRFTUNum).MaxNoCoolAirVolFlow / VRFTU(VRFTUNum).ActualFanVolFlowRate; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate > 0.0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate; } - MyVRFFlag(VRFTUNum) = false; + state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum) = false; } else { - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - VRFTU(VRFTUNum).ActualFanVolFlowRate = HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate = HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->designAirVolFlowRate; } else { - GetFanVolFlow(VRFTU(VRFTUNum).FanIndex, VRFTU(VRFTUNum).ActualFanVolFlowRate); + GetFanVolFlow(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ActualFanVolFlowRate); } } } else { - MyVRFFlag(VRFTUNum) = false; + state.dataHVACVarRefFlow->MyVRFFlag(VRFTUNum) = false; } } } // IF(MyVRFFlag(VRFTUNum))THEN @@ -6463,32 +6354,32 @@ namespace HVACVariableRefrigerantFlow { // providing more capacity than allowed. Example: TU loads are 1-ton, 2-ton, 3-ton, and 4-ton connected // to a condenser having only 9-tons available. This variable will be set to 3-tons and the 4-ton // terminal unit will be limited to 3-tons (see SimVRFCondenser where this variable is calculated). - if (CurrentEndTime > CurrentEndTimeLast || TimeStepSysLast > DataHVACGlobals::TimeStepSys || - (FirstHVACIteration && MyBeginTimeStepFlag(VRFCond))) { - MaxCoolingCapacity(VRFCond) = MaxCap; - MaxHeatingCapacity(VRFCond) = MaxCap; - MyBeginTimeStepFlag(VRFCond) = false; + if (CurrentEndTime > state.dataHVACVarRefFlow->CurrentEndTimeLast || TimeStepSysLast > DataHVACGlobals::TimeStepSys || + (FirstHVACIteration && state.dataHVACVarRefFlow->MyBeginTimeStepFlag(VRFCond))) { + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = MaxCap; + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = MaxCap; + state.dataHVACVarRefFlow->MyBeginTimeStepFlag(VRFCond) = false; } - if (!FirstHVACIteration) MyBeginTimeStepFlag(VRFCond) = true; + if (!FirstHVACIteration) state.dataHVACVarRefFlow->MyBeginTimeStepFlag(VRFCond) = true; // Do the following initializations (every time step). TimeStepSysLast = DataHVACGlobals::TimeStepSys; - CurrentEndTimeLast = CurrentEndTime; + state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime; - if (VRFTU(VRFTUNum).FanOpModeSchedPtr > 0) { - if (GetCurrentScheduleValue(state, VRFTU(VRFTUNum).FanOpModeSchedPtr) == 0.0) { - VRFTU(VRFTUNum).OpMode = DataHVACGlobals::CycFanCycCoil; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr > 0) { + if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr) == 0.0) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode = DataHVACGlobals::CycFanCycCoil; } else { - VRFTU(VRFTUNum).OpMode = DataHVACGlobals::ContFanCycCoil; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode = DataHVACGlobals::ContFanCycCoil; } } // if condenser is off, all terminal unit coils are off - if (GetCurrentScheduleValue(state, VRF(VRFCond).SchedPtr) == 0.0) { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; + if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPtr) == 0.0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; } else { //*** Operating Mode Initialization done at beginning of each iteration ***! @@ -6497,41 +6388,41 @@ namespace HVACVariableRefrigerantFlow { // Determine operating mode prior to simulating any terminal units connected to a VRF condenser // this should happen at the beginning of a time step where all TU's are polled to see what // mode the heat pump condenser will operate in - if (!any(TerminalUnitList(TUListIndex).IsSimulated)) { + if (!any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).IsSimulated)) { InitializeOperatingMode(state, FirstHVACIteration, VRFCond, TUListIndex, OnOffAirFlowRatio); } //*** End of Operating Mode Initialization done at beginning of each iteration ***! // disable VRF system when outside limits of operation based on OAT EnableSystem = false; // flag used to switch operating modes when OAT is outside operating limits - if (CoolingLoad(VRFCond)) { - if ((OutsideDryBulbTemp < VRF(VRFCond).MinOATCooling || OutsideDryBulbTemp > VRF(VRFCond).MaxOATCooling) && - any(TerminalUnitList(TUListIndex).CoolingCoilPresent)) { - CoolingLoad(VRFCond) = false; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) { + if ((OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling || OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) && + any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilPresent)) { + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; // test if heating load exists, account for thermostat control type { - auto const SELECT_CASE_var(VRF(VRFCond).ThermostatPriority); - if ((SELECT_CASE_var == LoadPriority) || (SELECT_CASE_var == ZonePriority)) { - if (SumHeatingLoads(VRFCond) > 0.0) EnableSystem = true; - } else if (SELECT_CASE_var == ThermostatOffsetPriority) { - if (MinDeltaT(VRFCond) < 0.0) EnableSystem = true; - } else if ((SELECT_CASE_var == ScheduledPriority) || (SELECT_CASE_var == MasterThermostatPriority)) { + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority); + if ((SELECT_CASE_var == iThermostatCtrlType::LoadPriority) || (SELECT_CASE_var == iThermostatCtrlType::ZonePriority)) { + if (state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) > 0.0) EnableSystem = true; + } else if (SELECT_CASE_var == iThermostatCtrlType::ThermostatOffsetPriority) { + if (state.dataHVACVarRefFlow->MinDeltaT(VRFCond) < 0.0) EnableSystem = true; + } else if ((SELECT_CASE_var == iThermostatCtrlType::ScheduledPriority) || (SELECT_CASE_var == iThermostatCtrlType::MasterThermostatPriority)) { // can't switch modes if scheduled (i.e., would be switching to unscheduled mode) // or master TSTAT used (i.e., master zone only has a specific load - can't switch) } else { } } if (EnableSystem) { - if ((OutsideDryBulbTemp >= VRF(VRFCond).MinOATHeating && OutsideDryBulbTemp <= VRF(VRFCond).MaxOATHeating) && - any(TerminalUnitList(TUListIndex).HeatingCoilPresent)) { - HeatingLoad(VRFCond) = true; + if ((OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating && OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) && + any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilPresent)) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; } else { - if (any(TerminalUnitList(TUListIndex).CoolingCoilAvailable)) { - if (VRF(VRFCond).CoolingMaxTempLimitIndex == 0) { - ShowWarningMessage(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + "\"."); + if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilAvailable)) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex == 0) { + ShowWarningMessage(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\"."); ShowContinueError(state, "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Cooling Mode Limits have been " "exceeded and VRF system is disabled."); - if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { ShowContinueError(state, format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp)); } else { @@ -6539,26 +6430,26 @@ namespace HVACVariableRefrigerantFlow { state, format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp)); } ShowContinueError( - state, format("... Cooling Minimum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MinOATCooling)); + state, format("... Cooling Minimum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling)); ShowContinueError( - state, format("... Cooling Maximum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MaxOATCooling)); + state, format("... Cooling Maximum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling)); ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Cooling Mode limits."); } ShowRecurringWarningErrorAtEnd(state, - cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\" -- Exceeded VRF Heat Pump min/max cooling temperature limit error continues...", - VRF(VRFCond).CoolingMaxTempLimitIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex, OutsideDryBulbTemp, OutsideDryBulbTemp); } } } else { - if (any(TerminalUnitList(TUListIndex).CoolingCoilAvailable)) { - if (VRF(VRFCond).CoolingMaxTempLimitIndex == 0) { - ShowWarningMessage(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + "\"."); + if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilAvailable)) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex == 0) { + ShowWarningMessage(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\"."); ShowContinueError(state, "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Cooling Mode Limits have been exceeded " "and VRF system is disabled."); - if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { ShowContinueError(state, format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp)); } else { @@ -6566,45 +6457,45 @@ namespace HVACVariableRefrigerantFlow { format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp)); } ShowContinueError(state, - format("... Cooling Minimum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MinOATCooling)); + format("... Cooling Minimum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling)); ShowContinueError(state, - format("... Cooling Maximum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MaxOATCooling)); + format("... Cooling Maximum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling)); ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Cooling Mode limits."); } - ShowRecurringWarningErrorAtEnd(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + + ShowRecurringWarningErrorAtEnd(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\" -- Exceeded VRF Heat Pump min/max cooling temperature limit error continues...", - VRF(VRFCond).CoolingMaxTempLimitIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).CoolingMaxTempLimitIndex, OutsideDryBulbTemp, OutsideDryBulbTemp); } } } - } else if (HeatingLoad(VRFCond)) { - if ((OutsideDryBulbTemp < VRF(VRFCond).MinOATHeating || OutsideDryBulbTemp > VRF(VRFCond).MaxOATHeating) && - any(TerminalUnitList(TUListIndex).HeatingCoilPresent)) { - HeatingLoad(VRFCond) = false; + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { + if ((OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating || OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) && + any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilPresent)) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; // test if cooling load exists, account for thermostat control type { - auto const SELECT_CASE_var(VRF(VRFCond).ThermostatPriority); - if ((SELECT_CASE_var == LoadPriority) || (SELECT_CASE_var == ZonePriority)) { - if (SumCoolingLoads(VRFCond) < 0.0) EnableSystem = true; - } else if (SELECT_CASE_var == ThermostatOffsetPriority) { - if (MaxDeltaT(VRFCond) > 0.0) EnableSystem = true; - } else if ((SELECT_CASE_var == ScheduledPriority) || (SELECT_CASE_var == MasterThermostatPriority)) { + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority); + if ((SELECT_CASE_var == iThermostatCtrlType::LoadPriority) || (SELECT_CASE_var == iThermostatCtrlType::ZonePriority)) { + if (state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) < 0.0) EnableSystem = true; + } else if (SELECT_CASE_var == iThermostatCtrlType::ThermostatOffsetPriority) { + if (state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) > 0.0) EnableSystem = true; + } else if ((SELECT_CASE_var == iThermostatCtrlType::ScheduledPriority) || (SELECT_CASE_var == iThermostatCtrlType::MasterThermostatPriority)) { } else { } } if (EnableSystem) { - if ((OutsideDryBulbTemp >= VRF(VRFCond).MinOATCooling && OutsideDryBulbTemp <= VRF(VRFCond).MaxOATCooling) && - any(TerminalUnitList(TUListIndex).CoolingCoilPresent)) { - CoolingLoad(VRFCond) = true; + if ((OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling && OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) && + any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).CoolingCoilPresent)) { + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; } else { - if (any(TerminalUnitList(TUListIndex).HeatingCoilAvailable)) { - if (VRF(VRFCond).HeatingMaxTempLimitIndex == 0) { - ShowWarningMessage(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + "\"."); + if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilAvailable)) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex == 0) { + ShowWarningMessage(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\"."); ShowContinueError(state, "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Heating Mode Limits have been " "exceeded and VRF system is disabled."); - if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { ShowContinueError(state, format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp)); } else { @@ -6612,26 +6503,26 @@ namespace HVACVariableRefrigerantFlow { format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp)); } ShowContinueError( - state, format("... Heating Minimum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MinOATHeating)); + state, format("... Heating Minimum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating)); ShowContinueError( - state, format("... Heating Maximum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MaxOATHeating)); + state, format("... Heating Maximum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating)); ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Heating Mode limits."); } ShowRecurringWarningErrorAtEnd(state, - cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\" -- Exceeded VRF Heat Pump min/max heating temperature limit error continues...", - VRF(VRFCond).HeatingMaxTempLimitIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex, OutsideDryBulbTemp, OutsideDryBulbTemp); } } } else { - if (any(TerminalUnitList(TUListIndex).HeatingCoilAvailable)) { - if (VRF(VRFCond).HeatingMaxTempLimitIndex == 0) { - ShowWarningMessage(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + "\"."); + if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HeatingCoilAvailable)) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex == 0) { + ShowWarningMessage(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\"."); ShowContinueError(state, "...InitVRF: VRF Heat Pump Min/Max Operating Temperature in Heating Mode Limits have been exceeded " "and VRF system is disabled."); - if (VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHVACGlobals::WaterCooled) { ShowContinueError(state, format("... Outdoor Unit Inlet Water Temperature = {:.3T}", OutsideDryBulbTemp)); } else { @@ -6639,14 +6530,14 @@ namespace HVACVariableRefrigerantFlow { format("... Outdoor Unit Inlet Air Temperature = {:.3T}", OutsideDryBulbTemp)); } ShowContinueError(state, - format("... Heating Minimum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MinOATHeating)); + format("... Heating Minimum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating)); ShowContinueError(state, - format("... Heating Maximum Outdoor Unit Inlet Temperature = {:.3T}", VRF(VRFCond).MaxOATHeating)); + format("... Heating Maximum Outdoor Unit Inlet Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating)); ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Heating Mode limits."); } - ShowRecurringWarningErrorAtEnd(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + + ShowRecurringWarningErrorAtEnd(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\" -- Exceeded VRF Heat Pump min/max heating temperature limit error continues...", - VRF(VRFCond).HeatingMaxTempLimitIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingMaxTempLimitIndex, OutsideDryBulbTemp, OutsideDryBulbTemp); } @@ -6657,51 +6548,51 @@ namespace HVACVariableRefrigerantFlow { } // IF (GetCurrentScheduleValue(state, VRF(VRFCond)%SchedPtr) .EQ. 0.0) THEN // initialize terminal unit flow rate - if (HeatingLoad(VRFCond) || (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - DataLoopNode::Node(OutsideAirNode).MassFlowRate = VRFTU(VRFTUNum).HeatOutAirMassFlow; + if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + DataLoopNode::Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; } else { - if (!VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; } - } else if (CoolingLoad(VRFCond) || (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - DataLoopNode::Node(OutsideAirNode).MassFlowRate = VRFTU(VRFTUNum).CoolOutAirMassFlow; + } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + DataLoopNode::Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; } else { - if (!VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = VRFTU(VRFTUNum).MaxCoolAirMassFlow; + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; } } else { - if (LastModeCooling(VRFCond)) { - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - DataLoopNode::Node(OutsideAirNode).MassFlowRate = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + DataLoopNode::Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; } else { - if (!VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; } - } else if (LastModeHeating(VRFCond)) { - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - DataLoopNode::Node(OutsideAirNode).MassFlowRate = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + DataLoopNode::Node(OutsideAirNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; } else { - if (!VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; } } } - if (VRFTU(VRFTUNum).ATMixerExists) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) { // There is an air terminal mixer - if (VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide) { // if there is an inlet side air terminal mixer + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_InletSide) { // if there is an inlet side air terminal mixer // set the primary air inlet mass flow rate - DataLoopNode::Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = - min(DataLoopNode::Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail, - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate); + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = + min(DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail, + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate); // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate has already // been set above (it is the "inlet" node flow rate) - SimATMixer(state, VRFTU(VRFTUNum).ATMixerName, FirstHVACIteration, VRFTU(VRFTUNum).ATMixerIndex); + SimATMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex); } } else { - if (VRFTU(VRFTUNum).OAMixerUsed) SimOAMixer(state, VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, VRFTU(VRFTUNum).OAMixerIndex); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); } OnOffAirFlowRatio = 1.0; @@ -6714,38 +6605,38 @@ namespace HVACVariableRefrigerantFlow { // TerminalUnitList(TUListIndex)%HRCoolRequest(IndexToTUInTUList) - TU will operate in this mode if heat recovery is used // TerminalUnitList(TUListIndex)%HRHeatRequest(IndexToTUInTUList) - TU will operate in this mode if heat recovery is used - getVRFTUZoneLoad(VRFTUNum, QZnReq, LoadToHeatingSP, LoadToCoolingSP, false); + getVRFTUZoneLoad(state, VRFTUNum, QZnReq, LoadToHeatingSP, LoadToCoolingSP, false); if (std::abs(QZnReq) < DataHVACGlobals::SmallLoad) QZnReq = 0.0; // set initial terminal unit operating mode for heat recovery // operating mode for non-heat recovery set above using CoolingLoad(VRFCond) or HeatingLoad(VRFCond) variables // first turn off terminal unit - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; // then set according to LoadToXXXXingSP variables if (LoadToCoolingSP < -1.0 * DataHVACGlobals::SmallLoad) { - if (CoolingLoad(VRFCond) || HeatingLoad(VRFCond)) { // don't allow heat recovery if control logic dictates unit is off - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) || state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { // don't allow heat recovery if control logic dictates unit is off + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; } } if (LoadToHeatingSP > DataHVACGlobals::SmallLoad) { - if (CoolingLoad(VRFCond) || HeatingLoad(VRFCond)) { // don't allow heat recovery if control logic dictates unit is off - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) || state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { // don't allow heat recovery if control logic dictates unit is off + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; } } if (LoadToCoolingSP > 0.0 && LoadToHeatingSP < 0.0) QZnReq = 0.0; // next check for overshoot when constant fan mode is used // check operating load to see if OA will overshoot setpoint temperature when constant fan mode is used - if ((VRFTU(VRFTUNum).OpMode == DataHVACGlobals::ContFanCycCoil || VRFTU(VRFTUNum).ATMixerExists) && !VRFTU(VRFTUNum).isSetPointControlled) { - SetCompFlowRate(VRFTUNum, VRFCond, true); + if ((state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode == DataHVACGlobals::ContFanCycCoil || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) && !state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) { + SetCompFlowRate(state, VRFTUNum, VRFCond, true); - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } // If the Terminal Unit has a net cooling capacity (TempOutput < 0) and @@ -6762,50 +6653,50 @@ namespace HVACVariableRefrigerantFlow { // If the net cooling capacity overshoots the heating setpoint count as heating load if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (TempControlType(VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint && - TempControlType(VRFTU(VRFTUNum).ZoneNum) != 0) { - if (!LastModeHeating(VRFCond)) { + if (TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint && + TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != 0) { + if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // system last operated in cooling mode, change air flows and repeat coil off capacity test - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = VRFTU(VRFTUNum).HeatOutAirMassFlow; - SimOAMixer(state, VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, VRFTU(VRFTUNum).OAMixerIndex); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); } else { - DataLoopNode::Node(InNode).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; + DataLoopNode::Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; } - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } // if zone temp will overshoot, pass the LoadToHeatingSP as the load to meet if (TempOutput < LoadToHeatingSP) { QZnReq = LoadToHeatingSP; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } } else { // last mode was heating, zone temp will overshoot heating setpoint, reset QznReq to LoadtoHeatingSP QZnReq = LoadToHeatingSP; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } } } else if (TempOutput > LoadToCoolingSP && LoadToCoolingSP < 0.0) { // If the net cooling capacity does not meet the zone cooling load enable cooling QZnReq = LoadToCoolingSP; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; } else if (TempOutput < LoadToCoolingSP && LoadToCoolingSP < 0.0) { // If the net cooling capacity meets the zone cooling load but does not overshoot heating setpoint QZnReq = 0.0; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } // If the terminal unit has a net heating capacity and the zone temp is below the Tstat cooling setpoint // see if the terminal unit operation will exceed the setpoint @@ -6813,119 +6704,119 @@ namespace HVACVariableRefrigerantFlow { // If the net heating capacity overshoots the cooling setpoint count as cooling load if (TempOutput > LoadToCoolingSP) { // Don't count as cooling load unless mode is allowed. Also check for floating zone. - if (TempControlType(VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleHeatingSetPoint && - TempControlType(VRFTU(VRFTUNum).ZoneNum) != 0) { - if (!LastModeCooling(VRFCond)) { - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = VRFTU(VRFTUNum).CoolOutAirMassFlow; - SimOAMixer(state, VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, VRFTU(VRFTUNum).OAMixerIndex); + if (TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleHeatingSetPoint && + TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != 0) { + if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); } else { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxCoolAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; } - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } // if zone temp will overshoot, pass the LoadToCoolingSP as the load to meet if (TempOutput > LoadToCoolingSP) { QZnReq = LoadToCoolingSP; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; } } else { QZnReq = LoadToCoolingSP; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; } } } else if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (TempControlType(VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint && - TempControlType(VRFTU(VRFTUNum).ZoneNum) != 0) { - if (!LastModeHeating(VRFCond)) { - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = VRFTU(VRFTUNum).HeatOutAirMassFlow; - SimOAMixer(state, VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, VRFTU(VRFTUNum).OAMixerIndex); + if (TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint && + TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != 0) { + if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); } else { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; } - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } // if zone temp will overshoot, pass the LoadToHeatingSP as the load to meet if (TempOutput < LoadToHeatingSP) { QZnReq = LoadToHeatingSP; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } } else { QZnReq = LoadToHeatingSP; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } } } else if (TempOutput > LoadToHeatingSP && TempOutput < LoadToCoolingSP) { // If the net capacity does not overshoot either setpoint QZnReq = 0.0; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } else { // If the net heating capacity meets the zone heating load but does not overshoot cooling setpoint QZnReq = 0.0; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } // If the terminal unit has a net heating capacity and the zone temp is above the Tstat cooling setpoint // see if the terminal unit operation will exceed the setpoint } else if (TempOutput > 0.0 && LoadToCoolingSP < 0.0) { // If the net heating capacity overshoots the cooling setpoint count as cooling load // Don't count as cooling load unless mode is allowed. Also check for floating zone. - if (TempControlType(VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleHeatingSetPoint && - TempControlType(VRFTU(VRFTUNum).ZoneNum) != 0) { - if (!LastModeCooling(VRFCond)) { - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = VRFTU(VRFTUNum).CoolOutAirMassFlow; - SimOAMixer(state, VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, VRFTU(VRFTUNum).OAMixerIndex); + if (TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleHeatingSetPoint && + TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != 0) { + if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); } else { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxCoolAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; } - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } // if zone temp will overshoot, pass the LoadToCoolingSP as the load to meet if (TempOutput > LoadToCoolingSP) { QZnReq = LoadToCoolingSP; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; } // last mode was cooling, zone temp will overshoot cooling setpoint, reset QznReq to LoadtoCoolingSP } else { QZnReq = LoadToCoolingSP; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; } } // If the Terminal Unit has a net cooling capacity (TempOutput < 0) and @@ -6933,179 +6824,179 @@ namespace HVACVariableRefrigerantFlow { // see if the terminal unit operation will exceed the setpoint } else if (TempOutput < 0.0 && LoadToHeatingSP > 0.0) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (TempControlType(VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint && - TempControlType(VRFTU(VRFTUNum).ZoneNum) != 0) { - if (!LastModeHeating(VRFCond)) { + if (TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint && + TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != 0) { + if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // system last operated in cooling mode, change air flows and repeat coil off capacity test - if (VRFTU(VRFTUNum).OAMixerUsed) { - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = VRFTU(VRFTUNum).HeatOutAirMassFlow; - SimOAMixer(state, VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, VRFTU(VRFTUNum).OAMixerIndex); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); } else { - DataLoopNode::Node(InNode).MassFlowRate = VRFTU(VRFTUNum).MaxHeatAirMassFlow; + DataLoopNode::Node(InNode).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; } - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } // if zone temp will overshoot, pass the LoadToHeatingSP as the load to meet if (TempOutput < LoadToHeatingSP) { QZnReq = LoadToHeatingSP; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } } else { // last mode was heating, zone temp will overshoot heating setpoint, reset QznReq to LoadtoHeatingSP QZnReq = LoadToHeatingSP; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } } } // test that the system is active if constant fan logic enables system when thermostat control logic did not - if (!CoolingLoad(VRFCond) && !HeatingLoad(VRFCond)) { - if (TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) && OutsideDryBulbTemp >= VRF(VRFCond).MinOATCooling && - OutsideDryBulbTemp <= VRF(VRFCond).MaxOATCooling) { - CoolingLoad(VRFCond) = true; - } else if (TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) && OutsideDryBulbTemp >= VRF(VRFCond).MinOATHeating && - OutsideDryBulbTemp <= VRF(VRFCond).MaxOATHeating) { - HeatingLoad(VRFCond) = true; + if (!state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && !state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) && OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling && + OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) { + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; + } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) && OutsideDryBulbTemp >= state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating && + OutsideDryBulbTemp <= state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; } } } // IF(VRFTU(VRFTUNum)%OpMode == DataHVACGlobals::ContFanCycCoil)THEN - if (VRF(VRFCond).HeatRecoveryUsed) { - if (OutsideDryBulbTemp < VRF(VRFCond).MinOATHeatRecovery || OutsideDryBulbTemp > VRF(VRFCond).MaxOATHeatRecovery) { - if ((any(TerminalUnitList(TUListIndex).HRCoolRequest) && HeatingLoad(VRFCond)) || - (any(TerminalUnitList(TUListIndex).HRHeatRequest) && CoolingLoad(VRFCond))) { - if (VRF(VRFCond).HRMaxTempLimitIndex == 0) { - ShowWarningMessage(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + "\"."); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) { + if (OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeatRecovery || OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeatRecovery) { + if ((any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest) && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) || + (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest) && state.dataHVACVarRefFlow->CoolingLoad(VRFCond))) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).HRMaxTempLimitIndex == 0) { + ShowWarningMessage(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\"."); ShowContinueError(state, "...InitVRF: VRF Heat Pump Min/Max Outdoor Temperature in Heat Recovery Mode Limits have been exceeded and " "VRF heat recovery is disabled."); ShowContinueError(state, format("... Outdoor Dry-Bulb Temperature = {:.3T}", OutsideDryBulbTemp)); ShowContinueError(state, - format("... Heat Recovery Minimum Outdoor Dry-Bulb Temperature = {:.3T}", VRF(VRFCond).MinOATHeatRecovery)); + format("... Heat Recovery Minimum Outdoor Dry-Bulb Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeatRecovery)); ShowContinueError(state, - format("... Heat Recovery Maximum Outdoor Dry-Bulb Temperature = {:.3T}", VRF(VRFCond).MaxOATHeatRecovery)); + format("... Heat Recovery Maximum Outdoor Dry-Bulb Temperature = {:.3T}", state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeatRecovery)); ShowContinueErrorTimeStamp(state, "... Check VRF Heat Pump Min/Max Outdoor Temperature in Heat Recovery Mode limits."); ShowContinueError(state, "...the system will operate in heat pump mode when applicable."); } - ShowRecurringWarningErrorAtEnd(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + + ShowRecurringWarningErrorAtEnd(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\" -- Exceeded VRF Heat Recovery min/max outdoor temperature limit error continues...", - VRF(VRFCond).HRMaxTempLimitIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).HRMaxTempLimitIndex, OutsideDryBulbTemp, OutsideDryBulbTemp); } // Allow heat pump mode to operate if within limits - if (OutsideDryBulbTemp < VRF(VRFCond).MinOATCooling || OutsideDryBulbTemp > VRF(VRFCond).MaxOATCooling) { + if (OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATCooling || OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATCooling) { // Disable cooling mode only, heating model will still be allowed - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } - if (OutsideDryBulbTemp < VRF(VRFCond).MinOATHeating || OutsideDryBulbTemp > VRF(VRFCond).MaxOATHeating) { + if (OutsideDryBulbTemp < state.dataHVACVarRefFlow->VRF(VRFCond).MinOATHeating || OutsideDryBulbTemp > state.dataHVACVarRefFlow->VRF(VRFCond).MaxOATHeating) { // Disable heating mode only, cooling model will still be allowed - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; } } } else { - TerminalUnitList(TUListIndex).HRHeatRequest = false; - TerminalUnitList(TUListIndex).HRCoolRequest = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest = false; } // Override operating mode when using EMS // this logic seems suspect, uses a "just run it on" mentality. Nee to test using EMS. - if (VRF(VRFCond).EMSOverrideHPOperatingMode) { - if (VRF(VRFCond).EMSValueForHPOperatingMode == 0.0) { // Off - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; - } else if (VRF(VRFCond).EMSValueForHPOperatingMode == 1.0) { // Cooling - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = true; + if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSOverrideHPOperatingMode) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode == 0.0) { // Off + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode == 1.0) { // Cooling + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; QZnReq = LoadToCoolingSP; - if (VRF(VRFCond).HeatRecoveryUsed) { - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) { + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = true; } - } else if (VRF(VRFCond).EMSValueForHPOperatingMode == 2.0) { // Heating - HeatingLoad(VRFCond) = true; - CoolingLoad(VRFCond) = false; + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode == 2.0) { // Heating + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; QZnReq = LoadToHeatingSP; - if (VRF(VRFCond).HeatRecoveryUsed) { - TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; - TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) { + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList) = true; + state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList) = false; } } else { - if (VRF(VRFCond).HPOperatingModeErrorIndex == 0) { - ShowWarningMessage(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + "\"."); - ShowContinueError(state, format("...InitVRF: Illegal HP operating mode = {:.0T}", VRF(VRFCond).EMSValueForHPOperatingMode)); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HPOperatingModeErrorIndex == 0) { + ShowWarningMessage(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\"."); + ShowContinueError(state, format("...InitVRF: Illegal HP operating mode = {:.0T}", state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode)); ShowContinueError(state, "...InitVRF: VRF HP operating mode will not be controlled by EMS."); } - ShowRecurringWarningErrorAtEnd(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + " \"" + VRF(VRFCond).Name + + ShowRecurringWarningErrorAtEnd(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + " \"" + state.dataHVACVarRefFlow->VRF(VRFCond).Name + "\" -- Illegal HP operating mode error continues...", - VRF(VRFCond).HPOperatingModeErrorIndex, - VRF(VRFCond).EMSValueForHPOperatingMode, - VRF(VRFCond).EMSValueForHPOperatingMode); + state.dataHVACVarRefFlow->VRF(VRFCond).HPOperatingModeErrorIndex, + state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode, + state.dataHVACVarRefFlow->VRF(VRFCond).EMSValueForHPOperatingMode); } } // set the TU flow rate. Check for heat recovery operation first, these will be FALSE if HR is not used. - if (TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; - } else if (TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).HeatOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).HeatingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; - } else if (CoolingLoad(VRFCond) && QZnReq != 0.0) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; - } else if (HeatingLoad(VRFCond) && QZnReq != 0.0) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).HeatOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).HeatingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && QZnReq != 0.0) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && QZnReq != 0.0) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; } else { - if (LastModeCooling(VRFCond)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; + if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; } - if (LastModeHeating(VRFCond)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).HeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; + if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; } - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; } - if (VRFTU(VRFTUNum).OpMode == DataHVACGlobals::CycFanCycCoil) { - CompOffMassFlow = 0.0; - OACompOffMassFlow = 0.0; - CompOffFlowRatio = 0.0; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode == DataHVACGlobals::CycFanCycCoil) { + state.dataHVACVarRefFlow->CompOffMassFlow = 0.0; + state.dataHVACVarRefFlow->OACompOffMassFlow = 0.0; + state.dataHVACVarRefFlow->CompOffFlowRatio = 0.0; } SetAverageAirFlow(state, VRFTUNum, 0.0, OnOffAirFlowRatio); @@ -7117,7 +7008,7 @@ namespace HVACVariableRefrigerantFlow { } } - void SetCompFlowRate(int const VRFTUNum, int const VRFCond, Optional_bool_const UseCurrentMode) + void SetCompFlowRate(EnergyPlusData &state, int const VRFTUNum, int const VRFCond, Optional_bool_const UseCurrentMode) { // SUBROUTINE INFORMATION: @@ -7139,8 +7030,8 @@ namespace HVACVariableRefrigerantFlow { int IndexToTUInTUList; // - index to TU in specific list for this VRF system int TUListIndex; // index to TU list for this VRF system - IndexToTUInTUList = VRFTU(VRFTUNum).IndexToTUInTUList; - TUListIndex = VRFTU(VRFTUNum).TUListIndex; + IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; + TUListIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; if (present(UseCurrentMode)) { CurrentMode = UseCurrentMode; } else { @@ -7148,86 +7039,86 @@ namespace HVACVariableRefrigerantFlow { } // uses current operating mode to set flow rate (after mode is set) - if (TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; - } else if (TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).HeatOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).HeatingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + } else if (state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; } else if (CurrentMode) { // uses current operating mode to set flow rate (after mode is set) - if (CoolingLoad(VRFCond)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; - } else if (HeatingLoad(VRFCond)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).HeatOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).HeatingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; - } else if (LastModeCooling(VRFCond)) { // if NOT cooling or heating then use last mode - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; - } else if (LastModeHeating(VRFCond)) { // if NOT cooling or heating then use last mode - CompOnMassFlow = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).HeatOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).HeatingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; + } else if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { // if NOT cooling or heating then use last mode + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // if NOT cooling or heating then use last mode + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; } else { // should not happen so just set to cooling flow rate - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; } } else { // uses previous operating mode to set flow rate (used for looping through each TU in Init before mode is set) - if (LastModeCooling(VRFCond)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; - } else if (LastModeHeating(VRFCond)) { - CompOnMassFlow = VRFTU(VRFTUNum).MaxHeatAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).HeatOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).HeatingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoHeatingSpeedRatio; + if (state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; + } else if (state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoHeatingSpeedRatio; } else { // should not happen so just set to cooling flow rate - CompOnMassFlow = VRFTU(VRFTUNum).MaxCoolAirMassFlow; - CompOffMassFlow = VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; - OACompOnMassFlow = VRFTU(VRFTUNum).CoolOutAirMassFlow; - OACompOffMassFlow = VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; - CompOnFlowRatio = VRFTU(VRFTUNum).CoolingSpeedRatio; - CompOffFlowRatio = VRFTU(VRFTUNum).NoCoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirMassFlow; + state.dataHVACVarRefFlow->OACompOnMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirMassFlow; + state.dataHVACVarRefFlow->OACompOffMassFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirMassFlow; + state.dataHVACVarRefFlow->CompOnFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingSpeedRatio; + state.dataHVACVarRefFlow->CompOffFlowRatio = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolingSpeedRatio; } } - if (VRFTU(VRFTUNum).OpMode == DataHVACGlobals::CycFanCycCoil) { - CompOffMassFlow = 0.0; - OACompOffMassFlow = 0.0; - CompOffFlowRatio = 0.0; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode == DataHVACGlobals::CycFanCycCoil) { + state.dataHVACVarRefFlow->CompOffMassFlow = 0.0; + state.dataHVACVarRefFlow->OACompOffMassFlow = 0.0; + state.dataHVACVarRefFlow->CompOffFlowRatio = 0.0; } } @@ -7343,7 +7234,7 @@ namespace HVACVariableRefrigerantFlow { EqSizing.DesHeatingLoad = 0.0; EqSizing.OAVolFlow = 0.0; - VRFCond = VRFTU(VRFTUNum).VRFSysNum; + VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; IsAutoSize = false; MaxCoolAirVolFlowDes = 0.0; MaxCoolAirVolFlowUser = 0.0; @@ -7378,70 +7269,70 @@ namespace HVACVariableRefrigerantFlow { DataFracOfAutosizedHeatingCapacity = 1.0; SuppHeatCap = 0.0; - if (MyOneTimeSizeFlag) { + if (state.dataHVACVarRefFlow->MyOneTimeSizeFlag) { // initialize the environment and sizing flags - CheckVRFCombinationRatio.dimension(NumVRFCond, true); - MyOneTimeSizeFlag = false; + CheckVRFCombinationRatio.dimension(state.dataHVACVarRefFlow->NumVRFCond, true); + state.dataHVACVarRefFlow->MyOneTimeSizeFlag = false; } - CompType = DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num); - CompName = VRFTU(VRFTUNum).Name; - DataZoneNumber = VRFTU(VRFTUNum).ZoneNum; + CompType = DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num); + CompName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name; + DataZoneNumber = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum; - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - if (VRFTU(VRFTUNum).isInZone) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { DataSizing::DataFanEnumType = DataAirSystems::objectVectorOOFanSystemModel; - DataSizing::DataFanIndex = VRFTU(VRFTUNum).FanIndex; - if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { + DataSizing::DataFanIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { DataSizing::DataFanPlacement = DataSizing::zoneFanPlacement::zoneBlowThru; - } else if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { DataSizing::DataFanPlacement = DataSizing::zoneFanPlacement::zoneDrawThru; } - } else if (VRFTU(VRFTUNum).isInAirLoop) { - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanModelTypeEnum = DataAirSystems::objectVectorOOFanSystemModel; - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanVecIndex = VRFTU(VRFTUNum).FanIndex; - if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::BlowThru; - } else if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::DrawThru; + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) { + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanModelTypeEnum = DataAirSystems::objectVectorOOFanSystemModel; + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanVecIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::BlowThru; + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::DrawThru; } } - } else if (VRFTU(VRFTUNum).FanIndex > 0) { - if (VRFTU(VRFTUNum).isInZone) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { DataSizing::DataFanEnumType = DataAirSystems::structArrayLegacyFanModels; - DataSizing::DataFanIndex = VRFTU(VRFTUNum).FanIndex; - if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { + DataSizing::DataFanIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { DataSizing::DataFanPlacement = DataSizing::zoneFanPlacement::zoneBlowThru; - } else if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { DataSizing::DataFanPlacement = DataSizing::zoneFanPlacement::zoneDrawThru; } - } else if (VRFTU(VRFTUNum).isInAirLoop) { - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanVecIndex = VRFTU(VRFTUNum).FanIndex; - if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::BlowThru; - } else if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { - state.dataAirSystemsData->PrimaryAirSystems(VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::DrawThru; + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) { + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanVecIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::BlowThru; + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::DrawThru) { + state.dataAirSystemsData->PrimaryAirSystems(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).airLoopNum).supFanLocation = DataAirSystems::fanPlacement::DrawThru; } } } - if (VRFTU(VRFTUNum).HVACSizingIndex > 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex > 0) { // initialize OA flow for sizing other inputs (e.g., capacity) - if (VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) { EqSizing.OAVolFlow = FinalZoneSizing(CurZoneEqNum).MinOA; } else { - EqSizing.OAVolFlow = VRFTU(VRFTUNum).CoolOutAirVolFlow; + EqSizing.OAVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow; } - if (VRFTU(VRFTUNum).HeatOutAirVolFlow != AutoSize) { - EqSizing.OAVolFlow = max(EqSizing.OAVolFlow, VRFTU(VRFTUNum).HeatOutAirVolFlow); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow != AutoSize) { + EqSizing.OAVolFlow = max(EqSizing.OAVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); } - if (VRFTU(VRFTUNum).ATMixerExists && VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for scalable capacity sizing + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for scalable capacity sizing EqSizing.OAVolFlow = 0.0; // Equipment OA flow should always be 0 when ATMixer is used - SingleDuct::setATMixerSizingProperties(state, VRFTU(VRFTUNum).ATMixerIndex, VRFTU(VRFTUNum).ZoneNum, CurZoneEqNum); + SingleDuct::setATMixerSizingProperties(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum, CurZoneEqNum); } - zoneHVACIndex = VRFTU(VRFTUNum).HVACSizingIndex; + zoneHVACIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HVACSizingIndex; SizingMethod = CoolingAirflowSizing; PrintFlag = true; @@ -7474,7 +7365,7 @@ namespace HVACVariableRefrigerantFlow { sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == FlowPerCoolingCapacity) { SizingMethod = CoolingCapacitySizing; @@ -7498,13 +7389,13 @@ namespace HVACVariableRefrigerantFlow { sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } SizingMethod = HeatingAirflowSizing; FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation PrintFlag = true; - SizingString = VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; SAFMethod = ZoneHVACSizing(zoneHVACIndex).HeatingSAFMethod; EqSizing.SizingMethod(SizingMethod) = SAFMethod; if (SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || SAFMethod == FractionOfAutosizedHeatingAirflow) { @@ -7531,7 +7422,7 @@ namespace HVACVariableRefrigerantFlow { sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == FlowPerHeatingCapacity) { SizingMethod = HeatingCapacitySizing; TempSize = AutoSize; @@ -7555,7 +7446,7 @@ namespace HVACVariableRefrigerantFlow { sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } PrintFlag = true; @@ -7593,13 +7484,13 @@ namespace HVACVariableRefrigerantFlow { sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } SizingMethod = HeatingAirflowSizing; FieldNum = 4; // N4, \field Supply Air Flow Rate When No Heating is Needed PrintFlag = true; - SizingString = VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; SAFMethod = ZoneHVACSizing(zoneHVACIndex).NoCoolHeatSAFMethod; EqSizing.SizingMethod(SizingMethod) = SAFMethod; if ((SAFMethod == SupplyAirFlowRate) || (SAFMethod == FlowPerFloorArea) || (SAFMethod == FractionOfAutosizedHeatingAirflow) || @@ -7633,7 +7524,7 @@ namespace HVACVariableRefrigerantFlow { sizingNoHeatingAirFlow.overrideSizingString(SizingString); // sizingNoHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingNoHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = sizingNoHeatingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = sizingNoHeatingAirFlow.size(state, TempSize, errorsFound); } // initialize capacity sizing variables: cooling @@ -7683,7 +7574,7 @@ namespace HVACVariableRefrigerantFlow { PrintFlag = true; - TempSize = VRFTU(VRFTUNum).MaxCoolAirVolFlow; + TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; bool errorsFound = false; CoolingAirFlowSizer sizingCoolingAirFlow; std::string stringOverride = "Cooling Supply Air Flow Rate [m3/s]"; @@ -7691,62 +7582,62 @@ namespace HVACVariableRefrigerantFlow { sizingCoolingAirFlow.overrideSizingString(stringOverride); // sizingCoolingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation - SizingString = VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; SizingMethod = HeatingAirflowSizing; - TempSize = VRFTU(VRFTUNum).MaxHeatAirVolFlow; + TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); errorsFound = false; SystemAirFlowSizer sizerSystemAirFlow; std::string sizingString = "No Cooling Supply Air Flow Rate [m3/s]"; sizerSystemAirFlow.overrideSizingString(sizingString); sizerSystemAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = sizerSystemAirFlow.size(state, VRFTU(VRFTUNum).MaxNoCoolAirVolFlow, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow = sizerSystemAirFlow.size(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoCoolAirVolFlow, errorsFound); SystemAirFlowSizer sizerSystemAirFlow2; sizingString = "No Heating Supply Air Flow Rate [m3/s]"; sizerSystemAirFlow2.overrideSizingString(sizingString); sizerSystemAirFlow2.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = sizerSystemAirFlow2.size(state, VRFTU(VRFTUNum).MaxNoHeatAirVolFlow, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow = sizerSystemAirFlow2.size(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxNoHeatAirVolFlow, errorsFound); } IsAutoSize = false; - if (VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { // Simulation continue - if (VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) { - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) { + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]", - VRFTU(VRFTUNum).CoolOutAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); } } else { - CheckZoneSizing(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), VRFTU(VRFTUNum).Name); - CoolOutAirVolFlowDes = min(FinalZoneSizing(CurZoneEqNum).MinOA, VRFTU(VRFTUNum).MaxCoolAirVolFlow); + CheckZoneSizing(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); + CoolOutAirVolFlowDes = min(FinalZoneSizing(CurZoneEqNum).MinOA, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow); if (CoolOutAirVolFlowDes < DataHVACGlobals::SmallAirVolFlow) { CoolOutAirVolFlowDes = 0.0; } if (IsAutoSize) { - VRFTU(VRFTUNum).CoolOutAirVolFlow = CoolOutAirVolFlowDes; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = CoolOutAirVolFlowDes; + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]", CoolOutAirVolFlowDes); } else { - if (VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 && CoolOutAirVolFlowDes > 0.0) { - CoolOutAirVolFlowUser = VRFTU(VRFTUNum).CoolOutAirVolFlow; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 && CoolOutAirVolFlowDes > 0.0) { + CoolOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow; + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]", CoolOutAirVolFlowDes, "User-Specified Outdoor Air Flow Rate During Cooling Operation [m3/s]", @@ -7754,7 +7645,7 @@ namespace HVACVariableRefrigerantFlow { if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(CoolOutAirVolFlowDes - CoolOutAirVolFlowUser) / CoolOutAirVolFlowUser) > AutoVsHardSizingThreshold) { ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + - DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ' ' + VRFTU(VRFTUNum).Name); + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ' ' + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError( state, format("User-Specified Outdoor Air Flow Rate During Cooling Operation of {:.5R} [m3/s]", CoolOutAirVolFlowUser)); @@ -7769,49 +7660,49 @@ namespace HVACVariableRefrigerantFlow { } } } else { - if (VRFTU(VRFTUNum).CoolOutAirVolFlow == DataSizing::AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow == DataSizing::AutoSize) { if (state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).OASysExists) { - VRFTU(VRFTUNum).CoolOutAirVolFlow = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = 0.0; } else { - VRFTU(VRFTUNum).CoolOutAirVolFlow = min(FinalSysSizing(CurSysNum).DesOutAirVolFlow, VRFTU(VRFTUNum).MaxCoolAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow = min(FinalSysSizing(CurSysNum).DesOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow); } - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate During Cooling Operation [m3/s]", - VRFTU(VRFTUNum).CoolOutAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); } } IsAutoSize = false; - if (VRFTU(VRFTUNum).HeatOutAirVolFlow == AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow == AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { // Simulation continue - if (VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) { - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0) { + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Outdoor Air Flow Rate During Heating Operation [m3/s]", - VRFTU(VRFTUNum).CoolOutAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); } } else { - CheckZoneSizing(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), VRFTU(VRFTUNum).Name); - HeatOutAirVolFlowDes = min(FinalZoneSizing(CurZoneEqNum).MinOA, VRFTU(VRFTUNum).MaxHeatAirVolFlow); + CheckZoneSizing(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); + HeatOutAirVolFlowDes = min(FinalZoneSizing(CurZoneEqNum).MinOA, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow); if (HeatOutAirVolFlowDes < DataHVACGlobals::SmallAirVolFlow) { HeatOutAirVolFlowDes = 0.0; } if (IsAutoSize) { - VRFTU(VRFTUNum).HeatOutAirVolFlow = HeatOutAirVolFlowDes; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = HeatOutAirVolFlowDes; + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]", HeatOutAirVolFlowDes); } else { - if (VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0 && HeatOutAirVolFlowDes > 0.0) { - HeatOutAirVolFlowUser = VRFTU(VRFTUNum).HeatOutAirVolFlow; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0 && HeatOutAirVolFlowDes > 0.0) { + HeatOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow; + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]", HeatOutAirVolFlowDes, "User-Specified Outdoor Air Flow Rate During Heating Operation [m3/s]", @@ -7819,7 +7710,7 @@ namespace HVACVariableRefrigerantFlow { if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(HeatOutAirVolFlowDes - HeatOutAirVolFlowUser) / HeatOutAirVolFlowUser) > AutoVsHardSizingThreshold) { ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + - DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ' ' + VRFTU(VRFTUNum).Name); + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ' ' + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError( state, format("User-Specified Outdoor Air Flow Rate During Heating Operation of {:.5R} [m3/s]", HeatOutAirVolFlowUser)); @@ -7834,56 +7725,56 @@ namespace HVACVariableRefrigerantFlow { } } } else { - if (VRFTU(VRFTUNum).HeatOutAirVolFlow == DataSizing::AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow == DataSizing::AutoSize) { if (state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).OASysExists) { - VRFTU(VRFTUNum).HeatOutAirVolFlow = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = 0.0; } else { - VRFTU(VRFTUNum).HeatOutAirVolFlow = min(FinalSysSizing(CurSysNum).DesOutAirVolFlow, VRFTU(VRFTUNum).MaxHeatAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow = min(FinalSysSizing(CurSysNum).DesOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow); } - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate During Heating Operation [m3/s]", - VRFTU(VRFTUNum).HeatOutAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); } } - EqSizing.OAVolFlow = max(VRFTU(VRFTUNum).CoolOutAirVolFlow, VRFTU(VRFTUNum).HeatOutAirVolFlow); + EqSizing.OAVolFlow = max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); - if (VRFTU(VRFTUNum).ATMixerExists && VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for use in component sizing + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) { // set up ATMixer conditions for use in component sizing EqSizing.OAVolFlow = 0.0; // Equipment OA flow should always be 0 when ATMixer is used - SingleDuct::setATMixerSizingProperties(state, VRFTU(VRFTUNum).ATMixerIndex, VRFTU(VRFTUNum).ZoneNum, CurZoneEqNum); + SingleDuct::setATMixerSizingProperties(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerIndex, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum, CurZoneEqNum); } IsAutoSize = false; - if (VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { // Simulation continue - if (VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0) { - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0) { + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow); } } else { - CheckZoneSizing(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), VRFTU(VRFTUNum).Name); + CheckZoneSizing(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); NoCoolHeatOutAirVolFlowDes = - min(FinalZoneSizing(CurZoneEqNum).MinOA, VRFTU(VRFTUNum).HeatOutAirVolFlow, VRFTU(VRFTUNum).CoolOutAirVolFlow); + min(FinalZoneSizing(CurZoneEqNum).MinOA, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow); if (NoCoolHeatOutAirVolFlowDes < DataHVACGlobals::SmallAirVolFlow) { NoCoolHeatOutAirVolFlowDes = 0.0; } if (IsAutoSize) { - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = NoCoolHeatOutAirVolFlowDes; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = NoCoolHeatOutAirVolFlowDes; + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", NoCoolHeatOutAirVolFlowDes); } else { - if (VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0 && NoCoolHeatOutAirVolFlowDes > 0.0) { - NoCoolHeatOutAirVolFlowUser = VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow > 0.0 && NoCoolHeatOutAirVolFlowDes > 0.0) { + NoCoolHeatOutAirVolFlowUser = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", NoCoolHeatOutAirVolFlowDes, "User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed [m3/s]", @@ -7892,7 +7783,7 @@ namespace HVACVariableRefrigerantFlow { if ((std::abs(NoCoolHeatOutAirVolFlowDes - NoCoolHeatOutAirVolFlowUser) / NoCoolHeatOutAirVolFlowUser) > AutoVsHardSizingThreshold) { ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + - DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num) + ' ' + VRFTU(VRFTUNum).Name); + DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num) + ' ' + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name); ShowContinueError(state, format("User-Specified Outdoor Air Flow Rate When No Cooling or Heating is Needed of {:.5R} [m3/s]", NoCoolHeatOutAirVolFlowUser)); @@ -7908,42 +7799,42 @@ namespace HVACVariableRefrigerantFlow { } } } else { - if (VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow == DataSizing::AutoSize) { if (state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).OASysExists) { - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = 0.0; } else { - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = min(VRFTU(VRFTUNum).MaxCoolAirVolFlow, VRFTU(VRFTUNum).MaxHeatAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow = min(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow); } - BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(VRFTU(VRFTUNum).VRFTUType_Num), - VRFTU(VRFTUNum).Name, + BaseSizer::reportSizerOutput(state, DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUType_Num), + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, "Design Size Outdoor Air Flow Rate When No Cooling or Heating Heating is Needed [m3/s]", - VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow); } } - if (VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { bool ErrorsFound = false; - TempSize = VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil; + TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil; MaxHeaterOutletTempSizer sizerMaxHeaterOutTemp; std::string stringOverride = "Maximum Supply Air Temperature from Supplemental Heater [C]"; if (state.dataGlobal->isEpJSON) stringOverride = "maximum_supply_air_temperature_from_supplemental_heater [C]"; sizerMaxHeaterOutTemp.overrideSizingString(stringOverride); sizerMaxHeaterOutTemp.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil = sizerMaxHeaterOutTemp.size(state, TempSize, ErrorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxSATFromSuppHeatCoil = sizerMaxHeaterOutTemp.size(state, TempSize, ErrorsFound); } - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { bool ErrorsFound = false; WaterCoils::SetCoilDesFlow( - state, VRFTU(VRFTUNum).SuppHeatCoilType, VRFTU(VRFTUNum).SuppHeatCoilName, VRFTU(VRFTUNum).MaxHeatAirVolFlow, ErrorsFound); + state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow, ErrorsFound); } - if (VRFTU(VRFTUNum).SuppHeatingCoilPresent) { - CompType = VRFTU(VRFTUNum).SuppHeatCoilType; - CompName = VRFTU(VRFTUNum).SuppHeatCoilName; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatingCoilPresent) { + CompType = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType; + CompName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName; PrintFlag = false; // why isn't this being reported? - TempSize = VRFTU(VRFTUNum).DesignSuppHeatingCapacity; - if (VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { + TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { // sizing result should always be reported if (TempSize == DataSizing::AutoSize) { WaterHeatingCapacitySizer sizerWaterHeatingCapacity; @@ -7952,7 +7843,7 @@ namespace HVACVariableRefrigerantFlow { if (state.dataGlobal->isEpJSON) stringOverride = "supplemental_heating_coil_nominal_capacity [W]"; sizerWaterHeatingCapacity.overrideSizingString(stringOverride); sizerWaterHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerWaterHeatingCapacity.size(state, TempSize, ErrorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerWaterHeatingCapacity.size(state, TempSize, ErrorsFound); } } else { SizingMethod = DataHVACGlobals::HeatingCapacitySizing; @@ -7963,23 +7854,23 @@ namespace HVACVariableRefrigerantFlow { HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).DesignSuppHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); } } } EqSizing.CoolingAirFlow = true; - EqSizing.CoolingAirVolFlow = VRFTU(VRFTUNum).MaxCoolAirVolFlow; + EqSizing.CoolingAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxCoolAirVolFlow; EqSizing.HeatingAirFlow = true; - EqSizing.HeatingAirVolFlow = VRFTU(VRFTUNum).MaxHeatAirVolFlow; + EqSizing.HeatingAirVolFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; if (CheckVRFCombinationRatio(VRFCond)) { OnOffAirFlowRat = 1.0; // set up the outside air data for sizing the DX coils - if (VRFTU(VRFTUNum).isInZone) ZoneEqDXCoil = true; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone) ZoneEqDXCoil = true; if (CurZoneEqNum > 0) { - if (VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 || VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0) { - EqSizing.OAVolFlow = max(VRFTU(VRFTUNum).CoolOutAirVolFlow, VRFTU(VRFTUNum).HeatOutAirVolFlow); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow > 0.0 || state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow > 0.0) { + EqSizing.OAVolFlow = max(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolOutAirVolFlow, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatOutAirVolFlow); } else { EqSizing.OAVolFlow = 0.0; } @@ -7989,31 +7880,31 @@ namespace HVACVariableRefrigerantFlow { Real64 SuppHeatCoilLoad = 0.0; // simulate the TU to size the coils - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, true, 0.0, TUCoolingCapacity, OnOffAirFlowRat, SuppHeatCoilLoad); } // ZoneEqDXCoil = .FALSE. TUCoolingCapacity = 0.0; TUHeatingCapacity = 0.0; FoundAll = true; - TUListNum = VRFTU(VRFTUNum).TUListIndex; - for (NumTU = 1; NumTU <= TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - if (VRFTU(TUIndex).CoolCoilIndex > 0) { - DXCoilCap = GetDXCoilCap(state, VRFTU(TUIndex).CoolCoilIndex, VRFTU(TUIndex).DXCoolCoilType_Num, errFlag); + TUListNum = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex; + for (NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex > 0) { + DXCoilCap = GetDXCoilCap(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex, state.dataHVACVarRefFlow->VRFTU(TUIndex).DXCoolCoilType_Num, errFlag); TUCoolingCapacity += DXCoilCap; if (DXCoilCap == AutoSize) { FoundAll = false; break; } } - if (VRFTU(TUIndex).HeatCoilIndex > 0) { - DXCoilCap = GetDXCoilCap(state, VRFTU(TUIndex).HeatCoilIndex, VRFTU(TUIndex).DXHeatCoilType_Num, errFlag); + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex > 0) { + DXCoilCap = GetDXCoilCap(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex, state.dataHVACVarRefFlow->VRFTU(TUIndex).DXHeatCoilType_Num, errFlag); TUHeatingCapacity += DXCoilCap; if (DXCoilCap == AutoSize) { FoundAll = false; @@ -8022,34 +7913,34 @@ namespace HVACVariableRefrigerantFlow { } } - if (FoundAll && (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeSysCurve)) { + if (FoundAll && (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::SysCurve)) { // Size VRF rated cooling/heating capacity (VRF-SysCurve Model) // Size VRF( VRFCond ).CoolingCapacity IsAutoSize = false; - if (VRF(VRFCond).CoolingCapacity == AutoSize) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity == AutoSize) { IsAutoSize = true; } CoolingCapacityDes = TUCoolingCapacity; if (IsAutoSize) { - VRF(VRFCond).CoolingCapacity = CoolingCapacityDes; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity = CoolingCapacityDes; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Cooling Capacity (gross) [W]", CoolingCapacityDes); } else { - if (VRF(VRFCond).CoolingCapacity > 0.0 && CoolingCapacityDes > 0.0) { - CoolingCapacityUser = VRF(VRFCond).CoolingCapacity; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity > 0.0 && CoolingCapacityDes > 0.0) { + CoolingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Cooling Capacity (gross) [W]", CoolingCapacityDes, "User-Specified Rated Total Cooling Capacity (gross) [W]", CoolingCapacityUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(CoolingCapacityDes - CoolingCapacityUser) / CoolingCapacityUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + ' ' + - VRFTU(VRFCond).Name); + ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + ' ' + + state.dataHVACVarRefFlow->VRFTU(VRFCond).Name); ShowContinueError(state, format("User-Specified Rated Total Cooling Capacity (gross) of {:.2R} [W]", CoolingCapacityUser)); ShowContinueError( @@ -8061,39 +7952,39 @@ namespace HVACVariableRefrigerantFlow { } } - if (VRF(VRFCond).CoolingCapacity > 0.0) { - VRF(VRFCond).CoolingCombinationRatio = TUCoolingCapacity / VRF(VRFCond).CoolingCapacity; + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio = TUCoolingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity; } // Size VRF( VRFCond ).HeatingCapacity IsAutoSize = false; - if (VRF(VRFCond).HeatingCapacity == AutoSize) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity == AutoSize) { IsAutoSize = true; } - if (VRF(VRFCond).LockHeatingCapacity) { - HeatingCapacityDes = VRF(VRFCond).CoolingCapacity * VRF(VRFCond).HeatingCapacitySizeRatio; + if (state.dataHVACVarRefFlow->VRF(VRFCond).LockHeatingCapacity) { + HeatingCapacityDes = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacitySizeRatio; } else { HeatingCapacityDes = TUHeatingCapacity; } if (IsAutoSize) { - VRF(VRFCond).HeatingCapacity = HeatingCapacityDes; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity = HeatingCapacityDes; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Heating Capacity [W]", HeatingCapacityDes); } else { - if (VRF(VRFCond).HeatingCapacity > 0.0 && HeatingCapacityDes > 0.0) { - HeatingCapacityUser = VRF(VRFCond).HeatingCapacity; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity > 0.0 && HeatingCapacityDes > 0.0) { + HeatingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Heating Capacity [W]", HeatingCapacityDes, "User-Specified Rated Total Heating Capacity [W]", HeatingCapacityUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(HeatingCapacityDes - HeatingCapacityUser) / HeatingCapacityUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + ' ' + - VRFTU(VRFCond).Name); + ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + ' ' + + state.dataHVACVarRefFlow->VRFTU(VRFCond).Name); ShowContinueError(state, format("User-Specified Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityUser)); ShowContinueError(state, format("differs from Design Size Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityDes)); @@ -8104,79 +7995,79 @@ namespace HVACVariableRefrigerantFlow { } } - if (VRF(VRFCond).HeatingCapacity > 0.0) { - VRF(VRFCond).HeatingCombinationRatio = TUHeatingCapacity / VRF(VRFCond).HeatingCapacity; + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity > 0.0) { + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio = TUHeatingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity; } // calculate the piping correction factors only once - if (VRF(VRFCond).PCFLengthCoolPtr > 0) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr > 0) { { - if (state.dataCurveManager->PerfCurve(VRF(VRFCond).PCFLengthCoolPtr).NumDims == 2) { - VRF(VRFCond).PipingCorrectionCooling = min( + if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr).NumDims == 2) { + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = min( 1.0, max(0.5, CurveValue( - state, VRF(VRFCond).PCFLengthCoolPtr, VRF(VRFCond).EquivPipeLngthCool, VRF(VRFCond).CoolingCombinationRatio) + - VRF(VRFCond).VertPipeLngth * VRF(VRFCond).PCFHeightCool)); + state, state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr, state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthCool, state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio) + + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightCool)); } else { - VRF(VRFCond).PipingCorrectionCooling = + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = min(1.0, max(0.5, - CurveValue(state, VRF(VRFCond).PCFLengthCoolPtr, VRF(VRFCond).EquivPipeLngthCool) + - VRF(VRFCond).VertPipeLngth * VRF(VRFCond).PCFHeightCool)); + CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthCoolPtr, state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthCool) + + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightCool)); } } } else { - VRF(VRFCond).PipingCorrectionCooling = min(1.0, max(0.5, (1.0 + VRF(VRFCond).VertPipeLngth * VRF(VRFCond).PCFHeightCool))); + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = min(1.0, max(0.5, (1.0 + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightCool))); } - if (VRF(VRFCond).PCFLengthHeatPtr > 0) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr > 0) { { - if (state.dataCurveManager->PerfCurve(VRF(VRFCond).PCFLengthHeatPtr).NumDims == 2) { - VRF(VRFCond).PipingCorrectionHeating = min( + if (state.dataCurveManager->PerfCurve(state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr).NumDims == 2) { + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = min( 1.0, max(0.5, CurveValue( - state, VRF(VRFCond).PCFLengthHeatPtr, VRF(VRFCond).EquivPipeLngthHeat, VRF(VRFCond).HeatingCombinationRatio) + - VRF(VRFCond).VertPipeLngth * VRF(VRFCond).PCFHeightHeat)); + state, state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr, state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthHeat, state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio) + + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightHeat)); } else { - VRF(VRFCond).PipingCorrectionHeating = + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = min(1.0, max(0.5, - CurveValue(state, VRF(VRFCond).PCFLengthHeatPtr, VRF(VRFCond).EquivPipeLngthHeat) + - VRF(VRFCond).VertPipeLngth * VRF(VRFCond).PCFHeightHeat)); + CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).PCFLengthHeatPtr, state.dataHVACVarRefFlow->VRF(VRFCond).EquivPipeLngthHeat) + + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightHeat)); } } } else { - VRF(VRFCond).PipingCorrectionHeating = min(1.0, max(0.5, (1.0 + VRF(VRFCond).VertPipeLngth * VRF(VRFCond).PCFHeightHeat))); + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = min(1.0, max(0.5, (1.0 + state.dataHVACVarRefFlow->VRF(VRFCond).VertPipeLngth * state.dataHVACVarRefFlow->VRF(VRFCond).PCFHeightHeat))); } - VRF(VRFCond).RatedCoolingPower = VRF(VRFCond).CoolingCapacity / VRF(VRFCond).CoolingCOP; - VRF(VRFCond).RatedHeatingPower = VRF(VRFCond).HeatingCapacity / VRF(VRFCond).HeatingCOP; + state.dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP; + state.dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower = state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP; - if (VRF(VRFCond).CoolCombRatioPTR > 0) { - CoolCombinationRatio(VRFCond) = CurveValue(state, VRF(VRFCond).CoolCombRatioPTR, VRF(VRFCond).CoolingCombinationRatio); + if (state.dataHVACVarRefFlow->VRF(VRFCond).CoolCombRatioPTR > 0) { + state.dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).CoolCombRatioPTR, state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio); } else { - CoolCombinationRatio(VRFCond) = 1.0; + state.dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) = 1.0; } - if (VRF(VRFCond).HeatCombRatioPTR > 0) { - HeatCombinationRatio(VRFCond) = CurveValue(state, VRF(VRFCond).HeatCombRatioPTR, VRF(VRFCond).HeatingCombinationRatio); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatCombRatioPTR > 0) { + state.dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) = CurveValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).HeatCombRatioPTR, state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio); } else { - HeatCombinationRatio(VRFCond) = 1.0; + state.dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) = 1.0; } } - if (FoundAll && (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl)) { + if (FoundAll && (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl)) { // Size VRF rated evaporative capacity (VRF-FluidTCtrl Model) // Set piping correction factors to 1.0 here for reporting to eio output - recalculated every time step in // VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl - VRF(VRFCond).PipingCorrectionCooling = 1.0; - VRF(VRFCond).PipingCorrectionHeating = 1.0; + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = 1.0; + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = 1.0; // Size VRF( VRFCond ).RatedEvapCapacity IsAutoSize = false; - if (VRF(VRFCond).RatedEvapCapacity == AutoSize) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity == AutoSize) { IsAutoSize = true; } @@ -8185,36 +8076,36 @@ namespace HVACVariableRefrigerantFlow { if (IsAutoSize) { // RatedEvapCapacity - VRF(VRFCond).RatedEvapCapacity = max(CoolingCapacityDes, HeatingCapacityDes / (1 + VRF(VRFCond).RatedCompPowerPerCapcity)); + state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity = max(CoolingCapacityDes, HeatingCapacityDes / (1 + state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPowerPerCapcity)); // Other parameters dependent on RatedEvapCapacity - VRF(VRFCond).RatedCompPower = VRF(VRFCond).RatedCompPowerPerCapcity * VRF(VRFCond).RatedEvapCapacity; - VRF(VRFCond).RatedOUFanPower = VRF(VRFCond).RatedOUFanPowerPerCapcity * VRF(VRFCond).RatedEvapCapacity; - VRF(VRFCond).OUAirFlowRate = VRF(VRFCond).OUAirFlowRatePerCapcity * VRF(VRFCond).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPower = state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFCond).RatedOUFanPower = state.dataHVACVarRefFlow->VRF(VRFCond).RatedOUFanPowerPerCapcity * state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFCond).OUAirFlowRate = state.dataHVACVarRefFlow->VRF(VRFCond).OUAirFlowRatePerCapcity * state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity; - VRF(VRFCond).CoolingCapacity = VRF(VRFCond).RatedEvapCapacity; - VRF(VRFCond).HeatingCapacity = VRF(VRFCond).RatedEvapCapacity * (1 + VRF(VRFCond).RatedCompPowerPerCapcity); + state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity = state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity; + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity = state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity * (1 + state.dataHVACVarRefFlow->VRF(VRFCond).RatedCompPowerPerCapcity); - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Heating Capacity [W]", - VRF(VRFCond).HeatingCapacity); - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity); + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Cooling Capacity (gross) [W]", - VRF(VRFCond).CoolingCapacity); + state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity); } else { - CoolingCapacityUser = VRF(VRFCond).RatedEvapCapacity; - HeatingCapacityUser = VRF(VRFCond).RatedHeatCapacity; + CoolingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).RatedEvapCapacity; + HeatingCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).RatedHeatCapacity; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Cooling Capacity (gross) [W]", CoolingCapacityDes, "User-Specified Rated Total Cooling Capacity (gross) [W]", CoolingCapacityUser); - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Rated Total Heating Capacity [W]", HeatingCapacityDes, "User-Specified Rated Total Heating Capacity [W]", @@ -8222,8 +8113,8 @@ namespace HVACVariableRefrigerantFlow { if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(CoolingCapacityDes - CoolingCapacityUser) / CoolingCapacityUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + ' ' + - VRFTU(VRFCond).Name); + ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + ' ' + + state.dataHVACVarRefFlow->VRFTU(VRFCond).Name); ShowContinueError(state, format("User-Specified Rated Total Cooling Capacity (gross) of {:.2R} [W]", CoolingCapacityUser)); ShowContinueError( @@ -8233,8 +8124,8 @@ namespace HVACVariableRefrigerantFlow { } if ((std::abs(HeatingCapacityDes - HeatingCapacityUser) / HeatingCapacityUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + ' ' + - VRFTU(VRFCond).Name); + ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + ' ' + + state.dataHVACVarRefFlow->VRFTU(VRFCond).Name); ShowContinueError(state, format("User-Specified Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityUser)); ShowContinueError(state, format("differs from Design Size Rated Total Heating Capacity of {:.2R} [W]", HeatingCapacityDes)); @@ -8248,33 +8139,33 @@ namespace HVACVariableRefrigerantFlow { if (FoundAll) { // autosize resistive defrost heater capacity IsAutoSize = false; - if (VRF(VRFCond).DefrostCapacity == AutoSize) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity == AutoSize) { IsAutoSize = true; } - if (VRF(VRFCond).DefrostStrategy == Resistive) { - DefrostCapacityDes = VRF(VRFCond).CoolingCapacity; + if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostStrategy == Resistive) { + DefrostCapacityDes = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity; } else { DefrostCapacityDes = 0.0; } if (IsAutoSize) { - VRF(VRFCond).DefrostCapacity = DefrostCapacityDes; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity = DefrostCapacityDes; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes); } else { - if (VRF(VRFCond).DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0) { - DefrostCapacityUser = VRF(VRFCond).DefrostCapacity; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + if (state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0) { + DefrostCapacityUser = state.dataHVACVarRefFlow->VRF(VRFCond).DefrostCapacity; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Resistive Defrost Heater Capacity", DefrostCapacityDes, "User-Specified Resistive Defrost Heater Capacity", DefrostCapacityUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(DefrostCapacityDes - DefrostCapacityUser) / DefrostCapacityUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + ' ' + - VRFTU(VRFCond).Name); + ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + ' ' + + state.dataHVACVarRefFlow->VRFTU(VRFCond).Name); ShowContinueError(state, format("User-Specified Resistive Defrost Heater Capacity of {:.2R} [W]", DefrostCapacityUser)); ShowContinueError( @@ -8287,22 +8178,22 @@ namespace HVACVariableRefrigerantFlow { } IsAutoSize = false; - if (VRF(VRFCond).EvapCondAirVolFlowRate == AutoSize) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate == AutoSize) { IsAutoSize = true; } // Auto size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton) - EvapCondAirVolFlowRateDes = VRF(VRFCond).CoolingCapacity * 0.000114; + EvapCondAirVolFlowRateDes = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * 0.000114; if (IsAutoSize) { - VRF(VRFCond).EvapCondAirVolFlowRate = EvapCondAirVolFlowRateDes; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate = EvapCondAirVolFlowRateDes; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Evaporative Condenser Air Flow Rate [m3/s]", EvapCondAirVolFlowRateDes); } else { - if (VRF(VRFCond).EvapCondAirVolFlowRate > 0.0 && EvapCondAirVolFlowRateDes > 0.0) { - EvapCondAirVolFlowRateUser = VRF(VRFCond).EvapCondAirVolFlowRate; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate > 0.0 && EvapCondAirVolFlowRateDes > 0.0) { + EvapCondAirVolFlowRateUser = state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondAirVolFlowRate; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Evaporative Condenser Air Flow Rate [m3/s]", EvapCondAirVolFlowRateDes, "User-Specified Evaporative Condenser Air Flow Rate [m3/s]", @@ -8310,8 +8201,8 @@ namespace HVACVariableRefrigerantFlow { if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(EvapCondAirVolFlowRateDes - EvapCondAirVolFlowRateUser) / EvapCondAirVolFlowRateUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + ' ' + - VRFTU(VRFCond).Name); + ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + ' ' + + state.dataHVACVarRefFlow->VRFTU(VRFCond).Name); ShowContinueError( state, format("User-Specified Evaporative Condenser Air Flow Rate of {:.5R} [m3/s]", EvapCondAirVolFlowRateUser)); ShowContinueError(state, @@ -8325,31 +8216,31 @@ namespace HVACVariableRefrigerantFlow { } IsAutoSize = false; - if (VRF(VRFCond).EvapCondPumpPower == AutoSize) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower == AutoSize) { IsAutoSize = true; } // Auto size evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) - EvapCondPumpPowerDes = VRF(VRFCond).CoolingCapacity * 0.004266; + EvapCondPumpPowerDes = state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * 0.004266; if (IsAutoSize) { - VRF(VRFCond).EvapCondPumpPower = EvapCondPumpPowerDes; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower = EvapCondPumpPowerDes; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Evaporative Condenser Pump Rated Power Consumption [W]", EvapCondPumpPowerDes); } else { - if (VRF(VRFCond).EvapCondPumpPower > 0.0 && EvapCondPumpPowerDes > 0.0) { - EvapCondPumpPowerUser = VRF(VRFCond).EvapCondPumpPower; - BaseSizer::reportSizerOutput(state, cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, + if (state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower > 0.0 && EvapCondPumpPowerDes > 0.0) { + EvapCondPumpPowerUser = state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpPower; + BaseSizer::reportSizerOutput(state, std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, "Design Size Evaporative Condenser Pump Rated Power Consumption [W]", EvapCondPumpPowerDes, "User-Specified Evaporative Condenser Pump Rated Power Consumption [W]", EvapCondPumpPowerUser); if (state.dataGlobal->DisplayExtraWarnings) { if ((std::abs(EvapCondPumpPowerDes - EvapCondPumpPowerUser) / EvapCondPumpPowerUser) > AutoVsHardSizingThreshold) { - ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + cVRFTypes(VRF(VRFCond).VRFSystemTypeNum) + ' ' + - VRFTU(VRFCond).Name); + ShowMessage(state, "SizeVRF: Potential issue with equipment sizing for " + std::string(cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum)) + ' ' + + state.dataHVACVarRefFlow->VRFTU(VRFCond).Name); ShowContinueError( state, format("User-Specified Evaporative Condenser Pump Rated Power Consumption of {:.2R} [W]", EvapCondPumpPowerUser)); @@ -8375,12 +8266,12 @@ namespace HVACVariableRefrigerantFlow { static constexpr auto Format_991(" VRF System Information, {}, {}, {:.5R}, {:.5R}, {:.5R}, {:.5R}\n"); print(state.files.eio, Format_991, - cVRFTypes(VRF(VRFCond).VRFSystemTypeNum), - VRF(VRFCond).Name, - VRF(VRFCond).CoolingCombinationRatio, - VRF(VRFCond).HeatingCombinationRatio, - VRF(VRFCond).PipingCorrectionCooling, - VRF(VRFCond).PipingCorrectionHeating); + cVRFTypes(state.dataHVACVarRefFlow->VRF(VRFCond).VRFSystemTypeNum), + state.dataHVACVarRefFlow->VRF(VRFCond).Name, + state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio, + state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCombinationRatio, + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling, + state.dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating); CheckVRFCombinationRatio(VRFCond) = false; } @@ -8497,31 +8388,31 @@ namespace HVACVariableRefrigerantFlow { Real64 PartLoadRatio(1.0); Real64 SuppHeatCoilLoad(0.0); // supplemental heating coil load (W) - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).ControlVRF_FluidTCtrl(state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ControlVRF_FluidTCtrl(state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided); if (PartLoadRatio == 0.0) { // set coil inlet conditions when coil does not operate. Inlet conditions are set in ControlVRF_FluidTCtrl when PLR=1 - if (VRFTU(VRFTUNum).CoolingCoilPresent) { - VRFTU(VRFTUNum).coilInNodeT = DataLoopNode::Node(DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).Temp; - VRFTU(VRFTUNum).coilInNodeW = DataLoopNode::Node(DXCoils::DXCoil(VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).HumRat; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeT = DataLoopNode::Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).Temp; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeW = DataLoopNode::Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex).AirInNode).HumRat; } else { - VRFTU(VRFTUNum).coilInNodeT = DataLoopNode::Node(DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).Temp; - VRFTU(VRFTUNum).coilInNodeW = DataLoopNode::Node(DXCoils::DXCoil(VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).HumRat; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeT = DataLoopNode::Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).Temp; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilInNodeW = DataLoopNode::Node(state.dataDXCoils->DXCoil(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex).AirInNode).HumRat; } } // CalcVRF( VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, LatOutputProvided ); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).ControlVRF(state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); - VRFTU(VRFTUNum).CalcVRF( + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ControlVRF(state, VRFTUNum, QZnReq, FirstHVACIteration, PartLoadRatio, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF( state, VRFTUNum, FirstHVACIteration, PartLoadRatio, SysOutputProvided, OnOffAirFlowRatio, SuppHeatCoilLoad, LatOutputProvided); } - VRFTU(VRFTUNum).TerminalUnitSensibleRate = SysOutputProvided; - VRFTU(VRFTUNum).TerminalUnitLatentRate = LatOutputProvided; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitSensibleRate = SysOutputProvided; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitLatentRate = LatOutputProvided; } void VRFTerminalUnitEquipment::ControlVRF(EnergyPlusData &state, @@ -8545,8 +8436,8 @@ namespace HVACVariableRefrigerantFlow { // Use RegulaFalsi technique to iterate on part-load ratio until convergence is achieved. PartLoadRatio = 0.0; - LoopDXCoolCoilRTF = 0.0; - LoopDXHeatCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0; // The RETURNS here will jump back to SimVRF where the CalcVRF routine will simulate with latest PLR @@ -8590,14 +8481,14 @@ namespace HVACVariableRefrigerantFlow { Real64 TempMaxPLR = 0.0; // max PLR used in Regula Falsi call bool ContinueIter; // used when convergence is an issue Real64 NoCompOutput = 0.0; // output when no active compressor [W] - bool VRFCoolingMode = CoolingLoad(VRFCond); - bool VRFHeatingMode = HeatingLoad(VRFCond); + bool VRFCoolingMode = state.dataHVACVarRefFlow->CoolingLoad(VRFCond); + bool VRFHeatingMode = state.dataHVACVarRefFlow->HeatingLoad(VRFCond); int IndexToTUInTUList = this->IndexToTUInTUList; - int TUListIndex = VRF(VRFCond).ZoneTUListPtr; - bool HRCoolingMode = TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList); - bool HRHeatingMode = TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList); + int TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; + bool HRCoolingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList); + bool HRHeatingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList); - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, NoCompOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { @@ -8633,7 +8524,7 @@ namespace HVACVariableRefrigerantFlow { // Otherwise the coil needs to turn on. Get full load result PartLoadRatio = 1.0; - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { @@ -8659,7 +8550,7 @@ namespace HVACVariableRefrigerantFlow { this->SuppHeatPartLoadRatio = min(1.0, SuppHeatCoilLoad / this->DesignSuppHeatingCapacity); } } else { - getVRFTUZoneLoad(VRFTUNum, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); + getVRFTUZoneLoad(state, VRFTUNum, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); if ((FullOutput < (LoadToHeatingSP - DataHVACGlobals::SmallLoad)) && !FirstHVACIteration) { SuppHeatCoilLoad = max(0.0, LoadToHeatingSP - FullOutput); this->SuppHeatingCoilLoad = SuppHeatCoilLoad; @@ -8680,12 +8571,12 @@ namespace HVACVariableRefrigerantFlow { this->SuppHeatPartLoadRatio = 0.0; } - if ((VRFCoolingMode && !VRF(VRFCond).HeatRecoveryUsed) || (VRF(VRFCond).HeatRecoveryUsed && HRCoolingMode)) { + if ((VRFCoolingMode && !state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && HRCoolingMode)) { // Since we are cooling, we expect FullOutput < NoCompOutput // If the QZnReq <= FullOutput the unit needs to run full out if (QZnReq <= FullOutput) { // if no coil present in terminal unit, no need to reset PLR? - if (VRFTU(VRFTUNum).CoolingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { PartLoadRatio = 1.0; // the zone set point could be exceeded if set point control is used so protect against that if (this->isSetPointControlled) { @@ -8698,7 +8589,7 @@ namespace HVACVariableRefrigerantFlow { return; } } - } else if ((VRFHeatingMode && !VRF(VRFCond).HeatRecoveryUsed) || (VRF(VRFCond).HeatRecoveryUsed && HRHeatingMode)) { + } else if ((VRFHeatingMode && !state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && HRHeatingMode)) { // Since we are heating, we expect FullOutput > NoCompOutput // If the QZnReq >= FullOutput the unit needs to run full out if (QZnReq >= FullOutput) { @@ -8729,7 +8620,7 @@ namespace HVACVariableRefrigerantFlow { Par(1) = VRFTUNum; Par(2) = 0.0; - if (VRFTU(VRFTUNum).isSetPointControlled) Par(2) = 1.0; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) Par(2) = 1.0; Par(4) = 0.0; // fan OpMode if (FirstHVACIteration) { Par(3) = 1.0; @@ -8747,7 +8638,7 @@ namespace HVACVariableRefrigerantFlow { while (ContinueIter && TempMaxPLR < 1.0) { TempMaxPLR += 0.1; - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, TempMaxPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { @@ -8764,7 +8655,7 @@ namespace HVACVariableRefrigerantFlow { TempMaxPLR = TempMinPLR; TempMinPLR -= 0.01; - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, TempMinPLR, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { @@ -8784,7 +8675,7 @@ namespace HVACVariableRefrigerantFlow { format(" Iteration limit exceeded calculating terminal unit part-load ratio, maximum iterations = {}", MaxIte)); ShowContinueErrorTimeStamp(state, format(" Part-load ratio returned = {:.3R}", PartLoadRatio)); - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control this->CalcVRF_FluidTCtrl( state, VRFTUNum, FirstHVACIteration, PartLoadRatio, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); @@ -8805,7 +8696,7 @@ namespace HVACVariableRefrigerantFlow { } } else if (SolFla == -2) { if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag) { - if (VRFTU(VRFTUNum).FirstIterfailed == 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FirstIterfailed == 0) { ShowWarningMessage(state, DataHVACGlobals::cVRFTUTypes(this->VRFTUType_Num) + " \"" + this->Name + "\""); ShowContinueError(state, "Terminal unit part-load ratio calculation failed: PLR limits of 0 to 1 exceeded"); ShowContinueError(state, "Please fill out a bug report and forward to the EnergyPlus support group."); @@ -8817,14 +8708,14 @@ namespace HVACVariableRefrigerantFlow { } else { ShowRecurringWarningErrorAtEnd(state, DataHVACGlobals::cVRFTUTypes(this->VRFTUType_Num) + " \"" + this->Name + "\" -- Terminal unit part-load ratio limits of 0 to 1 exceeded error continues...", - VRFTU(VRFTUNum).FirstIterfailed); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FirstIterfailed); } } PartLoadRatio = max(MinPLF, std::abs(QZnReq - NoCompOutput) / std::abs(FullOutput - NoCompOutput)); } } else if (SolFla == -2) { if (!FirstHVACIteration && !state.dataGlobal->WarmupFlag) { - if (VRFTU(VRFTUNum).FirstIterfailed == 0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FirstIterfailed == 0) { ShowWarningMessage(state, DataHVACGlobals::cVRFTUTypes(this->VRFTUType_Num) + " \"" + this->Name + "\""); ShowContinueError(state, "Terminal unit part-load ratio calculation failed: PLR limits of 0 to 1 exceeded"); ShowContinueError(state, "Please fill out a bug report and forward to the EnergyPlus support group."); @@ -8893,7 +8784,7 @@ namespace HVACVariableRefrigerantFlow { int ZoneNode; // Zone node of VRFTU is serving VRFCond = this->VRFSysNum; - TUListIndex = VRF(VRFCond).ZoneTUListPtr; + TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; IndexToTUInTUList = this->IndexToTUInTUList; VRFTUOutletNodeNum = this->VRFTUOutletNodeNum; VRFTUInletNodeNum = this->VRFTUInletNodeNum; @@ -8934,7 +8825,7 @@ namespace HVACVariableRefrigerantFlow { "", FirstHVACIteration, this->FanIndex, - FanSpeedRatio, + state.dataHVACVarRefFlow->FanSpeedRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff); } @@ -8942,8 +8833,8 @@ namespace HVACVariableRefrigerantFlow { if (this->CoolingCoilPresent) { // above condition for heat pump mode, below condition for heat recovery mode - if ((!VRF(VRFCond).HeatRecoveryUsed && CoolingLoad(VRFCond)) || - (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { + if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) || + (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { SimDXCoil(state, "", On, @@ -8953,20 +8844,20 @@ namespace HVACVariableRefrigerantFlow { PartLoadRatio, OnOffAirFlowRatio, _, - MaxCoolingCapacity(VRFCond), - VRF(this->VRFSysNum).VRFCondCyclingRatio); + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond), + state.dataHVACVarRefFlow->VRF(this->VRFSysNum).VRFCondCyclingRatio); } else { // cooling coil is off SimDXCoil(state, "", Off, FirstHVACIteration, this->CoolCoilIndex, OpMode, 0.0, OnOffAirFlowRatio); } - LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF; + state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { - LoopDXCoolCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0; } if (this->HeatingCoilPresent) { // above condition for heat pump mode, below condition for heat recovery mode - if ((!VRF(VRFCond).HeatRecoveryUsed && HeatingLoad(VRFCond)) || - (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { + if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) || + (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { SimDXCoil(state, "", Off, @@ -8976,13 +8867,13 @@ namespace HVACVariableRefrigerantFlow { PartLoadRatio, OnOffAirFlowRatio, _, - MaxHeatingCapacity(VRFCond)); + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond)); } else { SimDXCoil(state, "", Off, FirstHVACIteration, this->HeatCoilIndex, OpMode, 0.0, OnOffAirFlowRatio, _); } - LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF; + state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { - LoopDXHeatCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0; } // if draw through, simulate coils then fan @@ -9001,7 +8892,7 @@ namespace HVACVariableRefrigerantFlow { "", FirstHVACIteration, this->FanIndex, - FanSpeedRatio, + state.dataHVACVarRefFlow->FanSpeedRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff); } @@ -9063,7 +8954,7 @@ namespace HVACVariableRefrigerantFlow { } } - void ReportVRFTerminalUnit(int const VRFTUNum) // index to VRF terminal unit + void ReportVRFTerminalUnit(EnergyPlusData &state, int const VRFTUNum) // index to VRF terminal unit { // SUBROUTINE INFORMATION: @@ -9076,8 +8967,6 @@ namespace HVACVariableRefrigerantFlow { // This subroutine updates the report variables for the VRF Terminal Units. using namespace DataSizing; - using DXCoils::DXCoilTotalCooling; - using DXCoils::DXCoilTotalHeating; int DXCoolingCoilIndex; // - index to DX cooling coil int DXHeatingCoilIndex; // - index to DX heating coil @@ -9091,102 +8980,102 @@ namespace HVACVariableRefrigerantFlow { bool HRHeatRequestFlag; // - indicates TU could be in heat mode bool HRCoolRequestFlag; // - indicates TU could be in cool mode - DXCoolingCoilIndex = VRFTU(VRFTUNum).CoolCoilIndex; - DXHeatingCoilIndex = VRFTU(VRFTUNum).HeatCoilIndex; - VRFCond = VRFTU(VRFTUNum).VRFSysNum; - TUListIndex = VRF(VRFCond).ZoneTUListPtr; - IndexToTUInTUList = VRFTU(VRFTUNum).IndexToTUInTUList; - HRHeatRequestFlag = TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList); - HRCoolRequestFlag = TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList); + DXCoolingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolCoilIndex; + DXHeatingCoilIndex = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatCoilIndex; + VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; + IndexToTUInTUList = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList; + HRHeatRequestFlag = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList); + HRCoolRequestFlag = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList); ReportingConstant = DataHVACGlobals::TimeStepSys * DataGlobalConstants::SecInHour; // account for terminal unit parasitic On/Off power use // account for heat recovery first since these flags will be FALSE otherwise, each TU may have different operating mode if (HRCoolRequestFlag) { - if (VRFTU(VRFTUNum).CoolingCoilPresent) { - VRFTU(VRFTUNum).ParasiticCoolElecPower = - VRFTU(VRFTUNum).ParasiticElec * LoopDXCoolCoilRTF + VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - LoopDXCoolCoilRTF); - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; - VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0; - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0; } else { // cooling parasitic power report variable is not even available when there is no cooling coil, report for heating - VRFTU(VRFTUNum).ParasiticHeatElecPower = VRFTU(VRFTUNum).ParasiticOffElec; - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; } } else if (HRHeatRequestFlag) { - if (VRFTU(VRFTUNum).HeatingCoilPresent) { - VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0; - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0; - VRFTU(VRFTUNum).ParasiticHeatElecPower = - VRFTU(VRFTUNum).ParasiticElec * LoopDXHeatCoilRTF + VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - LoopDXHeatCoilRTF); - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; } else { // heating parasitic power report variable is not even available when there is no heating coil, report for cooling - VRFTU(VRFTUNum).ParasiticCoolElecPower = VRFTU(VRFTUNum).ParasiticOffElec; - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; - } - } else if (CoolingLoad(VRFCond) || (!HeatingLoad(VRFCond) && LastModeCooling(VRFTU(VRFTUNum).VRFSysNum))) { - if (VRFTU(VRFTUNum).CoolingCoilPresent) { - VRFTU(VRFTUNum).ParasiticCoolElecPower = - VRFTU(VRFTUNum).ParasiticElec * LoopDXCoolCoilRTF + VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - LoopDXCoolCoilRTF); - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; - VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0; - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + } + } else if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) || (!state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && state.dataHVACVarRefFlow->LastModeCooling(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum))) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXCoolCoilRTF + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXCoolCoilRTF); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = 0.0; } else { // cooling parasitic power report variable is not even available when there is no cooling coil, report for heating - VRFTU(VRFTUNum).ParasiticHeatElecPower = VRFTU(VRFTUNum).ParasiticOffElec; - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; - } - } else if (HeatingLoad(VRFCond) || (!CoolingLoad(VRFCond) && LastModeHeating(VRFTU(VRFTUNum).VRFSysNum))) { - if (VRFTU(VRFTUNum).HeatingCoilPresent) { - VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0; - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0; - VRFTU(VRFTUNum).ParasiticHeatElecPower = - VRFTU(VRFTUNum).ParasiticElec * LoopDXHeatCoilRTF + VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - LoopDXHeatCoilRTF); - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + } + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) || (!state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && state.dataHVACVarRefFlow->LastModeHeating(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum))) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElec * state.dataHVACVarRefFlow->LoopDXHeatCoilRTF + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec * (1.0 - state.dataHVACVarRefFlow->LoopDXHeatCoilRTF); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; } else { // heating parasitic power report variable is not even available when there is no heating coil, report for cooling - VRFTU(VRFTUNum).ParasiticCoolElecPower = VRFTU(VRFTUNum).ParasiticOffElec; - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; } } else { // happens when there is no cooling or heating load - if (!VRFTU(VRFTUNum).CoolingCoilPresent) { + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { // report all for heating - VRFTU(VRFTUNum).ParasiticHeatElecPower = VRFTU(VRFTUNum).ParasiticOffElec; - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; - } else if (!VRFTU(VRFTUNum).HeatingCoilPresent) { + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + } else if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatingCoilPresent) { // report all for cooling - VRFTU(VRFTUNum).ParasiticCoolElecPower = VRFTU(VRFTUNum).ParasiticOffElec; - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; } else { // split parasitic between both reporting variables - VRFTU(VRFTUNum).ParasiticCoolElecPower = VRFTU(VRFTUNum).ParasiticOffElec / 2.0; - VRFTU(VRFTUNum).ParasiticElecCoolConsumption = VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; - VRFTU(VRFTUNum).ParasiticHeatElecPower = VRFTU(VRFTUNum).ParasiticOffElec / 2.0; - VRFTU(VRFTUNum).ParasiticElecHeatConsumption = VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec / 2.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecCoolConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticCoolElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticOffElec / 2.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticElecHeatConsumption = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ParasiticHeatElecPower * ReportingConstant; } } - SensibleConditioning = VRFTU(VRFTUNum).TerminalUnitSensibleRate; - LatentConditioning = VRFTU(VRFTUNum).TerminalUnitLatentRate; + SensibleConditioning = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitSensibleRate; + LatentConditioning = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TerminalUnitLatentRate; Real64 TempOut = 0.0; Real64 TempIn = 0.0; - if (VRFTU(VRFTUNum).ATMixerExists) { - if (VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerExists) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { // Air terminal supply side mixer - TempOut = DataLoopNode::Node(VRFTU(VRFTUNum).ATMixerOutNode).Temp; - TempIn = DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Temp; + TempOut = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerOutNode).Temp; + TempIn = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp; } else { // Air terminal inlet side mixer - TempOut = DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; - TempIn = DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Temp; + TempOut = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; + TempIn = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp; } } else { - TempOut = DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; - TempIn = DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp; + TempOut = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; + TempIn = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp; } // latent heat vaporization/condensation used in moist air psychometrics Real64 const H2OHtOfVap = PsyHgAirFnWTdb(0.0, TempOut); @@ -9194,36 +9083,36 @@ namespace HVACVariableRefrigerantFlow { TotalConditioning = SensibleConditioning + (LatentConditioning * H2OHtOfVap); if (TotalConditioning <= 0.0) { - VRFTU(VRFTUNum).TotalCoolingRate = std::abs(TotalConditioning); - VRFTU(VRFTUNum).TotalHeatingRate = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate = std::abs(TotalConditioning); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate = 0.0; } else { - VRFTU(VRFTUNum).TotalCoolingRate = 0.0; - VRFTU(VRFTUNum).TotalHeatingRate = TotalConditioning; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate = TotalConditioning; } if (SensibleConditioning <= 0.0) { - VRFTU(VRFTUNum).SensibleCoolingRate = std::abs(SensibleConditioning); - VRFTU(VRFTUNum).SensibleHeatingRate = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate = std::abs(SensibleConditioning); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate = 0.0; } else { - VRFTU(VRFTUNum).SensibleCoolingRate = 0.0; - VRFTU(VRFTUNum).SensibleHeatingRate = SensibleConditioning; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate = SensibleConditioning; } if (LatentConditioning <= 0.0) { - VRFTU(VRFTUNum).LatentCoolingRate = std::abs(LatentConditioning) * H2OHtOfVap; - VRFTU(VRFTUNum).LatentHeatingRate = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate = std::abs(LatentConditioning) * H2OHtOfVap; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate = 0.0; } else { - VRFTU(VRFTUNum).LatentCoolingRate = 0.0; - VRFTU(VRFTUNum).LatentHeatingRate = LatentConditioning * H2OHtOfVap; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate = 0.0; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate = LatentConditioning * H2OHtOfVap; } - VRFTU(VRFTUNum).TotalCoolingEnergy = VRFTU(VRFTUNum).TotalCoolingRate * ReportingConstant; - VRFTU(VRFTUNum).SensibleCoolingEnergy = VRFTU(VRFTUNum).SensibleCoolingRate * ReportingConstant; - VRFTU(VRFTUNum).LatentCoolingEnergy = VRFTU(VRFTUNum).LatentCoolingRate * ReportingConstant; - VRFTU(VRFTUNum).TotalHeatingEnergy = VRFTU(VRFTUNum).TotalHeatingRate * ReportingConstant; - VRFTU(VRFTUNum).SensibleHeatingEnergy = VRFTU(VRFTUNum).SensibleHeatingRate * ReportingConstant; - VRFTU(VRFTUNum).LatentHeatingEnergy = VRFTU(VRFTUNum).LatentHeatingRate * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalCoolingRate * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleCoolingRate * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentCoolingRate * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).TotalHeatingRate * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SensibleHeatingRate * ReportingConstant; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingEnergy = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).LatentHeatingRate * ReportingConstant; - if (VRFTU(VRFTUNum).firstPass) { - if (!MySizeFlag(VRFTUNum)) { - DataSizing::resetHVACSizingGlobals(DataSizing::CurZoneEqNum, 0, VRFTU(VRFTUNum).firstPass); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).firstPass) { + if (!state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum)) { + DataSizing::resetHVACSizingGlobals(DataSizing::CurZoneEqNum, 0, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).firstPass); } } @@ -9231,7 +9120,7 @@ namespace HVACVariableRefrigerantFlow { DataHVACGlobals::OnOffFanPartLoadFraction = 1.0; } - void ReportVRFCondenser(int const VRFCond) // index to VRF condensing unit + void ReportVRFCondenser(EnergyPlusData &state, int const VRFCond) // index to VRF condensing unit { // SUBROUTINE INFORMATION: @@ -9248,20 +9137,20 @@ namespace HVACVariableRefrigerantFlow { ReportingConstant = DataHVACGlobals::TimeStepSys * DataGlobalConstants::SecInHour; // calculate VRF condenser power/energy use - VRF(VRFCond).CoolElecConsumption = VRF(VRFCond).ElecCoolingPower * ReportingConstant; - VRF(VRFCond).HeatElecConsumption = VRF(VRFCond).ElecHeatingPower * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).CoolElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).HeatElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower * ReportingConstant; - VRF(VRFCond).DefrostConsumption = VRF(VRFCond).DefrostPower * ReportingConstant; - VRF(VRFCond).BasinHeaterConsumption = VRF(VRFCond).BasinHeaterPower * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).DefrostConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).DefrostPower * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPower * ReportingConstant; - VRF(VRFCond).EvapCondPumpElecConsumption = VRF(VRFCond).EvapCondPumpElecPower * ReportingConstant; - VRF(VRFCond).CrankCaseHeaterElecConsumption = VRF(VRFCond).CrankCaseHeaterPower * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterElecConsumption = state.dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower * ReportingConstant; - VRF(VRFCond).QCondEnergy = VRF(VRFCond).QCondenser * ReportingConstant; - VRF(VRFCond).VRFHeatEnergyRec = VRF(VRFCond).VRFHeatRec * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).QCondEnergy = state.dataHVACVarRefFlow->VRF(VRFCond).QCondenser * ReportingConstant; + state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatEnergyRec = state.dataHVACVarRefFlow->VRF(VRFCond).VRFHeatRec * ReportingConstant; } - void UpdateVRFCondenser(int const VRFCond) // index to VRF condensing unit + void UpdateVRFCondenser(EnergyPlusData &state, int const VRFCond) // index to VRF condensing unit { // SUBROUTINE INFORMATION: @@ -9275,11 +9164,11 @@ namespace HVACVariableRefrigerantFlow { int CondenserOutletNode; // - outlet node for VRF water-cooled condenser - CondenserOutletNode = VRF(VRFCond).CondenserOutletNodeNum; + CondenserOutletNode = state.dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum; - DataLoopNode::Node(CondenserOutletNode).Temp = VRF(VRFCond).CondenserSideOutletTemp; + DataLoopNode::Node(CondenserOutletNode).Temp = state.dataHVACVarRefFlow->VRF(VRFCond).CondenserSideOutletTemp; - DataLoopNode::Node(CondenserOutletNode).MassFlowRate = CondenserWaterMassFlowRate; + DataLoopNode::Node(CondenserOutletNode).MassFlowRate = state.dataHVACVarRefFlow->CondenserWaterMassFlowRate; DataLoopNode::Node(CondenserOutletNode).MassFlowRateMaxAvail = DataLoopNode::Node(CondenserOutletNode).MassFlowRateMaxAvail; DataLoopNode::Node(CondenserOutletNode).MassFlowRateMinAvail = DataLoopNode::Node(CondenserOutletNode).MassFlowRateMinAvail; } @@ -9287,15 +9176,15 @@ namespace HVACVariableRefrigerantFlow { void isVRFCoilPresent(EnergyPlusData &state, std::string const VRFTUName, bool &CoolCoilPresent, bool &HeatCoilPresent) { - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - int WhichVRFTU = UtilityRoutines::FindItemInList(VRFTUName, VRFTU, &VRFTerminalUnitEquipment::Name, NumVRFTU); + int WhichVRFTU = UtilityRoutines::FindItemInList(VRFTUName, state.dataHVACVarRefFlow->VRFTU, &VRFTerminalUnitEquipment::Name, state.dataHVACVarRefFlow->NumVRFTU); if (WhichVRFTU != 0) { - CoolCoilPresent = VRFTU(WhichVRFTU).CoolingCoilPresent; - HeatCoilPresent = VRFTU(WhichVRFTU).HeatingCoilPresent; + CoolCoilPresent = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).CoolingCoilPresent; + HeatCoilPresent = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).HeatingCoilPresent; } else { ShowSevereError(state, "isVRFCoilPresent: Could not find VRF TU = \"" + VRFTUName + "\""); } @@ -9353,17 +9242,17 @@ namespace HVACVariableRefrigerantFlow { OnOffAirFlowRatio = Par(6); SuppHeatCoilLoad = 0.0; - if (VRF(VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRF(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, ActualOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } if (setPointControlled) { - Real64 outletNodeT = DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; - PLRResidual = (outletNodeT - VRFTU(VRFTUNum).coilTempSetPoint); + Real64 outletNodeT = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; + PLRResidual = (outletNodeT - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coilTempSetPoint); } else { if (std::abs(QZnReq) < 100.0) QZnReqTemp = sign(100.0, QZnReq); PLRResidual = (ActualOutput - QZnReq) / QZnReqTemp; @@ -9398,38 +9287,38 @@ namespace HVACVariableRefrigerantFlow { Real64 AverageUnitMassFlow(0.0); // average supply air mass flow rate over time step Real64 AverageOAMassFlow(0.0); // average outdoor air mass flow rate over time step - InletNode = VRFTU(VRFTUNum).VRFTUInletNodeNum; - OutsideAirNode = VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; - AirRelNode = VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum; + InletNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum; + OutsideAirNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; + AirRelNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum; - if (VRFTU(VRFTUNum).OpMode == DataHVACGlobals::CycFanCycCoil) { - AverageUnitMassFlow = (PartLoadRatio * CompOnMassFlow) + ((1 - PartLoadRatio) * CompOffMassFlow); - AverageOAMassFlow = (PartLoadRatio * OACompOnMassFlow) + ((1 - PartLoadRatio) * OACompOffMassFlow); + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode == DataHVACGlobals::CycFanCycCoil) { + AverageUnitMassFlow = (PartLoadRatio * state.dataHVACVarRefFlow->CompOnMassFlow) + ((1 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffMassFlow); + AverageOAMassFlow = (PartLoadRatio * state.dataHVACVarRefFlow->OACompOnMassFlow) + ((1 - PartLoadRatio) * state.dataHVACVarRefFlow->OACompOffMassFlow); } else { if (PartLoadRatio == 0.0) { // set the average OA air flow to off compressor values if the compressor PartLoadRatio is zero - AverageUnitMassFlow = CompOffMassFlow; - AverageOAMassFlow = OACompOffMassFlow; + AverageUnitMassFlow = state.dataHVACVarRefFlow->CompOffMassFlow; + AverageOAMassFlow = state.dataHVACVarRefFlow->OACompOffMassFlow; } else { - AverageUnitMassFlow = CompOnMassFlow; - AverageOAMassFlow = OACompOnMassFlow; + AverageUnitMassFlow = state.dataHVACVarRefFlow->CompOnMassFlow; + AverageOAMassFlow = state.dataHVACVarRefFlow->OACompOnMassFlow; } } - if (CompOffFlowRatio > 0.0) { - FanSpeedRatio = (PartLoadRatio * CompOnFlowRatio) + ((1 - PartLoadRatio) * CompOffFlowRatio); + if (state.dataHVACVarRefFlow->CompOffFlowRatio > 0.0) { + state.dataHVACVarRefFlow->FanSpeedRatio = (PartLoadRatio * state.dataHVACVarRefFlow->CompOnFlowRatio) + ((1 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffFlowRatio); } else { - FanSpeedRatio = CompOnFlowRatio; + state.dataHVACVarRefFlow->FanSpeedRatio = state.dataHVACVarRefFlow->CompOnFlowRatio; } // if the terminal unit and fan are scheduled on then set flow rate - if (GetCurrentScheduleValue(state, VRFTU(VRFTUNum).SchedPtr) > 0.0 && - (GetCurrentScheduleValue(state, VRFTU(VRFTUNum).FanAvailSchedPtr) > 0.0 || DataHVACGlobals::ZoneCompTurnFansOn) && + if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr) > 0.0 && + (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr) > 0.0 || DataHVACGlobals::ZoneCompTurnFansOn) && !DataHVACGlobals::ZoneCompTurnFansOff) { // so for sure OA system TUs should use inlet node flow rate, don't overwrite inlet node flow rate // could there be a reason for air loops to use inlet node flow? Possibly when VAV TUs used? - if (!VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InletNode).MassFlowRate = AverageUnitMassFlow; - if (!VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InletNode).MassFlowRate = AverageUnitMassFlow; + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; if (OutsideAirNode > 0) { DataLoopNode::Node(OutsideAirNode).MassFlowRate = AverageOAMassFlow; DataLoopNode::Node(OutsideAirNode).MassFlowRateMaxAvail = AverageOAMassFlow; @@ -9437,14 +9326,14 @@ namespace HVACVariableRefrigerantFlow { DataLoopNode::Node(AirRelNode).MassFlowRateMaxAvail = AverageOAMassFlow; } if (AverageUnitMassFlow > 0.0) { - OnOffAirFlowRatio = CompOnMassFlow / AverageUnitMassFlow; + OnOffAirFlowRatio = state.dataHVACVarRefFlow->CompOnMassFlow / AverageUnitMassFlow; } else { OnOffAirFlowRatio = 0.0; } } else { // terminal unit and/or fan is off - if (!VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InletNode).MassFlowRate = 0.0; + if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) DataLoopNode::Node(InletNode).MassFlowRate = 0.0; if (OutsideAirNode > 0) { DataLoopNode::Node(OutsideAirNode).MassFlowRate = 0.0; DataLoopNode::Node(AirRelNode).MassFlowRate = 0.0; @@ -9490,72 +9379,72 @@ namespace HVACVariableRefrigerantFlow { Real64 TempOutput; // terminal unit output [W] Real64 SuppHeatCoilLoad; // supplemental heating coil load - MaxDeltaT = 0.0; - MinDeltaT = 0.0; - NumCoolingLoads = 0; - SumCoolingLoads = 0.0; - NumHeatingLoads = 0; - SumHeatingLoads = 0.0; + state.dataHVACVarRefFlow->MaxDeltaT = 0.0; + state.dataHVACVarRefFlow->MinDeltaT = 0.0; + state.dataHVACVarRefFlow->NumCoolingLoads = 0; + state.dataHVACVarRefFlow->SumCoolingLoads = 0.0; + state.dataHVACVarRefFlow->NumHeatingLoads = 0; + state.dataHVACVarRefFlow->SumHeatingLoads = 0.0; SuppHeatCoilLoad = 0.0; - NumCoolingLoads(VRFCond) = 0; - NumHeatingLoads(VRFCond) = 0; - SumCoolingLoads(VRFCond) = 0.0; - SumHeatingLoads(VRFCond) = 0.0; - MaxDeltaT(VRFCond) = 0.0; - MinDeltaT(VRFCond) = 0.0; + state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) = 0; + state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) = 0; + state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) = 0.0; + state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) = 0.0; + state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = 0.0; + state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = 0.0; ZoneDeltaT = 0.0; - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; - TerminalUnitList(TUListNum).CoolingCoilAvailable = false; - TerminalUnitList(TUListNum).HeatingCoilAvailable = false; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailable = false; + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailable = false; // loop through all TU's to find operating mode. Be careful not to mix loop counters with current TU/Cond index - for (NumTU = 1; NumTU <= TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { + for (NumTU = 1; NumTU <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; ++NumTU) { // make sure TU's have been sized before looping through each one of them to determine operating mode - if (any(TerminalUnitList(TUListNum).TerminalUnitNotSizedYet)) break; - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - ThisZoneNum = VRFTU(TUIndex).ZoneNum; + if (any(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TerminalUnitNotSizedYet)) break; + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + ThisZoneNum = state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneNum; // check to see if coil is present - if (TerminalUnitList(TUListNum).CoolingCoilPresent(NumTU)) { + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTU)) { // now check to see if coil is scheduled off - if (GetCurrentScheduleValue(state, TerminalUnitList(TUListNum).CoolingCoilAvailSchPtr(NumTU)) > 0.0) { - TerminalUnitList(TUListNum).CoolingCoilAvailable(NumTU) = true; + if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailSchPtr(NumTU)) > 0.0) { + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailable(NumTU) = true; } } // check to see if coil is present - if (TerminalUnitList(TUListNum).HeatingCoilPresent(NumTU)) { + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilPresent(NumTU)) { // now check to see if coil is scheduled off - if (GetCurrentScheduleValue(state, TerminalUnitList(TUListNum).HeatingCoilAvailSchPtr(NumTU)) > 0.0) { - TerminalUnitList(TUListNum).HeatingCoilAvailable(NumTU) = true; + if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailSchPtr(NumTU)) > 0.0) { + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailable(NumTU) = true; } } - if (VRFTU(TUIndex).isSetPointControlled) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled) { // set point temperature may only reside at the TU outlet node - Real64 coolCoilTempSetPoint = DataLoopNode::Node(VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint; - VRFTU(TUIndex).suppTempSetPoint = coolCoilTempSetPoint; + Real64 coolCoilTempSetPoint = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOutletNodeNum).TempSetPoint; + state.dataHVACVarRefFlow->VRFTU(TUIndex).suppTempSetPoint = coolCoilTempSetPoint; Real64 heatCoilTempSetPoint = coolCoilTempSetPoint; // adjust coil control for fan heat when set point is at outlet node Real64 coolfanDeltaT = 0.0; Real64 heatfanDeltaT = 0.0; - if (VRFTU(TUIndex).FanPlace == DataHVACGlobals::DrawThru) { - if (VRFTU(TUIndex).fanOutletNode > 0) - coolfanDeltaT = DataLoopNode::Node(VRFTU(TUIndex).fanOutletNode).Temp - DataLoopNode::Node(VRFTU(TUIndex).fanInletNode).Temp; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanPlace == DataHVACGlobals::DrawThru) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOutletNode > 0) + coolfanDeltaT = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOutletNode).Temp - DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).fanInletNode).Temp; } heatfanDeltaT = coolfanDeltaT; // or the set point could be placed at either or both coils, update both if necessary - if (VRFTU(TUIndex).CoolingCoilPresent) { - if (DataLoopNode::Node(VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint != DataLoopNode::SensedNodeFlagValue) { - coolCoilTempSetPoint = DataLoopNode::Node(VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolingCoilPresent) { + if (DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint != DataLoopNode::SensedNodeFlagValue) { + coolCoilTempSetPoint = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirOutNode).TempSetPoint; //// should we adjust for fan heat or not? What if it's a mixed air SP that already adjusts for fan heat? // coolfanDeltaT = 0.0; } } - if (VRFTU(TUIndex).HeatingCoilPresent) { - if (DataLoopNode::Node(VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint != DataLoopNode::SensedNodeFlagValue) { - heatCoilTempSetPoint = DataLoopNode::Node(VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatingCoilPresent) { + if (DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint != DataLoopNode::SensedNodeFlagValue) { + heatCoilTempSetPoint = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirOutNode).TempSetPoint; //// should we adjust for fan heat or not? What if it's a mixed air SP that already adjusts for fan heat? // heatfanDeltaT = 0.0; } @@ -9563,63 +9452,63 @@ namespace HVACVariableRefrigerantFlow { // set a flow rate and simulate ATMixer/OASystem if needed if (FirstHVACIteration) { SetAverageAirFlow(state, TUIndex, 1.0, OnOffAirFlowRatio); - if (VRFTU(TUIndex).ATMixerExists) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerExists) { // There is an air terminal mixer - if (VRFTU(TUIndex).ATMixerType == DataHVACGlobals::ATMixer_InletSide) { // if there is an inlet side air terminal mixer + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerType == DataHVACGlobals::ATMixer_InletSide) { // if there is an inlet side air terminal mixer // set the primary air inlet mass flow rate - DataLoopNode::Node(VRFTU(TUIndex).ATMixerPriNode).MassFlowRate = - min(DataLoopNode::Node(VRFTU(TUIndex).ATMixerPriNode).MassFlowRateMaxAvail, - DataLoopNode::Node(VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate); + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerPriNode).MassFlowRate = + min(DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerPriNode).MassFlowRateMaxAvail, + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate); // now calculate the the mixer outlet air conditions (and the secondary air inlet flow rate). The mixer outlet flow rate // has already been set above (it is the "inlet" node flow rate) - SingleDuct::SimATMixer(state, VRFTU(TUIndex).ATMixerName, FirstHVACIteration, VRFTU(TUIndex).ATMixerIndex); + SingleDuct::SimATMixer(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(TUIndex).ATMixerIndex); } } else { // simulate OA Mixer - if (VRFTU(TUIndex).OAMixerUsed) - SimOAMixer(state, VRFTU(TUIndex).OAMixerName, FirstHVACIteration, VRFTU(TUIndex).OAMixerIndex); + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex); } } // identify a coil inlet temperature - if (VRFTU(TUIndex).CoolingCoilPresent) { - VRFTU(TUIndex).coilInNodeT = DataLoopNode::Node(VRFTU(TUIndex).coolCoilAirInNode).Temp; - VRFTU(TUIndex).coilInNodeW = DataLoopNode::Node(VRFTU(TUIndex).coolCoilAirInNode).HumRat; + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolingCoilPresent) { + state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirInNode).Temp; + state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).coolCoilAirInNode).HumRat; } else { - VRFTU(TUIndex).coilInNodeT = DataLoopNode::Node(VRFTU(TUIndex).heatCoilAirInNode).Temp; - VRFTU(TUIndex).coilInNodeW = DataLoopNode::Node(VRFTU(TUIndex).heatCoilAirInNode).HumRat; + state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirInNode).Temp; + state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).heatCoilAirInNode).HumRat; } - Real64 coilInletTemp = VRFTU(TUIndex).coilInNodeT; - Real64 coilInletHumRat = VRFTU(TUIndex).coilInNodeW; - Real64 coilInletMassFlow = DataLoopNode::Node(VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate; - VRFTU(TUIndex).coolSPActive = false; - VRFTU(TUIndex).heatSPActive = false; + Real64 coilInletTemp = state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeT; + Real64 coilInletHumRat = state.dataHVACVarRefFlow->VRFTU(TUIndex).coilInNodeW; + Real64 coilInletMassFlow = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate; + state.dataHVACVarRefFlow->VRFTU(TUIndex).coolSPActive = false; + state.dataHVACVarRefFlow->VRFTU(TUIndex).heatSPActive = false; if ((heatCoilTempSetPoint - coilInletTemp - heatfanDeltaT) > DataHVACGlobals::SmallTempDiff) { // heating Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(coilInletHumRat); ZoneLoad = coilInletMassFlow * CpAirIn * (heatCoilTempSetPoint - coilInletTemp - heatfanDeltaT); - VRFTU(TUIndex).heatSPActive = true; - VRFTU(TUIndex).heatLoadToSP = ZoneLoad; - ++NumHeatingLoads(VRFCond); - SumHeatingLoads(VRFCond) += ZoneLoad; - MinDeltaT(VRFCond) = min(MinDeltaT(VRFCond), -1.0); - VRFTU(TUIndex).coilTempSetPoint = heatCoilTempSetPoint - heatfanDeltaT; + state.dataHVACVarRefFlow->VRFTU(TUIndex).heatSPActive = true; + state.dataHVACVarRefFlow->VRFTU(TUIndex).heatLoadToSP = ZoneLoad; + ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond); + state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad; + state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), -1.0); + state.dataHVACVarRefFlow->VRFTU(TUIndex).coilTempSetPoint = heatCoilTempSetPoint - heatfanDeltaT; } else if ((coilInletTemp - coolCoilTempSetPoint - coolfanDeltaT) > DataHVACGlobals::SmallTempDiff) { // cooling Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(coilInletHumRat); ZoneLoad = coilInletMassFlow * CpAirIn * (coolCoilTempSetPoint - coilInletTemp - coolfanDeltaT); - VRFTU(TUIndex).coolSPActive = true; - VRFTU(TUIndex).coolLoadToSP = ZoneLoad; - ++NumCoolingLoads(VRFCond); - SumCoolingLoads(VRFCond) += ZoneLoad; - MaxDeltaT(VRFCond) = max(MaxDeltaT(VRFCond), 1.0); - VRFTU(TUIndex).coilTempSetPoint = coolCoilTempSetPoint - coolfanDeltaT; + state.dataHVACVarRefFlow->VRFTU(TUIndex).coolSPActive = true; + state.dataHVACVarRefFlow->VRFTU(TUIndex).coolLoadToSP = ZoneLoad; + ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond); + state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += ZoneLoad; + state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), 1.0); + state.dataHVACVarRefFlow->VRFTU(TUIndex).coilTempSetPoint = coolCoilTempSetPoint - coolfanDeltaT; } } else { // else is not set point controlled // Constant fan systems are tested for ventilation load to determine if load to be met changes. // more logic may be needed here, what is the OA flow rate, was last mode heating or cooling, what control is used, etc... - getVRFTUZoneLoad(TUIndex, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, true); + getVRFTUZoneLoad(state, TUIndex, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, true); - if (VRF(VRFCond).ThermostatPriority == ThermostatOffsetPriority) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == iThermostatCtrlType::ThermostatOffsetPriority) { // for TSTATPriority, just check difference between zone temp and thermostat setpoint if (ThisZoneNum > 0) { SPTempHi = ZoneThermostatSetPointHi(ThisZoneNum); @@ -9631,41 +9520,41 @@ namespace HVACVariableRefrigerantFlow { } else if (SELECT_CASE_var == DataHVACGlobals::SingleHeatingSetPoint) { // if heating load, ZoneDeltaT will be negative ZoneDeltaT = min(0.0, ZT(ThisZoneNum) - SPTempLo); - MinDeltaT(VRFCond) = min(MinDeltaT(VRFCond), ZoneDeltaT); + state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT); } else if (SELECT_CASE_var == DataHVACGlobals::SingleCoolingSetPoint) { // if cooling load, ZoneDeltaT will be positive ZoneDeltaT = max(0.0, ZT(ThisZoneNum) - SPTempHi); - MaxDeltaT(VRFCond) = max(MaxDeltaT(VRFCond), ZoneDeltaT); + state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT); } else if (SELECT_CASE_var == DataHVACGlobals::SingleHeatCoolSetPoint) { ZoneDeltaT = ZT(ThisZoneNum) - SPTempHi; //- SPTempHi and SPTempLo are same value if (ZoneDeltaT > 0.0) { - MaxDeltaT(VRFCond) = max(MaxDeltaT(VRFCond), ZoneDeltaT); + state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT); } else { - MinDeltaT(VRFCond) = min(MinDeltaT(VRFCond), ZoneDeltaT); + state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT); } } else if (SELECT_CASE_var == DataHVACGlobals::DualSetPointWithDeadBand) { if (ZT(ThisZoneNum) - SPTempHi > 0.0) { ZoneDeltaT = max(0.0, ZT(ThisZoneNum) - SPTempHi); - MaxDeltaT(VRFCond) = max(MaxDeltaT(VRFCond), ZoneDeltaT); + state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT); } else if (SPTempLo - ZT(ThisZoneNum) > 0.0) { ZoneDeltaT = min(0.0, ZT(ThisZoneNum) - SPTempLo); - MinDeltaT(VRFCond) = min(MinDeltaT(VRFCond), ZoneDeltaT); + state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT); } } else { } } } - } else if (VRF(VRFCond).ThermostatPriority == LoadPriority || VRF(VRFCond).ThermostatPriority == ZonePriority) { - if (VRFTU(TUIndex).OpMode == DataHVACGlobals::ContFanCycCoil) { - SetCompFlowRate(TUIndex, VRFCond); + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == iThermostatCtrlType::LoadPriority || state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority == iThermostatCtrlType::ZonePriority) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OpMode == DataHVACGlobals::ContFanCycCoil) { + SetCompFlowRate(state, TUIndex, VRFCond); - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(TUIndex).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(TUIndex).CalcVRF(state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF(state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } // If the Terminal Unit has a net cooling capacity (NoCompOutput < 0) and @@ -9675,37 +9564,37 @@ namespace HVACVariableRefrigerantFlow { if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. if (TempControlType(ThisZoneNum) != DataHVACGlobals::SingleCoolingSetPoint && TempControlType(ThisZoneNum) != 0) { - if (!LastModeHeating(VRFCond)) { + if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // if last mode was cooling, make sure heating flow rate is used - if (VRFTU(TUIndex).OAMixerUsed) { - DataLoopNode::Node(VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate = - VRFTU(TUIndex).MaxHeatAirMassFlow; - DataLoopNode::Node(VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate = VRFTU(TUIndex).HeatOutAirMassFlow; - SimOAMixer(state, VRFTU(TUIndex).OAMixerName, FirstHVACIteration, VRFTU(TUIndex).OAMixerIndex); + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate = + state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxHeatAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatOutAirMassFlow; + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex); } else { - DataLoopNode::Node(VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate = VRFTU(TUIndex).MaxHeatAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxHeatAirMassFlow; } // recalculate using correct flow rate - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(TUIndex).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(TUIndex).CalcVRF( + state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } if (TempOutput < LoadToHeatingSP) { - ++NumHeatingLoads(VRFCond); + ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond); // sum heating load on condenser, not total zone heating load - SumHeatingLoads(VRFCond) += (LoadToHeatingSP - TempOutput); + state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += (LoadToHeatingSP - TempOutput); } } else { - ++NumHeatingLoads(VRFCond); + ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond); // sum heating load on condenser, not total zone heating load - SumHeatingLoads(VRFCond) += (LoadToHeatingSP - TempOutput); + state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += (LoadToHeatingSP - TempOutput); } } } else if (TempOutput < ZoneLoad) { @@ -9713,9 +9602,9 @@ namespace HVACVariableRefrigerantFlow { // off coil do nothing, the zone will float } else if (ZoneLoad < 0.0) { // still a cooling load - ++NumCoolingLoads(VRFCond); + ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond); // sum cooling load on condenser, not total zone cooling load - SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput); + state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput); } // If the terminal unit has a net heating capacity and the zone temp is below the Tstat cooling setpoint @@ -9724,162 +9613,163 @@ namespace HVACVariableRefrigerantFlow { if (TempOutput > LoadToCoolingSP) { // Don't count as cooling load unless mode is allowed. Also check for floating zone. if (TempControlType(ThisZoneNum) != DataHVACGlobals::SingleHeatingSetPoint && TempControlType(ThisZoneNum) != 0) { - if (!LastModeCooling(VRFCond)) { - if (VRFTU(TUIndex).OAMixerUsed) { - DataLoopNode::Node(VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate = - VRFTU(TUIndex).MaxCoolAirMassFlow; - DataLoopNode::Node(VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate = VRFTU(TUIndex).CoolOutAirMassFlow; - SimOAMixer(state, VRFTU(TUIndex).OAMixerName, FirstHVACIteration, VRFTU(TUIndex).OAMixerIndex); + if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) { + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate = + state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxCoolAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerOANodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolOutAirMassFlow; + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerIndex); } else { - DataLoopNode::Node(VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate = VRFTU(TUIndex).MaxCoolAirMassFlow; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUInletNodeNum).MassFlowRate = state.dataHVACVarRefFlow->VRFTU(TUIndex).MaxCoolAirMassFlow; } - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(TUIndex).CalcVRF_FluidTCtrl( + state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF_FluidTCtrl( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(TUIndex).CalcVRF( + state.dataHVACVarRefFlow->VRFTU(TUIndex).CalcVRF( state, TUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } if (TempOutput > LoadToCoolingSP) { - ++NumCoolingLoads(VRFCond); - SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput); + ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond); + state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput); } } else { - ++NumCoolingLoads(VRFCond); - SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput); + ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond); + state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += (LoadToCoolingSP - TempOutput); } } } else if (TempOutput > ZoneLoad) { // do nothing, zone will float } else if (ZoneLoad > 0.0) { - ++NumHeatingLoads(VRFCond); - SumHeatingLoads(VRFCond) += ZoneLoad; + ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond); + state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad; } // ELSE there is no overshoot and the zone has a valid cooling load } else if (ZoneLoad < 0.0) { - ++NumCoolingLoads(VRFCond); - SumCoolingLoads(VRFCond) += ZoneLoad; + ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond); + state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += ZoneLoad; // ELSE there is no overshoot and the zone has a valid heating load } else if (ZoneLoad > 0.0) { - ++NumHeatingLoads(VRFCond); - SumHeatingLoads(VRFCond) += ZoneLoad; + ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond); + state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad; } } else { // is cycling fan if (ZoneLoad > 0.0) { - ++NumHeatingLoads(VRFCond); - SumHeatingLoads(VRFCond) += ZoneLoad; + ++state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond); + state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) += ZoneLoad; } else if (ZoneLoad < 0.0) { - ++NumCoolingLoads(VRFCond); - SumCoolingLoads(VRFCond) += ZoneLoad; + ++state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond); + state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) += ZoneLoad; } - } // IF(VRFTU(TUIndex)%OpMode == DataHVACGlobals::ContFanCycCoil)THEN + } } } } // Determine operating mode based on VRF type and thermostat control selection { - auto const SELECT_CASE_var(VRF(VRFCond).ThermostatPriority); - if (SELECT_CASE_var == ThermostatOffsetPriority) { - if (MaxDeltaT(VRFCond) > std::abs(MinDeltaT(VRFCond)) && MaxDeltaT(VRFCond) > 0.0) { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = true; - } else if (MaxDeltaT(VRFCond) < std::abs(MinDeltaT(VRFCond)) && MinDeltaT(VRFCond) < 0.0) { - HeatingLoad(VRFCond) = true; - CoolingLoad(VRFCond) = false; + auto const SELECT_CASE_var(state.dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority); + if (SELECT_CASE_var == iThermostatCtrlType::ThermostatOffsetPriority) { + if (state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) > std::abs(state.dataHVACVarRefFlow->MinDeltaT(VRFCond)) && state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) > 0.0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; + } else if (state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) < std::abs(state.dataHVACVarRefFlow->MinDeltaT(VRFCond)) && state.dataHVACVarRefFlow->MinDeltaT(VRFCond) < 0.0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; } else { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; - } - } else if (SELECT_CASE_var == LoadPriority) { - if (SumHeatingLoads(VRFCond) > std::abs(SumCoolingLoads(VRFCond)) && SumHeatingLoads(VRFCond) > 0.0) { - HeatingLoad(VRFCond) = true; - CoolingLoad(VRFCond) = false; - } else if (SumHeatingLoads(VRFCond) <= std::abs(SumCoolingLoads(VRFCond)) && SumCoolingLoads(VRFCond) < 0.0) { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + } + } else if (SELECT_CASE_var == iThermostatCtrlType::LoadPriority) { + if (state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) > std::abs(state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond)) && state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) > 0.0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + } else if (state.dataHVACVarRefFlow->SumHeatingLoads(VRFCond) <= std::abs(state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond)) && state.dataHVACVarRefFlow->SumCoolingLoads(VRFCond) < 0.0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; } else { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; - } - } else if (SELECT_CASE_var == ZonePriority) { - if (NumHeatingLoads(VRFCond) > NumCoolingLoads(VRFCond) && NumHeatingLoads(VRFCond) > 0) { - HeatingLoad(VRFCond) = true; - CoolingLoad(VRFCond) = false; - } else if (NumHeatingLoads(VRFCond) <= NumCoolingLoads(VRFCond) && NumCoolingLoads(VRFCond) > 0) { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + } + } else if (SELECT_CASE_var == iThermostatCtrlType::ZonePriority) { + if (state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) > state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) && state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) > 0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + } else if (state.dataHVACVarRefFlow->NumHeatingLoads(VRFCond) <= state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) && state.dataHVACVarRefFlow->NumCoolingLoads(VRFCond) > 0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; } else { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; - } - } else if (SELECT_CASE_var == ScheduledPriority) { - if (GetCurrentScheduleValue(state, VRF(VRFCond).SchedPriorityPtr) == 0) { - HeatingLoad(VRFCond) = true; - CoolingLoad(VRFCond) = false; - } else if (GetCurrentScheduleValue(state, VRF(VRFCond).SchedPriorityPtr) == 1) { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + } + } else if (SELECT_CASE_var == iThermostatCtrlType::ScheduledPriority) { + if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPriorityPtr) == 0) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + } else if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPriorityPtr) == 1) { + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; } else { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; } - } else if (SELECT_CASE_var == MasterThermostatPriority) { - ZoneLoad = ZoneSysEnergyDemand(VRF(VRFCond).MasterZonePtr).RemainingOutputRequired / - VRFTU(VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac; - if (VRFTU(VRF(VRFCond).MasterZoneTUIndex).OpMode == DataHVACGlobals::ContFanCycCoil) { - SetCompFlowRate(VRF(VRFCond).MasterZoneTUIndex, VRFCond); + } else if (SELECT_CASE_var == iThermostatCtrlType::MasterThermostatPriority) { + ZoneLoad = ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZonePtr).RemainingOutputRequired / + state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac; + if (state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).OpMode == DataHVACGlobals::ContFanCycCoil) { + SetCompFlowRate(state, state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex, VRFCond); - if (VRF(VRFCond).VRFAlgorithmTypeNum == AlgorithmTypeFluidTCtrl) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).VRFAlgorithmTypeNum == iAlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - VRFTU(VRF(VRFCond).MasterZoneTUIndex) + state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex) .CalcVRF_FluidTCtrl( - state, VRF(VRFCond).MasterZoneTUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state, state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } else { // Algorithm Type: VRF model based on system curve - VRFTU(VRF(VRFCond).MasterZoneTUIndex) - .CalcVRF(state, VRF(VRFCond).MasterZoneTUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); + state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex) + .CalcVRF(state, state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex, FirstHVACIteration, 0.0, TempOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); } - LoadToCoolingSP = ZoneSysEnergyDemand(VRF(VRFCond).MasterZonePtr).OutputRequiredToCoolingSP / - VRFTU(VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac; - LoadToHeatingSP = ZoneSysEnergyDemand(VRF(VRFCond).MasterZonePtr).OutputRequiredToHeatingSP / - VRFTU(VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac; + LoadToCoolingSP = ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZonePtr).OutputRequiredToCoolingSP / + state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac; + LoadToHeatingSP = ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZonePtr).OutputRequiredToHeatingSP / + state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex).controlZoneMassFlowFrac; if (TempOutput < LoadToHeatingSP) { - CoolingLoad(VRFCond) = false; - HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; } else if (TempOutput > LoadToCoolingSP) { - CoolingLoad(VRFCond) = true; - HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; } else { - CoolingLoad(VRFCond) = false; - HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; } } else if (ZoneLoad > 0.0) { - HeatingLoad(VRFCond) = true; - CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; } else if (ZoneLoad < 0.0) { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = true; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; } else { - HeatingLoad(VRFCond) = false; - CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; } - } else if (SELECT_CASE_var == FirstOnPriority) { + } else if (SELECT_CASE_var == iThermostatCtrlType::FirstOnPriority) { // na } else { } } // limit to one possible mode - if (CoolingLoad(VRFCond) && HeatingLoad(VRFCond)) HeatingLoad(VRFCond) = false; + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; } - void LimitTUCapacity(int const VRFCond, // Condenser Unit index + void LimitTUCapacity(EnergyPlusData &state, + int const VRFCond, // Condenser Unit index int const NumTUInList, // Number of terminal units in list Real64 const StartingCapacity, // temporary variable holding condenser capacity [W] const Array1D &CapArray, // Array of coil capacities in either cooling or heating mode [W] @@ -9923,15 +9813,15 @@ namespace HVACVariableRefrigerantFlow { // ** add in logic to limit coils operating opposite to mode when heat recovery is used // ** this is a hard one since we are here because the system is overloaded. That means // ** that we do not know at this point the actual operating capacity or compressor power. - if (VRF(VRFCond).HeatRecoveryUsed) { - if (CoolingLoad(VRFCond)) { - RemainingCapacity = StartingCapacity * (1 + 1 / VRF(VRFCond).CoolingCOP); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) { + RemainingCapacity = StartingCapacity * (1 + 1 / state.dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP); if (AltCapacity > RemainingCapacity) { LimitCoilCapacity(NumTUInList, RemainingCapacity, AltArray, AltLimit); } } - if (HeatingLoad(VRFCond)) { - RemainingCapacity = StartingCapacity / (1 + 1 / VRF(VRFCond).HeatingCOP); + if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { + RemainingCapacity = StartingCapacity / (1 + 1 / state.dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP); if (AltCapacity > RemainingCapacity) { LimitCoilCapacity(NumTUInList, RemainingCapacity, AltArray, AltLimit); } @@ -10020,13 +9910,13 @@ namespace HVACVariableRefrigerantFlow { // PURPOSE OF THIS FUNCTION: // lookup function for VRF terminal unit OA inlet node - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - if (VRFTUNum > 0 && VRFTUNum <= NumVRFTU) { - return VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; + if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) { + return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; } else { return 0; } @@ -10044,13 +9934,13 @@ namespace HVACVariableRefrigerantFlow { // PURPOSE OF THIS FUNCTION: // lookup function for VRF terminal unit zone inlet node - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - if (VRFTUNum > 0 && VRFTUNum <= NumVRFTU) { - return VRFTU(VRFTUNum).VRFTUOutletNodeNum; + if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) { + return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum; } else { return 0; } @@ -10060,14 +9950,14 @@ namespace HVACVariableRefrigerantFlow { { int NodeNum; // return value of node number - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - int WhichVRFTU = UtilityRoutines::FindItemInList(VRFTUName, VRFTU, &VRFTerminalUnitEquipment::Name, NumVRFTU); + int WhichVRFTU = UtilityRoutines::FindItemInList(VRFTUName, state.dataHVACVarRefFlow->VRFTU, &VRFTerminalUnitEquipment::Name, state.dataHVACVarRefFlow->NumVRFTU); if (WhichVRFTU != 0) { - NodeNum = VRFTU(WhichVRFTU).VRFTUOutletNodeNum; + NodeNum = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).VRFTUOutletNodeNum; } else { ShowSevereError(state, "GetVRFTUOutAirNodeFromName: Could not find VRF TU = \"" + VRFTUName + "\""); errorsFound = true; @@ -10081,14 +9971,14 @@ namespace HVACVariableRefrigerantFlow { { int NodeNum; // return value of node number - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - int WhichVRFTU = UtilityRoutines::FindItemInList(VRFTUName, VRFTU, &VRFTerminalUnitEquipment::Name, NumVRFTU); + int WhichVRFTU = UtilityRoutines::FindItemInList(VRFTUName, state.dataHVACVarRefFlow->VRFTU, &VRFTerminalUnitEquipment::Name, state.dataHVACVarRefFlow->NumVRFTU); if (WhichVRFTU != 0) { - NodeNum = VRFTU(WhichVRFTU).VRFTUInletNodeNum; + NodeNum = state.dataHVACVarRefFlow->VRFTU(WhichVRFTU).VRFTUInletNodeNum; } else { ShowSevereError(state, "GetVRFTUInAirNodeFromName: Could not find VRF TU = \"" + VRFTUName + "\""); errorsFound = true; @@ -10110,13 +10000,13 @@ namespace HVACVariableRefrigerantFlow { // PURPOSE OF THIS FUNCTION: // lookup function for VRF terminal unit mixed air node - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - if (VRFTUNum > 0 && VRFTUNum <= NumVRFTU) { - return VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; + if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) { + return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; } else { return 0; } @@ -10134,77 +10024,77 @@ namespace HVACVariableRefrigerantFlow { // PURPOSE OF THIS FUNCTION: // lookup function for VRF terminal unit return air node - if (GetVRFInputFlag) { + if (state.dataHVACVarRefFlow->GetVRFInputFlag) { GetVRFInput(state); - GetVRFInputFlag = false; + state.dataHVACVarRefFlow->GetVRFInputFlag = false; } - if (VRFTUNum > 0 && VRFTUNum <= NumVRFTU) { - return VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum; + if (VRFTUNum > 0 && VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU) { + return state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum; } else { return 0; } } - void getVRFTUZoneLoad(int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag) + void getVRFTUZoneLoad(EnergyPlusData &state, int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag) { - if (VRFTU(VRFTUNum).zoneSequenceCoolingNum > 0 && VRFTU(VRFTUNum).zoneSequenceHeatingNum > 0 && VRFTU(VRFTUNum).isInAirLoop) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceCoolingNum > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceHeatingNum > 0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInAirLoop) { // air loop equipment uses sequenced variables - LoadToCoolingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum) - .SequencedOutputRequiredToCoolingSP(VRFTU(VRFTUNum).zoneSequenceCoolingNum) / - VRFTU(VRFTUNum).controlZoneMassFlowFrac; - LoadToHeatingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum) - .SequencedOutputRequiredToHeatingSP(VRFTU(VRFTUNum).zoneSequenceHeatingNum) / - VRFTU(VRFTUNum).controlZoneMassFlowFrac; + LoadToCoolingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) + .SequencedOutputRequiredToCoolingSP(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceCoolingNum) / + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + LoadToHeatingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) + .SequencedOutputRequiredToHeatingSP(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceHeatingNum) / + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 && - DataHeatBalFanSys::TempControlType(VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint) { + DataHeatBalFanSys::TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleCoolingSetPoint) { zoneLoad = LoadToHeatingSP; } else if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 && - DataHeatBalFanSys::TempControlType(VRFTU(VRFTUNum).ZoneNum) == DataHVACGlobals::SingleCoolingSetPoint) { + DataHeatBalFanSys::TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == DataHVACGlobals::SingleCoolingSetPoint) { zoneLoad = 0.0; } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 && - DataHeatBalFanSys::TempControlType(VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleHeatingSetPoint) { + DataHeatBalFanSys::TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != DataHVACGlobals::SingleHeatingSetPoint) { zoneLoad = LoadToCoolingSP; } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 && - DataHeatBalFanSys::TempControlType(VRFTU(VRFTUNum).ZoneNum) == DataHVACGlobals::SingleHeatingSetPoint) { + DataHeatBalFanSys::TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == DataHVACGlobals::SingleHeatingSetPoint) { zoneLoad = 0.0; } else if (LoadToHeatingSP <= 0.0 && LoadToCoolingSP >= 0.0) { zoneLoad = 0.0; } - } else if (VRFTU(VRFTUNum).ZoneNum > 0) { + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum > 0) { // zone equipment uses Remaining* variables if (InitFlag) { // this will need more investigation. Using Remaining* variable during the initial load calculation seems wrong. // This may also have implications when VRF TUs are in the air loop or if SP control is used // another question is whether initialization of the opeating mode should look at TotalOutputRequired or RemainingOutputRequired - zoneLoad = ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired / VRFTU(VRFTUNum).controlZoneMassFlowFrac; - LoadToCoolingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum).OutputRequiredToCoolingSP / - VRFTU(VRFTUNum).controlZoneMassFlowFrac; - LoadToHeatingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum).OutputRequiredToHeatingSP / - VRFTU(VRFTUNum).controlZoneMassFlowFrac; + zoneLoad = ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + LoadToCoolingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).OutputRequiredToCoolingSP / + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + LoadToHeatingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).OutputRequiredToHeatingSP / + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; } else { - zoneLoad = ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired / VRFTU(VRFTUNum).controlZoneMassFlowFrac; - LoadToCoolingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToCoolSP / - VRFTU(VRFTUNum).controlZoneMassFlowFrac; - LoadToHeatingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToHeatSP / - VRFTU(VRFTUNum).controlZoneMassFlowFrac; - } - } else if (VRFTU(VRFTUNum).isSetPointControlled) { - if (VRFTU(VRFTUNum).coolSPActive) { - LoadToCoolingSP = VRFTU(VRFTUNum).coolLoadToSP; + zoneLoad = ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + LoadToCoolingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToCoolSP / + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + LoadToHeatingSP = DataZoneEnergyDemands::ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputReqToHeatSP / + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; + } + } else if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolSPActive) { + LoadToCoolingSP = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).coolLoadToSP; zoneLoad = LoadToCoolingSP; LoadToHeatingSP = 0.0; } - if (VRFTU(VRFTUNum).heatSPActive) { - LoadToHeatingSP = VRFTU(VRFTUNum).heatLoadToSP; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatSPActive) { + LoadToHeatingSP = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).heatLoadToSP; zoneLoad = LoadToHeatingSP; LoadToCoolingSP = 0.0; } } } - void VRFCondenserEquipment::CalcVRFIUTeTc_FluidTCtrl() + void VRFCondenserEquipment::CalcVRFIUTeTc_FluidTCtrl(EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR RP Zhang (LBNL), XF Pang (LBNL), Y Yura (Daikin Inc) @@ -10229,18 +10119,18 @@ namespace HVACVariableRefrigerantFlow { Real64 IUMaxCondTemp; int TUListNum = this->ZoneTUListPtr; - EvapTemp.allocate(TerminalUnitList(TUListNum).NumTUInList); - CondTemp.allocate(TerminalUnitList(TUListNum).NumTUInList); + EvapTemp.allocate(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList); + CondTemp.allocate(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList); IUMinEvapTemp = 100.0; IUMaxCondTemp = 0.0; if (this->AlgorithmIUCtrl == 1) { // 1. HighSensible: analyze the conditions of each IU - for (int i = 1; i <= TerminalUnitList(TUListNum).NumTUInList; i++) { - int VRFTUNum = TerminalUnitList(TUListNum).ZoneTUPtr(i); + for (int i = 1; i <= state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; i++) { + int VRFTUNum = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(i); // analyze the conditions of each IU - VRFTU(VRFTUNum).CalcVRFIUVariableTeTc(EvapTemp(i), CondTemp(i)); + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CalcVRFIUVariableTeTc(state, EvapTemp(i), CondTemp(i)); // select the Te/Tc that can satisfy all the zones IUMinEvapTemp = min(IUMinEvapTemp, EvapTemp(i), this->IUEvapTempHigh); @@ -10257,7 +10147,8 @@ namespace HVACVariableRefrigerantFlow { } } - void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(Real64 &EvapTemp, // evaporating temperature + void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(EnergyPlusData &state, + Real64 &EvapTemp, // evaporating temperature Real64 &CondTemp // condensing temperature ) { @@ -10275,9 +10166,6 @@ namespace HVACVariableRefrigerantFlow { // A new physics based VRF model applicable for Fluid Temperature Control. using namespace DataZoneEnergyDemands; - using DXCoils::DXCoil; - using HVACVariableRefrigerantFlow::VRF; - using HVACVariableRefrigerantFlow::VRFTU; using MixedAir::SimOAMixer; using Psychrometrics::PsyHFnTdbW; using SingleDuct::SimATMixer; @@ -10321,24 +10209,24 @@ namespace HVACVariableRefrigerantFlow { HeatCoilNum = this->HeatCoilIndex; ZoneIndex = this->ZoneNum; VRFNum = this->VRFSysNum; - TUListIndex = VRF(VRFNum).ZoneTUListPtr; + TUListIndex = state.dataHVACVarRefFlow->VRF(VRFNum).ZoneTUListPtr; IndexToTUInTUList = this->IndexToTUInTUList; // Bounds of Te/Tc for VRF IU Control Algorithm: VariableTemp - EvapTempMin = VRF(VRFNum).IUEvapTempLow; - EvapTempMax = VRF(VRFNum).IUEvapTempHigh; - CondTempMin = VRF(VRFNum).IUCondTempLow; - CondTempMax = VRF(VRFNum).IUCondTempHigh; + EvapTempMin = state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempLow; + EvapTempMax = state.dataHVACVarRefFlow->VRF(VRFNum).IUEvapTempHigh; + CondTempMin = state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempLow; + CondTempMax = state.dataHVACVarRefFlow->VRF(VRFNum).IUCondTempHigh; // Coefficients describing coil performance - SH = DXCoil(CoolCoilNum).SH; - SC = DXCoil(HeatCoilNum).SC; - C1Tevap = DXCoil(CoolCoilNum).C1Te; - C2Tevap = DXCoil(CoolCoilNum).C2Te; - C3Tevap = DXCoil(CoolCoilNum).C3Te; - C1Tcond = DXCoil(HeatCoilNum).C1Tc; - C2Tcond = DXCoil(HeatCoilNum).C2Tc; - C3Tcond = DXCoil(HeatCoilNum).C3Tc; + SH = state.dataDXCoils->DXCoil(CoolCoilNum).SH; + SC = state.dataDXCoils->DXCoil(HeatCoilNum).SC; + C1Tevap = state.dataDXCoils->DXCoil(CoolCoilNum).C1Te; + C2Tevap = state.dataDXCoils->DXCoil(CoolCoilNum).C2Te; + C3Tevap = state.dataDXCoils->DXCoil(CoolCoilNum).C3Te; + C1Tcond = state.dataDXCoils->DXCoil(HeatCoilNum).C1Tc; + C2Tcond = state.dataDXCoils->DXCoil(HeatCoilNum).C2Tc; + C3Tcond = state.dataDXCoils->DXCoil(HeatCoilNum).C3Tc; VRFInletNode = this->VRFTUInletNodeNum; T_TU_in = DataLoopNode::Node(VRFInletNode).Temp; @@ -10346,7 +10234,7 @@ namespace HVACVariableRefrigerantFlow { T_coil_in = this->coilInNodeT; W_coil_in = this->coilInNodeW; - Garate = CompOnMassFlow; + Garate = state.dataHVACVarRefFlow->CompOnMassFlow; H_coil_in = PsyHFnTdbW(T_coil_in, W_coil_in); RHsat = 0.98; BFC = 0.0592; @@ -10356,10 +10244,10 @@ namespace HVACVariableRefrigerantFlow { Real64 LoadToCoolingSP = 0.0; // 1. COOLING Mode - if ((Garate > 0.0) && ((!VRF(VRFNum).HeatRecoveryUsed && CoolingLoad(VRFNum)) || - (VRF(VRFNum).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)))) { + if ((Garate > 0.0) && ((!state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFNum)) || + (state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList)))) { // 1.1) Cooling coil is running - getVRFTUZoneLoad(IndexToTUInTUList, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); + getVRFTUZoneLoad(state, IndexToTUInTUList, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); QZnReqSenCoolingLoad = max(0.0, -1.0 * LoadToCoolingSP); Tout = T_TU_in - QZnReqSenCoolingLoad * 1.2 / Garate / 1005; Th2 = T_coil_in - (T_coil_in - Tout) / (1 - BFC); @@ -10372,10 +10260,10 @@ namespace HVACVariableRefrigerantFlow { } // 2. HEATING Mode - if ((Garate > 0.0) && ((!VRF(VRFNum).HeatRecoveryUsed && HeatingLoad(VRFNum)) || - (VRF(VRFNum).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)))) { + if ((Garate > 0.0) && ((!state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFNum)) || + (state.dataHVACVarRefFlow->VRF(VRFNum).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList)))) { // 2.1) Heating coil is running - getVRFTUZoneLoad(IndexToTUInTUList, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); + getVRFTUZoneLoad(state, IndexToTUInTUList, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); QZnReqSenHeatingLoad = max(0.0, LoadToHeatingSP); Tout = T_TU_in + QZnReqSenHeatingLoad / Garate / 1005; Th2 = T_coil_in + (Tout - T_coil_in) / (1 - BFH); @@ -10406,11 +10294,6 @@ namespace HVACVariableRefrigerantFlow { // A new physics based VRF model applicable for Fluid Temperature Control. using CurveManager::CurveValue; - using DXCoils::DXCoil; - using DXCoils::DXCoilCoolInletAirWBTemp; - using DXCoils::DXCoilHeatInletAirDBTemp; - using DXCoils::DXCoilHeatInletAirWBTemp; - using DXCoils::DXCoilTotalHeating; using FluidProperties::FindRefrigerant; using FluidProperties::GetSatEnthalpyRefrig; using FluidProperties::GetSatPressureRefrig; @@ -10566,8 +10449,8 @@ namespace HVACVariableRefrigerantFlow { // variable initializations TUListNum = this->ZoneTUListPtr; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; - VRFCond = VRFTU(TerminalUnitList(TUListNum).ZoneTUPtr(1)).VRFSysNum; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; + VRFCond = state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(1)).VRFSysNum; TU_CoolingLoad = 0.0; TU_HeatingLoad = 0.0; TUParasiticPower = 0.0; @@ -10615,28 +10498,28 @@ namespace HVACVariableRefrigerantFlow { // sum loads on TU coils for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TU_CoolingLoad += TerminalUnitList(TUListNum).TotalCoolLoad(NumTU); - TU_HeatingLoad += TerminalUnitList(TUListNum).TotalHeatLoad(NumTU); - TUParasiticPower += VRFTU(TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).ParasiticCoolElecPower + - VRFTU(TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).ParasiticHeatElecPower; - TUFanPower += VRFTU(TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).FanPower; + TU_CoolingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU); + TU_HeatingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU); + TUParasiticPower += state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).ParasiticCoolElecPower + + state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).ParasiticHeatElecPower; + TUFanPower += state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU)).FanPower; } this->TUCoolingLoad = TU_CoolingLoad; // this is cooling coil load, not terminal unit load this->TUHeatingLoad = TU_HeatingLoad; // this is heating coil load, not terminal unit load // loop through TU's and calculate average inlet conditions for active coils for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = VRFTU(TUIndex).CoolCoilIndex; - HeatCoilIndex = VRFTU(TUIndex).HeatCoilIndex; + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; + HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; - if (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) { - SumCoolInletWB += DXCoilCoolInletAirWBTemp(CoolCoilIndex) * TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TU_CoolingLoad; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0.0) { + SumCoolInletWB += state.dataDXCoils->DXCoilCoolInletAirWBTemp(CoolCoilIndex) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / TU_CoolingLoad; ++NumTUInCoolingMode; } - if (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) { - SumHeatInletDB += DXCoilHeatInletAirDBTemp(HeatCoilIndex) * TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad; - SumHeatInletWB += DXCoilHeatInletAirWBTemp(HeatCoilIndex) * TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0.0) { + SumHeatInletDB += state.dataDXCoils->DXCoilHeatInletAirDBTemp(HeatCoilIndex) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad; + SumHeatInletWB += state.dataDXCoils->DXCoilHeatInletAirWBTemp(HeatCoilIndex) * state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / TU_HeatingLoad; ++NumTUInHeatingMode; } } @@ -10682,13 +10565,13 @@ namespace HVACVariableRefrigerantFlow { if (TU_HeatingLoad > 0) { HRHeatRequestFlag = true; } else { - HeatingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; HRHeatRequestFlag = false; } if (TU_CoolingLoad > 0) { HRCoolRequestFlag = true; } else { - CoolingLoad(VRFCond) = false; + state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; HRCoolRequestFlag = false; } @@ -10699,7 +10582,7 @@ namespace HVACVariableRefrigerantFlow { this->OperatingMode = 0; // report variable for heating or cooling mode // 1. VRF-HP Cooling Mode .OR. VRF-HR Mode_1 - if ((!this->HeatRecoveryUsed && CoolingLoad(VRFCond)) || (this->HeatRecoveryUsed && !HRHeatRequestFlag && HRCoolRequestFlag)) { + if ((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) || (this->HeatRecoveryUsed && !HRHeatRequestFlag && HRCoolRequestFlag)) { this->OperatingMode = ModeCoolingOnly; this->VRFOperationSimPath = 10; @@ -10770,27 +10653,27 @@ namespace HVACVariableRefrigerantFlow { } else { for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { // Calc total refrigerant flow rate - if (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = VRFTU(TUIndex).CoolCoilIndex; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; RefTSat = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pevap, RefPHigh), RefPLow), RefrigerantIndex, RoutineName); h_IU_evap_out_i = GetSupHeatEnthalpyRefrig(state, this->RefrigerantName, - max(RefTSat, this->IUEvaporatingTemp + DXCoil(CoolCoilIndex).ActualSH), + max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH), max(min(Pevap, RefPHigh), RefPLow), RefrigerantIndex, RoutineName); if (h_IU_evap_out_i > h_IU_evap_in) { - m_ref_IU_evap_i = (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) + m_ref_IU_evap_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) ? 0.0 - : (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / + : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / (h_IU_evap_out_i - h_IU_evap_in)); // Ref Flow Rate in the IU( kg/s ) m_ref_IU_evap = m_ref_IU_evap + m_ref_IU_evap_i; h_IU_evap_out = h_IU_evap_out + m_ref_IU_evap_i * h_IU_evap_out_i; - SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * DXCoil(CoolCoilIndex).ActualSH; + SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH; } } } @@ -10868,7 +10751,7 @@ namespace HVACVariableRefrigerantFlow { // *VRF OU TeTc calculations m_air = this->OUAirFlowRate * RhoAir; SC_OU = this->SC; - this->VRFOU_TeTc(state, FlagCondMode, Q_h_OU, SC_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->CondensingTemp); + this->VRFOU_TeTc(state, iHXOpMode::CondMode, Q_h_OU, SC_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->CondensingTemp); this->CondensingTemp = min(CapMaxTc, this->CondensingTemp); this->SC = SC_OU; @@ -10925,11 +10808,11 @@ namespace HVACVariableRefrigerantFlow { CurveValue( state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, Tsuction); // Include the piping loss, at the highest compressor speed this->PipingCorrectionCooling = TU_CoolingLoad / (TU_CoolingLoad + Pipe_Q_c); - MaxCoolingCapacity(VRFCond) = this->CoolingCapacity; // for report, maximum evaporating capacity of the system + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = this->CoolingCapacity; // for report, maximum evaporating capacity of the system this->HeatingCapacity = 0.0; // Include the piping loss this->PipingCorrectionHeating = 1.0; // 1 means no piping loss - MaxHeatingCapacity(VRFCond) = 0.0; + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = 0.0; this->OUCondHeatRate = Q_h_OU; this->OUEvapHeatRate = 0; @@ -10937,7 +10820,7 @@ namespace HVACVariableRefrigerantFlow { this->IUEvapHeatRate = TU_CoolingLoad; // 2. VRF-HP Heating Mode .OR. VRF-HR Mode_6 - } else if ((!this->HeatRecoveryUsed && HeatingLoad(VRFCond)) || (this->HeatRecoveryUsed && !HRCoolRequestFlag && HRHeatRequestFlag)) { + } else if ((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) || (this->HeatRecoveryUsed && !HRCoolRequestFlag && HRHeatRequestFlag)) { this->OperatingMode = ModeHeatingOnly; this->VRFOperationSimPath = 60; @@ -10988,23 +10871,23 @@ namespace HVACVariableRefrigerantFlow { } else { for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { - if (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - HeatCoilIndex = VRFTU(TUIndex).HeatCoilIndex; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) { + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; h_IU_cond_out_i = GetSatEnthalpyRefrig( state, this->RefrigerantName, GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pcond, RefPHigh), RefPLow), RefrigerantIndex, RoutineName) - - DXCoil(HeatCoilIndex).ActualSC, + state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC, 0.0, RefrigerantIndex, RoutineName); // Quality=0 - m_ref_IU_cond_i = (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0) + m_ref_IU_cond_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0) ? 0.0 - : (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i)); + : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i)); m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i; h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i; - SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * DXCoil(HeatCoilIndex).ActualSC; + SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC; } } if (m_ref_IU_cond > 0) { @@ -11087,7 +10970,7 @@ namespace HVACVariableRefrigerantFlow { // *VRF OU Te calculations m_air = this->OUAirFlowRate * RhoAir; SH_OU = this->SH; - this->VRFOU_TeTc(state, FlagEvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp); + this->VRFOU_TeTc(state, iHXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp); this->SH = SH_OU; // *VRF OU Compressor Simulation at heating mode: Specify the compressor speed and power consumption @@ -11146,11 +11029,11 @@ namespace HVACVariableRefrigerantFlow { Tdischarge, Tsuction); // Include the piping loss, at the highest compressor speed this->PipingCorrectionHeating = TU_HeatingLoad / (TU_HeatingLoad + Pipe_Q_h); - MaxHeatingCapacity(VRFCond) = this->HeatingCapacity; // for report, maximum condensing capacity the system can provide + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = this->HeatingCapacity; // for report, maximum condensing capacity the system can provide this->CoolingCapacity = 0.0; // Include the piping loss this->PipingCorrectionCooling = 0.0; - MaxCoolingCapacity(VRFCond) = 0.0; // for report + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = 0.0; // for report this->OUCondHeatRate = 0; this->OUEvapHeatRate = Q_c_OU; @@ -11207,23 +11090,23 @@ namespace HVACVariableRefrigerantFlow { h_IU_cond_out_ave = 0; SC_IU_merged = 0; for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { - if (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - HeatCoilIndex = VRFTU(TUIndex).HeatCoilIndex; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) > 0) { + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + HeatCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; h_IU_cond_out_i = GetSatEnthalpyRefrig( state, this->RefrigerantName, GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pcond, RefPHigh), RefPLow), RefrigerantIndex, RoutineName) - - DXCoil(HeatCoilIndex).ActualSC, + state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC, 0.0, RefrigerantIndex, RoutineName); // Quality=0 - m_ref_IU_cond_i = (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0) + m_ref_IU_cond_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) <= 0.0) ? 0.0 - : (TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i)); + : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad(NumTU) / (h_IU_cond_in - h_IU_cond_out_i)); m_ref_IU_cond = m_ref_IU_cond + m_ref_IU_cond_i; h_IU_cond_out_ave = h_IU_cond_out_ave + m_ref_IU_cond_i * h_IU_cond_out_i; - SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * DXCoil(HeatCoilIndex).ActualSC; + SC_IU_merged = SC_IU_merged + m_ref_IU_cond_i * state.dataDXCoils->DXCoil(HeatCoilIndex).ActualSC; } } if (m_ref_IU_cond > 0) { @@ -11255,27 +11138,27 @@ namespace HVACVariableRefrigerantFlow { h_IU_evap_out = 0; SH_IU_merged = 0; for (NumTU = 1; NumTU <= NumTUInList; NumTU++) { // Calc total refrigerant flow rate - if (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = VRFTU(TUIndex).CoolCoilIndex; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; RefTSat = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(Pevap, RefPHigh), RefPLow), RefrigerantIndex, RoutineName); h_IU_evap_out_i = GetSupHeatEnthalpyRefrig(state, this->RefrigerantName, - max(RefTSat, this->IUEvaporatingTemp + DXCoil(CoolCoilIndex).ActualSH), + max(RefTSat, this->IUEvaporatingTemp + state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH), max(min(Pevap, RefPHigh), RefPLow), RefrigerantIndex, RoutineName); if (h_IU_evap_out_i > h_IU_evap_in) { - m_ref_IU_evap_i = (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) + m_ref_IU_evap_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) ? 0.0 - : (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / + : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / (h_IU_evap_out_i - h_IU_evap_in)); // Ref Flow Rate in the IU( kg/s ) m_ref_IU_evap = m_ref_IU_evap + m_ref_IU_evap_i; h_IU_evap_out = h_IU_evap_out + m_ref_IU_evap_i * h_IU_evap_out_i; - SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * DXCoil(CoolCoilIndex).ActualSH; + SH_IU_merged = SH_IU_merged + m_ref_IU_evap_i * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH; } } } @@ -11373,13 +11256,13 @@ namespace HVACVariableRefrigerantFlow { this->HeatingCapacity = this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, Tsuction) + this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(NumOfCompSpdInput), Tdischarge, Tsuction); // Include the piping loss - MaxHeatingCapacity(VRFCond) = + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = this->HeatingCapacity; // for report, maximum heating capacity of the system, at the highest compressor speed this->PipingCorrectionHeating = TU_HeatingLoad / Q_h_TU_PL; this->CoolingCapacity = this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, Tsuction); - MaxCoolingCapacity(VRFCond) = + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = this->CoolingCapacity; // for report, maximum evaporating capacity of the system, at the highest compressor speed this->PipingCorrectionCooling = TU_CoolingLoad / Q_c_TU_PL; @@ -11404,11 +11287,11 @@ namespace HVACVariableRefrigerantFlow { this->HeatingCapacity = 0.0; // Include the piping loss this->PipingCorrectionHeating = 1.0; // 1 means no piping loss - MaxHeatingCapacity(VRFCond) = 0.0; + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) = 0.0; this->CoolingCapacity = 0.0; // Include the piping loss this->PipingCorrectionCooling = 0.0; - MaxCoolingCapacity(VRFCond) = 0.0; // for report + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond) = 0.0; // for report this->CondensingTemp = state.dataEnvrn->OutDryBulbTemp; this->EvaporatingTemp = state.dataEnvrn->OutDryBulbTemp; @@ -11420,8 +11303,8 @@ namespace HVACVariableRefrigerantFlow { } // calculate capacities and energy use - if (((!this->HeatRecoveryUsed && CoolingLoad(VRFCond)) || (this->HeatRecoveryUsed && HRCoolRequestFlag)) && - TerminalUnitList(TUListNum).CoolingCoilPresent(NumTUInList)) { + if (((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) || (this->HeatRecoveryUsed && HRCoolRequestFlag)) && + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTUInList)) { InletAirWetBulbC = SumCoolInletWB; // From the VRF_FluidTCtrl model @@ -11434,8 +11317,8 @@ namespace HVACVariableRefrigerantFlow { CoolingPLR = 0.0; } } - if (((!this->HeatRecoveryUsed && HeatingLoad(VRFCond)) || (this->HeatRecoveryUsed && HRHeatRequestFlag)) && - TerminalUnitList(TUListNum).HeatingCoilPresent(NumTUInList)) { + if (((!this->HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) || (this->HeatRecoveryUsed && HRHeatRequestFlag)) && + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilPresent(NumTUInList)) { InletAirDryBulbC = SumHeatInletDB; InletAirWetBulbC = SumHeatInletWB; @@ -11476,7 +11359,7 @@ namespace HVACVariableRefrigerantFlow { if (DefrostEIRTempModFac < 0.0) { if (!state.dataGlobal->WarmupFlag) { if (this->DefrostHeatErrorIndex == 0) { - ShowSevereMessage(state, cVRFTypes(VRF_HeatPump) + " \"" + this->Name + "\":"); + ShowSevereMessage(state, std::string(cVRFTypes(VRF_HeatPump)) + " \"" + this->Name + "\":"); ShowContinueError( state, format(" Defrost Energy Input Ratio Modifier curve (function of temperature) output is negative ({:.3T}).", @@ -11533,7 +11416,7 @@ namespace HVACVariableRefrigerantFlow { if (!this->HRCoolingActive && !this->HRHeatingActive) { this->ModeChange = true; } - if (CoolingLoad(VRFCond)) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) { if (this->HRHeatingActive && !this->HRCoolingActive) { this->HRModeChange = true; } @@ -11546,7 +11429,7 @@ namespace HVACVariableRefrigerantFlow { HRInitialEIRFrac = this->HRInitialCoolEIRFrac; // Fractional cooling degradation at the start of heat recovery from cooling mode HREIRTC = this->HRCoolEIRTC; // Time constant used to recover from initial degradation in cooling heat recovery - } else if (HeatingLoad(VRFCond)) { + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) { if (!this->HRHeatingActive && this->HRCoolingActive) { this->HRModeChange = true; } @@ -11590,9 +11473,9 @@ namespace HVACVariableRefrigerantFlow { if (this->ModeChange || this->HRModeChange) { if (this->HRCoolingActive && this->HRTimer == 0.0) { - this->HRTimer = CurrentEndTimeLast; + this->HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast; } else if (this->HRHeatingActive && this->HRTimer == 0.0) { - this->HRTimer = CurrentEndTimeLast; + this->HRTimer = state.dataHVACVarRefFlow->CurrentEndTimeLast; } else if (!this->HRCoolingActive && !this->HRHeatingActive) { this->HRTimer = 0.0; } @@ -11612,7 +11495,7 @@ namespace HVACVariableRefrigerantFlow { } this->SUMultiplier = SUMultiplier; - CurrentEndTimeLast = CurrentEndTime; + state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime; } // Modify HR capacity for the transition period @@ -11658,7 +11541,7 @@ namespace HVACVariableRefrigerantFlow { PartLoadFraction = 1.0; VRFRTF = min(1.0, (CyclingRatio / PartLoadFraction)); - this->ElecCoolingPower = VRF(VRFCond).Ncomp + this->OUFanPower; + this->ElecCoolingPower = state.dataHVACVarRefFlow->VRF(VRFCond).Ncomp + this->OUFanPower; this->ElecHeatingPower = 0; } else if (this->OperatingMode == ModeHeatingOnly) { @@ -11710,7 +11593,7 @@ namespace HVACVariableRefrigerantFlow { // if ( this->CondenserType == DataHVACGlobals::EvapCooled ) // Calculate OperatingHeatingCOP & OperatingCoolingCOP: VRF Heat Pump Operating COP [] - if (CoolingLoad(VRFCond) && CoolingPLR > 0.0) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && CoolingPLR > 0.0) { if (this->ElecCoolingPower != 0.0) { // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond).TUCoolingLoad this->OperatingCoolingCOP = (this->TotalCoolingCapacity) / @@ -11719,7 +11602,7 @@ namespace HVACVariableRefrigerantFlow { this->OperatingCoolingCOP = 0.0; } } - if (HeatingLoad(VRFCond) && HeatingPLR > 0.0) { + if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && HeatingPLR > 0.0) { // this calc should use delivered capacity, not condenser capacity, use VRF(VRFCond).TUHeatingLoad if (this->ElecHeatingPower != 0.0) { this->OperatingHeatingCOP = (this->TotalHeatingCapacity) / @@ -11739,36 +11622,38 @@ namespace HVACVariableRefrigerantFlow { // limit the TU capacity when the condenser is maxed out on capacity // I think this next line will make the max cap report variable match the coil objects, will probably change the answer though // IF(CoolingLoad(VRFCond) .AND. NumTUInCoolingMode .GT. 0 .AND. MaxCoolingCapacity(VRFCond) == MaxCap)THEN - if (CoolingLoad(VRFCond) && NumTUInCoolingMode > 0) { + if (state.dataHVACVarRefFlow->CoolingLoad(VRFCond) && NumTUInCoolingMode > 0) { // IF TU capacity is greater than condenser capacity find maximum allowed TU capacity (i.e., conserve energy) if (TU_CoolingLoad > TotalTUCoolingCapacity) { - LimitTUCapacity(VRFCond, + LimitTUCapacity(state, + VRFCond, NumTUInList, TotalTUCoolingCapacity, - TerminalUnitList(TUListNum).TotalCoolLoad, - MaxCoolingCapacity(VRFCond), + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad, + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond), TotalTUHeatingCapacity, - TerminalUnitList(TUListNum).TotalHeatLoad, - MaxHeatingCapacity(VRFCond)); + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad, + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond)); } - } else if (HeatingLoad(VRFCond) && NumTUInHeatingMode > 0) { + } else if (state.dataHVACVarRefFlow->HeatingLoad(VRFCond) && NumTUInHeatingMode > 0) { // IF TU capacity is greater than condenser capacity if (TU_HeatingLoad > TotalTUHeatingCapacity) { - LimitTUCapacity(VRFCond, + LimitTUCapacity(state, + VRFCond, NumTUInList, TotalTUHeatingCapacity, - TerminalUnitList(TUListNum).TotalHeatLoad, - MaxHeatingCapacity(VRFCond), + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalHeatLoad, + state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond), TotalTUCoolingCapacity, - TerminalUnitList(TUListNum).TotalCoolLoad, - MaxCoolingCapacity(VRFCond)); + state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad, + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond)); } } else { } // Calculate the IU Te/Tc for the next time step - this->CalcVRFIUTeTc_FluidTCtrl(); + this->CalcVRFIUTeTc_FluidTCtrl(state); } void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, @@ -11821,15 +11706,15 @@ namespace HVACVariableRefrigerantFlow { bool HRHeatingMode; PartLoadRatio = 0.0; - LoopDXCoolCoilRTF = 0.0; - LoopDXHeatCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0; VRFCond = this->VRFSysNum; IndexToTUInTUList = this->IndexToTUInTUList; - TUListIndex = VRF(VRFCond).ZoneTUListPtr; - VRFCoolingMode = CoolingLoad(VRFCond); - VRFHeatingMode = HeatingLoad(VRFCond); - HRCoolingMode = TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList); - HRHeatingMode = TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList); + TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; + VRFCoolingMode = state.dataHVACVarRefFlow->CoolingLoad(VRFCond); + VRFHeatingMode = state.dataHVACVarRefFlow->HeatingLoad(VRFCond); + HRCoolingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList); + HRHeatingMode = state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList); // The RETURNS here will jump back to SimVRF where the CalcVRF routine will simulate with latest PLR @@ -11870,11 +11755,11 @@ namespace HVACVariableRefrigerantFlow { PartLoadRatio = 1.0; this->CalcVRF_FluidTCtrl(state, VRFTUNum, FirstHVACIteration, PartLoadRatio, FullOutput, OnOffAirFlowRatio, SuppHeatCoilLoad); if (this->CoolingCoilPresent) { - this->coilInNodeT = DataLoopNode::Node(DXCoils::DXCoil(this->CoolCoilIndex).AirInNode).Temp; - this->coilInNodeW = DataLoopNode::Node(DXCoils::DXCoil(this->CoolCoilIndex).AirInNode).HumRat; + this->coilInNodeT = DataLoopNode::Node(state.dataDXCoils->DXCoil(this->CoolCoilIndex).AirInNode).Temp; + this->coilInNodeW = DataLoopNode::Node(state.dataDXCoils->DXCoil(this->CoolCoilIndex).AirInNode).HumRat; } else { - this->coilInNodeT = DataLoopNode::Node(DXCoils::DXCoil(this->HeatCoilIndex).AirInNode).Temp; - this->coilInNodeW = DataLoopNode::Node(DXCoils::DXCoil(this->HeatCoilIndex).AirInNode).HumRat; + this->coilInNodeT = DataLoopNode::Node(state.dataDXCoils->DXCoil(this->HeatCoilIndex).AirInNode).Temp; + this->coilInNodeW = DataLoopNode::Node(state.dataDXCoils->DXCoil(this->HeatCoilIndex).AirInNode).HumRat; } // set supplemental heating coil calculation if the condition requires @@ -11895,7 +11780,7 @@ namespace HVACVariableRefrigerantFlow { this->SuppHeatPartLoadRatio = min(1.0, SuppHeatCoilLoad / this->DesignSuppHeatingCapacity); } } else { - getVRFTUZoneLoad(VRFTUNum, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); + getVRFTUZoneLoad(state, VRFTUNum, ZoneLoad, LoadToHeatingSP, LoadToCoolingSP, false); if ((FullOutput < (LoadToHeatingSP - DataHVACGlobals::SmallLoad)) && !FirstHVACIteration) { SuppHeatCoilLoad = max(0.0, LoadToHeatingSP - FullOutput); this->SuppHeatingCoilLoad = SuppHeatCoilLoad; @@ -11916,12 +11801,12 @@ namespace HVACVariableRefrigerantFlow { this->SuppHeatPartLoadRatio = 0.0; } - if ((VRFCoolingMode && !VRF(VRFCond).HeatRecoveryUsed) || (VRF(VRFCond).HeatRecoveryUsed && HRCoolingMode)) { + if ((VRFCoolingMode && !state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && HRCoolingMode)) { // Since we are cooling, we expect FullOutput < NoCompOutput // If the QZnReq <= FullOutput the unit needs to run full out if (QZnReq <= FullOutput) { // if no coil present in terminal unit, no need to reset PLR? - if (VRFTU(VRFTUNum).CoolingCoilPresent) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolingCoilPresent) { PartLoadRatio = 1.0; // the zone set point could be exceeded if set point control is used so protect against that if (this->isSetPointControlled) { @@ -11934,7 +11819,7 @@ namespace HVACVariableRefrigerantFlow { return; } } - } else if ((VRFHeatingMode && !VRF(VRFCond).HeatRecoveryUsed) || (VRF(VRFCond).HeatRecoveryUsed && HRHeatingMode)) { + } else if ((VRFHeatingMode && !state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) || (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && HRHeatingMode)) { // Since we are heating, we expect FullOutput > NoCompOutput // If the QZnReq >= FullOutput the unit needs to run full out if (QZnReq >= FullOutput) { @@ -11965,7 +11850,7 @@ namespace HVACVariableRefrigerantFlow { Par(1) = VRFTUNum; Par(2) = 0.0; - if (VRFTU(VRFTUNum).isSetPointControlled) Par(2) = 1.0; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled) Par(2) = 1.0; Par(4) = 0.0; if (FirstHVACIteration) { Par(3) = 1.0; @@ -12082,23 +11967,23 @@ namespace HVACVariableRefrigerantFlow { // FLOW VRFCond = this->VRFSysNum; - TUListIndex = VRF(VRFCond).ZoneTUListPtr; + TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; IndexToTUInTUList = this->IndexToTUInTUList; VRFTUOutletNodeNum = this->VRFTUOutletNodeNum; VRFTUInletNodeNum = this->VRFTUInletNodeNum; OpMode = this->OpMode; - EvapTemp = VRF(VRFCond).IUEvaporatingTemp; - CondTemp = VRF(VRFCond).IUCondensingTemp; + EvapTemp = state.dataHVACVarRefFlow->VRF(VRFCond).IUEvaporatingTemp; + CondTemp = state.dataHVACVarRefFlow->VRF(VRFCond).IUCondensingTemp; ZoneNode = this->ZoneAirNode; // Set inlet air mass flow rate based on PLR and compressor on/off air flow rates if (PartLoadRatio == 0) { // only provide required OA when coil is off - CompOnMassFlow = OACompOnMassFlow; - CompOffMassFlow = OACompOffMassFlow; + state.dataHVACVarRefFlow->CompOnMassFlow = state.dataHVACVarRefFlow->OACompOnMassFlow; + state.dataHVACVarRefFlow->CompOffMassFlow = state.dataHVACVarRefFlow->OACompOffMassFlow; } else { // identify the air flow rate corresponding to the coil load - CompOnMassFlow = CalVRFTUAirFlowRate_FluidTCtrl(state, VRFTUNum, PartLoadRatio, FirstHVACIteration); + state.dataHVACVarRefFlow->CompOnMassFlow = CalVRFTUAirFlowRate_FluidTCtrl(state, VRFTUNum, PartLoadRatio, FirstHVACIteration); } SetAverageAirFlow(state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio); AirMassFlow = DataLoopNode::Node(VRFTUInletNodeNum).MassFlowRate; @@ -12121,12 +12006,12 @@ namespace HVACVariableRefrigerantFlow { } // if blow through, simulate fan then coils if (this->FanPlace == DataHVACGlobals::BlowThru) { - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { if (OnOffAirFlowRatio > 0.0) { - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->simulate( + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->simulate( state, _, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff, _); } else { - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->simulate( + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->simulate( state, PartLoadRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff, _); } } else { @@ -12134,15 +12019,15 @@ namespace HVACVariableRefrigerantFlow { "", FirstHVACIteration, this->FanIndex, - FanSpeedRatio, + state.dataHVACVarRefFlow->FanSpeedRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff); } } if (this->CoolingCoilPresent) { // above condition for heat pump mode, below condition for heat recovery mode - if ((!VRF(VRFCond).HeatRecoveryUsed && CoolingLoad(VRFCond)) || - (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { + if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) || + (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { SimDXCoil(state, "", On, @@ -12152,37 +12037,37 @@ namespace HVACVariableRefrigerantFlow { PartLoadRatio, _, _, - MaxCoolingCapacity(VRFCond), - VRF(this->VRFSysNum).VRFCondCyclingRatio); + state.dataHVACVarRefFlow->MaxCoolingCapacity(VRFCond), + state.dataHVACVarRefFlow->VRF(this->VRFSysNum).VRFCondCyclingRatio); } else { // cooling coil is off SimDXCoil(state, "", Off, FirstHVACIteration, this->CoolCoilIndex, OpMode, 0.0, _); } - LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF; + state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { - LoopDXCoolCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXCoolCoilRTF = 0.0; } if (this->HeatingCoilPresent) { // above condition for heat pump mode, below condition for heat recovery mode - if ((!VRF(VRFCond).HeatRecoveryUsed && HeatingLoad(VRFCond)) || - (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { - SimDXCoil(state, "", On, FirstHVACIteration, this->HeatCoilIndex, OpMode, PartLoadRatio, _, _, MaxHeatingCapacity(VRFCond)); + if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) || + (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { + SimDXCoil(state, "", On, FirstHVACIteration, this->HeatCoilIndex, OpMode, PartLoadRatio, _, _, state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond)); } else { SimDXCoil(state, "", Off, FirstHVACIteration, this->HeatCoilIndex, OpMode, 0.0, _); } - LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF; + state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = state.dataAirLoop->LoopDXCoilRTF; } else { - LoopDXHeatCoilRTF = 0.0; + state.dataHVACVarRefFlow->LoopDXHeatCoilRTF = 0.0; } // if draw through, simulate coils then fan if (this->FanPlace == DataHVACGlobals::DrawThru) { - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { if (OnOffAirFlowRatio > 0.0) { - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->simulate( + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->simulate( state, _, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff, _); } else { - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->simulate( + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->simulate( state, PartLoadRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff, _); } @@ -12191,7 +12076,7 @@ namespace HVACVariableRefrigerantFlow { "", FirstHVACIteration, this->FanIndex, - FanSpeedRatio, + state.dataHVACVarRefFlow->FanSpeedRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff); } @@ -12273,7 +12158,6 @@ namespace HVACVariableRefrigerantFlow { // coil load. This is affected by the coil inlet conditions. However, the airflow rate will affect the // OA mixer simulation, which leads to different coil inlet conditions. So, there is a coupling issue here. - using DXCoils::DXCoil; using General::SolveRoot; using TempSolveRoot::SolveRoot; @@ -12296,41 +12180,41 @@ namespace HVACVariableRefrigerantFlow { Real64 TeTc; // evaporating temperature or condensing temperature for VRF indoor unit(C) VRFCond = this->VRFSysNum; - TUListIndex = VRF(VRFCond).ZoneTUListPtr; + TUListIndex = state.dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr; IndexToTUInTUList = this->IndexToTUInTUList; - if ((!VRF(VRFCond).HeatRecoveryUsed && CoolingLoad(VRFCond)) || - (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { + if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->CoolingLoad(VRFCond)) || + (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRCoolRequest(IndexToTUInTUList))) { // VRF terminal unit is on cooling mode DXCoilNum = this->CoolCoilIndex; - QCoilReq = -PartLoadRatio * DXCoil(DXCoilNum).RatedTotCap(Mode); - TeTc = VRF(VRFCond).IUEvaporatingTemp; + QCoilReq = -PartLoadRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + TeTc = state.dataHVACVarRefFlow->VRF(VRFCond).IUEvaporatingTemp; // For HR operations, Te is lower than the outdoor air temperature because of outdoor evaporator operations // The difference is usually 2-3C according to the engineering experience. 2 is used here for a slightly bigger fan flow rate. - if (VRF(VRFCond).HeatRecoveryUsed) TeTc = min(TeTc, state.dataEnvrn->OutDryBulbTemp - 2); + if (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed) TeTc = min(TeTc, state.dataEnvrn->OutDryBulbTemp - 2); - } else if ((!VRF(VRFCond).HeatRecoveryUsed && HeatingLoad(VRFCond)) || - (VRF(VRFCond).HeatRecoveryUsed && TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { + } else if ((!state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->HeatingLoad(VRFCond)) || + (state.dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed && state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).HRHeatRequest(IndexToTUInTUList))) { // VRF terminal unit is on heating mode DXCoilNum = this->HeatCoilIndex; - QCoilReq = PartLoadRatio * DXCoil(DXCoilNum).RatedTotCap(Mode); - TeTc = VRF(VRFCond).IUCondensingTemp; + QCoilReq = PartLoadRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedTotCap(Mode); + TeTc = state.dataHVACVarRefFlow->VRF(VRFCond).IUCondensingTemp; } else { // VRF terminal unit is off QCoilAct = 0.0; - AirMassFlowRate = max(OACompOnMassFlow, 0.0); + AirMassFlowRate = max(state.dataHVACVarRefFlow->OACompOnMassFlow, 0.0); return AirMassFlowRate; } // minimum airflow rate - if (DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) > 0.0) { - FanSpdRatioMin = min(OACompOnMassFlow / DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode), 1.0); + if (state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode) > 0.0) { + FanSpdRatioMin = min(state.dataHVACVarRefFlow->OACompOnMassFlow / state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode), 1.0); } else { // VRF terminal unit is off QCoilAct = 0.0; - AirMassFlowRate = max(OACompOnMassFlow, 0.0); + AirMassFlowRate = max(state.dataHVACVarRefFlow->OACompOnMassFlow, 0.0); return AirMassFlowRate; } @@ -12344,13 +12228,13 @@ namespace HVACVariableRefrigerantFlow { Par(4) = QCoilReq; Par(5) = TeTc; Par(6) = PartLoadRatio; - Par(7) = OACompOnMassFlow; + Par(7) = state.dataHVACVarRefFlow->OACompOnMassFlow; FanSpdRatioMax = 1.0; SolveRoot(state, ErrorTol, MaxIte, SolFla, FanSpdRatio, VRFTUAirFlowResidual_FluidTCtrl, FanSpdRatioMin, FanSpdRatioMax, Par); if (SolFla < 0) FanSpdRatio = FanSpdRatioMax; // over capacity - AirMassFlowRate = FanSpdRatio * DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); + AirMassFlowRate = FanSpdRatio * state.dataDXCoils->DXCoil(DXCoilNum).RatedAirMassFlowRate(Mode); return AirMassFlowRate; } @@ -12376,7 +12260,6 @@ namespace HVACVariableRefrigerantFlow { // OA mixer simulation, which leads to different coil inlet conditions. So, there is a coupling issue here. using DXCoils::ControlVRFIUCoil; - using DXCoils::DXCoil; using Fans::Fan; using Fans::SimulateFanComponents; using MixedAir::OAMixer; @@ -12425,10 +12308,10 @@ namespace HVACVariableRefrigerantFlow { QCoilReq = Par(4); TeTc = Par(5); PartLoadRatio = Par(6); - OACompOnMassFlow = Par(7); + state.dataHVACVarRefFlow->OACompOnMassFlow = Par(7); - VRFCond = VRFTU(VRFTUNum).VRFSysNum; - VRFInletNode = VRFTU(VRFTUNum).VRFTUInletNodeNum; + VRFCond = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum; + VRFInletNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum; if (std::abs(FanSpdRatio) < 0.01) FanSpdRatioBase = sign(0.01, FanSpdRatio); @@ -12436,46 +12319,46 @@ namespace HVACVariableRefrigerantFlow { FanSpdRatioBase = FanSpdRatio; // Set inlet air mass flow rate based on PLR and compressor on/off air flow rates - CompOnMassFlow = FanSpdRatio * DXCoil(CoilIndex).RatedAirMassFlowRate(Mode); + state.dataHVACVarRefFlow->CompOnMassFlow = FanSpdRatio * state.dataDXCoils->DXCoil(CoilIndex).RatedAirMassFlowRate(Mode); SetAverageAirFlow(state, VRFTUNum, PartLoadRatio, temp); Tin = DataLoopNode::Node(VRFInletNode).Temp; Win = DataLoopNode::Node(VRFInletNode).HumRat; // Simulation the OAMixer if there is any - if (VRFTU(VRFTUNum).OAMixerUsed) { - SimOAMixer(state, VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, VRFTU(VRFTUNum).OAMixerIndex); - OAMixNode = OAMixer(VRFTU(VRFTUNum).OAMixerIndex).MixNode; + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { + SimOAMixer(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerName, FirstHVACIteration, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex); + OAMixNode = OAMixer(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerIndex).MixNode; Tin = DataLoopNode::Node(OAMixNode).Temp; Win = DataLoopNode::Node(OAMixNode).HumRat; } // Simulate the blow-through fan if there is any - if (VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { - if (VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanPlace == DataHVACGlobals::BlowThru) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanType_Num == DataHVACGlobals::FanType_SystemModelObject) { if (temp > 0) { - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->simulate( + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->simulate( state, _, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff, _); } else { - HVACFan::fanObjs[VRFTU(VRFTUNum).FanIndex]->simulate( + HVACFan::fanObjs[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex]->simulate( state, PartLoadRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff, _); } } else { Fans::SimulateFanComponents(state, "", false, - VRFTU(VRFTUNum).FanIndex, - FanSpeedRatio, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex, + state.dataHVACVarRefFlow->FanSpeedRatio, DataHVACGlobals::ZoneCompTurnFansOn, DataHVACGlobals::ZoneCompTurnFansOff); } - Tin = DataLoopNode::Node(VRFTU(VRFTUNum).fanOutletNode).Temp; - Win = DataLoopNode::Node(VRFTU(VRFTUNum).fanOutletNode).HumRat; + Tin = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode).Temp; + Win = DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOutletNode).HumRat; } // Call the coil control logic to determine the air flow rate to match the given coil load - ControlVRFIUCoil(state, CoilIndex, QCoilReq, Tin, Win, TeTc, OACompOnMassFlow, FanSpdRatioAct, Wout, Tout, Hout, SHact, SCact); + ControlVRFIUCoil(state, CoilIndex, QCoilReq, Tin, Win, TeTc, state.dataHVACVarRefFlow->OACompOnMassFlow, FanSpdRatioAct, Wout, Tout, Hout, SHact, SCact); Hin = PsyHFnTdbW(Tin, Win); - QCoilAct = FanSpdRatioAct * DXCoil(CoilIndex).RatedAirMassFlowRate(Mode) * (Hout - Hin); // positive for heating, negative for cooling + QCoilAct = FanSpdRatioAct * state.dataDXCoils->DXCoil(CoilIndex).RatedAirMassFlowRate(Mode) * (Hout - Hin); // positive for heating, negative for cooling AirFlowRateResidual = (FanSpdRatioAct - FanSpdRatio); @@ -12522,11 +12405,12 @@ namespace HVACVariableRefrigerantFlow { // FLOW // calculate the total evaporative capacity Q_c_tot, at the given compressor speed and operational conditions - VRF(VRFCond).VRFOU_CompCap(state, CompSpdActual, Te, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot_temp, Ncomp_temp); + state.dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompCap(state, CompSpdActual, Te, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot_temp, Ncomp_temp); Q_c_OU_temp = Q_c_tot_temp - Q_c_TU_PL; // Tsuction_new calculated based on OU evaporator air-side calculations (Tsuction_new < To) - VRF(VRFCond).VRFOU_TeTc(state, FlagEvapMode, Q_c_OU_temp, VRF(VRFCond).SH, m_air_evap_rated, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat, state.dataEnvrn->OutBaroPress, Tfs, Te_new); + state.dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc(state, + iHXOpMode::EvapMode, Q_c_OU_temp, state.dataHVACVarRefFlow->VRF(VRFCond).SH, m_air_evap_rated, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat, state.dataEnvrn->OutBaroPress, Tfs, Te_new); TeResidual = Te_new - Te; @@ -12566,12 +12450,12 @@ namespace HVACVariableRefrigerantFlow { } void VRFCondenserEquipment::VRFOU_TeTc(EnergyPlusData &state, - int const OperationMode, // Mode 0 for running as condenser, 1 for evaporator - Real64 const Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W] - Real64 const SHSC, // SC for OU condenser or SH for OU evaporator [C] - Real64 const m_air, // OU coil air mass flow rate [kg/s] - Real64 const T_coil_in, // Temperature of air at OU coil inlet [C] - Real64 const W_coil_in, // Humidity ratio of air at OU coil inlet [kg/kg] + iHXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator + Real64 const Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W] + Real64 const SHSC, // SC for OU condenser or SH for OU evaporator [C] + Real64 const m_air, // OU coil air mass flow rate [kg/s] + Real64 const T_coil_in, // Temperature of air at OU coil inlet [C] + Real64 const W_coil_in, // Humidity ratio of air at OU coil inlet [kg/kg] Real64 const OutdoorPressure, // Outdoor air pressure [Pa] Real64 &T_coil_surf, // Air temperature at coil surface [C] Real64 &TeTc // VRF Tc at cooling mode, or Te at heating mode [C] @@ -12602,7 +12486,7 @@ namespace HVACVariableRefrigerantFlow { Real64 T_coil_surf_sat; // Saturated air temperature at coil surface [C] Real64 W_coil_surf_sat; // Humidity ratio of saturated air at coil surface [kg/kg] - if (OperationMode == FlagCondMode) { + if (OperationMode == iHXOpMode::CondMode) { // IU Cooling: OperationMode 0 if (m_air <= 0) { @@ -12620,7 +12504,7 @@ namespace HVACVariableRefrigerantFlow { TeTc = T_coil_surf + deltaT; - } else if (OperationMode == FlagEvapMode) { + } else if (OperationMode == iHXOpMode::EvapMode) { // IU Heating: OperationMode 1 if (m_air <= 0) { @@ -12652,7 +12536,7 @@ namespace HVACVariableRefrigerantFlow { } Real64 VRFCondenserEquipment::VRFOU_Cap(EnergyPlusData &state, - int const OperationMode, // Mode 0 for running as condenser, 1 for evaporator + iHXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator Real64 const TeTc, // VRF Tc at cooling mode, or Te at heating mode [C] Real64 const SHSC, // SC for OU condenser or SH for OU evaporator [C] Real64 const m_air, // OU coil air mass flow rate [kg/s] @@ -12686,7 +12570,7 @@ namespace HVACVariableRefrigerantFlow { Q_coil = 0.0; - if (OperationMode == FlagCondMode) { + if (OperationMode == iHXOpMode::CondMode) { // IU Cooling: OperationMode 0 if (m_air <= 0) { ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name)); @@ -12699,7 +12583,7 @@ namespace HVACVariableRefrigerantFlow { T_coil_out = T_coil_in + (T_coil_surf - T_coil_in) * (1 - BF); Q_coil = (T_coil_out - T_coil_in) * 1005.0 * m_air; - } else if (OperationMode == FlagEvapMode) { + } else if (OperationMode == iHXOpMode::EvapMode) { // IU Heating: OperationMode 1 if (m_air <= 0) { ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name)); @@ -12734,7 +12618,7 @@ namespace HVACVariableRefrigerantFlow { } Real64 VRFCondenserEquipment::VRFOU_FlowRate(EnergyPlusData &state, - int const OperationMode, // Mode 0 for running as condenser, 1 for evaporator + iHXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator Real64 const TeTc, // VRF Tc at cooling mode, or Te at heating mode [C] Real64 const SHSC, // SC for OU condenser or SH for OU evaporator [C] Real64 const Q_coil, // absolute value of OU coil heat release or heat extract [W] @@ -12768,7 +12652,7 @@ namespace HVACVariableRefrigerantFlow { m_air = 0.0; - if (OperationMode == FlagCondMode) { + if (OperationMode == iHXOpMode::CondMode) { // IU Cooling: OperationMode 0 BF = this->RateBFOUCond; // 0.219; @@ -12777,7 +12661,7 @@ namespace HVACVariableRefrigerantFlow { T_coil_out = T_coil_in + (T_coil_surf - T_coil_in) * (1 - BF); m_air = Q_coil / (T_coil_out - T_coil_in) / 1005.0; - } else if (OperationMode == FlagEvapMode) { + } else if (OperationMode == iHXOpMode::EvapMode) { // IU Heating: OperationMode 1 BF = this->RateBFOUEvap; // 0.45581; @@ -12808,7 +12692,7 @@ namespace HVACVariableRefrigerantFlow { } Real64 VRFCondenserEquipment::VRFOU_SCSH(EnergyPlusData &state, - int const OperationMode, // Mode 0 for running as condenser, 1 for evaporator + iHXOpMode const OperationMode, // Mode 0 for running as condenser, 1 for evaporator Real64 const Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W] Real64 const TeTc, // VRF Tc at cooling mode, or Te at heating mode [C] Real64 const m_air, // OU coil air mass flow rate [kg/s] @@ -12845,7 +12729,7 @@ namespace HVACVariableRefrigerantFlow { SHSC = 0.0; - if (OperationMode == FlagCondMode) { + if (OperationMode == iHXOpMode::CondMode) { // Cooling: OperationMode 0 if (m_air <= 0) { ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name)); @@ -12863,7 +12747,7 @@ namespace HVACVariableRefrigerantFlow { else SHSC = (-this->C2Tc + std::pow((pow_2(this->C2Tc) - 4 * (this->C1Tc - deltaT) * this->C3Tc), 0.5)) / (2 * this->C3Tc); - } else if (OperationMode == FlagEvapMode) { + } else if (OperationMode == iHXOpMode::EvapMode) { // Heating: OperationMode 1 if (m_air <= 0) { ShowSevereMessage(state, format(" Unreasonable outdoor unit airflow rate ({:.3T} ) for \"{}\":", m_air, this->Name)); @@ -13004,7 +12888,6 @@ namespace HVACVariableRefrigerantFlow { // METHODOLOGY EMPLOYED: // This is part of the VRF-FluidTCtrl Model. - using DXCoils::DXCoil; using FluidProperties::FindRefrigerant; using FluidProperties::GetSatPressureRefrig; using FluidProperties::GetSatTemperatureRefrig; @@ -13038,7 +12921,7 @@ namespace HVACVariableRefrigerantFlow { RefrigerantIndex = FindRefrigerant(state, this->RefrigerantName); RefPLow = RefrigData(RefrigerantIndex).PsLowPresValue; RefPHigh = RefrigData(RefrigerantIndex).PsHighPresValue; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; // Initialization of Te iterations (Label11) NumTeIte = 1; @@ -13056,12 +12939,12 @@ namespace HVACVariableRefrigerantFlow { // Re-calculate total refrigerant flow rate, with updated SH for (int NumTU = 1; NumTU <= NumTUInList; NumTU++) { - if (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = VRFTU(TUIndex).CoolCoilIndex; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; // The IU coil surface temperature should be the same. - Tfs = Te_up + (this->C3Te * pow_2(DXCoil(CoolCoilIndex).ActualSH) + this->C2Te * DXCoil(CoolCoilIndex).ActualSH + this->C1Te); + Tfs = Te_up + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH) + this->C2Te * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH + this->C1Te); // SH_IU_update is the updated SH for a specific IU if (this->C3Te == 0) @@ -13079,9 +12962,9 @@ namespace HVACVariableRefrigerantFlow { RoutineName); // hB_i for the IU if (Pipe_h_IU_out_i > Pipe_h_IU_in) { - Pipe_m_ref_i = (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) + Pipe_m_ref_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) ? 0.0 - : (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / (Pipe_h_IU_out_i - Pipe_h_IU_in)); + : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / (Pipe_h_IU_out_i - Pipe_h_IU_in)); Pipe_m_ref = Pipe_m_ref + Pipe_m_ref_i; Pipe_SH_merged = Pipe_SH_merged + Pipe_m_ref_i * SH_IU_update; Pipe_h_IU_out = Pipe_h_IU_out + Pipe_m_ref_i * Pipe_h_IU_out_i; @@ -13121,7 +13004,7 @@ namespace HVACVariableRefrigerantFlow { void VRFCondenserEquipment::VRFOU_CompSpd( EnergyPlusData &state, Real64 const Q_req, // Required capacity [W] - int const Q_type, // Required capacity type: 0 for condenser, 1 for evaporator + iHXOpMode const Q_type, // Required capacity type: 0 for condenser, 1 for evaporator Real64 const T_suction, // Compressor suction temperature Te' [C] Real64 const T_discharge, // Compressor discharge temperature Tc' [C] Real64 const h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] @@ -13174,7 +13057,7 @@ namespace HVACVariableRefrigerantFlow { // variable initializations: component index TUListNum = this->ZoneTUListPtr; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; RefrigerantIndex = FindRefrigerant(state, this->RefrigerantName); RefPLow = RefrigData(RefrigerantIndex).PsLowPresValue; RefPHigh = RefrigData(RefrigerantIndex).PsHighPresValue; @@ -13200,7 +13083,7 @@ namespace HVACVariableRefrigerantFlow { C_cap_operation = this->VRFOU_CapModFactor( state, h_comp_in, h_IU_evap_in, max(min(P_suction, RefPHigh), RefPLow), T_suction + SH_Comp, T_suction + 8, T_discharge - 5); - if (Q_type == FlagEvapMode) { + if (Q_type == iHXOpMode::EvapMode) { // Capacity to meet is for evaporator Q_evap_req = Q_req; @@ -13329,7 +13212,7 @@ namespace HVACVariableRefrigerantFlow { // variable initializations: component index TUListNum = this->ZoneTUListPtr; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; RefrigerantIndex = FindRefrigerant(state, this->RefrigerantName); RefPLow = RefrigData(RefrigerantIndex).PsLowPresValue; RefPHigh = RefrigData(RefrigerantIndex).PsHighPresValue; @@ -13426,7 +13309,6 @@ namespace HVACVariableRefrigerantFlow { // This is part of the VRF-FluidTCtrl Model. using CurveManager::CurveValue; - using DXCoils::DXCoil; using FluidProperties::FindRefrigerant; using FluidProperties::GetSatEnthalpyRefrig; using FluidProperties::GetSatPressureRefrig; @@ -13495,7 +13377,7 @@ namespace HVACVariableRefrigerantFlow { RefrigerantIndex = FindRefrigerant(state, this->RefrigerantName); RefPLow = RefrigData(RefrigerantIndex).PsLowPresValue; RefPHigh = RefrigData(RefrigerantIndex).PsHighPresValue; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; Modifi_SH = Pipe_T_comp_in - T_suction; @@ -13597,12 +13479,12 @@ namespace HVACVariableRefrigerantFlow { // Re-calculate total refrigerant flow rate, with updated SH for (int NumTU = 1; NumTU <= NumTUInList; NumTU++) { - if (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoolCoilIndex = VRFTU(TUIndex).CoolCoilIndex; + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) > 0) { + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoolCoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; Tfs = this->EvaporatingTemp + - (this->C3Te * pow_2(DXCoil(CoolCoilIndex).ActualSH) + this->C2Te * DXCoil(CoolCoilIndex).ActualSH + this->C1Te); + (this->C3Te * pow_2(state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH) + this->C2Te * state.dataDXCoils->DXCoil(CoolCoilIndex).ActualSH + this->C1Te); // Modifi_SH is the updated SH for a specific IU if (this->C3Te == 0) @@ -13622,9 +13504,9 @@ namespace HVACVariableRefrigerantFlow { RoutineName); if (Pipe_h_IU_out_i > Pipe_h_IU_in) { - Pipe_m_ref_i = (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) + Pipe_m_ref_i = (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) <= 0.0) ? 0.0 - : (TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / (Pipe_h_IU_out_i - Pipe_h_IU_in)); + : (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU) / (Pipe_h_IU_out_i - Pipe_h_IU_in)); Pipe_m_ref = Pipe_m_ref + Pipe_m_ref_i; Pipe_SH_merged = Pipe_SH_merged + Pipe_m_ref_i * Modifi_SHin; Pipe_h_IU_out = Pipe_h_IU_out + Pipe_m_ref_i * Pipe_h_IU_out_i; @@ -13691,7 +13573,8 @@ namespace HVACVariableRefrigerantFlow { OUCondHeatRelease = TU_load + Pipe_Q + Ncomp; // Pipe_Q is changed when T_suction is changed -> Tc is also changed // *VRF OU Tc calculations - this->VRFOU_TeTc(state, FlagCondMode, + this->VRFOU_TeTc(state, + iHXOpMode::CondMode, OUCondHeatRelease, this->SC, this->OUAirFlowRate * RhoAir, @@ -13781,7 +13664,6 @@ namespace HVACVariableRefrigerantFlow { // This is part of the VRF-FluidTCtrl Model. using CurveManager::CurveValue; - using DXCoils::DXCoil; using FluidProperties::FindRefrigerant; using FluidProperties::GetSatEnthalpyRefrig; using FluidProperties::GetSatPressureRefrig; @@ -13832,7 +13714,7 @@ namespace HVACVariableRefrigerantFlow { RefrigerantIndex = FindRefrigerant(state, this->RefrigerantName); RefPLow = RefrigData(RefrigerantIndex).PsLowPresValue; RefPHigh = RefrigData(RefrigerantIndex).PsHighPresValue; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; // Calculate capacity modification factor MinOutdoorUnitPe = GetSatPressureRefrig(state, this->RefrigerantName, T_suction, RefrigerantIndex, RoutineName); @@ -14006,8 +13888,6 @@ namespace HVACVariableRefrigerantFlow { using TempSolveRoot::SolveRoot; Array1D Par(7); // Parameters passed to RegulaFalsi - int const FlagCondMode(0); // Flag for running as condenser [-] - int const FlagEvapMode(1); // Flag for running as evaporator [-] Real64 const ErrorTol(0.1); // tolerance for RegulaFalsi iterations int const MaxIte(100); // maximum number of iterations int HRMode(0); // HR operational mode [W] @@ -14070,8 +13950,8 @@ namespace HVACVariableRefrigerantFlow { } // Calculate compressor speed satisfying IU loads: rps1_evap & rps2_cond - this->VRFOU_CompSpd(state, Q_c_TU_PL, FlagEvapMode, temp_Tsuction, Tdischarge, h_IU_evap_in, h_IU_PLc_out, rps1_evap); - this->VRFOU_CompSpd(state, Q_h_TU_PL, FlagCondMode, temp_Tsuction, Tdischarge, h_IU_evap_in, h_IU_PLc_out, rps2_cond); + this->VRFOU_CompSpd(state, Q_c_TU_PL, iHXOpMode::EvapMode, temp_Tsuction, Tdischarge, h_IU_evap_in, h_IU_PLc_out, rps1_evap); + this->VRFOU_CompSpd(state, Q_h_TU_PL, iHXOpMode::CondMode, temp_Tsuction, Tdischarge, h_IU_evap_in, h_IU_PLc_out, rps2_cond); // Determine FlagMode5 if (rps1_evap <= rps2_cond) { @@ -14114,7 +13994,7 @@ namespace HVACVariableRefrigerantFlow { Q_h_OU = 0; // OU fan flow rate and power - m_air_evap = this->VRFOU_FlowRate(state, FlagEvapMode, Tsuction, this->SH, Q_c_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); + m_air_evap = this->VRFOU_FlowRate(state, iHXOpMode::EvapMode, Tsuction, this->SH, Q_c_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); m_air_evap_rated = m_air_rated; N_fan_OU_evap = this->RatedOUFanPower * m_air_evap / m_air_evap_rated; N_fan_OU_cond = 0; @@ -14146,11 +14026,12 @@ namespace HVACVariableRefrigerantFlow { // Tsuction_new updated based on OU evaporator air-side calculations (Tsuction_new < To) m_air_evap_rated = m_air_rated; - this->VRFOU_TeTc(state, FlagEvapMode, Q_c_OU_temp, this->SH, m_air_evap_rated, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat, state.dataEnvrn->OutBaroPress, Tfs, Tsuction_new); + this->VRFOU_TeTc(state, + iHXOpMode::EvapMode, Q_c_OU_temp, this->SH, m_air_evap_rated, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat, state.dataEnvrn->OutBaroPress, Tfs, Tsuction_new); Tsuction_new = min(Tsuction_new, Tsuction); // should be lower than Tsuction_IU // Calculate updated rps corresponding to updated Tsuction_new and Q_c_tot_temp - this->VRFOU_CompSpd(state, Q_c_tot_temp, FlagEvapMode, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, CompSpdActual); + this->VRFOU_CompSpd(state, Q_c_tot_temp, iHXOpMode::EvapMode, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, CompSpdActual); // Calculate Ncomp_new, using updated CompSpdActual and Tsuction_new this->VRFOU_CompCap(state, CompSpdActual, Tsuction_new, Tdischarge, h_IU_evap_in, h_comp_in, Q_c_tot_temp, Ncomp_new); @@ -14227,7 +14108,7 @@ namespace HVACVariableRefrigerantFlow { // perform iterations to calculate Te at the given compressor speed and operational conditions { - Par(1) = VRFTU(TerminalUnitList(this->ZoneTUListPtr).ZoneTUPtr(1)).VRFSysNum; // VRFCond; + Par(1) = state.dataHVACVarRefFlow->VRFTU(state.dataHVACVarRefFlow->TerminalUnitList(this->ZoneTUListPtr).ZoneTUPtr(1)).VRFSysNum; // VRFCond; Par(2) = CompSpdActual; Par(3) = Tdischarge; Par(4) = h_IU_evap_in; @@ -14260,7 +14141,7 @@ namespace HVACVariableRefrigerantFlow { Q_c_OU = Q_c_tot - Q_c_TU_PL; // OU evaporator fan flow rate and power - m_air_evap = this->VRFOU_FlowRate(state, FlagEvapMode, Tsuction, this->SH, Q_c_OU_temp, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); + m_air_evap = this->VRFOU_FlowRate(state, iHXOpMode::EvapMode, Tsuction, this->SH, Q_c_OU_temp, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); } else { // Need to update Te_update & Pipe_Q_c_new, corresponding to Tsuction update. @@ -14294,7 +14175,7 @@ namespace HVACVariableRefrigerantFlow { Q_h_OU = Q_h_tot - Q_h_TU_PL; // OU condenser fan flow rate and power - m_air_cond = this->VRFOU_FlowRate(state, FlagCondMode, Tdischarge, this->SC, Q_h_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); + m_air_cond = this->VRFOU_FlowRate(state, iHXOpMode::CondMode, Tdischarge, this->SC, Q_h_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); // OU fan power N_fan_OU_evap = this->RatedOUFanPower * m_air_evap / m_air_rated; @@ -14314,7 +14195,7 @@ namespace HVACVariableRefrigerantFlow { Q_c_OU = 0; // OU fan flow rate and power - m_air_cond = this->VRFOU_FlowRate(state, FlagCondMode, Tdischarge, this->SC, Q_h_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); + m_air_cond = this->VRFOU_FlowRate(state, iHXOpMode::CondMode, Tdischarge, this->SC, Q_h_OU, state.dataEnvrn->OutDryBulbTemp, state.dataEnvrn->OutHumRat); N_fan_OU_cond = this->RatedOUFanPower * m_air_cond / m_air_rated; N_fan_OU_evap = 0; @@ -14392,7 +14273,6 @@ namespace HVACVariableRefrigerantFlow { // METHODOLOGY EMPLOYED: // Use a physics based piping loss model. - using DXCoils::DXCoil; using FluidProperties::FindRefrigerant; using FluidProperties::GetSupHeatDensityRefrig; using FluidProperties::RefrigData; @@ -14426,7 +14306,7 @@ namespace HVACVariableRefrigerantFlow { static std::string const RoutineName("VRFOU_PipeLossC"); TUListNum = this->ZoneTUListPtr; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; Pipe_conductivity_ref = this->RefPipInsCon; RefPipInsH = 9.3; @@ -14441,11 +14321,11 @@ namespace HVACVariableRefrigerantFlow { Pipe_T_room = 0; NumIUActivated = 0; for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoilIndex = VRFTU(TUIndex).CoolCoilIndex; + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).CoolCoilIndex; - if (DXCoil(CoilIndex).TotalCoolingEnergyRate > 0.0) { - Pipe_T_room = Pipe_T_room + DXCoil(CoilIndex).InletAirTemp; + if (state.dataDXCoils->DXCoil(CoilIndex).TotalCoolingEnergyRate > 0.0) { + Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp; NumIUActivated = NumIUActivated + 1; } } @@ -14544,7 +14424,6 @@ namespace HVACVariableRefrigerantFlow { // METHODOLOGY EMPLOYED: // Use a physics based piping loss model. - using DXCoils::DXCoil; using FluidProperties::FindRefrigerant; using FluidProperties::GetSatTemperatureRefrig; using FluidProperties::GetSupHeatDensityRefrig; @@ -14582,7 +14461,7 @@ namespace HVACVariableRefrigerantFlow { static std::string const RoutineName("VRFOU_PipeLossH"); TUListNum = this->ZoneTUListPtr; - NumTUInList = TerminalUnitList(TUListNum).NumTUInList; + NumTUInList = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).NumTUInList; Pipe_conductivity_ref = this->RefPipInsCon; RefPipInsH = 9.3; @@ -14610,11 +14489,11 @@ namespace HVACVariableRefrigerantFlow { Pipe_T_room = 0; NumIUActivated = 0; for (int NumTU = 1; NumTU <= NumTUInList; ++NumTU) { - TUIndex = TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); - CoilIndex = VRFTU(TUIndex).HeatCoilIndex; + TUIndex = state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).ZoneTUPtr(NumTU); + CoilIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex).HeatCoilIndex; - if (DXCoil(CoilIndex).TotalHeatingEnergyRate > 0.0) { - Pipe_T_room = Pipe_T_room + DXCoil(CoilIndex).InletAirTemp; + if (state.dataDXCoils->DXCoil(CoilIndex).TotalHeatingEnergyRate > 0.0) { + Pipe_T_room = Pipe_T_room + state.dataDXCoils->DXCoil(CoilIndex).InletAirTemp; NumIUActivated = NumIUActivated + 1; } } @@ -14807,14 +14686,14 @@ namespace HVACVariableRefrigerantFlow { // Real64 mdot = min(DataLoopNode::Node(VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode).MassFlowRateMaxAvail, // VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac); - Real64 mdot = HVACVariableRefrigerantFlow::VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac; - DataLoopNode::Node(VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode).MassFlowRate = mdot; + Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac; + DataLoopNode::Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode).MassFlowRate = mdot; WaterCoils::SimulateWaterCoilComponents(state, - VRFTU(VRFTUNum).SuppHeatCoilName, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, FirstHVACIteration, - VRFTU(VRFTUNum).SuppHeatCoilIndex, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, QActual, - VRFTU(VRFTUNum).OpMode, + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode, PartLoadFrac); if (std::abs(SuppHeatCoilLoad) == 0.0) { @@ -14849,56 +14728,4 @@ namespace HVACVariableRefrigerantFlow { return HeatCoilCapacityAllowed; } - // Clears the global data in HVACVariableRefrigerantFlow. - // Needed for unit tests, should not be normally called. - void clear_state() - { - NumVRFCond = 0; - NumVRFTU = 0; - NumVRFTULists = 0; - CompOnMassFlow = 0.0; - OACompOnMassFlow = 0.0; - CompOffMassFlow = 0.0; - OACompOffMassFlow = 0.0; - CompOnFlowRatio = 0.0; - CompOffFlowRatio = 0.0; - FanSpeedRatio = 0.0; - LoopDXCoolCoilRTF = 0.0; - LoopDXHeatCoilRTF = 0.0; - CondenserWaterMassFlowRate = 0.0; - CurrentEndTimeLast = 0.0; - GetVRFInputFlag = true; - MyOneTimeFlag = true; - MyOneTimeSizeFlag = true; - ZoneEquipmentListNotChecked = true; - VRF.deallocate(); - VrfUniqueNames.clear(); - VRFTU.deallocate(); - TerminalUnitList.deallocate(); - VRFTUNumericFields.deallocate(); - MaxCoolingCapacity.deallocate(); - MaxHeatingCapacity.deallocate(); - CoolCombinationRatio.deallocate(); - HeatCombinationRatio.deallocate(); - MaxDeltaT.deallocate(); - MinDeltaT.deallocate(); - LastModeCooling.deallocate(); - LastModeHeating.deallocate(); - HeatingLoad.deallocate(); - CoolingLoad.deallocate(); - NumCoolingLoads.deallocate(); - SumCoolingLoads.deallocate(); - NumHeatingLoads.deallocate(); - SumHeatingLoads.deallocate(); - CheckEquipName.deallocate(); - MyEnvrnFlag.deallocate(); - MySizeFlag.deallocate(); - MyBeginTimeStepFlag.deallocate(); - MyVRFFlag.deallocate(); - MyVRFCondFlag.deallocate(); - MyZoneEqFlag.deallocate(); - } - -} // namespace HVACVariableRefrigerantFlow - } // namespace EnergyPlus diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index 5d806f10f33..b53a994bbed 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -67,82 +67,68 @@ struct EnergyPlusData; namespace HVACVariableRefrigerantFlow { // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run - - // Heat Recovery System used - extern int const No; // Heat Pump mode only - extern int const Yes; // Heat Pump or Heat Recovery Mode (not available at this time) + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run // Defrost strategy - extern int const ReverseCycle; // uses reverse cycle defrost strategy - extern int const Resistive; // uses electric resistance heater for defrost + constexpr int ReverseCycle(1); // uses reverse cycle defrost strategy + constexpr int Resistive(2); // uses electric resistance heater for defrost // Defrost control - extern int const Timed; // defrost cycle is timed - extern int const OnDemand; // defrost cycle occurs only when required + constexpr int Timed(1); // defrost cycle is timed + constexpr int OnDemand(2); // defrost cycle occurs only when required // Thermostat Priority Control Type - extern int const LoadPriority; // total of zone loads dictate operation in cooling or heating - extern int const ZonePriority; // # of zones requireing cooling or heating dictate operation in cooling or heating - extern int const ThermostatOffsetPriority; // zone with largest deviation from setpoint dictates operation - extern int const ScheduledPriority; // cooling and heating modes are scheduled - extern int const MasterThermostatPriority; // Master zone thermostat dictates operation - extern int const FirstOnPriority; // first unit to respond dictates operation (not used at this time) + enum class iThermostatCtrlType { + Unassigned, + LoadPriority, // total of zone loads dictate operation in cooling or heating + ZonePriority, // # of zones requiring cooling or heating dictate operation in cooling or heating + ThermostatOffsetPriority, // zone with largest deviation from setpoint dictates operation + ScheduledPriority, // cooling and heating modes are scheduled + MasterThermostatPriority, // Master zone thermostat dictates operation + FirstOnPriority, // first unit to respond dictates operation (not used at this time) + }; - // Water Systems - extern int const CondensateDiscarded; // default mode where water is "lost" - extern int const CondensateToTank; // collect coil condensate from air and store in water storage tank + enum class iWaterSupply { + FromMains, // mains water line used as water source + FromTank, // storage tank used as water source + }; - extern int const WaterSupplyFromMains; // mains water line used as water source - extern int const WaterSupplyFromTank; // storage tank used as water source + constexpr Real64 MaxCap(1.0e+20); // limit of zone terminal unit capacity - extern Real64 const MaxCap; // limit of zone terminal unit capacity + // VRF Algorithm Type + enum class iAlgorithmType { + Unassigned, + SysCurve, // VRF model based on system curve + FluidTCtrl, // VRF model based on physics, appreciable for Fluid Temperature Control + }; // VRF System Types (strings used in integer conversions) - extern int const NumVRFSystemTypes; - extern int const VRF_HeatPump; - extern Array1D_string const cVRFTypes; - - extern bool GetVRFInputFlag; // Flag set to make sure you get input once - extern bool MyOneTimeFlag; // One time flag used to allocate MyEnvrnFlag and MySizeFlag - extern bool MyOneTimeSizeFlag; // One time flag used to allocate MyEnvrnFlag and MySizeFlag - extern Array1D_bool CheckEquipName; // Flag set to check equipment connections once - extern bool ZoneEquipmentListNotChecked; // False after the Zone Equipment List has been checked for items - extern Array1D_bool MyEnvrnFlag; // Flag for initializing at beginning of each new environment - extern Array1D_bool MySizeFlag; // False after TU has been sized - extern Array1D_bool MyBeginTimeStepFlag; // Flag to sense beginning of time step - extern Array1D_bool MyVRFFlag; // used for sizing VRF inputs one time - extern Array1D_bool MyVRFCondFlag; // used to reset timer counter - extern Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers - extern int NumVRFCond; // total number of VRF condensers (All VRF Algorithm Types) - extern int NumVRFCond_SysCurve; // total number of VRF condensers with VRF Algorithm Type 1 - extern int NumVRFTU; // total number of VRF terminal units - extern int NumVRFTULists; // The number of VRF TU lists - extern Real64 CompOnMassFlow; // Supply air mass flow rate w/ compressor ON - extern Real64 OACompOnMassFlow; // OA mass flow rate w/ compressor ON - extern Real64 CompOffMassFlow; // Supply air mass flow rate w/ compressor OFF - extern Real64 OACompOffMassFlow; // OA mass flow rate w/ compressor OFF - extern Real64 CompOnFlowRatio; // fan flow ratio when coil on - extern Real64 CompOffFlowRatio; // fan flow ratio when coil off - extern Real64 FanSpeedRatio; // ratio of air flow ratio passed to fan object - extern Array1D_bool HeatingLoad; // defines a heating load on VRFTerminalUnits - extern Array1D_bool CoolingLoad; // defines a cooling load on VRFTerminalUnits - extern Array1D_bool LastModeHeating; // defines last mode was heating mode - extern Array1D_bool LastModeCooling; // defines last mode was cooling mode - extern Array1D MaxCoolingCapacity; // maximum capacity of any terminal unit - extern Array1D MaxHeatingCapacity; // maximum capacity of any terminal unit - extern Array1D CoolCombinationRatio; // ratio of terminal unit capacity to VRF condenser capacity - extern Array1D HeatCombinationRatio; // ratio of terminal unit capacity to VRF condenser capacity - extern Real64 LoopDXCoolCoilRTF; // holds value of DX cooling coil RTF - extern Real64 LoopDXHeatCoilRTF; // holds value of DX heating coil RTF - extern Real64 CondenserWaterMassFlowRate; // VRF water-cooled condenser mass flow rate (kg/s) - extern Array1D_int NumCoolingLoads; // number of TU's requesting cooling - extern Array1D_int NumHeatingLoads; // number of TU's requesting heating - extern Array1D MaxDeltaT; // maximum zone temperature difference from setpoint - extern Array1D MinDeltaT; // minimum zone temperature difference from setpoint - extern Array1D SumCoolingLoads; // sum of cooling loads - extern Array1D SumHeatingLoads; // sum of heating loads + constexpr int VRF_HeatPump(1); + + constexpr auto cVRFTypes(int const &i) + { + if (i == 1) { + return "AirConditioner:VariableRefrigerantFlow"; + } else { + assert(false); + return ""; + } + } + + constexpr const char * fluidNameSteam("STEAM"); + + // Flag for hex operation + enum class iHXOpMode + { + CondMode, // Flag for the hex running as condenser [-] + EvapMode, // Flag for the hex running as evaporator [-] + }; + + // Flag for VRF operational mode + constexpr int ModeCoolingOnly = 1; // Flag for Cooling Only Mode [-] + constexpr int ModeHeatingOnly = 2; // Flag for Heating Only Mode [-] + constexpr int ModeCoolingAndHeating = 3; // Flag for Simultaneous Cooling and Heating Only Mode [-] // Subroutine Specifications for the Module struct VRFCondenserEquipment : PlantComponent @@ -150,7 +136,7 @@ namespace HVACVariableRefrigerantFlow { // Members std::string Name; // Name of the VRF Terminal Unit int VRFSystemTypeNum; // integer equivalent of system type - int VRFAlgorithmTypeNum; // Algorithm type: 1_system curve based model; 2_physics based model (FluidTCtrl) + iAlgorithmType VRFAlgorithmTypeNum; // Algorithm type: 1_system curve based model; 2_physics based model (FluidTCtrl) int VRFPlantTypeOfNum; // integer equivalent of index to DataPlant type int SourceLoopNum; // plant data for water-cooled only int SourceLoopSideNum; // plant data for water-cooled only @@ -206,7 +192,7 @@ namespace HVACVariableRefrigerantFlow { Real64 MinPLR; // minimum PLR before cycling occurs int MasterZonePtr; // index to master thermostat zone int MasterZoneTUIndex; // index to TU in master thermostat zone - int ThermostatPriority; // VRF priority control (1=LoadPriority, 2=ZonePriority, etc) + iThermostatCtrlType ThermostatPriority; // VRF priority control (1=LoadPriority, 2=ZonePriority, etc) int SchedPriorityPtr; // VRF priority control schedule pointer int ZoneTUListPtr; // index to zone terminal unit list bool HeatRecoveryUsed; // .TRUE. = heat recovery used @@ -294,7 +280,7 @@ namespace HVACVariableRefrigerantFlow { int DefrostHeatErrorIndex; // warning message index for recurring warnings // end variables used for heat recovery mode // begin variables for Water System interactions - int EvapWaterSupplyMode; // where does water come from + iWaterSupply EvapWaterSupplyMode; // where does water come from std::string EvapWaterSupplyName; // name of water source e.g. water storage tank int EvapWaterSupTankID; int EvapWaterTankDemandARRID; @@ -387,7 +373,7 @@ namespace HVACVariableRefrigerantFlow { // Default Constructor VRFCondenserEquipment() - : VRFSystemTypeNum(0), VRFAlgorithmTypeNum(0), VRFPlantTypeOfNum(0), SourceLoopNum(0), SourceLoopSideNum(0), SourceBranchNum(0), + : VRFSystemTypeNum(0), VRFAlgorithmTypeNum(iAlgorithmType::Unassigned), VRFPlantTypeOfNum(0), SourceLoopNum(0), SourceLoopSideNum(0), SourceBranchNum(0), SourceCompNum(0), WaterCondenserDesignMassFlow(0.0), WaterCondenserMassFlow(0.0), QCondenser(0.0), QCondEnergy(0.0), CondenserSideOutletTemp(0.0), SchedPtr(-1), CoolingCapacity(0.0), TotalCoolingCapacity(0.0), CoolingCombinationRatio(1.0), VRFCondPLR(0.0), VRFCondRTF(0.0), VRFCondCyclingRatio(0.0), CondenserInletTemp(0.0), CoolingCOP(0.0), OperatingCoolingCOP(0.0), @@ -396,36 +382,36 @@ namespace HVACVariableRefrigerantFlow { MinOATHeating(0.0), MaxOATHeating(0.0), CoolCapFT(0), CoolEIRFT(0), HeatCapFT(0), HeatEIRFT(0), CoolBoundaryCurvePtr(0), HeatBoundaryCurvePtr(0), EIRCoolBoundaryCurvePtr(0), CoolEIRFPLR1(0), CoolEIRFPLR2(0), CoolCapFTHi(0), CoolEIRFTHi(0), HeatCapFTHi(0), HeatEIRFTHi(0), EIRHeatBoundaryCurvePtr(0), HeatEIRFPLR1(0), HeatEIRFPLR2(0), CoolPLFFPLR(0), HeatPLFFPLR(0), - HeatingPerformanceOATType(0), MinPLR(0.0), MasterZonePtr(0), MasterZoneTUIndex(0), ThermostatPriority(0), SchedPriorityPtr(0), - ZoneTUListPtr(0), HeatRecoveryUsed(false), VertPipeLngth(0.0), PCFLengthCoolPtr(0), PCFHeightCool(0.0), EquivPipeLngthCool(0.0), - PipingCorrectionCooling(1.0), PCFLengthHeatPtr(0), PCFHeightHeat(0.0), EquivPipeLngthHeat(0.0), PipingCorrectionHeating(1.0), - CCHeaterPower(0.0), CompressorSizeRatio(0.0), NumCompressors(0), MaxOATCCHeater(0.0), DefrostEIRPtr(0), DefrostFraction(0.0), - DefrostStrategy(0), DefrostControl(0), DefrostCapacity(0.0), DefrostPower(0.0), DefrostConsumption(0.0), MaxOATDefrost(0.0), - CondenserType(0), CondenserNodeNum(0), SkipCondenserNodeNumCheck(false), CondenserOutletNodeNum(0), WaterCondVolFlowRate(0.0), - EvapCondEffectiveness(0.0), EvapCondAirVolFlowRate(0.0), EvapCondPumpPower(0.0), CoolCombRatioPTR(0), HeatCombRatioPTR(0), - OperatingMode(0), ElecPower(0.0), ElecCoolingPower(0.0), ElecHeatingPower(0.0), CoolElecConsumption(0.0), HeatElecConsumption(0.0), - CrankCaseHeaterPower(0.0), CrankCaseHeaterElecConsumption(0.0), EvapCondPumpElecPower(0.0), EvapCondPumpElecConsumption(0.0), - EvapWaterConsumpRate(0.0), HRMaxTempLimitIndex(0), CoolingMaxTempLimitIndex(0), HeatingMaxTempLimitIndex(0), - FuelTypeNum(DataGlobalConstants::ResourceType::None), - SUMultiplier(0.0), TUCoolingLoad(0.0), TUHeatingLoad(0.0), SwitchedMode(false), OperatingCOP(0.0), MinOATHeatRecovery(0.0), - MaxOATHeatRecovery(0.0), HRCAPFTCool(0), HRCAPFTCoolConst(0.9), HRInitialCoolCapFrac(0.5), HRCoolCapTC(0.15), HREIRFTCool(0), - HREIRFTCoolConst(1.1), HRInitialCoolEIRFrac(1.0), HRCoolEIRTC(0.0), HRCAPFTHeat(0), HRCAPFTHeatConst(1.1), HRInitialHeatCapFrac(1.0), - HRHeatCapTC(0.0), HREIRFTHeat(0), HREIRFTHeatConst(1.1), HRInitialHeatEIRFrac(1.0), HRHeatEIRTC(0.0), HRCoolingActive(false), - HRHeatingActive(false), ModeChange(false), HRModeChange(false), HRTimer(0.0), HRTime(0.0), EIRFTempCoolErrorIndex(0), - EIRFTempHeatErrorIndex(0), DefrostHeatErrorIndex(0), EvapWaterSupplyMode(WaterSupplyFromMains), EvapWaterSupTankID(0), - EvapWaterTankDemandARRID(0), CondensateTankID(0), CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), - BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), BasinHeaterPower(0.0), BasinHeaterConsumption(0.0), - BasinHeaterSchedulePtr(0), EMSOverrideHPOperatingMode(false), EMSValueForHPOperatingMode(0.0), HPOperatingModeErrorIndex(0), - VRFHeatRec(0.0), VRFHeatEnergyRec(0.0), HeatCapFTErrorIndex(0), CoolCapFTErrorIndex(0), AlgorithmIUCtrl(1), CondensingTemp(44.0), - CondTempFixed(0.0), CoffEvapCap(1.0), CompActSpeed(0.0), CompMaxDeltaP(0.0), C1Te(0.0), C2Te(0.0), C3Te(0.0), C1Tc(0.0), C2Tc(0.0), - C3Tc(0.0), DiffOUTeTo(5), EffCompInverter(0.95), EvaporatingTemp(6.0), EvapTempFixed(0.0), HROUHexRatio(0.0), IUEvaporatingTemp(6.0), - IUCondensingTemp(44.0), IUEvapTempLow(4.0), IUEvapTempHigh(15.0), IUCondTempLow(42.0), IUCondTempHigh(46.0), IUCondHeatRate(0.0), - IUEvapHeatRate(0.0), Ncomp(0.0), NcompCooling(0.0), NcompHeating(0.0), OUEvapTempLow(-30.0), OUEvapTempHigh(20.0), OUCondTempLow(30.0), - OUCondTempHigh(96.0), OUAirFlowRate(0.0), OUAirFlowRatePerCapcity(0.0), OUCondHeatRate(0.0), OUEvapHeatRate(0.0), OUFanPower(0.0), - RatedEvapCapacity(40000.0), RatedHeatCapacity(0.0), RatedCompPower(14000.0), RatedCompPowerPerCapcity(0.35), RatedOUFanPower(0.0), - RatedOUFanPowerPerCapcity(0.0), RateBFOUEvap(0.45581), RateBFOUCond(0.21900), RefPipDiaSuc(0.0), RefPipDiaDis(0.0), RefPipLen(0.0), - RefPipEquLen(0.0), RefPipHei(0.0), RefPipInsThi(0.0), RefPipInsCon(0.0), SH(0.0), SC(0.0), SCHE(0.0), SHLow(0.0), SCLow(0.0), - SHHigh(0.0), SCHigh(0.0), VRFOperationSimPath(0.0), checkPlantCondTypeOneTime(true) + HeatingPerformanceOATType(0), MinPLR(0.0), MasterZonePtr(0), MasterZoneTUIndex(0), ThermostatPriority(iThermostatCtrlType::Unassigned), + SchedPriorityPtr(0), ZoneTUListPtr(0), HeatRecoveryUsed(false), VertPipeLngth(0.0), PCFLengthCoolPtr(0), PCFHeightCool(0.0), + EquivPipeLngthCool(0.0), PipingCorrectionCooling(1.0), PCFLengthHeatPtr(0), PCFHeightHeat(0.0), EquivPipeLngthHeat(0.0), + PipingCorrectionHeating(1.0), CCHeaterPower(0.0), CompressorSizeRatio(0.0), NumCompressors(0), MaxOATCCHeater(0.0), DefrostEIRPtr(0), + DefrostFraction(0.0), DefrostStrategy(0), DefrostControl(0), DefrostCapacity(0.0), DefrostPower(0.0), DefrostConsumption(0.0), + MaxOATDefrost(0.0), CondenserType(0), CondenserNodeNum(0), SkipCondenserNodeNumCheck(false), CondenserOutletNodeNum(0), + WaterCondVolFlowRate(0.0), EvapCondEffectiveness(0.0), EvapCondAirVolFlowRate(0.0), EvapCondPumpPower(0.0), CoolCombRatioPTR(0), + HeatCombRatioPTR(0), OperatingMode(0), ElecPower(0.0), ElecCoolingPower(0.0), ElecHeatingPower(0.0), CoolElecConsumption(0.0), + HeatElecConsumption(0.0), CrankCaseHeaterPower(0.0), CrankCaseHeaterElecConsumption(0.0), EvapCondPumpElecPower(0.0), + EvapCondPumpElecConsumption(0.0), EvapWaterConsumpRate(0.0), HRMaxTempLimitIndex(0), CoolingMaxTempLimitIndex(0), + HeatingMaxTempLimitIndex(0), FuelTypeNum(DataGlobalConstants::ResourceType::None), SUMultiplier(0.0), TUCoolingLoad(0.0), + TUHeatingLoad(0.0), SwitchedMode(false), OperatingCOP(0.0), MinOATHeatRecovery(0.0), MaxOATHeatRecovery(0.0), HRCAPFTCool(0), + HRCAPFTCoolConst(0.9), HRInitialCoolCapFrac(0.5), HRCoolCapTC(0.15), HREIRFTCool(0), HREIRFTCoolConst(1.1), HRInitialCoolEIRFrac(1.0), + HRCoolEIRTC(0.0), HRCAPFTHeat(0), HRCAPFTHeatConst(1.1), HRInitialHeatCapFrac(1.0), HRHeatCapTC(0.0), HREIRFTHeat(0), + HREIRFTHeatConst(1.1), HRInitialHeatEIRFrac(1.0), HRHeatEIRTC(0.0), HRCoolingActive(false), HRHeatingActive(false), ModeChange(false), + HRModeChange(false), HRTimer(0.0), HRTime(0.0), EIRFTempCoolErrorIndex(0), EIRFTempHeatErrorIndex(0), DefrostHeatErrorIndex(0), + EvapWaterSupplyMode(iWaterSupply::FromMains), EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), CondensateTankID(0), + CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), + BasinHeaterPower(0.0), BasinHeaterConsumption(0.0), BasinHeaterSchedulePtr(0), EMSOverrideHPOperatingMode(false), + EMSValueForHPOperatingMode(0.0), HPOperatingModeErrorIndex(0), VRFHeatRec(0.0), VRFHeatEnergyRec(0.0), HeatCapFTErrorIndex(0), + CoolCapFTErrorIndex(0), AlgorithmIUCtrl(1), CondensingTemp(44.0), CondTempFixed(0.0), CoffEvapCap(1.0), CompActSpeed(0.0), + CompMaxDeltaP(0.0), C1Te(0.0), C2Te(0.0), C3Te(0.0), C1Tc(0.0), C2Tc(0.0), C3Tc(0.0), DiffOUTeTo(5), EffCompInverter(0.95), + EvaporatingTemp(6.0), EvapTempFixed(0.0), HROUHexRatio(0.0), IUEvaporatingTemp(6.0), IUCondensingTemp(44.0), IUEvapTempLow(4.0), + IUEvapTempHigh(15.0), IUCondTempLow(42.0), IUCondTempHigh(46.0), IUCondHeatRate(0.0), IUEvapHeatRate(0.0), Ncomp(0.0), + NcompCooling(0.0), NcompHeating(0.0), OUEvapTempLow(-30.0), OUEvapTempHigh(20.0), OUCondTempLow(30.0), OUCondTempHigh(96.0), + OUAirFlowRate(0.0), OUAirFlowRatePerCapcity(0.0), OUCondHeatRate(0.0), OUEvapHeatRate(0.0), OUFanPower(0.0), RatedEvapCapacity(40000.0), + RatedHeatCapacity(0.0), RatedCompPower(14000.0), RatedCompPowerPerCapcity(0.35), RatedOUFanPower(0.0), RatedOUFanPowerPerCapcity(0.0), + RateBFOUEvap(0.45581), RateBFOUCond(0.21900), RefPipDiaSuc(0.0), RefPipDiaDis(0.0), RefPipLen(0.0), RefPipEquLen(0.0), RefPipHei(0.0), + RefPipInsThi(0.0), RefPipInsCon(0.0), SH(0.0), SC(0.0), SCHE(0.0), SHLow(0.0), SCLow(0.0), SHHigh(0.0), SCHigh(0.0), + VRFOperationSimPath(0.0), checkPlantCondTypeOneTime(true) { } @@ -444,31 +430,31 @@ namespace HVACVariableRefrigerantFlow { void CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state); - void CalcVRFIUTeTc_FluidTCtrl(); + void CalcVRFIUTeTc_FluidTCtrl(EnergyPlusData &state); void VRFOU_TeTc(EnergyPlusData &state, - int OperationMode, // Flag for hex operation - Real64 Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W] - Real64 SHSC, // SH at cooling or SC at heating [C] - Real64 m_air, // OU coil air mass flow rate [kg/s] - Real64 T_coil_in, // Temperature of air at OU coil inlet [C] - Real64 W_coil_in, // Humidity ratio of air at OU coil inlet [kg/kg] - Real64 OutdoorPressure, // Outdoor air pressure (Pa) - Real64 &T_coil_surf, // Air temperature at coil surface [C] - Real64 &TeTc // VRF Tc at cooling mode, or Te at heating mode [C] + iHXOpMode OperationMode, // Flag for hex operation + Real64 Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W] + Real64 SHSC, // SH at cooling or SC at heating [C] + Real64 m_air, // OU coil air mass flow rate [kg/s] + Real64 T_coil_in, // Temperature of air at OU coil inlet [C] + Real64 W_coil_in, // Humidity ratio of air at OU coil inlet [kg/kg] + Real64 OutdoorPressure, // Outdoor air pressure (Pa) + Real64 &T_coil_surf, // Air temperature at coil surface [C] + Real64 &TeTc // VRF Tc at cooling mode, or Te at heating mode [C] ); Real64 VRFOU_FlowRate(EnergyPlusData &state, - int OperationMode, // Flag for hex operation - Real64 TeTc, // VRF Tc at cooling mode, or Te at heating mode [C] - Real64 SHSC, // SC for OU condenser or SH for OU evaporator [C] - Real64 Q_coil, // absolute value of OU coil heat release or heat extract [W] - Real64 T_coil_in, // Temperature of air at OU coil inlet [C] - Real64 W_coil_in // Humidity ratio of air at OU coil inlet [kg/kg] + iHXOpMode OperationMode, // Flag for hex operation + Real64 TeTc, // VRF Tc at cooling mode, or Te at heating mode [C] + Real64 SHSC, // SC for OU condenser or SH for OU evaporator [C] + Real64 Q_coil, // absolute value of OU coil heat release or heat extract [W] + Real64 T_coil_in, // Temperature of air at OU coil inlet [C] + Real64 W_coil_in // Humidity ratio of air at OU coil inlet [kg/kg] ) const; Real64 VRFOU_Cap(EnergyPlusData &state, - int OperationMode, // Flag for hex operation + iHXOpMode OperationMode, // Flag for hex operation Real64 TeTc, // VRF Tc at cooling mode, or Te at heating mode [C] Real64 SHSC, // SC for OU condenser or SH for OU evaporator [C] Real64 m_air, // OU coil air mass flow rate [kg/s] @@ -477,7 +463,7 @@ namespace HVACVariableRefrigerantFlow { ); Real64 VRFOU_SCSH(EnergyPlusData &state, - int OperationMode, // Mode 0 for running as evaporator, 1 for condenser + iHXOpMode OperationMode, // Mode 0 for running as evaporator, 1 for condenser Real64 Q_coil, // // OU coil heat release at cooling mode or heat extract at heating mode [W] Real64 TeTc, // VRF Tc at cooling mode, or Te at heating mode [C] Real64 m_air, // OU coil air mass flow rate [kg/s] @@ -560,7 +546,7 @@ namespace HVACVariableRefrigerantFlow { void VRFOU_CompSpd(EnergyPlusData &state, Real64 Q_req, // Required capacity [W] - int Q_type, // Required capacity type: 0 for evaporator, 1 for condenser + iHXOpMode Q_type, // Required capacity type: 0 for evaporator, 1 for condenser Real64 T_suction, // Compressor suction temperature Te' [C] Real64 T_discharge, // Compressor discharge temperature Tc' [C] Real64 h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] @@ -791,7 +777,8 @@ namespace HVACVariableRefrigerantFlow { // Note: the argument VRFTUNum should be removed later in the deeper OO re-factor. Now this argument may be used by other functions that are // not member functions of this class. - void CalcVRFIUVariableTeTc(Real64 &EvapTemp, // evaporating temperature + void CalcVRFIUVariableTeTc(EnergyPlusData &state, + Real64 &EvapTemp, // evaporating temperature Real64 &CondTemp // condensing temperature ); @@ -871,12 +858,6 @@ namespace HVACVariableRefrigerantFlow { VRFTUNumericFieldData() = default; }; - // Object Data - extern Array1D VRF; // AirConditioner:VariableRefrigerantFlow object - extern Array1D VRFTU; // ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object - extern Array1D TerminalUnitList; // zoneTerminalUnitList object - extern Array1D VRFTUNumericFields; // holds VRF TU numeric input fields character field name - // Functions void SimulateVRF(EnergyPlusData &state, std::string const &CompName, @@ -900,7 +881,7 @@ namespace HVACVariableRefrigerantFlow { void InitVRF(EnergyPlusData &state, int VRFTUNum, int ZoneNum, bool FirstHVACIteration, Real64 &OnOffAirFlowRatio, Real64 &QZnReq); - void SetCompFlowRate(int VRFTUNum, int VRFCond, Optional_bool_const UseCurrentMode = _); + void SetCompFlowRate(EnergyPlusData &state, int VRFTUNum, int VRFCond, Optional_bool_const UseCurrentMode = _); void SizeVRF(EnergyPlusData &state, int const VRFTUNum); @@ -921,17 +902,15 @@ namespace HVACVariableRefrigerantFlow { int GetVRFTUInAirNodeFromName(EnergyPlusData &state, std::string const VRFTUName, bool &errorsFound); - int GetVRFTUMixedAirNode(EnergyPlusData &state,int const VRFTUNum); - int GetVRFTUReturnAirNode(EnergyPlusData &state, int const VRFTUNum); - void getVRFTUZoneLoad(int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag); + void getVRFTUZoneLoad(EnergyPlusData &state, int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag); - void ReportVRFTerminalUnit(int VRFTUNum); // index to VRF terminal unit + void ReportVRFTerminalUnit(EnergyPlusData &state, int VRFTUNum); // index to VRF terminal unit - void ReportVRFCondenser(int VRFCond); // index to VRF condensing unit + void ReportVRFCondenser(EnergyPlusData &state, int VRFCond); // index to VRF condensing unit - void UpdateVRFCondenser(int VRFCond); // index to VRF condensing unit + void UpdateVRFCondenser(EnergyPlusData &state, int VRFCond); // index to VRF condensing unit void isVRFCoilPresent(EnergyPlusData &state, std::string const VRFTUName, bool &CoolCoilPresent, bool & HeatCoilPresent); @@ -951,7 +930,8 @@ namespace HVACVariableRefrigerantFlow { Real64 &OnOffAirFlowRatio // ratio of on to off flow rate ); - void LimitTUCapacity(int VRFCond, // Condenser Unit index + void LimitTUCapacity(EnergyPlusData &state, + int VRFCond, // Condenser Unit index int NumTUInList, // Number of terminal units in list Real64 StartingCapacity, // temporary variable holding condenser capacity [W] const Array1D &CapArray, // Array of coil capacities in either cooling or heating mode [W] @@ -967,8 +947,6 @@ namespace HVACVariableRefrigerantFlow { Real64 &MaxLimit // Maximum terminal unit capacity for coils in same operating mode [W] ); - void clear_state(); - Real64 VRFTUAirFlowResidual_FluidTCtrl(EnergyPlusData &state, Real64 FanSpdRatio, // fan speed ratio of VRF VAV TU Array1D const &Par // par(1) = VRFTUNum ); @@ -987,9 +965,105 @@ namespace HVACVariableRefrigerantFlow { struct HVACVarRefFlowData : BaseGlobalStruct { + bool GetVRFInputFlag = true; // Flag set to make sure you get input once + bool MyOneTimeFlag = true; // One time flag used to allocate MyEnvrnFlag and MySizeFlag + bool MyOneTimeSizeFlag = true; // One time flag used to allocate MyEnvrnFlag and MySizeFlag + bool ZoneEquipmentListNotChecked = true; // False after the Zone Equipment List has been checked for items + int NumVRFCond = 0; // total number of VRF condensers (All VRF Algorithm Types) + int NumVRFCond_SysCurve = 0; // total number of VRF condensers with VRF Algorithm Type 1 + int NumVRFCond_FluidTCtrl_HP = 0; // total number of VRF condensers with VRF Algorithm Type 2 (HP) + int NumVRFCond_FluidTCtrl_HR = 0; // total number of VRF condensers with VRF Algorithm Type 2 (HR) + int NumVRFTU = 0; // total number of VRF terminal units + int NumVRFTULists = 0; // The number of VRF TU lists + Real64 CompOnMassFlow = 0.0; // Supply air mass flow rate w/ compressor ON + Real64 OACompOnMassFlow = 0.0; // OA mass flow rate w/ compressor ON + Real64 CompOffMassFlow = 0.0; // Supply air mass flow rate w/ compressor OFF + Real64 OACompOffMassFlow = 0.0; // OA mass flow rate w/ compressor OFF + Real64 CompOnFlowRatio = 0.0; // fan flow ratio when coil on + Real64 CompOffFlowRatio = 0.0; // fan flow ratio when coil off + Real64 FanSpeedRatio = 0.0; // ratio of air flow ratio passed to fan object + Real64 LoopDXCoolCoilRTF = 0.0; // holds value of DX cooling coil RTF + Real64 LoopDXHeatCoilRTF = 0.0; // holds value of DX heating coil RTF + Real64 CondenserWaterMassFlowRate = 0.0; // VRF water-cooled condenser mass flow rate (kg/s) + Real64 CurrentEndTimeLast = 0.0; // end time of last time step + Array1D_bool HeatingLoad; // defines a heating load on VRFTerminalUnits + Array1D_bool CoolingLoad; // defines a cooling load on VRFTerminalUnits + Array1D_bool LastModeHeating; // defines last mode was heating mode + Array1D_bool LastModeCooling; // defines last mode was cooling mode + Array1D_bool CheckEquipName; // Flag set to check equipment connections once + Array1D_bool MyEnvrnFlag; // Flag for initializing at beginning of each new environment + Array1D_bool MySizeFlag; // False after TU has been sized + Array1D_bool MyBeginTimeStepFlag; // Flag to sense beginning of time step + Array1D_bool MyVRFFlag; // used for sizing VRF inputs one time + Array1D_bool MyVRFCondFlag; // used to reset timer counter + Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + Array1D_int NumCoolingLoads; // number of TU's requesting cooling + Array1D_int NumHeatingLoads; // number of TU's requesting heating + Array1D MaxCoolingCapacity; // maximum capacity of any terminal unit + Array1D MaxHeatingCapacity; // maximum capacity of any terminal unit + Array1D CoolCombinationRatio; // ratio of terminal unit capacity to VRF condenser capacity + Array1D HeatCombinationRatio; // ratio of terminal unit capacity to VRF condenser capacity + Array1D MaxDeltaT; // maximum zone temperature difference from setpoint + Array1D MinDeltaT; // minimum zone temperature difference from setpoint + Array1D SumCoolingLoads; // sum of cooling loads + Array1D SumHeatingLoads; // sum of heating loads + + // Object Data + Array1D VRF; // AirConditioner:VariableRefrigerantFlow object + std::unordered_map VrfUniqueNames; + Array1D VRFTU; // ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object + Array1D TerminalUnitList; // zoneTerminalUnitList object + Array1D VRFTUNumericFields; // holds VRF TU numeric input fields character field name + void clear_state() override { - + this->GetVRFInputFlag = true; + this->MyOneTimeFlag = true; + this->MyOneTimeSizeFlag = true; + this->ZoneEquipmentListNotChecked = true; + this->NumVRFCond = 0; + this->NumVRFCond_SysCurve = 0; + this->NumVRFCond_FluidTCtrl_HP = 0; + this->NumVRFCond_FluidTCtrl_HR = 0; + this->NumVRFTU = 0; + this->NumVRFTULists = 0; + this->CompOnMassFlow = 0.0; + this->OACompOnMassFlow = 0.0; + this->CompOffMassFlow = 0.0; + this->OACompOffMassFlow = 0.0; + this->CompOnFlowRatio = 0.0; + this->CompOffFlowRatio = 0.0; + this->FanSpeedRatio = 0.0; + this->LoopDXCoolCoilRTF = 0.0; + this->LoopDXHeatCoilRTF = 0.0; + this->CondenserWaterMassFlowRate = 0.0; + this->CurrentEndTimeLast = 0.0; + this->HeatingLoad.deallocate(); + this->CoolingLoad.deallocate(); + this->LastModeHeating.deallocate(); + this->LastModeCooling.deallocate(); + this->CheckEquipName.deallocate(); + this->MyEnvrnFlag.deallocate(); + this->MySizeFlag.deallocate(); + this->MyBeginTimeStepFlag.deallocate(); + this->MyVRFFlag.deallocate(); + this->MyVRFCondFlag.deallocate(); + this->MyZoneEqFlag.deallocate(); + this->NumCoolingLoads.deallocate(); + this->NumHeatingLoads.deallocate(); + this->MaxCoolingCapacity.deallocate(); + this->MaxHeatingCapacity.deallocate(); + this->CoolCombinationRatio.deallocate(); + this->HeatCombinationRatio.deallocate(); + this->MaxDeltaT.deallocate(); + this->MinDeltaT.deallocate(); + this->SumCoolingLoads.deallocate(); + this->SumHeatingLoads.deallocate(); + this->VRF.deallocate(); + this->VrfUniqueNames.clear(); + this->VRFTU.deallocate(); + this->TerminalUnitList.deallocate(); + this->VRFTUNumericFields.deallocate(); } }; diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index 7e2adafc1cb..4831bdf34c6 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -1276,13 +1276,6 @@ namespace HeatRecovery { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - // REFERENCES: - // na - - // Using/Aliasing - using DXCoils::DXCoilFullLoadOutAirHumRat; - using DXCoils::DXCoilFullLoadOutAirTemp; - // USE DataZoneEquipment, ONLY: ZoneEquipInputsFilled,CheckZoneEquipmentList using EMSManager::CheckIfNodeSetPointManagedByEMS; @@ -1568,14 +1561,14 @@ namespace HeatRecovery { if (CompanionCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed || CompanionCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) { - if (DXCoilFullLoadOutAirTemp(CompanionCoilIndex) == 0.0 || DXCoilFullLoadOutAirHumRat(CompanionCoilIndex) == 0.0) { + if (state.dataDXCoils->DXCoilFullLoadOutAirTemp(CompanionCoilIndex) == 0.0 || state.dataDXCoils->DXCoilFullLoadOutAirHumRat(CompanionCoilIndex) == 0.0) { // DX Coil is OFF, read actual inlet conditions FullLoadOutAirTemp = ExchCond(ExchNum).SecInTemp; FullLoadOutAirHumRat = ExchCond(ExchNum).SecInHumRat; } else { // DX Coil is ON, read full load DX coil outlet conditions (conditions HX sees when ON) - FullLoadOutAirTemp = DXCoilFullLoadOutAirTemp(CompanionCoilIndex); - FullLoadOutAirHumRat = DXCoilFullLoadOutAirHumRat(CompanionCoilIndex); + FullLoadOutAirTemp = state.dataDXCoils->DXCoilFullLoadOutAirTemp(CompanionCoilIndex); + FullLoadOutAirHumRat = state.dataDXCoils->DXCoilFullLoadOutAirHumRat(CompanionCoilIndex); } } else if (CompanionCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { // how to support VS dx coil here? @@ -2563,7 +2556,6 @@ namespace HeatRecovery { // Using/Aliasing using DataLoopNode::SensedNodeFlagValue; - using DXCoils::DXCoilPartLoadRatio; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -2810,7 +2802,7 @@ namespace HeatRecovery { } else if (CompanionCoilIndex > 0) { // VS coil issue here? - HXPartLoadRatio = DXCoilPartLoadRatio(CompanionCoilIndex); + HXPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(CompanionCoilIndex); } if (FanOpMode == CycFanCycCoil || RegenInletIsOANode) { diff --git a/src/EnergyPlus/HeatingCoils.cc b/src/EnergyPlus/HeatingCoils.cc index edcfa7518bc..2b6a61723d9 100644 --- a/src/EnergyPlus/HeatingCoils.cc +++ b/src/EnergyPlus/HeatingCoils.cc @@ -124,7 +124,6 @@ namespace HeatingCoils { using Psychrometrics::PsyRhoAirFnPbTdbW; using namespace ScheduleManager; using DXCoils::GetDXCoilIndex; - using DXCoils::NumDXCoils; using RefrigeratedCase::GetRefrigeratedRackIndex; // Data @@ -1423,7 +1422,7 @@ namespace HeatingCoils { } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_COOLING || HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTISPEED || HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTIMODE) { - for (DXCoilNum = 1; DXCoilNum <= NumDXCoils; ++DXCoilNum) { + for (DXCoilNum = 1; DXCoilNum <= state.dataDXCoils->NumDXCoils; ++DXCoilNum) { if (!UtilityRoutines::SameString(HeatReclaimDXCoil(DXCoilNum).Name, HeatingCoil(CoilNum).ReclaimHeatingCoilName)) continue; HeatingCoil(CoilNum).ReclaimHeatingSourceIndexNum = DXCoilNum; if (allocated(HeatReclaimDXCoil)) { @@ -2658,7 +2657,7 @@ namespace HeatingCoils { } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_COOLING || HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTISPEED || HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_MULTIMODE) { - HeatingCoil(CoilNum).RTF = DXCoil(SourceID).CoolingCoilRuntimeFraction; + HeatingCoil(CoilNum).RTF = state.dataDXCoils->DXCoil(SourceID).CoolingCoilRuntimeFraction; HeatingCoil(CoilNum).NominalCapacity = HeatReclaimDXCoil(SourceID).AvailCapacity * Effic - HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal; } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_VARIABLE_COOLING) { diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 205b6149211..d21b17ecb6f 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -164,9 +164,7 @@ namespace MixedAir { int const FixedDewPointAndDryBulb(5); int const ElectronicEnthalpy(6); int const DifferentialDryBulbAndEnthalpy(7); - // coil operation - int const On(1); // normal coil operation - int const Off(0); // signal coil shouldn't run + // component types addressed by this module int const OAMixer_Num(1); int const Fan_Simple_CV(2); @@ -185,13 +183,13 @@ namespace MixedAir { int const Unglazed_SolarCollector(15); int const EvapCooler(16); int const PVT_AirBased(17); - int const Fan_ComponentModel(18); // cpw22Aug2010 (new) + int const Fan_ComponentModel(18); int const DXHeatPumpSystem(19); int const Coil_UserDefined(20); int const Humidifier(21); int const Fan_System_Object(22); int const UnitarySystemModel(23); - int const VRFTerminalUnit(24); // new Jan 2020 + int const VRFTerminalUnit(24); int const ControllerOutsideAir(2); int const ControllerStandAloneERV(3); @@ -634,7 +632,6 @@ namespace MixedAir { if (Sim) { HVACFan::fanObjs[CompIndex - 1]->simulate(state, _, _, _, _); // vector is 0 based, but CompIndex is 1 based so shift } - // cpw22Aug2010 Add Fan:ComponentModel (new num=18) } else if (SELECT_CASE_var == Fan_ComponentModel) { // 'Fan:ComponentModel' if (Sim) { Fans::SimulateFanComponents(state, CompName, FirstHVACIteration, CompIndex); @@ -1228,7 +1225,6 @@ CurrentModuleObjects(CMO_SysAvailMgrList), AvailManagerListName); // construct fan object HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(CompNum))); state.dataAirLoop->OutsideAirSys(OASysNum).ComponentIndex(CompNum) = HVACFan::fanObjs.size(); - // cpw22Aug2010 Add Fan:ComponentModel (new) } else if (SELECT_CASE_var == "FAN:COMPONENTMODEL") { state.dataAirLoop->OutsideAirSys(OASysNum).ComponentType_Num(CompNum) = Fan_ComponentModel; diff --git a/src/EnergyPlus/MixedAir.hh b/src/EnergyPlus/MixedAir.hh index b2404c16b70..ee4f1dbcb97 100644 --- a/src/EnergyPlus/MixedAir.hh +++ b/src/EnergyPlus/MixedAir.hh @@ -84,8 +84,8 @@ namespace MixedAir { extern int const ElectronicEnthalpy; extern int const DifferentialDryBulbAndEnthalpy; // coil operation - extern int const On; // normal coil operation - extern int const Off; // signal coil shouldn't run + constexpr int On(1); // normal coil operation + constexpr int Off(0); // signal coil shouldn't run // component types addressed by this module extern int const OAMixer_Num; extern int const Fan_Simple_CV; @@ -104,7 +104,7 @@ namespace MixedAir { extern int const Unglazed_SolarCollector; extern int const EvapCooler; extern int const PVT_AirBased; - extern int const Fan_ComponentModel; // cpw22Aug2010 (new) + extern int const Fan_ComponentModel; extern int const DXHeatPumpSystem; extern int const Coil_UserDefined; extern int const Humidifier; diff --git a/src/EnergyPlus/OutputProcessor.cc b/src/EnergyPlus/OutputProcessor.cc index ebb3ecaf907..4f30a7e1994 100644 --- a/src/EnergyPlus/OutputProcessor.cc +++ b/src/EnergyPlus/OutputProcessor.cc @@ -5201,7 +5201,7 @@ void SetupOutputVariable(EnergyPlusData &state, std::string const &TimeStepTypeKey, // Zone, HeatBalance=1, HVAC, System, Plant=2 std::string const &VariableTypeKey, // State, Average=1, NonState, Sum=2 std::string const &KeyedValue, // Associated Key for this variable - Optional_string_const ReportFreq, // Internal use -- causes reporting at this freqency + Optional_string_const ReportFreq, // Internal use -- causes reporting at this frequency Optional_string_const ResourceTypeKey, // Meter Resource Type (Electricity, Gas, etc) Optional_string_const EndUseKey, // Meter End Use Key (Lights, Heating, Cooling, etc) Optional_string_const EndUseSubKey, // Meter End Use Sub Key (General Lights, Task Lights, etc) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 8ee86aa5917..c555a9dbbb3 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -3191,16 +3191,6 @@ namespace EnergyPlus::OutputReportTabular { // METHODOLOGY EMPLOYED: // Go through the reports and create links - // REFERENCES: - // na - - // Using/Aliasing - using EconomicLifeCycleCost::LCCparamPresent; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - // SUBROUTINE PARAMETER DEFINITIONS: static std::string const Entire_Facility("Entire Facility"); static std::string const Annual_Building_Utility_Performance_Summary("Annual Building Utility Performance Summary"); @@ -3238,7 +3228,7 @@ namespace EnergyPlus::OutputReportTabular { auto &ort(state.dataOutRptTab); // normally do not add to the table of contents here but the order of calls is different for the life-cycle costs - if (ort->displayLifeCycleCostReport && LCCparamPresent) { + if (ort->displayLifeCycleCostReport && state.dataEconLifeCycleCost->LCCparamPresent) { AddTOCEntry(state, "Life-Cycle Cost Report", "Entire Facility"); } @@ -4324,8 +4314,6 @@ namespace EnergyPlus::OutputReportTabular { using DataHVACGlobals::EvapCooled; using DataHVACGlobals::TimeStepSys; using DataHVACGlobals::WaterCooled; - using DXCoils::DXCoil; - using DXCoils::NumDXCoils; using EvaporativeCoolers::EvapCond; using EvaporativeCoolers::NumEvapCool; using EvaporativeFluidCoolers::NumSimpleEvapFluidCoolers; @@ -4333,8 +4321,6 @@ namespace EnergyPlus::OutputReportTabular { using FluidCoolers::SimpleFluidCooler; using HeatingCoils::HeatingCoil; using HeatingCoils::NumHeatingCoils; - using HVACVariableRefrigerantFlow::NumVRFCond; - using HVACVariableRefrigerantFlow::VRF; using MixedAir::NumOAControllers; using MixedAir::OAController; using PackagedThermalStorageCoil::NumTESCoils; @@ -4409,25 +4395,25 @@ namespace EnergyPlus::OutputReportTabular { } // DX Coils air to air - for (iCoil = 1; iCoil <= NumDXCoils; ++iCoil) { - if (DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed || - DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed || - DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling || - DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) { - if (DXCoil(iCoil).CondenserType(1) == AirCooled) { - SysTotalHVACRejectHeatLoss += DXCoil(iCoil).ElecCoolingConsumption + DXCoil(iCoil).DefrostConsumption + - DXCoil(iCoil).CrankcaseHeaterConsumption + DXCoil(iCoil).TotalCoolingEnergy; - } else if (DXCoil(iCoil).CondenserType(1) == EvapCooled) { - SysTotalHVACRejectHeatLoss += DXCoil(iCoil).EvapCondPumpElecConsumption + DXCoil(iCoil).BasinHeaterConsumption + - DXCoil(iCoil).EvapWaterConsump * RhoWater * H2OHtOfVap_HVAC; - } - if (DXCoil(iCoil).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { - SysTotalHVACRejectHeatLoss += DXCoil(iCoil).MSFuelWasteHeat * TimeStepSysSec; - } - } else if (DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical || - DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) { - SysTotalHVACRejectHeatLoss += DXCoil(iCoil).ElecHeatingConsumption + DXCoil(iCoil).DefrostConsumption + DXCoil(iCoil).FuelConsumed + - DXCoil(iCoil).CrankcaseHeaterConsumption - DXCoil(iCoil).TotalHeatingEnergy; + for (iCoil = 1; iCoil <= state.dataDXCoils->NumDXCoils; ++iCoil) { + if (state.dataDXCoils->DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed || + state.dataDXCoils->DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoSpeed || + state.dataDXCoils->DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling || + state.dataDXCoils->DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) { + if (state.dataDXCoils->DXCoil(iCoil).CondenserType(1) == AirCooled) { + SysTotalHVACRejectHeatLoss += state.dataDXCoils->DXCoil(iCoil).ElecCoolingConsumption + state.dataDXCoils->DXCoil(iCoil).DefrostConsumption + + state.dataDXCoils->DXCoil(iCoil).CrankcaseHeaterConsumption + state.dataDXCoils->DXCoil(iCoil).TotalCoolingEnergy; + } else if (state.dataDXCoils->DXCoil(iCoil).CondenserType(1) == EvapCooled) { + SysTotalHVACRejectHeatLoss += state.dataDXCoils->DXCoil(iCoil).EvapCondPumpElecConsumption + state.dataDXCoils->DXCoil(iCoil).BasinHeaterConsumption + + state.dataDXCoils->DXCoil(iCoil).EvapWaterConsump * RhoWater * H2OHtOfVap_HVAC; + } + if (state.dataDXCoils->DXCoil(iCoil).FuelTypeNum != DataGlobalConstants::ResourceType::Electricity) { + SysTotalHVACRejectHeatLoss += state.dataDXCoils->DXCoil(iCoil).MSFuelWasteHeat * TimeStepSysSec; + } + } else if (state.dataDXCoils->DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_HeatingEmpirical || + state.dataDXCoils->DXCoil(iCoil).DXCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) { + SysTotalHVACRejectHeatLoss += state.dataDXCoils->DXCoil(iCoil).ElecHeatingConsumption + state.dataDXCoils->DXCoil(iCoil).DefrostConsumption + state.dataDXCoils->DXCoil(iCoil).FuelConsumed + + state.dataDXCoils->DXCoil(iCoil).CrankcaseHeaterConsumption - state.dataDXCoils->DXCoil(iCoil).TotalHeatingEnergy; } } // VAV coils - air to air @@ -4474,16 +4460,16 @@ namespace EnergyPlus::OutputReportTabular { } // Variable Refrigerant Flow - for (iCoil = 1; iCoil <= NumVRFCond; ++iCoil) { - if (VRF(iCoil).CondenserType == AirCooled) { - SysTotalHVACRejectHeatLoss += VRF(iCoil).CoolElecConsumption + VRF(iCoil).HeatElecConsumption + - VRF(iCoil).CrankCaseHeaterElecConsumption + VRF(iCoil).DefrostConsumption + - (VRF(iCoil).TotalCoolingCapacity - VRF(iCoil).TotalHeatingCapacity) * TimeStepSysSec; - } else if (VRF(iCoil).CondenserType == EvapCooled) { - SysTotalHVACRejectHeatLoss += VRF(iCoil).EvapCondPumpElecConsumption + VRF(iCoil).BasinHeaterConsumption + - VRF(iCoil).EvapWaterConsumpRate * TimeStepSysSec * RhoWater * H2OHtOfVap_HVAC; - } else if (VRF(iCoil).CondenserType == WaterCooled) { - SysTotalHVACRejectHeatLoss += VRF(iCoil).QCondEnergy; + for (iCoil = 1; iCoil <= state.dataHVACVarRefFlow->NumVRFCond; ++iCoil) { + if (state.dataHVACVarRefFlow->VRF(iCoil).CondenserType == AirCooled) { + SysTotalHVACRejectHeatLoss += state.dataHVACVarRefFlow->VRF(iCoil).CoolElecConsumption + state.dataHVACVarRefFlow->VRF(iCoil).HeatElecConsumption + + state.dataHVACVarRefFlow->VRF(iCoil).CrankCaseHeaterElecConsumption + state.dataHVACVarRefFlow->VRF(iCoil).DefrostConsumption + + (state.dataHVACVarRefFlow->VRF(iCoil).TotalCoolingCapacity - state.dataHVACVarRefFlow->VRF(iCoil).TotalHeatingCapacity) * TimeStepSysSec; + } else if (state.dataHVACVarRefFlow->VRF(iCoil).CondenserType == EvapCooled) { + SysTotalHVACRejectHeatLoss += state.dataHVACVarRefFlow->VRF(iCoil).EvapCondPumpElecConsumption + state.dataHVACVarRefFlow->VRF(iCoil).BasinHeaterConsumption + + state.dataHVACVarRefFlow->VRF(iCoil).EvapWaterConsumpRate * TimeStepSysSec * RhoWater * H2OHtOfVap_HVAC; + } else if (state.dataHVACVarRefFlow->VRF(iCoil).CondenserType == WaterCooled) { + SysTotalHVACRejectHeatLoss += state.dataHVACVarRefFlow->VRF(iCoil).QCondEnergy; } } diff --git a/src/EnergyPlus/PackagedTerminalHeatPump.cc b/src/EnergyPlus/PackagedTerminalHeatPump.cc index 10f97c3fa9c..d4857197a9f 100644 --- a/src/EnergyPlus/PackagedTerminalHeatPump.cc +++ b/src/EnergyPlus/PackagedTerminalHeatPump.cc @@ -136,7 +136,6 @@ namespace PackagedTerminalHeatPump { using namespace DataLoopNode; using namespace DataSizing; using namespace DataHVACGlobals; - using DXCoils::DXCoilPartLoadRatio; // Use statements for access to subroutines in other modules using namespace ScheduleManager; @@ -146,17 +145,12 @@ namespace PackagedTerminalHeatPump { bool MyOneTimeFlag(true); // initialization flag bool ZoneEquipmentListNotChecked(true); // False after the Zone Equipment List has been checked for items } // namespace - // Data - // MODULE PARAMETER DEFINITIONS - // Compressor operation - int const On(1); // normal compressor operation - int const Off(0); // signal DXCoil that compressor shouldn't run // Last mode of operation int const CoolingMode(1); // last compressor operating mode was in cooling int const HeatingMode(2); // last compressor operating mode was in heating - // Airflow control for contant fan mode + // Airflow control for constant fan mode int const UseCompressorOnFlow(1); // set compressor OFF air flow rate equal to compressor ON air flow rate int const UseCompressorOffFlow(2); // set compressor OFF air flow rate equal to user defined value @@ -6004,7 +5998,7 @@ namespace PackagedTerminalHeatPump { PartLoadFrac, OnOffAirFlowRatio); } - SaveCompressorPLR = DXCoilPartLoadRatio(PTUnit(PTUnitNum).DXCoolCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(PTUnit(PTUnitNum).DXCoolCoilIndexNum); } else if (SELECT_CASE_var == PTWSHPUnit) { HeatPumpRunFrac(PTUnitNum, PartLoadFrac, errFlag, WSHPRuntimeFrac); SimWatertoAirHPSimple(state, @@ -6135,7 +6129,7 @@ namespace PackagedTerminalHeatPump { PTUnit(PTUnitNum).OpMode, PartLoadFrac, OnOffAirFlowRatio); - SaveCompressorPLR = DXCoilPartLoadRatio(PTUnit(PTUnitNum).DXHeatCoilIndexNum); + SaveCompressorPLR = state.dataDXCoils->DXCoilPartLoadRatio(PTUnit(PTUnitNum).DXHeatCoilIndexNum); } else if (SELECT_CASE_var == PTWSHPUnit) { HeatPumpRunFrac(PTUnitNum, PartLoadFrac, errFlag, WSHPRuntimeFrac); SimWatertoAirHPSimple(state, diff --git a/src/EnergyPlus/PackagedTerminalHeatPump.hh b/src/EnergyPlus/PackagedTerminalHeatPump.hh index b34c6aab25c..99a4d67650c 100644 --- a/src/EnergyPlus/PackagedTerminalHeatPump.hh +++ b/src/EnergyPlus/PackagedTerminalHeatPump.hh @@ -69,8 +69,8 @@ namespace PackagedTerminalHeatPump { // Data // MODULE PARAMETER DEFINITIONS // Compressor operation - extern int const On; // normal compressor operation - extern int const Off; // signal DXCoil that compressor shouldn't run + constexpr int On(1); // normal compressor operation + constexpr int Off(0); // signal DXCoil that compressor shouldn't run // Last mode of operation extern int const CoolingMode; // last compressor operating mode was in cooling diff --git a/src/EnergyPlus/SetPointManager.cc b/src/EnergyPlus/SetPointManager.cc index 586036766ca..94530e02151 100644 --- a/src/EnergyPlus/SetPointManager.cc +++ b/src/EnergyPlus/SetPointManager.cc @@ -3806,7 +3806,6 @@ namespace EnergyPlus::SetPointManager { LookForFan = true; } if (LookForFan) { - // cpw22Aug2010 Add Fan:ComponentModel (new) if (UtilityRoutines::SameString(CompType, "Fan:ConstantVolume") || UtilityRoutines::SameString(CompType, "Fan:VariableVolume") || UtilityRoutines::SameString(CompType, "Fan:OnOff") || @@ -3822,7 +3821,6 @@ namespace EnergyPlus::SetPointManager { for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) { for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { CompType = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf; - // cpw22Aug2010 Add Fan:ComponentModel (new) if (UtilityRoutines::SameString(CompType, "Fan:ConstantVolume") || UtilityRoutines::SameString(CompType, "Fan:VariableVolume") || UtilityRoutines::SameString(CompType, "Fan:OnOff") || diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index e53bb30c449..2e1a9297c32 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -68,7 +68,6 @@ #include #include #include -#include #include #include #include @@ -116,9 +115,7 @@ #include #include -namespace EnergyPlus { - -namespace SimAirServingZones { +namespace EnergyPlus::SimAirServingZones { // MODULE INFORMATION // AUTHOR: Russ Taylor, Dan Fisher, Fred Buhl @@ -143,77 +140,6 @@ namespace SimAirServingZones { using namespace DataZoneEquipment; using namespace DataAirSystems; - // Data - // MODULE PARAMETER DEFINITIONS: - // coil operation - int const CoilOn(1); // normal coil operation - int const CoilOff(0); // signal coil shouldn't run - int const BeforeBranchSim(1); - int const AfterBranchSim(2); - // CompType numerics -- for this module - // component types addressed by this module - int const OAMixer_Num(1); - int const Fan_Simple_CV(2); - int const Fan_Simple_VAV(3); - int const WaterCoil_SimpleCool(4); - int const WaterCoil_Cooling(5); - int const WaterCoil_SimpleHeat(6); - int const SteamCoil_AirHeat(7); - int const WaterCoil_DetailedCool(8); - int const Coil_ElectricHeat(9); - int const Coil_GasHeat(10); - int const WaterCoil_CoolingHXAsst(11); - int const DXCoil_CoolingHXAsst(12); - int const Coil_DeSuperHeat(13); - int const DXSystem(14); - int const HeatXchngr(15); - int const Desiccant(16); - int const Unglazed_SolarCollector(17); - int const EvapCooler(18); - int const Furnace_UnitarySys_HeatOnly(19); - int const Furnace_UnitarySys_HeatCool(20); - int const Humidifier(21); - int const Duct(22); - int const UnitarySystem_BypassVAVSys(23); - int const UnitarySystem_MSHeatPump(24); - int const Fan_ComponentModel(25); // cpw22Aug2010 (new) - int const DXHeatPumpSystem(26); - int const CoilUserDefined(27); - int const Fan_System_Object(28); - int const UnitarySystemModel(29); - int const ZoneVRFasAirLoopEquip(30); - - bool GetAirLoopInputFlag(true); // Flag set to make sure you get input once - - int NumOfTimeStepInDay; // number of zone time steps in a day - - namespace { - // These were static variables within different functions. They were pulled out into the namespace - // to facilitate easier unit testing of those functions. - // These are purposefully not in the header file as an extern variable. No one outside of this should - // use these. They are cleared by clear_state() for use by unit tests, but normal simulations should be unaffected. - // This is purposefully in an anonymous namespace so nothing outside this implementation file can use it. - bool InitAirLoopsOneTimeFlag(true); - int TestUniqueNodesNum(0); - bool SizeAirLoopsOneTimeFlag(true); - bool InitAirLoopsBranchSizingFlag(true); - bool OutputSetupFlag(false); - bool MyEnvrnFlag(true); - } // namespace - - // Functions - void clear_state() - { - GetAirLoopInputFlag = true; - InitAirLoopsOneTimeFlag = true; - SizeAirLoopsOneTimeFlag = true; - InitAirLoopsBranchSizingFlag = true; - NumOfTimeStepInDay = 0; - TestUniqueNodesNum = 0; - OutputSetupFlag = false; - MyEnvrnFlag = true; - } - void ManageAirLoops(EnergyPlusData &state, bool const FirstHVACIteration, // TRUE if first full HVAC iteration in an HVAC timestep bool &SimAir, // TRUE means air loops must be (re)simulated @@ -236,9 +162,9 @@ namespace SimAirServingZones { using MixedAir::ManageOutsideAirSystem; - if (GetAirLoopInputFlag) { // First time subroutine has been entered + if (state.dataSimAirServingZones->GetAirLoopInputFlag) { // First time subroutine has been entered GetAirPathData(state); // Get air loop descriptions from input file - GetAirLoopInputFlag = false; + state.dataSimAirServingZones->GetAirLoopInputFlag = false; } // Initialize air loop related parameters @@ -461,7 +387,7 @@ namespace SimAirServingZones { cAlphaFields = ""; lAlphaBlanks = true; - NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; + state.dataSimAirServingZones->NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; inputProcessor->getObjectDefMaxArgs(state, "NodeList", NumParams, NumAlphas, NumNumbers); NodeNums.dimension(NumParams, 0); @@ -560,13 +486,13 @@ namespace SimAirServingZones { } // work on unique nodes - test = UtilityRoutines::FindItemInList(Alphas(6), TestUniqueNodes, &AirUniqueNodes::NodeName, TestUniqueNodesNum); + test = UtilityRoutines::FindItemInList(Alphas(6), TestUniqueNodes, &AirUniqueNodes::NodeName, state.dataSimAirServingZones->TestUniqueNodesNum); if (test == 0) { - ++TestUniqueNodesNum; - TestUniqueNodes(TestUniqueNodesNum).NodeName = Alphas(6); - TestUniqueNodes(TestUniqueNodesNum).AirLoopName = Alphas(1); - TestUniqueNodes(TestUniqueNodesNum).FieldName = cAlphaFields(6); - TestUniqueNodes(TestUniqueNodesNum).NodeNameUsed = true; + ++state.dataSimAirServingZones->TestUniqueNodesNum; + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeName = Alphas(6); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).AirLoopName = Alphas(1); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).FieldName = cAlphaFields(6); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeNameUsed = true; } else { ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + Alphas(1) + "\", duplicate node name."); ShowContinueError(state, "...used for " + cAlphaFields(6) + "=\"" + Alphas(6) + "\""); @@ -575,13 +501,13 @@ namespace SimAirServingZones { ErrorsFound = true; } if (!lAlphaBlanks(7)) { - test = UtilityRoutines::FindItemInList(Alphas(7), TestUniqueNodes, &AirUniqueNodes::NodeName, TestUniqueNodesNum); + test = UtilityRoutines::FindItemInList(Alphas(7), TestUniqueNodes, &AirUniqueNodes::NodeName, state.dataSimAirServingZones->TestUniqueNodesNum); if (test == 0) { - ++TestUniqueNodesNum; - TestUniqueNodes(TestUniqueNodesNum).NodeName = Alphas(7); - TestUniqueNodes(TestUniqueNodesNum).AirLoopName = Alphas(1); - TestUniqueNodes(TestUniqueNodesNum).FieldName = cAlphaFields(7); - TestUniqueNodes(TestUniqueNodesNum).NodeNameUsed = true; + ++state.dataSimAirServingZones->TestUniqueNodesNum; + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeName = Alphas(7); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).AirLoopName = Alphas(1); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).FieldName = cAlphaFields(7); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeNameUsed = true; } else { ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + Alphas(1) + "\", duplicate node name."); ShowContinueError(state, "...used for " + cAlphaFields(7) + "=\"" + Alphas(7) + "\""); @@ -590,13 +516,13 @@ namespace SimAirServingZones { ErrorsFound = true; } } - test = UtilityRoutines::FindItemInList(Alphas(8), TestUniqueNodes, &AirUniqueNodes::NodeName, TestUniqueNodesNum); + test = UtilityRoutines::FindItemInList(Alphas(8), TestUniqueNodes, &AirUniqueNodes::NodeName, state.dataSimAirServingZones->TestUniqueNodesNum); if (test == 0) { - ++TestUniqueNodesNum; - TestUniqueNodes(TestUniqueNodesNum).NodeName = Alphas(8); - TestUniqueNodes(TestUniqueNodesNum).AirLoopName = Alphas(1); - TestUniqueNodes(TestUniqueNodesNum).FieldName = cAlphaFields(8); - TestUniqueNodes(TestUniqueNodesNum).NodeNameUsed = true; + ++state.dataSimAirServingZones->TestUniqueNodesNum; + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeName = Alphas(8); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).AirLoopName = Alphas(1); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).FieldName = cAlphaFields(8); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeNameUsed = true; } else { ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + Alphas(1) + "\", duplicate node name/list."); ShowContinueError(state, "...used for " + cAlphaFields(8) + "=\"" + Alphas(8) + "\""); @@ -604,13 +530,13 @@ namespace SimAirServingZones { TestUniqueNodes(test).FieldName); ErrorsFound = true; } - test = UtilityRoutines::FindItemInList(Alphas(9), TestUniqueNodes, &AirUniqueNodes::NodeName, TestUniqueNodesNum); + test = UtilityRoutines::FindItemInList(Alphas(9), TestUniqueNodes, &AirUniqueNodes::NodeName, state.dataSimAirServingZones->TestUniqueNodesNum); if (test == 0) { - ++TestUniqueNodesNum; - TestUniqueNodes(TestUniqueNodesNum).NodeName = Alphas(9); - TestUniqueNodes(TestUniqueNodesNum).AirLoopName = Alphas(1); - TestUniqueNodes(TestUniqueNodesNum).FieldName = cAlphaFields(9); - TestUniqueNodes(TestUniqueNodesNum).NodeNameUsed = true; + ++state.dataSimAirServingZones->TestUniqueNodesNum; + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeName = Alphas(9); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).AirLoopName = Alphas(1); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).FieldName = cAlphaFields(9); + TestUniqueNodes(state.dataSimAirServingZones->TestUniqueNodesNum).NodeNameUsed = true; } else { ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + Alphas(1) + "\", duplicate node name/list."); ShowContinueError(state, "...used for " + cAlphaFields(9) + "=\"" + Alphas(9) + "\""); @@ -921,7 +847,7 @@ namespace SimAirServingZones { SplitterExists = false; MixerExists = false; - if (ConnectorListName != "") { + if (ConnectorListName != std::string()) { ConListNum = inputProcessor->getObjectItemNum(state, "ConnectorList", ConnectorListName); if (ConListNum > 0) { inputProcessor->getObjectItem(state, "ConnectorList", ConListNum, Alphas, NumAlphas, Numbers, NumNumbers, IOStat); @@ -1065,7 +991,7 @@ namespace SimAirServingZones { } NumControllers = 0; - if (ControllerListName != "") { // If not blank, then must be there and valid + if (ControllerListName != std::string()) { // If not blank, then must be there and valid // Loop through the controller lists until you find the one attached to this primary air system ControllerListNum = inputProcessor->getObjectItemNum(state, "AirLoopHVAC:ControllerList", ControllerListName); if (ControllerListNum > 0) { @@ -1228,7 +1154,6 @@ namespace SimAirServingZones { state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).Branch(BranchNum).Comp(CompNum).CompIndex = HVACFan::getFanObjectVectorIndex(state, state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).Branch(BranchNum).Comp(CompNum).Name) + 1; // + 1 for shift from zero-based vector to 1-based compIndex - // cpw22Aug2010 Add Fan_ComponentModel type (new num=24) HVACFan::fanObjs[HVACFan::getFanObjectVectorIndex(state, state.dataAirSystemsData->PrimaryAirSystems(AirSysNum).Branch(BranchNum).Comp(CompNum).Name)] ->AirPathFlag = true; } else if (componentType == "FAN:COMPONENTMODEL") { @@ -1528,7 +1453,7 @@ namespace SimAirServingZones { AirLoopInit = true; // Do the one time initializations - if (InitAirLoopsOneTimeFlag) { + if (state.dataSimAirServingZones->InitAirLoopsOneTimeFlag) { // Figure out what zones are served by each primary air system (air loop) and // store the results in state.dataAirLoop->AirToZoneNodeInfo()%CoolCtrlZoneNums and state.dataAirLoop->AirToZoneNodeInfo()%HeatCtrlZoneNums @@ -1975,7 +1900,7 @@ namespace SimAirServingZones { // now connect return nodes with airloops and corresponding inlet nodes ConnectReturnNodes(state); - InitAirLoopsOneTimeFlag = false; + state.dataSimAirServingZones->InitAirLoopsOneTimeFlag = false; CtrlZoneNumsCool.deallocate(); CtrlZoneNumsHeat.deallocate(); @@ -2138,7 +2063,7 @@ namespace SimAirServingZones { } // one time flag // Size the air loop branch air flows - if (!state.dataGlobal->SysSizingCalc && InitAirLoopsBranchSizingFlag) { + if (!state.dataGlobal->SysSizingCalc && state.dataSimAirServingZones->InitAirLoopsBranchSizingFlag) { for (AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { @@ -2147,7 +2072,7 @@ namespace SimAirServingZones { } } - InitAirLoopsBranchSizingFlag = false; + state.dataSimAirServingZones->InitAirLoopsBranchSizingFlag = false; // calculate the ratio of air loop design flow to the sum of the zone design flows for (AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { @@ -2167,7 +2092,7 @@ namespace SimAirServingZones { } // Do the Begin Environment initializations - if (state.dataGlobal->BeginEnvrnFlag && FirstHVACIteration && MyEnvrnFlag) { + if (state.dataGlobal->BeginEnvrnFlag && FirstHVACIteration && state.dataSimAirServingZones->MyEnvrnFlag) { if (NumPrimaryAirSys > 0) { for (auto &e : state.dataAirLoop->PriAirSysAvailMgr) { @@ -2211,12 +2136,12 @@ namespace SimAirServingZones { } // end of loop through branches in system } // end of loop over primary air systems - MyEnvrnFlag = false; + state.dataSimAirServingZones->MyEnvrnFlag = false; } // End the environment initializations if (!state.dataGlobal->BeginEnvrnFlag) { - MyEnvrnFlag = true; + state.dataSimAirServingZones->MyEnvrnFlag = true; } // Do the Begin Day initializations @@ -2501,11 +2426,11 @@ namespace SimAirServingZones { // FLOW: // Set up output variables - if (!OutputSetupFlag) { + if (!state.dataSimAirServingZones->OutputSetupFlag) { SetupOutputVariable(state, "Air System Simulation Maximum Iteration Count", OutputProcessor::Unit::None, IterMax, "HVAC", "Sum", "SimAir"); SetupOutputVariable(state, "Air System Simulation Iteration Count", OutputProcessor::Unit::None, IterTot, "HVAC", "Sum", "SimAir"); SetupOutputVariable(state, "Air System Component Model Simulation Calls", OutputProcessor::Unit::None, NumCallsTot, "HVAC", "Sum", "SimAir"); - OutputSetupFlag = true; + state.dataSimAirServingZones->OutputSetupFlag = true; } // BUG: IterMax should not be aggregated as a Sum output variable @@ -3557,7 +3482,6 @@ namespace SimAirServingZones { DataHVACGlobals::OnOffFanPartLoadFraction = 1.0; HVACFan::fanObjs[CompIndex - 1]->simulate(state, _, _, _, _); // vector is 0 based, but CompIndex is 1 based so shift - // cpw22Aug2010 Add Fan:ComponentModel (new) } else if (SELECT_CASE_var == Fan_ComponentModel) { // 'Fan:ComponentModel' Fans::SimulateFanComponents(state, CompName, FirstHVACIteration, CompIndex); @@ -3669,8 +3593,8 @@ namespace SimAirServingZones { // Ducts } else if (SELECT_CASE_var == ZoneVRFasAirLoopEquip) { // 'ZoneHVAC:TerminalUnit:VariableRefrigerantFlow' int ControlledZoneNum = 0; - int const OAUnitNum = 0; - Real64 const OAUCoilOutTemp = 0.0; + int const OAUnitNumLocal = 0; + Real64 const OAUCoilOutTempLocal = 0.0; bool const ZoneEquipment = false; Real64 sysOut = 0.0; Real64 latOut = 0.0; @@ -3681,8 +3605,8 @@ namespace SimAirServingZones { CompIndex, HeatingActive, CoolingActive, - OAUnitNum, - OAUCoilOutTemp, + OAUnitNumLocal, + OAUCoilOutTempLocal, ZoneEquipment, sysOut, latOut); @@ -4031,33 +3955,9 @@ namespace SimAirServingZones { // central plant flow rates. Right now just uses one time flag to call // SetUpSysSizingArrays. - // REFERENCES: - // na - - // USE STATEMENTS: - // none - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - /////////// hoisted into namespace SizeAirLoopsOneTimeFlag - // static bool MyOneTimeFlag( true ); - /////////////////////////// - - if (SizeAirLoopsOneTimeFlag) { + if (state.dataSimAirServingZones->SizeAirLoopsOneTimeFlag) { SetUpSysSizingArrays(state); - SizeAirLoopsOneTimeFlag = false; + state.dataSimAirServingZones->SizeAirLoopsOneTimeFlag = false; } } @@ -4319,26 +4219,26 @@ namespace SimAirServingZones { SysSizing(DesDayEnvrnNum, AirLoopNum).MaxZoneOAFraction = SysSizInput(1).MaxZoneOAFraction; SysSizing(DesDayEnvrnNum, AirLoopNum).OAAutoSized = SysSizInput(1).OAAutoSized; } - SysSizing(DesDayEnvrnNum, AirLoopNum).HeatFlowSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SumZoneHeatLoadSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).CoolFlowSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SumZoneCoolLoadSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).CoolZoneAvgTempSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).HeatZoneAvgTempSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SensCoolCapSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).TotCoolCapSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).HeatCapSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).PreheatCapSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolRetTempSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolRetHumRatSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatRetTempSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatRetHumRatSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolOutTempSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolOutHumRatSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatOutTempSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatOutHumRatSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysDOASHeatAddSeq.dimension(NumOfTimeStepInDay, 0.0); - SysSizing(DesDayEnvrnNum, AirLoopNum).SysDOASLatAddSeq.dimension(NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).HeatFlowSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SumZoneHeatLoadSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).CoolFlowSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SumZoneCoolLoadSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).CoolZoneAvgTempSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).HeatZoneAvgTempSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SensCoolCapSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).TotCoolCapSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).HeatCapSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).PreheatCapSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolRetTempSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolRetHumRatSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatRetTempSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatRetHumRatSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolOutTempSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysCoolOutHumRatSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatOutTempSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysHeatOutHumRatSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysDOASHeatAddSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); + SysSizing(DesDayEnvrnNum, AirLoopNum).SysDOASLatAddSeq.dimension(state.dataSimAirServingZones->NumOfTimeStepInDay, 0.0); } // end the primary air system loop } @@ -4527,26 +4427,26 @@ namespace SimAirServingZones { CalcSysSizing(AirLoopNum).FlowPerCoolingCapacity = SysSizInput(1).FlowPerCoolingCapacity; CalcSysSizing(AirLoopNum).FlowPerHeatingCapacity = SysSizInput(1).FlowPerHeatingCapacity; } - FinalSysSizing(AirLoopNum).HeatFlowSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SumZoneHeatLoadSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).CoolFlowSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SumZoneCoolLoadSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).CoolZoneAvgTempSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).HeatZoneAvgTempSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SensCoolCapSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).TotCoolCapSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).HeatCapSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).PreheatCapSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysCoolRetTempSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysCoolRetHumRatSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysHeatRetTempSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysHeatRetHumRatSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysCoolOutTempSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysCoolOutHumRatSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysHeatOutTempSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysHeatOutHumRatSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysDOASHeatAddSeq.allocate(NumOfTimeStepInDay); - FinalSysSizing(AirLoopNum).SysDOASLatAddSeq.allocate(NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).HeatFlowSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SumZoneHeatLoadSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).CoolFlowSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SumZoneCoolLoadSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).CoolZoneAvgTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).HeatZoneAvgTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SensCoolCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).TotCoolCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).HeatCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).PreheatCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysCoolRetTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysCoolRetHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysHeatRetTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysHeatRetHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysCoolOutTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysCoolOutHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysHeatOutTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysHeatOutHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysDOASHeatAddSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + FinalSysSizing(AirLoopNum).SysDOASLatAddSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); FinalSysSizing(AirLoopNum).HeatFlowSeq = 0.0; FinalSysSizing(AirLoopNum).SumZoneHeatLoadSeq = 0.0; FinalSysSizing(AirLoopNum).CoolFlowSeq = 0.0; @@ -4569,26 +4469,26 @@ namespace SimAirServingZones { FinalSysSizing(AirLoopNum).SysDOASLatAddSeq = 0.0; FinalSysSizing(AirLoopNum).FloorAreaOnAirLoopCooled = 0.0; FinalSysSizing(AirLoopNum).FloorAreaOnAirLoopHeated = 0.0; - CalcSysSizing(AirLoopNum).HeatFlowSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SumZoneHeatLoadSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).CoolFlowSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SumZoneCoolLoadSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).CoolZoneAvgTempSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).HeatZoneAvgTempSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SensCoolCapSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).TotCoolCapSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).HeatCapSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).PreheatCapSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysCoolRetTempSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysCoolRetHumRatSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysHeatRetTempSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysHeatRetHumRatSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysCoolOutTempSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysCoolOutHumRatSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysHeatOutTempSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysHeatOutHumRatSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysDOASHeatAddSeq.allocate(NumOfTimeStepInDay); - CalcSysSizing(AirLoopNum).SysDOASLatAddSeq.allocate(NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).HeatFlowSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SumZoneHeatLoadSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).CoolFlowSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SumZoneCoolLoadSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).CoolZoneAvgTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).HeatZoneAvgTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SensCoolCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).TotCoolCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).HeatCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).PreheatCapSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysCoolRetTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysCoolRetHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysHeatRetTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysHeatRetHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysCoolOutTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysCoolOutHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysHeatOutTempSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysHeatOutHumRatSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysDOASHeatAddSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); + CalcSysSizing(AirLoopNum).SysDOASLatAddSeq.allocate(state.dataSimAirServingZones->NumOfTimeStepInDay); CalcSysSizing(AirLoopNum).HeatFlowSeq = 0.0; CalcSysSizing(AirLoopNum).SumZoneHeatLoadSeq = 0.0; CalcSysSizing(AirLoopNum).CoolFlowSeq = 0.0; @@ -5267,7 +5167,7 @@ namespace SimAirServingZones { using namespace DataSizing; // Locals - int NumOfTimeStepInDay; // number of zone time steps in a day + int numOfTimeStepInDay; // number of zone time steps in a day // SUBROUTINE ARGUMENT DEFINITIONS: @@ -5344,7 +5244,7 @@ namespace SimAirServingZones { Real64 termunitsizingtemp; // (1.0+termunitsizing(ctrlzone)%inducrat) Real64 VozClg(0.0); // corrected (for ventilation efficiency) zone outside air flow rate [m3/s] - NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; + numOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; // allocate scratch arrays if (!allocated(SensCoolCapTemp)) { @@ -5885,10 +5785,10 @@ namespace SimAirServingZones { Xs = 0.0; } if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizing(CurOverallSimDay, AirLoopNum).DesCoolVolFlow > 0) { - int NumZonesCooled = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; + int numZonesCooled = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; MinCoolingEvz = 1.0; VozSumClgBySys(AirLoopNum) = 0.0; - for (int ZonesCooledNum = 1; ZonesCooledNum <= NumZonesCooled; ++ZonesCooledNum) { + for (int ZonesCooledNum = 1; ZonesCooledNum <= numZonesCooled; ++ZonesCooledNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex(ZonesCooledNum); // Zone air secondary recirculation fraction @@ -5939,7 +5839,7 @@ namespace SimAirServingZones { EvzMinBySysCool(AirLoopNum) = MinCoolingEvz; } else { // Restore EvzByZoneCool() since it was reset by the current (but not highest Vot) design day - for (int ZonesCooledNum = 1; ZonesCooledNum <= NumZonesCooled; ++ZonesCooledNum) { + for (int ZonesCooledNum = 1; ZonesCooledNum <= numZonesCooled; ++ZonesCooledNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex(ZonesCooledNum); EvzByZoneCool(TermUnitSizingIndex) = EvzByZoneCoolPrev(TermUnitSizingIndex); } @@ -5989,11 +5889,11 @@ namespace SimAirServingZones { } if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizing(CurOverallSimDay, AirLoopNum).DesHeatVolFlow > 0) { - int NumZonesHeated = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; + int numZonesHeated = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; MinHeatingEvz = 1.0; VozSumHtgBySys(AirLoopNum) = 0.0; - if (NumZonesHeated > 0) { - for (int ZonesHeatedNum = 1; ZonesHeatedNum <= NumZonesHeated; ++ZonesHeatedNum) { + if (numZonesHeated > 0) { + for (int ZonesHeatedNum = 1; ZonesHeatedNum <= numZonesHeated; ++ZonesHeatedNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitHeatSizingIndex(ZonesHeatedNum); MatchingCooledZoneNum = FindNumberInList( TermUnitSizingIndex, state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex, NumZonesCooled); @@ -6081,8 +5981,8 @@ namespace SimAirServingZones { } else { // Restore EvzByZoneHeat() since it was reset by the current (but not highest Vot) design day // This kludge is probably because inside EndDay block and code gets called for each design day. - if (NumZonesHeated > 0) { - for (int ZonesHeatedNum = 1; ZonesHeatedNum <= NumZonesHeated; ++ZonesHeatedNum) { + if (numZonesHeated > 0) { + for (int ZonesHeatedNum = 1; ZonesHeatedNum <= numZonesHeated; ++ZonesHeatedNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitHeatSizingIndex(ZonesHeatedNum); EvzByZoneHeat(TermUnitSizingIndex) = EvzByZoneHeatPrev(TermUnitSizingIndex); } @@ -6152,10 +6052,10 @@ namespace SimAirServingZones { Xs = 0.0; } if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizing(CurOverallSimDay, AirLoopNum).DesCoolVolFlow > 0) { - int NumZonesCooled = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; + int numZonesCooled = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; MinCoolingEvz = 1.0; VozSumClgBySys(AirLoopNum) = 0.0; - for (int ZonesCooledNum = 1; ZonesCooledNum <= NumZonesCooled; ++ZonesCooledNum) { + for (int ZonesCooledNum = 1; ZonesCooledNum <= numZonesCooled; ++ZonesCooledNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex(ZonesCooledNum); // Zone air secondary recirculation fraction @@ -6206,7 +6106,7 @@ namespace SimAirServingZones { EvzMinBySysCool(AirLoopNum) = MinCoolingEvz; } else { // Restore EvzByZoneCool() since it was reset by the current (but not highest Vot) design day - for (int ZonesCooledNum = 1; ZonesCooledNum <= NumZonesCooled; ++ZonesCooledNum) { + for (int ZonesCooledNum = 1; ZonesCooledNum <= numZonesCooled; ++ZonesCooledNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex(ZonesCooledNum); EvzByZoneCool(TermUnitSizingIndex) = EvzByZoneCoolPrev(TermUnitSizingIndex); } @@ -6231,11 +6131,11 @@ namespace SimAirServingZones { Xs = 0.0; } if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizing(CurOverallSimDay, AirLoopNum).DesHeatVolFlow > 0) { - int NumZonesHeated = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; + int numZonesHeated = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; MinHeatingEvz = 1.0; VozSumHtgBySys(AirLoopNum) = 0.0; - if (NumZonesHeated > 0) { - for (int ZonesHeatedNum = 1; ZonesHeatedNum <= NumZonesHeated; ++ZonesHeatedNum) { + if (numZonesHeated > 0) { + for (int ZonesHeatedNum = 1; ZonesHeatedNum <= numZonesHeated; ++ZonesHeatedNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitHeatSizingIndex(ZonesHeatedNum); MatchingCooledZoneNum = FindNumberInList( TermUnitSizingIndex, state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex, NumZonesCooled); @@ -6269,8 +6169,8 @@ namespace SimAirServingZones { VozSumHtgBySys(AirLoopNum) += TermUnitFinalZoneSizing(TermUnitSizingIndex).VozHtgByZone; } } else { - int NumZonesCooled = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; - for (int ZonesHeatedNum = 1; ZonesHeatedNum <= NumZonesCooled; ++ZonesHeatedNum) { + int numZonesCooled = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; + for (int ZonesHeatedNum = 1; ZonesHeatedNum <= numZonesCooled; ++ZonesHeatedNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex(ZonesHeatedNum); // Zone air secondary recirculation fraction Er = TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneSecondaryRecirculation; @@ -6316,8 +6216,8 @@ namespace SimAirServingZones { } else { // Restore EvzByZoneHeat() since it was just reset by the current (but not highest Vot) design day // This kludge is probably because inside EndDay block and code gets called for each design day. - if (NumZonesHeated > 0) { - for (int ZonesHeatedNum = 1; ZonesHeatedNum <= NumZonesHeated; ++ZonesHeatedNum) { + if (numZonesHeated > 0) { + for (int ZonesHeatedNum = 1; ZonesHeatedNum <= numZonesHeated; ++ZonesHeatedNum) { int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitHeatSizingIndex(ZonesHeatedNum); EvzByZoneHeat(TermUnitSizingIndex) = EvzByZoneHeatPrev(TermUnitSizingIndex); } @@ -6402,7 +6302,7 @@ namespace SimAirServingZones { TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneRetTempAtHeatPeak = TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneTempAtHeatPeak + RetTempRise * termunitsizingtempfrac; } - for (TimeStepIndex = 1; TimeStepIndex <= NumOfTimeStepInDay; ++TimeStepIndex) { + for (TimeStepIndex = 1; TimeStepIndex <= numOfTimeStepInDay; ++TimeStepIndex) { RetTempRise = TermUnitFinalZoneSizing(TermUnitSizingIndex).CoolZoneRetTempSeq(TimeStepIndex) - TermUnitFinalZoneSizing(TermUnitSizingIndex).CoolZoneTempSeq(TimeStepIndex); if (RetTempRise > 0.01) { @@ -6777,7 +6677,7 @@ namespace SimAirServingZones { } for (AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { - for (TimeStepIndex = 1; TimeStepIndex <= NumOfTimeStepInDay; ++TimeStepIndex) { + for (TimeStepIndex = 1; TimeStepIndex <= numOfTimeStepInDay; ++TimeStepIndex) { FinalSysSizing(AirLoopNum).HeatFlowSeq(TimeStepIndex) = CalcSysSizing(AirLoopNum).HeatFlowSeq(TimeStepIndex); FinalSysSizing(AirLoopNum).CoolFlowSeq(TimeStepIndex) = CalcSysSizing(AirLoopNum).CoolFlowSeq(TimeStepIndex); FinalSysSizing(AirLoopNum).SumZoneCoolLoadSeq(TimeStepIndex) = CalcSysSizing(AirLoopNum).SumZoneCoolLoadSeq(TimeStepIndex); @@ -6860,7 +6760,7 @@ namespace SimAirServingZones { if (FinalSysSizing(AirLoopNum).DesCoolVolFlow > 0.0) { - for (TimeStepIndex = 1; TimeStepIndex <= NumOfTimeStepInDay; ++TimeStepIndex) { + for (TimeStepIndex = 1; TimeStepIndex <= numOfTimeStepInDay; ++TimeStepIndex) { if (CalcSysSizing(AirLoopNum).CoolFlowSeq(TimeStepIndex) > 0.0) { @@ -6941,7 +6841,7 @@ namespace SimAirServingZones { if (FinalSysSizing(AirLoopNum).DesHeatVolFlow > 0.0) { - for (TimeStepIndex = 1; TimeStepIndex <= NumOfTimeStepInDay; ++TimeStepIndex) { + for (TimeStepIndex = 1; TimeStepIndex <= numOfTimeStepInDay; ++TimeStepIndex) { if (CalcSysSizing(AirLoopNum).HeatFlowSeq(TimeStepIndex) > 0.0) { @@ -7591,7 +7491,7 @@ namespace SimAirServingZones { } void CheckWaterCoilIsOnAirLoop( - EnergyPlusData &state, int const CompTypeNum, std::string const CompType, std::string const CompName, bool &WaterCoilOnAirLoop) + EnergyPlusData &state, int const CompTypeNum, std::string const &CompType, std::string const &CompName, bool &WaterCoilOnAirLoop) { // PURPOSE OF THIS FUNCTION: // This function returns true if a water coil that has water controller is either on @@ -7617,16 +7517,16 @@ namespace SimAirServingZones { WaterCoilOnAirLoop = CheckWaterCoilIsOnAirLoop; } - bool CheckWaterCoilOnPrimaryAirLoopBranch(EnergyPlusData &state, int const CompTypeNum, std::string const CompName) + bool CheckWaterCoilOnPrimaryAirLoopBranch(EnergyPlusData &state, int const CompTypeNum, std::string const &CompName) { // PURPOSE OF THIS FUNCTION: // This function returns true if a water coil that has water controller is on // primary air loop branch. Searches for water coil name and type that match // components list in primary air systems. - if (GetAirLoopInputFlag) { // First time subroutine has been entered + if (state.dataSimAirServingZones->GetAirLoopInputFlag) { // First time subroutine has been entered GetAirPathData(state); // Get air loop descriptions from input file - GetAirLoopInputFlag = false; + state.dataSimAirServingZones->GetAirLoopInputFlag = false; } if (DataHVACGlobals::NumPrimaryAirSys > 0) { @@ -7644,7 +7544,7 @@ namespace SimAirServingZones { return false; } - bool CheckWaterCoilOnOASystem(EnergyPlusData &state, int const CompTypeNum, std::string const CompName) + bool CheckWaterCoilOnOASystem(EnergyPlusData &state, int const CompTypeNum, std::string const &CompName) { // PURPOSE OF THIS FUNCTION: // This function returns true if a water coil that has water controller is on @@ -7674,10 +7574,10 @@ namespace SimAirServingZones { return false; } - bool CheckWaterCoilSystemOnAirLoopOrOASystem(EnergyPlusData &state, int const CompTypeNum, std::string const CompName) + bool CheckWaterCoilSystemOnAirLoopOrOASystem(EnergyPlusData &state, int const CompTypeNum, std::string const &CompName) { // PURPOSE OF THIS FUNCTION: - // This function returns true if a water coil whcih is part of CoilSystem:Cooling:Water:HeatExchangerAssisted + // This function returns true if a water coil which is part of CoilSystem:Cooling:Water:HeatExchangerAssisted // and that has water controller is on primary air loop branch or outdoor air system. Searches for water coilsystem // type and name that match components list in primary air loop or outside air systems. @@ -7811,6 +7711,4 @@ namespace SimAirServingZones { // End of Utility subroutines for the SimAir Module // ***************************************************************************** -} // namespace SimAirServingZones - } // namespace EnergyPlus diff --git a/src/EnergyPlus/SimAirServingZones.hh b/src/EnergyPlus/SimAirServingZones.hh index 89e174ec84a..048fb6997f7 100644 --- a/src/EnergyPlus/SimAirServingZones.hh +++ b/src/EnergyPlus/SimAirServingZones.hh @@ -64,50 +64,45 @@ struct EnergyPlusData; namespace SimAirServingZones { - // Data - // MODULE PARAMETER DEFINITIONS: // coil operation - extern int const CoilOn; // normal coil operation - extern int const CoilOff; // signal coil shouldn't run - extern int const BeforeBranchSim; - extern int const AfterBranchSim; + constexpr int CoilOn(1); // normal coil operation + constexpr int CoilOff(0); // signal coil shouldn't run + + constexpr int BeforeBranchSim(1); + constexpr int AfterBranchSim(2); + // CompType numerics -- for this module // component types addressed by this module - extern int const OAMixer_Num; - extern int const Fan_Simple_CV; - extern int const Fan_Simple_VAV; - extern int const Fan_System_Object; - extern int const WaterCoil_SimpleCool; - extern int const WaterCoil_Cooling; - extern int const WaterCoil_SimpleHeat; - extern int const SteamCoil_AirHeat; - extern int const WaterCoil_DetailedCool; - extern int const Coil_ElectricHeat; - extern int const Coil_GasHeat; - extern int const WaterCoil_CoolingHXAsst; - extern int const DXCoil_CoolingHXAsst; - extern int const Coil_DeSuperHeat; - extern int const DXSystem; - extern int const HeatXchngr; - extern int const Desiccant; - extern int const Unglazed_SolarCollector; - extern int const EvapCooler; - extern int const Furnace_UnitarySys_HeatOnly; - extern int const Furnace_UnitarySys_HeatCool; - extern int const Humidifier; - extern int const Duct; - extern int const UnitarySystem_BypassVAVSys; - extern int const UnitarySystem_MSHeatPump; - extern int const Fan_ComponentModel; // cpw22Aug2010 (new) - extern int const DXHeatPumpSystem; - extern int const CoilUserDefined; - extern int const UnitarySystemModel; - extern int const ZoneVRFasAirLoopEquip; - - extern bool GetAirLoopInputFlag; // Flag set to make sure you get input once - extern int NumOfTimeStepInDay; // number of zone time steps in a day - - void clear_state(); + constexpr int OAMixer_Num(1); + constexpr int Fan_Simple_CV(2); + constexpr int Fan_Simple_VAV(3); + constexpr int WaterCoil_SimpleCool(4); + constexpr int WaterCoil_Cooling(5); + constexpr int WaterCoil_SimpleHeat(6); + constexpr int SteamCoil_AirHeat(7); + constexpr int WaterCoil_DetailedCool(8); + constexpr int Coil_ElectricHeat(9); + constexpr int Coil_GasHeat(10); + constexpr int WaterCoil_CoolingHXAsst(11); + constexpr int DXCoil_CoolingHXAsst(12); + constexpr int Coil_DeSuperHeat(13); + constexpr int DXSystem(14); + constexpr int HeatXchngr(15); + constexpr int Desiccant(16); + constexpr int Unglazed_SolarCollector(17); + constexpr int EvapCooler(18); + constexpr int Furnace_UnitarySys_HeatOnly(19); + constexpr int Furnace_UnitarySys_HeatCool(20); + constexpr int Humidifier(21); + constexpr int Duct(22); + constexpr int UnitarySystem_BypassVAVSys(23); + constexpr int UnitarySystem_MSHeatPump(24); + constexpr int Fan_ComponentModel(25); + constexpr int DXHeatPumpSystem(26); + constexpr int CoilUserDefined(27); + constexpr int Fan_System_Object(28); + constexpr int UnitarySystemModel(29); + constexpr int ZoneVRFasAirLoopEquip(30); void ManageAirLoops(EnergyPlusData &state, bool FirstHVACIteration, // TRUE if first full HVAC iteration in an HVAC timestep bool &SimAir, // TRUE means air loops must be (re)simulated @@ -184,21 +179,37 @@ namespace SimAirServingZones { Real64 &SystemCoolingEv // system ventilation efficiency ); - void CheckWaterCoilIsOnAirLoop(EnergyPlusData &state, int CoilTypeNum, std::string CompType, std::string CompName, bool &WaterCoilOnAirLoop); + void CheckWaterCoilIsOnAirLoop(EnergyPlusData &state, int CoilTypeNum, std::string const &CompType, std::string const &CompName, bool &WaterCoilOnAirLoop); - bool CheckWaterCoilOnPrimaryAirLoopBranch(EnergyPlusData &state, int CoilTypeNum, std::string CompName); + bool CheckWaterCoilOnPrimaryAirLoopBranch(EnergyPlusData &state, int CoilTypeNum, std::string const &CompName); - bool CheckWaterCoilOnOASystem(EnergyPlusData &state, int CoilTypeNum, std::string CompName); + bool CheckWaterCoilOnOASystem(EnergyPlusData &state, int CoilTypeNum, std::string const &CompName); - bool CheckWaterCoilSystemOnAirLoopOrOASystem(EnergyPlusData &state, int CoilTypeNum, std::string CompName); + bool CheckWaterCoilSystemOnAirLoopOrOASystem(EnergyPlusData &state, int CoilTypeNum, std::string const &CompName); } // namespace SimAirServingZones struct SimAirServingZonesData : BaseGlobalStruct { + bool GetAirLoopInputFlag = true; // Flag set to make sure you get input once + int NumOfTimeStepInDay = 0; // number of zone time steps in a day + bool InitAirLoopsOneTimeFlag = true; + int TestUniqueNodesNum = 0; + bool SizeAirLoopsOneTimeFlag = true; + bool InitAirLoopsBranchSizingFlag = true; + bool OutputSetupFlag = false; + bool MyEnvrnFlag = true; + void clear_state() override { - + this->GetAirLoopInputFlag = true; + this->NumOfTimeStepInDay = 0; + this->InitAirLoopsOneTimeFlag = true; + this->TestUniqueNodesNum = 0; + this->SizeAirLoopsOneTimeFlag = true; + this->InitAirLoopsBranchSizingFlag = true; + this->OutputSetupFlag = false; + this->MyEnvrnFlag = true; } }; diff --git a/src/EnergyPlus/StateManagement.cc b/src/EnergyPlus/StateManagement.cc index a3f8a89dc0f..593b4de7207 100644 --- a/src/EnergyPlus/StateManagement.cc +++ b/src/EnergyPlus/StateManagement.cc @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -81,7 +80,6 @@ #include #include #include -#include #include #include #include @@ -112,7 +110,6 @@ #include #include #include -#include #include #include #include @@ -172,7 +169,6 @@ #include #include #include -#include void EnergyPlus::clearAllStates(EnergyPlusData &state) { @@ -209,10 +205,8 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) DesiccantDehumidifiers::clear_state(); DisplacementVentMgr::clear_state(); DualDuct::clear_state(); - DXCoils::clear_state(); clearFacilityElectricPowerServiceObject(); EarthTube::clear_state(); - EconomicLifeCycleCost::clear_state(); ElectricBaseboardRadiator::clear_state(); EvaporativeCoolers::clear_state(); EvaporativeFluidCoolers::clear_state(); @@ -254,7 +248,6 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) HVACSingleDuctInduc::clear_state(); HVACStandAloneERV::clear_state(); HVACUnitaryBypassVAV::clear_state(); - HVACVariableRefrigerantFlow::clear_state(); HybridModel::clear_state(); HybridUnitaryAirConditioners::clear_state(); HysteresisPhaseChange::clear_state(); @@ -303,6 +296,5 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) RoomAirModelUserTempPattern::clear_state(); RuntimeLanguageProcessor::clear_state(); ScheduleManager::clear_state(); - SimAirServingZones::clear_state(); ResultsFramework::clear_state(); } diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 83e359fec67..8e3a352beac 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -4426,7 +4426,7 @@ namespace UnitarySystems { errorsFound = true; } if (state.dataGlobal->DoCoilDirectSolutions && thisSys.m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) { - DXCoils::DisableLatentDegradation(thisSys.m_CoolingCoilIndex); + DXCoils::DisableLatentDegradation(state, thisSys.m_CoolingCoilIndex); } thisSys.m_CoolingCoilAvailSchPtr = @@ -6772,10 +6772,10 @@ namespace UnitarySystems { "Unitary System Heat Recovery Nodes"); if (thisSys.m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) { - DXCoils::SetMSHPDXCoilHeatRecoveryFlag(thisSys.m_CoolingCoilIndex); + DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisSys.m_CoolingCoilIndex); } if (thisSys.m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) { - DXCoils::SetMSHPDXCoilHeatRecoveryFlag(thisSys.m_HeatingCoilIndex); + DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisSys.m_HeatingCoilIndex); } if (errFlag) { ShowContinueError(state, "Occurs in " + cCurrentModuleObject + " = " + thisObjectName); @@ -6829,7 +6829,7 @@ namespace UnitarySystems { thisSys.m_MSCoolingSpeedRatio.resize(thisSys.m_NumOfSpeedCooling + 1); if (state.dataGlobal->DoCoilDirectSolutions && thisSys.m_NumOfSpeedCooling > thisSys.m_NumOfSpeedHeating) { thisSys.FullOutput.resize(thisSys.m_NumOfSpeedCooling + 1); - DXCoils::DisableLatentDegradation(thisSys.m_CoolingCoilIndex); + DXCoils::DisableLatentDegradation(state, thisSys.m_CoolingCoilIndex); } for (int i = 1; i <= thisSys.m_NumOfSpeedCooling; ++i) { thisSys.m_CoolMassFlowRate[i] = 0.0; @@ -11531,7 +11531,7 @@ namespace UnitarySystems { for (SpeedNum = 1; SpeedNum <= this->m_NumOfSpeedCooling; ++SpeedNum) { SpeedRatio = double(SpeedNum) - 1.0; DXCoils::SimDXCoilMultiSpeed(state, CompName, SpeedRatio, CycRatio, this->m_CoolingCoilIndex); - OutletTemp = DXCoils::DXCoilOutletTemp(this->m_CoolingCoilIndex); + OutletTemp = state.dataDXCoils->DXCoilOutletTemp(this->m_CoolingCoilIndex); if (OutletTemp < DesOutTemp && SensibleLoad) break; // this isn't going to work IF dehumidIFying } @@ -12031,8 +12031,8 @@ namespace UnitarySystems { if (FullOutput >= 0) { PartLoadFrac = 0.0; } else { - OutletTempDXCoil = DXCoils::DXCoilOutletTemp(this->m_CoolingCoilIndex); - OutletHumRatDXCoil = DXCoils::DXCoilOutletHumRat(this->m_CoolingCoilIndex); + OutletTempDXCoil = state.dataDXCoils->DXCoilOutletTemp(this->m_CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex); // If sensible load and setpoint cannot be met, set PLR = 1. if no sensible load and // latent load exists and setpoint cannot be met, set PLR = 1. // why is our logic different? Did we figure something out that reduced the logic? @@ -12250,7 +12250,7 @@ namespace UnitarySystems { // Simulate MultiSpeed DX coil at sensible result DXCoils::SimDXCoilMultiSpeed(state, CompName, SpeedRatio, CycRatio, this->m_CoolingCoilIndex); - OutletHumRatDXCoil = DXCoils::DXCoilOutletHumRat(this->m_CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex); // IF humidity setpoint is not satisfied and humidity control type is CoolReheat, // then overcool to meet moisture load @@ -12260,11 +12260,11 @@ namespace UnitarySystems { SpeedRatio = 0.0; DXCoils::SimDXCoilMultiSpeed(state, CompName, 0.0, 1.0, this->m_CoolingCoilIndex); - OutletHumRatLS = DXCoils::DXCoilOutletHumRat(this->m_CoolingCoilIndex); + OutletHumRatLS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex); if (OutletHumRatLS > DesOutHumRat) { CycRatio = 1.0; DXCoils::SimDXCoilMultiSpeed(state, CompName, 1.0, 1.0, this->m_CoolingCoilIndex); - OutletHumRatHS = DXCoils::DXCoilOutletHumRat(this->m_CoolingCoilIndex); + OutletHumRatHS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex); if (OutletHumRatHS < DesOutHumRat) { Par[1] = double(this->m_CoolingCoilIndex); Par[2] = DesOutHumRat; @@ -12285,7 +12285,7 @@ namespace UnitarySystems { } else if (CoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) { DXCoils::SimDXCoilMultiSpeed(state, CompName, SpeedRatio, CycRatio, this->m_CoolingCoilIndex); - OutletHumRatDXCoil = DXCoils::DXCoilOutletHumRat(this->m_CoolingCoilIndex); + OutletHumRatDXCoil = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex); // IF humidity setpoint is not satisfied and humidity control type is CoolReheat, // then overcool to meet moisture load @@ -12296,11 +12296,11 @@ namespace UnitarySystems { SpeedRatio = 0.0; DXCoils::SimDXCoilMultiSpeed(state, CompName, 0.0, 1.0, this->m_CoolingCoilIndex); - OutletHumRatLS = DXCoils::DXCoilOutletHumRat(this->m_CoolingCoilIndex); + OutletHumRatLS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex); if (OutletHumRatLS > DesOutHumRat) { CycRatio = 1.0; DXCoils::SimDXCoilMultiSpeed(state, CompName, 1.0, 1.0, this->m_CoolingCoilIndex); - OutletHumRatHS = DXCoils::DXCoilOutletHumRat(this->m_CoolingCoilIndex); + OutletHumRatHS = state.dataDXCoils->DXCoilOutletHumRat(this->m_CoolingCoilIndex); if (OutletHumRatHS < DesOutHumRat) { Par[1] = double(this->m_CoolingCoilIndex); Par[2] = DesOutHumRat; @@ -14337,7 +14337,7 @@ namespace UnitarySystems { int CoilIndex = int(Par[1]); int FanOpMode = int(Par[5]); DXCoils::CalcDoe2DXCoil(state, CoilIndex, state.dataUnitarySystems->On, true, PartLoadRatio, FanOpMode); - Real64 OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par[2] - OutletAirTemp; return Residuum; @@ -14371,7 +14371,7 @@ namespace UnitarySystems { int CoilIndex = int(Par[1]); int FanOpMode = int(Par[5]); DXCoils::CalcDoe2DXCoil(state, CoilIndex, state.dataUnitarySystems->On, true, PartLoadRatio, FanOpMode); - Real64 OutletAirHumRat = DXCoils::DXCoilOutletHumRat(CoilIndex); + Real64 OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); Residuum = Par[2] - OutletAirHumRat; return Residuum; @@ -14596,7 +14596,7 @@ namespace UnitarySystems { if (SELECT_CASE_var == DataHVACGlobals::CoilDX_CoolingTwoSpeed) { DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, SpeedRatio, 1.0); - OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); } else if (SELECT_CASE_var == DataHVACGlobals::CoilDX_MultiSpeedCooling) { @@ -14608,7 +14608,7 @@ namespace UnitarySystems { thisSys.setAverageAirFlow(state, SpeedRatio, OnOffAirFlowRatio); DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, 0); - OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); } else if ((SELECT_CASE_var == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) || (SELECT_CASE_var == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) { @@ -14699,7 +14699,7 @@ namespace UnitarySystems { DXCoils::CalcMultiSpeedDXCoilHeating(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); - OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); } else if ((SELECT_CASE_var == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) || (SELECT_CASE_var == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit)) { @@ -14803,7 +14803,7 @@ namespace UnitarySystems { if (SELECT_CASE_var == DataHVACGlobals::CoilDX_CoolingTwoSpeed) { DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, SpeedRatio, 1.0); - OutletAirHumRat = DXCoils::DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); } else if (SELECT_CASE_var == DataHVACGlobals::CoilDX_MultiSpeedCooling) { @@ -14815,7 +14815,7 @@ namespace UnitarySystems { thisSys.setAverageAirFlow(state, SpeedRatio, OnOffAirFlowRatio); DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, 0); - OutletAirHumRat = DXCoils::DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); } else if ((SELECT_CASE_var == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) || (SELECT_CASE_var == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) { @@ -14914,7 +14914,7 @@ namespace UnitarySystems { DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, 0.0, CycRatio); } - OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); } else if (SELECT_CASE_var == DataHVACGlobals::CoilDX_MultiSpeedCooling) { @@ -14932,7 +14932,7 @@ namespace UnitarySystems { } else { DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, 0); } - OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); } else if ((SELECT_CASE_var == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) || (SELECT_CASE_var == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) { @@ -15017,7 +15017,7 @@ namespace UnitarySystems { DXCoils::CalcMultiSpeedDXCoil(state, CoilIndex, 0.0, CycRatio); - OutletAirHumRat = DXCoils::DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); } else if (SELECT_CASE_var == DataHVACGlobals::CoilDX_MultiSpeedCooling) { SpeedRatio = int(Par[4]); @@ -15028,7 +15028,7 @@ namespace UnitarySystems { thisSys.setAverageAirFlow(state, CycRatio, OnOffAirFlowRatio); DXCoils::CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, 0); - OutletAirHumRat = DXCoils::DXCoilOutletHumRat(CoilIndex); + OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); } else if ((SELECT_CASE_var == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) || (SELECT_CASE_var == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit)) { @@ -15126,7 +15126,7 @@ namespace UnitarySystems { thisSys.setAverageAirFlow(state, CycRatio, OnOffAirFlowRatio); DXCoils::CalcMultiSpeedDXCoilHeating(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); - OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); } else if ((SELECT_CASE_var == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) || (SELECT_CASE_var == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit)) { @@ -15275,7 +15275,7 @@ namespace UnitarySystems { DehumidMode = int(Par[3]); FanOpMode = int(Par[4]); DXCoils::SimDXCoilMultiMode(state, "", state.dataUnitarySystems->On, false, PartLoadRatio, DehumidMode, CoilIndex, FanOpMode); - OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par[2] - OutletAirTemp; return Residuum; @@ -15311,7 +15311,7 @@ namespace UnitarySystems { int DehumidMode = int(Par[3]); int FanOpMode = int(Par[4]); DXCoils::SimDXCoilMultiMode(state, "", state.dataUnitarySystems->On, false, PartLoadRatio, DehumidMode, CoilIndex, FanOpMode); - Real64 OutletAirHumRat = DXCoils::DXCoilOutletHumRat(CoilIndex); + Real64 OutletAirHumRat = state.dataDXCoils->DXCoilOutletHumRat(CoilIndex); Residuum = Par[2] - OutletAirHumRat; return Residuum; @@ -15787,7 +15787,7 @@ namespace UnitarySystems { DXCoils::CalcDXHeatingCoil(state, CoilIndex, PartLoadFrac, DataHVACGlobals::ContFanCycCoil, OnOffAirFlowFrac); - Real64 OutletAirTemp = DXCoils::DXCoilOutletTemp(CoilIndex); + Real64 OutletAirTemp = state.dataDXCoils->DXCoilOutletTemp(CoilIndex); Residuum = Par[2] - OutletAirTemp; return Residuum; diff --git a/src/EnergyPlus/VariableSpeedCoils.hh b/src/EnergyPlus/VariableSpeedCoils.hh index 358a7c54040..a3970099516 100644 --- a/src/EnergyPlus/VariableSpeedCoils.hh +++ b/src/EnergyPlus/VariableSpeedCoils.hh @@ -466,7 +466,8 @@ namespace VariableSpeedCoils { void UpdateVarSpeedCoil(EnergyPlusData &state, int const DXCoilNum); - Real64 CalcEffectiveSHR(EnergyPlusData &state, int const DXCoilNum, // Index number for cooling coil + Real64 CalcEffectiveSHR(EnergyPlusData &state, + int const DXCoilNum, // Index number for cooling coil Real64 const SHRss, // Steady-state sensible heat ratio int const CyclingScheme, // Fan/compressor cycling scheme indicator Real64 const RTF, // Compressor run-time fraction diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index b3e10689d11..110120f62c4 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1448,7 +1448,7 @@ namespace WaterThermalTanks { } } else { // this is a single speed coil - DXCoils::DXCoilData &Coil = DXCoils::DXCoil(HPWH.DXCoilNum); + DXCoils::DXCoilData &Coil = state.dataDXCoils->DXCoil(HPWH.DXCoilNum); if (!UtilityRoutines::SameString(HPWH.DXCoilType, Coil.DXCoilType)) { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + "=\"" + HPWH.Name + "\", "); ShowContinueError(state, "specifies the coil " + HPWH.DXCoilType + "=\"" + HPWH.DXCoilName + "\"."); @@ -1487,7 +1487,7 @@ namespace WaterThermalTanks { // Dummy condenser Inlet/Outlet Nodes for wrapped tanks if (HPWH.DXCoilTypeNum == DataHVACGlobals::CoilDX_HeatPumpWaterHeaterWrapped) { - DXCoils::DXCoilData &Coil = DXCoils::DXCoil(HPWH.DXCoilNum); + DXCoils::DXCoilData &Coil = state.dataDXCoils->DXCoil(HPWH.DXCoilNum); HPWH.InletNodeName1 = "DUMMY CONDENSER INLET " + Coil.Name; HPWH.CondWaterInletNode = NodeInputManager::GetOnlySingleNode(state, HPWH.InletNodeName1, @@ -1649,17 +1649,17 @@ namespace WaterThermalTanks { if (HPWH.DXCoilNum > 0 && !bIsVScoil) { // get HPWH capacity, air inlet node, and PLF curve info from DX coil object - HPWH.Capacity = DXCoils::DXCoil(HPWH.DXCoilNum).RatedTotCap2; - HPWH.DXCoilAirInletNode = DXCoils::DXCoil(HPWH.DXCoilNum).AirInNode; - HPWH.DXCoilPLFFPLR = DXCoils::DXCoil(HPWH.DXCoilNum).PLFFPLR(1); + HPWH.Capacity = state.dataDXCoils->DXCoil(HPWH.DXCoilNum).RatedTotCap2; + HPWH.DXCoilAirInletNode = state.dataDXCoils->DXCoil(HPWH.DXCoilNum).AirInNode; + HPWH.DXCoilPLFFPLR = state.dataDXCoils->DXCoil(HPWH.DXCoilNum).PLFFPLR(1); // check the range of condenser pump power to be <= 5 gpm/ton - if (DXCoils::DXCoil(HPWH.DXCoilNum).HPWHCondPumpElecNomPower / DXCoils::DXCoil(HPWH.DXCoilNum).RatedTotCap2 > 0.1422) { + if (state.dataDXCoils->DXCoil(HPWH.DXCoilNum).HPWHCondPumpElecNomPower / state.dataDXCoils->DXCoil(HPWH.DXCoilNum).RatedTotCap2 > 0.1422) { ShowWarningError( state, - DXCoils::DXCoil(HPWH.DXCoilNum).DXCoilType + "= " + DXCoils::DXCoil(HPWH.DXCoilNum).Name + + state.dataDXCoils->DXCoil(HPWH.DXCoilNum).DXCoilType + "= " + state.dataDXCoils->DXCoil(HPWH.DXCoilNum).Name + format(": Rated condenser pump power per watt of rated heating capacity has exceeded the recommended maximum of 0.1422 " "W/W (41.67 watt/MBH). Condenser pump power per watt = {:.4T}", - (DXCoils::DXCoil(HPWH.DXCoilNum).HPWHCondPumpElecNomPower / DXCoils::DXCoil(HPWH.DXCoilNum).RatedTotCap2))); + (state.dataDXCoils->DXCoil(HPWH.DXCoilNum).HPWHCondPumpElecNomPower / state.dataDXCoils->DXCoil(HPWH.DXCoilNum).RatedTotCap2))); } } else if ((HPWH.DXCoilNum > 0) && (bIsVScoil)) { @@ -2011,7 +2011,7 @@ namespace WaterThermalTanks { HPWH.FanOutletNode = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(state, HPWH.DXCoilType, HPWH.DXCoilName, DXCoilErrFlag); } } else { - HPWH.FanOutletNode = DXCoils::DXCoil(HPWH.DXCoilNum).AirInNode; + HPWH.FanOutletNode = state.dataDXCoils->DXCoil(HPWH.DXCoilNum).AirInNode; } } @@ -2082,7 +2082,7 @@ namespace WaterThermalTanks { } } else if (HPWH.DXCoilNum > 0) { - DXCoilAirOutletNodeNum = DXCoils::DXCoil(HPWH.DXCoilNum).AirOutNode; + DXCoilAirOutletNodeNum = state.dataDXCoils->DXCoil(HPWH.DXCoilNum).AirOutNode; } if (HPWH.FanPlacement == DataHVACGlobals::DrawThru) { if (FanInletNodeNum != DXCoilAirOutletNodeNum) { @@ -7130,7 +7130,7 @@ namespace WaterThermalTanks { CoilTotalHeatingEnergyRate = Coil.TotalHeatingEnergyRate; } else { // Single speed HPWH - DXCoils::DXCoilData const &Coil = DXCoils::DXCoil(HPWH.DXCoilNum); + DXCoils::DXCoilData const &Coil = state.dataDXCoils->DXCoil(HPWH.DXCoilNum); CoilTotalHeatingEnergyRate = Coil.TotalHeatingEnergyRate; } return CoilTotalHeatingEnergyRate * this->SourceEffectiveness; @@ -7999,7 +7999,7 @@ namespace WaterThermalTanks { DesupHtr.ReclaimHeatingSource == CoilObjEnum::DXMultiMode) { AverageWasteHeat = DataHeatBalance::HeatReclaimDXCoil(SourceID).AvailCapacity - DataHeatBalance::HeatReclaimDXCoil(SourceID).HVACDesuperheaterReclaimedHeatTotal; - DesupHtr.DXSysPLR = DXCoils::DXCoil(SourceID).PartLoadRatio; + DesupHtr.DXSysPLR = state.dataDXCoils->DXCoil(SourceID).PartLoadRatio; } else if (DesupHtr.ReclaimHeatingSource == CoilObjEnum::DXVariableCooling) { AverageWasteHeat = DataHeatBalance::HeatReclaimVS_DXCoil(SourceID).AvailCapacity - DataHeatBalance::HeatReclaimVS_DXCoil(SourceID).HVACDesuperheaterReclaimedHeatTotal; @@ -9595,7 +9595,7 @@ namespace WaterThermalTanks { void WaterThermalTankData::ConvergeSingleSpeedHPWHCoilAndTank(EnergyPlusData &state, Real64 const partLoadRatio) { HeatPumpWaterHeaterData &HPWH = state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum); - DXCoils::DXCoilData &Coil = DXCoils::DXCoil(HPWH.DXCoilNum); + DXCoils::DXCoilData &Coil = state.dataDXCoils->DXCoil(HPWH.DXCoilNum); Real64 PrevTankTemp = this->SourceOutletTemp; for (int i = 1; i <= 10; ++i) { @@ -9863,7 +9863,7 @@ namespace WaterThermalTanks { else CoilTotalHeatingEnergyRatePtr = &state.dataVariableSpeedCoils->VarSpeedCoil(HeatPump.DXCoilNum).TotalHeatingEnergyRate; } else { - CoilTotalHeatingEnergyRatePtr = &DXCoils::DXCoil(HeatPump.DXCoilNum).TotalHeatingEnergyRate; + CoilTotalHeatingEnergyRatePtr = &state.dataDXCoils->DXCoil(HeatPump.DXCoilNum).TotalHeatingEnergyRate; } // Copy the value of the total heating energy rate Real64 const CoilTotalHeatingEnergyRateBackup = *CoilTotalHeatingEnergyRatePtr; @@ -11660,9 +11660,9 @@ namespace WaterThermalTanks { } } - this->MaxCapacity = DXCoils::HPWHHeatingCapacity; - this->MinCapacity = DXCoils::HPWHHeatingCapacity; - this->Efficiency = DXCoils::HPWHHeatingCOP; + this->MaxCapacity = state.dataDXCoils->HPWHHeatingCapacity; + this->MinCapacity = state.dataDXCoils->HPWHHeatingCapacity; + this->Efficiency = state.dataDXCoils->HPWHHeatingCOP; } if (FirstTimeFlag) { @@ -11753,7 +11753,7 @@ namespace WaterThermalTanks { if (bIsVSCoil) { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchSWHHeatIn, equipName, state.dataVariableSpeedCoils->VSHPWHHeatingCapacity); } else { - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchSWHHeatIn, equipName, DXCoils::HPWHHeatingCapacity); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchSWHHeatIn, equipName, state.dataDXCoils->HPWHHeatingCapacity); } OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchSWHThEff, equipName, this->Efficiency); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchSWHRecEff, equipName, RecoveryEfficiency); @@ -11782,7 +11782,7 @@ namespace WaterThermalTanks { state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).Type, state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).Name, this->Volume, - DXCoils::HPWHHeatingCapacity, + state.dataDXCoils->HPWHHeatingCapacity, RecoveryEfficiency, EnergyFactor, RatedDXCoilTotalCapacity); diff --git a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc index 48fc9fb12fe..9c37d741355 100644 --- a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc +++ b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc @@ -129,7 +129,8 @@ namespace WaterToAirHeatPumpSimple { using DataPlant::TypeOf_CoilWAHPCoolingEquationFit; using DataPlant::TypeOf_CoilWAHPHeatingEquationFit; - void SimWatertoAirHPSimple(EnergyPlusData &state, std::string const &CompName, // Coil Name + void SimWatertoAirHPSimple(EnergyPlusData &state, + std::string const &CompName, // Coil Name int &CompIndex, // Index for Component name Real64 const SensLoad, // Sensible demand load [W] Real64 const LatentLoad, // Latent demand load [W] diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc index a136ed7c3c9..25400407867 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc @@ -656,8 +656,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition Node(PTUnit(PTUnitNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; @@ -987,8 +987,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition at outside air condition Node(PTUnit(PTUnitNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; @@ -1401,8 +1401,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition Node(PTUnit(PTUnitNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; @@ -1814,8 +1814,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition at outside air condition Node(PTUnit(PTUnitNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; @@ -2438,14 +2438,14 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) GetZoneAirLoopEquipment(*state); GetVRFInput(*state); - GetVRFInputFlag = false; + state->dataHVACVarRefFlow->GetVRFInputFlag = false; // get input test for terminal air single duct mixer on inlet side of VRF terminal unit ASSERT_EQ(1, state->dataSingleDuct->NumATMixers); EXPECT_EQ("SPACE1-1 DOAS AIR TERMINAL", state->dataSingleDuct->SysATMixer(1).Name); // single duct air terminal mixer name EXPECT_EQ(DataHVACGlobals::ATMixer_InletSide, state->dataSingleDuct->SysATMixer(1).MixerType); // air terminal mixer connection type EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", state->dataDefineEquipment->AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type - EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name + EXPECT_EQ("TU1", state->dataHVACVarRefFlow->VRFTU(1).Name); // zoneHVAC equipment name // EXPECT_EQ( "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow", VRFTU( 1 ).Name ); // zoneHVAC equipment type state->dataGlobal->BeginEnvrnFlag = false; @@ -2466,26 +2466,26 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) Node(ZoneEquipConfig(1).ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(ZoneEquipConfig(1).ZoneNode).Temp, Node(ZoneEquipConfig(1).ZoneNode).HumRat); - HVACVariableRefrigerantFlow::CoolingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad(1) = false; - HVACVariableRefrigerantFlow::CoolingLoad(1) = true; - HVACVariableRefrigerantFlow::CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate - HVACVariableRefrigerantFlow::OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate - HVACVariableRefrigerantFlow::CompOnFlowRatio = 1.0; // compressor is on + state->dataHVACVarRefFlow->CoolingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad(1) = false; + state->dataHVACVarRefFlow->CoolingLoad(1) = true; + state->dataHVACVarRefFlow->CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate + state->dataHVACVarRefFlow->OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate + state->dataHVACVarRefFlow->CompOnFlowRatio = 1.0; // compressor is on DataHVACGlobals::ZoneCompTurnFansOff = false; DataHVACGlobals::ZoneCompTurnFansOn = true; VRFNum = 1; VRFTUNum = 1; - VRFTU(VRFTUNum).OpMode = ContFanCycCoil; - VRFTU(VRFTUNum).isInZone = true; - VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(1).ZoneNode; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode = ContFanCycCoil; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone = true; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(1).ZoneNode; // VRFTU( VRFTUNum ).VRFTUOutletNodeNum // initialize mass flow rates - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; @@ -2495,20 +2495,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition - Node(VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; - Node(VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; - Node(VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; // set secondary air (recirculating air) conditions to zone air node Node(state->dataSingleDuct->SysATMixer(1).SecInNode).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; Node(state->dataSingleDuct->SysATMixer(1).SecInNode).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; Node(state->dataSingleDuct->SysATMixer(1).SecInNode).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; - VRFTU(1).ZoneNum = 1; + state->dataHVACVarRefFlow->VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; state->dataGlobal->SysSizingCalc = true; @@ -2518,8 +2518,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -5000.0; QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available // set secondary air mass flow rate to zero Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -3117,14 +3117,14 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) GetZoneAirLoopEquipment(*state); GetVRFInput(*state); - GetVRFInputFlag = false; + state->dataHVACVarRefFlow->GetVRFInputFlag = false; // get input test for terminal air single duct mixer on inlet side of VRF terminal unit ASSERT_EQ(1, state->dataSingleDuct->NumATMixers); EXPECT_EQ("SPACE1-1 DOAS AIR TERMINAL", state->dataSingleDuct->SysATMixer(1).Name); // single duct air terminal mixer name EXPECT_EQ(DataHVACGlobals::ATMixer_SupplySide, state->dataSingleDuct->SysATMixer(1).MixerType); // air terminal mixer connection type EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", state->dataDefineEquipment->AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type - EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name + EXPECT_EQ("TU1", state->dataHVACVarRefFlow->VRFTU(1).Name); // zoneHVAC equipment name state->dataGlobal->BeginEnvrnFlag = false; @@ -3144,24 +3144,24 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) Node(ZoneEquipConfig(1).ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(ZoneEquipConfig(1).ZoneNode).Temp, Node(ZoneEquipConfig(1).ZoneNode).HumRat); - HVACVariableRefrigerantFlow::CoolingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad(1) = false; - HVACVariableRefrigerantFlow::CoolingLoad(1) = true; - HVACVariableRefrigerantFlow::CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate - HVACVariableRefrigerantFlow::OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate - HVACVariableRefrigerantFlow::CompOnFlowRatio = 1.0; // compressor is on + state->dataHVACVarRefFlow->CoolingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad(1) = false; + state->dataHVACVarRefFlow->CoolingLoad(1) = true; + state->dataHVACVarRefFlow->CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate + state->dataHVACVarRefFlow->OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate + state->dataHVACVarRefFlow->CompOnFlowRatio = 1.0; // compressor is on DataHVACGlobals::ZoneCompTurnFansOff = false; DataHVACGlobals::ZoneCompTurnFansOn = true; VRFNum = 1; VRFTUNum = 1; - VRFTU(VRFTUNum).OpMode = ContFanCycCoil; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode = ContFanCycCoil; // initialize mass flow rates - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; @@ -3171,20 +3171,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition - Node(VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; - Node(VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; - Node(VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; // set VRF terminal unit inlet condition to zone air node - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; - VRFTU(1).ZoneNum = 1; + state->dataHVACVarRefFlow->VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; state->dataGlobal->SysSizingCalc = true; @@ -3194,8 +3194,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4000.0; QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available // set secondary air mass flow rate to zero Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -4867,14 +4867,14 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi GetZoneAirLoopEquipment(*state); GetVRFInput(*state); - GetVRFInputFlag = false; + state->dataHVACVarRefFlow->GetVRFInputFlag = false; // get input test for terminal air single duct mixer on inlet side of VRF terminal unit ASSERT_EQ(1, state->dataSingleDuct->NumATMixers); EXPECT_EQ("SPACE1-1 DOAS AIR TERMINAL", state->dataSingleDuct->SysATMixer(1).Name); // single duct air terminal mixer name EXPECT_EQ(DataHVACGlobals::ATMixer_InletSide, state->dataSingleDuct->SysATMixer(1).MixerType); // air terminal mixer connection type EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", state->dataDefineEquipment->AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type - EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name + EXPECT_EQ("TU1", state->dataHVACVarRefFlow->VRFTU(1).Name); // zoneHVAC equipment name state->dataGlobal->BeginEnvrnFlag = false; @@ -4895,25 +4895,25 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi Node(ZoneEquipConfig(1).ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(ZoneEquipConfig(1).ZoneNode).Temp, Node(ZoneEquipConfig(1).ZoneNode).HumRat); - HVACVariableRefrigerantFlow::CoolingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad(1) = false; - HVACVariableRefrigerantFlow::CoolingLoad(1) = true; - HVACVariableRefrigerantFlow::CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate - HVACVariableRefrigerantFlow::OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate - HVACVariableRefrigerantFlow::CompOnFlowRatio = 1.0; // compressor is on + state->dataHVACVarRefFlow->CoolingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad(1) = false; + state->dataHVACVarRefFlow->CoolingLoad(1) = true; + state->dataHVACVarRefFlow->CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate + state->dataHVACVarRefFlow->OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate + state->dataHVACVarRefFlow->CompOnFlowRatio = 1.0; // compressor is on DataHVACGlobals::ZoneCompTurnFansOff = false; DataHVACGlobals::ZoneCompTurnFansOn = true; VRFNum = 1; VRFTUNum = 1; - VRFTU(VRFTUNum).OpMode = CycFanCycCoil; - VRFTU(VRFTUNum).isInZone = true; - VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(1).ZoneNode; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode = CycFanCycCoil; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone = true; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(1).ZoneNode; // initialize mass flow rates - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; @@ -4923,20 +4923,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition - Node(VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; - Node(VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; - Node(VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; // set secondary air (recirculating air) conditions to zone air node Node(state->dataSingleDuct->SysATMixer(1).SecInNode).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; Node(state->dataSingleDuct->SysATMixer(1).SecInNode).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; Node(state->dataSingleDuct->SysATMixer(1).SecInNode).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; - VRFTU(1).ZoneNum = 1; + state->dataHVACVarRefFlow->VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; state->dataGlobal->SysSizingCalc = true; @@ -4946,8 +4946,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -5000.0; QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available // set secondary air mass flow rate to zero Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -4955,10 +4955,10 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); // check the terminal air mixer secondary air mass flow rate, requires updating the secondary flow - SecondaryAirMassFlowRate = Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate - PrimaryAirMassFlowRate; + SecondaryAirMassFlowRate = Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate - PrimaryAirMassFlowRate; ASSERT_EQ(SecondaryAirMassFlowRate, Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate); // check the terminal air mixer outlet flow rate must be equal to VRFTU mass flow rate - HVACInletMassFlowRate = Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate; + HVACInletMassFlowRate = Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate; ASSERT_EQ(HVACInletMassFlowRate, state->dataSingleDuct->SysATMixer(1).MixedAirMassFlowRate); // check the cooling output delivered is within 5.0 Watt of zone cooling load ASSERT_NEAR(QZnReq, QUnitOutVRFTU, 5.0); @@ -6621,14 +6621,14 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS GetZoneAirLoopEquipment(*state); GetVRFInput(*state); - GetVRFInputFlag = false; + state->dataHVACVarRefFlow->GetVRFInputFlag = false; // get input test for terminal air single duct mixer on supply side of VRF terminal unit ASSERT_EQ(1, state->dataSingleDuct->NumATMixers); EXPECT_EQ("SPACE1-1 DOAS AIR TERMINAL", state->dataSingleDuct->SysATMixer(1).Name); // single duct air terminal mixer name EXPECT_EQ(DataHVACGlobals::ATMixer_SupplySide, state->dataSingleDuct->SysATMixer(1).MixerType); // air terminal mixer connection type EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", state->dataDefineEquipment->AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type - EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name + EXPECT_EQ("TU1", state->dataHVACVarRefFlow->VRFTU(1).Name); // zoneHVAC equipment name state->dataGlobal->BeginEnvrnFlag = false; @@ -6647,25 +6647,25 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS Node(ZoneEquipConfig(1).ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(ZoneEquipConfig(1).ZoneNode).Temp, Node(ZoneEquipConfig(1).ZoneNode).HumRat); - HVACVariableRefrigerantFlow::CoolingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad.allocate(1); - HVACVariableRefrigerantFlow::HeatingLoad(1) = false; - HVACVariableRefrigerantFlow::CoolingLoad(1) = true; - HVACVariableRefrigerantFlow::CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate - HVACVariableRefrigerantFlow::OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate - HVACVariableRefrigerantFlow::CompOnFlowRatio = 1.0; // compressor is on + state->dataHVACVarRefFlow->CoolingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad(1) = false; + state->dataHVACVarRefFlow->CoolingLoad(1) = true; + state->dataHVACVarRefFlow->CompOnMassFlow = HVACInletMassFlowRate; // supply air mass flow rate + state->dataHVACVarRefFlow->OACompOnMassFlow = PrimaryAirMassFlowRate; // OA mass flow rate + state->dataHVACVarRefFlow->CompOnFlowRatio = 1.0; // compressor is on DataHVACGlobals::ZoneCompTurnFansOff = false; DataHVACGlobals::ZoneCompTurnFansOn = true; VRFNum = 1; VRFTUNum = 1; - VRFTU(VRFTUNum).OpMode = CycFanCycCoil; - VRFTU(VRFTUNum).isInZone = true; - VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(1).ZoneNode; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode = CycFanCycCoil; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).isInZone = true; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode = ZoneEquipConfig(1).ZoneNode; // initialize mass flow rates - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; - Node(VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate = HVACInletMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; @@ -6675,20 +6675,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition - Node(VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; - Node(VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; - Node(VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Temp = state->dataEnvrn->OutDryBulbTemp; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).HumRat = state->dataEnvrn->OutHumRat; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ATMixerPriNode).Enthalpy = state->dataEnvrn->OutEnthalpy; // set VRF terminal unit inlet condition to zone air node - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; - VRFTU(1).ZoneNum = 1; + state->dataHVACVarRefFlow->VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; state->dataGlobal->SysSizingCalc = true; @@ -6698,8 +6698,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4000.0; QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available // set secondary air mass flow rate to zero Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -6707,7 +6707,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); // check the terminal air mixer secondary air mass flow rate, requires updating the secondary flow - SecondaryAirMassFlowRate = Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate; + SecondaryAirMassFlowRate = Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate; ASSERT_EQ(SecondaryAirMassFlowRate, Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate); // check the terminal air mixer outlet flow rate must be equal to the mass flow rate of VRFTU + the primary air ATMixerOutletMassFlowRate = SecondaryAirMassFlowRate + PrimaryAirMassFlowRate; diff --git a/tst/EnergyPlus/unit/DXCoils.unit.cc b/tst/EnergyPlus/unit/DXCoils.unit.cc index f8876531f0d..57ab273ec77 100644 --- a/tst/EnergyPlus/unit/DXCoils.unit.cc +++ b/tst/EnergyPlus/unit/DXCoils.unit.cc @@ -92,73 +92,73 @@ TEST_F(EnergyPlusFixture, DXCoils_Test1) int DXCoilNum; int CurveNum; - NumDXCoils = 2; - DXCoil.allocate(NumDXCoils); - DXCoil(1).DXCoilType_Num = CoilDX_MultiSpeedCooling; - DXCoil(1).DXCoilType = "Coil:Cooling:DX:MultiSpeed"; - DXCoil(2).DXCoilType_Num = CoilDX_MultiSpeedHeating; - DXCoil(2).DXCoilType = "Coil:Heating:DX:MultiSpeed"; - DXCoil(1).MSRatedTotCap.allocate(2); - DXCoil(2).MSRatedTotCap.allocate(2); - DXCoil(2).CompanionUpstreamDXCoil = 1; - - DXCoilNumericFields.allocate(NumDXCoils); - DXCoilNumericFields(2).PerfMode.allocate(1); - DXCoilNumericFields(2).PerfMode(1).FieldNames.allocate(17); - DXCoil(2).DefrostStrategy = Resistive; - DXCoil(2).DefrostCapacity = 5000.0; - DXCoil(2).Name = "DX Heating coil"; - DXCoil(1).NumOfSpeeds = 2; - DXCoil(2).NumOfSpeeds = 2; + state->dataDXCoils->NumDXCoils = 2; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(1).DXCoilType_Num = CoilDX_MultiSpeedCooling; + state->dataDXCoils->DXCoil(1).DXCoilType = "Coil:Cooling:DX:MultiSpeed"; + state->dataDXCoils->DXCoil(2).DXCoilType_Num = CoilDX_MultiSpeedHeating; + state->dataDXCoils->DXCoil(2).DXCoilType = "Coil:Heating:DX:MultiSpeed"; + state->dataDXCoils->DXCoil(1).MSRatedTotCap.allocate(2); + state->dataDXCoils->DXCoil(2).MSRatedTotCap.allocate(2); + state->dataDXCoils->DXCoil(2).CompanionUpstreamDXCoil = 1; + + state->dataDXCoils->DXCoilNumericFields.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilNumericFields(2).PerfMode.allocate(1); + state->dataDXCoils->DXCoilNumericFields(2).PerfMode(1).FieldNames.allocate(17); + state->dataDXCoils->DXCoil(2).DefrostStrategy = Resistive; + state->dataDXCoils->DXCoil(2).DefrostCapacity = 5000.0; + state->dataDXCoils->DXCoil(2).Name = "DX Heating coil"; + state->dataDXCoils->DXCoil(1).NumOfSpeeds = 2; + state->dataDXCoils->DXCoil(2).NumOfSpeeds = 2; for (DXCoilNum = 1; DXCoilNum <= 2; ++DXCoilNum) { - DXCoil(DXCoilNum).MSRatedTotCap.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedSHR.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedCOP.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedAirVolFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedAirMassFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSCCapFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSCCapFFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEIRFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEIRFFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSWasteHeat.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEvapCondEffect.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEvapCondAirFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSRatedCBF.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSWasteHeatFrac.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSPLFFPLR.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSTwet_Rated.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSGamma_Rated.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSLatentCapacityTimeConstant.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate.allocate(DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedSHR.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedAirMassFlowRate.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSWasteHeat.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSEvapCondEffect.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSEvapCondAirFlow.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSEvapCondPumpElecNomPower.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedCBF.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSWasteHeatFrac.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSTwet_Rated.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSGamma_Rated.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSMaxONOFFCyclesperHour.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSLatentCapacityTimeConstant.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); } - DXCoil(1).MSRatedTotCap(1) = 4455.507579219055; - DXCoil(1).MSRatedTotCap(2) = 6188.507579219055; - DXCoil(1).MSCCapFFlow = 1; - DXCoil(1).MSCCapFTemp = 3; - DXCoil(1).MSEIRFFlow = 1; - DXCoil(1).MSEIRFTemp = 3; - DXCoil(1).MSPLFFPLR = 2; + state->dataDXCoils->DXCoil(1).MSRatedTotCap(1) = 4455.507579219055; + state->dataDXCoils->DXCoil(1).MSRatedTotCap(2) = 6188.507579219055; + state->dataDXCoils->DXCoil(1).MSCCapFFlow = 1; + state->dataDXCoils->DXCoil(1).MSCCapFTemp = 3; + state->dataDXCoils->DXCoil(1).MSEIRFFlow = 1; + state->dataDXCoils->DXCoil(1).MSEIRFTemp = 3; + state->dataDXCoils->DXCoil(1).MSPLFFPLR = 2; DXCoilNum = 2; - DXCoil(DXCoilNum).MSRatedTotCap(1) = 4455.507579219055; - DXCoil(DXCoilNum).MSRatedTotCap(2) = 6188.204971137576; - DXCoil(DXCoilNum).MSRatedCOP(1) = 4.03; - DXCoil(DXCoilNum).MSRatedCOP(2) = 3.53; - - DXCoil(DXCoilNum).MSCCapFFlow = 1; - DXCoil(DXCoilNum).MSCCapFTemp = 3; - DXCoil(DXCoilNum).MSEIRFFlow = 1; - DXCoil(DXCoilNum).MSEIRFTemp = 3; - DXCoil(DXCoilNum).MSPLFFPLR = 2; - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(1) = 0.2339; - DXCoil(DXCoilNum).MSRatedAirVolFlowRate(2) = 0.2924; - DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate = 0.0; - DXCoil(DXCoilNum).RegionNum = 4; - DXCoil(DXCoilNum).MinOATCompressor = -17.78; + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(1) = 4455.507579219055; + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap(2) = 6188.204971137576; + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(1) = 4.03; + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedCOP(2) = 3.53; + + state->dataDXCoils->DXCoil(DXCoilNum).MSCCapFFlow = 1; + state->dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp = 3; + state->dataDXCoils->DXCoil(DXCoilNum).MSEIRFFlow = 1; + state->dataDXCoils->DXCoil(DXCoilNum).MSEIRFTemp = 3; + state->dataDXCoils->DXCoil(DXCoilNum).MSPLFFPLR = 2; + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(1) = 0.2339; + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedAirVolFlowRate(2) = 0.2924; + state->dataDXCoils->DXCoil(DXCoilNum).MSFanPowerPerEvapAirFlowRate = 0.0; + state->dataDXCoils->DXCoil(DXCoilNum).RegionNum = 4; + state->dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = -17.78; state->dataCurveManager->NumCurves = 3; state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); @@ -210,7 +210,7 @@ TEST_F(EnergyPlusFixture, DXCoils_Test1) SetPredefinedTables(*state); SizeDXCoil(*state, 2); - EXPECT_DOUBLE_EQ(5000.0, DXCoil(2).DefrostCapacity); + EXPECT_DOUBLE_EQ(5000.0, state->dataDXCoils->DXCoil(2).DefrostCapacity); EXPECT_TRUE(has_eio_output()); @@ -230,28 +230,28 @@ TEST_F(EnergyPlusFixture, DXCoils_Test1) int CoilIndex = 1; DataHeatBalance::HeatReclaimDXCoil.allocate(2); - DXCoil(CoilIndex).InletAirMassFlowRate = MSHPMassFlowRateLow; - DXCoil(CoilIndex).MSRatedAirMassFlowRate(1) = MSHPMassFlowRateLow; - DXCoil(CoilIndex).MSRatedAirMassFlowRate(2) = MSHPMassFlowRateHigh; - DXCoil(CoilIndex).InletAirTemp = 16.1; // 97% RH - inlet is right up against the saturation curve - DXCoil(CoilIndex).InletAirEnthalpy = 45158.16; - DXCoil(CoilIndex).InletAirHumRat = 0.01145065; - DXCoil(CoilIndex).MSRatedCBF(1) = 0.0107723; - DXCoil(CoilIndex).MSRatedCBF(2) = 0.0107723; - DXCoil(CoilIndex).MSWasteHeat(1) = 0; - DXCoil(CoilIndex).MSWasteHeat(2) = 0; - DXCoil(CoilIndex).MSWasteHeatFrac(1) = 0; - DXCoil(CoilIndex).MSWasteHeatFrac(2) = 0; - DXCoil(CoilIndex).SchedPtr = 1; + state->dataDXCoils->DXCoil(CoilIndex).InletAirMassFlowRate = MSHPMassFlowRateLow; + state->dataDXCoils->DXCoil(CoilIndex).MSRatedAirMassFlowRate(1) = MSHPMassFlowRateLow; + state->dataDXCoils->DXCoil(CoilIndex).MSRatedAirMassFlowRate(2) = MSHPMassFlowRateHigh; + state->dataDXCoils->DXCoil(CoilIndex).InletAirTemp = 16.1; // 97% RH - inlet is right up against the saturation curve + state->dataDXCoils->DXCoil(CoilIndex).InletAirEnthalpy = 45158.16; + state->dataDXCoils->DXCoil(CoilIndex).InletAirHumRat = 0.01145065; + state->dataDXCoils->DXCoil(CoilIndex).MSRatedCBF(1) = 0.0107723; + state->dataDXCoils->DXCoil(CoilIndex).MSRatedCBF(2) = 0.0107723; + state->dataDXCoils->DXCoil(CoilIndex).MSWasteHeat(1) = 0; + state->dataDXCoils->DXCoil(CoilIndex).MSWasteHeat(2) = 0; + state->dataDXCoils->DXCoil(CoilIndex).MSWasteHeatFrac(1) = 0; + state->dataDXCoils->DXCoil(CoilIndex).MSWasteHeatFrac(2) = 0; + state->dataDXCoils->DXCoil(CoilIndex).SchedPtr = 1; Schedule.allocate(1); Schedule(1).CurrentValue = 1.0; - DXCoilOutletTemp.allocate(1); - DXCoilOutletHumRat.allocate(1); - DXCoilPartLoadRatio.allocate(1); - DXCoilFanOpMode.allocate(1); + state->dataDXCoils->DXCoilOutletTemp.allocate(1); + state->dataDXCoils->DXCoilOutletHumRat.allocate(1); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(1); + state->dataDXCoils->DXCoilFanOpMode.allocate(1); DataLoopNode::Node.allocate(1); - DXCoil(CoilIndex).AirOutNode = 1; + state->dataDXCoils->DXCoil(CoilIndex).AirOutNode = 1; Real64 SpeedRatio = 0.0; Real64 CycRatio = 1.0; @@ -261,9 +261,9 @@ TEST_F(EnergyPlusFixture, DXCoils_Test1) int SingleMode = 0; CalcMultiSpeedDXCoilCooling(*state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); - Real64 TdbAtOutlet = PsyTdbFnHW(DXCoil(CoilIndex).OutletAirEnthalpy, DXCoil(CoilIndex).OutletAirHumRat); - Real64 tSatAtOutlet = PsyTsatFnHPb(*state, DXCoil(CoilIndex).OutletAirEnthalpy, state->dataEnvrn->OutBaroPress); - Real64 rhAtOutlet = PsyRhFnTdbWPb(*state, DXCoil(CoilIndex).OutletAirTemp, DXCoil(CoilIndex).OutletAirHumRat, state->dataEnvrn->OutBaroPress); + Real64 TdbAtOutlet = PsyTdbFnHW(state->dataDXCoils->DXCoil(CoilIndex).OutletAirEnthalpy, state->dataDXCoils->DXCoil(CoilIndex).OutletAirHumRat); + Real64 tSatAtOutlet = PsyTsatFnHPb(*state, state->dataDXCoils->DXCoil(CoilIndex).OutletAirEnthalpy, state->dataEnvrn->OutBaroPress); + Real64 rhAtOutlet = PsyRhFnTdbWPb(*state, state->dataDXCoils->DXCoil(CoilIndex).OutletAirTemp, state->dataDXCoils->DXCoil(CoilIndex).OutletAirHumRat, state->dataEnvrn->OutBaroPress); // air outlet condition is right next to the saturation curve EXPECT_DOUBLE_EQ(TdbAtOutlet, tSatAtOutlet); // Tdb higher than TSat by 1.8E-15 C @@ -286,32 +286,32 @@ TEST_F(EnergyPlusFixture, DXCoils_Test2) state->dataAirSystemsData->PrimaryAirSystems.allocate(1); state->dataAirLoop->AirLoopControlInfo.allocate(1); CurSysNum = 1; - NumDXCoils = 2; + state->dataDXCoils->NumDXCoils = 2; DXCoilNum = 2; UnitarySysEqSizing.allocate(1); - DXCoil.allocate(NumDXCoils); - DXCoil(1).DXCoilType_Num = CoilDX_CoolingSingleSpeed; - DXCoil(2).DXCoilType_Num = CoilDX_HeatingEmpirical; - DXCoil(DXCoilNum).DXCoilType = "Coil:Heating:DX:SingleSpeed"; - DXCoil(2).CompanionUpstreamDXCoil = 1; - - DXCoilNumericFields.allocate(NumDXCoils); - DXCoilNumericFields(2).PerfMode.allocate(1); - DXCoilNumericFields(2).PerfMode(1).FieldNames.allocate(20); - DXCoil(2).DefrostStrategy = Resistive; - DXCoil(2).DefrostCapacity = 5000.0; - DXCoil(2).Name = "DX Heating coil"; - - DXCoil(1).RatedTotCap(1) = AutoSize; - DXCoil(1).RatedTotCap(2) = AutoSize; - DXCoil(2).RatedTotCap(1) = AutoSize; - DXCoil(DXCoilNum).RegionNum = 4; - DXCoil(DXCoilNum).MinOATCompressor = -17.78; - DXCoil(DXCoilNum).CCapFFlow(1) = 1; - DXCoil(DXCoilNum).CCapFTemp(1) = 1; - DXCoil(DXCoilNum).EIRFFlow(1) = 1; - DXCoil(DXCoilNum).EIRFTemp(1) = 1; - DXCoil(DXCoilNum).PLFFPLR(1) = 1; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(1).DXCoilType_Num = CoilDX_CoolingSingleSpeed; + state->dataDXCoils->DXCoil(2).DXCoilType_Num = CoilDX_HeatingEmpirical; + state->dataDXCoils->DXCoil(DXCoilNum).DXCoilType = "Coil:Heating:DX:SingleSpeed"; + state->dataDXCoils->DXCoil(2).CompanionUpstreamDXCoil = 1; + + state->dataDXCoils->DXCoilNumericFields.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilNumericFields(2).PerfMode.allocate(1); + state->dataDXCoils->DXCoilNumericFields(2).PerfMode(1).FieldNames.allocate(20); + state->dataDXCoils->DXCoil(2).DefrostStrategy = Resistive; + state->dataDXCoils->DXCoil(2).DefrostCapacity = 5000.0; + state->dataDXCoils->DXCoil(2).Name = "DX Heating coil"; + + state->dataDXCoils->DXCoil(1).RatedTotCap(1) = AutoSize; + state->dataDXCoils->DXCoil(1).RatedTotCap(2) = AutoSize; + state->dataDXCoils->DXCoil(2).RatedTotCap(1) = AutoSize; + state->dataDXCoils->DXCoil(DXCoilNum).RegionNum = 4; + state->dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = -17.78; + state->dataDXCoils->DXCoil(DXCoilNum).CCapFFlow(1) = 1; + state->dataDXCoils->DXCoil(DXCoilNum).CCapFTemp(1) = 1; + state->dataDXCoils->DXCoil(DXCoilNum).EIRFFlow(1) = 1; + state->dataDXCoils->DXCoil(DXCoilNum).EIRFTemp(1) = 1; + state->dataDXCoils->DXCoil(DXCoilNum).PLFFPLR(1) = 1; state->dataCurveManager->NumCurves = 3; state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); @@ -362,7 +362,7 @@ TEST_F(EnergyPlusFixture, DXCoils_Test2) SetPredefinedTables(*state); SizeDXCoil(*state, 2); - EXPECT_DOUBLE_EQ(0.0, DXCoil(2).RatedTotCap(1)); + EXPECT_DOUBLE_EQ(0.0, state->dataDXCoils->DXCoil(2).RatedTotCap(1)); EXPECT_TRUE(has_eio_output()); @@ -398,23 +398,23 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) // Set up heating coil and curves. - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoilData &Coil = DXCoil(DXCoilNum); + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + DXCoilData &Coil = state->dataDXCoils->DXCoil(DXCoilNum); Coil.DXCoilType = "Coil:Heating:DX:MultiSpeed"; Coil.DXCoilType_Num = CoilDX_MultiSpeedHeating; Coil.SchedPtr = DataGlobalConstants::ScheduleAlwaysOn; - DXCoilNumericFields.allocate(NumDXCoils); - DataHeatBalance::HeatReclaimDXCoil.allocate(NumDXCoils); - DXCoilOutletTemp.allocate(NumDXCoils); - DXCoilOutletHumRat.allocate(NumDXCoils); - DXCoilFanOpMode.allocate(NumDXCoils); - DXCoilPartLoadRatio.allocate(NumDXCoils); - DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); - DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(15); + state->dataDXCoils->DXCoilNumericFields.allocate(state->dataDXCoils->NumDXCoils); + DataHeatBalance::HeatReclaimDXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilOutletTemp.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilOutletHumRat.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilFanOpMode.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); + state->dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(15); Coil.DefrostStrategy = Resistive; Coil.Name = "DX Heating coil"; Coil.NumOfSpeeds = 2; @@ -768,18 +768,18 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) // Set up heating coil and curves. - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoilNumericFields.allocate(1); - DXCoilOutletTemp.allocate(NumDXCoils); - DXCoilOutletHumRat.allocate(NumDXCoils); - DXCoilFanOpMode.allocate(NumDXCoils); - DXCoilPartLoadRatio.allocate(NumDXCoils); - DXCoilTotalHeating.allocate(NumDXCoils); - DXCoilHeatInletAirDBTemp.allocate(NumDXCoils); - DXCoilHeatInletAirWBTemp.allocate(NumDXCoils); - DXCoilData &Coil = DXCoil(DXCoilNum); + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilNumericFields.allocate(1); + state->dataDXCoils->DXCoilOutletTemp.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilOutletHumRat.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilFanOpMode.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilTotalHeating.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilHeatInletAirDBTemp.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilHeatInletAirWBTemp.allocate(state->dataDXCoils->NumDXCoils); + DXCoilData &Coil = state->dataDXCoils->DXCoil(DXCoilNum); Coil.Name = "DX Single Speed Heating Coil"; Coil.DXCoilType = "Coil:Heating:DX:SingleSpeed"; @@ -1062,16 +1062,16 @@ TEST_F(EnergyPlusFixture, DXCoilEvapCondPumpSizingTest) GetCurveInput(*state); GetDXCoils(*state); - ASSERT_EQ(1, NumDXCoils); - EXPECT_EQ(DataSizing::AutoSize, DXCoil(1).EvapCondPumpElecNomPower(1)); + ASSERT_EQ(1, state->dataDXCoils->NumDXCoils); + EXPECT_EQ(DataSizing::AutoSize, state->dataDXCoils->DXCoil(1).EvapCondPumpElecNomPower(1)); SetPredefinedTables(*state); SizeDXCoil(*state, 1); - EXPECT_EQ(25000.0, DXCoil(1).RatedTotCap(1)); - EXPECT_EQ(DXCoil(1).RatedTotCap(1) * 0.004266, DXCoil(1).EvapCondPumpElecNomPower(1)); + EXPECT_EQ(25000.0, state->dataDXCoils->DXCoil(1).RatedTotCap(1)); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).RatedTotCap(1) * 0.004266, state->dataDXCoils->DXCoil(1).EvapCondPumpElecNomPower(1)); // Minimum Outdoor Temperature for Compressor Operation defaults to -25.0 C - EXPECT_EQ(DXCoil(1).MinOATCompressor, -25.0); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).MinOATCompressor, -25.0); } TEST_F(EnergyPlusFixture, TestDXCoilIndoorOrOutdoor) @@ -1089,7 +1089,7 @@ TEST_F(EnergyPlusFixture, TestDXCoilIndoorOrOutdoor) // Allocate NumCoils = 3; - DXCoil.allocate(NumCoils); + state->dataDXCoils->DXCoil.allocate(NumCoils); // IDF snippets std::string const idf_objects = delimited_string({ @@ -1106,20 +1106,20 @@ TEST_F(EnergyPlusFixture, TestDXCoilIndoorOrOutdoor) // Run DXCoilNum = 1; - DXCoil(DXCoilNum).AirInNode = 1; // "Outside Air Inlet Node 1" - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, DXCoil(DXCoilNum).AirInNode); + state->dataDXCoils->DXCoil(DXCoilNum).AirInNode = 1; // "Outside Air Inlet Node 1" + state->dataDXCoils->DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, state->dataDXCoils->DXCoil(DXCoilNum).AirInNode); DXCoilNum = 2; - DXCoil(DXCoilNum).AirInNode = 2; // "Outside Air Inlet Node 2" - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, DXCoil(DXCoilNum).AirInNode); + state->dataDXCoils->DXCoil(DXCoilNum).AirInNode = 2; // "Outside Air Inlet Node 2" + state->dataDXCoils->DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, state->dataDXCoils->DXCoil(DXCoilNum).AirInNode); DXCoilNum = 3; // "Inside Air Inlet Node" - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, DXCoil(DXCoilNum).AirInNode); + state->dataDXCoils->DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, state->dataDXCoils->DXCoil(DXCoilNum).AirInNode); // Check - EXPECT_FALSE(DXCoil(1).IsDXCoilInZone); - EXPECT_FALSE(DXCoil(2).IsDXCoilInZone); - EXPECT_TRUE(DXCoil(3).IsDXCoilInZone); + EXPECT_FALSE(state->dataDXCoils->DXCoil(1).IsDXCoilInZone); + EXPECT_FALSE(state->dataDXCoils->DXCoil(2).IsDXCoilInZone); + EXPECT_TRUE(state->dataDXCoils->DXCoil(3).IsDXCoilInZone); } TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) @@ -1298,44 +1298,44 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) // Case 1 test GetDXCoils(*state); - EXPECT_EQ("Electricity", DXCoil(1).FuelType); // it also covers a test for fuel type input - EXPECT_EQ(DataGlobalConstants::ResourceType::Electricity, DXCoil(1).FuelTypeNum); - EXPECT_EQ(0, DXCoil(1).MSWasteHeat(2)); + EXPECT_EQ("Electricity", state->dataDXCoils->DXCoil(1).FuelType); // it also covers a test for fuel type input + EXPECT_EQ(DataGlobalConstants::ResourceType::Electricity, state->dataDXCoils->DXCoil(1).FuelTypeNum); + EXPECT_EQ(0, state->dataDXCoils->DXCoil(1).MSWasteHeat(2)); // Test calculations of the waste heat function #5162 // Case 2 test waste heat is zero when the parent has not heat recovery inputs - DXCoil(1).FuelType = "NaturalGas"; - DXCoil(1).FuelTypeNum = DataGlobalConstants::ResourceType::Natural_Gas; - DXCoil(1).MSHPHeatRecActive = false; + state->dataDXCoils->DXCoil(1).FuelType = "NaturalGas"; + state->dataDXCoils->DXCoil(1).FuelTypeNum = DataGlobalConstants::ResourceType::Natural_Gas; + state->dataDXCoils->DXCoil(1).MSHPHeatRecActive = false; state->dataEnvrn->OutDryBulbTemp = 35; state->dataEnvrn->OutHumRat = 0.0128; state->dataEnvrn->OutBaroPress = 101325; state->dataEnvrn->OutWetBulbTemp = PsyTwbFnTdbWPb(*state, state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat, state->dataEnvrn->OutBaroPress); - DXCoil(1).MSRatedAirMassFlowRate(1) = DXCoil(1).MSRatedAirVolFlowRate(1) * 1.2; - DXCoil(1).MSRatedAirMassFlowRate(2) = DXCoil(1).MSRatedAirVolFlowRate(2) * 1.2; - DXCoil(1).InletAirMassFlowRate = DXCoil(1).MSRatedAirMassFlowRate(2); - MSHPMassFlowRateLow = DXCoil(1).MSRatedAirMassFlowRate(1); - MSHPMassFlowRateHigh = DXCoil(1).MSRatedAirMassFlowRate(2); + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(1) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1) * 1.2; + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(2) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2) * 1.2; + state->dataDXCoils->DXCoil(1).InletAirMassFlowRate = state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(2); + MSHPMassFlowRateLow = state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(1); + MSHPMassFlowRateHigh = state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(2); - DXCoil(1).InletAirTemp = 25.0; - DXCoil(1).InletAirHumRat = 0.005; - DXCoil(1).InletAirEnthalpy = PsyHFnTdbW(25.0, 0.005); + state->dataDXCoils->DXCoil(1).InletAirTemp = 25.0; + state->dataDXCoils->DXCoil(1).InletAirHumRat = 0.005; + state->dataDXCoils->DXCoil(1).InletAirEnthalpy = PsyHFnTdbW(25.0, 0.005); - DXCoil(1).SchedPtr = 1; - Schedule(DXCoil(1).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser - DXCoil(1).MSRatedCBF(1) = 0.1262; - DXCoil(1).MSRatedCBF(2) = 0.0408; + state->dataDXCoils->DXCoil(1).SchedPtr = 1; + Schedule(state->dataDXCoils->DXCoil(1).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser + state->dataDXCoils->DXCoil(1).MSRatedCBF(1) = 0.1262; + state->dataDXCoils->DXCoil(1).MSRatedCBF(2) = 0.0408; CalcMultiSpeedDXCoilCooling(*state, 1, 1, 1, 2, 1, 1, 0); EXPECT_EQ(0, MSHPWasteHeat); // Case 3 heat recovery is true and no waste heat function cuvre - DXCoil(1).MSWasteHeat(1) = 0; - DXCoil(1).MSWasteHeat(2) = 0; - DXCoil(1).MSHPHeatRecActive = true; + state->dataDXCoils->DXCoil(1).MSWasteHeat(1) = 0; + state->dataDXCoils->DXCoil(1).MSWasteHeat(2) = 0; + state->dataDXCoils->DXCoil(1).MSHPHeatRecActive = true; CalcMultiSpeedDXCoilCooling(*state, 1, 1, 1, 2, 1, 1, 0); @@ -1455,7 +1455,7 @@ TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunction) DataFlowUsedForSizing = 0.1; ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).CoolingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesCoolingLoad = DXCoil(1).RatedTotCap(1); + ZoneEqSizing(CurZoneEqNum).DesCoolingLoad = state->dataDXCoils->DXCoil(1).RatedTotCap(1); ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(25); ZoneEqSizing(CurZoneEqNum).SizingMethod(DataHVACGlobals::SystemAirflowSizing) = DataSizing::SupplyAirFlowRate; @@ -1471,48 +1471,48 @@ TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunction) Real64 const RatedInletAirHumRat(0.01125); // Humidity ratio corresponding to 80F dry bulb/67F wet bulb std::string const CallingRoutine("DXCoil_ValidateADPFunction"); - Real64 CBF_calculated = CalcCBF(*state, DXCoil(1).DXCoilType, - DXCoil(1).Name, + Real64 CBF_calculated = CalcCBF(*state, state->dataDXCoils->DXCoil(1).DXCoilType, + state->dataDXCoils->DXCoil(1).Name, RatedInletAirTemp, RatedInletAirHumRat, - DXCoil(1).RatedTotCap(1), - DXCoil(1).RatedAirVolFlowRate(1), - DXCoil(1).RatedSHR(1), + state->dataDXCoils->DXCoil(1).RatedTotCap(1), + state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1), + state->dataDXCoils->DXCoil(1).RatedSHR(1), true); - EXPECT_NEAR(0.792472, DXCoil(1).RatedSHR(1), 0.0000001); + EXPECT_NEAR(0.792472, state->dataDXCoils->DXCoil(1).RatedSHR(1), 0.0000001); EXPECT_NEAR(0.00213735, CBF_calculated, 0.0000001); - DXCoil(1).RatedTotCap(1) = 35000.0; // simulate outlet condition right at the saturation curve - DXCoil(1).RatedSHR(1) = AutoSize; + state->dataDXCoils->DXCoil(1).RatedTotCap(1) = 35000.0; // simulate outlet condition right at the saturation curve + state->dataDXCoils->DXCoil(1).RatedSHR(1) = AutoSize; SizeDXCoil(*state, 1); - CBF_calculated = CalcCBF(*state, DXCoil(1).DXCoilType, - DXCoil(1).Name, + CBF_calculated = CalcCBF(*state, state->dataDXCoils->DXCoil(1).DXCoilType, + state->dataDXCoils->DXCoil(1).Name, RatedInletAirTemp, RatedInletAirHumRat, - DXCoil(1).RatedTotCap(1), - DXCoil(1).RatedAirVolFlowRate(1), - DXCoil(1).RatedSHR(1), + state->dataDXCoils->DXCoil(1).RatedTotCap(1), + state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1), + state->dataDXCoils->DXCoil(1).RatedSHR(1), true); - EXPECT_NEAR(0.67908322, DXCoil(1).RatedSHR(1), 0.0000001); + EXPECT_NEAR(0.67908322, state->dataDXCoils->DXCoil(1).RatedSHR(1), 0.0000001); EXPECT_NEAR(0.00298921, CBF_calculated, 0.0000001); - DXCoil(1).RatedTotCap(1) = 40000.0; // reverse perturb SHR (i.e., decrease SHR), CalcCBF would have failed with RH >= 1.0 - DXCoil(1).RatedSHR(1) = AutoSize; + state->dataDXCoils->DXCoil(1).RatedTotCap(1) = 40000.0; // reverse perturb SHR (i.e., decrease SHR), CalcCBF would have failed with RH >= 1.0 + state->dataDXCoils->DXCoil(1).RatedSHR(1) = AutoSize; SizeDXCoil(*state, 1); - CBF_calculated = CalcCBF(*state, DXCoil(1).DXCoilType, - DXCoil(1).Name, + CBF_calculated = CalcCBF(*state, state->dataDXCoils->DXCoil(1).DXCoilType, + state->dataDXCoils->DXCoil(1).Name, RatedInletAirTemp, RatedInletAirHumRat, - DXCoil(1).RatedTotCap(1), - DXCoil(1).RatedAirVolFlowRate(1), - DXCoil(1).RatedSHR(1), + state->dataDXCoils->DXCoil(1).RatedTotCap(1), + state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1), + state->dataDXCoils->DXCoil(1).RatedSHR(1), true); - EXPECT_NEAR(0.64708322, DXCoil(1).RatedSHR(1), 0.0000001); + EXPECT_NEAR(0.64708322, state->dataDXCoils->DXCoil(1).RatedSHR(1), 0.0000001); EXPECT_NEAR(0.00252307, CBF_calculated, 0.0000001); } @@ -1695,7 +1695,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCrankcaseOutput) InitDXCoil(*state, 1); - EXPECT_FALSE(DXCoil(1).ReportCoolingCoilCrankcasePower); + EXPECT_FALSE(state->dataDXCoils->DXCoil(1).ReportCoolingCoilCrankcasePower); // These two output variables are listed in rdd for Coil:Cooling:DX:MultiSpeed used for AC only EXPECT_EQ("Cooling Coil Crankcase Heater Electricity Rate", state->dataOutputProcessor->DDVariableTypes(10).VarNameOnly); EXPECT_EQ("Cooling Coil Crankcase Heater Electricity Energy", state->dataOutputProcessor->DDVariableTypes(11).VarNameOnly); @@ -1776,12 +1776,12 @@ TEST_F(EnergyPlusFixture, BlankDefrostEIRCurveInput) GetCurveInput(*state); GetDXCoils(*state); - ASSERT_EQ(1, NumDXCoils); - ASSERT_EQ(DXCoil(1).DefrostStrategy, ReverseCycle); - ASSERT_EQ(DXCoil(1).DefrostControl, Timed); - ASSERT_EQ(DXCoil(1).DefrostEIRFT, 1); - ASSERT_EQ(DXCoil(1).MaxOATDefrost, 5.0); - ASSERT_EQ(DXCoil(1).DefrostTime, 0.058333); + ASSERT_EQ(1, state->dataDXCoils->NumDXCoils); + ASSERT_EQ(state->dataDXCoils->DXCoil(1).DefrostStrategy, ReverseCycle); + ASSERT_EQ(state->dataDXCoils->DXCoil(1).DefrostControl, Timed); + ASSERT_EQ(state->dataDXCoils->DXCoil(1).DefrostEIRFT, 1); + ASSERT_EQ(state->dataDXCoils->DXCoil(1).MaxOATDefrost, 5.0); + ASSERT_EQ(state->dataDXCoils->DXCoil(1).DefrostTime, 0.058333); } TEST_F(EnergyPlusFixture, CurveOutputLimitWarning) @@ -1846,7 +1846,7 @@ TEST_F(EnergyPlusFixture, CurveOutputLimitWarning) // TODO: FIXME: Should this still have cerr output? // EXPECT_TRUE( has_cerr_output() ); // capacity as a function of temperature inputs will give output above 1.0 +- 10% and trip warning message - Real64 CurveVal = CurveValue(*state, DXCoil(1).CCapFTemp(1), RatedInletWetBulbTemp, RatedOutdoorAirTemp); + Real64 CurveVal = CurveValue(*state, state->dataDXCoils->DXCoil(1).CCapFTemp(1), RatedInletWetBulbTemp, RatedOutdoorAirTemp); ASSERT_EQ(CurveVal, 1.1001); // anything over 1.1 will trip warning message for capacity as a function of temperature } @@ -1947,8 +1947,8 @@ TEST_F(EnergyPlusFixture, CoilHeatingDXSingleSpeed_MinOADBTempCompOperLimit) ProcessScheduleInput(*state); GetDXCoils(*state); - ASSERT_EQ("HEATING COIL SINGLESPEED", DXCoil(1).Name); // Heating Coil Single Speed - ASSERT_EQ(-30.0, DXCoil(1).MinOATCompressor); // removed the minimum limit of -20.0C + ASSERT_EQ("HEATING COIL SINGLESPEED", state->dataDXCoils->DXCoil(1).Name); // Heating Coil Single Speed + ASSERT_EQ(-30.0, state->dataDXCoils->DXCoil(1).MinOATCompressor); // removed the minimum limit of -20.0C } TEST_F(EnergyPlusFixture, CoilCoolingDXTwoSpeed_MinOADBTempCompOperLimit) @@ -2056,8 +2056,8 @@ TEST_F(EnergyPlusFixture, CoilCoolingDXTwoSpeed_MinOADBTempCompOperLimit) ProcessScheduleInput(*state); GetDXCoils(*state); - ASSERT_EQ("MAIN COOLING COIL 1", DXCoil(1).Name); // Cooling Coil Two Speed - ASSERT_EQ(-25.0, DXCoil(1).MinOATCompressor); // use default value at -25C + ASSERT_EQ("MAIN COOLING COIL 1", state->dataDXCoils->DXCoil(1).Name); // Cooling Coil Two Speed + ASSERT_EQ(-25.0, state->dataDXCoils->DXCoil(1).MinOATCompressor); // use default value at -25C } TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) @@ -2176,7 +2176,7 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) ScheduleManager::ProcessScheduleInput(*state); DXCoils::GetDXCoils(*state); - EXPECT_EQ(1, DXCoils::NumDXCoils); + EXPECT_EQ(1, state->dataDXCoils->NumDXCoils); DataSizing::CurZoneEqNum = 0; DataSizing::CurOASysNum = 0; @@ -2220,33 +2220,33 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) // SizeDXCoil is the one doing the sizing AND the reporting DXCoils::SizeDXCoil(*state, 1); // Ensure we have a RatedTotCap size to begin with - Real64 ratedTotCap = DXCoils::DXCoil(1).RatedTotCap(1); + Real64 ratedTotCap = state->dataDXCoils->DXCoil(1).RatedTotCap(1); EXPECT_GT(ratedTotCap, 0.0); // High Speed Condenser Air Flow = RatedTotCap * 0.000114 m3/s/W (850 CFM/ton) - Real64 highSpeedCondAirFlow = DXCoils::DXCoil(1).RatedTotCap(1) * 0.000114; - EXPECT_NEAR(highSpeedCondAirFlow, DXCoils::DXCoil(1).EvapCondAirFlow(1), 0.1); + Real64 highSpeedCondAirFlow = state->dataDXCoils->DXCoil(1).RatedTotCap(1) * 0.000114; + EXPECT_NEAR(highSpeedCondAirFlow, state->dataDXCoils->DXCoil(1).EvapCondAirFlow(1), 0.1); // Low Speed Condenser Air Flow: 1/3 Total Capacity * 0.000114 m3/s/w (850 cfm/ton) - Real64 lowSpeedCondAirFlow = DXCoils::DXCoil(1).RatedTotCap(1) * 0.000114 * 0.3333; - EXPECT_NEAR(lowSpeedCondAirFlow, DXCoils::DXCoil(1).EvapCondAirFlow2, 0.1); + Real64 lowSpeedCondAirFlow = state->dataDXCoils->DXCoil(1).RatedTotCap(1) * 0.000114 * 0.3333; + EXPECT_NEAR(lowSpeedCondAirFlow, state->dataDXCoils->DXCoil(1).EvapCondAirFlow2, 0.1); // High Speed Condenser Pump Power = Total Capacity * 0.004266 W/W (15 W/ton) - Real64 highSpeedCondPumpPower = DXCoils::DXCoil(1).RatedTotCap(1) * 0.004266; - EXPECT_NEAR(highSpeedCondPumpPower, DXCoils::DXCoil(1).EvapCondPumpElecNomPower(1), 0.1); + Real64 highSpeedCondPumpPower = state->dataDXCoils->DXCoil(1).RatedTotCap(1) * 0.004266; + EXPECT_NEAR(highSpeedCondPumpPower, state->dataDXCoils->DXCoil(1).EvapCondPumpElecNomPower(1), 0.1); // Low Speed Condenser Pump Power = Total Capacity * 0.004266 W/W (15 W/ton) * 1/3 - Real64 lowSpeedCondPumpPower = DXCoils::DXCoil(1).RatedTotCap(1) * 0.004266 * 0.3333; - EXPECT_NEAR(lowSpeedCondPumpPower, DXCoils::DXCoil(1).EvapCondPumpElecNomPower2, 0.1); + Real64 lowSpeedCondPumpPower = state->dataDXCoils->DXCoil(1).RatedTotCap(1) * 0.004266 * 0.3333; + EXPECT_NEAR(lowSpeedCondPumpPower, state->dataDXCoils->DXCoil(1).EvapCondPumpElecNomPower2, 0.1); // Write the EIO Table we need // We actually don't need this because ReportSizerOutput also outputs to the "ComponentSizes" table // OutputReportTabular::WriteEioTables(); // Now check output tables / EIO - const std::string compType = DXCoils::DXCoil(1).DXCoilType; + const std::string compType = state->dataDXCoils->DXCoil(1).DXCoilType; EXPECT_EQ(compType, "Coil:Cooling:DX:TwoSpeed"); - const std::string compName = DXCoils::DXCoil(1).Name; + const std::string compName = state->dataDXCoils->DXCoil(1).Name; EXPECT_EQ(compName, "MAIN COOLING COIL 1"); struct TestQuery @@ -2401,7 +2401,7 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_SingleSpeed) ScheduleManager::ProcessScheduleInput(*state); DXCoils::GetDXCoils(*state); - EXPECT_EQ(1, DXCoils::NumDXCoils); + EXPECT_EQ(1, state->dataDXCoils->NumDXCoils); // All of this is to basically manage to get RatedTotCap to be autosized DataSizing::CurZoneEqNum = 0; @@ -2445,25 +2445,25 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_SingleSpeed) // SizeDXCoil is the one doing the sizing AND the reporting DXCoils::SizeDXCoil(*state, 1); // Ensure we have a RatedTotCap size to begin with - Real64 ratedTotCap = DXCoils::DXCoil(1).RatedTotCap(1); + Real64 ratedTotCap = state->dataDXCoils->DXCoil(1).RatedTotCap(1); EXPECT_GT(ratedTotCap, 0.0); // Condenser Air Flow = RatedTotCap * 0.000114 m3/s/W (850 CFM/ton) - Real64 condAirFlow = DXCoils::DXCoil(1).RatedTotCap(1) * 0.000114; - EXPECT_NEAR(condAirFlow, DXCoils::DXCoil(1).EvapCondAirFlow(1), 0.1); + Real64 condAirFlow = state->dataDXCoils->DXCoil(1).RatedTotCap(1) * 0.000114; + EXPECT_NEAR(condAirFlow, state->dataDXCoils->DXCoil(1).EvapCondAirFlow(1), 0.1); // Condenser Pump Power = Total Capacity * 0.004266 W/W (15 W/ton) - Real64 condPumpPower = DXCoils::DXCoil(1).RatedTotCap(1) * 0.004266; - EXPECT_NEAR(condPumpPower, DXCoils::DXCoil(1).EvapCondPumpElecNomPower(1), 0.1); + Real64 condPumpPower = state->dataDXCoils->DXCoil(1).RatedTotCap(1) * 0.004266; + EXPECT_NEAR(condPumpPower, state->dataDXCoils->DXCoil(1).EvapCondPumpElecNomPower(1), 0.1); // Write the EIO Table we need // We actually don't need this because ReportSizerOutput also outputs to the "ComponentSizes" table // OutputReportTabular::WriteEioTables(); // Now check output tables / EIO - const std::string compType = DXCoils::DXCoil(1).DXCoilType; + const std::string compType = state->dataDXCoils->DXCoil(1).DXCoilType; EXPECT_EQ(compType, "Coil:Cooling:DX:SingleSpeed"); - const std::string compName = DXCoils::DXCoil(1).Name; + const std::string compName = state->dataDXCoils->DXCoil(1).Name; EXPECT_EQ(compName, "FURNACE ACDXCOIL 1"); struct TestQuery @@ -2887,22 +2887,22 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedHeatingCoilSizingOutput) GetDXCoils(*state); SetPredefinedTables(*state); // check multi-speed DX cooling coil - EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); - EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); + EXPECT_EQ("ASHP CLG COIL", state->dataDXCoils->DXCoil(1).Name); + EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", state->dataDXCoils->DXCoil(1).DXCoilType); SizeDXCoil(*state, 1); - EXPECT_EQ(14067.4113682534, DXCoil(1).MSRatedTotCap(2)); - EXPECT_EQ(10128.5361851424, DXCoil(1).MSRatedTotCap(1)); - EXPECT_EQ(0.649588460819866, DXCoil(1).MSRatedAirVolFlowRate(2)); - EXPECT_EQ(0.558646076305085, DXCoil(1).MSRatedAirVolFlowRate(1)); + EXPECT_EQ(14067.4113682534, state->dataDXCoils->DXCoil(1).MSRatedTotCap(2)); + EXPECT_EQ(10128.5361851424, state->dataDXCoils->DXCoil(1).MSRatedTotCap(1)); + EXPECT_EQ(0.649588460819866, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.558646076305085, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1)); // check multi-speed DX heating coil - EXPECT_EQ("ASHP HTG COIL", DXCoil(2).Name); - EXPECT_EQ("Coil:Heating:DX:MultiSpeed", DXCoil(2).DXCoilType); + EXPECT_EQ("ASHP HTG COIL", state->dataDXCoils->DXCoil(2).Name); + EXPECT_EQ("Coil:Heating:DX:MultiSpeed", state->dataDXCoils->DXCoil(2).DXCoilType); SizeDXCoil(*state, 2); - EXPECT_EQ(14067.4113682534, DXCoil(2).MSRatedTotCap(2)); - EXPECT_EQ(10128.5361851424, DXCoil(2).MSRatedTotCap(1)); - EXPECT_EQ(0.664879557979531, DXCoil(2).MSRatedAirVolFlowRate(2)); - EXPECT_EQ(0.531903646383625, DXCoil(2).MSRatedAirVolFlowRate(1)); + EXPECT_EQ(14067.4113682534, state->dataDXCoils->DXCoil(2).MSRatedTotCap(2)); + EXPECT_EQ(10128.5361851424, state->dataDXCoils->DXCoil(2).MSRatedTotCap(1)); + EXPECT_EQ(0.664879557979531, state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.531903646383625, state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(1)); } TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilTabularReporting) { @@ -3103,8 +3103,8 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilTabularReporting) // Setup the predefined tables EnergyPlus::OutputReportPredefined::SetPredefinedTables(*state); // check multi-speed DX cooling coil - EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); - EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); + EXPECT_EQ("ASHP CLG COIL", state->dataDXCoils->DXCoil(1).Name); + EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", state->dataDXCoils->DXCoil(1).DXCoilType); // coils are in an airloop DataSizing::CurSysNum = 1; UnitarySysEqSizing.allocate(CurSysNum); @@ -3112,18 +3112,18 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilTabularReporting) UnitarySysEqSizing(CurSysNum).HeatingCapacity = false; // coil sizing SizeDXCoil(*state, 1); - EXPECT_EQ(14067.4113682534, DXCoil(1).MSRatedTotCap(2)); - EXPECT_EQ(10128.5361851424, DXCoil(1).MSRatedTotCap(1)); - EXPECT_EQ(0.649588460819866, DXCoil(1).MSRatedAirVolFlowRate(2)); - EXPECT_EQ(0.558646076305085, DXCoil(1).MSRatedAirVolFlowRate(1)); + EXPECT_EQ(14067.4113682534, state->dataDXCoils->DXCoil(1).MSRatedTotCap(2)); + EXPECT_EQ(10128.5361851424, state->dataDXCoils->DXCoil(1).MSRatedTotCap(1)); + EXPECT_EQ(0.649588460819866, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.558646076305085, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1)); // check multi-speed DX cooling coil rated capacity - EXPECT_EQ(14067.4113682534, DXCoil(1).RatedTotCap(1)); - EXPECT_EQ(0.727729571918817, DXCoil(1).RatedSHR(1)); - Real64 RatedSensCapacity = DXCoil(1).RatedTotCap(1) * DXCoil(1).RatedSHR(1); + EXPECT_EQ(14067.4113682534, state->dataDXCoils->DXCoil(1).RatedTotCap(1)); + EXPECT_EQ(0.727729571918817, state->dataDXCoils->DXCoil(1).RatedSHR(1)); + Real64 RatedSensCapacity = state->dataDXCoils->DXCoil(1).RatedTotCap(1) * state->dataDXCoils->DXCoil(1).RatedSHR(1); EXPECT_EQ(10237.271253024948, RatedSensCapacity); // check tabular outputs - PreDefTableEntry(*state, state->dataOutRptPredefined->pdch2CoilFinalTotalCap, "Coil Final Gross Total Capacity [W]", DXCoil(1).RatedTotCap(1), 3); - PreDefTableEntry(*state, state->dataOutRptPredefined->pdch2CoilFinalSensCap, "Coil Final Gross Sensible Capacity [W]", DXCoil(1).RatedTotCap(1) * DXCoil(1).RatedSHR(1), 3); + PreDefTableEntry(*state, state->dataOutRptPredefined->pdch2CoilFinalTotalCap, "Coil Final Gross Total Capacity [W]", state->dataDXCoils->DXCoil(1).RatedTotCap(1), 3); + PreDefTableEntry(*state, state->dataOutRptPredefined->pdch2CoilFinalSensCap, "Coil Final Gross Sensible Capacity [W]", state->dataDXCoils->DXCoil(1).RatedTotCap(1) * state->dataDXCoils->DXCoil(1).RatedSHR(1), 3); EXPECT_EQ("14067.411", RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdch2CoilFinalTotalCap, "Coil Final Gross Total Capacity [W]")); EXPECT_EQ("10237.271", RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdch2CoilFinalSensCap, "Coil Final Gross Sensible Capacity [W]")); } @@ -3506,8 +3506,8 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) GetDXCoils(*state); SetPredefinedTables(*state); // check multi-speed DX cooling coil - EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); - EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); + EXPECT_EQ("ASHP CLG COIL", state->dataDXCoils->DXCoil(1).Name); + EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", state->dataDXCoils->DXCoil(1).DXCoilType); state->dataEnvrn->StdBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.2; @@ -3539,24 +3539,24 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) SizeDXCoil(*state, 1); // Design flow rate at speed 2 and speed 1 - EXPECT_EQ(1.75, DXCoil(1).MSRatedAirVolFlowRate(2)); - EXPECT_EQ(0.875, DXCoil(1).MSRatedAirVolFlowRate(2) * 0.5); - EXPECT_EQ(0.875, DXCoil(1).MSRatedAirVolFlowRate(1)); + EXPECT_EQ(1.75, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.875, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2) * 0.5); + EXPECT_EQ(0.875, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1)); // Design Capacity at speed 2 and speed 1 - EXPECT_NEAR(31888.0, DXCoil(1).MSRatedTotCap(2), 0.01); - EXPECT_NEAR(15944.0, DXCoil(1).MSRatedTotCap(1), 0.01); + EXPECT_NEAR(31888.0, state->dataDXCoils->DXCoil(1).MSRatedTotCap(2), 0.01); + EXPECT_NEAR(15944.0, state->dataDXCoils->DXCoil(1).MSRatedTotCap(1), 0.01); // check multi-speed DX heating coil - EXPECT_EQ("ASHP HTG COIL", DXCoil(2).Name); - EXPECT_EQ("Coil:Heating:DX:MultiSpeed", DXCoil(2).DXCoilType); + EXPECT_EQ("ASHP HTG COIL", state->dataDXCoils->DXCoil(2).Name); + EXPECT_EQ("Coil:Heating:DX:MultiSpeed", state->dataDXCoils->DXCoil(2).DXCoilType); // set companion dx cooling coil - DXCoil(2).CompanionUpstreamDXCoil = 1; + state->dataDXCoils->DXCoil(2).CompanionUpstreamDXCoil = 1; SizeDXCoil(*state, 2); - EXPECT_EQ(1.75, DXCoil(2).MSRatedAirVolFlowRate(2)); - EXPECT_EQ(0.875, DXCoil(2).MSRatedAirVolFlowRate(2) * 0.5); - EXPECT_EQ(0.875, DXCoil(2).MSRatedAirVolFlowRate(1)); - EXPECT_NEAR(31888.0, DXCoil(2).MSRatedTotCap(2), 0.01); - EXPECT_NEAR(15944.0, DXCoil(2).MSRatedTotCap(1), 0.01); + EXPECT_EQ(1.75, state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.875, state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(2) * 0.5); + EXPECT_EQ(0.875, state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(1)); + EXPECT_NEAR(31888.0, state->dataDXCoils->DXCoil(2).MSRatedTotCap(2), 0.01); + EXPECT_NEAR(15944.0, state->dataDXCoils->DXCoil(2).MSRatedTotCap(1), 0.01); } TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) @@ -3758,8 +3758,8 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) GetDXCoils(*state); SetPredefinedTables(*state); // check multi-speed DX cooling coil - EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); - EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); + EXPECT_EQ("ASHP CLG COIL", state->dataDXCoils->DXCoil(1).Name); + EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", state->dataDXCoils->DXCoil(1).DXCoilType); state->dataEnvrn->StdBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.2; @@ -3792,32 +3792,32 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) // test SHR design size when all autosized SizeDXCoil(*state, 1); // Design flow rate at speed 2 and speed 1 - EXPECT_EQ(1.75, DXCoil(1).MSRatedAirVolFlowRate(2)); - EXPECT_EQ(0.875, DXCoil(1).MSRatedAirVolFlowRate(2) * 0.5); - EXPECT_EQ(0.875, DXCoil(1).MSRatedAirVolFlowRate(1)); + EXPECT_EQ(1.75, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.875, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2) * 0.5); + EXPECT_EQ(0.875, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1)); // Design Capacity at speed 2 and speed 1 - EXPECT_NEAR(31888.0, DXCoil(1).MSRatedTotCapDes(2), 0.01); - EXPECT_NEAR(31888.0, DXCoil(1).MSRatedTotCap(2), 0.01); - EXPECT_NEAR(15944.0, DXCoil(1).MSRatedTotCap(1), 0.01); + EXPECT_NEAR(31888.0, state->dataDXCoils->DXCoil(1).MSRatedTotCapDes(2), 0.01); + EXPECT_NEAR(31888.0, state->dataDXCoils->DXCoil(1).MSRatedTotCap(2), 0.01); + EXPECT_NEAR(15944.0, state->dataDXCoils->DXCoil(1).MSRatedTotCap(1), 0.01); // Design SHR at speed 2 and speed 1 - EXPECT_NEAR(0.80099, DXCoil(1).MSRatedSHR(2), 0.00001); - EXPECT_NEAR(0.80099, DXCoil(1).MSRatedSHR(1), 0.00001); + EXPECT_NEAR(0.80099, state->dataDXCoils->DXCoil(1).MSRatedSHR(2), 0.00001); + EXPECT_NEAR(0.80099, state->dataDXCoils->DXCoil(1).MSRatedSHR(1), 0.00001); // test SHR design size when partial autosizing (capacity is hardsized) - DXCoil(1).MSRatedTotCap(1) = 17500.0; // DataSizing::AutoSize; - DXCoil(1).MSRatedTotCap(2) = 35000.0; // DataSizing::AutoSize; + state->dataDXCoils->DXCoil(1).MSRatedTotCap(1) = 17500.0; // DataSizing::AutoSize; + state->dataDXCoils->DXCoil(1).MSRatedTotCap(2) = 35000.0; // DataSizing::AutoSize; SizeDXCoil(*state, 1); // Design size SHR at speed 2 and speed 1 - EXPECT_NEAR(0.80099, DXCoil(1).MSRatedSHR(2), 0.00001); - EXPECT_NEAR(0.80099, DXCoil(1).MSRatedSHR(1), 0.00001); + EXPECT_NEAR(0.80099, state->dataDXCoils->DXCoil(1).MSRatedSHR(2), 0.00001); + EXPECT_NEAR(0.80099, state->dataDXCoils->DXCoil(1).MSRatedSHR(1), 0.00001); // Design Capacity at speed 2 and speed 1 - EXPECT_NEAR(31888.0, DXCoil(1).MSRatedTotCapDes(2), 0.01); - EXPECT_EQ(35000.0, DXCoil(1).MSRatedTotCap(2)); - EXPECT_EQ(35000.0 * 0.5, DXCoil(1).MSRatedTotCap(1)); + EXPECT_NEAR(31888.0, state->dataDXCoils->DXCoil(1).MSRatedTotCapDes(2), 0.01); + EXPECT_EQ(35000.0, state->dataDXCoils->DXCoil(1).MSRatedTotCap(2)); + EXPECT_EQ(35000.0 * 0.5, state->dataDXCoils->DXCoil(1).MSRatedTotCap(1)); // Design flow rate at speed 2 and speed 1 - EXPECT_EQ(1.75, DXCoil(1).MSRatedAirVolFlowRate(2)); - EXPECT_EQ(0.875, DXCoil(1).MSRatedAirVolFlowRate(1)); + EXPECT_EQ(1.75, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.875, state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1)); } TEST_F(EnergyPlusFixture, DXCoils_GetDXCoilCapFTCurveIndexTest) @@ -3825,17 +3825,17 @@ TEST_F(EnergyPlusFixture, DXCoils_GetDXCoilCapFTCurveIndexTest) int DXCoilNum; int CurveNum; - NumDXCoils = 2; - DXCoil.allocate(NumDXCoils); - DXCoil(1).DXCoilType_Num = CoilDX_MultiSpeedCooling; - DXCoil(1).DXCoilType = "Coil:Cooling:DX:MultiSpeed"; - DXCoil(2).DXCoilType_Num = CoilDX_MultiSpeedHeating; - DXCoil(2).DXCoilType = "Coil:Heating:DX:MultiSpeed"; + state->dataDXCoils->NumDXCoils = 2; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(1).DXCoilType_Num = CoilDX_MultiSpeedCooling; + state->dataDXCoils->DXCoil(1).DXCoilType = "Coil:Cooling:DX:MultiSpeed"; + state->dataDXCoils->DXCoil(2).DXCoilType_Num = CoilDX_MultiSpeedHeating; + state->dataDXCoils->DXCoil(2).DXCoilType = "Coil:Heating:DX:MultiSpeed"; for (DXCoilNum = 1; DXCoilNum <= 2; ++DXCoilNum) { - DXCoil(DXCoilNum).NumOfSpeeds = 2; - DXCoil(DXCoilNum).MSRatedTotCap.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSCCapFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds = 2; + state->dataDXCoils->DXCoil(DXCoilNum).MSRatedTotCap.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); } state->dataCurveManager->NumCurves = 4; @@ -3905,21 +3905,21 @@ TEST_F(EnergyPlusFixture, DXCoils_GetDXCoilCapFTCurveIndexTest) state->dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; - DXCoil(1).MSCCapFTemp(1) = 1; - DXCoil(1).MSCCapFTemp(2) = 2; + state->dataDXCoils->DXCoil(1).MSCCapFTemp(1) = 1; + state->dataDXCoils->DXCoil(1).MSCCapFTemp(2) = 2; DXCoilNum = 2; - DXCoil(DXCoilNum).MSCCapFTemp(1) = 3; - DXCoil(DXCoilNum).MSCCapFTemp(2) = 4; + state->dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(1) = 3; + state->dataDXCoils->DXCoil(DXCoilNum).MSCCapFTemp(2) = 4; bool ErrorsFound; int DataTotCapCurveIndex = 0; - DXCoils::GetCoilsInputFlag = false; + state->dataDXCoils->GetCoilsInputFlag = false; // dx cooling coil int CoilIndex = 1; - EXPECT_EQ(DXCoil(CoilIndex).DXCoilType, "Coil:Cooling:DX:MultiSpeed"); + EXPECT_EQ(state->dataDXCoils->DXCoil(CoilIndex).DXCoilType, "Coil:Cooling:DX:MultiSpeed"); DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(*state, CoilIndex, ErrorsFound); EXPECT_EQ(2, DataTotCapCurveIndex); // evaluate dx cooling coil curves to show impacts of incorrect curve index @@ -3936,7 +3936,7 @@ TEST_F(EnergyPlusFixture, DXCoils_GetDXCoilCapFTCurveIndexTest) // dx heating coil CoilIndex = 2; - EXPECT_EQ(DXCoil(CoilIndex).DXCoilType, "Coil:Heating:DX:MultiSpeed"); + EXPECT_EQ(state->dataDXCoils->DXCoil(CoilIndex).DXCoilType, "Coil:Heating:DX:MultiSpeed"); DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(*state, CoilIndex, ErrorsFound); EXPECT_EQ(4, DataTotCapCurveIndex); // evaluate dx heating coil curves to show impacts of incorrect curve index @@ -3963,22 +3963,22 @@ TEST_F(EnergyPlusFixture, DXCoils_RatedInletAirWTest) TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) { int DXCoilNum(1); - DXCoils::NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; state->dataCurveManager->NumCurves = 2; - DXCoil.allocate(DXCoils::NumDXCoils); + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); DataLoopNode::Node.allocate(2); - DXCoilNumericFields.allocate(DXCoils::NumDXCoils); - DXCoilNumericFields(DXCoils::NumDXCoils).PerfMode.allocate(1); - DXCoilNumericFields(DXCoils::NumDXCoils).PerfMode(1).FieldNames.allocate(20); - DataHeatBalance::HeatReclaimDXCoil.allocate(DXCoils::NumDXCoils); - DXCoilOutletTemp.allocate(DXCoils::NumDXCoils); - DXCoilOutletHumRat.allocate(DXCoils::NumDXCoils); - DXCoilFullLoadOutAirTemp.allocate(DXCoils::NumDXCoils); - DXCoilFullLoadOutAirHumRat.allocate(DXCoils::NumDXCoils); - DXCoilPartLoadRatio.allocate(DXCoils::NumDXCoils); - DXCoilFanOpMode.allocate(DXCoils::NumDXCoils); + state->dataDXCoils->DXCoilNumericFields.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilNumericFields(state->dataDXCoils->NumDXCoils).PerfMode.allocate(1); + state->dataDXCoils->DXCoilNumericFields(state->dataDXCoils->NumDXCoils).PerfMode(1).FieldNames.allocate(20); + DataHeatBalance::HeatReclaimDXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilOutletTemp.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilOutletHumRat.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilFullLoadOutAirTemp.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilFullLoadOutAirHumRat.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilFanOpMode.allocate(state->dataDXCoils->NumDXCoils); state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); - auto &Coil = DXCoils::DXCoil(DXCoilNum); + auto &Coil = state->dataDXCoils->DXCoil(DXCoilNum); auto &constantcurve1 = state->dataCurveManager->PerfCurve(1); auto &constantcurve2 = state->dataCurveManager->PerfCurve(2); auto &AirInletNode = DataLoopNode::Node(1); @@ -4100,23 +4100,23 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) { int DXCoilNum(1); - DXCoils::NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; state->dataCurveManager->NumCurves = 2; DataHVACGlobals::MSHPMassFlowRateLow = 0.6; DataHVACGlobals::MSHPMassFlowRateHigh = 1.0; - DXCoil.allocate(DXCoils::NumDXCoils); + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); DataLoopNode::Node.allocate(2); - DXCoilNumericFields.allocate(DXCoils::NumDXCoils); - DXCoilNumericFields(1).PerfMode.allocate(1); - DXCoilNumericFields(1).PerfMode(1).FieldNames.allocate(17); + state->dataDXCoils->DXCoilNumericFields.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilNumericFields(1).PerfMode.allocate(1); + state->dataDXCoils->DXCoilNumericFields(1).PerfMode(1).FieldNames.allocate(17); DataHeatBalance::HeatReclaimDXCoil.allocate(2); - DXCoilOutletTemp.allocate(1); - DXCoilOutletHumRat.allocate(1); - DXCoilPartLoadRatio.allocate(1); - DXCoilFanOpMode.allocate(1); + state->dataDXCoils->DXCoilOutletTemp.allocate(1); + state->dataDXCoils->DXCoilOutletHumRat.allocate(1); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(1); + state->dataDXCoils->DXCoilFanOpMode.allocate(1); state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); - auto &Coil = DXCoils::DXCoil(1); + auto &Coil = state->dataDXCoils->DXCoil(1); auto &constantcurve1 = state->dataCurveManager->PerfCurve(1); auto &constantcurve2 = state->dataCurveManager->PerfCurve(2); auto &AirInletNode = DataLoopNode::Node(1); diff --git a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc index 4fbd74753ee..8d5c0d809e0 100644 --- a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc +++ b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc @@ -256,35 +256,35 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_GetInput) GetInputForLifeCycleCost(*state); - EXPECT_EQ(disConvEndOfYear, discountConvension); - EXPECT_EQ(inflAppConstantDollar, inflationApproach); - EXPECT_EQ(0.03, realDiscountRate); - EXPECT_EQ(1, baseDateMonth); - EXPECT_EQ(2012, baseDateYear); - EXPECT_EQ(22 * 12, lengthStudyTotalMonths); - - EXPECT_EQ(5, numNonrecurringCost); - EXPECT_EQ("RESIDUALVALUE", NonrecurringCost(5).name); - EXPECT_EQ(costCatSalvage, NonrecurringCost(5).category); - EXPECT_EQ(startBasePeriod, NonrecurringCost(5).startOfCosts); - EXPECT_EQ(-20000., NonrecurringCost(5).cost); - - EXPECT_EQ(1, numRecurringCosts); - EXPECT_EQ("ANNUALMAINT", RecurringCosts(1).name); - EXPECT_EQ(costCatMaintenance, RecurringCosts(1).category); - EXPECT_EQ(7000., RecurringCosts(1).cost); - EXPECT_EQ(startServicePeriod, RecurringCosts(1).startOfCosts); - EXPECT_EQ(1, RecurringCosts(1).repeatPeriodYears); - - EXPECT_EQ(3, numUsePriceEscalation); - EXPECT_EQ("MIDWEST COMMERCIAL-NATURAL GAS", UsePriceEscalation(3).name); - EXPECT_EQ(2012, UsePriceEscalation(3).escalationStartYear); - EXPECT_EQ(1.1321, UsePriceEscalation(3).Escalation(11)); - EXPECT_EQ(1.2818, UsePriceEscalation(3).Escalation(21)); - - EXPECT_EQ(1, numUseAdjustment); - EXPECT_EQ("NOELECTRICUSEADJUSTMENT", UseAdjustment(1).name); - EXPECT_EQ(1.0, UseAdjustment(1).Adjustment(1)); + EXPECT_EQ(iDiscConv::EndOfYear, state->dataEconLifeCycleCost->discountConvention); + EXPECT_EQ(iInflAppr::ConstantDollar, state->dataEconLifeCycleCost->inflationApproach); + EXPECT_EQ(0.03, state->dataEconLifeCycleCost->realDiscountRate); + EXPECT_EQ(1, state->dataEconLifeCycleCost->baseDateMonth); + EXPECT_EQ(2012, state->dataEconLifeCycleCost->baseDateYear); + EXPECT_EQ(22 * 12, state->dataEconLifeCycleCost->lengthStudyTotalMonths); + + EXPECT_EQ(5, state->dataEconLifeCycleCost->numNonrecurringCost); + EXPECT_EQ("RESIDUALVALUE", state->dataEconLifeCycleCost->NonrecurringCost(5).name); + EXPECT_EQ(costCatSalvage, state->dataEconLifeCycleCost->NonrecurringCost(5).category); + EXPECT_EQ(iStartCosts::BasePeriod, state->dataEconLifeCycleCost->NonrecurringCost(5).startOfCosts); + EXPECT_EQ(-20000., state->dataEconLifeCycleCost->NonrecurringCost(5).cost); + + EXPECT_EQ(1, state->dataEconLifeCycleCost->numRecurringCosts); + EXPECT_EQ("ANNUALMAINT", state->dataEconLifeCycleCost->RecurringCosts(1).name); + EXPECT_EQ(costCatMaintenance, state->dataEconLifeCycleCost->RecurringCosts(1).category); + EXPECT_EQ(7000., state->dataEconLifeCycleCost->RecurringCosts(1).cost); + EXPECT_EQ(iStartCosts::ServicePeriod, state->dataEconLifeCycleCost->RecurringCosts(1).startOfCosts); + EXPECT_EQ(1, state->dataEconLifeCycleCost->RecurringCosts(1).repeatPeriodYears); + + EXPECT_EQ(3, state->dataEconLifeCycleCost->numUsePriceEscalation); + EXPECT_EQ("MIDWEST COMMERCIAL-NATURAL GAS", state->dataEconLifeCycleCost->UsePriceEscalation(3).name); + EXPECT_EQ(2012, state->dataEconLifeCycleCost->UsePriceEscalation(3).escalationStartYear); + EXPECT_EQ(1.1321, state->dataEconLifeCycleCost->UsePriceEscalation(3).Escalation(11)); + EXPECT_EQ(1.2818, state->dataEconLifeCycleCost->UsePriceEscalation(3).Escalation(21)); + + EXPECT_EQ(1, state->dataEconLifeCycleCost->numUseAdjustment); + EXPECT_EQ("NOELECTRICUSEADJUSTMENT", state->dataEconLifeCycleCost->UseAdjustment(1).name); + EXPECT_EQ(1.0, state->dataEconLifeCycleCost->UseAdjustment(1).Adjustment(1)); } TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ProcessMaxInput) @@ -393,97 +393,97 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ProcessMaxInput) GetInputForLifeCycleCost(*state); - EXPECT_EQ(disConvEndOfYear, discountConvension); - EXPECT_EQ(inflAppConstantDollar, inflationApproach); - EXPECT_EQ(0.03, realDiscountRate); - EXPECT_EQ(1, baseDateMonth); - EXPECT_EQ(2012, baseDateYear); - EXPECT_EQ(100 * 12, lengthStudyTotalMonths); - - EXPECT_EQ(3, numUsePriceEscalation); - EXPECT_EQ("MIDWEST COMMERCIAL-NATURAL GAS", UsePriceEscalation(3).name); - EXPECT_EQ(2012, UsePriceEscalation(3).escalationStartYear); - EXPECT_EQ(1.007, UsePriceEscalation(3).Escalation(1)); - EXPECT_EQ(1.008, UsePriceEscalation(3).Escalation(11)); - EXPECT_EQ(1.009, UsePriceEscalation(3).Escalation(21)); - EXPECT_EQ(1.099, UsePriceEscalation(3).Escalation(99)); - EXPECT_EQ(1.100, UsePriceEscalation(3).Escalation(100)); - - EXPECT_EQ(1, numUseAdjustment); - EXPECT_EQ("NOELECTRICUSEADJUSTMENT", UseAdjustment(1).name); - EXPECT_EQ(1.007, UseAdjustment(1).Adjustment(1)); - EXPECT_EQ(1.008, UseAdjustment(1).Adjustment(11)); - EXPECT_EQ(1.009, UseAdjustment(1).Adjustment(21)); - EXPECT_EQ(1.099, UseAdjustment(1).Adjustment(99)); - EXPECT_EQ(1.100, UseAdjustment(1).Adjustment(100)); + EXPECT_EQ(iDiscConv::EndOfYear, state->dataEconLifeCycleCost->discountConvention); + EXPECT_EQ(iInflAppr::ConstantDollar, state->dataEconLifeCycleCost->inflationApproach); + EXPECT_EQ(0.03, state->dataEconLifeCycleCost->realDiscountRate); + EXPECT_EQ(1, state->dataEconLifeCycleCost->baseDateMonth); + EXPECT_EQ(2012, state->dataEconLifeCycleCost->baseDateYear); + EXPECT_EQ(100 * 12, state->dataEconLifeCycleCost->lengthStudyTotalMonths); + + EXPECT_EQ(3, state->dataEconLifeCycleCost->numUsePriceEscalation); + EXPECT_EQ("MIDWEST COMMERCIAL-NATURAL GAS", state->dataEconLifeCycleCost->UsePriceEscalation(3).name); + EXPECT_EQ(2012, state->dataEconLifeCycleCost->UsePriceEscalation(3).escalationStartYear); + EXPECT_EQ(1.007, state->dataEconLifeCycleCost->UsePriceEscalation(3).Escalation(1)); + EXPECT_EQ(1.008, state->dataEconLifeCycleCost->UsePriceEscalation(3).Escalation(11)); + EXPECT_EQ(1.009, state->dataEconLifeCycleCost->UsePriceEscalation(3).Escalation(21)); + EXPECT_EQ(1.099, state->dataEconLifeCycleCost->UsePriceEscalation(3).Escalation(99)); + EXPECT_EQ(1.100, state->dataEconLifeCycleCost->UsePriceEscalation(3).Escalation(100)); + + EXPECT_EQ(1, state->dataEconLifeCycleCost->numUseAdjustment); + EXPECT_EQ("NOELECTRICUSEADJUSTMENT", state->dataEconLifeCycleCost->UseAdjustment(1).name); + EXPECT_EQ(1.007, state->dataEconLifeCycleCost->UseAdjustment(1).Adjustment(1)); + EXPECT_EQ(1.008, state->dataEconLifeCycleCost->UseAdjustment(1).Adjustment(11)); + EXPECT_EQ(1.009, state->dataEconLifeCycleCost->UseAdjustment(1).Adjustment(21)); + EXPECT_EQ(1.099, state->dataEconLifeCycleCost->UseAdjustment(1).Adjustment(99)); + EXPECT_EQ(1.100, state->dataEconLifeCycleCost->UseAdjustment(1).Adjustment(100)); } TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ComputeEscalatedEnergyCosts) { - lengthStudyYears = 5; - - numCashFlow = 1; - CashFlow.allocate(numCashFlow); - CashFlow(1).pvKind = pvkEnergy; - CashFlow(1).Resource = DataGlobalConstants::ResourceType::Electricity; - CashFlow(1).yrAmount.allocate(lengthStudyYears); - CashFlow(1).yrAmount(1) = 100; - CashFlow(1).yrAmount(2) = 110; - CashFlow(1).yrAmount(3) = 120; - CashFlow(1).yrAmount(4) = 130; - CashFlow(1).yrAmount(5) = 140; - - numResourcesUsed = 1; - - for (int year = 1; year <= lengthStudyYears; ++year) { + state->dataEconLifeCycleCost->lengthStudyYears = 5; + + state->dataEconLifeCycleCost->numCashFlow = 1; + state->dataEconLifeCycleCost->CashFlow.allocate(state->dataEconLifeCycleCost->numCashFlow); + state->dataEconLifeCycleCost->CashFlow(1).pvKind = iPrValKind::Energy; + state->dataEconLifeCycleCost->CashFlow(1).Resource = DataGlobalConstants::ResourceType::Electricity; + state->dataEconLifeCycleCost->CashFlow(1).yrAmount.allocate(state->dataEconLifeCycleCost->lengthStudyYears); + state->dataEconLifeCycleCost->CashFlow(1).yrAmount(1) = 100; + state->dataEconLifeCycleCost->CashFlow(1).yrAmount(2) = 110; + state->dataEconLifeCycleCost->CashFlow(1).yrAmount(3) = 120; + state->dataEconLifeCycleCost->CashFlow(1).yrAmount(4) = 130; + state->dataEconLifeCycleCost->CashFlow(1).yrAmount(5) = 140; + + state->dataEconLifeCycleCost->numResourcesUsed = 1; + + for (int year = 1; year <= state->dataEconLifeCycleCost->lengthStudyYears; ++year) { std::map yearMap; for (auto iResource : DataGlobalConstants::AllResourceTypes) { yearMap.insert(std::pair (iResource, 0.0)); } - EscalatedEnergy.insert(std::pair>(year, yearMap)); + state->dataEconLifeCycleCost->EscalatedEnergy.insert(std::pair>(year, yearMap)); } - EscalatedTotEnergy.allocate(lengthStudyYears); - EscalatedTotEnergy = 0.0; - - ComputeEscalatedEnergyCosts(); - EXPECT_NEAR(EscalatedEnergy.at(1).at( DataGlobalConstants::ResourceType::Electricity), 100., 0.001); - EXPECT_NEAR(EscalatedEnergy.at(2).at( DataGlobalConstants::ResourceType::Electricity), 110., 0.001); - EXPECT_NEAR(EscalatedEnergy.at(3).at( DataGlobalConstants::ResourceType::Electricity), 120., 0.001); - EXPECT_NEAR(EscalatedEnergy.at(4).at( DataGlobalConstants::ResourceType::Electricity), 130., 0.001); - EXPECT_NEAR(EscalatedEnergy.at(5).at( DataGlobalConstants::ResourceType::Electricity), 140., 0.001); - - EXPECT_NEAR(EscalatedTotEnergy(1), 100., 0.001); - EXPECT_NEAR(EscalatedTotEnergy(2), 110., 0.001); - EXPECT_NEAR(EscalatedTotEnergy(3), 120., 0.001); - EXPECT_NEAR(EscalatedTotEnergy(4), 130., 0.001); - EXPECT_NEAR(EscalatedTotEnergy(5), 140., 0.001); - - numUsePriceEscalation = 1; - UsePriceEscalation.allocate(numUsePriceEscalation); - UsePriceEscalation(1).resource = DataGlobalConstants::ResourceType::Electricity; - UsePriceEscalation(1).Escalation.allocate(lengthStudyYears); - UsePriceEscalation(1).Escalation(1) = 1.03; - UsePriceEscalation(1).Escalation(2) = 1.05; - UsePriceEscalation(1).Escalation(3) = 1.07; - UsePriceEscalation(1).Escalation(4) = 1.11; - UsePriceEscalation(1).Escalation(5) = 1.15; + state->dataEconLifeCycleCost->EscalatedTotEnergy.allocate(state->dataEconLifeCycleCost->lengthStudyYears); + state->dataEconLifeCycleCost->EscalatedTotEnergy = 0.0; + + ComputeEscalatedEnergyCosts(*state); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(1).at( DataGlobalConstants::ResourceType::Electricity), 100., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(2).at( DataGlobalConstants::ResourceType::Electricity), 110., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(3).at( DataGlobalConstants::ResourceType::Electricity), 120., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(4).at( DataGlobalConstants::ResourceType::Electricity), 130., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(5).at( DataGlobalConstants::ResourceType::Electricity), 140., 0.001); + + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(1), 100., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(2), 110., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(3), 120., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(4), 130., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(5), 140., 0.001); + + state->dataEconLifeCycleCost->numUsePriceEscalation = 1; + state->dataEconLifeCycleCost->UsePriceEscalation.allocate(state->dataEconLifeCycleCost->numUsePriceEscalation); + state->dataEconLifeCycleCost->UsePriceEscalation(1).resource = DataGlobalConstants::ResourceType::Electricity; + state->dataEconLifeCycleCost->UsePriceEscalation(1).Escalation.allocate(state->dataEconLifeCycleCost->lengthStudyYears); + state->dataEconLifeCycleCost->UsePriceEscalation(1).Escalation(1) = 1.03; + state->dataEconLifeCycleCost->UsePriceEscalation(1).Escalation(2) = 1.05; + state->dataEconLifeCycleCost->UsePriceEscalation(1).Escalation(3) = 1.07; + state->dataEconLifeCycleCost->UsePriceEscalation(1).Escalation(4) = 1.11; + state->dataEconLifeCycleCost->UsePriceEscalation(1).Escalation(5) = 1.15; //reset this variable to zero - EscalatedTotEnergy = 0.0; + state->dataEconLifeCycleCost->EscalatedTotEnergy = 0.0; - ComputeEscalatedEnergyCosts(); - EXPECT_NEAR(EscalatedEnergy.at(1).at(DataGlobalConstants::ResourceType::Electricity), 103.0, 0.001); - EXPECT_NEAR(EscalatedEnergy.at(2).at(DataGlobalConstants::ResourceType::Electricity), 115.5, 0.001); - EXPECT_NEAR(EscalatedEnergy.at(3).at(DataGlobalConstants::ResourceType::Electricity), 128.4, 0.001); - EXPECT_NEAR(EscalatedEnergy.at(4).at(DataGlobalConstants::ResourceType::Electricity), 144.3, 0.001); - EXPECT_NEAR(EscalatedEnergy.at(5).at(DataGlobalConstants::ResourceType::Electricity), 161.0, 0.001); + ComputeEscalatedEnergyCosts(*state); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(1).at(DataGlobalConstants::ResourceType::Electricity), 103.0, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(2).at(DataGlobalConstants::ResourceType::Electricity), 115.5, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(3).at(DataGlobalConstants::ResourceType::Electricity), 128.4, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(4).at(DataGlobalConstants::ResourceType::Electricity), 144.3, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedEnergy.at(5).at(DataGlobalConstants::ResourceType::Electricity), 161.0, 0.001); - EXPECT_NEAR(EscalatedTotEnergy(1), 103., 0.001); - EXPECT_NEAR(EscalatedTotEnergy(2), 115.5, 0.001); - EXPECT_NEAR(EscalatedTotEnergy(3), 128.4, 0.001); - EXPECT_NEAR(EscalatedTotEnergy(4), 144.3, 0.001); - EXPECT_NEAR(EscalatedTotEnergy(5), 161.0, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(1), 103., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(2), 115.5, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(3), 128.4, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(4), 144.3, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->EscalatedTotEnergy(5), 161.0, 0.001); } @@ -507,14 +507,14 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_MonthToMonthNumber) TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ExpressAsCashFlows) { - baseDateYear = 2020; - baseDateMonth = 1; + state->dataEconLifeCycleCost->baseDateYear = 2020; + state->dataEconLifeCycleCost->baseDateMonth = 1; - serviceDateYear = 2023; - serviceDateMonth = 1; + state->dataEconLifeCycleCost->serviceDateYear = 2023; + state->dataEconLifeCycleCost->serviceDateMonth = 1; - lengthStudyYears = 5; - lengthStudyTotalMonths = lengthStudyYears * 12; + state->dataEconLifeCycleCost->lengthStudyYears = 5; + state->dataEconLifeCycleCost->lengthStudyTotalMonths = state->dataEconLifeCycleCost->lengthStudyYears * 12; state->dataEconTariff->numTariff = 1; @@ -537,59 +537,59 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ExpressAsCashFlows) state->dataEconTariff->econVar(1).values(11) = 111.; state->dataEconTariff->econVar(1).values(12) = 112.; - numNonrecurringCost = 1; - NonrecurringCost.allocate(1); - NonrecurringCost(1).name = "MiscConstruction"; - NonrecurringCost(1).name = "MiscConstruction"; - NonrecurringCost(1).category = costCatConstruction; - NonrecurringCost(1).cost = 123456.; - NonrecurringCost(1).startOfCosts = startServicePeriod; - NonrecurringCost(1).totalMonthsFromStart = 10; + state->dataEconLifeCycleCost->numNonrecurringCost = 1; + state->dataEconLifeCycleCost->NonrecurringCost.allocate(1); + state->dataEconLifeCycleCost->NonrecurringCost(1).name = "MiscConstruction"; + state->dataEconLifeCycleCost->NonrecurringCost(1).name = "MiscConstruction"; + state->dataEconLifeCycleCost->NonrecurringCost(1).category = costCatConstruction; + state->dataEconLifeCycleCost->NonrecurringCost(1).cost = 123456.; + state->dataEconLifeCycleCost->NonrecurringCost(1).startOfCosts = iStartCosts::ServicePeriod; + state->dataEconLifeCycleCost->NonrecurringCost(1).totalMonthsFromStart = 10; ExpressAsCashFlows(*state); - EXPECT_NEAR(CashFlow(17).mnAmount(47), 123456., 0.001); // 36 months plus 10 months plus one month + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(17).mnAmount(47), 123456., 0.001); // 36 months plus 10 months plus one month // first year - EXPECT_NEAR(CashFlow(18).mnAmount(37), 101., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(38), 102., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(39), 103., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(40), 104., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(41), 105., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(42), 106., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(43), 107., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(44), 108., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(45), 109., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(46), 110., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(47), 111., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(48), 112., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(37), 101., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(38), 102., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(39), 103., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(40), 104., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(41), 105., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(42), 106., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(43), 107., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(44), 108., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(45), 109., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(46), 110., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(47), 111., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(48), 112., 0.001); // second year - EXPECT_NEAR(CashFlow(18).mnAmount(49), 101., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(50), 102., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(51), 103., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(52), 104., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(53), 105., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(54), 106., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(55), 107., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(56), 108., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(57), 109., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(58), 110., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(59), 111., 0.001); - EXPECT_NEAR(CashFlow(18).mnAmount(60), 112., 0.001); - - EXPECT_NEAR(CashFlow(18).yrAmount(4), 1278., 0.001); - EXPECT_NEAR(CashFlow(18).yrAmount(5), 1278., 0.001); - - EXPECT_NEAR(CashFlow(costCatEnergy).yrAmount(4), 1278., 0.001); - EXPECT_NEAR(CashFlow(costCatEnergy).yrAmount(5), 1278., 0.001); - - EXPECT_NEAR(CashFlow(costCatTotEnergy).yrAmount(4), 1278., 0.001); - EXPECT_NEAR(CashFlow(costCatTotEnergy).yrAmount(5), 1278., 0.001); - - EXPECT_NEAR(CashFlow(costCatConstruction).yrAmount(4), 123456, 0.001); - EXPECT_NEAR(CashFlow(costCatTotCaptl).yrAmount(4), 123456, 0.001); - - EXPECT_NEAR(CashFlow(costCatTotGrand).yrAmount(4), 1278. + 123456., 0.001); - EXPECT_NEAR(CashFlow(costCatTotGrand).yrAmount(5), 1278., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(49), 101., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(50), 102., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(51), 103., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(52), 104., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(53), 105., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(54), 106., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(55), 107., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(56), 108., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(57), 109., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(58), 110., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(59), 111., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).mnAmount(60), 112., 0.001); + + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).yrAmount(4), 1278., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(18).yrAmount(5), 1278., 0.001); + + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatEnergy).yrAmount(4), 1278., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatEnergy).yrAmount(5), 1278., 0.001); + + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatTotEnergy).yrAmount(4), 1278., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatTotEnergy).yrAmount(5), 1278., 0.001); + + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatConstruction).yrAmount(4), 123456, 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatTotCaptl).yrAmount(4), 123456, 0.001); + + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatTotGrand).yrAmount(4), 1278. + 123456., 0.001); + EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow(costCatTotGrand).yrAmount(5), 1278., 0.001); } diff --git a/tst/EnergyPlus/unit/HVACControllers.unit.cc b/tst/EnergyPlus/unit/HVACControllers.unit.cc index 8587f63009f..c4513b61833 100644 --- a/tst/EnergyPlus/unit/HVACControllers.unit.cc +++ b/tst/EnergyPlus/unit/HVACControllers.unit.cc @@ -220,7 +220,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) ASSERT_EQ(0, ControllerProps(1).AirLoopControllerIndex); OutputReportPredefined::SetPredefinedTables(*state); - SimAirServingZones::GetAirLoopInputFlag = false; + state->dataSimAirServingZones->GetAirLoopInputFlag = false; DataHVACGlobals::NumPrimaryAirSys = 1; state->dataAirLoop->PriAirSysAvailMgr.allocate(1); state->dataAirLoop->AirLoopControlInfo.allocate(1); @@ -411,7 +411,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnPrimaryLoopCheckTest) ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_Cooling); OutputReportPredefined::SetPredefinedTables(*state); - SimAirServingZones::GetAirLoopInputFlag = false; + state->dataSimAirServingZones->GetAirLoopInputFlag = false; DataHVACGlobals::NumPrimaryAirSys = 1; state->dataAirSystemsData->PrimaryAirSystems.allocate(1); state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; @@ -504,7 +504,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnOutsideAirSystemCheckTest) ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_SimpleHeating); OutputReportPredefined::SetPredefinedTables(*state); - SimAirServingZones::GetAirLoopInputFlag = false; + state->dataSimAirServingZones->GetAirLoopInputFlag = false; state->dataAirLoop->NumOASystems = 1; state->dataAirLoop->OutsideAirSys.allocate(1); @@ -636,7 +636,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CoilSystemCoolingWaterOnOutsideAirSyst ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_DetFlatFinCooling); OutputReportPredefined::SetPredefinedTables(*state); - SimAirServingZones::GetAirLoopInputFlag = false; + state->dataSimAirServingZones->GetAirLoopInputFlag = false; state->dataAirLoop->NumOASystems = 1; state->dataAirLoop->OutsideAirSys.allocate(1); @@ -928,7 +928,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) ASSERT_EQ(0, ControllerProps(1).AirLoopControllerIndex); OutputReportPredefined::SetPredefinedTables(*state); - SimAirServingZones::GetAirLoopInputFlag = false; + state->dataSimAirServingZones->GetAirLoopInputFlag = false; DataHVACGlobals::NumPrimaryAirSys = 1; state->dataAirLoop->PriAirSysAvailMgr.allocate(1); state->dataAirLoop->AirLoopControlInfo.allocate(1); diff --git a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc index abbe3b93549..16355942a6b 100644 --- a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc @@ -1339,10 +1339,10 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) Fans::Fan(2).MaxAirMassFlowRate = DataLoopNode::Node(16).MassFlowRateMaxAvail; Fans::Fan(2).RhoAirStdInit = state->dataEnvrn->StdRhoAir; - DXCoils::DXCoil(2).MSRatedAirMassFlowRate(1) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(1) * state->dataEnvrn->StdRhoAir; - DXCoils::DXCoil(2).MSRatedAirMassFlowRate(2) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(2) * state->dataEnvrn->StdRhoAir; - DXCoils::DXCoil(2).MSRatedCBF(1) = 0.2; - DXCoils::DXCoil(2).MSRatedCBF(2) = 0.2; + state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(1) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(1) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(2) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(2) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(2).MSRatedCBF(1) = 0.2; + state->dataDXCoils->DXCoil(2).MSRatedCBF(2) = 0.2; Real64 QSensUnitOut; // Cooling diff --git a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc index d7cae07225b..8b35207e1e5 100644 --- a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc +++ b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc @@ -193,45 +193,45 @@ class CBVAVSys : public EnergyPlusFixture cbvav.ActualZoneNodeNum.allocate(1); cbvav.ActualZoneNodeNum(1) = 1; cbvav.DXCoolCoilIndexNum = 1; - DXCoils::DXCoil.allocate(1); - DXCoils::DXCoilNumericFields.allocate(1); - DXCoils::DXCoilNumericFields(1).PerfMode.allocate(1); - DXCoils::DXCoilNumericFields(1).PerfMode(1).FieldNames.allocate(20); - DXCoils::DXCoil(1).Name = "MyDXCoolCoil"; - DXCoils::DXCoil(1).DXCoilType = "COIL:COOLING:DX:SINGLESPEED"; - DXCoils::NumDXCoils = 1; - DXCoils::CheckEquipName.dimension(1, true); - DXCoils::GetCoilsInputFlag = false; - DXCoils::DXCoil(1).CCapFFlow.allocate(1); - DXCoils::DXCoil(1).CCapFFlow(1) = 1; - DXCoils::DXCoil(1).CCapFTemp.allocate(1); - DXCoils::DXCoil(1).CCapFTemp(1) = 1; - DXCoils::DXCoil(1).EIRFFlow.allocate(1); - DXCoils::DXCoil(1).EIRFFlow(1) = 1; - DXCoils::DXCoil(1).EIRFTemp.allocate(1); - DXCoils::DXCoil(1).EIRFTemp(1) = 1; - DXCoils::DXCoil(1).PLFFPLR.allocate(1); - DXCoils::DXCoil(1).PLFFPLR(1) = 1; - DXCoils::DXCoilFullLoadOutAirTemp.allocate(1); - DXCoils::DXCoilFullLoadOutAirHumRat.allocate(1); - DXCoils::DXCoil(1).RatedAirVolFlowRate.allocate(1); - DXCoils::DXCoil(1).RatedAirVolFlowRate(1) = 0.5; - DXCoils::DXCoil(1).RatedTotCap.allocate(1); - DXCoils::DXCoil(1).RatedTotCap(1) = 10000.0; - DXCoils::DXCoil(1).RatedCOP(1) = 3.3333; - DXCoils::DXCoil(1).RatedEIR.allocate(1); - DXCoils::DXCoil(1).RatedEIR(1) = 0.3; - DXCoils::DXCoil(1).RatedSHR.allocate(1); - DXCoils::DXCoil(1).RatedSHR(1) = 0.7; - DXCoils::DXCoil(1).SchedPtr = -1; - DXCoils::DXCoilOutletTemp.allocate(1); - DXCoils::DXCoilOutletHumRat.allocate(1); - DXCoils::DXCoilPartLoadRatio.allocate(1); - DXCoils::DXCoilFanOpMode.allocate(1); + state->dataDXCoils->DXCoil.allocate(1); + state->dataDXCoils->DXCoilNumericFields.allocate(1); + state->dataDXCoils->DXCoilNumericFields(1).PerfMode.allocate(1); + state->dataDXCoils->DXCoilNumericFields(1).PerfMode(1).FieldNames.allocate(20); + state->dataDXCoils->DXCoil(1).Name = "MyDXCoolCoil"; + state->dataDXCoils->DXCoil(1).DXCoilType = "COIL:COOLING:DX:SINGLESPEED"; + state->dataDXCoils->NumDXCoils = 1; + state->dataDXCoils->CheckEquipName.dimension(1, true); + state->dataDXCoils->GetCoilsInputFlag = false; + state->dataDXCoils->DXCoil(1).CCapFFlow.allocate(1); + state->dataDXCoils->DXCoil(1).CCapFFlow(1) = 1; + state->dataDXCoils->DXCoil(1).CCapFTemp.allocate(1); + state->dataDXCoils->DXCoil(1).CCapFTemp(1) = 1; + state->dataDXCoils->DXCoil(1).EIRFFlow.allocate(1); + state->dataDXCoils->DXCoil(1).EIRFFlow(1) = 1; + state->dataDXCoils->DXCoil(1).EIRFTemp.allocate(1); + state->dataDXCoils->DXCoil(1).EIRFTemp(1) = 1; + state->dataDXCoils->DXCoil(1).PLFFPLR.allocate(1); + state->dataDXCoils->DXCoil(1).PLFFPLR(1) = 1; + state->dataDXCoils->DXCoilFullLoadOutAirTemp.allocate(1); + state->dataDXCoils->DXCoilFullLoadOutAirHumRat.allocate(1); + state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate.allocate(1); + state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1) = 0.5; + state->dataDXCoils->DXCoil(1).RatedTotCap.allocate(1); + state->dataDXCoils->DXCoil(1).RatedTotCap(1) = 10000.0; + state->dataDXCoils->DXCoil(1).RatedCOP(1) = 3.3333; + state->dataDXCoils->DXCoil(1).RatedEIR.allocate(1); + state->dataDXCoils->DXCoil(1).RatedEIR(1) = 0.3; + state->dataDXCoils->DXCoil(1).RatedSHR.allocate(1); + state->dataDXCoils->DXCoil(1).RatedSHR(1) = 0.7; + state->dataDXCoils->DXCoil(1).SchedPtr = -1; + state->dataDXCoils->DXCoilOutletTemp.allocate(1); + state->dataDXCoils->DXCoilOutletHumRat.allocate(1); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(1); + state->dataDXCoils->DXCoilFanOpMode.allocate(1); DataHeatBalance::HeatReclaimDXCoil.allocate(1); cbvav.DXCoolCoilName = "MyDXCoolCoil"; - DXCoils::DXCoil(1).DXCoilType_Num = DataHVACGlobals::CoilDX_CoolingSingleSpeed; + state->dataDXCoils->DXCoil(1).DXCoilType_Num = DataHVACGlobals::CoilDX_CoolingSingleSpeed; HeatingCoils::HeatingCoil.allocate(1); HeatingCoils::HeatingCoilNumericFields.allocate(1); HeatingCoils::HeatingCoilNumericFields(1).FieldNames.allocate(20); @@ -269,10 +269,10 @@ class CBVAVSys : public EnergyPlusFixture MixedAir::OAMixer(1).RelNode = 4; MixedAir::OAMixer(1).RetNode = 6; MixedAir::OAMixer(1).MixNode = 7; - DXCoils::DXCoil(1).AirInNode = 7; - cbvav.DXCoilInletNode = DXCoils::DXCoil(1).AirInNode; - DXCoils::DXCoil(1).AirOutNode = 8; - cbvav.DXCoilOutletNode = DXCoils::DXCoil(1).AirOutNode; + state->dataDXCoils->DXCoil(1).AirInNode = 7; + 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; @@ -732,8 +732,8 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_AutoSize) cbvav.HeatOutAirVolFlow = DataSizing::AutoSize; cbvav.NoCoolHeatOutAirVolFlow = DataSizing::AutoSize; HeatingCoils::HeatingCoil(1).NominalCapacity = DataSizing::AutoSize; - DXCoils::DXCoil(1).RatedAirVolFlowRate(1) = DataSizing::AutoSize; - DXCoils::DXCoil(1).RatedTotCap(1) = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1) = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(1).RatedTotCap(1) = DataSizing::AutoSize; cbvav.OpMode = DataHVACGlobals::CycFanCycCoil; // must set one type of fan operating mode to initialize CalcSetPointTempTarget DataLoopNode::Node(cbvav.AirInNode).Temp = 24.0; // initialize inlet node temp used to initialize CalcSetPointTempTarget @@ -752,8 +752,8 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_AutoSize) EXPECT_EQ(cbvav.NoCoolHeatOutAirVolFlow, finalSysSizing.DesOutAirVolFlow); // expect coils to size appropriately based on sizing inputs - EXPECT_EQ(DXCoils::DXCoil(1).RatedAirVolFlowRate(1), finalSysSizing.DesMainVolFlow); - EXPECT_GT(DXCoils::DXCoil(1).RatedTotCap(1), 30000.0); + 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); } diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 9d59e970b3d..60c2e314210 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -51,7 +51,6 @@ #include // C++ Headers -#include #include // ObjexxFCL Headers @@ -66,7 +65,6 @@ #include #include #include -#include #include #include #include @@ -81,7 +79,6 @@ #include #include #include -#include #include #include #include @@ -173,23 +170,23 @@ class AirLoopFixture : public EnergyPlusFixture DataSizing::ZoneHVACSizing.allocate(50); ZoneHVACSizing(1).MaxCoolAirVolFlow = DataSizing::AutoSize; ZoneHVACSizing(1).MaxHeatAirVolFlow = DataSizing::AutoSize; - DXCoils::DXCoil.allocate(10); - DXCoils::DXCoilOutletTemp.allocate(10); - DXCoils::DXCoilOutletHumRat.allocate(10); - DXCoils::DXCoilFullLoadOutAirTemp.allocate(10); - DXCoils::DXCoilFullLoadOutAirHumRat.allocate(10); - DXCoils::DXCoilPartLoadRatio.allocate(10); - DXCoils::DXCoilFanOpMode.allocate(10); - DXCoils::DXCoilTotalCooling.allocate(10); - DXCoils::DXCoilCoolInletAirWBTemp.allocate(10); - DXCoils::DXCoilTotalHeating.allocate(10); - DXCoils::DXCoilHeatInletAirDBTemp.allocate(10); - DXCoils::DXCoilHeatInletAirWBTemp.allocate(10); - - DXCoils::CheckEquipName.allocate(10); - DXCoils::DXCoilNumericFields.allocate(10); + state->dataDXCoils->DXCoil.allocate(10); + state->dataDXCoils->DXCoilOutletTemp.allocate(10); + state->dataDXCoils->DXCoilOutletHumRat.allocate(10); + state->dataDXCoils->DXCoilFullLoadOutAirTemp.allocate(10); + state->dataDXCoils->DXCoilFullLoadOutAirHumRat.allocate(10); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(10); + state->dataDXCoils->DXCoilFanOpMode.allocate(10); + state->dataDXCoils->DXCoilTotalCooling.allocate(10); + state->dataDXCoils->DXCoilCoolInletAirWBTemp.allocate(10); + state->dataDXCoils->DXCoilTotalHeating.allocate(10); + state->dataDXCoils->DXCoilHeatInletAirDBTemp.allocate(10); + state->dataDXCoils->DXCoilHeatInletAirWBTemp.allocate(10); + + state->dataDXCoils->CheckEquipName.allocate(10); + state->dataDXCoils->DXCoilNumericFields.allocate(10); DataHeatBalance::HeatReclaimDXCoil.allocate(10); - DXCoils::NumDXCoils = 10; + state->dataDXCoils->NumDXCoils = 10; MixedAir::OAMixer.allocate(5); DataSizing::NumSysSizInput = 1; DataSizing::SysSizInput.allocate(1); @@ -353,18 +350,18 @@ class AirLoopFixture : public EnergyPlusFixture DataSizing::PlantSizData(2).DeltaT = 5.0; // set up VRF system - int numVRFCond = HVACVariableRefrigerantFlow::NumVRFCond = 1; // total number of condenser units - HVACVariableRefrigerantFlow::VRF.allocate(numVRFCond); - HVACVariableRefrigerantFlow::CoolCombinationRatio.allocate(1); - HVACVariableRefrigerantFlow::HeatCombinationRatio.allocate(1); + int numVRFCond = state->dataHVACVarRefFlow->NumVRFCond = 1; // total number of condenser units + state->dataHVACVarRefFlow->VRF.allocate(numVRFCond); + state->dataHVACVarRefFlow->CoolCombinationRatio.allocate(1); + state->dataHVACVarRefFlow->HeatCombinationRatio.allocate(1); int condNum = 1; - auto &VRFCond(HVACVariableRefrigerantFlow::VRF(condNum)); + auto &VRFCond(state->dataHVACVarRefFlow->VRF(condNum)); int condNodeNum = 1; VRFCond.VRFSystemTypeNum = 1; - VRFCond.VRFAlgorithmTypeNum = 1; + VRFCond.VRFAlgorithmTypeNum = iAlgorithmType::SysCurve; VRFCond.SchedPtr = 1; VRFCond.CoolingCapacity = 10000.0; VRFCond.CoolingCOP = 3.0; @@ -375,29 +372,29 @@ class AirLoopFixture : public EnergyPlusFixture VRFCond.ZoneTUListPtr = 1; VRFCond.MaxOATCooling = 40.0; VRFCond.MaxOATHeating = 30.0; - VRFCond.ThermostatPriority = HVACVariableRefrigerantFlow::LoadPriority; - HVACVariableRefrigerantFlow::MaxCoolingCapacity.allocate(1); - HVACVariableRefrigerantFlow::MaxCoolingCapacity(1) = 1.0E20; - HVACVariableRefrigerantFlow::MaxHeatingCapacity.allocate(1); - HVACVariableRefrigerantFlow::MaxHeatingCapacity(1) = 1.0E20; + VRFCond.ThermostatPriority = iThermostatCtrlType::LoadPriority; + state->dataHVACVarRefFlow->MaxCoolingCapacity.allocate(1); + state->dataHVACVarRefFlow->MaxCoolingCapacity(1) = 1.0E20; + state->dataHVACVarRefFlow->MaxHeatingCapacity.allocate(1); + state->dataHVACVarRefFlow->MaxHeatingCapacity(1) = 1.0E20; int Sch1 = 1; int Sch2 = 2; int numTU = 1; // total number of TUs - HVACVariableRefrigerantFlow::VRFTUNumericFields.allocate(numTU); - VRFTUNumericFields(1).FieldNames.allocate(25); - VRFTUNumericFields(1).FieldNames = " "; - HVACVariableRefrigerantFlow::NumVRFTU = numTU; - HVACVariableRefrigerantFlow::VRFTU.allocate(numTU); - HVACVariableRefrigerantFlow::NumVRFTULists = numTU; - HVACVariableRefrigerantFlow::TerminalUnitList.allocate(numTU); - HVACVariableRefrigerantFlow::CheckEquipName.allocate(numTU); - HVACVariableRefrigerantFlow::CheckEquipName = true; + state->dataHVACVarRefFlow->VRFTUNumericFields.allocate(numTU); + state->dataHVACVarRefFlow->VRFTUNumericFields(1).FieldNames.allocate(25); + state->dataHVACVarRefFlow->VRFTUNumericFields(1).FieldNames = " "; + state->dataHVACVarRefFlow->NumVRFTU = numTU; + state->dataHVACVarRefFlow->VRFTU.allocate(numTU); + state->dataHVACVarRefFlow->NumVRFTULists = numTU; + state->dataHVACVarRefFlow->TerminalUnitList.allocate(numTU); + state->dataHVACVarRefFlow->CheckEquipName.allocate(numTU); + state->dataHVACVarRefFlow->CheckEquipName = true; // set up terminal unit list int thisTUList = 1; - auto &terminalUnitList(HVACVariableRefrigerantFlow::TerminalUnitList(thisTUList)); + auto &terminalUnitList(state->dataHVACVarRefFlow->TerminalUnitList(thisTUList)); terminalUnitList.NumTUInList = 1; terminalUnitList.ZoneTUPtr.allocate(1); terminalUnitList.ZoneTUPtr(thisTUList) = 1; @@ -417,7 +414,7 @@ class AirLoopFixture : public EnergyPlusFixture // set up VRF Terminal Unit int TUNum = 1; // index to this TU - auto &VRFTU(HVACVariableRefrigerantFlow::VRFTU(TUNum)); + auto &VRFTU(state->dataHVACVarRefFlow->VRFTU(TUNum)); int coolCoilIndex = 1; int heatCoilIndex = 2; @@ -481,41 +478,41 @@ class AirLoopFixture : public EnergyPlusFixture VRFTU.HVACSizingIndex = 0; // DX coil set up - DXCoils::DXCoilNumericFields(1).PerfMode.allocate(5); - DXCoils::DXCoilNumericFields(1).PerfMode(1).FieldNames.allocate(30); - DXCoils::DXCoil(1).Name = "VRFTUDXCOOLCOIL"; - DXCoils::DXCoil(1).DXCoilType = "Coil:Cooling:DX:VariableRefrigerantFlow"; - DXCoils::DXCoil(1).AirInNode = coolCoilAirInNode; - DXCoils::DXCoil(1).AirOutNode = coolCoilAirOutNode; - DXCoils::DXCoil(1).DXCoilType_Num = CoilVRF_Cooling; - DXCoils::DXCoil(1).RatedAirVolFlowRate = DataSizing::AutoSize; - DXCoils::DXCoil(1).RatedTotCap = DataSizing::AutoSize; - DXCoils::DXCoil(1).RatedSHR = DataSizing::AutoSize; - DXCoils::DXCoil(1).SchedPtr = Sch1; - DXCoils::DXCoil(1).CCapFTemp.allocate(1); - DXCoils::DXCoil(1).CCapFTemp(1) = Sch1; - DXCoils::DXCoil(1).CCapFFlow.allocate(1); - DXCoils::DXCoil(1).CCapFFlow(1) = Sch1; - DXCoils::DXCoil(1).PLFFPLR.allocate(1); - DXCoils::DXCoil(1).PLFFPLR(1) = Sch1; - - DXCoils::DXCoilNumericFields(2).PerfMode.allocate(5); - DXCoils::DXCoilNumericFields(2).PerfMode(1).FieldNames.allocate(30); - DXCoils::DXCoil(2).Name = "VRFTUDXHEATCOIL"; - DXCoils::DXCoil(2).DXCoilType = "Coil:Heating:DX:VariableRefrigerantFlow"; - DXCoils::DXCoil(2).AirInNode = heatCoilAirInNode; - DXCoils::DXCoil(2).AirOutNode = heatCoilAirOutNode; - DXCoils::DXCoil(2).DXCoilType_Num = CoilVRF_Heating; - DXCoils::DXCoil(2).RatedAirVolFlowRate = DataSizing::AutoSize; - DXCoils::DXCoil(2).RatedTotCap = DataSizing::AutoSize; - DXCoils::DXCoil(2).RatedSHR = DataSizing::AutoSize; - DXCoils::DXCoil(2).SchedPtr = Sch1; - DXCoils::DXCoil(2).CCapFTemp.allocate(1); - DXCoils::DXCoil(2).CCapFTemp(1) = Sch1; - DXCoils::DXCoil(2).CCapFFlow.allocate(1); - DXCoils::DXCoil(2).CCapFFlow(1) = Sch1; - DXCoils::DXCoil(2).PLFFPLR.allocate(1); - DXCoils::DXCoil(2).PLFFPLR(1) = Sch1; + state->dataDXCoils->DXCoilNumericFields(1).PerfMode.allocate(5); + state->dataDXCoils->DXCoilNumericFields(1).PerfMode(1).FieldNames.allocate(30); + state->dataDXCoils->DXCoil(1).Name = "VRFTUDXCOOLCOIL"; + state->dataDXCoils->DXCoil(1).DXCoilType = "Coil:Cooling:DX:VariableRefrigerantFlow"; + state->dataDXCoils->DXCoil(1).AirInNode = coolCoilAirInNode; + state->dataDXCoils->DXCoil(1).AirOutNode = coolCoilAirOutNode; + state->dataDXCoils->DXCoil(1).DXCoilType_Num = CoilVRF_Cooling; + state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(1).RatedTotCap = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(1).RatedSHR = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(1).SchedPtr = Sch1; + state->dataDXCoils->DXCoil(1).CCapFTemp.allocate(1); + state->dataDXCoils->DXCoil(1).CCapFTemp(1) = Sch1; + state->dataDXCoils->DXCoil(1).CCapFFlow.allocate(1); + state->dataDXCoils->DXCoil(1).CCapFFlow(1) = Sch1; + state->dataDXCoils->DXCoil(1).PLFFPLR.allocate(1); + state->dataDXCoils->DXCoil(1).PLFFPLR(1) = Sch1; + + state->dataDXCoils->DXCoilNumericFields(2).PerfMode.allocate(5); + state->dataDXCoils->DXCoilNumericFields(2).PerfMode(1).FieldNames.allocate(30); + state->dataDXCoils->DXCoil(2).Name = "VRFTUDXHEATCOIL"; + state->dataDXCoils->DXCoil(2).DXCoilType = "Coil:Heating:DX:VariableRefrigerantFlow"; + state->dataDXCoils->DXCoil(2).AirInNode = heatCoilAirInNode; + state->dataDXCoils->DXCoil(2).AirOutNode = heatCoilAirOutNode; + state->dataDXCoils->DXCoil(2).DXCoilType_Num = CoilVRF_Heating; + state->dataDXCoils->DXCoil(2).RatedAirVolFlowRate = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(2).RatedTotCap = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(2).RatedSHR = DataSizing::AutoSize; + state->dataDXCoils->DXCoil(2).SchedPtr = Sch1; + state->dataDXCoils->DXCoil(2).CCapFTemp.allocate(1); + state->dataDXCoils->DXCoil(2).CCapFTemp(1) = Sch1; + state->dataDXCoils->DXCoil(2).CCapFFlow.allocate(1); + state->dataDXCoils->DXCoil(2).CCapFFlow(1) = Sch1; + state->dataDXCoils->DXCoil(2).PLFFPLR.allocate(1); + state->dataDXCoils->DXCoil(2).PLFFPLR(1) = Sch1; // set up schedules ScheduleManager::Schedule.allocate(10); @@ -537,15 +534,15 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) int curTUNum = 1; // turn off GetInput for AirLoopFixture unit tests, everything is set up in fixture - HVACVariableRefrigerantFlow::GetVRFInputFlag = false; - DXCoils::GetCoilsInputFlag = false; + state->dataHVACVarRefFlow->GetVRFInputFlag = false; + state->dataDXCoils->GetCoilsInputFlag = false; // trigger a mining function (will bypass GetInput) int ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, 1); - auto &thisTU(HVACVariableRefrigerantFlow::VRFTU(curTUNum)); + auto &thisTU(state->dataHVACVarRefFlow->VRFTU(curTUNum)); // node number set up in fixture EXPECT_EQ(ZoneInletAirNode, thisTU.VRFTUOutletNodeNum); - Schedule(VRF(curSysNum).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser + Schedule(state->dataHVACVarRefFlow->VRF(curSysNum).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser Schedule(thisTU.SchedPtr).CurrentValue = 1.0; // enable the terminal unit Schedule(thisTU.FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan Schedule(thisTU.FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode @@ -556,7 +553,7 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) state->dataAirLoop->AirLoopInputsFilled = true; - Node(VRF(curSysNum).CondenserNodeNum).Temp = 35.0; + Node(state->dataHVACVarRefFlow->VRF(curSysNum).CondenserNodeNum).Temp = 35.0; int VRFTUOAMixerOANodeNum = thisTU.VRFTUOAMixerOANodeNum; int VRFTUOAMixerRetNodeNum = thisTU.VRFTUOAMixerRetNodeNum; @@ -585,7 +582,7 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters - ASSERT_EQ(1, NumVRFCond); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFCond); EXPECT_TRUE(thisTU.isInAirLoop); // initialization found TU in main air loop EXPECT_TRUE(thisTU.isSetPointControlled); // initialization found TU is set point controlled EXPECT_EQ(20.0, thisTU.coilTempSetPoint); // set point is initialized @@ -613,7 +610,7 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) Node(VRFTUOAMixerRetNodeNum).HumRat = 0.007; Node(VRFTUOAMixerRetNodeNum).Enthalpy = PsyHFnTdbW(Node(VRFTUOAMixerRetNodeNum).Temp, Node(VRFTUOAMixerRetNodeNum).HumRat); state->dataEnvrn->OutDryBulbTemp = 10.0; - Node(VRF(curSysNum).CondenserNodeNum).Temp = 10.0; + Node(state->dataHVACVarRefFlow->VRF(curSysNum).CondenserNodeNum).Temp = 10.0; Node(VRFTUOAMixerOANodeNum).Temp = 10.0; InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); @@ -633,16 +630,16 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) thisTU.ZoneNum = 1; InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters EXPECT_EQ(0.0, QZnReq); - EXPECT_FALSE(CoolingLoad(curSysNum)); // verify no load on TU - EXPECT_FALSE(HeatingLoad(curSysNum)); + EXPECT_FALSE(state->dataHVACVarRefFlow->CoolingLoad(curSysNum)); // verify no load on TU + EXPECT_FALSE(state->dataHVACVarRefFlow->HeatingLoad(curSysNum)); ZoneSysEnergyDemand(curZoneNum).RemainingOutputRequired = 1000.0; // set heating load ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToCoolSP = 2000.0; ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToHeatSP = 1000.0; InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters EXPECT_GT(QZnReq, 0.0); - EXPECT_FALSE(CoolingLoad(curSysNum)); - EXPECT_TRUE(HeatingLoad(curSysNum)); + EXPECT_FALSE(state->dataHVACVarRefFlow->CoolingLoad(curSysNum)); + EXPECT_TRUE(state->dataHVACVarRefFlow->HeatingLoad(curSysNum)); SimVRF(*state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); EXPECT_NEAR(SysOutputProvided, QZnReq, 1.0); @@ -651,8 +648,8 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToHeatSP = -2000.0; InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters EXPECT_LT(QZnReq, 0.0); - EXPECT_TRUE(CoolingLoad(curSysNum)); - EXPECT_FALSE(HeatingLoad(curSysNum)); + EXPECT_TRUE(state->dataHVACVarRefFlow->CoolingLoad(curSysNum)); + EXPECT_FALSE(state->dataHVACVarRefFlow->HeatingLoad(curSysNum)); SimVRF(*state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); EXPECT_NEAR(SysOutputProvided, QZnReq, 1.0); } @@ -664,8 +661,6 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) // Test a group of methods related with the outdoor unit compressor calculations in the VRF_FluidTCtrl model. // Inputs_general - int const FlagCondMode(0); // Flag for running as condenser [-] - int const FlagEvapMode(1); // Flag for running as evaporator [-] bool ErrorsFound(false); // function returns true on error int VRFCond(1); // index to VRF condenser @@ -2273,9 +2268,9 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) // Check expected result from GetInput // #6218 Fan:SystemModel is used and DX coil RatedVolAirFlowRate was not set equal to system fan designAirVolFlowRate - EXPECT_EQ(DXCoil(1).RatedAirVolFlowRate(1), 1.0); - EXPECT_EQ(DXCoil(2).RatedAirVolFlowRate(1), 1.0); - EXPECT_EQ(HVACFan::fanObjs[VRFTU(1).FanIndex]->designAirVolFlowRate, 1.0); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1), 1.0); + EXPECT_EQ(state->dataDXCoils->DXCoil(2).RatedAirVolFlowRate(1), 1.0); + EXPECT_EQ(HVACFan::fanObjs[state->dataHVACVarRefFlow->VRFTU(1).FanIndex]->designAirVolFlowRate, 1.0); // Run and Check: GetSupHeatTempRefrig { @@ -2329,7 +2324,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) state->dataEnvrn->OutDryBulbTemp = 10.35; // Run - VRF(VRFCond).VRFHR_OU_HR_Mode(*state, + state->dataHVACVarRefFlow->VRF(VRFCond).VRFHR_OU_HR_Mode(*state, h_IU_evap_in, h_comp_out, Q_c_TU_PL, @@ -2375,8 +2370,8 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 C_cap_operation; // Run - C_cap_operation = - VRF(VRFCond).VRFOU_CapModFactor(*state, h_comp_in_real, h_evap_in_real, P_evap_real, T_comp_in_real, T_comp_in_rate, T_cond_out_rate); + C_cap_operation = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CapModFactor( + *state, h_comp_in_real, h_evap_in_real, P_evap_real, T_comp_in_real, T_comp_in_rate, T_cond_out_rate); // Test EXPECT_NEAR(0.879, C_cap_operation, 0.005); @@ -2397,7 +2392,8 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 CompSpdActual; // Actual compressor running speed [rps] // Run - VRF(VRFCond).VRFOU_CompSpd(*state, Q_req, FlagEvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( + *state, Q_req, iHXOpMode::EvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); // Test EXPECT_NEAR(1295, CompSpdActual, 5); @@ -2415,7 +2411,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 CompSpdActual; // Actual compressor running speed [rps] // Run - VRF(VRFCond).VRFOU_CompSpd(*state, Q_req, FlagCondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd(*state, Q_req, iHXOpMode::CondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); // Test EXPECT_NEAR(950, CompSpdActual, 5); @@ -2437,7 +2433,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 Ncomp; // Compressor power [W] // Run - VRF(VRFCond).VRFOU_CompCap(*state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompCap(*state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); // Test EXPECT_NEAR(6990, Q_c_tot, 10); @@ -2465,14 +2461,14 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 CompSpdActual; // Actual compressor running speed [rps] // Run - VRF(VRFCond).VRFOU_CalcCompH(*state, + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompH(*state, TU_load, T_suction, T_discharge, Pipe_h_out_ave, IUMaxCondTemp, MinOutdoorUnitTe, Tfs, Pipe_Q, OUEvapHeatExtract, CompSpdActual, Ncomp); // Test EXPECT_NEAR(5110, OUEvapHeatExtract, 1); EXPECT_NEAR(1500, CompSpdActual, 1); EXPECT_NEAR(2080, Ncomp, 1); - EXPECT_EQ(Node(VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0); + EXPECT_EQ(Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0); } } @@ -2486,11 +2482,9 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) // Allocate int NumVRFCondenser = 1; int VRFCond = 1; - VRF.allocate(NumVRFCondenser); + state->dataHVACVarRefFlow->VRF.allocate(NumVRFCondenser); // Inputs_general - int const FlagCondMode(0); // Flag for running as condenser [-] - int const FlagEvapMode(1); // Flag for running as evaporator [-] Real64 OutDryBulbTemp; // Temperature of outdoor air [C] Real64 OutHumRat; // Humidity ratio of outdoor air [kg/kg] Real64 OutBaroPress(101325); // Outdoor air pressure [Pa] @@ -2504,14 +2498,14 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) Real64 temp; // OU coil air mass flow rate [kg/s] // Inputs_VRF configurations - VRF(VRFCond).RateBFOUCond = 0.05; - VRF(VRFCond).RateBFOUEvap = 0.281; - VRF(VRFCond).C1Te = 0; - VRF(VRFCond).C2Te = 6.05E-1; - VRF(VRFCond).C3Te = 2.50E-2; - VRF(VRFCond).C1Tc = 0; - VRF(VRFCond).C2Tc = -0.091; - VRF(VRFCond).C3Tc = 0.075; + state->dataHVACVarRefFlow->VRF(VRFCond).RateBFOUCond = 0.05; + state->dataHVACVarRefFlow->VRF(VRFCond).RateBFOUEvap = 0.281; + state->dataHVACVarRefFlow->VRF(VRFCond).C1Te = 0; + state->dataHVACVarRefFlow->VRF(VRFCond).C2Te = 6.05E-1; + state->dataHVACVarRefFlow->VRF(VRFCond).C3Te = 2.50E-2; + state->dataHVACVarRefFlow->VRF(VRFCond).C1Tc = 0; + state->dataHVACVarRefFlow->VRF(VRFCond).C2Tc = -0.091; + state->dataHVACVarRefFlow->VRF(VRFCond).C3Tc = 0.075; // Pre-process state->dataEnvrn->OutBaroPress = OutBaroPress; @@ -2530,7 +2524,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) Tdischarge = 36; // Run - Q_h_OU = VRF(VRFCond).VRFOU_Cap(*state, FlagCondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); + Q_h_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, iHXOpMode::CondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(27551, Q_h_OU, 10); @@ -2547,7 +2541,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) Tsuction = -3; // Run - Q_c_OU = VRF(VRFCond).VRFOU_Cap(*state, FlagEvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); + Q_c_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, iHXOpMode::EvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(24456, Q_c_OU, 10); @@ -2567,7 +2561,7 @@ SC = 1; Tdischarge = 36; // Run -m_air = VRF(VRFCond).VRFOU_FlowRate(*state, FlagCondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); +m_air = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, iHXOpMode::CondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(3.6, m_air, 0.01); @@ -2584,7 +2578,7 @@ EXPECT_NEAR(3.6, m_air, 0.01); Tsuction = -3; // Run - m_air = VRF(VRFCond).VRFOU_FlowRate(*state, FlagEvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); + m_air = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, iHXOpMode::EvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(3.6, m_air, 0.01); @@ -2605,7 +2599,7 @@ OutHumRat = 0.0146; SC = 1; // Run -VRF(VRFCond).VRFOU_TeTc(*state, FlagCondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); +state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc(*state, iHXOpMode::CondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); // Test EXPECT_NEAR(36, Tdischarge, 0.05); @@ -2623,7 +2617,7 @@ EXPECT_NEAR(36, Tdischarge, 0.05); Tsuction = -3; // Run - VRF(VRFCond).VRFOU_TeTc(*state, FlagEvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc(*state, iHXOpMode::EvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); // Test EXPECT_NEAR(-3, Tsuction, 0.05); @@ -2646,7 +2640,7 @@ EXPECT_NEAR(36, Tdischarge, 0.05); Tdischarge = 36; // Run - SC = VRF(VRFCond).VRFOU_SCSH(*state, FlagCondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + SC = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH(*state, iHXOpMode::CondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); // Test EXPECT_NEAR(1, SC, 0.01); @@ -2663,14 +2657,14 @@ EXPECT_NEAR(36, Tdischarge, 0.05); Tsuction = -3; // Run - SH = VRF(VRFCond).VRFOU_SCSH(*state, FlagEvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + SH = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH(*state, iHXOpMode::EvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); // Test EXPECT_NEAR(1, SH, 0.01); } } // Clean up -VRF.deallocate(); +state->dataHVACVarRefFlow->VRF.deallocate(); } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_GetCoilInput) @@ -2707,14 +2701,14 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_GetCoilInput) GetDXCoils(*state); // Check the results - ASSERT_EQ(1, NumDXCoils); - EXPECT_EQ(DXCoil(1).DXCoilType_Num, 33); - EXPECT_EQ(DXCoil(1).RatedTotCap(1), 2200); - EXPECT_EQ(DXCoil(1).RatedSHR(1), 0.865); - EXPECT_EQ(DXCoil(1).C1Te, 0); - EXPECT_EQ(DXCoil(1).C2Te, 0.80404); - EXPECT_EQ(DXCoil(1).C3Te, 0); - EXPECT_EQ(DXCoil(1).SH, 3); + ASSERT_EQ(1, state->dataDXCoils->NumDXCoils); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).DXCoilType_Num, 33); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).RatedTotCap(1), 2200); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).RatedSHR(1), 0.865); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).C1Te, 0); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).C2Te, 0.80404); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).C3Te, 0); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).SH, 3); } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CompResidual) @@ -2872,7 +2866,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) // Allocate int NumCoils = 2; - DXCoil.allocate(NumCoils); + state->dataDXCoils->DXCoil.allocate(NumCoils); int NumZones = 2; ZoneSysEnergyDemand.allocate(NumZones); @@ -2884,16 +2878,16 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) state->dataEnvrn->OutBaroPress = 101570; InitializePsychRoutines(); - DXCoil(CoolCoilIndex).C1Te = 0; - DXCoil(CoolCoilIndex).C2Te = 0.804; - DXCoil(CoolCoilIndex).C3Te = 0; - DXCoil(CoolCoilIndex).SH = 3.00; - DXCoil(CoolCoilIndex).SupplyFanIndex = 0; - DXCoil(HeatCoilIndex).C1Tc = -1.905; - DXCoil(HeatCoilIndex).C2Tc = 0.4333; - DXCoil(HeatCoilIndex).C3Tc = 0.0207; - DXCoil(HeatCoilIndex).SC = 5.00; - DXCoil(HeatCoilIndex).SupplyFanIndex = 0; + state->dataDXCoils->DXCoil(CoolCoilIndex).C1Te = 0; + state->dataDXCoils->DXCoil(CoolCoilIndex).C2Te = 0.804; + state->dataDXCoils->DXCoil(CoolCoilIndex).C3Te = 0; + state->dataDXCoils->DXCoil(CoolCoilIndex).SH = 3.00; + state->dataDXCoils->DXCoil(CoolCoilIndex).SupplyFanIndex = 0; + state->dataDXCoils->DXCoil(HeatCoilIndex).C1Tc = -1.905; + state->dataDXCoils->DXCoil(HeatCoilIndex).C2Tc = 0.4333; + state->dataDXCoils->DXCoil(HeatCoilIndex).C3Tc = 0.0207; + state->dataDXCoils->DXCoil(HeatCoilIndex).SC = 5.00; + state->dataDXCoils->DXCoil(HeatCoilIndex).SupplyFanIndex = 0; // Run and Check for Cooling Mode Mode = 0; @@ -2903,10 +2897,10 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) ZoneSysEnergyDemand(ZoneIndex).OutputRequiredToCoolingSP = -2716.6229; ZoneSysEnergyDemand(ZoneIndex).OutputRequiredToHeatingSP = -45507.8487; - DXCoil(CoolCoilIndex).RatedAirMassFlowRate(1) = 0.2066; - DXCoil(CoolCoilIndex).InletAirTemp = 25.5553; - DXCoil(CoolCoilIndex).InletAirHumRat = 8.4682e-3; - DXCoil(CoolCoilIndex).InletAirEnthalpy = 47259.78; + state->dataDXCoils->DXCoil(CoolCoilIndex).RatedAirMassFlowRate(1) = 0.2066; + state->dataDXCoils->DXCoil(CoolCoilIndex).InletAirTemp = 25.5553; + state->dataDXCoils->DXCoil(CoolCoilIndex).InletAirHumRat = 8.4682e-3; + state->dataDXCoils->DXCoil(CoolCoilIndex).InletAirEnthalpy = 47259.78; ControlVRFIUCoil(*state, CoolCoilIndex, @@ -2933,10 +2927,10 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) ZoneSysEnergyDemand(ZoneIndex).OutputRequiredToCoolingSP = 43167.2628; ZoneSysEnergyDemand(ZoneIndex).OutputRequiredToHeatingSP = 4241.66099; - DXCoil(HeatCoilIndex).RatedAirMassFlowRate(1) = 0.21136; - DXCoil(HeatCoilIndex).InletAirTemp = 20.2362; - DXCoil(HeatCoilIndex).InletAirHumRat = 4.1053e-3; - DXCoil(HeatCoilIndex).InletAirEnthalpy = 30755.6253; + state->dataDXCoils->DXCoil(HeatCoilIndex).RatedAirMassFlowRate(1) = 0.21136; + state->dataDXCoils->DXCoil(HeatCoilIndex).InletAirTemp = 20.2362; + state->dataDXCoils->DXCoil(HeatCoilIndex).InletAirHumRat = 4.1053e-3; + state->dataDXCoils->DXCoil(HeatCoilIndex).InletAirEnthalpy = 30755.6253; ControlVRFIUCoil(*state, HeatCoilIndex, @@ -2966,157 +2960,157 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUTeTc) // Allocate int NumVRFCondenser = 1; - VRF.allocate(NumVRFCondenser); + state->dataHVACVarRefFlow->VRF.allocate(NumVRFCondenser); int NumTUList = 1; - TerminalUnitList.allocate(NumTUList); + state->dataHVACVarRefFlow->TerminalUnitList.allocate(NumTUList); // Common Inputs int IndexVRFCondenser = 1; int IndexTUList = 1; - TerminalUnitList(IndexTUList).NumTUInList = 2; + state->dataHVACVarRefFlow->TerminalUnitList(IndexTUList).NumTUInList = 2; - VRF(IndexVRFCondenser).ZoneTUListPtr = 1; - VRF(IndexVRFCondenser).EvapTempFixed = 3; - VRF(IndexVRFCondenser).CondTempFixed = 5; + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).ZoneTUListPtr = 1; + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).EvapTempFixed = 3; + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).CondTempFixed = 5; // test fixed evap/cond temp method - VRF(IndexVRFCondenser).AlgorithmIUCtrl = 0; + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).AlgorithmIUCtrl = 0; // Run and Check - VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(); + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(*state); - EXPECT_EQ(VRF(IndexVRFCondenser).IUEvaporatingTemp, 3); - EXPECT_EQ(VRF(IndexVRFCondenser).IUCondensingTemp, 5); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUEvaporatingTemp, 3); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUCondensingTemp, 5); // test variable evap/cond temp method - VRF(IndexVRFCondenser).AlgorithmIUCtrl = 1; - VRF(IndexVRFCondenser).HeatRecoveryUsed = false; - VRFTU.allocate(TerminalUnitList(IndexTUList).NumTUInList); - VRFTU(1).CoolCoilIndex = 1; - VRFTU(1).HeatCoilIndex = 2; - VRFTU(2).CoolCoilIndex = 3; - VRFTU(2).HeatCoilIndex = 4; - VRFTU(1).ZoneNum = 1; - VRFTU(1).VRFSysNum = 1; - VRFTU(2).ZoneNum = 2; - VRFTU(2).VRFSysNum = 1; - VRFTU(1).IndexToTUInTUList = 1; - VRFTU(2).IndexToTUInTUList = 2; - VRFTU(1).VRFTUInletNodeNum = 1; - VRFTU(2).VRFTUInletNodeNum = 2; - TerminalUnitList(1).ZoneTUPtr.allocate(2); - TerminalUnitList(1).ZoneTUPtr(1) = 1; - TerminalUnitList(1).ZoneTUPtr(2) = 2; - TerminalUnitList(1).HRCoolRequest.allocate(2); - TerminalUnitList(1).HRCoolRequest = false; - TerminalUnitList(1).HRHeatRequest.allocate(2); - TerminalUnitList(1).HRHeatRequest = false; - DXCoil.allocate(4); // 2 TUs each with a cooling and heating coil + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).AlgorithmIUCtrl = 1; + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).HeatRecoveryUsed = false; + state->dataHVACVarRefFlow->VRFTU.allocate(state->dataHVACVarRefFlow->TerminalUnitList(IndexTUList).NumTUInList); + state->dataHVACVarRefFlow->VRFTU(1).CoolCoilIndex = 1; + state->dataHVACVarRefFlow->VRFTU(1).HeatCoilIndex = 2; + state->dataHVACVarRefFlow->VRFTU(2).CoolCoilIndex = 3; + state->dataHVACVarRefFlow->VRFTU(2).HeatCoilIndex = 4; + state->dataHVACVarRefFlow->VRFTU(1).ZoneNum = 1; + state->dataHVACVarRefFlow->VRFTU(1).VRFSysNum = 1; + state->dataHVACVarRefFlow->VRFTU(2).ZoneNum = 2; + state->dataHVACVarRefFlow->VRFTU(2).VRFSysNum = 1; + state->dataHVACVarRefFlow->VRFTU(1).IndexToTUInTUList = 1; + state->dataHVACVarRefFlow->VRFTU(2).IndexToTUInTUList = 2; + state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum = 1; + state->dataHVACVarRefFlow->VRFTU(2).VRFTUInletNodeNum = 2; + state->dataHVACVarRefFlow->TerminalUnitList(1).ZoneTUPtr.allocate(2); + state->dataHVACVarRefFlow->TerminalUnitList(1).ZoneTUPtr(1) = 1; + state->dataHVACVarRefFlow->TerminalUnitList(1).ZoneTUPtr(2) = 2; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest.allocate(2); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest.allocate(2); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest = false; + state->dataDXCoils->DXCoil.allocate(4); // 2 TUs each with a cooling and heating coil for (int i = 1; i <= 2; ++i) { - DXCoil((i - 1) * 2 + 1).SH = 8.0 + double(i); - DXCoil((i - 1) * 2 + 1).C1Te = 1.0; - DXCoil((i - 1) * 2 + 1).C2Te = 0.0; - DXCoil((i - 1) * 2 + 1).C3Te = 0.0; - DXCoil((i - 1) * 2 + 2).SC = 6.0 + double(i); - DXCoil((i - 1) * 2 + 2).C1Tc = 1.0; - DXCoil((i - 1) * 2 + 2).C2Tc = 0.0; - DXCoil((i - 1) * 2 + 2).C3Tc = 0.0; + state->dataDXCoils->DXCoil((i - 1) * 2 + 1).SH = 8.0 + double(i); + state->dataDXCoils->DXCoil((i - 1) * 2 + 1).C1Te = 1.0; + state->dataDXCoils->DXCoil((i - 1) * 2 + 1).C2Te = 0.0; + state->dataDXCoils->DXCoil((i - 1) * 2 + 1).C3Te = 0.0; + state->dataDXCoils->DXCoil((i - 1) * 2 + 2).SC = 6.0 + double(i); + state->dataDXCoils->DXCoil((i - 1) * 2 + 2).C1Tc = 1.0; + state->dataDXCoils->DXCoil((i - 1) * 2 + 2).C2Tc = 0.0; + state->dataDXCoils->DXCoil((i - 1) * 2 + 2).C3Tc = 0.0; } Node.allocate(5); Node(1).Temp = 21.0; // TU 1 inlet node Node(1).HumRat = 0.011; Node(2).Temp = 21.0; // TU 2 inlet node Node(2).HumRat = 0.011; - VRFTU(1).fanOutletNode = 3; + state->dataHVACVarRefFlow->VRFTU(1).fanOutletNode = 3; Node(3).Temp = 23.0; // TU 1 fan outlet node Node(3).HumRat = 0.011; // TU 1 fan outlet node - VRFTU(2).fanOutletNode = 4; + state->dataHVACVarRefFlow->VRFTU(2).fanOutletNode = 4; Node(4).Temp = 23.0; // TU 2 fan outlet node Node(4).HumRat = 0.011; // TU 2 fan outlet node - VRFTU(1).coilInNodeT = Node(1).Temp; - VRFTU(1).coilInNodeW = Node(1).HumRat; - VRFTU(2).coilInNodeT = Node(2).Temp; - VRFTU(2).coilInNodeW = Node(2).HumRat; - - CoolingLoad.allocate(1); - HeatingLoad.allocate(1); - CoolingLoad(1) = true; - HeatingLoad(1) = false; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeT = Node(1).Temp; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeW = Node(1).HumRat; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeT = Node(2).Temp; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeW = Node(2).HumRat; + + state->dataHVACVarRefFlow->CoolingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad.allocate(1); + state->dataHVACVarRefFlow->CoolingLoad(1) = true; + state->dataHVACVarRefFlow->HeatingLoad(1) = false; DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(2); DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -100.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = -200.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(2).RemainingOutputReqToCoolSP = -1100.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(2).RemainingOutputReqToHeatSP = -1200.0; - CompOnMassFlow = 0.0; // system is off + state->dataHVACVarRefFlow->CompOnMassFlow = 0.0; // system is off // Run and Check - VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(); - EXPECT_EQ(VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); // default value, coil inlet temps higher than default - EXPECT_EQ(VRF(IndexVRFCondenser).IUCondensingTemp, 42); // default value, coil inlet temps lower than default + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(*state); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); // default value, coil inlet temps higher than default + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUCondensingTemp, 42); // default value, coil inlet temps lower than default - CompOnMassFlow = 0.1; + state->dataHVACVarRefFlow->CompOnMassFlow = 0.1; // system is on in cooling mode - VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(); + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(*state); // minimum coil surface temp of both cooling coils below default - EXPECT_LT(VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); + EXPECT_LT(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); // default value, coil inlet temps lower than default - EXPECT_EQ(VRF(IndexVRFCondenser).IUCondensingTemp, 42); - Real64 saveCoolingEvapTemp = VRF(IndexVRFCondenser).IUEvaporatingTemp; + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUCondensingTemp, 42); + Real64 saveCoolingEvapTemp = state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUEvaporatingTemp; // test blow thru fan // adjust coil inlet temps for fan heat - VRFTU(1).coilInNodeT = Node(3).Temp; - VRFTU(1).coilInNodeW = Node(3).HumRat; - VRFTU(2).coilInNodeT = Node(3).Temp; - VRFTU(2).coilInNodeW = Node(3).HumRat; - VRFTU(1).FanPlace = DataHVACGlobals::BlowThru; - VRFTU(2).FanPlace = DataHVACGlobals::BlowThru; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeT = Node(3).Temp; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeW = Node(3).HumRat; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeT = Node(3).Temp; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeW = Node(3).HumRat; + state->dataHVACVarRefFlow->VRFTU(1).FanPlace = DataHVACGlobals::BlowThru; + state->dataHVACVarRefFlow->VRFTU(2).FanPlace = DataHVACGlobals::BlowThru; // system is on in cooling mode - VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(); + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(*state); // fan heat added to coil inlet temp, coil surface temp should also be lower to overcome additional heat tranfer - EXPECT_LT(VRF(IndexVRFCondenser).IUEvaporatingTemp, saveCoolingEvapTemp); + EXPECT_LT(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUEvaporatingTemp, saveCoolingEvapTemp); // default value, coil inlet temps lower than default - EXPECT_EQ(VRF(IndexVRFCondenser).IUCondensingTemp, 42); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUCondensingTemp, 42); - VRFTU(1).FanPlace = DataHVACGlobals::DrawThru; - VRFTU(2).FanPlace = DataHVACGlobals::DrawThru; + state->dataHVACVarRefFlow->VRFTU(1).FanPlace = DataHVACGlobals::DrawThru; + state->dataHVACVarRefFlow->VRFTU(2).FanPlace = DataHVACGlobals::DrawThru; // rest coil inlet temps - VRFTU(1).coilInNodeT = Node(1).Temp; - VRFTU(1).coilInNodeW = Node(1).HumRat; - VRFTU(2).coilInNodeT = Node(2).Temp; - VRFTU(2).coilInNodeW = Node(2).HumRat; - CoolingLoad(1) = false; - HeatingLoad(1) = true; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeT = Node(1).Temp; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeW = Node(1).HumRat; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeT = Node(2).Temp; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeW = Node(2).HumRat; + state->dataHVACVarRefFlow->CoolingLoad(1) = false; + state->dataHVACVarRefFlow->HeatingLoad(1) = true; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = 300.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 200.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(2).RemainingOutputReqToCoolSP = 2000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(2).RemainingOutputReqToHeatSP = 1900.0; // system is on in heating mode - VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(); + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(*state); // default value, coil inlet temps higher than default - EXPECT_EQ(VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); // maximum coil surface temp of both heating coils above default - EXPECT_GT(VRF(IndexVRFCondenser).IUCondensingTemp, 42); - Real64 saveHeatingCondTemp = VRF(IndexVRFCondenser).IUCondensingTemp; + EXPECT_GT(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUCondensingTemp, 42); + Real64 saveHeatingCondTemp = state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUCondensingTemp; // test blow thru fan - VRFTU(1).FanPlace = DataHVACGlobals::BlowThru; - VRFTU(2).FanPlace = DataHVACGlobals::BlowThru; + state->dataHVACVarRefFlow->VRFTU(1).FanPlace = DataHVACGlobals::BlowThru; + state->dataHVACVarRefFlow->VRFTU(2).FanPlace = DataHVACGlobals::BlowThru; // adjust coil inlet temps for fan heat - VRFTU(1).coilInNodeT = Node(3).Temp; - VRFTU(1).coilInNodeW = Node(3).HumRat; - VRFTU(2).coilInNodeT = Node(3).Temp; - VRFTU(2).coilInNodeW = Node(3).HumRat; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeT = Node(3).Temp; + state->dataHVACVarRefFlow->VRFTU(1).coilInNodeW = Node(3).HumRat; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeT = Node(3).Temp; + state->dataHVACVarRefFlow->VRFTU(2).coilInNodeW = Node(3).HumRat; // system is on in heating mode - VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(); + state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).CalcVRFIUTeTc_FluidTCtrl(*state); // default value, coil inlet temps higher than default - EXPECT_EQ(VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUEvaporatingTemp, 15); // fan heat added to coil inlet temp, coil surface temp should also be lower to account for less heat tranfer - EXPECT_LT(VRF(IndexVRFCondenser).IUCondensingTemp, saveHeatingCondTemp); + EXPECT_LT(state->dataHVACVarRefFlow->VRF(IndexVRFCondenser).IUCondensingTemp, saveHeatingCondTemp); // Clean up - VRF.deallocate(); - TerminalUnitList.deallocate(); + state->dataHVACVarRefFlow->VRF.deallocate(); + state->dataHVACVarRefFlow->TerminalUnitList.deallocate(); } //*****************VRF-SysCurve Model @@ -3726,10 +3720,10 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) GetZoneEquipmentData(*state); // read equipment list and connections ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function - Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode + Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode // Test coil sizing @@ -3740,9 +3734,9 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) FinalZoneSizing(CurZoneEqNum).ZoneRetTempAtCoolPeak = 26.66667; FinalZoneSizing(CurZoneEqNum).ZoneHumRatAtCoolPeak = 0.01117049470250416; // AHRI condition at 80 F db / 67 F wb - Node(VRF(VRFCond).CondenserNodeNum).Temp = 35.0; // AHRI condition at 95 F db - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 35.0; // AHRI condition at 95 F db - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).HumRat = 0.01; // don't care + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 35.0; // AHRI condition at 95 F db + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 35.0; // AHRI condition at 95 F db + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).HumRat = 0.01; // don't care FinalZoneSizing(CurZoneEqNum).CoolDDNum = 1; FinalZoneSizing(CurZoneEqNum).TimeStepNumAtCoolMax = 1; DesDayWeath.allocate(1); @@ -3760,7 +3754,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) state->dataAirLoop->AirLoopInputsFilled = true; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -3772,29 +3766,29 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) SysOutputProvided, LatOutputProvided); - ASSERT_EQ(1, NumVRFCond); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFCond); ASSERT_EQ(ZoneInletAirNode, - ZoneEquipConfig(VRFTU(VRFTUNum).ZoneNum).InletNode(1)); // only 1 inlet node specified above in ZoneHVAC:EquipmentConnections - ASSERT_EQ(1.0, VRF(VRFCond).CoolingCombinationRatio); - EXPECT_NEAR(11170.869, VRF(VRFCond).CoolingCapacity, 0.001); - EXPECT_NEAR(11170.869, VRF(VRFCond).HeatingCapacity, 0.001); - EXPECT_EQ(0.0, VRF(VRFCond).DefrostPower); + ZoneEquipConfig(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).InletNode(1)); // only 1 inlet node specified above in ZoneHVAC:EquipmentConnections + ASSERT_EQ(1.0, state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCombinationRatio); + EXPECT_NEAR(11170.869, state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity, 0.001); + EXPECT_NEAR(11170.869, state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity, 0.001); + EXPECT_EQ(0.0, state->dataHVACVarRefFlow->VRF(VRFCond).DefrostPower); // test defrost operation Issue #4950 - Reverse cycle with timed defrost = 0 // set OA node temperatures for heating where defrost should be active - Node(VRF(VRFCond).CondenserNodeNum).Temp = VRF(VRFCond).MaxOATDefrost - 1.0; - Node(VRF(VRFCond).CondenserNodeNum).HumRat = 0.005; - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = Node(VRF(VRFCond).CondenserNodeNum).Temp; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = state->dataHVACVarRefFlow->VRF(VRFCond).MaxOATDefrost - 1.0; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).HumRat = 0.005; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp; // set zone load to heating - ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = VRF(VRFCond).HeatingCapacity; // set load equal to the VRF heating capacity + ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity; // set load equal to the VRF heating capacity ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = - VRF(VRFCond).HeatingCapacity + 1000.0; // simulates a dual Tstat with load to cooling SP > load to heating SP - ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = VRF(VRFCond).HeatingCapacity; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity + 1000.0; // simulates a dual Tstat with load to cooling SP > load to heating SP + ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -3806,45 +3800,45 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) SysOutputProvided, LatOutputProvided); - ASSERT_TRUE(VRF(VRFCond).DefrostPower > 0.0); // defrost power should be greater than 0 - DefrostWatts = VRF(VRFCond).VRFCondRTF * (VRF(VRFCond).HeatingCapacity / 1.01667) * VRF(VRFCond).DefrostFraction; - ASSERT_EQ(DefrostWatts, VRF(VRFCond).DefrostPower); // defrost power calculation check + ASSERT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).DefrostPower > 0.0); // defrost power should be greater than 0 + DefrostWatts = state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF * (state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / 1.01667) * state->dataHVACVarRefFlow->VRF(VRFCond).DefrostFraction; + ASSERT_EQ(DefrostWatts, state->dataHVACVarRefFlow->VRF(VRFCond).DefrostPower); // defrost power calculation check // test that correct performance curve is used (i.e., lo or hi performance curves based on OAT) int DXHeatingCoilIndex = 2; - Real64 outWB = Node(VRF(VRFCond).CondenserNodeNum).OutAirWetBulb; - Real64 outHR = Node(VRF(VRFCond).CondenserNodeNum).HumRat; + Real64 outWB = Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).OutAirWetBulb; + Real64 outHR = Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).HumRat; // adjust for defrost factors - Real64 outT = 0.82 * Node(VRF(VRFCond).CondenserNodeNum).Temp - 8.589; + Real64 outT = 0.82 * Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp - 8.589; Real64 OutdoorCoildw = max(1.0e-6, (outHR - PsyWFnTdpPb(*state, outT, state->dataEnvrn->OutBaroPress))); - Real64 FractionalDefrostTime = VRF(VRFCond).DefrostFraction; + Real64 FractionalDefrostTime = state->dataHVACVarRefFlow->VRF(VRFCond).DefrostFraction; Real64 LoadDueToDefrost = - (0.01 * FractionalDefrostTime) * (7.222 - Node(VRF(VRFCond).CondenserNodeNum).Temp) * (VRF(VRFCond).HeatingCapacity / 1.01667); + (0.01 * FractionalDefrostTime) * (7.222 - Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp) * (state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / 1.01667); Real64 HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw; Real64 InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw; // setup curve results - Real64 InletAirDryBulbC = DXCoils::DXCoilHeatInletAirDBTemp(DXHeatingCoilIndex); // load weighted average but only 1 coil here - Real64 OATatHeatCapBoundary = CurveValue(*state, VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); - Real64 OATatHeatEIRBoundary = CurveValue(*state, VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); - Real64 TotHeatCapTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); - Real64 TotHeatEIRTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); - Real64 TotHeatCapTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); - Real64 TotHeatEIRTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); - Real64 EIRFPLRModFac = CurveValue(*state, VRF(VRFCond).HeatEIRFPLR1, max(VRF(VRFCond).MinPLR, VRF(VRFCond).VRFCondPLR)); + Real64 InletAirDryBulbC = state->dataDXCoils->DXCoilHeatInletAirDBTemp(DXHeatingCoilIndex); // load weighted average but only 1 coil here + Real64 OATatHeatCapBoundary = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); + Real64 OATatHeatEIRBoundary = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); + Real64 TotHeatCapTempModFacLo = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); + Real64 TotHeatEIRTempModFacLo = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); + Real64 TotHeatCapTempModFacHi = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); + Real64 TotHeatEIRTempModFacHi = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); + Real64 EIRFPLRModFac = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR1, max(state->dataHVACVarRefFlow->VRF(VRFCond).MinPLR, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR)); Real64 TotalCondHeatingCapacityLo = - VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacLo * HeatingCapacityMultiplier; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity * state->dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacLo * HeatingCapacityMultiplier; Real64 ElecHeatingPowerLo = - VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacLo * TotHeatEIRTempModFacLo * EIRFPLRModFac * InputPowerMultiplier; + state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacLo * TotHeatEIRTempModFacLo * EIRFPLRModFac * InputPowerMultiplier; Real64 TotalCondHeatingCapacityHi = - VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacHi * HeatingCapacityMultiplier; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity * state->dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacHi * HeatingCapacityMultiplier; Real64 ElecHeatingPowerHi = - VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacHi * TotHeatEIRTempModFacHi * EIRFPLRModFac * InputPowerMultiplier; - Real64 HeatingPLRLo = (VRF(VRFCond).TUHeatingLoad / VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityLo; + state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacHi * TotHeatEIRTempModFacHi * EIRFPLRModFac * InputPowerMultiplier; + Real64 HeatingPLRLo = (state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad / state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityLo; HeatingPLRLo += (LoadDueToDefrost * HeatingPLRLo) / TotalCondHeatingCapacityLo; // account for defrost - Real64 OperatingCondHeatCapLo = TotalCondHeatingCapacityLo * VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity - Real64 HeatingPLRHi = (VRF(VRFCond).TUHeatingLoad / VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityHi; + Real64 OperatingCondHeatCapLo = TotalCondHeatingCapacityLo * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity + Real64 HeatingPLRHi = (state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad / state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityHi; HeatingPLRHi += (LoadDueToDefrost * HeatingPLRHi) / TotalCondHeatingCapacityHi; // account for defrost - Real64 OperatingCondHeatCapHi = TotalCondHeatingCapacityHi * VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity + Real64 OperatingCondHeatCapHi = TotalCondHeatingCapacityHi * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity // check that the performance curves yield different results (i.e., different curves are used) EXPECT_NE(TotHeatCapTempModFacLo, TotHeatCapTempModFacHi); @@ -3854,34 +3848,34 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) EXPECT_NE(ElecHeatingPowerLo, ElecHeatingPowerHi); // now test OAT versus boundary curve result and compare results - if (Node(VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatCapBoundary) { // use Hi curves - EXPECT_NEAR(HeatingPLRHi, VRF(VRFCond).VRFCondPLR, 0.000000001); - EXPECT_NEAR(OperatingCondHeatCapHi, VRF(VRFCond).TotalHeatingCapacity, 0.000000001); + if (Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatCapBoundary) { // use Hi curves + EXPECT_NEAR(HeatingPLRHi, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.000000001); + EXPECT_NEAR(OperatingCondHeatCapHi, state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 0.000000001); ASSERT_TRUE(false); } else { // use Lo curves - EXPECT_NEAR(HeatingPLRLo, VRF(VRFCond).VRFCondPLR, 0.000000001); - EXPECT_NEAR(OperatingCondHeatCapLo, VRF(VRFCond).TotalHeatingCapacity, 0.000000001); + EXPECT_NEAR(HeatingPLRLo, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.000000001); + EXPECT_NEAR(OperatingCondHeatCapLo, state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 0.000000001); ASSERT_TRUE(true); } - if (Node(VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatEIRBoundary) { // use Hi curves - EXPECT_NEAR(ElecHeatingPowerHi, VRF(VRFCond).ElecHeatingPower, 0.000000001); + if (Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatEIRBoundary) { // use Hi curves + EXPECT_NEAR(ElecHeatingPowerHi, state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, 0.000000001); ASSERT_TRUE(false); } else { // use Lo curves - EXPECT_NEAR(ElecHeatingPowerLo, VRF(VRFCond).ElecHeatingPower, 0.000000001); + EXPECT_NEAR(ElecHeatingPowerLo, state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, 0.000000001); ASSERT_TRUE(true); } // test that Hi curves are used for higher OAT HeatingCapacityMultiplier = 1.0; // no defrost operation InputPowerMultiplier = 1.0; // no defrost operation - Node(VRF(VRFCond).CondenserNodeNum).Temp = 15; - Node(VRF(VRFCond).CondenserNodeNum).OutAirWetBulb = 7.0; - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = Node(VRF(VRFCond).CondenserNodeNum).Temp; - Node(VRFTU(VRFCond).VRFTUInletNodeNum).Temp = 20; // 20 C at 13 C WB (44.5 % RH) for indoor heating condition - Node(VRFTU(VRFCond).VRFTUInletNodeNum).HumRat = 0.0064516; // need to set these so OA mixer will get proper mixed air condition - Node(VRFTU(VRFCond).VRFTUInletNodeNum).Enthalpy = 36485.3142; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 15; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).OutAirWetBulb = 7.0; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp; + Node(state->dataHVACVarRefFlow->VRFTU(VRFCond).VRFTUInletNodeNum).Temp = 20; // 20 C at 13 C WB (44.5 % RH) for indoor heating condition + Node(state->dataHVACVarRefFlow->VRFTU(VRFCond).VRFTUInletNodeNum).HumRat = 0.0064516; // need to set these so OA mixer will get proper mixed air condition + Node(state->dataHVACVarRefFlow->VRFTU(VRFCond).VRFTUInletNodeNum).Enthalpy = 36485.3142; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -3893,23 +3887,23 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) SysOutputProvided, LatOutputProvided); - outWB = Node(VRF(VRFCond).CondenserNodeNum).OutAirWetBulb; // no defrost adjustment to OA WB - InletAirDryBulbC = DXCoils::DXCoilHeatInletAirDBTemp(DXHeatingCoilIndex); // load weighted average but only 1 coil here - OATatHeatCapBoundary = CurveValue(*state, VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); - OATatHeatEIRBoundary = CurveValue(*state, VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); - TotHeatCapTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); - TotHeatEIRTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); - TotHeatCapTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); - TotHeatEIRTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); - EIRFPLRModFac = CurveValue(*state, VRF(VRFCond).HeatEIRFPLR1, max(VRF(VRFCond).MinPLR, VRF(VRFCond).VRFCondPLR)); // EIRFPLR1 is used when PLR <= 1 - TotalCondHeatingCapacityLo = VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacLo * HeatingCapacityMultiplier; - ElecHeatingPowerLo = VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacLo * TotHeatEIRTempModFacLo * EIRFPLRModFac * InputPowerMultiplier; - TotalCondHeatingCapacityHi = VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacHi * HeatingCapacityMultiplier; - ElecHeatingPowerHi = VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacHi * TotHeatEIRTempModFacHi * EIRFPLRModFac * InputPowerMultiplier; - HeatingPLRLo = (VRF(VRFCond).TUHeatingLoad / VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityLo; - OperatingCondHeatCapLo = TotalCondHeatingCapacityLo * VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity - HeatingPLRHi = (VRF(VRFCond).TUHeatingLoad / VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityHi; - OperatingCondHeatCapHi = TotalCondHeatingCapacityHi * VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity + outWB = Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).OutAirWetBulb; // no defrost adjustment to OA WB + InletAirDryBulbC = state->dataDXCoils->DXCoilHeatInletAirDBTemp(DXHeatingCoilIndex); // load weighted average but only 1 coil here + OATatHeatCapBoundary = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); + OATatHeatEIRBoundary = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); + TotHeatCapTempModFacLo = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); + TotHeatEIRTempModFacLo = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); + TotHeatCapTempModFacHi = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); + TotHeatEIRTempModFacHi = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); + EIRFPLRModFac = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR1, max(state->dataHVACVarRefFlow->VRF(VRFCond).MinPLR, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR)); // EIRFPLR1 is used when PLR <= 1 + TotalCondHeatingCapacityLo = state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity * state->dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacLo * HeatingCapacityMultiplier; + ElecHeatingPowerLo = state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacLo * TotHeatEIRTempModFacLo * EIRFPLRModFac * InputPowerMultiplier; + TotalCondHeatingCapacityHi = state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity * state->dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacHi * HeatingCapacityMultiplier; + ElecHeatingPowerHi = state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacHi * TotHeatEIRTempModFacHi * EIRFPLRModFac * InputPowerMultiplier; + HeatingPLRLo = (state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad / state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityLo; + OperatingCondHeatCapLo = TotalCondHeatingCapacityLo * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity + HeatingPLRHi = (state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad / state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating) / TotalCondHeatingCapacityHi; + OperatingCondHeatCapHi = TotalCondHeatingCapacityHi * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalHeatingCapacity // check that the performance curves yield different results (i.e., different curves are used) EXPECT_NE(TotHeatCapTempModFacLo, TotHeatCapTempModFacHi); @@ -3919,21 +3913,21 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) EXPECT_NE(ElecHeatingPowerLo, ElecHeatingPowerHi); // now test OAT versus boundary curve result and compare results - if (Node(VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatCapBoundary) { // use Hi curves - EXPECT_NEAR(HeatingPLRHi, VRF(VRFCond).VRFCondPLR, 0.000000001); - EXPECT_NEAR(OperatingCondHeatCapHi, VRF(VRFCond).TotalHeatingCapacity, 0.000000001); + if (Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatCapBoundary) { // use Hi curves + EXPECT_NEAR(HeatingPLRHi, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.000000001); + EXPECT_NEAR(OperatingCondHeatCapHi, state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 0.000000001); ASSERT_TRUE(true); } else { // use Lo curves - EXPECT_NEAR(HeatingPLRLo, VRF(VRFCond).VRFCondPLR, 0.000000001); - EXPECT_NEAR(OperatingCondHeatCapLo, VRF(VRFCond).TotalHeatingCapacity, 0.000000001); + EXPECT_NEAR(HeatingPLRLo, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.000000001); + EXPECT_NEAR(OperatingCondHeatCapLo, state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 0.000000001); ASSERT_TRUE(false); } - if (Node(VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatEIRBoundary) { // use Hi curves - EXPECT_NEAR(ElecHeatingPowerHi, VRF(VRFCond).ElecHeatingPower, 0.000000001); + if (Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp > OATatHeatEIRBoundary) { // use Hi curves + EXPECT_NEAR(ElecHeatingPowerHi, state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, 0.000000001); EXPECT_LE(HeatingPLRHi, 1.0); // make sure correct EIRfPLR curve is used ASSERT_TRUE(true); } else { // use Lo curves - EXPECT_NEAR(ElecHeatingPowerLo, VRF(VRFCond).ElecHeatingPower, 0.000000001); + EXPECT_NEAR(ElecHeatingPowerLo, state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, 0.000000001); ASSERT_TRUE(false); } @@ -3946,28 +3940,28 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) TempControlType = 4; ZT.allocate(1); ZT = 25.0; - Node(VRFTU(VRFTUNum).ZoneAirNode).Temp = 27.0; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp = 27.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = - -VRF(VRFCond).CoolingCapacity * 0.75; // set load equal to the VRF cooling capacity adjusted for SHR - ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -VRF(VRFCond).CoolingCapacity * 0.75; - ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = -VRF(VRFCond).CoolingCapacity * 0.75 - 1000.0; - - Node(VRF(VRFCond).CondenserNodeNum).Temp = 35.0; // AHRI condition at 95 F db - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 27.0; // some zone return condition - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.011; - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 55194.0; // VRF DX coil model uses node enthalpy - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 35.0; // AHRI condition at 95 F db - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).HumRat = 0.008; // don't care - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Enthalpy = 55698.0; - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).OutAirWetBulb = 19.652; - - VRF(VRFCond).MasterZonePtr = 0; - VRF(VRFCond).MasterZoneTUIndex = 0; - VRF(VRFCond).ThermostatPriority = ThermostatOffsetPriority; + -state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * 0.75; // set load equal to the VRF cooling capacity adjusted for SHR + ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * 0.75; + ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = -state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * 0.75 - 1000.0; + + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 35.0; // AHRI condition at 95 F db + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 27.0; // some zone return condition + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.011; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 55194.0; // VRF DX coil model uses node enthalpy + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 35.0; // AHRI condition at 95 F db + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).HumRat = 0.008; // don't care + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Enthalpy = 55698.0; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).OutAirWetBulb = 19.652; + + state->dataHVACVarRefFlow->VRF(VRFCond).MasterZonePtr = 0; + state->dataHVACVarRefFlow->VRF(VRFCond).MasterZoneTUIndex = 0; + state->dataHVACVarRefFlow->VRF(VRFCond).ThermostatPriority = iThermostatCtrlType::ThermostatOffsetPriority; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -3984,21 +3978,21 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) // test that correct performance curve is used (i.e., lo or hi performance curves based on OAT) int DXCoolingCoilIndex = 1; - Real64 InletAirWetBulbC = DXCoils::DXCoilCoolInletAirWBTemp(DXCoolingCoilIndex); // load weighted average but only 1 coil here - Real64 OATatCoolCapBoundary = CurveValue(*state, VRF(VRFCond).CoolBoundaryCurvePtr, InletAirWetBulbC); - Real64 OATatCoolEIRBoundary = CurveValue(*state, VRF(VRFCond).EIRCoolBoundaryCurvePtr, InletAirWetBulbC); - Real64 TotCoolCapTempModFacLo = CurveValue(*state, VRF(VRFCond).CoolCapFT, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); - Real64 TotCoolEIRTempModFacLo = CurveValue(*state, VRF(VRFCond).CoolEIRFT, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); - Real64 TotCoolCapTempModFacHi = CurveValue(*state, VRF(VRFCond).CoolCapFTHi, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); - Real64 TotCoolEIRTempModFacHi = CurveValue(*state, VRF(VRFCond).CoolEIRFTHi, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); - Real64 TotalCondCoolingCapacityLo = VRF(VRFCond).CoolingCapacity * CoolCombinationRatio(VRFCond) * TotCoolCapTempModFacLo; - Real64 ElecCoolingPowerLo = VRF(VRFCond).RatedCoolingPower * TotCoolCapTempModFacLo * TotCoolEIRTempModFacLo; - Real64 TotalCondCoolingCapacityHi = VRF(VRFCond).CoolingCapacity * CoolCombinationRatio(VRFCond) * TotCoolCapTempModFacHi; - Real64 ElecCoolingPowerHi = VRF(VRFCond).RatedCoolingPower * TotCoolCapTempModFacHi * TotCoolEIRTempModFacHi; - Real64 CoolingPLRLo = (VRF(VRFCond).TUCoolingLoad / VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacityLo; - Real64 OperatingCondCoolCapLo = TotalCondCoolingCapacityLo * VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalCoolingCapacity - Real64 CoolingPLRHi = (VRF(VRFCond).TUCoolingLoad / VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacityHi; - Real64 OperatingCondCoolCapHi = TotalCondCoolingCapacityHi * VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalCoolingCapacity + Real64 InletAirWetBulbC = state->dataDXCoils->DXCoilCoolInletAirWBTemp(DXCoolingCoilIndex); // load weighted average but only 1 coil here + Real64 OATatCoolCapBoundary = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).CoolBoundaryCurvePtr, InletAirWetBulbC); + Real64 OATatCoolEIRBoundary = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).EIRCoolBoundaryCurvePtr, InletAirWetBulbC); + Real64 TotCoolCapTempModFacLo = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).CoolCapFT, InletAirWetBulbC, Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp); + Real64 TotCoolEIRTempModFacLo = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFT, InletAirWetBulbC, Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp); + Real64 TotCoolCapTempModFacHi = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).CoolCapFTHi, InletAirWetBulbC, Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp); + Real64 TotCoolEIRTempModFacHi = CurveValue(*state, state->dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFTHi, InletAirWetBulbC, Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp); + Real64 TotalCondCoolingCapacityLo = state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * state->dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) * TotCoolCapTempModFacLo; + Real64 ElecCoolingPowerLo = state->dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower * TotCoolCapTempModFacLo * TotCoolEIRTempModFacLo; + Real64 TotalCondCoolingCapacityHi = state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity * state->dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) * TotCoolCapTempModFacHi; + Real64 ElecCoolingPowerHi = state->dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower * TotCoolCapTempModFacHi * TotCoolEIRTempModFacHi; + Real64 CoolingPLRLo = (state->dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad / state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacityLo; + Real64 OperatingCondCoolCapLo = TotalCondCoolingCapacityLo * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalCoolingCapacity + Real64 CoolingPLRHi = (state->dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad / state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling) / TotalCondCoolingCapacityHi; + Real64 OperatingCondCoolCapHi = TotalCondCoolingCapacityHi * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR; // = VRF(VRFCond).TotalCoolingCapacity // check that the performance curves yield different results (i.e., different curves are used) EXPECT_NE(TotCoolCapTempModFacLo, TotCoolCapTempModFacHi); @@ -4008,38 +4002,38 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) EXPECT_NE(ElecCoolingPowerLo, ElecCoolingPowerHi); // now test OAT versus boundary curve result and compare results - if (Node(VRF(VRFCond).CondenserNodeNum).Temp > OATatCoolCapBoundary) { // use Hi curves - EXPECT_NEAR(CoolingPLRHi, VRF(VRFCond).VRFCondPLR, 0.000000001); + if (Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp > OATatCoolCapBoundary) { // use Hi curves + EXPECT_NEAR(CoolingPLRHi, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.000000001); EXPECT_GT(CoolingPLRHi, 1.0); - EXPECT_NEAR(OperatingCondCoolCapHi, VRF(VRFCond).TotalCoolingCapacity, 0.000000001); + EXPECT_NEAR(OperatingCondCoolCapHi, state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 0.000000001); ASSERT_TRUE(true); } else { // use Lo curves - EXPECT_NEAR(CoolingPLRLo, VRF(VRFCond).VRFCondPLR, 0.000000001); - EXPECT_NEAR(OperatingCondCoolCapLo, VRF(VRFCond).TotalCoolingCapacity, 0.000000001); + EXPECT_NEAR(CoolingPLRLo, state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.000000001); + EXPECT_NEAR(OperatingCondCoolCapLo, state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 0.000000001); ASSERT_TRUE(false); } - if (Node(VRF(VRFCond).CondenserNodeNum).Temp > OATatCoolEIRBoundary) { // use Hi curves - EXPECT_NEAR(ElecCoolingPowerHi, VRF(VRFCond).ElecCoolingPower, 0.000000001); + if (Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp > OATatCoolEIRBoundary) { // use Hi curves + EXPECT_NEAR(ElecCoolingPowerHi, state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, 0.000000001); ASSERT_TRUE(true); } else { // use Lo curves - EXPECT_NEAR(ElecCoolingPowerLo, VRF(VRFCond).ElecCoolingPower, 0.000000001); + EXPECT_NEAR(ElecCoolingPowerLo, state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, 0.000000001); ASSERT_TRUE(false); } // ensure that TU turns off when fan heat exceeds the heating load ZT = 20.0; // set zone temp below heating SP (SP=21) to ensure heating mode - Node(VRFTU(VRFTUNum).ZoneAirNode).Temp = 20.0; - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 20; // 20 C at 13 C WB (44.5 % RH) for indoor heating condition - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.0064516; // need to set these so OA mixer will get proper mixed air condition - Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 36485.3142; - Node(VRF(VRFCond).CondenserNodeNum).Temp = 20.0; // within the heating temperature range of VRF outdoor unit - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 19.0; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp = 20.0; + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 20; // 20 C at 13 C WB (44.5 % RH) for indoor heating condition + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.0064516; // need to set these so OA mixer will get proper mixed air condition + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 36485.3142; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 20.0; // within the heating temperature range of VRF outdoor unit + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 19.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = 400.0; // set load equal to small value less than expected fan heat ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 500.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 400.0; - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -4052,18 +4046,18 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) LatOutputProvided); EXPECT_EQ(SysOutputProvided, 0.0); // for this system with 0 no load flow rate output should be = 0 when fan heat at very low TU PLR (1E-20) is greater than load - EXPECT_EQ(VRF(VRFCond).VRFCondPLR, 0.0); // system should be off + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.0); // system should be off // ensure that TU operates when fan heat does not exceed the heating load ZT = 20.0; // set zone temp below heating SP (SP=21) to ensure heating mode - Node(VRF(VRFCond).CondenserNodeNum).Temp = 19.0; // within the heating temperature range of VRF outdoor unit - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 19.0; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 19.0; // within the heating temperature range of VRF outdoor unit + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 19.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = 800.0; // set load equal to small value less than expected fan heat ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 900.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 800.0; - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -4075,12 +4069,12 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) SysOutputProvided, LatOutputProvided); EXPECT_NEAR(SysOutputProvided, ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired, 5.0); // system should meet the heating load - EXPECT_GT(VRF(VRFCond).VRFCondPLR, 0.0); // system should be on + EXPECT_GT(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.0); // system should be on - Node(VRF(VRFCond).CondenserNodeNum).Temp = 21.0; // outside the heating temperature range (-20 to 20) of VRF outdoor unit - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 21.0; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 21.0; // outside the heating temperature range (-20 to 20) of VRF outdoor unit + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 21.0; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -4091,15 +4085,15 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) ZoneEquipment, SysOutputProvided, LatOutputProvided); - EXPECT_EQ(VRF(VRFCond).VRFCondPLR, 0.0); // system should be off - EXPECT_EQ(Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.0); // system should be off + EXPECT_EQ(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, 0.0); // flow should be = 0 at no load flow rate for constant fan mode in this example - EXPECT_EQ(Node(VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, + EXPECT_EQ(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, 0.0); // flow should be = 0 at no load flow rate for constant fan mode in this example - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -4110,9 +4104,9 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) ZoneEquipment, SysOutputProvided, LatOutputProvided); - EXPECT_EQ(VRF(VRFCond).VRFCondPLR, 0.0); // system should also be off - EXPECT_EQ(Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode - EXPECT_EQ(Node(VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.0); // system should also be off + EXPECT_EQ(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode + EXPECT_EQ(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode } TEST_F(EnergyPlusFixture, VRFTest_SysCurve_GetInputFailers) @@ -4715,14 +4709,14 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_GetInputFailers) GetZoneEquipmentData(*state); // read equipment list and connections GetVRFInputData(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); - EXPECT_EQ(0, VRFTU(VRFTUNum).VRFSysNum); - EXPECT_EQ(1, VRFTU(VRFTUNum).ZoneNum); - EXPECT_EQ(0, VRFTU(VRFTUNum).TUListIndex); - EXPECT_EQ(0, VRFTU(VRFTUNum).IndexToTUInTUList); + EXPECT_EQ(0, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum); + EXPECT_EQ(1, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum); + EXPECT_EQ(0, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).TUListIndex); + EXPECT_EQ(0, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).IndexToTUInTUList); // Additional tests for fuel type input - EXPECT_EQ(VRF(VRFTUNum).FuelType, "Electricity"); - EXPECT_EQ(VRF(VRFTUNum).FuelTypeNum, DataGlobalConstants::ResourceType::Electricity); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFTUNum).FuelType, "Electricity"); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFTUNum).FuelTypeNum, DataGlobalConstants::ResourceType::Electricity); } TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) @@ -5575,14 +5569,14 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) PlantManager::GetPlantLoopData(*state); PlantManager::GetPlantInput(*state); - HVACVariableRefrigerantFlow::MyEnvrnFlag = true; + state->dataHVACVarRefFlow->MyEnvrnFlag = true; ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function state->dataAirLoop->AirLoopInputsFilled = true; - Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode + Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode // Test coil sizing @@ -5592,9 +5586,9 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) DataSizing::FinalZoneSizing(CurZoneEqNum).ZoneRetTempAtCoolPeak = 26.66667; DataSizing::FinalZoneSizing(CurZoneEqNum).ZoneHumRatAtCoolPeak = 0.01117049470250416; // AHRI condition at 80 F db / 67 F wb - DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).Temp = 35.0; // AHRI condition at 95 F db - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 35.0; // AHRI condition at 95 F db - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).HumRat = 0.01; // don't care + DataLoopNode::Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 35.0; // AHRI condition at 95 F db + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 35.0; // AHRI condition at 95 F db + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).HumRat = 0.01; // don't care DataSizing::FinalZoneSizing(CurZoneEqNum).CoolDDNum = 1; DataSizing::FinalZoneSizing(CurZoneEqNum).TimeStepNumAtCoolMax = 1; DataSizing::DesDayWeath.allocate(1); @@ -5616,7 +5610,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) bool ZoneEquipment = true; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -5629,7 +5623,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) LatOutputProvided); // call plant-side VRF - auto vrfCondPtr = HVACVariableRefrigerantFlow::VRFCondenserEquipment::factory(*state, VRF(VRFCond).Name); + auto vrfCondPtr = HVACVariableRefrigerantFlow::VRFCondenserEquipment::factory(*state, state->dataHVACVarRefFlow->VRF(VRFCond).Name); PlantLocation dummyLoc; dummyLoc.loopNum = dynamic_cast(vrfCondPtr)->SourceLoopNum; vrfCondPtr->onInitLoopEquip(*state, dummyLoc); @@ -5639,18 +5633,18 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = -2000.0; state->dataGlobal->BeginEnvrnFlag = true; - DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Temp = 24.0; - DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).HumRat = 0.0093; - DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Enthalpy = 47794.1; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 24.0; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.0093; - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 47794.1; + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp = 24.0; + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).HumRat = 0.0093; + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Enthalpy = 47794.1; + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 24.0; + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.0093; + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 47794.1; state->dataEnvrn->OutDryBulbTemp = 35.0; state->dataEnvrn->OutHumRat = 0.017767; // 50% RH state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->OutWetBulbTemp = 26.045; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -5661,41 +5655,41 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) ZoneEquipment, SysOutputProvided, LatOutputProvided); - EXPECT_TRUE(VRF(VRFCond).VRFCondPLR > 0.0); + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR > 0.0); EXPECT_NEAR(SysOutputProvided, ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP, 1.0); rho = GetDensityGlycol(*state, - PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, PlantSizData(1).ExitTemp, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); + PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidName, PlantSizData(1).ExitTemp, PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); Cp = GetSpecificHeatGlycol(*state, - PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, PlantSizData(1).ExitTemp, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); - CondVolFlowRate = max(VRF(VRFCond).CoolingCapacity, VRF(VRFCond).HeatingCapacity) / (PlantSizData(1).DeltaT * Cp * rho); + PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidName, PlantSizData(1).ExitTemp, PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); + CondVolFlowRate = max(state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity, state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity) / (PlantSizData(1).DeltaT * Cp * rho); - EXPECT_DOUBLE_EQ(CondVolFlowRate, VRF(VRFCond).WaterCondVolFlowRate); + EXPECT_DOUBLE_EQ(CondVolFlowRate, state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondVolFlowRate); rho = GetDensityGlycol(*state, - PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, DataGlobalConstants::InitConvTemp, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); - EXPECT_DOUBLE_EQ(VRF(VRFCond).WaterCondenserDesignMassFlow, (VRF(VRFCond).WaterCondVolFlowRate * rho)); + PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidName, DataGlobalConstants::InitConvTemp, PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow, (state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondVolFlowRate * rho)); // set zone load to heating DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = - VRF(VRFCond).HeatingCapacity; // set load equal to the VRF heating capacity + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity; // set load equal to the VRF heating capacity DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = - VRF(VRFCond).HeatingCapacity + 1000.0; // simulates a dual Tstat with load to cooling SP > load to heating SP - DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = VRF(VRFCond).HeatingCapacity; - - DataLoopNode::Node(VRF(VRFCond).CondenserNodeNum).Temp = 7.0; // water inlet temperature - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 20.0; // TU inlet air temp - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.0056; // TU inlet air humrat - DataLoopNode::Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 34823.5; // TU inlet air enthalpy - DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Temp = 20.0; // also set zone conditions - DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).HumRat = 0.0056; - DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Enthalpy = 34823.5; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity + 1000.0; // simulates a dual Tstat with load to cooling SP > load to heating SP + DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity; + + DataLoopNode::Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 7.0; // water inlet temperature + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp = 20.0; // TU inlet air temp + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).HumRat = 0.0056; // TU inlet air humrat + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Enthalpy = 34823.5; // TU inlet air enthalpy + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp = 20.0; // also set zone conditions + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).HumRat = 0.0056; + DataLoopNode::Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Enthalpy = 34823.5; state->dataEnvrn->OutDryBulbTemp = 5.0; state->dataEnvrn->OutHumRat = 0.00269; // 50% RH state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->OutWetBulbTemp = 1.34678; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -5707,17 +5701,17 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) SysOutputProvided, LatOutputProvided); - EXPECT_TRUE(VRF(VRFCond).VRFCondPLR > 0.0); + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR > 0.0); EXPECT_NEAR(SysOutputProvided, ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP, 1.0); - ASSERT_EQ(VRF(VRFCond).WaterCondenserDesignMassFlow, - Node(VRF(VRFCond).CondenserNodeNum).MassFlowRate); // Condenser flow rate should be set for active cooling - ASSERT_EQ(VRF(VRFCond).WaterCondenserDesignMassFlow, Node(VRF(VRFCond).CondenserOutletNodeNum).MassFlowRate); // outlet node should also be set + ASSERT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow, + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).MassFlowRate); // Condenser flow rate should be set for active cooling + ASSERT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow, Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserOutletNodeNum).MassFlowRate); // outlet node should also be set - Node(VRF(VRFCond).CondenserNodeNum).Temp = 21.0; // outside the heating temperature range (-20 to 20) of VRF outdoor unit - Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 21.0; + Node(state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum).Temp = 21.0; // outside the heating temperature range (-20 to 20) of VRF outdoor unit + Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 21.0; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -5728,16 +5722,16 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) ZoneEquipment, SysOutputProvided, LatOutputProvided); - EXPECT_EQ(VRF(VRFCond).VRFCondPLR, 0.0); // system should be off - EXPECT_EQ(Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode - EXPECT_EQ(Node(VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.0); // system should be off + EXPECT_EQ(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode + EXPECT_EQ(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, 0.0); // flow should be = 0 for cycling fan mode DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -5748,10 +5742,10 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) ZoneEquipment, SysOutputProvided, LatOutputProvided); - EXPECT_EQ(VRF(VRFCond).VRFCondPLR, 0.0); // system should also be off - EXPECT_GT(Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.0); // system should also be off + EXPECT_GT(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate, 0.0); // flow should be > 0 at no load flow rate for constant fan mode in this example - EXPECT_GT(Node(VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, + EXPECT_GT(Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, 0.0); // flow should be > 0 at no load flow rate for constant fan mode in this example } @@ -6449,32 +6443,32 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NoLoad_OAMassFlowRateTest) DataZoneEquipment::GetZoneEquipmentData(*state); // read equipment list and connections state->dataAirLoop->AirLoopInputsFilled = true; - HVACVariableRefrigerantFlow::MyEnvrnFlag = true; + state->dataHVACVarRefFlow->MyEnvrnFlag = true; ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function - OutsideAirNode = VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; // outside air air inlet node num + OutsideAirNode = state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; // outside air air inlet node num DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = 0.0; // No load DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 0.0; // No load DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 0.0; // No load QZnReq = DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired; // No load // Initialize terminal unit - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // turn on TU - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set continuous fan operating mode + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // turn on TU + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set continuous fan operating mode InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters - ASSERT_EQ(VRFTU(VRFTUNum).OpMode, DataHVACGlobals::ContFanCycCoil); // continuous fan cycling coil operating mode + ASSERT_EQ(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode, DataHVACGlobals::ContFanCycCoil); // continuous fan cycling coil operating mode // Set average OA flow rate when there in no load for cont. fan cyc. coil operating mode SetAverageAirFlow(*state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio); - AverageOAMassFlow = state->dataEnvrn->StdRhoAir * VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; + AverageOAMassFlow = state->dataEnvrn->StdRhoAir * state->dataHVACVarRefFlow->VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; EXPECT_EQ(AverageOAMassFlow, Node(OutsideAirNode).MassFlowRate); // test availability manager operation - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 0.0; // turn off fan + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 0.0; // turn off fan SetAverageAirFlow(*state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_EQ(0.0, Node(OutsideAirNode).MassFlowRate); EXPECT_FALSE(DataHVACGlobals::ZoneCompTurnFansOn); EXPECT_FALSE(DataHVACGlobals::ZoneCompTurnFansOff); - EXPECT_EQ(0.0, Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue); + EXPECT_EQ(0.0, Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue); // turn on "Turn Fan On" flag for availability manager, result should be the same as previous non-zero result DataHVACGlobals::ZoneCompTurnFansOn = true; @@ -6533,65 +6527,65 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) CurveManager::GetCurveInput(*state); int VRFCond = 1; - VRF.allocate(1); - VRF(VRFCond).CondenserNodeNum = 0; - VRF(VRFCond).CondenserType = 1; // DataHVACGlobals::AirCooled - VRF(VRFCond).ZoneTUListPtr = 1; - VRF(VRFCond).CoolingCapacity = 20000.0; - VRF(VRFCond).HeatingCapacity = 20000.0; - VRF(VRFCond).CoolingCOP = 3.0; - VRF(VRFCond).HeatingCOP = 3.0; - VRF(VRFCond).RatedCoolingPower = VRF(VRFCond).CoolingCapacity / VRF(VRFCond).CoolingCOP; - VRF(VRFCond).RatedHeatingPower = VRF(VRFCond).HeatingCapacity / VRF(VRFCond).HeatingCOP; - VRF(VRFCond).PipingCorrectionCooling = 1.0; - VRF(VRFCond).PipingCorrectionHeating = 1.0; - VRF(VRFCond).CoolCapFT = 1; - VRF(VRFCond).CoolEIRFT = 1; - VRF(VRFCond).CoolEIRFPLR1 = 2; - VRF(VRFCond).HeatEIRFPLR1 = 2; - CoolCombinationRatio.allocate(1); - CoolCombinationRatio(VRFCond) = 1.0; - HeatCombinationRatio.allocate(1); - HeatCombinationRatio(VRFCond) = 1.0; - LastModeCooling.allocate(1); - LastModeHeating.allocate(1); - - TerminalUnitList.allocate(1); - TerminalUnitList(1).NumTUInList = 5; - TerminalUnitList(1).TotalCoolLoad.allocate(5); - TerminalUnitList(1).TotalHeatLoad.allocate(5); - TerminalUnitList(1).ZoneTUPtr.allocate(5); - TerminalUnitList(1).HRCoolRequest.allocate(5); - TerminalUnitList(1).HRHeatRequest.allocate(5); - TerminalUnitList(1).HRCoolRequest = false; - TerminalUnitList(1).HRHeatRequest = false; - - TerminalUnitList(1).CoolingCoilAvailable.allocate(5); - TerminalUnitList(1).HeatingCoilAvailable.allocate(5); + state->dataHVACVarRefFlow->VRF.allocate(1); + state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum = 0; + state->dataHVACVarRefFlow->VRF(VRFCond).CondenserType = 1; // DataHVACGlobals::AirCooled + state->dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr = 1; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity = 20000.0; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity = 20000.0; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP = 3.0; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP = 3.0; + state->dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower = state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity / state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP; + state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower = state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP; + state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = 1.0; + state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = 1.0; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolCapFT = 1; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFT = 1; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFPLR1 = 2; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR1 = 2; + state->dataHVACVarRefFlow->CoolCombinationRatio.allocate(1); + state->dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) = 1.0; + state->dataHVACVarRefFlow->HeatCombinationRatio.allocate(1); + state->dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) = 1.0; + state->dataHVACVarRefFlow->LastModeCooling.allocate(1); + state->dataHVACVarRefFlow->LastModeHeating.allocate(1); + + state->dataHVACVarRefFlow->TerminalUnitList.allocate(1); + state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList = 5; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).ZoneTUPtr.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest = false; + + state->dataHVACVarRefFlow->TerminalUnitList(1).CoolingCoilAvailable.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HeatingCoilAvailable.allocate(5); // all TU coils are available - TerminalUnitList(1).CoolingCoilAvailable = true; - TerminalUnitList(1).HeatingCoilAvailable = true; - - CoolingLoad.allocate(1); - HeatingLoad.allocate(1); - CoolingLoad(VRFCond) = false; - HeatingLoad(VRFCond) = false; - LastModeCooling(VRFCond) = false; - LastModeHeating(VRFCond) = false; - - DXCoilCoolInletAirWBTemp.allocate(10); - DXCoilHeatInletAirDBTemp.allocate(10); - DXCoilHeatInletAirWBTemp.allocate(10); - - VRFTU.allocate(5); - for (int NumTU = 1; NumTU <= TerminalUnitList(1).NumTUInList; ++NumTU) { - VRFTU(NumTU).CoolCoilIndex = NumTU; - VRFTU(NumTU).HeatCoilIndex = TerminalUnitList(1).NumTUInList + NumTU; - TerminalUnitList(1).ZoneTUPtr(NumTU) = NumTU; + state->dataHVACVarRefFlow->TerminalUnitList(1).CoolingCoilAvailable = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).HeatingCoilAvailable = true; + + state->dataHVACVarRefFlow->CoolingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad.allocate(1); + state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state->dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state->dataHVACVarRefFlow->LastModeCooling(VRFCond) = false; + state->dataHVACVarRefFlow->LastModeHeating(VRFCond) = false; + + state->dataDXCoils->DXCoilCoolInletAirWBTemp.allocate(10); + state->dataDXCoils->DXCoilHeatInletAirDBTemp.allocate(10); + state->dataDXCoils->DXCoilHeatInletAirWBTemp.allocate(10); + + state->dataHVACVarRefFlow->VRFTU.allocate(5); + for (int NumTU = 1; NumTU <= state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList; ++NumTU) { + state->dataHVACVarRefFlow->VRFTU(NumTU).CoolCoilIndex = NumTU; + state->dataHVACVarRefFlow->VRFTU(NumTU).HeatCoilIndex = state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList + NumTU; + state->dataHVACVarRefFlow->TerminalUnitList(1).ZoneTUPtr(NumTU) = NumTU; // initialize DX coil inlet conditions - DXCoilCoolInletAirWBTemp(NumTU) = 19.4; - DXCoilHeatInletAirDBTemp(TerminalUnitList(1).NumTUInList + NumTU) = 20.0; - DXCoilHeatInletAirWBTemp(TerminalUnitList(1).NumTUInList + NumTU) = 17.0; + state->dataDXCoils->DXCoilCoolInletAirWBTemp(NumTU) = 19.4; + state->dataDXCoils->DXCoilHeatInletAirDBTemp(state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList + NumTU) = 20.0; + state->dataDXCoils->DXCoilHeatInletAirWBTemp(state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList + NumTU) = 17.0; } // set up environment @@ -6605,211 +6599,211 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) state->dataEnvrn->OutWetBulbTemp = 21.1340575; // TU's are off - TerminalUnitList(1).TotalCoolLoad(1) = 0.0; - TerminalUnitList(1).TotalCoolLoad(2) = 0.0; - TerminalUnitList(1).TotalCoolLoad(3) = 0.0; - TerminalUnitList(1).TotalCoolLoad(4) = 0.0; - TerminalUnitList(1).TotalCoolLoad(5) = 0.0; - TerminalUnitList(1).TotalHeatLoad(1) = 0.0; - TerminalUnitList(1).TotalHeatLoad(2) = 0.0; - TerminalUnitList(1).TotalHeatLoad(3) = 0.0; - TerminalUnitList(1).TotalHeatLoad(4) = 0.0; - TerminalUnitList(1).TotalHeatLoad(5) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(1) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(2) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(3) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(4) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(5) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(1) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(2) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(3) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(4) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(5) = 0.0; CalcVRFCondenser(*state, VRFCond); - EXPECT_DOUBLE_EQ(VRF(VRFCond).ElecCoolingPower, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).ElecHeatingPower, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).CrankCaseHeaterPower, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).EvapCondPumpElecPower, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).EvapWaterConsumpRate, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).DefrostPower, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).OperatingCoolingCOP, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).OperatingHeatingCOP, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).OperatingCOP, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).SCHE, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).BasinHeaterPower, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).SUMultiplier, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).VRFCondPLR, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).VRFCondRTF, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).VRFCondCyclingRatio, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).QCondEnergy, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).TotalHeatingCapacity, 0.0); - EXPECT_DOUBLE_EQ(VRF(VRFCond).OperatingMode, 0.0); - EXPECT_FALSE(VRF(VRFCond).HRHeatingActive); - EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).CrankCaseHeaterPower, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).EvapCondPumpElecPower, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).EvapWaterConsumpRate, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).DefrostPower, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).OperatingCoolingCOP, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).OperatingHeatingCOP, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).OperatingCOP, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).SCHE, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).BasinHeaterPower, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondCyclingRatio, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).QCondEnergy, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 0.0); + EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).OperatingMode, 0.0); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive); // TU's are in cooling mode only - CoolingLoad(VRFCond) = true; - LastModeCooling(VRFCond) = true; - LastModeHeating(VRFCond) = false; - TerminalUnitList(1).TotalCoolLoad(1) = 1000.0; - TerminalUnitList(1).TotalCoolLoad(2) = 1000.0; - TerminalUnitList(1).TotalCoolLoad(3) = 1000.0; - TerminalUnitList(1).TotalCoolLoad(4) = 1000.0; - TerminalUnitList(1).TotalCoolLoad(5) = 1000.0; + state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; + state->dataHVACVarRefFlow->LastModeCooling(VRFCond) = true; + state->dataHVACVarRefFlow->LastModeHeating(VRFCond) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(1) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(2) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(3) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(4) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(5) = 1000.0; CalcVRFCondenser(*state, VRFCond); - EXPECT_FALSE(VRF(VRFCond).HRHeatingActive); - EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); - EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 5000.0); - EXPECT_EQ(VRF(VRFCond).TUCoolingLoad, 5000.0); - EXPECT_EQ(VRF(VRFCond).TotalHeatingCapacity, 0.0); - EXPECT_EQ(VRF(VRFCond).TUHeatingLoad, 0.0); - EXPECT_EQ(VRF(VRFCond).VRFCondPLR, 0.25); - EXPECT_EQ(VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR - EXPECT_EQ(VRF(VRFCond).SUMultiplier, 1.0); - EXPECT_FALSE(VRF(VRFCond).ModeChange); - EXPECT_FALSE(VRF(VRFCond).HRModeChange); - EXPECT_EQ(VRF(VRFCond).ElecCoolingPower, VRF(VRFCond).RatedCoolingPower * VRF(VRFCond).VRFCondPLR); - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, 0.0); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 5000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad, 5000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.25); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 1.0); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).ModeChange); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRModeChange); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, 0.0); // TU's are in heating mode only - CoolingLoad(VRFCond) = false; - HeatingLoad(VRFCond) = true; - LastModeCooling(VRFCond) = false; - LastModeHeating(VRFCond) = true; - TerminalUnitList(1).TotalCoolLoad(1) = 0.0; - TerminalUnitList(1).TotalCoolLoad(2) = 0.0; - TerminalUnitList(1).TotalCoolLoad(3) = 0.0; - TerminalUnitList(1).TotalCoolLoad(4) = 0.0; - TerminalUnitList(1).TotalCoolLoad(5) = 0.0; - TerminalUnitList(1).TotalHeatLoad(1) = 1000.0; - TerminalUnitList(1).TotalHeatLoad(2) = 1000.0; - TerminalUnitList(1).TotalHeatLoad(3) = 1000.0; - TerminalUnitList(1).TotalHeatLoad(4) = 1000.0; - TerminalUnitList(1).TotalHeatLoad(5) = 1000.0; + state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state->dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state->dataHVACVarRefFlow->LastModeCooling(VRFCond) = false; + state->dataHVACVarRefFlow->LastModeHeating(VRFCond) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(1) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(2) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(3) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(4) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(5) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(1) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(2) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(3) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(4) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(5) = 1000.0; CalcVRFCondenser(*state, VRFCond); - EXPECT_FALSE(VRF(VRFCond).HRHeatingActive); - EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); - EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); - EXPECT_EQ(VRF(VRFCond).TUCoolingLoad, 0.0); - EXPECT_EQ(VRF(VRFCond).TotalHeatingCapacity, 5000.0); - EXPECT_EQ(VRF(VRFCond).TUHeatingLoad, 5000.0); - EXPECT_EQ(VRF(VRFCond).VRFCondPLR, 0.25); - EXPECT_EQ(VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR - EXPECT_EQ(VRF(VRFCond).SUMultiplier, 1.0); - EXPECT_FALSE(VRF(VRFCond).ModeChange); - EXPECT_FALSE(VRF(VRFCond).HRModeChange); - EXPECT_EQ(VRF(VRFCond).ElecCoolingPower, 0.0); - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 5000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad, 5000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.25); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 1.0); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).ModeChange); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRModeChange); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR); // increment time step state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 0.5 // set TU's to request both cooling and heating - TerminalUnitList(1).TotalCoolLoad(1) = 0.0; - TerminalUnitList(1).HRCoolRequest(1) = false; - TerminalUnitList(1).TotalCoolLoad(2) = 1000.0; - TerminalUnitList(1).HRCoolRequest(2) = true; - TerminalUnitList(1).TotalCoolLoad(3) = 0.0; - TerminalUnitList(1).HRCoolRequest(3) = false; - TerminalUnitList(1).TotalCoolLoad(4) = 1000.0; - TerminalUnitList(1).HRCoolRequest(4) = true; - TerminalUnitList(1).TotalCoolLoad(5) = 0.0; - TerminalUnitList(1).HRCoolRequest(5) = false; - TerminalUnitList(1).TotalHeatLoad(1) = 1000.0; - TerminalUnitList(1).HRHeatRequest(1) = true; - TerminalUnitList(1).TotalHeatLoad(2) = 0.0; - TerminalUnitList(1).HRHeatRequest(2) = false; - TerminalUnitList(1).TotalHeatLoad(3) = 1000.0; - TerminalUnitList(1).HRHeatRequest(3) = true; - TerminalUnitList(1).TotalHeatLoad(4) = 0.0; - TerminalUnitList(1).HRHeatRequest(4) = false; - TerminalUnitList(1).TotalHeatLoad(5) = 1000.0; - TerminalUnitList(1).HRHeatRequest(5) = true; - VRF(VRFCond).HeatRecoveryUsed = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(1) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(1) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(2) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(2) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(3) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(3) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(4) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(4) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(5) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(5) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(1) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(1) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(2) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(2) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(3) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(3) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(4) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(4) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(5) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(5) = true; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed = true; // set heat recovery time constant to non-zero value (means mode change will degrade performance) - VRF(VRFCond).HRHeatCapTC = 0.25; // 15 min exponential rise + state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatCapTC = 0.25; // 15 min exponential rise // last operating mode was heating CalcVRFCondenser(*state, VRFCond); - EXPECT_TRUE(VRF(VRFCond).HRHeatingActive); - EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); - EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); - EXPECT_EQ(VRF(VRFCond).TUCoolingLoad, 2000.0); - EXPECT_EQ(VRF(VRFCond).TotalHeatingCapacity, 3000.0); - EXPECT_EQ(VRF(VRFCond).TUHeatingLoad, 3000.0); - EXPECT_NEAR(VRF(VRFCond).VRFCondPLR, 0.13636, 0.00001); - EXPECT_EQ(VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR - EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.63212, 0.00001); - EXPECT_TRUE(VRF(VRFCond).ModeChange); - EXPECT_FALSE(VRF(VRFCond).HRModeChange); - EXPECT_EQ(VRF(VRFCond).ElecCoolingPower, 0.0); + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad, 2000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 3000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad, 3000.0); + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.13636, 0.00001); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 0.63212, 0.00001); + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).ModeChange); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRModeChange); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, 0.0); // make adjustment for heat recovery startup degradation - Real64 HREIRFTConst = VRF(VRFCond).HREIRFTHeatConst; - Real64 HRInitialEIRFrac = VRF(VRFCond).HRInitialHeatEIRFrac; - Real64 HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; + Real64 HREIRFTConst = state->dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst; + Real64 HRInitialEIRFrac = state->dataHVACVarRefFlow->VRF(VRFCond).HRInitialHeatEIRFrac; + Real64 HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier; - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR * HREIRAdjustment); // last operating mode was cooling should give same answer since TU heating request > TU cooling request * ( 1 + 1/COP) - CoolingLoad(VRFCond) = true; - HeatingLoad(VRFCond) = false; - LastModeCooling(VRFCond) = true; - LastModeHeating(VRFCond) = false; + state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; + state->dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state->dataHVACVarRefFlow->LastModeCooling(VRFCond) = true; + state->dataHVACVarRefFlow->LastModeHeating(VRFCond) = false; state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 0.75 - CalcVRFCondenser saves last time stamp for use in exponential curve, increment by // 1 time step to get same answer CalcVRFCondenser(*state, VRFCond); - EXPECT_TRUE(VRF(VRFCond).HRHeatingActive); - EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); - EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); - EXPECT_EQ(VRF(VRFCond).TUCoolingLoad, 2000.0); - EXPECT_EQ(VRF(VRFCond).TotalHeatingCapacity, 3000.0); - EXPECT_EQ(VRF(VRFCond).TUHeatingLoad, 3000.0); - EXPECT_NEAR(VRF(VRFCond).VRFCondPLR, 0.13636, 0.00001); - EXPECT_EQ(VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR - EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.63212, 0.00001); - EXPECT_TRUE(VRF(VRFCond).ModeChange); - EXPECT_FALSE(VRF(VRFCond).HRModeChange); - EXPECT_EQ(VRF(VRFCond).ElecCoolingPower, 0.0); - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad, 2000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 3000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad, 3000.0); + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.13636, 0.00001); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 0.63212, 0.00001); + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).ModeChange); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRModeChange); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR * HREIRAdjustment); EXPECT_NEAR(HREIRAdjustment, 1.06321, 0.00001); // simulate again and see that power has exponential changed from previous time step state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.0 - CoolingLoad(VRFCond) = false; - HeatingLoad(VRFCond) = true; - LastModeCooling(VRFCond) = false; - LastModeHeating(VRFCond) = true; + state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state->dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state->dataHVACVarRefFlow->LastModeCooling(VRFCond) = false; + state->dataHVACVarRefFlow->LastModeHeating(VRFCond) = true; CalcVRFCondenser(*state, VRFCond); - HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; + HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier; - EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.86466, 0.00001); // will exponentially rise towards 1.0 - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 0.86466, 0.00001); // will exponentially rise towards 1.0 + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR * HREIRAdjustment); EXPECT_NEAR(HREIRAdjustment, 1.08646, 0.00001); // will exponentially rise towards VRF( VRFCond ).HREIRFTHeatConst = 1.1 // simulate again and see that power has exponential changed from previous time step state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.25 CalcVRFCondenser(*state, VRFCond); - HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; - EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.95021, 0.00001); // will exponentially rise towards 1.0 - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); + HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier; + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 0.95021, 0.00001); // will exponentially rise towards 1.0 + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR * HREIRAdjustment); EXPECT_NEAR(HREIRAdjustment, 1.09502, 0.00001); // will exponentially rise towards VRF( VRFCond ).HREIRFTHeatConst = 1.1 // simulate again and see that power has exponential changed from previous time step state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.5 CalcVRFCondenser(*state, VRFCond); - HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; - EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.98168, 0.00001); // will exponentially rise towards 1.0 - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); + HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier; + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 0.98168, 0.00001); // will exponentially rise towards 1.0 + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR * HREIRAdjustment); EXPECT_NEAR(HREIRAdjustment, 1.09817, 0.00001); // will exponentially rise towards VRF( VRFCond ).HREIRFTHeatConst = 1.1 // simulate again and see that power has exponential changed from previous time step state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.75 CalcVRFCondenser(*state, VRFCond); - HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; - EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 1.0, 0.00001); // will exponentially rise towards 1.0 - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); + HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier; + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 1.0, 0.00001); // will exponentially rise towards 1.0 + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR * HREIRAdjustment); EXPECT_NEAR(HREIRAdjustment, 1.1, 0.00001); // will exponentially rise towards VRF( VRFCond ).HREIRFTHeatConst = 1.1 // at end of exponential decay (when SUMultiplier = 1), HREIRAdjustment = VRF( VRFCond ).HREIRFTHeatConst - EXPECT_EQ(HREIRAdjustment, VRF(VRFCond).HREIRFTHeatConst); + EXPECT_EQ(HREIRAdjustment, state->dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst); } TEST_F(EnergyPlusFixture, VRFTU_SupplementalHeatingCoilGetInput) @@ -7891,31 +7885,31 @@ TEST_F(EnergyPlusFixture, VRFTU_SupplementalHeatingCoilGetInput) // get VRF terminal unit GetVRFInput(*state); - auto &VRFTU_1(VRFTU(1)); + auto &VRFTU_1(state->dataHVACVarRefFlow->VRFTU(1)); // Check the results EXPECT_EQ(VRFTU_1.Name, "TU1"); EXPECT_EQ(VRFTU_1.SuppHeatCoilType, "COIL:HEATING:ELECTRIC"); EXPECT_EQ(VRFTU_1.SuppHeatCoilName, "TU1 SUPP HEATING COIL"); - auto &VRFTU_2(VRFTU(2)); + auto &VRFTU_2(state->dataHVACVarRefFlow->VRFTU(2)); // Check the results EXPECT_EQ(VRFTU_2.Name, "TU2"); EXPECT_EQ(VRFTU_2.SuppHeatCoilType, "COIL:HEATING:FUEL"); EXPECT_EQ(VRFTU_2.SuppHeatCoilName, "TU2 SUPP HEATING COIL"); - auto &VRFTU_3(VRFTU(3)); + auto &VRFTU_3(state->dataHVACVarRefFlow->VRFTU(3)); // Check the results EXPECT_EQ(VRFTU_3.Name, "TU3"); EXPECT_EQ(VRFTU_3.SuppHeatCoilType, "COIL:HEATING:WATER"); EXPECT_EQ(VRFTU_3.SuppHeatCoilName, "TU3 SUPP HEATING COIL"); - auto &VRFTU_4(VRFTU(4)); + auto &VRFTU_4(state->dataHVACVarRefFlow->VRFTU(4)); // Check the results EXPECT_EQ(VRFTU_4.Name, "TU4"); EXPECT_EQ(VRFTU_4.SuppHeatCoilType, "COIL:HEATING:FUEL"); EXPECT_EQ(VRFTU_4.SuppHeatCoilName, "TU4 SUPP HEATING COIL"); - auto &VRFTU_5(VRFTU(5)); + auto &VRFTU_5(state->dataHVACVarRefFlow->VRFTU(5)); // Check the results EXPECT_EQ(VRFTU_5.Name, "TU5"); EXPECT_EQ(VRFTU_5.SuppHeatCoilType, "COIL:HEATING:STEAM"); @@ -8153,8 +8147,8 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) bool FirstHVACIteration(false); Real64 SuppHeatCoilLoad = 10000.0; - VRFTU.allocate(VRFTUNum); - VRFTU(VRFTUNum) = thisVRFTU; + state->dataHVACVarRefFlow->VRFTU.allocate(VRFTUNum); + state->dataHVACVarRefFlow->VRFTU(VRFTUNum) = thisVRFTU; // run supplemental heating coil thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); @@ -10582,10 +10576,10 @@ TEST_F(EnergyPlusFixture, VRFFluidControl_FanSysModel_OnOffModeTest) Real64 QZnReq = 0.0; // set to cooling mode - CoolingLoad(VRFCond) = true; - HeatingLoad(VRFCond) = false; - LastModeCooling(VRFCond) = true; - LastModeHeating(VRFCond) = false; + state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; + state->dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; + state->dataHVACVarRefFlow->LastModeCooling(VRFCond) = true; + state->dataHVACVarRefFlow->LastModeHeating(VRFCond) = false; // test cooling mode fan operation ZoneSysEnergyDemand(1).RemainingOutputRequired = -5000.0; @@ -10602,7 +10596,7 @@ TEST_F(EnergyPlusFixture, VRFFluidControl_FanSysModel_OnOffModeTest) Real64 Result_AirMassFlowRateDesign = HVACFan::fanObjs[0]->maxAirMassFlowRate(); EXPECT_NEAR(Result_AirMassFlowRateDesign, 0.347052, 0.000001); Real64 Result_AirMassFlowRate = DataLoopNode::Node(HVACFan::fanObjs[0]->outletNodeNum).MassFlowRate; - EXPECT_NEAR(Result_AirMassFlowRate, DXCoils::DXCoil(1).RatedAirMassFlowRate(1), 0.000001); + EXPECT_NEAR(Result_AirMassFlowRate, state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1), 0.000001); Real64 Result_FanPower = HVACFan::fanObjs[0]->fanPower(); EXPECT_NEAR(Result_FanPower, 39.593, 0.001); @@ -11194,10 +11188,10 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) // get zone input and connections GetZoneEquipmentData(*state); ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); - Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set the zone cooling and heat requirements ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = -5000.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; @@ -11209,7 +11203,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) Node(thisZoneEquip.ZoneNode).HumRat = 0.0075; Node(thisZoneEquip.ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(thisZoneEquip.ZoneNode).Temp, Node(thisZoneEquip.ZoneNode).HumRat); - auto &thisVRFTU(VRFTU(1)); + auto &thisVRFTU(state->dataHVACVarRefFlow->VRFTU(1)); Node(thisVRFTU.VRFTUInletNodeNum).Temp = 24.0; Node(thisVRFTU.VRFTUInletNodeNum).HumRat = 0.0075; Node(thisVRFTU.VRFTUInletNodeNum).Enthalpy = @@ -11236,8 +11230,8 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) FinalZoneSizing(CurZoneEqNum).CoolDesHumRat = 0.0095; // set pointer to components auto &thisFan(Fan(1)); - auto &thisDXCoolingCoil(DXCoil(1)); - auto &thisDXHeatingCoil(DXCoil(2)); + auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); + auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); // run the model bool HeatingActive = false; bool CoolingActive = false; @@ -11246,7 +11240,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) bool ZoneEquipment = true; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -11259,10 +11253,10 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) LatOutputProvided); // check model inputs - ASSERT_EQ(1, NumVRFCond); - ASSERT_EQ(1, NumVRFTU); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFCond); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFTU); ASSERT_EQ(1, state->dataFans->NumFans); - ASSERT_EQ(2, NumDXCoils); + ASSERT_EQ(2, state->dataDXCoils->NumDXCoils); ASSERT_EQ("TU1 VRF DX COOLING COIL", thisDXCoolingCoil.Name); ASSERT_EQ("TU1 VRF DX HEATING COIL", thisDXHeatingCoil.Name); // check if total cooling rate provided by the cooling coil matches @@ -12925,11 +12919,11 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) // get zone input and connections GetZoneEquipmentData(*state); GetVRFInput(*state); - GetVRFInputFlag = false; - Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->GetVRFInputFlag = false; + Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set the zone cooling and heat requirements ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = -5000.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; @@ -12941,7 +12935,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) Node(thisZoneEquip.ZoneNode).HumRat = 0.0075; Node(thisZoneEquip.ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(thisZoneEquip.ZoneNode).Temp, Node(thisZoneEquip.ZoneNode).HumRat); - auto &thisVRFTU(VRFTU(1)); + auto &thisVRFTU(state->dataHVACVarRefFlow->VRFTU(1)); Node(thisVRFTU.VRFTUInletNodeNum).Temp = 24.0; Node(thisVRFTU.VRFTUInletNodeNum).HumRat = 0.0075; Node(thisVRFTU.VRFTUInletNodeNum).Enthalpy = @@ -12969,8 +12963,8 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) // set pointer to components auto &thisFan(Fan(1)); - auto &thisDXCoolingCoil(DXCoil(1)); - auto &thisDXHeatingCoil(DXCoil(2)); + auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); + auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); // run the model bool HeatingActive = false; bool CoolingActive = false; @@ -12979,7 +12973,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) bool ZoneEquipment = true; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -12992,10 +12986,10 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) LatOutputProvided); // check model inputs - ASSERT_EQ(1, NumVRFCond); - ASSERT_EQ(1, NumVRFTU); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFCond); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFTU); ASSERT_EQ(1, state->dataFans->NumFans); - ASSERT_EQ(2, NumDXCoils); + ASSERT_EQ(2, state->dataDXCoils->NumDXCoils); ASSERT_EQ("TU1 VRF DX COOLING COIL", thisDXCoolingCoil.Name); ASSERT_EQ("TU1 VRF DX HEATING COIL", thisDXHeatingCoil.Name); // check if total cooling rate provided by the DX cooling coil matches @@ -13077,65 +13071,65 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) CurveManager::GetCurveInput(*state); int VRFCond = 1; - VRF.allocate(1); - VRF(VRFCond).CondenserNodeNum = 0; - VRF(VRFCond).CondenserType = 1; // DataHVACGlobals::AirCooled - VRF(VRFCond).ZoneTUListPtr = 1; - VRF(VRFCond).CoolingCapacity = 20000.0; - VRF(VRFCond).HeatingCapacity = 20000.0; - VRF(VRFCond).CoolingCOP = 3.0; - VRF(VRFCond).HeatingCOP = 3.0; - VRF(VRFCond).RatedCoolingPower = VRF(VRFCond).CoolingCapacity / VRF(VRFCond).CoolingCOP; - VRF(VRFCond).RatedHeatingPower = VRF(VRFCond).HeatingCapacity / VRF(VRFCond).HeatingCOP; - VRF(VRFCond).PipingCorrectionCooling = 1.0; - VRF(VRFCond).PipingCorrectionHeating = 1.0; + state->dataHVACVarRefFlow->VRF.allocate(1); + state->dataHVACVarRefFlow->VRF(VRFCond).CondenserNodeNum = 0; + state->dataHVACVarRefFlow->VRF(VRFCond).CondenserType = 1; // DataHVACGlobals::AirCooled + state->dataHVACVarRefFlow->VRF(VRFCond).ZoneTUListPtr = 1; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity = 20000.0; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity = 20000.0; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP = 3.0; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP = 3.0; + state->dataHVACVarRefFlow->VRF(VRFCond).RatedCoolingPower = state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity / state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCOP; + state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower = state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity / state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCOP; + state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionCooling = 1.0; + state->dataHVACVarRefFlow->VRF(VRFCond).PipingCorrectionHeating = 1.0; // Curve Indices, including HR curves (3 & 4) - VRF(VRFCond).CoolCapFT = 1; - VRF(VRFCond).CoolEIRFT = 1; - VRF(VRFCond).CoolEIRFPLR1 = 2; - VRF(VRFCond).HeatEIRFPLR1 = 2; - VRF(VRFCond).HRCAPFTHeat = 3; - VRF(VRFCond).HREIRFTHeat = 4; - - CoolCombinationRatio.allocate(1); - CoolCombinationRatio(VRFCond) = 1.0; - HeatCombinationRatio.allocate(1); - HeatCombinationRatio(VRFCond) = 1.0; - LastModeCooling.allocate(1); - LastModeHeating.allocate(1); - - TerminalUnitList.allocate(1); - TerminalUnitList(1).NumTUInList = 5; - TerminalUnitList(1).TotalCoolLoad.allocate(5); - TerminalUnitList(1).TotalHeatLoad.allocate(5); - TerminalUnitList(1).ZoneTUPtr.allocate(5); - TerminalUnitList(1).HRCoolRequest.allocate(5); - TerminalUnitList(1).HRHeatRequest.allocate(5); - TerminalUnitList(1).HRCoolRequest = false; - TerminalUnitList(1).HRHeatRequest = false; - - TerminalUnitList(1).CoolingCoilAvailable.allocate(5); - TerminalUnitList(1).HeatingCoilAvailable.allocate(5); + state->dataHVACVarRefFlow->VRF(VRFCond).CoolCapFT = 1; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFT = 1; + state->dataHVACVarRefFlow->VRF(VRFCond).CoolEIRFPLR1 = 2; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatEIRFPLR1 = 2; + state->dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeat = 3; + state->dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeat = 4; + + state->dataHVACVarRefFlow->CoolCombinationRatio.allocate(1); + state->dataHVACVarRefFlow->CoolCombinationRatio(VRFCond) = 1.0; + state->dataHVACVarRefFlow->HeatCombinationRatio.allocate(1); + state->dataHVACVarRefFlow->HeatCombinationRatio(VRFCond) = 1.0; + state->dataHVACVarRefFlow->LastModeCooling.allocate(1); + state->dataHVACVarRefFlow->LastModeHeating.allocate(1); + + state->dataHVACVarRefFlow->TerminalUnitList.allocate(1); + state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList = 5; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).ZoneTUPtr.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest = false; + + state->dataHVACVarRefFlow->TerminalUnitList(1).CoolingCoilAvailable.allocate(5); + state->dataHVACVarRefFlow->TerminalUnitList(1).HeatingCoilAvailable.allocate(5); // all TU coils are available - TerminalUnitList(1).CoolingCoilAvailable = true; - TerminalUnitList(1).HeatingCoilAvailable = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).CoolingCoilAvailable = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).HeatingCoilAvailable = true; - CoolingLoad.allocate(1); - HeatingLoad.allocate(1); + state->dataHVACVarRefFlow->CoolingLoad.allocate(1); + state->dataHVACVarRefFlow->HeatingLoad.allocate(1); - DXCoilCoolInletAirWBTemp.allocate(10); - DXCoilHeatInletAirDBTemp.allocate(10); - DXCoilHeatInletAirWBTemp.allocate(10); + state->dataDXCoils->DXCoilCoolInletAirWBTemp.allocate(10); + state->dataDXCoils->DXCoilHeatInletAirDBTemp.allocate(10); + state->dataDXCoils->DXCoilHeatInletAirWBTemp.allocate(10); - VRFTU.allocate(5); - for (int NumTU = 1; NumTU <= TerminalUnitList(1).NumTUInList; ++NumTU) { - VRFTU(NumTU).CoolCoilIndex = NumTU; - VRFTU(NumTU).HeatCoilIndex = TerminalUnitList(1).NumTUInList + NumTU; - TerminalUnitList(1).ZoneTUPtr(NumTU) = NumTU; + state->dataHVACVarRefFlow->VRFTU.allocate(5); + for (int NumTU = 1; NumTU <= state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList; ++NumTU) { + state->dataHVACVarRefFlow->VRFTU(NumTU).CoolCoilIndex = NumTU; + state->dataHVACVarRefFlow->VRFTU(NumTU).HeatCoilIndex = state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList + NumTU; + state->dataHVACVarRefFlow->TerminalUnitList(1).ZoneTUPtr(NumTU) = NumTU; // initialize DX coil inlet conditions - DXCoilCoolInletAirWBTemp(NumTU) = 19.4; - DXCoilHeatInletAirDBTemp(TerminalUnitList(1).NumTUInList + NumTU) = 20.0; - DXCoilHeatInletAirWBTemp(TerminalUnitList(1).NumTUInList + NumTU) = 17.0; + state->dataDXCoils->DXCoilCoolInletAirWBTemp(NumTU) = 19.4; + state->dataDXCoils->DXCoilHeatInletAirDBTemp(state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList + NumTU) = 20.0; + state->dataDXCoils->DXCoilHeatInletAirWBTemp(state->dataHVACVarRefFlow->TerminalUnitList(1).NumTUInList + NumTU) = 17.0; } // set up environment @@ -13150,76 +13144,76 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) state->dataEnvrn->OutWetBulbTemp = 21.1340575; // call with zero loads to reset CurrentEndTimeLast until that's resolved - TerminalUnitList(1).TotalCoolLoad = 0.0; - TerminalUnitList(1).HRCoolRequest = false; - TerminalUnitList(1).TotalHeatLoad = 0.0; - TerminalUnitList(1).HRHeatRequest = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest = false; CalcVRFCondenser(*state, VRFCond); // increment time step state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 0.5 // set TU's to request both cooling and heating - CoolingLoad(VRFCond) = false; - HeatingLoad(VRFCond) = true; - LastModeCooling(VRFCond) = false; - LastModeHeating(VRFCond) = true; - - TerminalUnitList(1).TotalCoolLoad(1) = 0.0; - TerminalUnitList(1).HRCoolRequest(1) = false; - TerminalUnitList(1).TotalCoolLoad(2) = 1000.0; - TerminalUnitList(1).HRCoolRequest(2) = true; - TerminalUnitList(1).TotalCoolLoad(3) = 0.0; - TerminalUnitList(1).HRCoolRequest(3) = false; - TerminalUnitList(1).TotalCoolLoad(4) = 1000.0; - TerminalUnitList(1).HRCoolRequest(4) = true; - TerminalUnitList(1).TotalCoolLoad(5) = 0.0; - TerminalUnitList(1).HRCoolRequest(5) = false; - TerminalUnitList(1).TotalHeatLoad(1) = 1000.0; - TerminalUnitList(1).HRHeatRequest(1) = true; - TerminalUnitList(1).TotalHeatLoad(2) = 0.0; - TerminalUnitList(1).HRHeatRequest(2) = false; - TerminalUnitList(1).TotalHeatLoad(3) = 1000.0; - TerminalUnitList(1).HRHeatRequest(3) = true; - TerminalUnitList(1).TotalHeatLoad(4) = 0.0; - TerminalUnitList(1).HRHeatRequest(4) = false; - TerminalUnitList(1).TotalHeatLoad(5) = 1000.0; - TerminalUnitList(1).HRHeatRequest(5) = true; - VRF(VRFCond).HeatRecoveryUsed = true; + state->dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; + state->dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; + state->dataHVACVarRefFlow->LastModeCooling(VRFCond) = false; + state->dataHVACVarRefFlow->LastModeHeating(VRFCond) = true; + + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(1) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(1) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(2) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(2) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(3) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(3) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(4) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(4) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalCoolLoad(5) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRCoolRequest(5) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(1) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(1) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(2) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(2) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(3) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(3) = true; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(4) = 0.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(4) = false; + state->dataHVACVarRefFlow->TerminalUnitList(1).TotalHeatLoad(5) = 1000.0; + state->dataHVACVarRefFlow->TerminalUnitList(1).HRHeatRequest(5) = true; + state->dataHVACVarRefFlow->VRF(VRFCond).HeatRecoveryUsed = true; // set heat recovery time constant to non-zero value (means mode change will degrade performance) - VRF(VRFCond).HRHeatCapTC = 0.25; // 15 min exponential rise + state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatCapTC = 0.25; // 15 min exponential rise // VRF(VRFCond).HRHeatEIRTC = 0.0; // (default) // last operating mode was heating CalcVRFCondenser(*state, VRFCond); - EXPECT_TRUE(VRF(VRFCond).ModeChange); - EXPECT_FALSE(VRF(VRFCond).HRModeChange); - EXPECT_EQ(VRF(VRFCond).OperatingMode, 2); // ModeHeatingOnly - EXPECT_TRUE(VRF(VRFCond).HRHeatingActive); - EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); - EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); - EXPECT_EQ(VRF(VRFCond).TUCoolingLoad, 2000.0); - EXPECT_EQ(VRF(VRFCond).TotalHeatingCapacity, 3000.0); - EXPECT_EQ(VRF(VRFCond).TUHeatingLoad, 3000.0); - EXPECT_NEAR(VRF(VRFCond).VRFCondPLR, 0.1875, 0.00001); - EXPECT_EQ(VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).ModeChange); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRModeChange); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).OperatingMode, 2); // ModeHeatingOnly + EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).HRHeatingActive); + EXPECT_FALSE(state->dataHVACVarRefFlow->VRF(VRFCond).HRCoolingActive); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalCoolingCapacity, 0.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUCoolingLoad, 2000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TotalHeatingCapacity, 3000.0); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).TUHeatingLoad, 3000.0); + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR, 0.1875, 0.00001); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondRTF, 1.0); // unit is not cycling below min PLR // CurrentEndTime = 0.25 // HRTimer = CurrentEndTimeLast = 0 // HRTime = (CurrentEndTime - HRTimer) = 0.25 - = 0.25 // SUMultiplier = min(1, 1 - exp(-HRTime / HRHeatCapTC)) = 1 - exp(-1) = 0.6321205588285577 - EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.63212, 0.00001); - EXPECT_EQ(VRF(VRFCond).ElecCoolingPower, 0.0); + EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier, 0.63212, 0.00001); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecCoolingPower, 0.0); // make adjustment for heat recovery startup degradation // Ensure HREIRFTConst / HRCAPFTHeatConst are assigned the right curve ouput - Real64 HREIRFTConst = VRF(VRFCond).HREIRFTHeatConst; + Real64 HREIRFTConst = state->dataHVACVarRefFlow->VRF(VRFCond).HREIRFTHeatConst; EXPECT_EQ(HREIRFTConst, 0.9); // It's normal that it works, it's the internal variable that's messed up - EXPECT_EQ(VRF(VRFCond).HRCAPFTHeatConst, 0.8); - Real64 HRInitialEIRFrac = VRF(VRFCond).HRInitialHeatEIRFrac; + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).HRCAPFTHeatConst, 0.8); + Real64 HRInitialEIRFrac = state->dataHVACVarRefFlow->VRF(VRFCond).HRInitialHeatEIRFrac; EXPECT_EQ(HRInitialEIRFrac, 1.0); // Internally, it uses a local variable HREIRFTConst, which was wrongly set to HRCAPFTHeatConst = 0.9 - Real64 HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; + Real64 HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * state->dataHVACVarRefFlow->VRF(VRFCond).SUMultiplier; // Before fix, =1 + (0.8 - 1) * 0.63212 = 0.873576 EXPECT_NEAR(HREIRAdjustment, 0.936788, 0.00001); // =1 + (0.9 - 1) * 0.63212 // InletAirDryBulbC = 20, InletAirWetBulbC = 17 @@ -13236,7 +13230,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) // VRFRTF = 1.0 because not cycling below min PLR // EIRFPLRModFac is 1 because EIRFPLR curve output is constant as 1.0 above // InputPowerMultiplier is 1 because no defrost - EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); + EXPECT_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).ElecHeatingPower, state->dataHVACVarRefFlow->VRF(VRFCond).RatedHeatingPower * state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR * HREIRAdjustment); } TEST_F(EnergyPlusFixture, VRF_BlowthroughFanPlacement_InputTest) @@ -13668,13 +13662,13 @@ TEST_F(EnergyPlusFixture, VRF_BlowthroughFanPlacement_InputTest) GetZoneEquipmentData(*state); GetVRFInput(*state); // set pointer to components - auto &thisVRFTU(VRFTU(1)); - auto &thisDXCoolingCoil(DXCoil(1)); - auto &thisDXHeatingCoil(DXCoil(2)); + auto &thisVRFTU(state->dataHVACVarRefFlow->VRFTU(1)); + auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); + auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); auto &thisSuppHeatingCoil(HeatingCoil(1)); // check model inputs - ASSERT_EQ(1, NumVRFTU); - ASSERT_EQ(2, NumDXCoils); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFTU); + ASSERT_EQ(2, state->dataDXCoils->NumDXCoils); ASSERT_EQ(1, NumHeatingCoils); EXPECT_TRUE(thisVRFTU.OAMixerUsed); ASSERT_EQ("TU1 OA MIXER", thisVRFTU.OAMixerName); @@ -14259,7 +14253,7 @@ TEST_F(EnergyPlusFixture, VRF_MinPLR_and_EIRfPLRCruveMinPLRInputsTest) // expect error due to min PLR value EXPECT_TRUE(ErrorsFound); // set pointer to components - auto &thisVRF(VRF(1)); + auto &thisVRF(state->dataHVACVarRefFlow->VRF(1)); auto &thisCoolEIRFPLR(state->dataCurveManager->PerfCurve(thisVRF.CoolEIRFPLR1)); auto &thisHeatEIRFPLR(state->dataCurveManager->PerfCurve(thisVRF.HeatEIRFPLR1)); // check user input VRF Minimum PLR @@ -14971,16 +14965,16 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NotOnZoneHVACEquipmentList) DataZoneEquipment::GetZoneEquipmentData(*state); // read equipment list and connections state->dataAirLoop->AirLoopInputsFilled = true; - HVACVariableRefrigerantFlow::MyEnvrnFlag = true; + state->dataHVACVarRefFlow->MyEnvrnFlag = true; ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function - OutsideAirNode = VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; // outside air air inlet node num + OutsideAirNode = state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; // outside air air inlet node num DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = 0.0; // No load DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 0.0; // No load DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 0.0; // No load QZnReq = DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired; // No load // Initialize terminal unit - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set continuous fan operating mode + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set continuous fan operating mode // Reset the err stream, which has warnings about curves values not equal to 1.0 (+ or - 10%) at rated conditions EXPECT_TRUE(has_err_output(true)); @@ -14995,7 +14989,7 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NotOnZoneHVACEquipmentList) EXPECT_TRUE(compare_err_stream(error_string, true)); - ASSERT_EQ(VRFTU(VRFTUNum).OpMode, DataHVACGlobals::ContFanCycCoil); // continuous fan cycling coil operating mode + ASSERT_EQ(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).OpMode, DataHVACGlobals::ContFanCycCoil); // continuous fan cycling coil operating mode } @@ -15602,10 +15596,10 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) // get zone input and connections GetZoneEquipmentData(*state); ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); - Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; + Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set the zone cooling and heat requirements ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = -5000.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; @@ -15617,7 +15611,7 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) Node(thisZoneEquip.ZoneNode).HumRat = 0.0075; Node(thisZoneEquip.ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(thisZoneEquip.ZoneNode).Temp, Node(thisZoneEquip.ZoneNode).HumRat); - auto &thisVRFTU(VRFTU(1)); + auto &thisVRFTU(state->dataHVACVarRefFlow->VRFTU(1)); Node(thisVRFTU.VRFTUInletNodeNum).Temp = 24.0; Node(thisVRFTU.VRFTUInletNodeNum).HumRat = 0.0075; Node(thisVRFTU.VRFTUInletNodeNum).Enthalpy = @@ -15644,8 +15638,8 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) FinalZoneSizing(CurZoneEqNum).CoolDesHumRat = 0.0095; // set pointer to components auto &thisFan(Fan(1)); - auto &thisDXCoolingCoil(DXCoil(1)); - auto &thisDXHeatingCoil(DXCoil(2)); + auto &thisDXCoolingCoil(state->dataDXCoils->DXCoil(1)); + auto &thisDXHeatingCoil(state->dataDXCoils->DXCoil(2)); // run the model bool HeatingActive = false; bool CoolingActive = false; @@ -15654,7 +15648,7 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) bool ZoneEquipment = true; SimulateVRF(*state, - VRFTU(VRFTUNum).Name, + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr), @@ -15667,10 +15661,10 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) LatOutputProvided); // check model inputs - ASSERT_EQ(1, NumVRFCond); - ASSERT_EQ(1, NumVRFTU); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFCond); + ASSERT_EQ(1, state->dataHVACVarRefFlow->NumVRFTU); ASSERT_EQ(1, state->dataFans->NumFans); - ASSERT_EQ(2, NumDXCoils); + ASSERT_EQ(2, state->dataDXCoils->NumDXCoils); ASSERT_EQ("TU1 VRF DX COOLING COIL", thisDXCoolingCoil.Name); ASSERT_EQ("TU1 VRF DX HEATING COIL", thisDXHeatingCoil.Name); // check if total cooling rate provided by the cooling coil matches diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 2bc5575af71..d8ecd8b3db2 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -1429,8 +1429,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ZoneMultiplierTest) EXPECT_EQ(10.0, (Zone(2).Volume * Zone(2).Multiplier * Zone(2).ListMultiplier) / (Zone(1).Volume * Zone(1).Multiplier * Zone(1).ListMultiplier)); // leaving a little wiggle room on these - EXPECT_NEAR(10.0, (DXCoils::DXCoil(2).RatedTotCap(1) / DXCoils::DXCoil(1).RatedTotCap(1)), 0.00001); - EXPECT_NEAR(10.0, (DXCoils::DXCoil(2).RatedAirVolFlowRate(1) / DXCoils::DXCoil(1).RatedAirVolFlowRate(1)), 0.00001); + EXPECT_NEAR(10.0, (state->dataDXCoils->DXCoil(2).RatedTotCap(1) / state->dataDXCoils->DXCoil(1).RatedTotCap(1)), 0.00001); + EXPECT_NEAR(10.0, (state->dataDXCoils->DXCoil(2).RatedAirVolFlowRate(1) / state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1)), 0.00001); EXPECT_NEAR( 10.0, (DataZoneEnergyDemands::ZoneSysEnergyDemand(2).TotalOutputRequired / DataZoneEnergyDemands::ZoneSysEnergyDemand(1).TotalOutputRequired), @@ -3739,22 +3739,22 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatEmissionReport) EXPECT_EQ(condenserReject, DataHeatBalance::SysTotalHVACRejectHeatLoss); EXPECT_EQ(condenserReject * DataGlobalConstants::convertJtoGJ, BuildingPreDefRep.emiHVACReject); - DXCoils::NumDXCoils = 2; - DXCoils::DXCoil.allocate(2); - DXCoils::DXCoil(1).DXCoilType_Num = DataHVACGlobals::CoilDX_MultiSpeedCooling; - DXCoils::DXCoil(1).CondenserType(1) = DataHVACGlobals::AirCooled; - DXCoils::DXCoil(1).FuelType = "NaturalGas"; - DXCoils::DXCoil(1).ElecCoolingConsumption = 100.0; - DXCoils::DXCoil(1).TotalCoolingEnergy = 100.0; - DXCoils::DXCoil(1).MSFuelWasteHeat = 1.0; - DXCoils::DXCoil(1).DefrostConsumption = 0.0; - DXCoils::DXCoil(1).CrankcaseHeaterConsumption = 0.0; - DXCoils::DXCoil(2).DXCoilType_Num = DataHVACGlobals::CoilDX_HeatingEmpirical; - DXCoils::DXCoil(2).ElecHeatingConsumption = 50.0; - DXCoils::DXCoil(2).TotalHeatingEnergy = 40.0; - DXCoils::DXCoil(2).DefrostConsumption = 0.0; - DXCoils::DXCoil(2).FuelConsumed = 0.0; - DXCoils::DXCoil(2).CrankcaseHeaterConsumption = 0.0; + state->dataDXCoils->NumDXCoils = 2; + state->dataDXCoils->DXCoil.allocate(2); + state->dataDXCoils->DXCoil(1).DXCoilType_Num = DataHVACGlobals::CoilDX_MultiSpeedCooling; + state->dataDXCoils->DXCoil(1).CondenserType(1) = DataHVACGlobals::AirCooled; + state->dataDXCoils->DXCoil(1).FuelType = "NaturalGas"; + state->dataDXCoils->DXCoil(1).ElecCoolingConsumption = 100.0; + state->dataDXCoils->DXCoil(1).TotalCoolingEnergy = 100.0; + state->dataDXCoils->DXCoil(1).MSFuelWasteHeat = 1.0; + state->dataDXCoils->DXCoil(1).DefrostConsumption = 0.0; + state->dataDXCoils->DXCoil(1).CrankcaseHeaterConsumption = 0.0; + state->dataDXCoils->DXCoil(2).DXCoilType_Num = DataHVACGlobals::CoilDX_HeatingEmpirical; + state->dataDXCoils->DXCoil(2).ElecHeatingConsumption = 50.0; + state->dataDXCoils->DXCoil(2).TotalHeatingEnergy = 40.0; + state->dataDXCoils->DXCoil(2).DefrostConsumption = 0.0; + state->dataDXCoils->DXCoil(2).FuelConsumed = 0.0; + state->dataDXCoils->DXCoil(2).CrankcaseHeaterConsumption = 0.0; Real64 coilReject = 1.0 * TimeStepSysSec + 200.0 + 10.0; GatherHeatEmissionReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index f3988586e92..f99fc577bf6 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -858,8 +858,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition Node(PTUnit(PTUnitNum).OutsideAirNode).Temp = state->dataEnvrn->OutDryBulbTemp; @@ -1204,8 +1204,8 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // set DX coil rated performance parameters - DXCoil(1).RatedCBF(1) = 0.05; - DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.05; + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = HVACInletMassFlowRate; // primary air condition set at outdoor air condition Node(PTUnit(PTUnitNum).OutsideAirNode).Temp = state->dataEnvrn->OutDryBulbTemp; diff --git a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc index 4ac1c33c838..d2fe9dcdc43 100644 --- a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc +++ b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc @@ -84,20 +84,20 @@ TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilSingleSpeed_Test1) // tests secondary DX coil calculation of single speed DX system or heat pump int DXCoilNum; - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingSingleSpeed; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 5000.0; - DXCoil(DXCoilNum).ElecCoolingPower = 500.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + state->dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingSingleSpeed; + state->dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 5000.0; + state->dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 500.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; CalcSecondaryDXCoils(*state, DXCoilNum); - EXPECT_DOUBLE_EQ(5500.0, DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); + EXPECT_DOUBLE_EQ(5500.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); // cleanup - DXCoil.deallocate(); + state->dataDXCoils->DXCoil.deallocate(); } TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilTwoSpeed_Test2) { @@ -105,20 +105,20 @@ TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilTwoSpeed_Test2) // tests secondary DX coil calculation of two speed DX cooling system int DXCoilNum; - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingTwoSpeed; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 5000.0; - DXCoil(DXCoilNum).ElecCoolingPower = 500.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + state->dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_CoolingTwoSpeed; + state->dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 5000.0; + state->dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 500.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; CalcSecondaryDXCoils(*state, DXCoilNum); - EXPECT_DOUBLE_EQ(5500.0, DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); + EXPECT_DOUBLE_EQ(5500.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); // cleanup - DXCoil.deallocate(); + state->dataDXCoils->DXCoil.deallocate(); } TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilMultiSpeed_Test3) { @@ -126,56 +126,56 @@ TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilMultiSpeed_Test3) // tests secondary DX coil calculation of multi speed heat pump int DXCoilNum; - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedCooling; - DXCoil(DXCoilNum).TotalCoolingEnergyRate = 5000.0; - DXCoil(DXCoilNum).ElecCoolingPower = 500.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + state->dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedCooling; + state->dataDXCoils->DXCoil(DXCoilNum).TotalCoolingEnergyRate = 5000.0; + state->dataDXCoils->DXCoil(DXCoilNum).ElecCoolingPower = 500.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; CalcSecondaryDXCoils(*state, DXCoilNum); - EXPECT_DOUBLE_EQ(5500.0, DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); + EXPECT_DOUBLE_EQ(5500.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); // cleanup - DXCoil.deallocate(); + state->dataDXCoils->DXCoil.deallocate(); } TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) { // tests secondary DX coil calculation of single speed heat pump int DXCoilNum; - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatingEmpirical; - DXCoil(DXCoilNum).MinOATCompressor = -5.0; - DXCoil(DXCoilNum).TotalHeatingEnergyRate = 5500.0; - DXCoil(DXCoilNum).ElecHeatingPower = 500.0; - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; - - DXCoil(DXCoilNum).SecZonePtr = 1; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + state->dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_HeatingEmpirical; + state->dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = -5.0; + state->dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = 5500.0; + state->dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = 500.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; + + state->dataDXCoils->DXCoil(DXCoilNum).SecZonePtr = 1; Node.allocate(2); ZT.allocate(1); ZoneAirHumRat.allocate(1); ZT(1) = 10.0; ZoneAirHumRat(1) = 0.003; - DXCoil(DXCoilNum).SecCoilAirFlow = 1.0; - DXCoil(DXCoilNum).CompressorPartLoadRatio = 1.0; - DXCoil(DXCoilNum).SecCoilRatedSHR = 1.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow = 1.0; + state->dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio = 1.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilRatedSHR = 1.0; state->dataEnvrn->OutBaroPress = 101325.0; - DXCoil(DXCoilNum).AirInNode = 2; - Node(DXCoil(DXCoilNum).AirInNode).Temp = 20.0; + state->dataDXCoils->DXCoil(DXCoilNum).AirInNode = 2; + Node(state->dataDXCoils->DXCoil(DXCoilNum).AirInNode).Temp = 20.0; InitializePsychRoutines(); CalcSecondaryDXCoils(*state, DXCoilNum); - EXPECT_DOUBLE_EQ(-5000.0, DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); - EXPECT_DOUBLE_EQ(1.0, DXCoil(DXCoilNum).SecCoilSHR); + EXPECT_DOUBLE_EQ(-5000.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); + EXPECT_DOUBLE_EQ(1.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSHR); //// set up arguments Real64 const EvapAirMassFlow = 1.2; @@ -202,7 +202,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) EXPECT_DOUBLE_EQ(1.0, SHRTest); // cleanup - DXCoil.deallocate(); + state->dataDXCoils->DXCoil.deallocate(); Node.deallocate(); } TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilMultiSpeed_Test5) @@ -211,58 +211,58 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilMultiSpeed_Test5) // tests secondary DX coil calculation of multi speed heat pump int DXCoilNum; - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoil(DXCoilNum).NumOfSpeeds = 2; - DXCoil(DXCoilNum).MSSecCoilAirFlow.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilRatedSHR.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilSHRFT.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - DXCoil(DXCoilNum).MSSecCoilSHRFF.allocate(DXCoil(DXCoilNum).NumOfSpeeds); - - DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; - DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedHeating; - DXCoil(DXCoilNum).MinOATCompressor = -5.0; - DXCoil(DXCoilNum).TotalHeatingEnergyRate = 5500.0; - DXCoil(DXCoilNum).ElecHeatingPower = 500.0; - DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; - DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; - - DXCoil(DXCoilNum).SecZonePtr = 1; + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds = 2; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF.allocate(state->dataDXCoils->DXCoil(DXCoilNum).NumOfSpeeds); + + state->dataDXCoils->DXCoil(DXCoilNum).IsSecondaryDXCoilInZone = true; + state->dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num = CoilDX_MultiSpeedHeating; + state->dataDXCoils->DXCoil(DXCoilNum).MinOATCompressor = -5.0; + state->dataDXCoils->DXCoil(DXCoilNum).TotalHeatingEnergyRate = 5500.0; + state->dataDXCoils->DXCoil(DXCoilNum).ElecHeatingPower = 500.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate = 0.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSensibleHeatRemovalRate = 0.0; + state->dataDXCoils->DXCoil(DXCoilNum).SecCoilLatentHeatRemovalRate = 0.0; + + state->dataDXCoils->DXCoil(DXCoilNum).SecZonePtr = 1; Node.allocate(2); ZT.allocate(1); ZoneAirHumRat.allocate(1); ZT(1) = 10.0; ZoneAirHumRat(1) = 0.003; - DXCoil(DXCoilNum).MSSecCoilAirFlow(1) = 1.0; - DXCoil(DXCoilNum).MSSecCoilAirFlow(2) = 1.0; - DXCoil(DXCoilNum).MSSecCoilSHRFT(1) = 0; - DXCoil(DXCoilNum).MSSecCoilSHRFF(1) = 0; - DXCoil(DXCoilNum).MSSecCoilSHRFT(2) = 0; - DXCoil(DXCoilNum).MSSecCoilSHRFF(2) = 0; - DXCoil(DXCoilNum).MSSecCoilRatedSHR(1) = 1.0; - DXCoil(DXCoilNum).MSSecCoilRatedSHR(2) = 1.0; - - DXCoil(DXCoilNum).MSSpeedRatio = 0; - DXCoil(DXCoilNum).MSCycRatio = 1; - DXCoil(DXCoilNum).MSSpeedNumHS = 1; - DXCoil(DXCoilNum).MSSpeedNumLS = 1; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(1) = 1.0; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(2) = 1.0; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(1) = 0; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF(1) = 0; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(2) = 0; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF(2) = 0; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR(1) = 1.0; + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR(2) = 1.0; + + state->dataDXCoils->DXCoil(DXCoilNum).MSSpeedRatio = 0; + state->dataDXCoils->DXCoil(DXCoilNum).MSCycRatio = 1; + state->dataDXCoils->DXCoil(DXCoilNum).MSSpeedNumHS = 1; + state->dataDXCoils->DXCoil(DXCoilNum).MSSpeedNumLS = 1; state->dataEnvrn->OutBaroPress = 101325.0; - DXCoil(DXCoilNum).AirInNode = 2; - Node(DXCoil(DXCoilNum).AirInNode).Temp = 20.0; + state->dataDXCoils->DXCoil(DXCoilNum).AirInNode = 2; + Node(state->dataDXCoils->DXCoil(DXCoilNum).AirInNode).Temp = 20.0; InitializePsychRoutines(); CalcSecondaryDXCoils(*state, DXCoilNum); - EXPECT_DOUBLE_EQ(-5000.0, DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); - EXPECT_DOUBLE_EQ(1.0, DXCoil(DXCoilNum).SecCoilSHR); + EXPECT_DOUBLE_EQ(-5000.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); + EXPECT_DOUBLE_EQ(1.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilSHR); // cleanup - DXCoil(DXCoilNum).MSSecCoilAirFlow.deallocate(); - DXCoil(DXCoilNum).MSSecCoilRatedSHR.deallocate(); - DXCoil(DXCoilNum).MSSecCoilSHRFT.deallocate(); - DXCoil(DXCoilNum).MSSecCoilSHRFF.deallocate(); - DXCoil.deallocate(); + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow.deallocate(); + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilRatedSHR.deallocate(); + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT.deallocate(); + state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFF.deallocate(); + state->dataDXCoils->DXCoil.deallocate(); Node.deallocate(); } diff --git a/tst/EnergyPlus/unit/StandardRatings.unit.cc b/tst/EnergyPlus/unit/StandardRatings.unit.cc index 5ddb449a455..a6bb6827af1 100644 --- a/tst/EnergyPlus/unit/StandardRatings.unit.cc +++ b/tst/EnergyPlus/unit/StandardRatings.unit.cc @@ -75,24 +75,23 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) { // Test that the standard ratings calculation with negative curve value - using DXCoils::DXCoil; using Psychrometrics::PsyRhoAirFnPbTdbW; using StandardRatings::SingleSpeedDXHeatingCoilStandardRatings; // Set up heating coil and curves. int DXCoilNum; - NumDXCoils = 1; + state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; - DXCoil.allocate(NumDXCoils); - DXCoilNumericFields.allocate(1); - DXCoilOutletTemp.allocate(NumDXCoils); - DXCoilOutletHumRat.allocate(NumDXCoils); - DXCoilFanOpMode.allocate(NumDXCoils); - DXCoilPartLoadRatio.allocate(NumDXCoils); - DXCoilTotalHeating.allocate(NumDXCoils); - DXCoilHeatInletAirDBTemp.allocate(NumDXCoils); - DXCoilHeatInletAirWBTemp.allocate(NumDXCoils); - DXCoilData &Coil = DXCoil(DXCoilNum); + state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilNumericFields.allocate(1); + state->dataDXCoils->DXCoilOutletTemp.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilOutletHumRat.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilFanOpMode.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilPartLoadRatio.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilTotalHeating.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilHeatInletAirDBTemp.allocate(state->dataDXCoils->NumDXCoils); + state->dataDXCoils->DXCoilHeatInletAirWBTemp.allocate(state->dataDXCoils->NumDXCoils); + DXCoilData &Coil = state->dataDXCoils->DXCoil(DXCoilNum); Coil.Name = "DX Single Speed Heating Coil"; Coil.DXCoilType = "Coil:Heating:DX:SingleSpeed"; @@ -451,7 +450,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_SEERValueTest) GetDXCoils(*state); - auto &thisCoil(DXCoils::DXCoil(1)); + auto &thisCoil(state->dataDXCoils->DXCoil(1)); auto &thisCoolPLFfPLR(state->dataCurveManager->PerfCurve(thisCoil.PLFFPLR(1))); // ckeck user PLF curve coefficients EXPECT_EQ(0.90, thisCoolPLFfPLR.Coeff1); @@ -724,7 +723,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_SEERValueTest) GetDXCoils(*state); - auto &thisCoil(DXCoils::DXCoil(1)); + auto &thisCoil(state->dataDXCoils->DXCoil(1)); auto &thisCoolPLFfPLR(state->dataCurveManager->PerfCurve(thisCoil.MSPLFFPLR(1))); // ckeck user PLF curve coefficients EXPECT_EQ(0.90, thisCoolPLFfPLR.Coeff1); diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index f43ff67eb60..0ce126f7600 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -4751,8 +4751,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) state->dataEnvrn->OutHumRat = 0.1; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->OutWetBulbTemp = 30.0; - DXCoils::DXCoil(1).RatedCBF(1) = 0.1; // autosizing is disabled so initialize coil bypass factor - DXCoils::DXCoil(1).RatedAirMassFlowRate(1) = 1.9268939689375426; // autosizing is disabled so initialize cooling coil rated air mass flow rate + state->dataDXCoils->DXCoil(1).RatedCBF(1) = 0.1; // autosizing is disabled so initialize coil bypass factor + state->dataDXCoils->DXCoil(1).RatedAirMassFlowRate(1) = 1.9268939689375426; // autosizing is disabled so initialize cooling coil rated air mass flow rate thisSys->simulate(*state, thisSys->Name, @@ -7498,7 +7498,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilSizing) EXPECT_EQ(thisSys->m_DesignHeatingCapacity * 0.00005, thisSys->m_MaxHeatAirVolFlow); EXPECT_EQ(thisSys->m_DesignCoolingCapacity * 0.00005, thisSys->m_MaxCoolAirVolFlow); - EXPECT_EQ(thisSys->m_DesignCoolingCapacity, DXCoils::DXCoil(thisSys->m_CoolingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedCooling)); + EXPECT_EQ(thisSys->m_DesignCoolingCapacity, state->dataDXCoils->DXCoil(thisSys->m_CoolingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedCooling)); // 64-bit MSVS shows these next variables as identical yet other compilers show diff's, changing ASSERT_EQ to EXPECT_NEAR EXPECT_NEAR(thisSys->m_DesignHeatingCapacity, state->dataVariableSpeedCoils->VarSpeedCoil(thisSys->m_HeatingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedHeating), @@ -7506,23 +7506,23 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilSizing) // 3 cooling speeds with autosized MSHP design spec yielding equally distributed air flow at 1/3 per speed EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[1], 0.032774, 0.000001); - EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_CoolVolumeFlowRate[1], 0.000001); + EXPECT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_CoolVolumeFlowRate[1], 0.000001); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[2], 0.065549, 0.000001); - EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_CoolVolumeFlowRate[2], 0.000001); + EXPECT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_CoolVolumeFlowRate[2], 0.000001); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[3], 0.098323, 0.000001); - EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_CoolVolumeFlowRate[3], 0.000001); + EXPECT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_CoolVolumeFlowRate[3], 0.000001); EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], 0.333333, 0.000001); EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], 0.666666, 0.000001); EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], 1.000000, 0.000001); - EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(1), + EXPECT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], 0.000001); - EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(2), + EXPECT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], 0.000001); - EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(3), + EXPECT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], 0.000001); @@ -9170,18 +9170,18 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXHeatingCoilOnly) ASSERT_NEAR(thisSys->m_DesignHeatingCapacity, 1303.091, 0.001); ASSERT_EQ(thisSys->m_DesignCoolingCapacity, 0.0); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedTotCap(1), 325.773, 0.001); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedTotCap(2), 651.545, 0.001); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedTotCap(3), 977.318, 0.001); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedTotCap(4), 1303.091, 0.001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedTotCap(1), 325.773, 0.001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedTotCap(2), 651.545, 0.001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedTotCap(3), 977.318, 0.001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedTotCap(4), 1303.091, 0.001); ASSERT_NEAR(thisSys->m_HeatVolumeFlowRate[1], 0.0131, 0.0001); ASSERT_NEAR(thisSys->m_HeatVolumeFlowRate[2], 0.0262, 0.0001); ASSERT_NEAR(thisSys->m_HeatVolumeFlowRate[3], 0.0393, 0.0001); ASSERT_NEAR(thisSys->m_HeatVolumeFlowRate[4], 0.0524, 0.0001); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(1), 0.0131, 0.0001); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(2), 0.0262, 0.0001); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(3), 0.0393, 0.0001); - ASSERT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(4), 0.0524, 0.0001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1), 0.0131, 0.0001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2), 0.0262, 0.0001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(3), 0.0393, 0.0001); + ASSERT_NEAR(state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(4), 0.0524, 0.0001); } TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) @@ -9996,29 +9996,29 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * state->dataEnvrn->StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; - DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; - DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; Iter = 1; thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * state->dataEnvrn->StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; - DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; - DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; Iter = 2; thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * state->dataEnvrn->StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; - DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; - DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; Iter = 3; thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * state->dataEnvrn->StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; - DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; - DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; + state->dataDXCoils->DXCoil(2).MSRatedAirMassFlowRate(Iter) = state->dataDXCoils->DXCoil(2).MSRatedAirVolFlowRate(Iter) * state->dataEnvrn->StdRhoAir; Iter = 4; thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; @@ -11042,15 +11042,15 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilHeatRecoveryHandlin DataZoneEquipment::ZoneEquipInputsFilled = true; thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - ASSERT_FALSE(DXCoils::DXCoil(1).MSHPHeatRecActive); // electricity - ASSERT_TRUE(DXCoils::DXCoil(2).MSHPHeatRecActive); // natural gas + ASSERT_FALSE(state->dataDXCoils->DXCoil(1).MSHPHeatRecActive); // electricity + ASSERT_TRUE(state->dataDXCoils->DXCoil(2).MSHPHeatRecActive); // natural gas // Minimum Outdoor Temperature for Compressor Operation blank field defaults to -25.0 C - EXPECT_EQ(DXCoils::DXCoil(1).MinOATCompressor, -25.0); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).MinOATCompressor, -25.0); // Minimum Outdoor Temperature for Compressor read from input field as -8.0 C - EXPECT_EQ(DXCoils::DXCoil(2).MinOATCompressor, -8.0); + EXPECT_EQ(state->dataDXCoils->DXCoil(2).MinOATCompressor, -8.0); // Unitary System mines data from coil objects - EXPECT_EQ(DXCoils::DXCoil(1).MinOATCompressor, thisSys->m_MinOATCompressorCooling); - EXPECT_EQ(DXCoils::DXCoil(2).MinOATCompressor, thisSys->m_MinOATCompressorHeating); + EXPECT_EQ(state->dataDXCoils->DXCoil(1).MinOATCompressor, thisSys->m_MinOATCompressorCooling); + EXPECT_EQ(state->dataDXCoils->DXCoil(2).MinOATCompressor, thisSys->m_MinOATCompressorHeating); } TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) @@ -12720,7 +12720,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_AllFlowFieldsBlankInputTest) EXPECT_TRUE(thisSys->m_CoolCoilExists); EXPECT_TRUE(thisSys->m_HeatCoilExists); - auto &thisClgCoil = DXCoils::DXCoil(1); + auto &thisClgCoil = state->dataDXCoils->DXCoil(1); auto &thisHtgCoil = HeatingCoils::HeatingCoil(1); EXPECT_EQ(thisClgCoil.RatedTotCap(1), DataSizing::AutoSize); diff --git a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc index b1f3626ef1e..ccc9ec4a4e7 100644 --- a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc +++ b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc @@ -728,7 +728,7 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance) WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(1); WaterThermalTanks::HeatPumpWaterHeaterData &HPWH = state->dataWaterThermalTanks->HPWaterHeater(Tank.HeatPumpNum); - DXCoils::DXCoilData &Coil = DXCoils::DXCoil(HPWH.DXCoilNum); + DXCoils::DXCoilData &Coil = state->dataDXCoils->DXCoil(HPWH.DXCoilNum); Tank.Node(1).SavedTemp = 51.190278176501131; Tank.Node(2).SavedTemp = 51.190445301209223; Tank.Node(3).SavedTemp = 51.190593898651336; @@ -1042,7 +1042,7 @@ TEST_F(EnergyPlusFixture, HPWHSizing) DataHeatBalFanSys::MAT(1) = 20.0; WaterThermalTanks::SimHeatPumpWaterHeater(*state, "Zone4HeatPumpWaterHeater", true, SenseLoadMet, LatLoadMet, CompIndex); EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, state->dataWaterThermalTanks->HPWaterHeater(1).OperatingAirFlowRate); - EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, DXCoils::DXCoil(1).RatedAirVolFlowRate(1)); + EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1)); } TEST_F(EnergyPlusFixture, WaterThermalTank_CalcTempIntegral) @@ -1411,7 +1411,7 @@ TEST_F(EnergyPlusFixture, HPWHTestSPControl) DataHVACGlobals::HPWHInletDBTemp = 30.0; state->dataEnvrn->WaterMainsTemp = 40.0; DataHVACGlobals::DXCoilTotalCapacity = 3500.0; - DXCoils::HPWHHeatingCapacity = 4000.0; + state->dataDXCoils->HPWHHeatingCapacity = 4000.0; DataLoopNode::Node(3).Temp = 30.0; DataLoopNode::Node(3).HumRat = 0.01; @@ -2177,7 +2177,6 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) using DataHVACGlobals::SysTimeElapsed; using DataHVACGlobals::TimeStepSys; using DataLoopNode::Node; - using DXCoils::DXCoil; std::string const idf_objects = delimited_string({ "Schedule:Constant, Hot Water Demand Schedule, , 1.0;", @@ -2410,7 +2409,7 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) Desuperheater.SetPointTemp = 55; Desuperheater.Mode = 1; DataHeatBalance::HeatReclaimDXCoil(DXNum).AvailCapacity = 0; - DXCoil(DXNum).PartLoadRatio = 1.0; + state->dataDXCoils->DXCoil(DXNum).PartLoadRatio = 1.0; Tank.Mode = 0; Tank.SetPointTemp = 50; @@ -2721,7 +2720,6 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) using DataHVACGlobals::SysTimeElapsed; using DataHVACGlobals::TimeStepSys; using DataLoopNode::Node; - using DXCoils::DXCoil; std::string const idf_objects = delimited_string({ "Schedule:Constant, Hot Water Demand Schedule, , 1.0;", @@ -3022,25 +3020,25 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->OutWetBulbTemp = Psychrometrics::PsyTwbFnTdbWPb(*state, 32.0, 0.02, 101325.0); - DXCoil(1).MSRatedAirMassFlowRate(1) = DXCoil(1).MSRatedAirVolFlowRate(1) * 1.2; - DXCoil(1).MSRatedAirMassFlowRate(2) = DXCoil(1).MSRatedAirVolFlowRate(2) * 1.2; - DXCoil(1).InletAirMassFlowRate = DXCoil(1).MSRatedAirMassFlowRate(2); - DataHVACGlobals::MSHPMassFlowRateLow = DXCoil(1).MSRatedAirMassFlowRate(1); - DataHVACGlobals::MSHPMassFlowRateHigh = DXCoil(1).MSRatedAirMassFlowRate(2); + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(1) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(1) * 1.2; + state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(2) = state->dataDXCoils->DXCoil(1).MSRatedAirVolFlowRate(2) * 1.2; + state->dataDXCoils->DXCoil(1).InletAirMassFlowRate = state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(2); + DataHVACGlobals::MSHPMassFlowRateLow = state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(1); + DataHVACGlobals::MSHPMassFlowRateHigh = state->dataDXCoils->DXCoil(1).MSRatedAirMassFlowRate(2); - DXCoil(1).InletAirTemp = 27.0; - DXCoil(1).InletAirHumRat = 0.005; - DXCoil(1).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(27.0, 0.005); - DXCoil(1).SchedPtr = 1; - ScheduleManager::Schedule(DXCoil(1).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser - DXCoil(1).MSRatedCBF(1) = 0.1262; - DXCoil(1).MSRatedCBF(2) = 0.0408; + state->dataDXCoils->DXCoil(1).InletAirTemp = 27.0; + state->dataDXCoils->DXCoil(1).InletAirHumRat = 0.005; + state->dataDXCoils->DXCoil(1).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(27.0, 0.005); + state->dataDXCoils->DXCoil(1).SchedPtr = 1; + ScheduleManager::Schedule(state->dataDXCoils->DXCoil(1).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser + state->dataDXCoils->DXCoil(1).MSRatedCBF(1) = 0.1262; + state->dataDXCoils->DXCoil(1).MSRatedCBF(2) = 0.0408; // Calculate multispeed DX cooling coils DXCoils::CalcMultiSpeedDXCoilCooling(*state, DXNum, 1, 1, 2, 1, 1, 1); // Source availably heat successfully passed to DataHeatBalance::HeatReclaimDXCoil data struct - EXPECT_EQ(DataHeatBalance::HeatReclaimDXCoil(DXNum).AvailCapacity, DXCoil(DXNum).TotalCoolingEnergyRate + DXCoil(DXNum).ElecCoolingPower); + EXPECT_EQ(DataHeatBalance::HeatReclaimDXCoil(DXNum).AvailCapacity, state->dataDXCoils->DXCoil(DXNum).TotalCoolingEnergyRate + state->dataDXCoils->DXCoil(DXNum).ElecCoolingPower); // Now move to the water thermal tank calculation WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); @@ -3068,7 +3066,7 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) Desuperheater.FirstTimeThroughFlag = true; Tank.CalcDesuperheaterWaterHeater(*state, true); - EXPECT_EQ(Desuperheater.DXSysPLR, DXCoil(DXNum).PartLoadRatio); + EXPECT_EQ(Desuperheater.DXSysPLR, state->dataDXCoils->DXCoil(DXNum).PartLoadRatio); // if desuperheater was not on through all the timestep, part load ratio is searched to meet load demand EXPECT_GE(Desuperheater.DXSysPLR, Desuperheater.DesuperheaterPLR); // used desuperheater reclaim heat is successfully stored in HeatReclaimDXCoil data struct @@ -3409,7 +3407,6 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) using DataHVACGlobals::SysTimeElapsed; using DataHVACGlobals::TimeStepSys; using DataLoopNode::Node; - using DXCoils::DXCoil; std::string const idf_objects = delimited_string({ "Schedule:Constant, Hot Water Demand Schedule, , 1.0;", @@ -3698,7 +3695,7 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) } DataHeatBalance::HeatReclaimDXCoil(DXNum).AvailCapacity = 500; - DXCoil(DXNum).PartLoadRatio = 1.0; + state->dataDXCoils->DXCoil(DXNum).PartLoadRatio = 1.0; // first tank heat reclaim // Call desuperheater calculation function @@ -4419,7 +4416,7 @@ TEST_F(EnergyPlusFixture, CrashCalcStandardRatings_HPWH_and_Standalone) DataHVACGlobals::HPWHInletDBTemp = 30.0; state->dataEnvrn->WaterMainsTemp = 40.0; DataHVACGlobals::DXCoilTotalCapacity = 3500.0; - DXCoils::HPWHHeatingCapacity = 4000.0; + state->dataDXCoils->HPWHHeatingCapacity = 4000.0; DataLoopNode::Node(3).Temp = 30.0; DataLoopNode::Node(3).HumRat = 0.01; @@ -4443,7 +4440,7 @@ TEST_F(EnergyPlusFixture, CrashCalcStandardRatings_HPWH_and_Standalone) DataHVACGlobals::HPWHInletDBTemp = 30.0; state->dataEnvrn->WaterMainsTemp = 40.0; DataHVACGlobals::DXCoilTotalCapacity = 3500.0; - DXCoils::HPWHHeatingCapacity = 4000.0; + state->dataDXCoils->HPWHHeatingCapacity = 4000.0; DataLoopNode::Node(3).Temp = 30.0; DataLoopNode::Node(3).HumRat = 0.01;